I'm rewriting my code, changing from sysfs interface forward to libgpiod. After the request of a line, direction is fixed and I need to figure out, how to switch the direction of this line on the fly for changing between input and output. At the moment I don't see the right way, and a further request is denied.
When I do a cycle of request - use - release - request-again with different direction, this seem wrong overhead to me.
I would prefer to have a function call, which changes the direction from in to out and vice versa.
Is there something, I've overseen?
Answering the question myself:
The direction is currently not changeable yet without releasing the line.
I've got this directly from the author of libgpiod via e-mail:
... this is because the kernel doesn't allow to change the direction without releasing a line. This however will change in linux v5.5 as the patches introducing this functionality have been reviewed and are pending a merge. New version of libgpiod with support for that will be released shortly after.
Best regards, Bartosz Golaszewski
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With