doceme / py-spidev

MIT License
451 stars 203 forks source link

FileNotFoundError: [Errno 2] No such file or directory #87

Open tarantelot opened 5 years ago

tarantelot commented 5 years ago

Do I have this error because of the incorrect path specified in spidev_module.c. The default path to look for devices is dev/spidevX.Y, whereas my appear at /sys/bus/spi/devices/spiX.Y.

Wuppdich commented 4 years ago

i came across the same error because i forgot to enable SPI in the Raspberry Pi settings

tim-seoss commented 1 year ago

/sys/bus/spi/devices/spiX.Y are sysfs entries which indicate that one or more SPI bus master devices are present, and have SPI controller drivers loaded and bound to them, with the corresponding chip-select lines configured (bus X and chipselect Ys in your example).

If you don't have spidev devices, then either udev hasn't created them on your system (because of a deliberate or accidental misconfiguration), or (more likely) because the spidev driver is not bound to any SPI peripheral devices. It used to be possible to do this using devicetree rules, or using dynamic binding (e.g. using udev rules). More recent kernels have deprecated the devicetree mechanisms, so udev rules should be used.