From: Payton Fack <facksweng@gmail.com>
To: Bartosz Golaszewski <brgl@kernel.org>,
Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>,
linux-gpio@vger.kernel.org
Cc: Vincent Fazio <vfazio@gmail.com>, Payton Fack <facksweng@gmail.com>
Subject: [PATCH libgpiod v3 2/2] dbus: add optional D-Bus activation file for gpio-manager
Date: Wed, 02 Dec 2026 15:06:30 -0600 [thread overview]
Message-ID: <20261202-master-v3-2-08bbf2ce59b0@gmail.com> (raw)
In-Reply-To: <20261202-master-v3-0-08bbf2ce59b0@gmail.com>
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
prev parent reply other threads:[~2026-12-02 21:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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=20261202-master-v3-2-08bbf2ce59b0@gmail.com \
--to=facksweng@gmail.com \
--cc=bartosz.golaszewski@oss.qualcomm.com \
--cc=brgl@kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=vfazio@gmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox