aprsdroid
aprsdroid copied to clipboard
No TX possible: bluetooth disconnected with java.io.IOException: bt closed, read return: -1
With Android 7.1 or Android 7.0, mobilinkd tnc2.2 and aprsdroid (1.3.0-107-gd893eac 2017-05.12) the log keeps telling that bluetooth disconnected while it tries to TX. RX is working fine. Also close station (like 3m away) cannot receive anything from that setup.
Error messages:
bluetooth disconnected java.io.IOException: bt closed, read return: -1 Reconnecting in 3s...
The app will then retry to send a position. The error reoccurs.
The mobilinkd-app is disconnected and even forcefully shutdown to be very sure.
Connection settings in APRSdroid:
TNC (KISS) Bluetooth SPP Channel empty TNC Init-Delay 300 TNC Init-String empty
Thank you very much for your work on aprsdroid!
Unfortunately, I have exactly the same problem. I’m using Android 6.0.1 and APRSdroid v1.3.0 (2015-04-03). Thanks a lot.
Does that happen before or after the packet is sent from APRSdroid to the TNC? I.e. can you see it as "Bluetooth OK" in the log?
If yes, it is probably an RF shielding problem between the TNC and the radio, where the RF emission causes the Bluetooth connection to be interrupted.
If no, the only other problem I can imagine right now is that Android is doing "battery optimizations" on the app, causing it to stop working properly. However, that shouldn't happen with a foreground notification, which APRSdroid is using.
You could try disabling Doze mode for APRSdroid: http://www.greenbot.com/article/2993199/android/how-to-turn-off-doze-mode-for-specific-apps-in-android-marshmallow.html
Thanks for your help. Really appreciate it.
It seems like it happens before the packet is sent from APRSdroid to the TNC. I can’t find anything like “Bluetooth ok” in the logs.
I also tried it without a radio connected to the TNC. The result was the same (like described in the first post). Therefore, RF Shielding doesn’t seem to be the problem.
Disabling the doze mode didn’t make any difference either.
Do you have any other ideas what could cause the problem?
"Does that happen before or after the packet is sent from APRSdroid to the TNC? I.e. can you see it as "Bluetooth OK" in the log?"
The packet is not listed as bluetooth OK. Instead it says bluetooth disconnected in about 90% of cases. Maybe this description narrows it down further:
The radio does not show any TX signs with aprsdroid at all. But the configuration-app of the TNC2.2, mobilinkd, does work. The test signal can be transmitted successfully through the radio. Therefore the Android device can trigger the push to talk and send a tone via bluetooth.
Somehow aprsdroid does not trigger the same path. Are there any known problems with bluetooth spp? Is there a fallback configuration to help BT getting more stable?
APRSdroid is using standard Bluetooth APIs to connect to an SPP socket on a remote device, and unfortunately the error messages are not really useful.
In the past, Android's BT stack has been very brittle, but that got fixed some time around Android 4.x. I've personally had many many hours of APRSdroid usage via Bluetooth from my Android 6 device, both to a Mobilinkd TNC and to the Kenwood TH-D74, without any problems. My most burdening setup for Bluetooth so far has been running Android Auto with a Bluetooth audio connection to the car radio, plus Bluetooth SPP to the D74. The audio connection was playing music and APRSdroid's TTS. You had to start APRSdroid after setting up the audio connection, but it was stable afterwards.
I also tested APRSdroid on an Android 7 device with the TNC2 right now, and there were no problems.
From the description it really looks like a Bluetooth radio transmission problem of some kind - too bad signal, Android and TNC losing the Bluetooth connection for some reason (and Android only noticing that when trying to transmit), etc.; or maybe really a bug in your Bluetooth drivers. What manufacturer and Android firmware are you on?
Rolling back to version 1.3 fixed the issue for me. So something introduced in 1.4.
@karrots there was a major refactoring of APRSdroid components between 1.3 and 1.4, but nothing that would actually change the Bluetooth access. Is the fix reproducible?
So I may have posted the above too soon. Once I tried to start another session it had issues again. Even with the older version, Due to some personal time constraints (and winter), I haven't been able to do much testing. It may have been the clearing of the cache/data before reinstall that fixed it temporarily.
My feeling is still that this is either a stability problem with your device's Bluetooth driver or with the 2.4 GHz spectrum at your place. The former might be temporarily "fixed" by restating android.
The testing is in my car outside or up in the mountains. Its just odd that receive is fine until a TX happens then everything gets disconnected.
On Fri, Feb 9, 2018 at 11:19 AM, Georg Lukas [email protected] wrote:
My feeling is still that this is either a stability problem with your device's Bluetooth driver or with the 2.4 GHz spectrum at your place. The former might be temporarily "fixed" by restating android.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ge0rg/aprsdroid/issues/178#issuecomment-364514951, or mute the thread https://github.com/notifications/unsubscribe-auth/AGA_aI1mvdSe7z8y9HiOhNUJFW2mulsJks5tTIwbgaJpZM4OUurS .
If the disconnect is triggered by a TX, then maybe the issue is that you are actually doing high-power RF transmissions near to your Android, and its poor 2.4GHz antenna is totally overloaded by whatever power your radio emits? ;-)
Used to work just fine in the same setup. I'll try again I now have a different phone. The antenna is outside my car. I'm pretty sure I tried it on my house antenna as well. I'll also try with the new version you just released.
You could check whether reducing TX power on the radio will help with the issue. The disconnect happening on TX really indicates some RF influence issue.