All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Sayers <kernel.org@pileofstuff.org>
To: linux-bluetooth@vger.kernel.org
Cc: luiz.dentz@gmail.com, pav@iki.fi,
	Andrew Sayers <kernel.org@pileofstuff.org>
Subject: [PATCH BlueZ v5 3/6] obexd: Support creating private system/session bus connections
Date: Tue, 29 Apr 2025 15:14:13 +0100	[thread overview]
Message-ID: <20250429141533.803295-4-kernel.org@pileofstuff.org> (raw)
In-Reply-To: <20250429141533.803295-1-kernel.org@pileofstuff.org>

Obexd can either connect to the system or session bus.
We mostly share a common connection to that bus, but it can be useful
to have a private connection.  For example, this allows us to quickly
unregister profiles when switching user.

Add obex_setup_dbus_connection_private(), which creates a new
connection to whichever bus was specified by the user.

Signed-off-by: Andrew Sayers <kernel.org@pileofstuff.org>
---
 obexd/src/main.c  | 8 ++++++++
 obexd/src/obexd.h | 2 ++
 2 files changed, 10 insertions(+)

diff --git a/obexd/src/main.c b/obexd/src/main.c
index 703173662..ca95a70de 100644
--- a/obexd/src/main.c
+++ b/obexd/src/main.c
@@ -253,6 +253,14 @@ DBusConnection *obex_setup_dbus_connection(const char *name,
 	return connection;
 }
 
+DBusConnection *obex_setup_dbus_connection_private(const char *name,
+					DBusError *error)
+{
+	return g_dbus_setup_private(option_system_bus ?
+				DBUS_BUS_SYSTEM : DBUS_BUS_SESSION,
+				name, error);
+}
+
 int main(int argc, char *argv[])
 {
 	GOptionContext *context;
diff --git a/obexd/src/obexd.h b/obexd/src/obexd.h
index 5e5edc4de..560db29ce 100644
--- a/obexd/src/obexd.h
+++ b/obexd/src/obexd.h
@@ -33,3 +33,5 @@ const char *obex_option_capability(void);
 DBusConnection *obex_get_dbus_connection(void);
 DBusConnection *obex_setup_dbus_connection(const char *name,
 					DBusError *error);
+DBusConnection *obex_setup_dbus_connection_private(const char *name,
+					DBusError *error);
-- 
2.49.0


  parent reply	other threads:[~2025-04-29 14:15 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-29 14:14 [PATCH BlueZ v5 0/6] obexd: unregister profiles when the user is inactive Andrew Sayers
2025-04-29 14:14 ` [PATCH BlueZ v5 1/6] pbap: Support calling pbap_init() after pbap_exit() Andrew Sayers
2025-04-29 15:51   ` obexd: unregister profiles when the user is inactive bluez.test.bot
2025-04-29 14:14 ` [PATCH BlueZ v5 2/6] obexd/bluetooth: Support calling bluetooth_init() after bluetooth_exit() Andrew Sayers
2025-04-29 14:14 ` Andrew Sayers [this message]
2025-04-29 14:14 ` [PATCH BlueZ v5 4/6] obexd: Unregister profiles when the user is inactive Andrew Sayers
2025-04-29 17:25   ` Luiz Augusto von Dentz
2025-04-29 19:20     ` Andrew Sayers
2025-04-29 21:12       ` Luiz Augusto von Dentz
2025-04-29 14:14 ` [PATCH BlueZ v5 5/6] obexd: Support sd_login_monitor_get_timeout() Andrew Sayers
2025-04-29 14:14 ` [PATCH BlueZ v5 6/6] Revert "obexd: only run one instance at once" Andrew Sayers
2025-04-29 18:10 ` [PATCH BlueZ v5 0/6] obexd: unregister profiles when the user is inactive patchwork-bot+bluetooth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250429141533.803295-4-kernel.org@pileofstuff.org \
    --to=kernel.org@pileofstuff.org \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=luiz.dentz@gmail.com \
    --cc=pav@iki.fi \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.