From 8d0b51fcb6cd7d59365cb90dd283491339a4fd36 Mon Sep 17 00:00:00 2001 From: Chih-Wei Huang Date: Wed, 12 Oct 2016 20:50:06 +0800 Subject: [PATCH] Support BT HCI UART devices Set appropriate properties to start btattach service. Add BT related tools and remove obsolete code for BlueZ. --- init.sh | 18 ++---------------- init.x86.rc | 9 +-------- packages.mk | 5 +++++ 3 files changed, 8 insertions(+), 24 deletions(-) diff --git a/init.sh b/init.sh index 2fbb8fe..05a503c 100644 --- 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 ;; diff --git a/init.x86.rc b/init.x86.rc index b79a42a..46ede7d 100644 --- a/init.x86.rc +++ b/init.x86.rc @@ -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 diff --git a/packages.mk b/packages.mk index 0e1c611..0e9889a 100644 --- a/packages.mk +++ b/packages.mk @@ -80,6 +80,11 @@ PRODUCT_PACKAGES += \ resize2fs \ tune2fs \ +PRODUCT_PACKAGES += \ + btattach \ + hciconfig \ + hcitool \ + # Third party apps PRODUCT_PACKAGES += \ CMFileManager \ -- 2.11.0