android-x86 / android-x86.github.io

Official Website for Android-x86 Project
MIT License
121 stars 33 forks source link

Bluetooth only work on Live Android #25

Open vafagh opened 5 years ago

vafagh commented 5 years ago

Kernel: 4.19.15-android-x86_64-g321974c6234b Android 8.1.0 Device: Notebook iView Ultima 13”

Bluetooth working fine with live version of android(not installed)

With installed version of same android, Bluetooth not functioning on UI, I turn it on, the Off status became a gray On, the toggle button stay disabled and nothing else happens (like device list or mac address, ….) I tried terminal, everything looks good but not able to connect my sound system. There are some error after executing those commands.

x86_64:/ $
x86_64:/ $ /system/bin/su
x86_64:/ # setenforce 0
x86_64:/ # hciconfig
hci0:   Type: Primary  Bus: UART
        BD Address: 7C:C7:08:60:0C:95  ACL MTU: 1021:8  SCO MTU: 255:16
        DOWN
        RX bytes:21218 acl:21 sco:0 events:385 errors:0
        TX bytes:6309 acl:21 sco:0 commands:213 errors:0

x86_64:/ # hciconfig hci0 up
x86_64:/ # hciconfig hci0 -a
hci0:   Type: Primary  Bus: UART
        BD Address: 7C:C7:08:60:0C:95  ACL MTU: 1021:8  SCO MTU: 255:16
        UP RUNNING
        RX bytes:18766 acl:19 sco:0 events:347 errors:0
        TX bytes:5737 acl:19 sco:0 commands:191 errors:0
        Features: 0xff 0xff 0xff 0xfe 0xdb 0xff 0x7b 0x87
        Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3
        Link policy: RSWITCH HOLD SNIFF PARK
        Link mode: SLAVE ACCEPT
        Name: 'RTK_BT_4.0'
        Class: 0x000000
        Service Classes: Unspecified
        Device Class: Miscellaneous,
        HCI Version: 4.0 (0x6)  Revision: 0x1e3e
        LMP Version: 4.0 (0x6)  Subversion: 0xe40e
        Manufacturer: Realtek Semiconductor Corporation (93)

x86_64:/ # hcitool scan
Scanning ...
        08:EF:3B:B1:8f:36       LG LAS551H(36)
        00:9E:C8:92:19:H2       X3
x86_64:/ # hcitool cc 08:EF:3B:B1:8f:36
x86_64:/ # hcitool con
Connections:
x86_64:/ # dmes
.
.
.
[ 5238.514708] type=1400 audit(1559639191.673:2422): avc: denied { map } for pid=1602 comm="RenderThread" path=2F69393135202864656C6574656429 dev="tmpfs" ino=385975 scontext=u:r:system_server:s0 tcontext=u:object_r:system_server_tmpfs:s0 tclass=file permissive=1
[ 5238.514721] type=1400 audit(1559639194.007:2423): avc: denied { map } for pid=1602 comm="android.anim" path=2F69393135202864656C6574656429 dev="tmpfs" ino=387893 scontext=u:r:system_server:s0 tcontext=u:object_r:surfaceflinger_tmpfs:s0 tclass=file permissive=1
[ 5238.514845] type=1400 audit(1559639194.007:2423): avc: denied { map } for pid=1602 comm="android.anim" path=2F69393135202864656C6574656429 dev="tmpfs" ino=387893 scontext=u:r:system_server:s0 tcontext=u:object_r:surfaceflinger_tmpfs:s0 tclass=file permissive=1
[ 5238.514853] type=1400 audit(1559639194.007:2424): avc: denied { read write } for pid=1602 comm="android.anim" path=2F69393135202864656C6574656429 dev="tmpfs" ino=387893 scontext=u:r:system_server:s0 tcontext=u:object_r:surfaceflinger_tmpfs:s0 tclass=file permissive=1
[ 5250.171561] type=1400 audit(1559639194.007:2424): avc: denied { read write } for pid=1602 comm="android.anim" path=2F69393135202864656C6574656429 dev="tmpfs" ino=387893 scontext=u:r:system_server:s0 tcontext=u:object_r:surfaceflinger_tmpfs:s0 tclass=file permissive=1
[ 5250.171573] type=1400 audit(1559639205.662:2425): avc: denied { map } for pid=1492 comm="surfaceflinger" path=2F69393135202864656C6574656429 dev="tmpfs" ino=390155 scontext=u:r:surfaceflinger:s0 tcontext=u:object_r:surfaceflinger_tmpfs:s0 tclass=file permissive=1
[ 5266.782819] binder: 13262:13552 IncRefs 0 refcount change on invalid ref 33 ret -22
[ 5266.782833] binder: 13262:13552 Acquire 1 refcount change on invalid ref 33 ret -22
[ 5266.782846] binder: transaction release 1263790 bad handle 33, ret = -22
[ 5288.165693] healthd: battery l=38 v=3784 t=0.0 h=2 st=2 c=1136 fc=8399664 chg=u
[ 5288.287185] type=1400 audit(1559639205.662:2425): avc: denied { map } for pid=1492 comm="surfaceflinger" path=2F69393135202864656C6574656429 dev="tmpfs" ino=390155 scontext=u:r:surfaceflinger:s0 tcontext=u:object_r:surfaceflinger_tmpfs:s0 tclass=file permissive=1
[ 5288.287213] type=1400 audit(1559639243.779:2426): avc: denied { dac_read_search } for pid=1491 comm="lmkd" capability=2 scontext=u:r:lmkd:s0 tcontext=u:r:lmkd:s0 tclass=capability permissive=1
[ 5293.408636] binder_alloc: 1602: binder_alloc_buf size 1043592 failed, no address space
[ 5293.408641] binder_alloc: allocated: 304 (num: 4 largest: 280), free: 1040080 (num: 3 largest: 1039696)
[ 5293.408647] binder: 10874:10874 transaction failed 29201/-28, size 1043592-0 line 3138
[ 5293.498186] type=1400 audit(1559639243.779:2426): avc: denied { dac_read_search } for pid=1491 comm="lmkd" capability=2 scontext=u:r:lmkd:s0 tcontext=u:r:lmkd:s0 tclass=capability permissive=1
[ 5293.498199] type=1400 audit(1559639248.990:2427): avc: denied { write } for pid=1602 comm="ActivityManager" name="timerslack_ns" dev="proc" ino=389720 scontext=u:r:system_server:s0 tcontext=u:r:priv_app:s0:c512,c768 tclass=file permissive=1
[ 5294.103125] type=1400 audit(1559639248.990:2427): avc: denied { write } for pid=1602 comm="ActivityManager" name="timerslack_ns" dev="proc" ino=389720 scontext=u:r:system_server:s0 tcontext=u:r:priv_app:s0:c512,c768 tclass=file permissive=1
[ 5294.103166] type=1400 audit(1559639249.595:2428): avc: denied { ioctl } for pid=2110 comm="RenderThread" path="/dev/dri/card0" dev="tmpfs" ino=8550 ioctlcmd=0x6469 scontext=u:r:priv_app:s0:c512,c768 tcontext=u:object_r:device:s0 tclass=chr_file permissive=1
[ 5294.103332] type=1400 audit(1559639249.595:2428): avc: denied { ioctl } for pid=2110 comm="RenderThread" path="/dev/dri/card0" dev="tmpfs" ino=8550 ioctlcmd=0x6469 scontext=u:r:priv_app:s0:c512,c768 tcontext=u:object_r:device:s0 tclass=chr_file permissive=1
[ 5294.103341] type=1400 audit(1559639249.595:2429): avc: denied { map } for pid=2110 comm="RenderThread" path=2F69393135202864656C6574656429 dev="tmpfs" ino=388802 scontext=u:r:priv_app:s0:c512,c768 tcontext=u:object_r:priv_app_tmpfs:s0:c512,c768 tclass=file permissive=1
[ 5297.937109] init: Untracked pid 11315 killed by signal 1
[ 5297.937235] type=1400 audit(1559639249.595:2429): avc: denied { map } for pid=2110 comm="RenderThread" path=2F69393135202864656C6574656429 dev="tmpfs" ino=388802 scontext=u:r:priv_app:s0:c512,c768 tcontext=u:object_r:priv_app_tmpfs:s0:c512,c768 tclass=file permissive=1
[ 5297.937246] type=1400 audit(1559639253.429:2430): avc: denied { ioctl } for pid=11316 comm="su" path="/dev/pts/0" dev="devpts" ino=3 ioctlcmd=0x5404 scontext=u:r:untrusted_app_25:s0:c512,c768 tcontext=u:object_r:untrusted_app_25_devpts:s0:c512,c768 tclass=chr_file permissive=1

x86_64:/ $
mbradley612 commented 4 years ago

I have experienced exactly the same. For what it's worth, I'm using KVM on an Ubuntu 16.04 host. Seems to work perfectly in live mode with audio. Bluetooth doesn't work in install mode with same hciconfig output as Vafa describes.

Are there any potential fixes?

ThomasFreedman commented 4 years ago

Similar issue here. Been beating my head against the wall trying to find a solution. This was the first thing I found that describes the issue even close to what I'm seeing.

All looks fine with hciconfig & hcitool, but the GUI doesn't seem able to turn it on, it only shows the switch in the off position when you go to that setting. Oh you can change the position of the toggle switch to "on", but it will remain gray. Going out & coming back in shows it in the left or disabled state.

I can bring the device "up", but when I scan it sees no remote devices and there are at least 2 very close by. Same with hcitool lescan

In my case I'm running under a VirtualBox VM, but USB is being seen by the VM so I know there's not an issue seeing the device, since hciconfig & hcitool sees it and can bring it "up" and hciconfig -a info changes appropriately.

ouhena commented 2 years ago

Same here with android-x86-9.0-r2.iso in VirtualBox. The Bluetooth works fine in LiveCD mode but not after installation on hard drive. In installed mode I can have hciconfig and hcitool working from terminal only after 'su', not in user mode

grifcj commented 2 years ago

Same for me with android-x86-9.0-r2.iso and android-x86_64-9.0-r2.iso with installed versions. Also, I was able to get the live version to fail if I enable/disabled bluetooth and capture/uncapture bluetooth dongles enough.

On Ubuntu 20.04 with internal intel bluetooth. Interface can be brought up with hciconfig and lescan performed with hcitool. GUI doesn't work, keep getting "Bluetooth keeps stopping" warning from Android.

Jikodis commented 2 years ago

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:

Extra Commands:

Notes:

cetsupport commented 2 years ago

@Jikodis Your comments are very useful. I recently installed the Bliss OS 14.03 with GMS support. VPN, WIFI, Sound output via HDMI all works fine, except the blue tooth.

I followed your step one by one, when execute: "pm disable com.android.bluetooth" found there no com.android.bluetooth package in my system. Do you think this is a problem?

Jikodis commented 2 years ago

@cetsupport Do you get a bluetooth stopped responding message? You should be able to tap the dialog for more info to see what the package/app is that handles bluetooth. You may be able to find the package name then after finding the app in the Play Store and checking the URL of the page.

You can also check this answer on Stack Overflow for a way to get a list of all package names. There is even a pm command that handles that it appears.

You could run something like pm list packages -f bluetooth to perhaps see packages related to bluetooth. If you don't see anything, you might just run pm list packages -f without the search filter and scan and see what you find.

A final alternative that may work is searching the Play Store for "package name" and find an app that lists out package names for you.

Hope this is helpful. Definitely great once bluetooth starts working. I am successfully using a FitBit with Android-x86 in a VM on VirtualBox. I admittedly have to run the terminal commands from time to time, but it is worth it to have the functionality of my FitBit. My next step is creating an executable bash file that will run the commands automatically. I just have not gotten around to it since every time I create a file, it is not there on reboot.