Linux GPIO subsystem development
 help / color / mirror / Atom feed
* [PATCH libgpiod v3 0/2] dbus: add optional D-Bus activation for gpio-manager
@ 2026-12-02 21:06 Payton Fack
  2026-12-02 21:06 ` [PATCH libgpiod v3 1/2] meson: fail if systemd is enabled but D-Bus is not available Payton Fack
  2026-12-02 21:06 ` [PATCH libgpiod v3 2/2] dbus: add optional D-Bus activation file for gpio-manager Payton Fack
  0 siblings, 2 replies; 3+ messages in thread
From: Payton Fack @ 2026-12-02 21:06 UTC (permalink / raw)
  To: Bartosz Golaszewski, Bartosz Golaszewski, linux-gpio
  Cc: Vincent Fazio, Payton Fack

This series adds an optional D-Bus activation file so that dbus-daemon
can start gpio-manager on demand via systemd, and tightens a related
meson check.

The first patch fixes the existing check that -Dsystemd=enabled requires
D-Bus. The systemd data files are installed from the dbus subdirectory,
which is only processed when the D-Bus dependencies are found, but the
check only verified that the dbus option was not disabled. With
-Ddbus=auto and missing dependencies, the build would silently skip the
systemd files. Assert on dbus_enabled instead.

The second patch installs an io.gpiod1.service system-service file whose
SystemdService= points at gpio-manager.service. It is gated behind a new
dbus-activation feature option that defaults to disabled and requires
systemd support, since on-demand activation is not wanted on every
system.

Changes in v3:
- Add a new patch cleaning up the systemd/D-Bus dependency check in meson.
- Use pkg-config paths for the install location of the D-Bus activation
  file instead of hardcoding it.
- Make dbus-activation default to disabled.
- Fail the build if dbus-activation is enabled while D-Bus is disabled.
- Link to v2: https://lore.kernel.org/linux-gpio/20261029154623.387575-1-facksweng@gmail.com/

Changes in v2:
- Make service run as gpio-manager user
- Force debus service to use systemd to start
- Fix dbus-activation systemd dependency
- Link to v1: https://lore.kernel.org/linux-gpio/20261026221323.2235111-1-facksweng@gmail.com/

Signed-off-by: Payton Fack <facksweng@gmail.com>
---
Payton Fack (2):
      meson: fail if systemd is enabled but D-Bus is not available
      dbus: add optional D-Bus activation file for gpio-manager

 dbus/data/io.gpiod1.service |  8 ++++++++
 dbus/data/meson.build       |  7 +++++++
 meson.build                 | 37 +++++++++++++++++++++++++++++++------
 meson_options.txt           |  6 ++++++
 4 files changed, 52 insertions(+), 6 deletions(-)
---
base-commit: b1071a55288d595a80709204a73932eb19a0a400
change-id: 20261202-master-d4f13a68bbfb

Best regards,
--  
Payton Fack <facksweng@gmail.com>


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

* [PATCH libgpiod v3 1/2] meson: fail if systemd is enabled but D-Bus is not available
  2026-12-02 21:06 [PATCH libgpiod v3 0/2] dbus: add optional D-Bus activation for gpio-manager Payton Fack
@ 2026-12-02 21:06 ` Payton Fack
  2026-12-02 21:06 ` [PATCH libgpiod v3 2/2] dbus: add optional D-Bus activation file for gpio-manager Payton Fack
  1 sibling, 0 replies; 3+ messages in thread
From: Payton Fack @ 2026-12-02 21:06 UTC (permalink / raw)
  To: Bartosz Golaszewski, Bartosz Golaszewski, linux-gpio
  Cc: Vincent Fazio, Payton Fack

The systemd data files are installed from the dbus subdirectory, which
is only processed when the D-Bus dependencies were found. The check
that -Dsystemd=enabled requires D-Bus only verified that the dbus
option was not disabled, so with -Ddbus=auto and missing dependencies
the build silently skipped the systemd files.

Assert on dbus_enabled instead, now that it is computed before the
check.

Signed-off-by: Payton Fack <facksweng@gmail.com>
---
 meson.build | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/meson.build b/meson.build
index c92179c..6eac41e 100644
--- a/meson.build
+++ b/meson.build
@@ -85,12 +85,6 @@ opt_introspection = opt_introspection.require(
   get_option('default_library') != 'static',
   error_message: 'introspection requires -Ddefault_library=shared or both')
 
-# systemd requires D-Bus.
-if opt_systemd.enabled()
-  assert(opt_dbus.allowed(),
-    'systemd support requires -Ddbus=enabled')
-endif
-
 libgpiod_inc = include_directories('include')
 
 libedit_dep = dependency('libedit', version: '>= 3.1', required: opt_gpioset_interactive)
@@ -151,6 +145,12 @@ else
   dbus_enabled = false
 endif
 
+# systemd requires D-Bus.
+if opt_systemd.enabled()
+  assert(dbus_enabled,
+    'systemd support requires D-Bus, which is disabled or was not found')
+endif
+
 if opt_introspection.allowed()
   gir_dep       = dependency('gobject-introspection-1.0', version: '>= 0.6.2',
                              required: opt_introspection)

-- 
2.56.1


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

* [PATCH libgpiod v3 2/2] dbus: add optional D-Bus activation file for gpio-manager
  2026-12-02 21:06 [PATCH libgpiod v3 0/2] dbus: add optional D-Bus activation for gpio-manager Payton Fack
  2026-12-02 21:06 ` [PATCH libgpiod v3 1/2] meson: fail if systemd is enabled but D-Bus is not available Payton Fack
@ 2026-12-02 21:06 ` Payton Fack
  1 sibling, 0 replies; 3+ messages in thread
From: Payton Fack @ 2026-12-02 21:06 UTC (permalink / raw)
  To: Bartosz Golaszewski, Bartosz Golaszewski, linux-gpio
  Cc: Vincent Fazio, Payton Fack

Add an io.gpiod1.service D-Bus system-service file whose
SystemdService= points at gpio-manager.service, which lets dbus-daemon
start the manager through systemd on demand when a client sends a
request to io.gpiod1.

On-demand activation is not wanted on every system, so gate it behind
a new dbus-activation feature option. It defaults to disabled and
requires systemd support. When disabled, the activation file is not
installed.

Signed-off-by: Payton Fack <facksweng@gmail.com>
---
 dbus/data/io.gpiod1.service |  8 ++++++++
 dbus/data/meson.build       |  7 +++++++
 meson.build                 | 25 +++++++++++++++++++++++++
 meson_options.txt           |  6 ++++++
 4 files changed, 46 insertions(+)

diff --git a/dbus/data/io.gpiod1.service b/dbus/data/io.gpiod1.service
new file mode 100644
index 0000000..893ed74
--- /dev/null
+++ b/dbus/data/io.gpiod1.service
@@ -0,0 +1,8 @@
+# SPDX-License-Identifier: CC0-1.0
+# SPDX-FileCopyrightText: 2026 Garmin Ltd. or its subsidiaries
+
+[D-BUS Service]
+Name=io.gpiod1
+Exec=/bin/false
+User=gpio-manager
+SystemdService=gpio-manager.service
diff --git a/dbus/data/meson.build b/dbus/data/meson.build
index 8af178b..afe9929 100644
--- a/dbus/data/meson.build
+++ b/dbus/data/meson.build
@@ -18,6 +18,13 @@ if opt_systemd.allowed() and systemd_dep.found()
   install_data(gpio_manager_service,
     install_dir: systemd_unit_dir,
   )
+
+  if dbus_activation_enabled
+    install_data('io.gpiod1.service',
+      install_dir: system_bus_services_dir,
+    )
+  endif
+
   install_data('90-gpio.rules',
     install_dir: get_option('libdir') / 'udev' / 'rules.d',
   )
diff --git a/meson.build b/meson.build
index 6eac41e..2648792 100644
--- a/meson.build
+++ b/meson.build
@@ -56,6 +56,7 @@ opt_bindings_glib       = get_option('bindings-glib')
 opt_dbus                = get_option('dbus')
 opt_introspection       = get_option('introspection')
 opt_systemd             = get_option('systemd')
+opt_dbus_activation     = get_option('dbus-activation')
 
 if opt_bindings_cxx.allowed()
   add_languages('cpp', native: false)
@@ -178,6 +179,29 @@ else
   systemd_enabled = false
 endif
 
+if opt_dbus_activation.allowed()
+  dbus_dep = dependency('dbus-1', required: opt_dbus_activation)
+  if dbus_dep.found()
+    opt_system_bus_services_dir = get_option('system-bus-services-dir')
+    if opt_system_bus_services_dir != ''
+      system_bus_services_dir = opt_system_bus_services_dir
+    else
+      system_bus_services_dir = dbus_dep.get_variable('system_bus_services_dir')
+    endif
+  endif
+
+  dbus_activation_enabled = dbus_dep.found()
+else
+  dbus_activation_enabled = false
+endif
+
+if opt_dbus_activation.enabled()
+  assert(systemd_enabled,
+    'D-Bus activation requires systemd support, which is disabled or was not found')
+  assert(dbus_enabled,
+    'D-Bus activation requires D-Bus support, which is disabled or was not found')
+endif
+
 if opt_bindings_rust.allowed()
   cargo = find_program('cargo', required: opt_bindings_rust)
 
@@ -323,5 +347,6 @@ summary({
   'gpioset interactive'   : libedit_dep.found(),
   'GObject introspection' : introspection_enabled,
   'systemd'               : systemd_enabled,
+  'D-Bus activation'      : dbus_activation_enabled,
   'Profiling'             : get_option('profiling'),
 }, section: 'Features', bool_yn: true)
diff --git a/meson_options.txt b/meson_options.txt
index 64e3c14..1fb6e00 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -34,8 +34,14 @@ option('introspection', type: 'feature',
 option('systemd', type: 'feature',
   description: 'Install systemd unit and udev rules (requires dbus)')
 
+option('dbus-activation', type: 'feature', value: 'disabled',
+  description: 'Install D-Bus activation file for gpio-manager (requires systemd)')
+
 option('systemd-unit-dir', type: 'string', value: '',
   description: 'Directory for systemd system unit files (default: from pkg-config)')
 
+option('system-bus-services-dir', type: 'string', value: '',
+  description: 'Directory for D-Bus system bus service files (default: from pkg-config)')
+
 option('profiling', type: 'boolean', value: false,
   description: 'Enable gcov profiling on the core library and tests')

-- 
2.56.1


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

end of thread, other threads:[~2026-12-02 21:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-02 21:06 [PATCH libgpiod v3 0/2] dbus: add optional D-Bus activation for gpio-manager Payton Fack
2026-12-02 21:06 ` [PATCH libgpiod v3 1/2] meson: fail if systemd is enabled but D-Bus is not available Payton Fack
2026-12-02 21:06 ` [PATCH libgpiod v3 2/2] dbus: add optional D-Bus activation file for gpio-manager Payton Fack

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