1#!/bin/bash 2 3killall brcm_patchram_plus1 4 5echo 0 > /sys/class/rfkill/rfkill0/state 6echo 0 > /proc/bluetooth/sleep/btwrite 7sleep 2 8echo 1 > /sys/class/rfkill/rfkill0/state 9echo 1 > /proc/bluetooth/sleep/btwrite 10sleep 2 11 12COMPATIBLE=$(cat /proc/device-tree/compatible) 13 14if [[ $(expr $COMPATIBLE : ".*rk3588") -ne 0 ]]; then 15brcm_patchram_plus1 --bd_addr_rand --enable_hci --no2bytes --use_baudrate_for_download --tosleep 200000 --baudrate 1500000 --patchram /system/etc/firmware/ /dev/ttyS8 & 16hciconfig hci0 up 17sleep 1 18elif [[ $(expr $COMPATIBLE : ".*rk3568") -ne 0 ]]; then 19brcm_patchram_plus1 --bd_addr_rand --enable_hci --no2bytes --use_baudrate_for_download --tosleep 200000 --baudrate 1500000 --patchram /system/etc/firmware/ /dev/ttyS8 & 20hciconfig hci0 up 21sleep 1 22elif [[ $(expr $COMPATIBLE : ".*rk3566") -ne 0 ]]; then 23brcm_patchram_plus1 --bd_addr_rand --enable_hci --no2bytes --use_baudrate_for_download --tosleep 200000 --baudrate 1500000 --patchram /system/etc/firmware/ /dev/ttyS0 & 24hciconfig hci0 up 25sleep 1 26elif [[ $(expr $COMPATIBLE : ".*rk3562") -ne 0 ]]; then 27brcm_patchram_plus1 --bd_addr_rand --enable_hci --no2bytes --use_baudrate_for_download --tosleep 200000 --baudrate 1500000 --patchram /system/etc/firmware/ /dev/ttyS1 & 28hciconfig hci0 up 29sleep 1 30elif [[ $(expr $COMPATIBLE : ".*rk3399") -ne 0 ]]; then 31brcm_patchram_plus1 --bd_addr_rand --enable_hci --no2bytes --use_baudrate_for_download --tosleep 200000 --baudrate 1500000 --patchram /system/etc/firmware/ /dev/ttyS0 & 32hciconfig hci0 up 33sleep 1 34elif [[ $(expr $COMPATIBLE : ".*rk3288") -ne 0 ]]; then 35brcm_patchram_plus1 --bd_addr_rand --enable_hci --no2bytes --use_baudrate_for_download --tosleep 200000 --baudrate 1500000 --patchram /system/etc/firmware/ /dev/ttyS0 & 36hciconfig hci0 up 37sleep 1 38elif [[ $(expr $COMPATIBLE : ".*rk3326") -ne 0 ]]; then 39brcm_patchram_plus1 --bd_addr_rand --enable_hci --no2bytes --use_baudrate_for_download --tosleep 200000 --baudrate 1500000 --patchram /system/etc/firmware/ /dev/ttyS1 & 40hciconfig hci0 up 41sleep 1 42elif [[ $(expr $COMPATIBLE : ".*px30") -ne 0 ]]; then 43brcm_patchram_plus1 --bd_addr_rand --enable_hci --no2bytes --use_baudrate_for_download --tosleep 200000 --baudrate 1500000 --patchram /system/etc/firmware/ /dev/ttyS1 & 44hciconfig hci0 up 45sleep 1 46else 47brcm_patchram_plus1 --bd_addr_rand --enable_hci --no2bytes --use_baudrate_for_download --tosleep 200000 --baudrate 1500000 --patchram /system/etc/firmware/ /dev/ttyS0 & 48hciconfig hci0 up 49sleep 1 50fi 51