balena-allwinner/layers/meta-balena-allwinner/recipes-bsp/nanopi-air-bt/nanopi-air-bt/nanopi-air-bt-start
Florin Sarbu a6654dc76d Rename meta-resin to meta-balena in repository
Changelog-entry: Rename meta-resin to meta-balena in repository
Signed-off-by: Florin Sarbu <florin@balena.io>
2019-09-10 15:42:22 +02:00

24 lines
671 B
Bash
Executable file

#!/bin/sh
if [ $# -lt 1 ]; then
echo "Interface argument missing ... /dev/ttyX"
exit 1
fi
echo 205 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio205/direction
# Reset BT
echo "Resetting BT chip"
echo 0 > /sys/class/gpio/gpio205/value
echo 1 > /sys/class/gpio/gpio205/value
CHIP_REV=`dmesg | grep brcmfm | grep "chip 0x00a9a6" | awk '{print $11}'`
BT_FIRMWARE="bcm43438a0.hcd" # AP6212 chip
if [ "$CHIP_REV" = "0x000001" ]; then
BT_FIRMWARE="bcm43438a1.hcd" # AP6212A chip
fi
/usr/bin/brcm_patchram_plus -d --patchram /lib/firmware/brcm/$BT_FIRMWARE --no2bytes --tosleep 5000 $1 > /tmp/brcm_log 2>&1
hciattach -n $1 bcm43xx 115200 flow