diff options
Diffstat (limited to 'meta-ti-extras/recipes-ti/beagleboard/beaglebone-capes')
3 files changed, 47 insertions, 0 deletions
diff --git a/meta-ti-extras/recipes-ti/beagleboard/beaglebone-capes/cape-stop.sh b/meta-ti-extras/recipes-ti/beagleboard/beaglebone-capes/cape-stop.sh new file mode 100755 index 00000000..222a010d --- /dev/null +++ b/meta-ti-extras/recipes-ti/beagleboard/beaglebone-capes/cape-stop.sh @@ -0,0 +1,14 @@ +#!/bin/sh +for eeprom in /sys/bus/i2c/devices/3-005*/eeprom ; do + PARTNUMBER=$(hexdump -e '8/1 "%c"' $eeprom -s 58 -n16) + case $PARTNUMBER in + "BB-BONE-LCD3-01.") + echo "Turning off backlight for LCD3 cape" + i2cset -f -y 1 0x24 0x07 0x00;; + "BB-BONE-LCD4"*) + echo "Turning off backlight for LCD4 cape" + i2cset -f -y 1 0x24 0x07 0x00;; + *) + echo "unknown cape: $PARTNUMBER";; + esac +done diff --git a/meta-ti-extras/recipes-ti/beagleboard/beaglebone-capes/cape.service b/meta-ti-extras/recipes-ti/beagleboard/beaglebone-capes/cape.service new file mode 100644 index 00000000..ce0db719 --- /dev/null +++ b/meta-ti-extras/recipes-ti/beagleboard/beaglebone-capes/cape.service @@ -0,0 +1,11 @@ +[Unit] +Description=Beaglebone cape support + +[Service] +Type=oneshot +RemainAfterExit=yes +ExecStart=/usr/bin/cape.sh +ExecStop=/usr/bin/cape-stop.sh + +[Install] +WantedBy=basic.target diff --git a/meta-ti-extras/recipes-ti/beagleboard/beaglebone-capes/cape.sh b/meta-ti-extras/recipes-ti/beagleboard/beaglebone-capes/cape.sh new file mode 100755 index 00000000..c279349d --- /dev/null +++ b/meta-ti-extras/recipes-ti/beagleboard/beaglebone-capes/cape.sh @@ -0,0 +1,22 @@ +#!/bin/sh +for eeprom in /sys/bus/i2c/devices/3-005*/eeprom ; do + PARTNUMBER=$(hexdump -e '8/1 "%c"' $eeprom -s 58 -n16) + case $PARTNUMBER in + "BB-BONE-LCD3-01.") + echo "Turning on backlight for LCD3 cape" + i2cset -f -y 1 0x24 0x07 0x09 + i2cset -f -y 1 0x24 0x08 0x60;; + "BB-BONE-LCD4"*) + echo "Turning on backlight for LCD4 cape" + i2cset -f -y 1 0x24 0x07 0x09 + i2cset -f -y 1 0x24 0x08 0x60;; + "BB-BONE-WTHR-01.") + echo "Initializing I2C devices" + echo sht21 0x40 > /sys/class/i2c-adapter/i2c-3/new_device + echo bmp085 0x77 > /sys/class/i2c-adapter/i2c-3/new_device + echo tsl2550 0x39 > /sys/class/i2c-adapter/i2c-3/new_device + echo 1 > /sys/bus/i2c/devices/3-0039/operating_mode;; + *) + echo "unknown cape: $PARTNUMBER";; + esac +done |