From 6e79dc833dd46e67db725225ea117fdfbf145ad0 Mon Sep 17 00:00:00 2001 From: Eddi De Pieri Date: Sat, 27 Jan 2018 10:04:23 +0100 Subject: [PATCH 1/2] Revert "fix bt on orangepiwin" This reverts commit 238072cb55009480c5170a9952d5ee1e83a74473. --- packages/bsp/common/etc/init.d/firstrun | 4 ++-- packages/extras/tools/brcm40183-patch | 11 +---------- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/packages/bsp/common/etc/init.d/firstrun b/packages/bsp/common/etc/init.d/firstrun index 1c4daa07b0..4129107744 100755 --- a/packages/bsp/common/etc/init.d/firstrun +++ b/packages/bsp/common/etc/init.d/firstrun @@ -36,10 +36,10 @@ case "$1" in # BT tweaks case ${BOARD} in - cubietruck|orangepiwin) + cubietruck) systemctl enable brcm40183-patch && service brcm40183-patch start ;; - bananapim2plus|nanopiair|nanopim1plus|orangepizeroplus2*|nanopineoplus2|nanopik2) + bananapim2plus|nanopiair|nanopim1plus|orangepizeroplus2*|orangepiwin|nanopineoplus2|nanopik2) update-rc.d ap6212-bluetooth defaults ;; cubox-i) diff --git a/packages/extras/tools/brcm40183-patch b/packages/extras/tools/brcm40183-patch index 23abf9984a..33c853771e 100644 --- a/packages/extras/tools/brcm40183-patch +++ b/packages/extras/tools/brcm40183-patch @@ -21,7 +21,6 @@ fi # exit if bluetooth utils are not installed [ -f "/bin/hciconfig" ] || exit 0 -. /etc/armbian-release . /lib/lsb/init-functions do_start () { @@ -46,16 +45,8 @@ else PORT="ttyS1" fi - case ${BOARD} in - "orangepiwin") - PATCHRAM="/lib/firmware/ap6212/bcm43438a1.hcd" - ;; - *) - PATCHRAM="/lib/firmware/ap6210/bcm20710a1.hcd" # Different port for mainline if [ `uname -r | grep -v '^3.4.' ` ]; then PORT="ttyS2"; fi - ;; - esac # reset port /usr/bin/brcm_bt_reset /dev/$PORT @@ -64,7 +55,7 @@ else /bin/echo -en "" > /dev/$PORT # pull down RTS on UART log_action_begin_msg "Start pushing firmware to device and waiting max. 60sec to complete" - /usr/bin/timeout 20s /usr/bin/brcm_patchram_plus -d --patchram $PATCHRAM -enable_hci --no2bytes --tosleep 1000 $MAC_OPTIONS /dev/$PORT > /tmp/brcm40183.firmware 2>&1 + /usr/bin/timeout 20s /usr/bin/brcm_patchram_plus -d --patchram /lib/firmware/ap6210/bcm20710a1.hcd --enable_hci --no2bytes --tosleep 1000 $MAC_OPTIONS /dev/$PORT > /tmp/brcm40183.firmware 2>&1 case "$?" in 0) log_action_end_msg 0 From 4da02059db8f0129619563c022c05fa188f821fc Mon Sep 17 00:00:00 2001 From: Eddi De Pieri Date: Sat, 27 Jan 2018 10:02:55 +0100 Subject: [PATCH 2/2] orangepi win can now use ap6212-bluetooth patch --- packages/extras/tools/ap6212-bluetooth | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/extras/tools/ap6212-bluetooth b/packages/extras/tools/ap6212-bluetooth index d4078a4edc..29ace36ff9 100644 --- a/packages/extras/tools/ap6212-bluetooth +++ b/packages/extras/tools/ap6212-bluetooth @@ -29,6 +29,11 @@ if [ -f "/lib/firmware/ap6212/bcm43438a0.hcd" ] && [ ! -f /etc/firmware/ap6212/4 fi +if [ -f "/lib/firmware/ap6212/bcm43438a1.hcd" ] && [ ! -f /etc/firmware/ap6212/BCM43430A1.hcd ]; then + mkdir -p /etc/firmware/ap6212 + cp /lib/firmware/ap6212/bcm43438a1.hcd /etc/firmware/ap6212/BCM43430A1.hcd +fi + . /lib/lsb/init-functions do_start () { @@ -54,7 +59,12 @@ then rfkill unblock all echo "0" > /sys/class/rfkill/rfkill0/state echo "1" > /sys/class/rfkill/rfkill0/state - echo " " > /dev/$PORT + #on orangepi win following command never ends on first try... force to run with a timeout... + timeout 5s echo " " > /dev/$PORT + if [ $? != 0 ]; then + #timed out... retry + echo " " > /dev/$PORT + fi hciattach /dev/$PORT bcm43xx 115200 flow bdaddr $MAC_OPTIONS hciconfig hci0 up fi