doceme / py-spidev

MIT License
459 stars 205 forks source link

Adapt to updated spidev kernel 3.15+ API #14

Closed chrillomat closed 9 years ago

chrillomat commented 9 years ago

New fields in spi_ioc_transfer struct: tx_nbits, rx_nbits New IOCTLs: SPI_IOC_WR_MODE32, SPI_IOC_RD_MODE32 - we are checking for these to determine if the new fields are available in spi_ioc_transfer see also https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit?id=dc64d39b54c1e9db97a6fb1ca52598c981728157

Gadgetoid commented 9 years ago

I've compiled Py-spidev along with this pull request against spidev.h for kernel 3.18.4+ and can confirm that this change appears to not only work, but be essential for Py-spidev to work against this kernel.

The upshot of compiling the existing pypi package is this:

self.spi.xfer([self.instruction_set_template | instruction_set])
IOError: [Errno 22] Invalid argument

While the package, with this PR, works as expected.

I have yet to test this PR against an earlier kernel.