OSDN Git Service

Support BT HCI UART devices
authorChih-Wei Huang <cwhuang@linux.org.tw>
Wed, 12 Oct 2016 12:50:06 +0000 (20:50 +0800)
committerChih-Wei Huang <cwhuang@linux.org.tw>
Wed, 12 Oct 2016 12:50:06 +0000 (20:50 +0800)
Set appropriate properties to start btattach service.

Add BT related tools and remove obsolete code for BlueZ.

init.sh
init.x86.rc
packages.mk

diff --git a/init.sh b/init.sh
index 2fbb8fe..05a503c 100644 (file)
--- a/init.sh
+++ b/init.sh
@@ -48,6 +48,7 @@ function init_hal_bluetooth()
        case "$PRODUCT" in
                T10*TA|HP*Omni*)
                        BTUART_PORT=/dev/ttyS1
+                       set_property hal.bluetooth.uart.proto bcm
                        ;;
                MacBookPro8*)
                        rmmod b43
@@ -68,15 +69,13 @@ function init_hal_bluetooth()
                        for bt in $(lsusb -v | awk ' /Class:.E0/ { print $9 } '); do
                                chown 1002.1002 $bt && chmod 660 $bt
                        done
-                       modprobe btusb
                        ;;
        esac
 
        if [ -n "$BTUART_PORT" ]; then
                set_property hal.bluetooth.uart $BTUART_PORT
                chown bluetooth.bluetooth $BTUART_PORT
-               start btattach:-B$BTUART_PORT
-               log -t hciconfig -p i "`hciconfig`"
+               start btattach
        fi
 }
 
@@ -405,16 +404,6 @@ function do_bootcomplete()
        post_bootcomplete
 }
 
-function do_hci()
-{
-       local hci=`hciconfig | grep ^hci | cut -d: -f1`
-       local btd="`getprop init.svc.bluetoothd`"
-       log -t bluetoothd -p i "$btd ($hci)"
-       if [ -n "`getprop hal.bluetooth.uart`" ]; then
-               [ "`getprop init.svc.bluetoothd`" = "running" ] && hciconfig $hci up
-       fi
-}
-
 PATH=/sbin:/system/bin:/system/xbin
 
 DMIPATH=/sys/class/dmi/id
@@ -455,9 +444,6 @@ case "$1" in
        bootcomplete)
                do_bootcomplete
                ;;
-       hci)
-               do_hci
-               ;;
        init|"")
                do_init
                ;;
index b79a42a..46ede7d 100644 (file)
@@ -1,4 +1,3 @@
-import /init.bluetooth.rc
 import /init.superuser.rc
 
 on early-init
@@ -101,7 +100,7 @@ service powerbtnd /system/bin/powerbtnd
 service logcat /system/bin/logcat -v threadtime -f /data/log.txt
     class debug
 
-service btattach /system/bin/btattach -Pbcm
+service btattach /system/bin/btattach
     class main
     disabled
     oneshot
@@ -127,12 +126,6 @@ on property:sys.boot_completed=1
     write /proc/sys/kernel/ctrl-alt-del 0
     exec -- /system/bin/logwrapper /system/bin/sh /system/etc/init.sh bootcomplete
 
-on property:init.svc.bluetoothd=running
-    exec -- /system/bin/logwrapper /system/bin/sh /system/etc/init.sh hci
-
-on property:init.svc.bluetoothd=stopped
-    exec -- /system/bin/logwrapper /system/bin/sh /system/etc/init.sh hci
-
 on property:net.dns1=*
     exec -- /system/bin/logwrapper /system/bin/sh /system/etc/init.sh netconsole
 
index 0e1c611..0e9889a 100644 (file)
@@ -80,6 +80,11 @@ PRODUCT_PACKAGES += \
     resize2fs \
     tune2fs \
 
+PRODUCT_PACKAGES += \
+    btattach \
+    hciconfig \
+    hcitool \
+
 # Third party apps
 PRODUCT_PACKAGES += \
     CMFileManager \