summaryrefslogtreecommitdiffstats
path: root/meta-ti-extras/recipes-ti/beagleboard/beaglebone-capes
diff options
context:
space:
mode:
Diffstat (limited to 'meta-ti-extras/recipes-ti/beagleboard/beaglebone-capes')
-rwxr-xr-xmeta-ti-extras/recipes-ti/beagleboard/beaglebone-capes/cape-stop.sh14
-rw-r--r--meta-ti-extras/recipes-ti/beagleboard/beaglebone-capes/cape.service11
-rwxr-xr-xmeta-ti-extras/recipes-ti/beagleboard/beaglebone-capes/cape.sh22
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 @@
1#!/bin/sh
2for eeprom in /sys/bus/i2c/devices/3-005*/eeprom ; do
3 PARTNUMBER=$(hexdump -e '8/1 "%c"' $eeprom -s 58 -n16)
4 case $PARTNUMBER in
5 "BB-BONE-LCD3-01.")
6 echo "Turning off backlight for LCD3 cape"
7 i2cset -f -y 1 0x24 0x07 0x00;;
8 "BB-BONE-LCD4"*)
9 echo "Turning off backlight for LCD4 cape"
10 i2cset -f -y 1 0x24 0x07 0x00;;
11 *)
12 echo "unknown cape: $PARTNUMBER";;
13 esac
14done
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 @@
1[Unit]
2Description=Beaglebone cape support
3
4[Service]
5Type=oneshot
6RemainAfterExit=yes
7ExecStart=/usr/bin/cape.sh
8ExecStop=/usr/bin/cape-stop.sh
9
10[Install]
11WantedBy=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 @@
1#!/bin/sh
2for eeprom in /sys/bus/i2c/devices/3-005*/eeprom ; do
3 PARTNUMBER=$(hexdump -e '8/1 "%c"' $eeprom -s 58 -n16)
4 case $PARTNUMBER in
5 "BB-BONE-LCD3-01.")
6 echo "Turning on backlight for LCD3 cape"
7 i2cset -f -y 1 0x24 0x07 0x09
8 i2cset -f -y 1 0x24 0x08 0x60;;
9 "BB-BONE-LCD4"*)
10 echo "Turning on backlight for LCD4 cape"
11 i2cset -f -y 1 0x24 0x07 0x09
12 i2cset -f -y 1 0x24 0x08 0x60;;
13 "BB-BONE-WTHR-01.")
14 echo "Initializing I2C devices"
15 echo sht21 0x40 > /sys/class/i2c-adapter/i2c-3/new_device
16 echo bmp085 0x77 > /sys/class/i2c-adapter/i2c-3/new_device
17 echo tsl2550 0x39 > /sys/class/i2c-adapter/i2c-3/new_device
18 echo 1 > /sys/bus/i2c/devices/3-0039/operating_mode;;
19 *)
20 echo "unknown cape: $PARTNUMBER";;
21 esac
22done