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

udev for SPI #26

Open
jp-bennett opened this issue Jan 8, 2024 · 2 comments
Open

udev for SPI #26

jp-bennett opened this issue Jan 8, 2024 · 2 comments

Comments

@jp-bennett
Copy link

I'm trying to put together udev rules for firing up an SPI device automatically on plug. I think there's an issue, that the ch341-spi driver doesn't actually expose what SPI number the USB has grabbed. So, on most systems, that will be "/sys/class/spi_master/spi0" but if the system has an existing SPI bus, I suspect the CH341 may become SPI1 instead. Would it be possible to set a udev ENV value that identifies which SPI bus number the driver is using? Or is there an easier solution?

@frank-zago
Copy link
Owner

This is not managed by the driver, but the spi subsystem. Run "udevadm monitor", plug the device, and see if you get what you need.

@mjsir911
Copy link

mjsir911 commented Mar 9, 2024

https://github.com/rogerjames99/spi-ch341-usb & https://github.com/rogerjames99/spi-ch341-usb/blob/master/udev/90-ch341-spi.rules seems to work somewhat.

After copying that file to /etc/udev/rules.d/, all I need to do to set up the device is:

echo spidev 0 | sudo tee /sys/class/spi_master/spi1/new_device

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

3 participants