Closed pelwell closed 1 year ago
@pelwell Indeed, i can confirm this causes an issue with latest kernels
For those looking for a quick kernel rollback, reverting using https://github.com/Hexxeh/rpi-firmware/commits/master Note that rpi3b was not working with kernel 5.4.83, so it was reverted to 5.4.79
sudo rpi-update 0642816ed05d31fb37fc8fbbba9e1774b475113f
sudo rpi-update 453e49bdd87325369b462b40e809d5f3187df21d
There are two bugs here.
_spi.cshigh
appears True
when it actually should be False
(SPI standard) by default.False
crashes the program.So the entirely reasonable-looking code:
if self._spi.cshigh:
self._spi.cshigh = False
hits both bugs and dies.
SPI drivers that are configured to use GPIO descriptors, such as spi-bcm2835, always result in the SPI_CS_HIGH flag being set. This is meant to be purely internal state - the GPIO descriptor actually handles the polarity inversion as necessary - but the state is visible to clients of spidev.
This library intentionally issues zero-length reads if SPI_CS_HIGH is set, which is always true on Raspberry Pi kernels since 5.4. An optimisation present in the 5.10 and 5.11 kernels makes these reads fatal by triggering an almost-infinite loop. The lockup is the responsibility of the spi-bcm2835 driver, but you might want to reconsider whether this special SPI_CS_HIGH handling is still appropriate.