Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bluetooth not working on Android x86 Pie (android-x86-9.0-r2), but working on Android x86 Nougat (android-x86-7.1-r4) #91

Open
projectbtle opened this issue Aug 18, 2020 · 4 comments

Comments

@projectbtle
Copy link

projectbtle commented Aug 18, 2020

Firstly, thanks for this great project. Very useful for researchers.

I'm trying to test Bluetooth on Android Pie, but am unable to get it to work.

Environment:

  • Windows 10 64-bit host
  • VMWare Workstation 14 Player (14.1.8 build-14921873)
  • CSR Bluetooth dongle (BT 4.0)
  • Android x86 Pie (android-x86-9.0-r2)

Problem:

  • Bluetooth doesn't switch on within Settings. The toggle goes to the right but remains grey. No devices are found (within the Settings interface) even though there are several devices advertising.

Troubleshooting:

  • hcitool lescan works (i.e., shows advertising devices in the vicinity), so it can't be a problem with the CSR adapter.
  • logcat shows couldn't write 1002 to /config/sdcardfs/com.android.bluetooth/appid, but it says the same (with different appids) for all the apps that were on /config/sdcardfs in older Android versions. It looks like that folder doesn't have app-specific sub-folders on Android v9.

When we try to turn on Bluetooth within Settings, logcat shows:

08-18 07:00:23.743  1766  2425 D BluetoothManagerService: enable(com.android.settings):  mBluetooth =null mBinding = false mState = OFF
08-18 07:00:23.743  1766  2425 D BluetoothManagerService: enable returning
08-18 07:00:23.743  1766  1834 D BluetoothManagerService: MESSAGE_ENABLE(0): mBluetooth = null
08-18 07:00:23.743  1766  1834 E BluetoothManagerService: Fail to bind to: Intent { act=android.bluetooth.IBluetooth }

The same setup with Android x86 Nougat (android-x86-7.1-r4) works.

@projectbtle projectbtle changed the title Bluetooth not working on Android x86 Pie (android-x86-9.0-r2.iso), but working on Android x86 Nougat (android-x86-7.1-r4) Bluetooth not working on Android x86 Pie (android-x86-9.0-r2), but working on Android x86 Nougat (android-x86-7.1-r4) Aug 18, 2020
@projectbtle
Copy link
Author

Attached logcat and dmesg outputs for Nougat (where Bluetooth works) and Pie (where Bluetooth doesn't work).

logcat_nougat.txt
dmesg_nougat.txt
logcat_pie.txt
dmesg_pie.txt

@Jikodis
Copy link

Jikodis commented Dec 7, 2021

I have had issues in Android X-86 and BlissOS. This is what I have found to fix my specific issue after toying with different commands. You may be able to automate this process on boot following a process similar to https://android.stackexchange.com/a/6560/342111

Also note that I am on Mac and had to get a bluetooth USB adapter since MacOS does not allow you to use the built in bluetooth.

I also had to force Mac to not auto-capture my bluetooth USB dongle, but to let VirtualBox take it over. The command was sudo nvram bluetoothHostControllerSwitchBehavior=never

As to why this is needed, I don't know, but hopefully Bluetooth is more stable in future versions of Android X-86.

Command Chain (w/Sleep delays):

hciconfig && gsudo hciconfig hci0 down && sleep 10 && gsudo pm disable com.android.bluetooth && sleep 10 && gsudo pm enable com.android.bluetooth && sleep 10 && gsudo service call bluetooth_manager 6 && sleep 10 && gsudo hciconfig hci0 up

Commands to Enter and Leave Terminal:

Enter terminal: Alt + F1

Leave terminal: Alt + F7

Ordered Steps Explanation:

  • hciconfig
    • Shows the status of any bluetooth devices
  • gsudo hciconfig hci0 down
    • Puts the bluetooth receiver into an “off” mode.
    • Change hci0 to the ID of your bluetooth receiver if different
  • gsudo pm disable com.android.bluetooth
    • Stops the bluetooth Android package
  • gsudo pm enable com.android.bluetooth
    • Starts the bluetooth Android package
  • gsudo service call bluetooth_manager 6
    • Terminal call to enable bluetooth on the device. It is possible this could be done through the Android UI as well.
  • gsudo hciconfig hci0 up
    • Tells the bluetooth receiver to turn “on” and start transmissions as needed

Extra Commands:

  • gsudo service call bluetooth_manager 9
    • Disables bluetooth setting through terminal. This may be done manually as well, and this command might not be needed at all.

Notes:

  • gsudo is what the sudo command is in BlissOS. It may be the same in Android X-86 as well. gsudo may not be needed in the commands above, but I used it for good measure.

@whitedavidp
Copy link

Well, I'll be darned! Thanks Jikodis for the above post. I really need to have BT working inside my Android x86 Guest and for some reason, this does the trick. I never would have figured this out myself. I had managed to find the hciconfig -a and hciconfig chi0 up myself somehow and I was able to run hcitool scan and lescan and see results. So I thought I had it made. But that was not sufficient. I now have Tasker running this command line (with root) at boot:

hciconfig hci0 down; sleep 5;pm disable com.android.bluetooth;sleep 5;pm enable com.android.bluetooth;sleep 5;service call bluetooth_manager 6;sleep 5;hciconfig hci0 up

@Ch667
Copy link

Ch667 commented May 20, 2024

Thanks a lot Jikodis, bluetooth worked successfully on my android x86 7.0-R5!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants