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

Device or resource busy #5

Open
DasPez opened this issue Aug 9, 2018 · 1 comment
Open

Device or resource busy #5

DasPez opened this issue Aug 9, 2018 · 1 comment

Comments

@DasPez
Copy link

DasPez commented Aug 9, 2018

Hello,
I would like to use the character device interface /dev/gpiochip1.
The sysfs interface works perfectly fine

# echo 1 > /sys/class/gpio/gpio0/value 
# echo 0 > /sys/class/gpio/gpio0/value 

but the character device is busy

# gpiodetect
gpiochip0 [INT345D:00] (203 lines)
gpiochip1 [ch341] (8 lines)
# gpioinfo gpiochip1
gpiochip1 - 8 lines:
	line   0:      "gpio0"      "gpio0"  output  active-high [used]
	line   1:      "gpio1"      "gpio1"  output  active-high [used]
	line   2:      "gpio2"      "gpio2"  output  active-high [used]
	line   3:      "gpio3"      "gpio3"  output  active-high [used]
	line   4:      "gpio4"      "gpio4"   input  active-high [used]
	line   5:      "gpio5"      "gpio5"   input  active-high [used]
	line   6:      "gpio6"      "gpio6"   input  active-high [used]
	line   7:      "gpio7"      "gpio7"   input  active-high [used]

# gpioset gpiochip1 0=1
gpioset: error setting the GPIO line values: Device or resource busy

I tried unexporting gpio0

# ls /sys/class/gpio/
export  gpio0  gpio1  gpio2  gpio3  gpio4  gpio5  gpio6  gpio7  gpiochip301  gpiochip309  unexport
# echo 0 > /sys/class/gpio/unexport 
bash: echo: write error: Invalid argument

Why are the gpio pin indices starting at 0 even though the controller base index is 301?

# cat /sys/class/gpio/gpiochip301/label 
ch341
# cat /sys/class/gpio/gpiochip301/base 
301
geeksville added a commit to geeksville/spi-ch341-usb that referenced this issue Oct 31, 2020
@geeksville
Copy link

It seems like @gschorcht is busy with other things, so I won't bother to send in a PR for this great driver. But I've merged various fixes from others needed to make the driver work for modern kernels and then I fixed the EBUSY problem you discovered (because it also happened to me).

In case it is useful, here's my fork: https://github.com/geeksville/spi-ch341-usb

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

No branches or pull requests

2 participants