I am using Linux (kernel 5.8.17) on an embedded custom board and have a script doing some gpioget and gpioset operations with the libgpiod package. Setting output pins with gpioset works great, as does getting value of input pins with gpioget. But when I need to know the current value of an output pin, using gpioget changes the pin value, and the direction.
Here is an example:
~# gpioinfo |grep MB_AC_ON
line 230: "MB_AC_ON" unused output active-high
~# gpioset $(gpiofind "MB_AC_ON")=1
~# gpioget $(gpiofind "MB_AC_ON")
0
~# gpioinfo |grep MB_AC_ON
line 230: "MB_AC_ON" unused input active-high
Setting the pin to '1' works. But then checking the current value of that same pin using gpioget, the value changes to '0' and the direction is changed to input. Is it even possible to get the value of a gpio output using libgpiod?