From 8f52b3e590811ca645c13219d9b9a9191476aec3 Mon Sep 17 00:00:00 2001 From: Koen Kooi Date: Wed, 4 Jun 2008 14:55:31 +0000 Subject: angstrom led config: initscript that applies led config from /etc/default/leds --- packages/angstrom/angstrom-led-config.bb | 30 +++++++++++++++++++++ .../angstrom/angstrom-led-config/.mtn2git_empty | 0 .../angstrom-led-config/beagleboard/.mtn2git_empty | 0 .../angstrom/angstrom-led-config/beagleboard/leds | 3 +++ packages/angstrom/angstrom-led-config/led-config | 31 ++++++++++++++++++++++ packages/angstrom/angstrom-led-config/leds | 1 + 6 files changed, 65 insertions(+) create mode 100644 packages/angstrom/angstrom-led-config.bb create mode 100644 packages/angstrom/angstrom-led-config/.mtn2git_empty create mode 100644 packages/angstrom/angstrom-led-config/beagleboard/.mtn2git_empty create mode 100644 packages/angstrom/angstrom-led-config/beagleboard/leds create mode 100755 packages/angstrom/angstrom-led-config/led-config create mode 100644 packages/angstrom/angstrom-led-config/leds diff --git a/packages/angstrom/angstrom-led-config.bb b/packages/angstrom/angstrom-led-config.bb new file mode 100644 index 0000000000..a0a29cbb3c --- /dev/null +++ b/packages/angstrom/angstrom-led-config.bb @@ -0,0 +1,30 @@ +DESCRIPTION = "Configuration files for runtime LED configuration" + +#PV = "${DISTRO_VERSION}" +PR = "r0" +PACKAGE_ARCH = "${MACHINE_ARCH}" + +inherit update-rc.d +INITSCRIPT_NAME = "led-config" + +SRC_URI = "file://led-config \ + file://leds \ + " + +do_compile() { + : +} + + +do_install () { + install -d ${D}/${sysconfdir}/default + install -d ${D}/${INIT_D_DIR} + + install -m 0644 ${WORKDIR}/leds ${D}/${sysconfdir}/default/ + install -m 0755 ${WORKDIR}/led-config ${D}/${INIT_D_DIR} +} + +CONFFILES_${PN} += "${sysconfdir}/default/leds \ + ${INIT_D_DIR}/led-config \ + " + diff --git a/packages/angstrom/angstrom-led-config/.mtn2git_empty b/packages/angstrom/angstrom-led-config/.mtn2git_empty new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/angstrom/angstrom-led-config/beagleboard/.mtn2git_empty b/packages/angstrom/angstrom-led-config/beagleboard/.mtn2git_empty new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/angstrom/angstrom-led-config/beagleboard/leds b/packages/angstrom/angstrom-led-config/beagleboard/leds new file mode 100644 index 0000000000..19c73ebcf3 --- /dev/null +++ b/packages/angstrom/angstrom-led-config/beagleboard/leds @@ -0,0 +1,3 @@ +#file format: name trigger +beagleboard::led0 mmc0 +beagleboard::led1 nand-disk diff --git a/packages/angstrom/angstrom-led-config/led-config b/packages/angstrom/angstrom-led-config/led-config new file mode 100755 index 0000000000..63d52d6cd0 --- /dev/null +++ b/packages/angstrom/angstrom-led-config/led-config @@ -0,0 +1,31 @@ +#! /bin/sh + +if [ -e /sys/class/leds/ ] ; then + +case "$1" in + start) + echo "Configuring leds:" + for led in /sys/class/leds/* ; do + trigger=$(grep "$(basename $led)" /etc/default/leds | awk '{print $2}') + if [ "x$trigger" = "x" ] ; then trigger="none" ; fi + echo " $(basename $led): $trigger" + echo "$trigger" > "$led/trigger" + done +;; + stop) + echo "Deconfiguring leds:" + for led in /sys/class/leds/* ; do + echo " $(basename $led): no trigger" + echo "none" > "$led/trigger" + done + ;; + *) + echo "Usage: /etc/init.d/led-config {start|stop}" + exit 1 +esac + +else + echo "No LEDs detected" +fi + +exit 0 diff --git a/packages/angstrom/angstrom-led-config/leds b/packages/angstrom/angstrom-led-config/leds new file mode 100644 index 0000000000..7de8a2e3ae --- /dev/null +++ b/packages/angstrom/angstrom-led-config/leds @@ -0,0 +1 @@ +#file format: name trigger -- cgit v1.2.3