Bluetooth in Android x86 on Virtualbox
Asked Answered
N

4

13

I'm trying to get Bluetooth working on Android x86 in virtualbox. I have tried both Virtualbox on Linux and Windows, with the latest android x86 iso, but the problem is the same: the bluetooth adapter of my thinkpad-laptop host (that is fully working) is not recognized.

I have found similar discussions:

How to test Bluetooth Based Application on Androidx86 on top of VirtualBox with inbuilt laptop bluetooth

how to test bluetooth application on emulators in android

Unfortunately the same steps does not solve my problem.

Should I try another virtualization software and/or another android x86 iso?

Neigh answered 23/7, 2013 at 9:29 Comment(1)
I would suggest trying a different ISO first.Annora
B
5

I know this is an old question, but I found this very helpful- https://forums.virtualbox.org/viewtopic.php?f=3&t=83325

In addition- notice that the Bluethooth USB device might not have an informative name (for example- in my computer it was "Intel Corp.").

The way to know that this is the right device (in Windows) is to go to the device manager, and compare the device ID of the Bluetooth device, to the one in the Virtualbox- Virtualbox Device manager

Bufflehead answered 5/11, 2018 at 9:20 Comment(0)
D
4

VirtualBox is capable of sharing USB devices. Your bluetooth dongle may or may not be internally connected trough USB. I have two Thinkpads, both with bluetooth inside, and only one of them has it on USB.

The trick mentioned on many "I want to test my Android Bluetooth app" solutions assume that your Bluetooth device uses USB, ait it won't work when it doesn't.

Dowel answered 5/10, 2014 at 21:15 Comment(0)
P
3

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.
Proper answered 7/12, 2021 at 1:14 Comment(2)
This method also worked for activating bluetooth on an Android x86 KVM vm on Ubuntu (without gsudo).Falkner
this almost works for me. in android x86, open the terminal emulator, switch to su and do the pm enable com.android.bluetooth service call bluetooth_manager 6 then hciconfig hci0 up and it should work. I have problems with this setup because when androidx86 restarts, the pm is enabled but not working, so it keeps crashing, but if i make sure to disable before turning it off and write all the this again next time, then it worksKaolin
A
-1

I had a similar problem a few months ago - found these steps were needed to make it work:

  1. # poweroff
  2. settings -> USB -> Alt+Ins, this popped up "Unknown Device 0A12:0001[0134]", I clicked on it, I could see the device selected under USB device Filters
  3. clicke on OK.
  4. Select the guest OS i.e., Ubuntu 10.04, click on start.
  5. fiddled with the USB dongle (insert - remove - insert bluetooth dongle).

Now it threw a message box, "Failed to set bluetooth power, The error reported is: Connection timed out"

  1. # gedit /etc/bluetooth/main.conf
  2. Replace 'RememberPowered' parameter from "true" to "false" (ofcourse with out quotes ).
  3. Save and close.
  4. # reboot

After the system is up ... 10. # hciconfig -a output this is showing me the device
11. # hictool scan can see the mobiles, which have activated their bluetooth

More info here: https://forums.virtualbox.org/viewtopic.php?f=6&t=34867

Arachne answered 6/8, 2013 at 14:58 Comment(3)
none of this is relevant to android x86. you can't run gedit, hciconfig or hcitool on androidTintype
android-x86 7.1 comes with hciconfig, hcitool and vi, not gedit it seems though. It's been a couple of years since the answer was posted so I assume stuff might have changed throughout the years.Incised
this answer is indeed completely irrelevant for the question asked. it is about ubuntu guests, as is all the content on the link with supposedly more info. neither version 7.1 nor 9 of android-x86 have a /etc/bluetooth/main.conf file.Snoop

© 2022 - 2024 — McMap. All rights reserved.