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.
Raspberry Pi Stack Exchange is a question and answer site for users and developers of hardware and software for Raspberry Pi. It only takes a minute to sign up.
Sign up to join this communityI suggest looking for entries in /sys/class/gpio
. If GPIO X is in use by the kernel there will be a gpioX directory.
/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.
/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.