This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

debugging bluetooth via ti-st on android ics devkit

Other Parts Discussed in Thread: WL1271

Hi,

I'm a bit stuck with debugging bluetooth. I've followed the porting guide recommendations. But I'm not yet able to get bluetooth to work. I have attached the repo diff for all the changes that I made. Also boot log.

I see the ti-st driver output like:

(stk) :sysfs entries created
(stk) : debugfs entries created

Bluetooth: HCI UART driver ver 2.2
Bluetooth: HCI H4 protocol initialized
Bluetooth: HCI BCSP protocol initialized
Bluetooth: HCILL protocol initialized
Bluetooth: HCIATH3K protocol initialized
Bluetooth: Generic Bluetooth USB driver ver 0.6
usbcore: registered new interface driver btusb
Bluetooth: Generic Bluetooth SDIO driver ver 0.1
Bluetooth: Bluetooth Driver for TI WiLink - Version 1.0

(btdrv): bt_drv_init Start
(btdrv): Bluetooth Driver Version 1.0
(btdrv): hci_st_register_dev Start
(btdrv): HCI device allocated. hdev= cf291000
usb 1-2: new high speed USB device using ehci-omap and address 2
(btdrv): HCI device registered. hdev= cf291000
(btdrv): hci_st_register_dev Exit(0)
(btdrv): bt_drv_init Exit(0)

But when I try to turn on bluetooth using the UI, I see:

D/BluetoothAdapterStateMachine( 1220): Bluetooth state 10 -> 11
E/BluetoothAdapterStateMachine( 1220): failed to prepare bluetooth, abort turning on
D/BluetoothAdapterStateMachine( 1220): Bluetooth state 11 -> 10

root@android:/ # hcitool dev
Devices:

Any suggestions on what I could look at to find out which part is not working?

Thanks,

jayakumar

5518.2012.07.28.diff_to_addbbxm_bbtoyswifi_ics403.patch.txt

0820.bbxm_bbtoyswifi_btdebug2.log

  • One thing that is interesting. I couldn't get it to work graphically from the Android UI. But if I use the command line, I see:

    130|root@android:/ # hciconfig hci0 up
    (stc): st_register(2)
    (stc): chnl_id list empty :2
    (stk) : st_kim_start
    plat_kim_chip_enable
    (stk) :ldisc_install = 1
    (stc): st_tty_open
    (stk) : line discipline installed
    (stk) :TIInit_7.2.31.bts
    (stk) :change remote baud rate command in firmware
    (stk) :skipping the wait event of change remote baud
    (stc): add_channel_to_table: id 2
    (stc): st_register(3)
    (stc): add_channel_to_table: id 3
    (stc): st_register(4)
    (stc): add_channel_to_table: id 4
    root@android:/ # hciconfig
    hci0: Type: BR/EDR Bus: UART
    BD Address: E0:D7:BA:39:46:7B ACL MTU: 1021:4 SCO MTU: 180:4
    UP RUNNING
    RX bytes:348 acl:0 sco:0 events:11 errors:0
    TX bytes:49 acl:0 sco:0 commands:11 errors:0

    hci1: Type: BR/EDR Bus: UART
    BD Address: 00:00:00:00:00:00 ACL MTU: 0:0 SCO MTU: 0:0
    DOWN
    RX bytes:0 acl:0 sco:0 events:0 errors:0
    TX bytes:0 acl:0 sco:0 commands:0 errors:0

    hci2: Type: BR/EDR Bus: SDIO
    BD Address: 00:00:00:00:00:00 ACL MTU: 0:0 SCO MTU: 0:0
    DOWN
    RX bytes:0 acl:0 sco:0 events:0 errors:0
    TX bytes:0 acl:0 sco:0 commands:0 errors:0

    root@android:/ # hcitool scan
    Scanning ...
    70:1A:04:59:33:50 Dell Wireless 370 Bluetooth Mini-card
    BC:47:60:3B:2F:B5 C6112(71**)

    I think this means the problem lies somewhere in how Android tries to turn on bluetooth. Any suggestions/ideas?

  • I'm still stuck on this problem. The fact that it works fine from the command line and not from the UI is really confusing to me. I've gone through the porting guide item by item and checked it. Here's my checklist. Has something been missed from the porting guide? Any suggestions on how to move forward with the debug?

    0. pinmux
    project u-boot/
    diff --git a/board/ti/beagle/beagle.h b/board/ti/beagle/beagle.h

    Done. I am satisfied with the pinmux working since bluetooth works (hcitool scan) when initiated from command line (hciconfig hci0 up).

    1. BoardConfig.mk
    BOARD_HAVE_BLUETOOTH := true

    done.

    project device/ti/beagleboard/
    diff --git a/BoardConfig.mk b/BoardConfig.mk
    index 57a929b..043096f 100644
    --- a/BoardConfig.mk
    +++ b/BoardConfig.mk
    @@ -29,7 +29,7 @@ TARGET_CPU_ABI2 := armeabi
    TARGET_ARCH_VARIANT := armv7-a-neon
    ARCH_ARM_HAVE_TLS_REGISTER := true

    -BOARD_HAVE_BLUETOOTH := false
    +BOARD_HAVE_BLUETOOTH := true
    TARGET_NO_KERNEL := true
    TARGET_NO_BOOTLOADER := true
    TARGET_NO_RECOVERY := true

    2. kernel .config
    CONFIG_BT=y
    CONFIG_BT_L2CAP=y
    CONFIG_BT_SCO=y
    CONFIG_BT_RFCOMM=y
    CONFIG_BT_RFCOMM_TTY=y
    CONFIG_BT_BNEP=y
    CONFIG_BT_BNEP_MC_FILTER=y
    CONFIG_BT_BNEP_PROTO_FILTER=y
    CONFIG_BT_HIDP=y
    CONFIG_BT_HCIBTUSB=y
    CONFIG_BT_HCIBTSDIO=y
    CONFIG_BT_HCIUART=y
    CONFIG_BT_HCIUART_H4=y
    CONFIG_BT_HCIUART_BCSP=y
    CONFIG_BT_HCIUART_ATH3K=y
    CONFIG_BT_HCIUART_LL=y
    CONFIG_RFKILL=y
    CONFIG_RFKILL_PM=y
    CONFIG_RFKILL_INPUT=y

    Done.

    3. TI-ST and wilink bluetooth

    CONFIG_BT_WL1271=y
    CONFIG_BT_WILINK=y
    CONFIG_TI_ST=y

    Done.

    4. input
    CONFIG_INPUT_MISC=y
    CONFIG_INPUT_UINPUT=y

    Done.

    5. board level config
    Done.

    6. BT HAL config
    chmod 0660 /dev/ttyO1
    chown bluetooth bluetooth /dev/ttyO1
    chmod 0660 /sys/class/rfkill/rfkill0/state
    chown bluetooth bluetooth /sys/class/rfkill/rfkill0/state

    7. d-bus
    service dbus /system/bin/dbus-daemon --system --nofork
    class main
    socket dbus stream 660 bluetooth bluetooth
    user bluetooth
    group bluetooth net_bt_admin
    Done.

    8. bluetoothd
    service bluetoothd /system/bin/bluetoothd -n
    class main
    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
    Done

    9. uim-sysfs
    service uim /system/bin/uim-sysfs
    class core
    user bluetooth
    group bluetooth net_bt_admin
    Done.

    10. overlay
    device/ti/beagleboard/overlay/frameworks/base/core/res/res/values/config.xml
    <string-array translatable="false" name="networkAttributes">
    <item>"wifi,1,1,1,-1,true"</item>
    <item>"wifi_p2p,13,1,0,-1,true"</item>
    <item>"bluetooth,7,7,0,-1,true"</item>
    <item>"ethernet,9,9,2,-1,true"</item>
    </string-array>
    ...
    <string-array translatable="false" name="radioAttributes">
    <item>"1,1"</item>
    <item>"7,1"</item>
    <item>"9,1"</item>
    </string-array>

    11. bluetooth permissions
    ./device/ti/beagleboard/device.mk
    PRODUCT_COPY_FILES += \
    device/ti/beagleboard/android.hardware.bluetooth.xml:system/etc/permissions/android.hardware.bluetooth.xml \
    system/bluetooth/data/main.nonsmartphone.conf:system/etc/bluetooth/main.conf

  • Not sure what is going wrong here.

    Perhaps you could add additional logging in the TI-ST uim-sysfs driver to find the cause. The sources is at hardware/ti/wpan/ti_st/uim-sysfs/

  • Thanks for your reply.

    I've enabled debug in hardware/ti/wpan/ti_st/uim-sysfs/uim.c . I clicked on settings->bluetooth, turn on and I don't see any messages from uim-sysfs. As per the init.rc shown in the porting guide and also matching the one in omap3evm, what I have is:

       #shared transport user space mgr service for Bluetooth, FM and GPS
       service uim /system/bin/uim-sysfs
       class core
       user bluetooth
       group bluetooth net_bt_admin
    If I start uim-sysfs from the command line, I see:

    root@android:/ # /system/bin/uim-sysfs 

    E/uim-sysfs( 1598): uim: Inside main
    E/uim-sysfs( 1598): uim:ST built into the kernel ?
    E/uim-sysfs( 1598): uim:BT driver module un-available...
    E/uim-sysfs( 1598): uim:BT driver built into the kernel ?
    E/uim-sysfs( 1598): uim:FM driver module un-available...
    E/uim-sysfs( 1598): uim:FM driver built into the kernel ?
    E/uim-sysfs( 1598): uim:GPS driver module un-available...
    E/uim-sysfs( 1598): uim:GPS driver built into the kernel ?
    E/uim-sysfs( 1598): uim:FM V4L2 driver module un-available...
    E/uim-sysfs( 1598): uim:FM V4L2 driver built into the kernel ?
    E/uim-sysfs( 1598): uim:found bluetooth rfkill entry @ 0
    E/uim-sysfs( 1598):
    E/uim-sysfs( 1598): uim:changed permissions for /sys/class/rfkill/rfkill0/state(0)
    E/uim-sysfs( 1598):

    Those messages look correct as the ti-st and btwilink drivers are built-in as per the porting guide. 

    I noticed, if I just do hciconfig hci0 up, something is automatically kicking off with uim-sysfs because I then see in logcat:

    root@android:/ # hciconfig hci0 up
    init: untracked pid 1247 exited
    (stc): st_register(2)
    (stc): chnl_id list empty :2
    (stk) : st_kim_start
    plat_kim_chip_enable
    (stk) :ldisc_install = 1E/uim-sysfs( 1087): uim: Inside st_uart_config
    E/uim-sysfs( 1087): uim:install set to 1
    E/uim-sysfs( 1087): uim: Inside set_baud_rate
    E/uim-sysfs( 1087): uim: set_baud_rate() done
    E/uim-sysfs( 1087): uim: Inside read_firmware_version
    E/uim-sysfs( 1087): uim: Inside read_hci_event
    E/uim-sysfs( 1087): uim: read_hci_event
    E/uim-sysfs( 1087): uim: 4
    E/uim-sysfs( 1087): uim: e
    E/uim-sysfs( 1087): uim: c
    E/uim-sysfs( 1087): uim: 1
    E/uim-sysfs( 1087): uim: 1
    E/uim-sysfs( 1087): uim: 10
    E/uim-sysfs( 1087): uim: 0
    E/uim-sysfs( 1087): uim: 4
    E/uim-sysfs( 1087): uim: 0
    E/uim-sysfs( 1087): uim: 0
    E/uim-sysfs( 1087): uim: 4
    E/uim-sysfs( 1087): uim: d
    E/uim-sysfs( 1087): uim: 0
    E/uim-sysfs( 1087): uim: 1f
    E/uim-sysfs( 1087): uim: 1d
    E/uim-sysfs( 1087): uim: Setting speed to 3000000
    E/uim-sysfs( 1087): uim: Inside read_command_complete
    E/uim-sysfs( 1087): uim: Command complete starte
    (stc): st_tty_open d
    E/uim-sysfs(
    (stk) : line discipline installed 1087): uim: Inside read_hci_event
    E/uim-sysfs( 1087): uim: read
    (stk) :TIInit_7.2.31.bts_hci_event
    E/uim-sysfs( 1087): uim: Command complete done
    E/uim-sysfs( 1087): uim: Speed changed to 3000000
    E/uim-sysfs( 1087): uim: Inside set_custom_baud_rate
    E/uim-sysfs( 1087): uim: Ch
    (stk) :change remote baud rate command in firmwareanging baud rate
    (stk) :skipping the wait event of change remote baud to 3000000, flow control to 1
    E/uim-sysfs( 1087): uim: set_custom_baud_rate() done
    E/uim-sysfs( 1087): uim: Installed N_TI_WL Line displine
    select 1370 (d.process.acore), adj 15, size 8041, to kill
    send sigkill to 1370 (d.process.acore), adj 15, size 8041
    I/ActivityManager( 1192): Process android.process.acore (pid 1370) has died.
    (stc): add_channel_to_table: id 2
    (stc): st_register(3)
    (stc): add_channel_to_table: id 3
    (stc): st_register(4)
    (stc): add_channel_to_table: id 4

    Also, looking at the start of logcat, I see:

    root@android:/ # --------- beginning of /dev/log/main
    I/DEBUG ( 1089): debuggerd: Jun 24 2012 00:05:22
    E/uim-sysfs( 1087): uim: Inside main
    E/uim-sysfs( 1087): uim:ST built into the kernel ?
    E/uim-sysfs( 1087): uim:BT driver module un-available...
    E/uim-sysfs( 1087): uim:BT driver built into the kernel ?
    E/uim-sysfs( 1087): uim:FM driver module un-available...
    E/uim-sysfs( 1087): uim:FM driver built into the kernel ?
    E/uim-sysfs( 1087): uim:GPS driver module un-available...
    E/uim-sysfs( 1087): uim:GPS driver built into the kernel ?
    E/uim-sysfs( 1087): uim:FM V4L2 driver module un-available...
    E/uim-sysfs( 1087): uim:FM V4L2 driver built into the kernel ?
    E/uim-sysfs( 1087): uim:found bluetooth rfkill entry @ 0
    E/uim-sysfs( 1087):
    E/uim-sysfs( 1087): uim:changed permissions for /sys/class/rfkill/rfkill0/state(0)
    E/uim-sysfs( 1087):
    I/Netd ( 1088): Netd 1.0 starting
    E/Netd ( 1088): Unable to create netlink socket: Protocol not supported
    E/Netd ( 1088): Unable to open quota2 logging socket
    --------- beginning of /dev/log/system
    I/Vold ( 1086): Vold 2.1 (the revenge) firing up

    So it would seem that uim-sysfs is getting started automatically. I couldn't follow what should be doing the equivalent of hciconfig hci0 up. Full logcat output from boot attached.

    Thanks,

    jayakumar

    4341.bbxm_bbtoyswifi_btdebug5.log

  • I also checked the sysfs files are present:

    root@android:/ # cat /sys/devices/platform/kim/
    baud_rate driver/ install power/ uevent
    dev_name flow_cntrl modalias subsystem/
    root@android:/ # cat /sys/devices/platform/kim/
    baud_rate driver/ install power/ uevent
    dev_name flow_cntrl modalias subsystem/
    /devices/platform/kim/dev_name <
    /dev/ttyO1
    root@android:/ # ls /sys
    sys/ system/
    root@android:/ # ls /sys/dev
    dev/ devices/
    sys/devices/platform/btwilink/ <
    driver
    modalias
    power
    subsystem
    uevent
    root@android:/ # cat /sys/devices/platform/btwilink/
    driver/ modalias power/ subsystem/ uevent
    root@android:/ # cat /sys/devices/platform/btwilink/
    driver/ modalias power/ subsystem/ uevent
    ces/platform/btwilink/modalias <
    platform:btwilink

  • Hello Jaya Kumar,

    Have you solved this problem? I have the same problem.

    Regards,

    Ruvinda

  • I have similar problem 

    I have TI Android ICS 4.0.3 on BeagleBoard XM and I have rebuilt the kernel with the BT CONFIGs.

    I have modified the Init.rc

    I see the Setting->Bluetooth interface but if I try to enable it  goes back immediately off

    I does not find some file into my rootfs like /system/bin/bluetoothd.

    Do I need some furthermore steps ?

    Should I rebuild the rootfs too?

    Please Help