SPI_IOC_MESSAGE(N) macro giving me fits
I'm having trouble getting a SPI program I'm working on to behave correctly and it seems to be some issue with the SPI_IOC_MESSAGE(N) macro. Here's sample code that DOESN'T work (ioctl returns EINVAL (22) ): std::vector<spi_ioc_transfer> tr; <code that fills tr with 1+ transfers> // Hand the transmission(s) off to the SPI driver if (tr.size() > 0) { int ret = ioctl(fd, SPI_IOC_MESSAGE(tr.size()), tr.data()); if (ret < 1) { int err = errno; } } My test code right now is creating a vector of length 1. If I explicitly change the code to: int ret = ioctl(fd, SPI_IOC_MESSAGE( 1 ), tr.data()); ..