I'm attempting to get Bluetooth working on an iMX53-based platform running i.MX Android R10.2. Android version is 2.3.3.
I've got it to the stage where I can manually perform a hciattach and this seems to work OK but when I attempt to start Bluetooth via the Android GUI it fails. Here is a snippet from logcat and the failure appears to be Dbus-related (No Such Adapter)
I've looked around various forums but have not made too much progress.
Any ideas as to the cause of the problem?
Thanks
Bruno
D/BluetoothService( 2084): Bluetooth state 10 -> 11
V/BluetoothEventRedirector( 2206): Received andrBDP rfkill set power 0
oid.bluetooth.adapter.action.STATE_CHANGED
I/bluedroid( 2084): Starting hciattach daemon
I/bluedroid( 2084): Starting bluetoothd deamon
E/BluetoothEventLoop.cpp( 2084): get_adapter_path: D-Bus error: org.bluez.Error.NoSuchAdapter (No such adapter)
E/BluetoothEventLoop.cpp( 2084): failure setting up Event Loop!
E/BluetoothEventLoop.cpp( 2084): get_adapter_path: D-Bus error: org.bluez.Error.NoSuchAdapter (No such adapter)
E/BluetoothEventLoop.cpp( 2084): failure setting up Event Loop!
D/BluetoothService( 2084): bt EnableThread giving up
I/bluedroid( 2084): Stopping bluetoothd deamon
BDP rfkill set power 1
I/bluedroid( 2084): Stopping hciattach deamon
D/BluetoothService( 2084): Bluetooth state 11 -> 10
V/BluetoothEventRedirector( 2206): Received android.bluetooth.adapter.action.STATE_CHANGED
Here's what I see when I do a manual hciattach and hciconfig
# hciattach -s 115200 /dev/ttymxc4 texas 3000000 flow
[ATH_INFO] (external/bluetooth/bluez/
tools/hciattach.c) <init_uart>: Serial port is opened
[ATH_INFO] (external/bluetooth/bluez/tools/hciattach.c) <init_uart>: Port settings is gotten
[ATH_INFO] (external/bluetooth/bluez/tools/hciattach.c) <init_uart>: Port settings is set
[ATH_INFO] (external/bluetooth/bluez/tools/hciattach.c) <init_uart>: Initial baud rate is set
[ATH_INFO] (external/bluetooth/bluez/tools/hciattach.c) <init_uart>: Break is sent
Found a Texas Instruments' chip!
Firmware file : /system/lib/firmware/ti/TIInit_7.6.15.bts
Sending script to serial device
Loaded BTS script version 1
texas: changing baud rate to 3000000, flow control to 1
CCCCCCCCCCCCCCCCCCCCWRCSCCCCCWRCCWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRCCWRWRWRWRWRCCCCCWRWRWRWRWRWRWRWRWRCCCWRCCCCCCCCCCCCCCCWRCCWRCCCWRCCCCWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRCCCCCCWRCCWRCCWRCWRCCCCCCWRCCCC
[ATH_INFO] (external/bluetooth/bluez/tools/hciattach.c) <init_uart>: u->init is loaded
[ATH_INFO] (external/bluetooth/bluez/tools/hciattach.c) <init_uart>: Actual baud rate is set
[ATH_INFO] (external/bluetooth/bluez/tools/hciattach.c) <init_uart>: Line discipline is set
[ATH_INFO] (external/bluetooth/bluez/tools/hciattach.c) <init_uart>: Ioctl device is set
Added device hci0
Sending script to bluetooth socket
[ATH_INFO] (external/bluetooth/bluez/tools/hciattach.c) <init_uart>: u->post is loaded
Device setup complete
# hciconfig
hci0: Type: BR/EDR Bus: UART
BD Address: 34:B1:F7:97:8E:CE ACL MTU: 1021:4 SCO MTU: 180:4
UP RUNNING
RX bytes:352 acl:0 sco:0 events:10 errors:0
TX bytes:45 acl:0 sco:0 commands:10 errors:0
Here's the relevant piece from the init.rc file
# Prepare for bluetooth
chmod 665 /sys/class/rfkill/rfkill0/state
chown bluetooth bluetooth /sys/class/rfkill/rfkill0/state
write /sys/class/rfkill/rfkill0/state 0
chmod 0660 /dev/ttymxc4
chown bluetooth bluetooth /dev/ttymxc4
service dbus /system/bin/dbus-daemon --system --nofork
socket dbus stream 660 bluetooth bluetooth
user bluetooth
group bluetooth net_bt_admin
service bluetoothd /system/bin/bluetoothd -n
socket bluetooth stream 660 bluetooth bluetooth
socket dbus_bluetooth stream 660 bluetooth bluetooth
# init.rc does not yet support applying capabilities, so run as root and
# let bluetoothd drop uid to bluetooth with the right linux capabilities
group bluetooth net_bt_admin misc
disabled
service hfag /system/bin/sdptool add --channel=10 HFAG
user bluetooth
group bluetooth net_bt_admin
disabled
oneshot
service hsag /system/bin/sdptool add --channel=11 HSAG
user bluetooth
group bluetooth net_bt_admin
disabled
oneshot
service opush /system/bin/sdptool add --channel=12 OPUSH
user bluetooth
group bluetooth net_bt_admin
disabled
oneshot
service pbap /system/bin/sdptool add --channel=19 PBAP
user bluetooth
group bluetooth net_bt_admin
disabled
oneshot
service hciattach /system/bin/hciattach -n -s 115200 /dev/ttymxc4 texas 3000000 flow
user bluetooth
group bluetooth net_bt_admin
disabled
已解决! 转到解答。
The problem was eventually found to be caused by hciattach being unable to open the hci0 device because it lacked NET_ADMIN capabilities. I changed the user from 'bluetooth' to 'root' in init.rc where the hciattach service is defined.
There may be another way to fix this but this did work and I did see an init.rc for the wireless device (TI WL127XX) with user set to root. This may be of help to someone else.
Hi Bruno
this error my be caused by improper/incompatible bluez version, please check links below
Qualcomm Bluetooth D-Bus problem - Development - RootzWiki
Also it may be recommended to post it on specialized bluez forums.
Best regards
chip
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
The problem was eventually found to be caused by hciattach being unable to open the hci0 device because it lacked NET_ADMIN capabilities. I changed the user from 'bluetooth' to 'root' in init.rc where the hciattach service is defined.
There may be another way to fix this but this did work and I did see an init.rc for the wireless device (TI WL127XX) with user set to root. This may be of help to someone else.