From: Bartosz Golaszewski <brgl@bgdev.pl>
To: Linus Walleij <linus.walleij@linaro.org>,
Kent Gibson <warthog618@gmail.com>,
Erik Schilling <erik.schilling@linaro.org>,
Phil Howard <phil@gadgetoid.com>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Viresh Kumar <viresh.kumar@linaro.org>,
Dan Carpenter <dan.carpenter@linaro.org>
Cc: "As advised by Dan Carpenter - I'm CC'ing
dbus"@lists.freedesktop.orgto, linux-gpio@vger.kernel.org,
dbus@lists.freedesktop.org,
Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Subject: [PATCH libgpiod v2 17/18] README: document the DBus API
Date: Fri, 28 Jun 2024 16:53:33 +0200 [thread overview]
Message-ID: <20240628-dbus-v2-17-e42336efe2d3@linaro.org> (raw)
In-Reply-To: <20240628-dbus-v2-0-e42336efe2d3@linaro.org>
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Add information on the DBus API as well as gpio-manager and gpiocli to
the README file.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
README | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 64 insertions(+)
diff --git a/README b/README
index ef5d328..192943c 100644
--- a/README
+++ b/README
@@ -224,6 +224,70 @@ C library using make, they will be automatically configured to build against the
build results of the C library. Please refer to bindings/rust/libgpiod/README.md
for more information.
+DBUS
+----
+
+A commonly requested feature for the GPIO character device was state persistence
+after releasing the lines (as a kernel feature) or providing a central authority
+(in user-space) that would be in charge of keeping the lines requested and in a
+certain state (similarily to how the sysfs ABI works). DBus API has been
+provided to address this requirement. We define an interface covering the
+majority of the GPIO chardev's functionality and implement it from both the
+server and client sides in the form of the gpio-manager daemon and the gpiocli
+command-line utility for talking to the manager.
+
+DBus support can be built by passing --enable-dbus to configure. The daemon
+is bundled with a systemd unit file and an example configuration file for the
+io.gpiod1 interface that allows all users to access basic information about the
+GPIOs in the system but only root to request lines or change their values.
+
+With the manager running the user can run gpiocli to control GPIOs by asking
+gpio-manager to act on their behalf:
+
+ # Detect chips in the system.
+ $ gpiocli detect
+ gpiochip0 [INT34C6:00] (463 lines)
+
+ # Request a set of lines. Note that gpiocli exits immediately but the
+ # state of the lines is retained because it's the gpio-manager that
+ # requested them.
+ $ gpiocli request --output foo=active
+ request0
+
+ # Previous invocation printed out the name of the request by which the
+ # caller can refer to it later. All active requests can also be inspected
+ # at any time.
+ $ gpiocli requests
+ request0 (gpiochip1) Offsets: [5]
+
+ # We can print the information about the requested line using the
+ # information above.
+ $ gpiocli info --chip=gpiochip1 5
+ gpiochip1 5: "foo" [used,consumer="gpiocli request",managed="request0",output,push-pull]
+
+ # We can now change the value of the line.
+ $ gpiocli set foo=inactive
+
+ # And read it.
+ $ gpiocli get foo
+ "foo"=inactive
+
+ # We can even reconfigure it to input and enable edge-detection.
+ $ gpiocli reconfigure --input --both-edges request0
+
+ # And wait for edge events.
+ $ gpiocli monitor cos
+ 21763952894920 rising "foo"
+
+ # And finally release the request.
+ $ gpiocli release request0
+
+For more information please refer to the output of gpiocli --help as well as
+gpiocli <command> --help which prints detailed info on every available command.
+
+Of course - this being DBus - users can talk to gpio-manager using any DBus
+library available and are not limited to the provided client.
+
TESTING
-------
--
2.43.0
next prev parent reply other threads:[~2024-06-28 14:54 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-28 14:53 [PATCH libgpiod v2 00/18] dbus: add GLib-based DBus daemon and command-line client Bartosz Golaszewski
2024-06-28 14:53 ` [PATCH libgpiod v2 01/18] tests: split out reusable test code into a local static library Bartosz Golaszewski
2024-06-28 14:53 ` [PATCH libgpiod v2 02/18] tests: split out the common test code for bash scripts Bartosz Golaszewski
2024-06-28 14:53 ` [PATCH libgpiod v2 03/18] bindings: glib: add build files Bartosz Golaszewski
2024-06-28 14:53 ` [PATCH libgpiod v2 04/18] bindings: glib: add public headers Bartosz Golaszewski
2024-06-28 14:53 ` [PATCH libgpiod v2 05/18] bindings: glib: add core code Bartosz Golaszewski
2024-06-28 14:53 ` [PATCH libgpiod v2 06/18] bindings: glib: add examples Bartosz Golaszewski
2024-06-28 14:53 ` [PATCH libgpiod v2 07/18] bindings: glib: add tests Bartosz Golaszewski
2024-06-28 14:53 ` [PATCH libgpiod v2 08/18] README: document GLib bindings Bartosz Golaszewski
2024-06-28 14:53 ` [PATCH libgpiod v2 09/18] dbus: add build files Bartosz Golaszewski
2024-06-28 14:53 ` [PATCH libgpiod v2 10/18] dbus: add the API definitions Bartosz Golaszewski
2024-06-28 14:53 ` [PATCH libgpiod v2 11/18] dbus: add a wrapper around the gdbus-codegen generated header Bartosz Golaszewski
2024-06-28 14:53 ` [PATCH libgpiod v2 12/18] dbus: add data files Bartosz Golaszewski
2024-06-28 14:53 ` [PATCH libgpiod v2 13/18] dbus: add gpio-manager code Bartosz Golaszewski
2024-06-28 14:53 ` [PATCH libgpiod v2 14/18] dbus: add tests Bartosz Golaszewski
2024-06-28 14:53 ` [PATCH libgpiod v2 15/18] dbus: add a command-line client Bartosz Golaszewski
2024-06-28 14:53 ` [PATCH libgpiod v2 16/18] dbus: client: add tests Bartosz Golaszewski
2024-06-28 14:53 ` Bartosz Golaszewski [this message]
2024-06-28 14:53 ` [PATCH libgpiod v2 18/18] TODO: drop the DBus daemon from the list Bartosz Golaszewski
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=20240628-dbus-v2-17-e42336efe2d3@linaro.org \
--to=brgl@bgdev.pl \
--cc="As advised by Dan Carpenter - I'm CC'ing dbus"@lists.freedesktop.orgto \
--cc=andriy.shevchenko@linux.intel.com \
--cc=bartosz.golaszewski@linaro.org \
--cc=dan.carpenter@linaro.org \
--cc=dbus@lists.freedesktop.org \
--cc=erik.schilling@linaro.org \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=phil@gadgetoid.com \
--cc=viresh.kumar@linaro.org \
--cc=warthog618@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;
as well as URLs for NNTP newsgroup(s).