public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ v2 0/4] obexd: unregister profiles when the user is inactive
@ 2025-04-25 17:12 Andrew Sayers
  2025-04-25 17:13 ` [PATCH BlueZ v2 1/5] pbap: Support calling pbap_init() after pbap_exit() Andrew Sayers
                   ` (5 more replies)
  0 siblings, 6 replies; 8+ messages in thread
From: Andrew Sayers @ 2025-04-25 17:12 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: luiz.dentz, pav, Andrew Sayers

This is a follow-up to "obexd: only run one instance at once".
Instead of refusing to run parallel services, it unregisters
profiles when the user is inactive.  This avoids the need
for tmpfiles, and avoids issues where the user with the
obex service logs out, leaving obex disabled altogether.

Luiz previously suggested moving this to systemd, but I haven't had much
luck getting the systemd devs to accept changes, and Pauli's mention of
elogind (i.e. logind without systemd) suggests it's probably better
to avoid the dependency anyway.

I considered writing a separate D-Bus service that would notify you
when the session became (in)active, but D-Bus doesn't have particularly
strong guarantees about how long messages take to deliver, which could
lead to race conditions between instances on overloaded systems.

I also considered writing some kind of library, but there's not much
code to deduplicate, and most of it would need to be reworked for every
service that uses it.  So I wrote a gist for people to copy/paste:

https://gist.github.com/andrew-sayers/1c4a24f86a9a4c1b1e38d109f1bd1d1e

Signed-off-by: Andrew Sayers <kernel.org@pileofstuff.org>
---

V1 -> V2 Open/close private DBus connections instead of
          calling UnregisterProfile (thanks Pauli Virtanen)
         Add obex_setup_dbus_connection_private() (to enable the above)
         Fix CI errors
         Minor issues I missed last time:
           * s/regster/register/ in e-mail subject lines
           * s/login_.*_cb/logind_$1_cb/g in logind.[ch]
           * remove watches on exit in pbap.c and bluetooth.c

Andrew Sayers (5):
      pbap: Support calling pbap_init() after pbap_exit()
      obexd/bluetooth: Support calling bluetooth_init() after bluetooth_exit()
      obexd: Support creating private system/session bus connections
      obexd: Unregister profiles when the user is inactive
      Revert "obexd: only run one instance at once"

 Makefile.obexd            |  10 ++
 obexd/client/pbap.c       |  33 ++++++-
 obexd/plugins/bluetooth.c |  30 +++++-
 obexd/src/logind.c        | 245 ++++++++++++++++++++++++++++++++++++++++++++++
 obexd/src/logind.h        |  26 +++++
 obexd/src/main.c          |  12 +++
 obexd/src/obex.service.in |   9 --
 obexd/src/obexd.h         |   2 +
 8 files changed, 349 insertions(+), 18 deletions(-)


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2025-04-25 18:50 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-25 17:12 [PATCH BlueZ v2 0/4] obexd: unregister profiles when the user is inactive Andrew Sayers
2025-04-25 17:13 ` [PATCH BlueZ v2 1/5] pbap: Support calling pbap_init() after pbap_exit() Andrew Sayers
2025-04-25 18:50   ` obexd: unregister profiles when the user is inactive bluez.test.bot
2025-04-25 17:13 ` [PATCH BlueZ v2 2/5] obexd/bluetooth: Support calling bluetooth_init() after bluetooth_exit() Andrew Sayers
2025-04-25 17:13 ` [PATCH BlueZ v2 3/5] obexd: Support creating private system/session bus connections Andrew Sayers
2025-04-25 17:13 ` [PATCH BlueZ v2 4/5] obexd: Unregister profiles when the user is inactive Andrew Sayers
2025-04-25 17:13 ` [PATCH BlueZ v2 5/5] Revert "obexd: only run one instance at once" Andrew Sayers
2025-04-25 18:20 ` [PATCH BlueZ v2 0/4] obexd: unregister profiles when the user is inactive Luiz Augusto von Dentz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox