Reputation: 41
First of all, about this system:
I didn't build it, but it was tailored and customized with a lot of functions removed. The kernel version appears to be v4.x. It's running on an embedded system.
When I call in my program
echo 0 > /sys/class/gpio/gpioX/value
where "X" is my desired pin, I got an error message in the bash, produced not by my printf calls in the program but by system:
sh: write error: Device or resource busy
I can see all the pins that I want to use under:
/sys/class/gpio
and not:
/sys/kernel/debug/gpio
in fact, "/sys/kernel/" doesn't even have a debug folder to begin with, which I believe is sufficient to draw the conclusion that no system process is occupying the port.
Furthermore, using lsof
produced a long list but no GPIO could be found.
Usually if you saw the titular error message you just locate the process and kill it right? But in this case I couldn't even find the process. What should I do?
Upvotes: 3
Views: 11040
Reputation: 41
Your problem sounds like the GPIO pin has been assigned to a hardware device driver in your kernel device tree. If that is the case, you will not be able to control the pin from user-space as it will forever be "busy". Your only solution in this case would be to alter the device tree (likely disabling the HW driver) as to leave the pin unassigned by DTS.
Upvotes: 4