0

We will get many times "Device or resource busy" error, when try to read or write GPIO pin of raspberry pi.

So, Is there any way to find out which GPIO pin of raspberry pi busy?

Thanks in advance.

0

I suggest looking for entries in /sys/class/gpio. If GPIO X is in use by the kernel there will be a gpioX directory.

2
  • This isn't true. If a GPIO pin is used by the kernel, it won't show up in /sys/class/gpio; pins only show up here if they are being used by a user-space process using the sysfs filesystem interface. Anything that interacts with the gpio pins through a kernel driver (e.g, the bcm2835_gpiomem driver, which exposes /dev/gpiomem) will not create entries in the sysfs directory.
    – larsks
    Nov 8 '17 at 13:21
  • 2
    @larsks True, however I wouldn't class GPIO access via /dev/mem or /dev/gpiomem as use by the kernel, all the kernel does is allow access to the register memory. It has no knowledge of what the user process may be doing and would not raise the "Device or resource busy" error mentioned in the question.
    – joan
    Nov 8 '17 at 14:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.