Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sysfs: GPIO unexport at exit #29

Open
sausagenoods opened this issue Feb 23, 2023 · 1 comment
Open

sysfs: GPIO unexport at exit #29

sausagenoods opened this issue Feb 23, 2023 · 1 comment

Comments

@sausagenoods
Copy link

sausagenoods commented Feb 23, 2023

Describe the bug
I need to manually "unexport" pins after using this library. Let's say I've used pin 17 with the debounce example code. I'm unable to use the same pin again (using another library) without rebooting the Pi or running a command like this:

$ sudo bash -c "for ((i=0; i<32; i++)); do echo \$i >/sys/class/gpio/unexport; done"

Otherwise the other library fails with: RequestLine returned error: device or resource busy. And no I'm not running both programs at the same time. Apologies if this is normal, I don't know much about GPIO.
To Reproduce
Steps to reproduce the behavior:

  1. Run the debounce example code.
  2. Run the input pin watcher example from the other library.
  3. 2nd step fails with the RequestLine error I mentioned above and I'm unable to reuse the same pin unless I manually unexport it.

Expected behavior
Be able to reuse the same pin. I think it would be nice to have a function that unexports and people would defer that.

Platform (please complete the following information):

  • OS: Raspberry Pi OS Bullseye 5.15.84-v8+
  • Board: Raspberry Pi 3b+
@maruel maruel transferred this issue from periph/conn Feb 23, 2023
@maruel maruel changed the title GPIO unexport at exit sysfs: GPIO unexport at exit Feb 23, 2023
@maruel
Copy link
Member

maruel commented Feb 23, 2023

We would need a new shutdown function exported from either sysfs or as a generic form in periph.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants