On 17/12/2024 15.57, Dan Williams wrote:

On Mon, 2024-12-09 at 13:35 +0100, Teemu Ikonen wrote:
Hi,

In Geoclue we're wondering
(https://gitlab.freedesktop.org/geoclue/geoclue/-/merge_requests/176)
how to deal with multiple clients using ModemManager for location
info.
[...]

Out of curiosity, what other clients have you found using location info
alongside GeoClue?

I've written Satellite (https://codeberg.org/tpikonen/satellite) and there are also apps using the gpsd API which can be made to work with something like gnss-share (https://gitlab.postmarketos.org/postmarketOS/gnss-share).

In any case, Aleksander and I talked about this last week and didn't
think of a great solution. Instead we came up with a hybrid approach
that may meet the needs of both long-lived clients (GeoClue) and short-
lived ones (mmcli).

a) refcount location source enable/disable in MM based on D-Bus
connection. When the D-Bus client goes away or drops off the bus, drop
the reference. When all users have dropped off the bus, disable the
location source.

b) to ensure we don't break mmcli and other tools that depend on the
existing behavior that sources stay enabled over D-Bus connection
changes, add a new API method that has the existing non-refcounted
behavior, and switch mmcli to that. Would really use refcounting
underneath though, but based on API start/stop requests instead of D-
Bus client.

Yeah, in reality that does break tools like mmcli, but I'm not sure how
we can really fix this otherwise. Adding a new ref-counted API would
likely take years for all clients to switch over.

This sounds like a good plan. Geoclue does refcounting with its location sources and it works well.

Since implementation will no doubt take a long time, do you have any comments on the protocol described in the MR above? It's also implemented in the Satellite app, and I've ran it and patched Geoclue concurrently without problems. But, I'm not that familiar with MM internals, so I might be missing something.

If the concept is OK, ideally it could be mentioned or referenced in MM docs somewhere, until a proper multi-client implementation is ready.

Best,

Teemu

Reply via email to