labgrid-project / labgrid

Embedded systems control library for development, testing and installation
https://labgrid.readthedocs.io/
Other
329 stars 167 forks source link

Add DigitalInputProtocol, GpioDigitalInputDriver #1457

Open flxzt opened 1 month ago

flxzt commented 1 month ago

Currently it is only possible to specify GPIO's as outputs see here.

I am proposing to add a DigitalInputProtocol together with a GpioDigitalInputDriver that configures GPIO pins as input only through sysfs (or switch to the newer devfs/libgpiod based GPIO interface while at it, because the sysfs one is deprecated). This could ensure that there won't be any shorts when the pin is connected to an output of the DUT.

jluebbe commented 1 month ago

Please see https://github.com/labgrid-project/labgrid/pull/468 for the libgpiod discussion.

Adding a corresponding DigitalInputProtocol and GpioDigitalInputDriver to the existing sysfs variant would be useful though. Sharing most of the agent code seems relatively easy. Do you intend to create a PR?

flxzt commented 1 month ago

I see. Having to keep a process open is a limitation of the devfs based interface that I didn't have in mind. Yes, I intend to add it. I'll see if I can come up with a sysfs based implementation similar to the existing agent code then