The spi_read() function reads data from a specific device on the SPI bus. The prototype for this function is:
int spi_read( int fd, uint32_t device, void *buf, int len );
The arguments are:
The function returns the number of bytes of data that it successfully read from the device. If an error occurred, the function returns -1 and sets errno:
An SPI driver typically considers it to be an error if the number of bytes returned by this function isn't the same as the number of bytes it asked the function to read.