@@ -2,6 +2,19 @@
if OBEX
if SYSTEMD
+
+if USE_SYSTEMBUS_FOR_OBEXD
+
+systemdsystemunit_DATA += obexd/src/obex.service
+dbussystembus_DATA += obexd/src/org.bluez.obex.service
+
+obexd-add-service-symlink:
+ $(LN_S) -f obex.service $(DESTDIR)$(SYSTEMD_SYSTEMUNITDIR)/dbus-org.bluez.obex.service
+
+obexd-remove-service-symlink:
+ rm -f $(DESTDIR)$(SYSTEMD_SYSTEMUNITDIR)/dbus-org.bluez.obex.service
+else
+
systemduserunit_DATA += obexd/src/obex.service
dbussessionbusdir = $(DBUS_SESSIONBUSDIR)
@@ -12,6 +25,7 @@ obexd-add-service-symlink:
obexd-remove-service-symlink:
rm -f $(DESTDIR)$(SYSTEMD_USERUNITDIR)/dbus-org.bluez.obex.service
+endif
else
obexd-add-service-symlink:
obexd-remove-service-symlink:
@@ -292,6 +292,15 @@ if (test "${enable_obex}" != "no"); then
fi
AM_CONDITIONAL(OBEX, test "${enable_obex}" != "no")
+AC_ARG_ENABLE(use-systembus-for-obexd, AS_HELP_STRING([--enable-use-systembus-for-obexd],
+ [enable systembus for obexd]), [enable_use_systembus_for_obexd=${enableval}])
+AM_CONDITIONAL(USE_SYSTEMBUS_FOR_OBEXD, test "${enable_use_systembus_for_obexd}" = "yes")
+if (test "${enable_use_systembus_for_obexd}" = "yes"); then
+ AC_DEFINE(USE_SYSTEMBUS_FOR_OBEXD, 1, [Define to 1 if you want to use system bus for obexd.])
+else
+ AC_DEFINE(USE_SYSTEMBUS_FOR_OBEXD, 0, [Define to 0 if you want to use session bus for obexd.])
+fi
+
AC_ARG_ENABLE(btpclient, AS_HELP_STRING([--enable-btpclient],
[enable BTP client]), [enable_btpclient=${enableval}])
AM_CONDITIONAL(BTPCLIENT, test "${enable_btpclient}" = "yes")
@@ -463,7 +463,8 @@ int ftp_init(void)
DBG("");
- conn = dbus_bus_get(DBUS_BUS_SESSION, NULL);
+ conn = dbus_bus_get(USE_SYSTEMBUS_FOR_OBEXD ?
+ DBUS_BUS_SYSTEM : DBUS_BUS_SESSION, NULL);
if (!conn)
return -EIO;
@@ -2063,7 +2063,8 @@ int map_init(void)
DBG("");
- conn = dbus_bus_get(DBUS_BUS_SESSION, NULL);
+ conn = dbus_bus_get(USE_SYSTEMBUS_FOR_OBEXD ?
+ DBUS_BUS_SYSTEM : DBUS_BUS_SESSION, NULL);
if (!conn)
return -EIO;
@@ -178,7 +178,8 @@ int opp_init(void)
DBG("");
- conn = dbus_bus_get(DBUS_BUS_SESSION, NULL);
+ conn = dbus_bus_get(USE_SYSTEMBUS_FOR_OBEXD ?
+ DBUS_BUS_SYSTEM : DBUS_BUS_SESSION, NULL);
if (!conn)
return -EIO;
@@ -1303,7 +1303,8 @@ int pbap_init(void)
DBG("");
- conn = dbus_bus_get(DBUS_BUS_SESSION, NULL);
+ conn = dbus_bus_get(USE_SYSTEMBUS_FOR_OBEXD ?
+ DBUS_BUS_SYSTEM : DBUS_BUS_SESSION, NULL);
if (!conn)
return -EIO;
@@ -591,7 +591,8 @@ struct obc_session *obc_session_create(const char *source,
if (driver == NULL)
return NULL;
- conn = dbus_bus_get(DBUS_BUS_SESSION, NULL);
+ conn = dbus_bus_get(USE_SYSTEMBUS_FOR_OBEXD ?
+ DBUS_BUS_SYSTEM : DBUS_BUS_SESSION, NULL);
if (conn == NULL)
return NULL;
@@ -224,7 +224,8 @@ int sync_init(void)
DBG("");
- conn = dbus_bus_get(DBUS_BUS_SESSION, NULL);
+ conn = dbus_bus_get(USE_SYSTEMBUS_FOR_OBEXD ?
+ DBUS_BUS_SYSTEM : DBUS_BUS_SESSION, NULL);
if (!conn)
return -EIO;
@@ -322,7 +322,8 @@ static gboolean send_backup_dbus_message(const char *oper,
file_size = size ? *size : 0;
- conn = g_dbus_setup_bus(DBUS_BUS_SESSION, NULL, NULL);
+ conn = g_dbus_setup_bus(USE_SYSTEMBUS_FOR_OBEXD ?
+ DBUS_BUS_SYSTEM : DBUS_BUS_SESSION, NULL, NULL);
if (conn == NULL)
return FALSE;
@@ -488,7 +488,8 @@ gboolean manager_init(void)
dbus_error_init(&err);
- connection = g_dbus_setup_bus(DBUS_BUS_SESSION, OBEXD_SERVICE, &err);
+ connection = g_dbus_setup_bus(USE_SYSTEMBUS_FOR_OBEXD ?
+ DBUS_BUS_SYSTEM : DBUS_BUS_SESSION, OBEXD_SERVICE, &err);
if (connection == NULL) {
if (dbus_error_is_set(&err) == TRUE) {
fprintf(stderr, "%s\n", err.message);
@@ -21,10 +21,22 @@
<allow send_interface="org.freedesktop.DBus.ObjectManager"/>
<allow send_interface="org.freedesktop.DBus.Properties"/>
<allow send_interface="org.mpris.MediaPlayer2.Player"/>
+ <allow own="org.bluez.obex"/>
+ <allow send_destination="org.bluez.obex"/>
+ <allow send_interface="org.bluez.obex.Agent1"/>
+ <allow send_interface="org.bluez.obex.Client1"/>
+ <allow send_interface="org.bluez.obex.Session1"/>
+ <allow send_interface="org.bluez.obex.Transfer1"/>
+ <allow send_interface="org.bluez.obex.ObjectPush1"/>
+ <allow send_interface="org.bluez.obex.PhonebookAccess1"/>
+ <allow send_interface="org.bluez.obex.Synchronization1"/>
+ <allow send_interface="org.bluez.obex.MessageAccess1"/>
+ <allow send_interface="org.bluez.obex.Message1"/>
</policy>
<policy context="default">
<allow send_destination="org.bluez"/>
+ <allow send_destination="org.bluez.obex"/>
</policy>
</busconfig>
@@ -2158,7 +2158,8 @@ int main(int argc, char *argv[])
bt_shell_set_menu(&main_menu);
bt_shell_set_prompt(PROMPT, NULL);
- dbus_conn = g_dbus_setup_bus(DBUS_BUS_SESSION, NULL, NULL);
+ dbus_conn = g_dbus_setup_bus(USE_SYSTEMBUS_FOR_OBEXD ?
+ DBUS_BUS_SYSTEM : DBUS_BUS_SESSION, NULL, NULL);
client = g_dbus_client_new(dbus_conn, "org.bluez.obex",
"/org/bluez/obex");
From: Damodar Reddy GangiReddy <quic_dgangire@quicinc.com> Currently obexd uses session bus. Distros where session bus is not supported and still obex profiles are required in that case use system bus instead of session bus which can be configured with new optional feature Additional optional feature has been added to achieve this with name --enable-use-systembus-for-obexd steps to configure system bus ./configure --enable-use-systembus-for-obexd --- Makefile.obexd | 14 ++++++++++++++ configure.ac | 9 +++++++++ obexd/client/ftp.c | 3 ++- obexd/client/map.c | 3 ++- obexd/client/opp.c | 3 ++- obexd/client/pbap.c | 3 ++- obexd/client/session.c | 3 ++- obexd/client/sync.c | 3 ++- obexd/plugins/pcsuite.c | 3 ++- obexd/src/manager.c | 3 ++- src/bluetooth.conf | 12 ++++++++++++ tools/obexctl.c | 3 ++- 12 files changed, 53 insertions(+), 9 deletions(-)