Add D-Bus support to the cli to allow sharing of GPIOs between processes and provide an easy to setup option for sysfs users.
The concept is for the gpiocdev cli to run as a daemon managing a fixed set of lines and using a D-Bus session bus to expose methods to clients to control those lines. So a new dbusd subcommand, with options to request lines as inputs and outputs. The existing gpiocdev get/set/edge commands would get a --dbus option allowing them to access the GPIOs via the gpiocdev instance running as a daemon. Clients are not restricted to being gpiocdev.
The D-Bus methods would operate on the request, not individual lines, to maintain the "as atomic as possible" approach of the uAPI.
Potential methods:
- get lines -> values
- set (line,value)s
- get_in (as per get but forces the lines to inputs)
- set_out (as per set but forces the lines to outputs)
- edges (signal)
- level (simplified edges that just reports the line level)
- reconfigure (to allow complete reconfiguration of requested lines)
There is intentionally some overlap there - the idea being to provide simple methods for common cases (I'm looking at you, sysfs), as well as more comprehensive methods for full functionality.
Going with session bus, rather than a system bus, constrains the scope to one user and so avoids wider authorisation issues.
This is in contrast to the daemon Bart is working on for libgpiod, which is a single system daemon using a system bus. Not sure how he will handle access control - last I looked client access is restricted to root.
Add D-Bus support to the cli to allow sharing of GPIOs between processes and provide an easy to setup option for
sysfsusers.The concept is for the
gpiocdevcli to run as a daemon managing a fixed set of lines and using a D-Bus session bus to expose methods to clients to control those lines. So a newdbusdsubcommand, with options to request lines as inputs and outputs. The existinggpiocdevget/set/edgecommands would get a--dbusoption allowing them to access the GPIOs via thegpiocdevinstance running as a daemon. Clients are not restricted to beinggpiocdev.The D-Bus methods would operate on the request, not individual lines, to maintain the "as atomic as possible" approach of the uAPI.
Potential methods:
There is intentionally some overlap there - the idea being to provide simple methods for common cases (I'm looking at you,
sysfs), as well as more comprehensive methods for full functionality.Going with session bus, rather than a system bus, constrains the scope to one user and so avoids wider authorisation issues.
This is in contrast to the daemon Bart is working on for
libgpiod, which is a single system daemon using a system bus. Not sure how he will handle access control - last I looked client access is restricted to root.