I was hoping to get some bluetooth devices and do some testing, but it actually won't happen soon, so I can't test more. With what I have bluez is handling ok.
Though there's one more minor issue I'm experiencing but it seems related to bluez itself (it happens on other systems), not the port. I'm looking into it too.
Other than this issue I don't see any major one.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
This minor issue is another race that happens sometimes on bluez android hidhost. Unfortunately I couldn't find the solution for it.
Sometimes when reconnecting a paired hid device to the pc/tablet, if a error SDP Record I/O happens during the reconnection the device is set disconnected, but (in my case, a bluetooth keyboard) immediately after the disconnection it tries to connect again to the pc/tablet, after some time bluez crashes because a broken pipe.
Most time the crash happens on:
file: external/bluetooth/bluez/src/sdp-client.c
Line 205
if (ctxt->cb)
--> ctxt->cb(recs, err, ctxt->user_data);
ctxt->cb is unreferenced with invalid address pointer and ctxt->user_data becomes null.
But it can also happen after randomly.
Even though, this error happens rarely and most time when bluetooth restart the hid device can work again by itself.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
1 - SDP Record error in various situations:
I thought that would happen very rarely as I pointed in the previous post but actually happens a lot. So the situations are the following:
Can happen when pairing with a Android phone and computers ( I could only try it with my android phone, don't know about other mobile OS)
It always happens when trying to pair a device with Android Wear
Can happen when reconnecting some paired devices (I tried only with a Bluetooth keyboard but I feel that with other devices can happen more times than others)
I did a lot of debugging and I found that for some reason sometimes the response for the pairing is not correct causing the other device to be waiting until it timeout.
If I had a good reproducible steps I could trace the problem but after all this time I couldn't find a way. The Android Wear does always show the error but I couldn't find a way to make it work, so nothing good here.
(It can also be that the socket connection is closing randomly way before than it should be, that would explain the random behaviour but also after some debugging I couldn't find the bug) [1]
These issues probably can be fixed if the new SDP Search API is implemented into Bluez. [2][3]
More informations here [4]
2 - Sending a file to a Android phone doesn't work (Tested with a Android 4.4.2)
Sending a file to Android-x86 from a Android phone hangs or corrupt information is sent. (Tested with a Android 4.4.2)
When I send a file through my phone to Android-x86 often the incoming file transfer will hang but sometimes it doesn't timeout and close
When this happens I can send files (outgoing file transfer) to my phone as it should be, without any issue.
Of course because the incoming file transfer is hanged I can't send files from my phone until I turn bluetooth off or finish the file transfer from my phone.
If I stop the hanged file transfer the issue about sending files will starts again.
The incoming file transfer can also work if the file have a low size but ~50% of the data is corrupt.
These issue only happens when I tried with my phone, trying with my computer with a usb bluetooth dongle both sending and receiving files works with no data corruption.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi André, now the file transfer is fixed. Do you see any other major issue of the porting?
I was hoping to get some bluetooth devices and do some testing, but it actually won't happen soon, so I can't test more. With what I have bluez is handling ok.
Though there's one more minor issue I'm experiencing but it seems related to bluez itself (it happens on other systems), not the port. I'm looking into it too.
Other than this issue I don't see any major one.
This minor issue is another race that happens sometimes on bluez android hidhost. Unfortunately I couldn't find the solution for it.
Sometimes when reconnecting a paired hid device to the pc/tablet, if a error SDP Record I/O happens during the reconnection the device is set disconnected, but (in my case, a bluetooth keyboard) immediately after the disconnection it tries to connect again to the pc/tablet, after some time bluez crashes because a broken pipe.
Most time the crash happens on:
But it can also happen after randomly.
Even though, this error happens rarely and most time when bluetooth restart the hid device can work again by itself.
Ok, so the current status of bluez porting is:
1 - SDP Record error in various situations:
I thought that would happen very rarely as I pointed in the previous post but actually happens a lot. So the situations are the following:
I did a lot of debugging and I found that for some reason sometimes the response for the pairing is not correct causing the other device to be waiting until it timeout.
If I had a good reproducible steps I could trace the problem but after all this time I couldn't find a way. The Android Wear does always show the error but I couldn't find a way to make it work, so nothing good here.
(It can also be that the socket connection is closing randomly way before than it should be, that would explain the random behaviour but also after some debugging I couldn't find the bug) [1]
These issues probably can be fixed if the new SDP Search API is implemented into Bluez. [2][3]
More informations here [4]
[1] https://android.googlesource.com/platform/system/bt/+/8372aa5fa535ee4f09c09981b6125b54ace31fe2%5E%21/#F29
Bluez has a similar function but we don't have a "close(send_fd)" on it, bluez probably has it somewhere but I didn't find.
If the issue is really this it's probably a similar call happening somewhere.
[2] https://android.googlesource.com/platform/hardware/libhardware/+/43d3443ce2a7c6749582d6c70abb59ebc5af10c4%5E!
[3] https://android.googlesource.com/platform/system/bt/+/8372aa5fa535ee4f09c09981b6125b54ace31fe2%5E%21
[4] https://android.googlesource.com/platform/packages/apps/Bluetooth/+/bbb4110b455b3aa29106d5b4f0a37e1be8e09475
2 - Sending a file to a Android phone doesn't work (Tested with a Android 4.4.2)
Sending a file to Android-x86 from a Android phone hangs or corrupt information is sent. (Tested with a Android 4.4.2)
When I send a file through my phone to Android-x86 often the incoming file transfer will hang but sometimes it doesn't timeout and close
When this happens I can send files (outgoing file transfer) to my phone as it should be, without any issue.
Of course because the incoming file transfer is hanged I can't send files from my phone until I turn bluetooth off or finish the file transfer from my phone.
If I stop the hanged file transfer the issue about sending files will starts again.
The incoming file transfer can also work if the file have a low size but ~50% of the data is corrupt.
These issue only happens when I tried with my phone, trying with my computer with a usb bluetooth dongle both sending and receiving files works with no data corruption.
I got another device with bluetooth and did some tests with it, turn out that pretty much everything works except for the Android Wear.
So all I wrote before should be bugs with the realtek bluetooth kernel driver or my tablet's bluetooth is damaged.
Last edit: André Vitor 2016-02-03