Part 'How To', part 'how did I do that, again?'...
I'm loving the geekiness of PinePhone Pro + postmarketOS + SXMO/SWMO, but I was struggling to get my PineTime + InfiniTime watch to play nice with it all. Here's what is currently working for me:
I'm using InfiniTime Daemon to manage the connectivity. Download and install itd
(update version, as required): $> apk add --allow-untrusted itd-0.0.7-linux-arm.apk
Run itd
from the command line to pair with your watch (this is an interactive process, requiring the entry of the PIN/key displayed on your watch). You only need to do this once (unless you unpair, of course).
The instructions for starting itd
as a service, however, use 'systemctl', which is not a feature of Alpine Linux (and thus, postmarketOS) *. So we need to create an OpenRC service script (/usr/local/etc/init.d/openrc_itd.service - $> mkdir -p /usr/local/etc/init.d
, if necessary):
#!/sbin/openrc-run # See https://github.com/OpenRC/openrc/blob/master/service-script-guide.md # NB: to pair with the watch, run 'rc-service /usr/bin/itd start' (foreground) so you can enter the PIN supervisor=supervise-daemon name="itd" description="InfiniTime daemon" command="/usr/bin/itd" command_args="" pidfile="/run/${RC_SVCNAME}.pid" command_background=true command_user="user:user" healthcheck_timer=30 # seconds; used by supervise-daemon depend() { need bluetooth }
Enable this script with: $> rc-update add openrc_itd.service default
Test it with: $> itctl notify title message
Keeping Bluetooth Connection To Watch Alive
In addition to the above, I wrote a wee script to do some Matrix logging (outside the scope of this article), that is triggered via a cron job. I was struggling to keep the bluetooth connection alive after the phone suspends for the first time, but was helped by a great community member (hat-tip: earboxer).
My cron entry looks like this:
1,13,25,37,49 7-22 * * * sxmo_rtcwake.sh ~/rtcwake_matrix.sh 2>> ~/.local/state/tinydm.log
And the script (~/rtcwake_matrix.sh) it calls looks like this:
#!/bin/sh /usr/bin/bluetoothctl --timeout 10 connect [PineTime MAC address **] /usr/bin/python3 /home/user/MatrixLogger.py exit 0
It's the call to bluetoothctl
that seems to trigger the 'reconnect' that itd
requires.
You might also want to look at /etc/itd.toml
, e.g. I set '[on.reconnect] notify = false' to stop being alerted to every 'reconnect' event.
That's it! Hopefully of use to someone out there (and to me, next time I need to set this up)...
Footnotes
* I have subsequently learned that you can re-use systemd/systemctl service scripts with superd, which is installed - see your /usr/share/superd/services/
folder. I have not tried this approach, as what I did above is working well for me.
** which you can get via $> itctl get addr
once itd
is up-and-running.
¤ Copyright 1999-2024 Chris Molloy ¤ All rights reserved ¤