Re: USB peripheral controller driver for Maxim MAX3420e

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2 Mar 2012, Edwin Mercado wrote:

> Hi,
> 
> I'm developing a peripheral controller driver for the Maxim Max3420e
> device using USB Gadget API for Linux.  Max3420e device is USB 2.0
> compatible but supports only full speed. I'm developing the driver
> under Linux Kernel 2.6.34-10.
> 
> 
> When testing this driver using -t8 of the testusb I get a --> 75
> (Value too large for defined data type) error message.

Test 8 is scatter-gather bulk-IN reads, right?

> Client: modprobe g_zero autoresume=5
> Host: ./testusb -a -c 1 -v 1 -t 8
> 
> unknown speed   /proc/bus/usb/002/009
> param->iterations 1
> /proc/bus/usb/002/009 test 8 --> 75 (Value too large for defined data type)
> 
> The default packet size in testusb is 512 bytes.

No it isn't; that's the default transfer size.   The packet size is 
whatever the endpoint descriptor says it should be.

>  Running the test
> consecutive times gives the same result. However, when I capture the
> USB traces (attached) I notice the following.

You forgot to attach the traces.

> For the first -t8 execution, the client returns 576 bytes (64b more
> than the defined packet size).

64b = 64 bits = 8 bytes.  You probably mean 64 B = 64 bytes.  You said
that your hardware supports only full speed; therefore the bulk
maxpacket size cannot be 512 bytes.  The size must be a power of 2
between 8 and 64, probably 64 bytes.  What does "lsusb -v" show?

Regardless, the 75 error code indicates that your device sent a packet 
larger than the expected packet size.  Most likely, it sent a packet 
containing more than 64 bytes.

>  Every subsequently -t8 execution
> returns 640 bytes (128b more than the defined packet size). In my
> simplistic conclusion, it seems that the host (i.e., testusb -t8)
> requests more bytes than what it can sustain but later complains of
> the packet size being too big.

The host always requests as many bytes as it expects.  If the device 
sends a packet containing too many bytes, it's the device's fault.

> Could you please shed some light as to what may be causing this?

You need to understand and keep straight the difference between packets 
and transfers, as well as the difference between what the host expects 
and what the device tries to send.

For example, assuming the maxpacket size is 64 bytes, suppose the host
wants to receive a 512-byte transfer.  It will ask the device to send 8
64-byte packets.  Even if the device wants to send more data than that,
it can't because the host won't ask it for anything more.

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux