piggz / harbour-amazfish

Amazfit Bip support for SailfishOS
GNU General Public License v3.0
103 stars 51 forks source link

Xperia X keeps disconnecting and often wont ever reconnect again. #169

Closed Malakay666 closed 3 years ago

Malakay666 commented 3 years ago

Hi Piggz, I have Xperia X with SFOS 3.4.0.24 now. Problem first appeared when I bought my Amazfit Bip watch (A1608) and tried to use Amazfish with version 3.2.0.12 Torronsuo.

The problem is that I can´t rely on my watch because quite often watch disconnects - sometimes it will reconnect, but quite often it won´t even after an hour, so I missed many important calls. I don´t need BPM measure, fitness features etc, I only want to be notified, nothing more, nothing less.

So I tried multiple watch FW versions, even Amazfish versions, but problem appeared on every version I tried. Sometimes more often, sometimes less.

Then I upgraded to 3.4.0.24, problem still persisted. I did factory reset of my phone, problem still persists. I am out of more ideas. I stopped exploring this in july 2020, so I obtained logs from that time.

One more thing - I use automatic powersave mode after disconnecting charger from phone to keep battery last longer, but even with this disabled problem still persisted.

I am desperate of all this, please help.

Amazfish_2020-07-13T054040.txt Amazfish_2020-07-13T055943.txt Amazfish_2020-07-13T060104.txt Amazfish_2020-07-19T180225.txt

Malakay666 commented 3 years ago

So, yesterday I reinstalled Amazfish again to make some new logs. Yesterday it was working flawlessly, disconnected maybe 2 times, but perhaps because I went too far from phone. But when I went to sleep, it started again during the night. In the morning I had many notifications "Your phone and watch are now connected". And, until now, problem still occurs.

Log from night 14-15 Feb (22pm-6am) Amazfish_2021-02-15T06-18-25.txt

Log from today (6am - 9am) Amazfish_2021-02-15T08-54-40.txt

Log from today (10am - 12) Amazfish_2021-02-15T12-30-42.txt

piggz commented 3 years ago

Very strange One thing for certain, the application doesnt crash, so its not that. I suspect the problem is at a lower level than Amazfish because Amazfish is getting notified by bluez that the connection was lost.

Is the watch firmware up to date? Perhaps you could ask other Xperia X users for their experience with bluetooth?

Malakay666 commented 3 years ago

I assume that other Xperia X users dont have this problem at all - i didnt see any coment like that on openrepos. Watch FW is 1.1.6.48. You have written on openrepos that is tested with 0.1.1.45 which is obsolete, so I tried multiple versions, sometimes better, sometimes not, but problem didnt disappeared.

I noticed one thing today morning - when I am not caring about my phone, it disconnects much more often then I am doing something on the phone. Maybe some "sleeping" feature of BT? I have automatic powersave enabled, maybe this can cause something?

Malakay666 commented 3 years ago

But again - when I disable powersave, its the same One more thing - does bluez support some kind of logging? Maybe we can check even there. I have BT headset for accepting calls I often use - there is no problem with it even after few hours connected (even with automatic powersave feature). So maybe some watch problem?

Malakay666 commented 3 years ago

Logs from afternoon/evening Amazfish_2021-02-15T19-21-57.txt Amazfish_2021-02-15T19-23-00.txt

piggz commented 3 years ago

Can you look at the times of some of the messages like BipDevice::onPropertiesChanged: "org.bluez.Device1" QMap(("Connected", QVariant(bool, false))("ServicesResolved", QVariant(bool, false))) () ANd look i the full journal to see if there is anything else going on at that time

Malakay666 commented 3 years ago

how to display full journal?

Malakay666 commented 3 years ago

i googled a little and found this: journalctl -ab --no-pager > $MYHOME/journal.txt so, output here: journal.txt

piggz commented 3 years ago

Ok, its quite clear from that log that the disconnect happens whenever your phone sleeps ... ever occurrence of the disconnect is preceded by power-management sleep messages, I think you need to ask on general sailfish forums about this. Maybe i could add some code to prevent the sleep, ill have a think.

Example: Feb 15 18:42:42 Sailfish kernel: Freezing user space processes ... (elapsed 0.003 seconds) done. Feb 15 18:42:42 Sailfish kernel: Freezing remaining freezable tasks ... (elapsed 0.003 seconds) done. Feb 15 18:42:42 Sailfish kernel: Suspending console(s) (use no_console_suspend to debug) Feb 15 18:42:42 Sailfish kernel: as3668 6-0042: Suspending AS3668 Feb 15 18:42:42 Sailfish kernel: PM: suspend of devices complete after 19.829 msecs Feb 15 18:42:42 Sailfish kernel: PM: late suspend of devices complete after 1.084 msecs Feb 15 18:42:42 Sailfish kernel: PM: noirq suspend of devices complete after 1.926 msecs Feb 15 18:42:42 Sailfish kernel: Disabling non-boot CPUs ... Feb 15 18:42:42 Sailfish kernel: __qpnpint_handle_irq: 363 triggered [0x0, 0x61,0x1] qpnp_rtc_alarm Feb 15 18:42:42 Sailfish kernel: Suspended for 0.000 seconds Feb 15 18:42:42 Sailfish kernel: Enabling non-boot CPUs ... Feb 15 18:42:42 Sailfish kernel: CPU1 is up Feb 15 18:42:42 Sailfish kernel: CPU2 is up Feb 15 18:42:42 Sailfish kernel: CPU3 is up Feb 15 18:42:42 Sailfish kernel: PM: noirq resume of devices complete after 0.636 msecs Feb 15 18:42:42 Sailfish kernel: PM: early resume of devices complete after 0.810 msecs Feb 15 18:42:42 Sailfish kernel: as3668 6-0042: Resuming AS3668 Feb 15 18:42:42 Sailfish kernel: PM: resume of devices complete after 45.480 msecs Feb 15 18:39:52 Sailfish firmware[3267]: Loaded firmware venus-v1.mdt Feb 15 18:42:42 Sailfish kernel: Restarting tasks ... done. Feb 15 18:42:42 Sailfish kernel: Resume caused by IRQ 240, 1000000.pinctrl Feb 15 18:42:42 Sailfish kernel: Resume caused by IRQ 222, 200f000.qcom,spmi Feb 15 18:42:42 Sailfish kernel: Resume caused by IRQ 203, 601d0.qcom,mpm Feb 15 18:42:42 Sailfish kernel: Resume caused by IRQ 200, qcom,smd-rpm Feb 15 18:42:42 Sailfish kernel: Resume caused by IRQ 363, qpnp_rtc_alarm Feb 15 18:42:42 Sailfish firmware[3270]: Loaded firmware mba.mbn Feb 15 18:42:42 Sailfish harbour-amazfishd[16880]: [D] unknown:0 - BipDevice::onPropertiesChanged: "org.bluez.Device1" QMap(("Connected", QVariant(bool, false))("ServicesResolved", QVariant(bool, false))) ()

Malakay666 commented 3 years ago

is any way to exclude amazfish from sleep?

wait......now I remember - I bought another watch (cheap one from china for test) and it stays connected flawlessly....interesting that amazfish connection falls, but another watch incompatible with amazfish stays working

Malakay666 commented 3 years ago

I disabled powersaving mode one more time to try, but today at 15:05 few minutes after disabling - disconnected again -_-

Amazfish_2021-02-16T15-05-25.txt journal.txt

Malakay666 commented 3 years ago

Hi Piggz, I found this, maybe it could help?

https://together.jolla.com/question/181730/work-arounddisable-power-saving-mode-best-practice/

piggz commented 3 years ago

Thanks, yes, my idea was to use libkeepalive. Ill add it next, maybe make it an option while it is tested.

Malakay666 commented 3 years ago

Someone on forum told me to try mcetools and disable late suspend, im going to try

Malakay666 commented 3 years ago

But I found something strange - today I run amazfish and it told me I have FW too old to change display items - but i have already did that and it worked. It tells me that required is 0.1.1.4, but i have much newer 1.1.6.48. Does it mean I have to downgrade?

Malakay666 commented 3 years ago

So, it seems that MCETool is a right way (or workaround until piggz tests libkeepalive)

I disabled late suspend feature with command: mcetool --set-suspend-policy=early

Today my watch were working flawlessly at work. Didn´t lose connection even once, just only when I got home, let my phone on a table and went to another room it lost connection. When I got back, reconnected almost instantly :)

EDIT: Today (tuesday) watch was working flawlessly too :)

So I think this problem is solved.

Piggz, I have few more questions: 1) it is said on Storeman, even in app, that Amazfish is tested with watch FW ver. 0.1.1.4, I have 1.1.6.48 which is much newer. Should I do downgrade or I can keep actual FW? One time app told me I can´t edit Menu display items because of FW version, but now it works even with 1.1.6.48

2) I found that every notification comes twice - one is okay, another is almost okay with few strange symbols. Is there any known solution for this? EDIT: I found that only SMS notifications are doubled, for example Threema notifications are not.

3) for Amazfit Bip watch I found that they´re equipped with GPS and Glonass. I care about my privacy, so I want to know, if my position is somehow proccessed by Amazfish, or if Amazfish doesn´t support any GPS/Glonass related functions, so I don´t have to be bothered about this :)

Thanks

piggz commented 3 years ago

1)No, you should be fine with the new FW 2)SMS issue is known .. Can you raise a separate issue for this please 3)Amazfish DOES allow you to download outdoor activities captured on your watch, such as running/cycling. It stores a TCX file on the phone, along with other data like heartrate /calories etc captured by the watch, and stores these in its database. There is also an option to upload activities to Strava (a website for runners/cyclists) but that is an optional and manual activity.

Malakay666 commented 3 years ago

So, If I understand correctly, when I turn on some outdoor activity on the watch, it turns on gps on watch and amazfish starts logging. If I just use watch as watch and notifications, gps on the watch is disabled?

Malakay666 commented 3 years ago

And even if it not disabled, amazfish logs it to the phone only. So If I understand correctly, it is privacy-secure?

Malakay666 commented 3 years ago

And yes, I will post it as issue when i got home :)

piggz commented 3 years ago

No, amazfish never has access to the live GPS data. The watch stores the track on internal memory, and amazfish can download it afterwards. Download is a manual operation, it doesnt sync activities automatically like the Zepp/Amazifsh apps, or do any auto uploading.

Malakay666 commented 3 years ago

Ah, great :) so its privacy-secure :) thanks a lot :)