azymohliad / watchmate

PineTime smart watch companion app for Linux phone and desktop
GNU General Public License v3.0
136 stars 4 forks source link

Occasionally will not reconnect after suspend #54

Open grahamvh opened 7 months ago

grahamvh commented 7 months ago

Occasionally when resuming from suspend watchmate will fail to reconnect with the watch. What I see is watchmate sees the watch and spins trying to connect,but is never able to connect to it. Restarting watchmate does not help. Restarting the PineTime will allow watchmate to reconnect.

Version: v0.5.1 (flatpak) OS: PureOS 10 Hardware: Librem 5 & PineTime Smartwatch

Thank you again for fixing the suspend connection before!

azymohliad commented 7 months ago

Hi, thanks for the report. I'm not sure when I can look deeper into it. Meanwhile, when you reproduce it again, could you also try going out of range for 10-20 seconds instead of restarting the PineTime? And maybe also removing the device from the system bluetooth settings? I wonder if something affects it from the PineTime side as well so that restart is necessary, or is it only because Bluez looses it for the duration of restart.

fernandosanchezjr commented 7 months ago

Experiencing the same thing. Removing the device from system bluetooth settings fixes the problem. This watch does not show a bluetooth pairing confirmation number when connecting to this app, but it does when pairing to the phone with Gadgetbridge instead.

Thanks for the app, it's very nice and THE EASIEST WAY to update firmware + resources on the watch.

Host OS: Ubuntu 23.10 & Infinitime 1.13.0 Hardware: PineTime

azymohliad commented 4 months ago

I've pushed another fix for waking up from suspend in #62. Turns out there was a pretty silly mistake that would occasionally cause device discovery to stuck in an infinite loop without actually scanning, and also increasing the CPU usage (#57). I doubt it's the same issue that you were having, because in this case app restart would've helped. But the fix also tracks the bluetooth adapters state more carefully, so there's a chance it might help here too.

I want to include some more fixes and additions into the next release and test it more, so I'm not sure when I'm gonna release it. But if you'd like to try this earlier, you can install this test build from Flathub CI:

flatpak install --user https://dl.flathub.org/build-repo/87429/io.gitlab.azymohliad.WatchMate.flatpakref

UPD: Those fixes are now released as 0.5.2, but auto-reconnection is still not very reliable, and the plan is to implement secure pairing first, and then try another way of reconnection.