[BRLTTY] Repeated Bluetooth pairing request on Android
Robert Pösel
robyer at seznam.cz
Mon Mar 5 12:20:32 EST 2018
Hi,
I am having annoing problem when using BRLTTY on Android with Braille
device connected via Bluetooth. I'm using Humanware Brailliant BI 40
which I paired with Android phone and then in BRLTTY settings I added
and selected this device and everything works as expected. Then when I
turn off the Braille device, BRLTTY after few seconds correctly realizes
it's disconnected and plays a sound. But when I turn the Braille device
on again, most of the time it shows the pairing dialog to pair the
device again. I have tested different Android devices with different
Android versions (Android 7.0 and Android 7.1.1) and the issue is
happening on all of them.
There are 2 interesting things that I realized:
1) It doesn't unpair all the time, but it happens only some times. It
feels like it is dependend on the specific moment when I turn on the
device, but I'm unable to really determine what is the trigger. On
average it happens in 50 % of attempts.
2) It seems to work correctly (without repeated pairing request) in
BrailleBack app. I see as a difference that in BrailleBack I need to
initiate connection to the Braille device manually via click in the
options, while in BRLTTY app it tries to connect automatically every few
seconds. So I thought that BRLTTY may somehow interrupt or cancel the
paired state of the Braille device resulting in Android showing pairing
dialog again.
And during writing of this e-mail I've found the issue and solution.
Problem was indeed in BRLTTY code, namely in the
BluetoothConnection.open() method. There is check "if (channel == 0)"
based on which it uses either direct call on device object, or it uses
reflection to call some hidden method on the device object. I don't
understand the purpose of this channel argument and whole condition,
could you clarify why it was written this way? In my case channel value
was 1, so it was calling the hidden method via reflection and was
causing the problems with pairing dialog I described. When I removed the
if check and always used the correct call (as if channel value was 0),
everything works correctly and I've experienced no pairing dialog ever
again.
I think that if-block and reflection call to that hidden method should
be removed completely.
Best regards
Robert Pösel
More information about the BRLTTY
mailing list