diff --git a/board/raspberrypi/overlay/etc/init.d/S13btuart b/board/raspberrypi/overlay/etc/init.d/S13btuart new file mode 100755 index 0000000000..6899065c82 --- /dev/null +++ b/board/raspberrypi/overlay/etc/init.d/S13btuart @@ -0,0 +1,43 @@ +#!/bin/bash + +sys_conf="/etc/bluetooth.conf" +boot_conf="/boot/bluetooth.conf" +conf="/data/etc/bluetooth.conf" + +test -f $conf || test -f $boot_conf || test -f $sys_conf || exit 0 + +test -n "$os_version" || source /etc/init.d/base + +function start() { + if [ "$(cat /proc/device-tree/aliases/uart0)" = "$(cat /proc/device-tree/aliases/serial1)" ] ; then + if [ "$(wc -c /proc/device-tree/soc/gpio@7e200000/uart0_pins/brcm\,pins | cut -f 1 -d ' ')" = " 16" ] ; then + /usr/bin/hciattach -t5 /dev/serial1 bcm43xx 3000000 flow - &>/dev/null + else + /usr/bin/hciattach -t5 /dev/serial1 bcm43xx 921600 noflow - &>/dev/null + fi + else + /usr/bin/hciattach -t5 /dev/serial1 bcm43xx 460800 noflow - &>/dev/null + fi +} + +case "$1" in + start) + msg_begin "Attaching UART bluetooth modem" + # for some reason, sometimes the hciattach command needs to be run twice + (start || start) &>/dev/null & + msg_background + ;; + + stop) + msg_begin "Detaching UART bluetooth modem" + killall hciattach &>/dev/null + test $? == 0 && msg_done || msg_fail + ;; + + *) + echo $"Usage: $0 {start}" + exit 1 +esac + +exit $? + diff --git a/board/raspberrypi/overlay/etc/udev/rules.d/99-com.rules b/board/raspberrypi/overlay/etc/udev/rules.d/99-com.rules new file mode 100644 index 0000000000..a964057230 --- /dev/null +++ b/board/raspberrypi/overlay/etc/udev/rules.d/99-com.rules @@ -0,0 +1,32 @@ +SUBSYSTEM=="input", GROUP="input", MODE="0660" +SUBSYSTEM=="i2c-dev", GROUP="i2c", MODE="0660" +SUBSYSTEM=="spidev", GROUP="spi", MODE="0660" +SUBSYSTEM=="bcm2835-gpiomem", GROUP="gpio", MODE="0660" + +SUBSYSTEM=="gpio*", PROGRAM="/bin/sh -c '\ + chown -R root:gpio /sys/class/gpio && chmod -R 770 /sys/class/gpio;\ + chown -R root:gpio /sys/devices/virtual/gpio && chmod -R 770 /sys/devices/virtual/gpio;\ + chown -R root:gpio /sys$devpath && chmod -R 770 /sys$devpath\ +'" + +KERNEL=="ttyAMA[01]", PROGRAM="/bin/sh -c '\ + ALIASES=/proc/device-tree/aliases; \ + if cmp -s $ALIASES/uart0 $ALIASES/serial0; then \ + echo 0;\ + elif cmp -s $ALIASES/uart0 $ALIASES/serial1; then \ + echo 1; \ + else \ + exit 1; \ + fi\ +'", SYMLINK+="serial%c" + +KERNEL=="ttyS0", PROGRAM="/bin/sh -c '\ + ALIASES=/proc/device-tree/aliases; \ + if cmp -s $ALIASES/uart1 $ALIASES/serial0; then \ + echo 0; \ + elif cmp -s $ALIASES/uart1 $ALIASES/serial1; then \ + echo 1; \ + else \ + exit 1; \ + fi \ +'", SYMLINK+="serial%c" diff --git a/board/raspberrypi/overlay/lib/firmware/BCM43430A1.hcd b/board/raspberrypi/overlay/lib/firmware/BCM43430A1.hcd new file mode 100644 index 0000000000..162275ac0b Binary files /dev/null and b/board/raspberrypi/overlay/lib/firmware/BCM43430A1.hcd differ diff --git a/board/raspberrypi/overlay/usr/bin/hciattach b/board/raspberrypi/overlay/usr/bin/hciattach new file mode 100755 index 0000000000..468a3342a6 Binary files /dev/null and b/board/raspberrypi/overlay/usr/bin/hciattach differ