Bluetooth failure on Nexus 7 with Flounder built from source

678 views
Skip to first unread message

john oliver

unread,
Nov 6, 2014, 6:07:39 AM11/6/14
to android-...@googlegroups.com
Hi all,

I have built and flashed the AOSP for flounder and I'm not able to enable Bluetooth. I thought the first port of call was this "Building Group" to see if anybody else has managed to build an image for the Nexus 9, and run BT successfully.

Using LRX21L, I chose aosp_flounder-userdebug from lunch ( having added it manually) , and the built seemed to complete successfully. I then performed a fastboot flashall -w.  The device came up ok and I am able to adb root and remount ok, but I didn't change anything. When I go into the BT settings on the tablet, after I chose "On", after a few seconds it turns off. The log cat includes "Error enabling Bluetooth - hardware init failed" ..


D/bt_userial( 2100): userial_init
I/bt-btu  ( 2100): btu_task pending for preload complete event
I/bt_userial_vendor( 2100): userial vendor open: opening /dev/ttyO1
E/bt_userial_vendor( 2100): userial vendor open: unable to open /dev/ttyO1
E/bt_userial( 2100): userial_open opened wrong number of ports: got 0, expected 1.
E/bt_userial( 2100): userial_write error writing to serial port: Bad file number
I/wpa_supplicant( 1739): wlan0: WPA: Group rekeying completed with 84:c9:b2:7a:ad:54 [GTK=TKIP]
E/WifiStateMachine(  453): WifiStateMachine CMD_START_SCAN source -2 txSuccessRate=14.69 rxSuccessRate=53.41 targetRoamBSSID=any RSSI=-48
E/WifiStateMachine(  453): WifiStateMachine starting scan for "BFSWHWAP01"WPA_PSK with 2472
I/wpa_supplicant( 1739): wlan0: CTRL-EVENT-SCAN-STARTED 
E/bt-btif ( 2100): ...preload_wait_timeout (retried:0/max-retry:0)...
W/bt-btu  ( 2100): btu_task start abort!
I/GKI_LINUX( 2100): gki_task task_id=0 [BTU] terminating
I/GKI_LINUX( 2100): GKI_exit_task 0 done
I/GKI_LINUX( 2100): GKI_shutdown(): task [BTU] terminated
I/GKI_LINUX( 2100): GKI_exit_task 1 done
I/GKI_LINUX( 2100): gki_task task_id=2 [A2DP-MEDIA] terminating
I/GKI_LINUX( 2100): GKI_exit_task 2 done
D/BluetoothAdapterState( 2100): CURRENT_STATE=PENDING, MESSAGE = DISABLED, isTurningOn=true, isTurningOff=false
E/BluetoothAdapterState( 2100): Error enabling Bluetooth - hardware init failed
I/GKI_LINUX( 2100): gki_task task_id=1 [BTIF] terminating
D/HeadsetService( 2100): Received stop request...Stopping profile...
D/HeadsetStateMachine( 2100): Exit Disconnected: -1
D/BluetoothAdapterService( 2100): getAdapterService() - returning com.android.bluetooth.btservice.AdapterService@84a2e0d
D/A2dpService( 2100): Received stop request...Stopping profile...
D/A2dpStateMachine( 2100): Exit Disconnected: -1


I'd earlier verified that with the factory image on the same device BT was able to discover BT devices ok.  WIFI works ok with my built image, and the BT problem occurs with WIFI both on and off.

Could anybody please confirm whether their build works ok?


Cheers,

johno

john oliver

unread,
Nov 6, 2014, 10:32:02 AM11/6/14
to android-...@googlegroups.com
I've gathered some more info .. unfortunately it hasn't help me narrow down the problem, but perhaps it'll give some clues:

Building aosp_flounder64-userdebug instead of aosp_flounder-userdebug doesn't fix the problem.

Booting from the factory image, when I am able to enabled BT, I see

I/bt_userial_vendor( 2551): userial vendor open: opening /dev/ttyTHS2
I/bt_userial_vendor( 2551): device fd = 53 open
D/bt_userial( 2551): Entering userial_read_thread()
I/bt_hwcfg( 2551): bt vendor lib: set UART baud 3000000
D/bt_hwcfg( 2551): Chipset BCM4350C0
D/bt_hwcfg( 2551): Target name = [BCM4350C0]
I/bt_hwcfg( 2551): Found patchfile: /vendor/firmware//bcm4350c0.hcd
I/bt_hwcfg( 2551): bt vendor lib: set UART baud 115200
D/bt_hwcfg( 2551): Settlement delay -- 100 ms
I/bt_hwcfg( 2551): Setting fw settlement delay to 100 
I/bt_hwcfg( 2551): bt vendor lib: set UART baud 3000000
I/bt_hwcfg( 2551): Setting local bd addr to B4:CE:F6:36:AD:56
I/bt_hwcfg( 2551): vendor lib fwcfg completed

Booting from my build I get

I/bt_userial_vendor( 1453): userial vendor open: opening /dev/ttyO1
E/bt_userial_vendor( 1453): userial vendor open: unable to open /dev/ttyO1
E/bt_userial( 1453): userial_open opened wrong number of ports: got 0, expected 1.
E/bt_userial( 1453): userial_write error writing to serial port: Bad file number



/dev/ttyTHS2 does exist when I run my build:

crw-rw---- bluetooth net_bt_stack 243,   2 2014-11-06 12:41 ttyTHS2

The device it is trying to open, /dev/tty01   ( not sure why it appears as "/dev/ttyO1") doesn't exist.


Apart from setting the device permissions and giving the hci_attach_dev group ownership of it ( for selinux I assume), there is no other reference to /dev/ttyTHS2 in the source downloaded from android.googlesource.com

I am going to try building my own flounder kernel to see if that helps.

-johno

john oliver

unread,
Nov 7, 2014, 12:13:47 PM11/7/14
to android-...@googlegroups.com


On Thursday, 6 November 2014 11:07:39 UTC, john oliver wrote:
Hi all,

I have built and flashed the AOSP for flounder and I'm not able to enable Bluetooth. I thought the first port of call was this "Building Group" to see if anybody else has managed to build an image for the Nexus 9, and run BT successfully.



I have tried a few things since last time, but still my Nexus 7 is not recognizing the Bluetooth hardware when I build and install a system image from source.

 - I've built the flounder-kernel from source and made sure SERIAL_TEGRA was set, and updated the kernel in the system.img ( verified in the About Tablet screen)
-  Neither a full flashall -w or just flashing the system image makes any difference
-  I also tried replacing the system.img in the factory update .zip file, and followed the factory update procedure.

However, I've managed a workaround which allows me to make changes to bluedroid. By rooting and remounting my Nexus 9 ( running the factory image) to be writable, I am able to successfully update bluedroid libraries built from source and they operate as expected.

I would still like to understand why I cannot build a fully working system.img from source though. I appreciate that lollipop may still be rolling out with more updates yet to come, but  even that is not clear. Could somebody please clarify whether the source we see today is considered a release or not.

cheers,
johno

Lele

unread,
Dec 2, 2014, 7:55:04 AM12/2/14
to android-...@googlegroups.com
Hi John did you have any luck eventually?

In my build both WiFi and BT had issues but I see that other AOSP builds like Lollipopalooza work fine.

I'd like to build straight from source without any hack

Any idea?


thanks
Emanuele

john oliver

unread,
Dec 4, 2014, 6:07:44 AM12/4/14
to android-...@googlegroups.com
Hi Emanuele,

The title of this thread contains "Nexus 7". This was a mistake. I have been able to built the AOSP for Nexus 7 flo and get WiFI and BT working without any problems.

So I started another thread with "Nexus 9" in the title, when I realised my mistake:  https://groups.google.com/forum/#!topic/android-building/sBK8Vc_EtzE. There, I say that I solved my Nexus 9 issue, but I didn't give the details. I needed to set the following in vnd_flounder64.txt and vnd_flounder.txt

BLUETOOTH_UART_DEVICE_PORT = "/dev/ttyTHS2"
FW_PATCHFILE_LOCATION = "/vendor/firmware/"

I haven't encountered any WiFI issues with the Nexus 9.

Hope this helps..

Regards,
John

Andrei Emeltchenko

unread,
Dec 5, 2014, 4:25:46 AM12/5/14
to android-...@googlegroups.com
Hi John,

What is your preferred target aosp_flounder or aosp_flounder64?

Regards,
Andrei

James Johnson

unread,
May 2, 2015, 9:31:51 AM5/2/15
to android-...@googlegroups.com
What folder on the Nexus 9 are those two .txt files found?  I tried searching for them on the entire root folder but is taking forever to finish the search.

john oliver

unread,
May 18, 2015, 11:50:03 AM5/18/15
to android-...@googlegroups.com


On Saturday, 2 May 2015 14:31:51 UTC+1, James Johnson wrote:
What folder on the Nexus 9 are those two .txt files found?  I tried searching for them on the entire root folder but is taking forever to finish the search.


Hi James. they are in  hardware/broadcom/libbt/include
Reply all
Reply to author
Forward
0 new messages