Skip to contentSkip to conversation

Documentation/spi/spidev_test.c "Message too long" -EMSGSIZE

DISCUSSION Kevyn-Alexandre Paré 2 participants 2 messages Mar 4, 2011 SPI

lore
Share & tools
lore
#0 lore raw

Hi,

I just try to transfer 32775 bytes with spidev_test.c and receive this message:
can't send spi message: Message too long

Since driver/spi/spidev.c validate that count is not bigger then bufsiz that is 4096. Because of this:

static unsigned bufsiz = 4096;
module_param(bufsiz, uint, S_IRUGO); MODULE_PARM_DESC(bufsiz, "data bytes in biggest supported SPI message");

Question1: Anyone have made some test with buffer bigger then 4096 and see any reason not going to something like 32775?

Question2: Since this parameter is S_IRUGO I have no other choice then using the driver as module if I want to change this size!?

Best Regards,

Kevyn-Alexandre Paré

------------------------------------------------------------------------------
What You Don't Know About Data Connectivity CAN Hurt You This paper provides an overview of data connectivity, details its effect on application quality, and explores various alternative solutions. http://p.sf.net/sfu/progress-d2d
_______________________________________________
spi-devel-general mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/spi-devel-general

#1 lore raw
Quoted 6 lines · Kevyn-Alexandre Paré

Hi,

I just try to transfer 32775 bytes with spidev_test.c and receive this message:
can't send spi message: Message too long

Quoted 6 lines

Since driver/spi/spidev.c validate that count is not bigger then bufsiz that is 4096. Because of this:

static unsigned bufsiz = 4096;
module_param(bufsiz, uint, S_IRUGO); MODULE_PARM_DESC(bufsiz, "data bytes in biggest supported SPI message");

That's just broken. There shouldn't be any limit on the size of an spi message sent from userspace. If userspace can pass the buffer, then the spi layer should be able to send it.

It looks like it should be possible to modify spidev to handle large transfers.

Quoted 4 lines

Question1: Anyone have made some test with buffer bigger then 4096 and see any reason not going to something like 32775?

Question2: Since this parameter is S_IRUGO I have no other choice then using the driver as module if I want to change this size!?

You should be able to pass a different default value in the kernel parameters string at boot time.

g.

------------------------------------------------------------------------------
What You Don't Know About Data Connectivity CAN Hurt You This paper provides an overview of data connectivity, details its effect on application quality, and explores various alternative solutions. http://p.sf.net/sfu/progress-d2d