piggz / harbour-amazfish

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

Amazfish Port for PinePhone? #156

Closed je-nix closed 2 months ago

je-nix commented 3 years ago

I recently bought a PinePhone 0 and plan to replace my SFOS XperiaX once the software gets stable enough. The only thing currently missing is support for my Amazfish GTS. So I was wondering, if Amazfish could be ported / build for native Linux? The base architecture of the PinePhone is the same as SFOS (aarch64) and the library dependencies should hopefully be available. The main issue would probably be the UI, since most distros for PinePhone rely on qt5. Unfortunately, I have no experience with building / adapting software to other platforms. I also couldn't find any build instructions for Amazfish to determine if this would even be feasible. Can you please help me out here?

Thanks.

piggz commented 3 years ago

Since 1.8, the amazfish UI has been completely re-written just for ths purpose. I already have some people using it on manjaro. Best way to proceed would be to ask distro packagers for whatever distro you use to contribute.

je-nix commented 3 years ago

This sounds amazing, especially since I'm looking forward to use the Manjaro builds on my Pine. Do you know if there are precompiled packages or building instructions somewhere?

dano6 commented 3 years ago

It should be possible to install on Manjaro-arm, see https://gitlab.manjaro.org/manjaro-arm/packages/community/plasma-mobile/amazfish/

je-nix commented 3 years ago

@dano6 Thank you so much for the link. Are you in any way involved with the PKGBUILD for Manjaro? I tried to build it on my Pinephone with the Manjaro Posh Beta 4, but the build keeps failing because of a missing dependency for the daemon.pro target:

Project ERROR: libkmcal-qt5 development package not found

From my research, it seems that kmcal is a kcal port for the MER Project and thus probably not available for Manajaro? It could be, the required libraries are present in plasma-mobile. If so, it would be great to add them to the dependencies in the PKGBUILD.

je-nix commented 3 years ago

Nice. In the meantime, the PKGBUILD file was updated to include the missing dependencies (although not all it seems, as at least kirigami2 is missing). Building Amazfish on the Pinephone with Manjaro-Phosh now works. And amazfish is now available in the community repo and can be installed via a simple 'pacman -S amazfish'. That is great.

Unfortunately, while the GUI can now be started, the service fails to start:

harbour-amazfish.service: Failed to locate executable /usr/bin/invoker: No such file or directory

From my understanding, the invoker binary at /usr/bin/invoker is SFOS specific. Is this an error in the code or a build configuration error? Thanks again for your support.

piggz commented 3 years ago

Ah ok, does editing the service to remove the need for infoker allow it all to work correctly? It shouldnt be too difficult to have a non-sfos service file.

je-nix commented 3 years ago

Editing the systemd service file at /usr/lib/systemd/user/harbour-amazfish.service (setting 'ExecStart=/usr/bin/harbour-amazfishd' ) allows the service to start. Pairing with my GTS still does not seem to work. I get to the point where I can select the BT device, it also detects my GTS, but when I click on it, nothing happens. The shell output of harbour-amazfish-ui only produces:

void DaemonInterface::pair(const QString&, QString)

I have the impression that communication with bluez may not work. When looking into the systems bluetooth settings, no connection with the smartwatch was established. Pairing the watch there seems to also not work (amazfish still hangs on the pairing screen).

According to the service logs, the application may not be properly connected to D-Bus (though I'm no expert here):

Jan 22 10:40:07 manjaro-arm systemd[3801]: Started Amazfish daemon. Jan 22 10:40:07 manjaro-arm harbour-amazfishd[7049]: Starting amazfish daemon Jan 22 10:40:07 manjaro-arm harbour-amazfishd[7049]: : QML MprisManager: Failed attempting to connect to DBus Jan 22 10:40:07 manjaro-arm harbour-amazfishd[7049]: watchfish-NotificationMonitor: Could not connect to the session bus Jan 22 10:40:07 manjaro-arm harbour-amazfishd[7049]: void NavigationInterface::connectDaemon() Jan 22 10:40:07 manjaro-arm harbour-amazfishd[7049]: Interface is not valid Jan 22 10:40:07 manjaro-arm harbour-amazfishd[7049]: Registering service on dbus uk.co.piggz.amazfish Jan 22 10:40:07 manjaro-arm harbour-amazfishd[7049]: DeviceFactory::createDevice: requested device of type: "" Jan 22 10:40:07 manjaro-arm harbour-amazfishd[7049]: DeviceFactory::createDevice: no suitable devices found, creating a Bip device as default Jan 22 10:40:07 manjaro-arm harbour-amazfishd[7049]: Creating DBUS HRM Jan 22 10:40:07 manjaro-arm harbour-amazfishd[7049]: "Not connected to D-Bus server" Jan 22 10:40:07 manjaro-arm harbour-amazfishd[7049]: DRIVERS: ("org.kde.kdb.mysql", "org.kde.kdb.postgresql", "org.kde.kdb.sqlite") Jan 22 10:40:07 manjaro-arm harbour-amazfishd[7049]: Database is: "/home/manjaro/.local/share/harbour-amazfish/harbour-amazfish/amazfish.kexi" Jan 22 10:40:07 manjaro-arm harbour-amazfishd[7049]: KDbConnection object created. Jan 22 10:40:07 manjaro-arm harbour-amazfishd[7049]: KDbConnection::connect() OK. Jan 22 10:40:07 manjaro-arm harbour-amazfishd[7049]: ("mi_band_activity", "sports_data", "sports_meta")

piggz commented 3 years ago

Could you try the latest versions. The daemon systemd unit didnt specify the correct DBUS path for regular linux desktops so this may be fixed now.

je-nix commented 3 years ago

Awesome! Just built 1.9.3 on my PinePhone (posh) and it seems to be running well. Pairing my Amazfish GTS worked fine, data sync seems to be working as well (steps are synced, triggering of hearth rate measurement from the app works). However, the connection does not seem to be stable. I get random "connected to watch" notifications every few seconds (on average every 20 seconds, in a range between 8 to 60 seconds) hinting that the connection was lost and reestablished.

A few observations that will need further investigations:

piggz commented 3 years ago

Just tagged 1.9.4, which should fix an issue with the service.

je-nix commented 3 years ago

Thanks. Just built and installed 1.9.4. Unfortunately, I can't see any improvements regarding the service, it still can't be enabled in amazfish and the systemd service is unknown to systemd ("No files found for harbour-amazfish.service.")

piggz commented 3 years ago

are you using systemctl --user ?

je-nix commented 3 years ago

I'm not quite sure how to check that, but I think the system does (systemd services are spawned from the '/usr/lib/systemd/systemd --user' parent and run with the user when checking with 'ps faux').

ell1e commented 3 years ago

Would it be possible to have amazfish added to flathub as an ARM64 flatpak? This would possibly fix the whole getting it packaged right for every distro issue

piggz commented 3 years ago

i would absolutely accept any PRs or contributions for such packaging .... i think the whole systemd daemon causes issues with things like flatpak/snap though ............ in the end, it doesnt have to be a systemd service, it just needs to talk over dbus so maybe that could be changed, so long as there was still a way to manage as something like a service to bring it up on boot/user-session

ell1e commented 3 years ago

@piggz personally I wouldn't care at all if it just wasn't collecting any data/syncing notifications while the app wasn't running. So maybe the background functionality just could be left out entirely? Not that I would mind if it was added one day, but that seems somewhat unnecessary to me to just be able to see any of the data at all without an Android phone and make it mostly work as a start.

neovalis commented 2 years ago

Any update on being able to "Select Device Type"? I just compiled on PPP Mobian and can't select InfiniTime or Pinetime. It just flashes. Additional sub-menus open for some other devices.

ell1e commented 2 years ago

What are even the install steps for the PinePhone? The README seems to be SailfishOS specific. And just any sort of precompiled release for ARM64 would be really nice, although a flatpak probably the easiest to install.

jmlich commented 6 months ago

The merge request https://github.com/flathub/flathub/pull/5173 closes this issue if flathub is enough.