SysfsGPIO: add invert attribute (active-low)
Description
Adds the invert (active-low) attribute to SysfsGPIO, NetworkSysfsGPIO, MatchedSysfsGPIO, GPIOSysFSExport, GpioDigitalOutputDriver and the GpioDigitalOutput agent.
Adds a new method "invert" to the DigitalOutputProtocol which switches the GPIO output line from True to False or False to True. This is useful for cases where a sensor attached to the gpio line reacts to any change of state (both rising edge and falling edge). The new invert method is implemented in all the drivers implementing the DigitalOutputProtocol (DeditecRelaisDriver, FileDigitalOutputDriver, GpioDigitalOutputDriver, HttpDigitalOutputDriver, LXAIOBusPIODriver, ManualSwitchDriver, ModbusCoilDriver, OneWirePIODriver, SerialPortDigitalOutputDriver, HIDRelayDriver) and the GpioDigitalOutput agent
Updates the documentation and the sysfsgpio examples
Checklist
- [x] Documentation for the feature
- [x] Tests for the feature done on a Raspberry Pi 4 running Debian 11 via the examples/sysfsgpio examples and the labgrid-client command line interface.
- [x] The arguments and description in doc/configuration.rst have been updated
- [x] PR has been tested
Note This is a reduced version of PR #1583 without the new ButtonProtocol.
My use case is the TP-Link WDR-4900 running openwrt. It has a 2-position sliding switch on the back side (WiFi on/off). It doesn't matter which position it is in (on or off) before the router boots openwrt, the setting in /etc/config/wireless will be what's used. Once the router has booted, changing the position in either direction will disable/enable WiFi on the device. All of this is in disregard to the label on the switch's position. The actual action of changing the position is what calls the hotplug script which in turn einables/disables WiFi. Sliding this switch is what I am emulating in my tests.
Naturally I could do everything in the strategies. Let me know if I should get rid of this method. I really need the invert attribute and that is my main goal with this pr.
Please remove the invert functions, IMO this specific behaviour of your device can be either encapsulated in the device strategy (for i.e. something like a boot mode reset), or in case of enabling/disabling wifi in your test case the test case itself retrieve the current polarity and than set the correct direction.
Please remove the invert functions, IMO this specific behaviour of your device can be either encapsulated in the device strategy (for i.e. something like a boot mode reset), or in case of enabling/disabling wifi in your test case the test case itself retrieve the current polarity and than set the correct direction.
Done
Added pylint to disable=unused-variable to labgrid/remote/exporter.py line 657