AsteroidOS / AsteroidOSSync

Android application to synchronize a phone with a watch running asteroid-btsyncd.
GNU General Public License v3.0
101 stars 37 forks source link

Cannot pair dory (Asteroid OS 1.0) to Nexus 5 (LineageOS 14.1, AsteroidOS Sync 0.11) #49

Closed DamageIncorporated closed 6 years ago

DamageIncorporated commented 6 years ago

When trying to pair the watch, the same PIN appears on both screens, but when I accept, the devices don't pair. On the phone appears an error message, that the PIN is incorrect and the device cannot be paired.

This happens when using the sync app or the bluetooth settings on the phone.

DamageIncorporated commented 6 years ago

...maybe this is a duplicate or related to https://github.com/AsteroidOS/asteroid-btsyncd/issues/4 ? Sorry I didn't see that issue before posting this one.

Unfortunately I can't help to debug this with a PC: My old ThinkPad doesn't support Bluetooth 4.0 or BLE and doesn't recognise the watch at all :-/

DamageIncorporated commented 6 years ago

I've tried to get a log from my phone.

This is the approximate time of my last failed attempt, filtered for all entries containing "bluetooth". I hope this helps and contains all relevant information. If not, I can generate another log if needed.

I don't understand anything of this stuff, but with a little help I think I can provide the information you need and help debugging/testing this issue :-)

logcat_05-18-2018_09-00-39.txt

FlorentRevest commented 6 years ago

Hey! Thanks a lot for reporting and for your logs. :) Could you please try to send the result of "hcidump" ran as root over SSH on your watch while this behavior is observed? ;) This should be a bit verbose but will be more helpful.

DamageIncorporated commented 6 years ago

Hey, Now I've managed to get a ssh connection (my usb cable connection was unstable) and ran hcidump while trying to pair several times. Sometimes I clicked the "pair"-button on the phone and then on the watch, sometimes I did it in reverse order to create variations in the log.

Here's the result: hcidump.txt

I hope that helps :-)

FlorentRevest commented 6 years ago

Mhh... Interesting, that actually reminds me of what made me write that commit: https://github.com/AsteroidOS/AsteroidOSSync/commit/9e66e094228b0d3af27dbd0ae97edbab28da3935 I believe the error was the same. However, it caused more problems than it solved and I finally had to revert that commit: https://github.com/AsteroidOS/AsteroidOSSync/commit/1b6ed04dc22a67a59119655f59f8b3c7e05dca5a

Could you please try to: 1 - Go to your phone's settings app. Open the Settings app. Go to the Bluetooth page. Make it "forget" your watch. Open AsteroidOSSync and try again 2- If you feel like doing so, reapply https://github.com/AsteroidOS/AsteroidOSSync/commit/9e66e094228b0d3af27dbd0ae97edbab28da3935 on the current AsteroidOSSync's code and recompile it. (you'd need the android sdk for that... :/ )

DamageIncorporated commented 6 years ago

... Oh I forgot something: I noticed another effect while doing the dump above: The PIN displayed on both screens was not always identical, on some occasions in the beginning the phone displayed the PIN with a leading 0. Example: Phone: 065874 Watch: 65874

FlorentRevest commented 6 years ago

That last comment is interesting. Could you please create an issue on asteroid-launcher regarding that?

DamageIncorporated commented 6 years ago

Okay, tomorrow. I'm leaving to have some beers with my buddies now ;-)

FlorentRevest commented 6 years ago

I see you've got your priorities straight. :) Enjoy! Drink one for me

DamageIncorporated commented 6 years ago

Update: I've tried to reflash dory to start from scratch, but now the phone doesn't find the watch at all, neither in AsteroidOSSync nor from bluetooth settings...

This is not meant to complain, but just to inform I can't run further tests on this issue at the moment. I think my next step will be to patch, compile and reflash as you suggested above :-)

...May take a while since this will be my first time drilling that deep ;-)

DamageIncorporated commented 6 years ago

@FlorentRevest I want to try out the commit you mentioned earlier: https://github.com/AsteroidOS/AsteroidOSSync/commit/9e66e094228b0d3af27dbd0ae97edbab28da3935

I've now downloaded the repository and ran ./prepare-build.sh dory

(At the moment, I bitbake the current Asteroid image to try that on the watch and check if I did something wrong already...)

As a non-developer I have literally no clue how to use git or version control in general, but this is a nice opportunity to start learning

can you give me a kickstart and post a sample git commandline how to apply the commit to my local repository? I resist to add this oneliner by hand to get a foot in the door to git wonderland ;-)

FlorentRevest commented 6 years ago

Oh... It looks like you spent a very fair amount of time recompiling the entire AsteroidOS while I was only talking about recompiling the AsteroidOSSync android app. Actually, you just need to clone that repository:

git clone https://github.com/AsteroidOS/AsteroidOSSync

Install Android Studio https://developer.android.com/studio/ Import the project Add the following line

cfg.useGattRefresh = true;

After the line 240 of SynchronizationService.java https://github.com/AsteroidOS/AsteroidOSSync/blob/master/app/src/main/java/org/asteroidos/sync/services/SynchronizationService.java#L240

Compile everything from Android Studio and send it to your phone

DamageIncorporated commented 6 years ago

Hey Florent, I'm sorry I couldn't keep up on this issue for a while, but some real life issues got in the way and my watch "disappeared" for some weeks :-)

I have a small boy (3) so this was no real surprise ;-)

Today I found the watch and started over with a new phone (now Lineage 15.1) and despite some instabilities the connection was established and good..

So for me the issue is solved and I can't help to test on it anymore.

Thanks for your help up to now!

Greetings, Markus

FlorentRevest commented 6 years ago

Hi Markus, No worries, I understand, I also have a life! I still can't explain what happened with your previous phone but I assume it might have been a phone/lineage problem. :) I'll close this issue then. Thanks again for reporting!