Added BT loader for Banana M2+

This commit is contained in:
Igor Pecovnik 2016-10-28 20:18:04 +02:00
parent 88e1cdc974
commit ca10632f28
3 changed files with 68 additions and 1 deletions

View File

@ -47,9 +47,12 @@ compile_tools()
# brcm
cp $tmpdir/brcm/{brcm_bt_reset,brcm_patchram_plus} $tmpdir/armbian-tools-${RELEASE}_${REVISION}_${ARCH}/usr/bin
# brcm configs and service
install -m 644 $SRC/lib/scripts/brcm40183 $tmpdir/armbian-tools-${RELEASE}_${REVISION}_${ARCH}/etc/default
install -m 644 $SRC/lib/scripts/brcm40183 $tmpdir/armbian-tools-${RELEASE}_${REVISION}_${ARCH}/etc/default
install -m 755 $SRC/lib/scripts/brcm40183-patch $tmpdir/armbian-tools-${RELEASE}_${REVISION}_${ARCH}/etc/init.d
# ap6212 BT
install -m 644 $SRC/lib/scripts/ap6212-bluetooth $tmpdir/armbian-tools-${RELEASE}_${REVISION}_${ARCH}/etc/init.d
cd $tmpdir/armbian-tools-${RELEASE}_${REVISION}_${ARCH}
find . -type f ! -regex '.*.hg.*' ! -regex '.*?debian-binary.*' ! -regex '.*?DEBIAN.*' -printf '%P ' | xargs md5sum > DEBIAN/md5sums
cd $tmpdir

61
scripts/ap6212-bluetooth Normal file
View File

@ -0,0 +1,61 @@
#! /bin/sh
### BEGIN INIT INFO
# Provides: ap6212-bluetooth
# Required-Start: $local_fs
# Required-Stop:
# X-Start-Before: bluetooth
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Patch firmware for ap6212 adapter
# Description: Patch firmware for ap6212 adapter
### END INIT INFO
# exit if bluetooth utils are not installed
[ -f "/bin/hciconfig" ] || exit 0
# copy firmware
if [ -f "/lib/firmware/ap6212/bcm43438a0.hcd" ] && [ ! -f /etc/firmware/ap6212/4343A0.hcd ]; then
mkdir -p /etc/firmware/ap6212
cp /lib/firmware/ap6212/bcm43438a0.hcd /etc/firmware/ap6212/4343A0.hcd
fi
. /lib/lsb/init-functions
do_start () {
if [ ! -z $(hciconfig | /bin/grep UART | /usr/bin/cut -d: -f1) ]
then
echo "ap6212 BT device allready initialized"
hcitool dev
else
# Start patching
rfkill unblock all
echo "0" > /sys/class/rfkill/rfkill0/state
echo "1" > /sys/class/rfkill/rfkill0/state
echo " " > /dev/ttyS1
hciattach /dev/ttyS1 bcm43xx 115200
hciconfig hci0 up
fi
}
case "$1" in
start)
do_start
;;
restart|reload|force-reload)
echo "Error: argument '$1' not supported" >&2
exit 3
;;
stop)
# No-op
;;
status)
hcitool dev
;;
*)
echo "Usage: ap6212-bluetooth [start|stop|status]" >&2
exit 3
;;
esac

View File

@ -84,6 +84,9 @@ collect_information() {
# enable BT on cubietruck
[[ "$BOARD" == "cubietruck" ]] && update-rc.d brcm40183-patch defaults
# enable BT on Banana M2+
[[ "$BOARD" == "bananapim2plus" ]] && update-rc.d ap6212-bluetooth defaults
# enable BT on Solidrun boards
[[ "$BOARD" == "Cubox i2eX/i4" ]] && update-rc.d brcm4330-patch defaults && /etc/init.d/brcm4330-patch start