golemparts/rppal

Detect SPI buffer size

danieldulaney opened this issue · 0 comments

Would it be possible to detect the SPI buffer size based on /sys/module/spidev/parameters/bufsiz and automatically chunk SPI transfers?

I am writing a higher-level interface that is meant to work on multiple platforms. However, Raspberry Pi currently has to be special-cased to avoid EMSGSIZE when larger SPI transfers are needed. This will end up affecting all upstream users that depend on embedded_hal.

I accomplished this with minimal overhead by using chunks and chunks_mut on the read and write buffers. If there's interest, I can put together a PR.