gpio-manager D-Bus service support#1818
Conversation
|
Hmm... OK, I missed the previous discussions on why character device support wasn't added before. It looks like I need to update this to use the D-Bus API so that we get persistent state, e.g. even after the agent exits. |
I guess there is a problem that there isn't always an exporter (i.e. running locally), so even if the exporter process could hold open the gpiod file descriptor, it wouldn't solve the issue in all cases. |
|
OK, I've updated this to use the D-Bus service, so should be worth a look now. I edited the first comment with the updated description. |
47b3f5a to
74e268e
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #1818 +/- ##
========================================
- Coverage 45.2% 45.2% -0.1%
========================================
Files 174 175 +1
Lines 13752 13905 +153
========================================
+ Hits 6224 6291 +67
- Misses 7528 7614 +86
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
2a0b877 to
664c342
Compare
Add support for GPIOs via the gpio-manager D-Bus service. Some kernels are starting to ship with the gpio sysfs interface disabled, so an alternative is needed. The gpio-manager service will allow the pin state to persist even after the agent exits, which is something that the character device interface cannot do but is needed for some use cases. Signed-off-by: David Lechner <dlechner@baylibre.com>
|
This is quite a lot of new code and adds a new dependency on jeepney on the agent/exporter side. Which benefits do you see compared to adding support for the new per-chip sysfs GPIO interface (which is not deprecated; see also #1715 (comment)) to the existing GpioDigitalOutputDriver? It should be possible to implement it in a fully backwards compatible way. |
I was not aware of this. So perhaps there is not much benefit. It could still be interesting to people who are already using Although, I suppose one could easily create an HTTP server that talks to |
Description
Add support for controlling GPIOs via the gpio-manager D-Bus service.
There have been many attempts to use the gpio character device interface in labgrid since the sysfs interface is deprecated and is turned off in some kernel builds. However, these were rejected because the state of the gpio can change when the character device closes.
The
gpio-managerD-Bus daemon is supposed to be the "new" way to address this. It has been around for a few years, but isn't widely available yet. I suspect that will change though. And it is fairly simple to install from source if needed (some notes).I have tested this locally using the examples for both local and remote usage (slightly customized to my gpiochip path and pin number). I haven't implemented the lookup by name part yet (I'll have to do that on a Rapsberry Pi, which will be slower). I'm just putting this out there to see what people think first before I polish it up the rest of the way.
Similar to the way the sysfs gpio implementation will export gpios that are not already exported, this will request gpios that are not already requested. Since there isn't a process managing this, it means the line will stay requested until the user manually releases the request, e.g using the
gpioclicommand line too.Checklist