On 15-11-12 02:37 PM, Alan Stern wrote:
On Thu, 12 Nov 2015, Felipe Balbi wrote:
Also, my problem seems to be sensitive to the host port being USB
3.0 since I have an older Lenovo X201 with USB 2.0 ports that does
_not_ exhibit this problem. IOW when I connect my Arietta G25 mass
storage gadget to the X201, it works properly for all G25 kernels
that I have tried.
I'd blame UDC driver. We have several other UDCs working with the same
configuration.
Sounds reasonable to me. But that doesn't explain why it works okay
with the older Lenovo X201 laptop.
it seems like only x240 is running > 4.0. What is x201 running ? Could
be older, buggy xhci driver.
Or maybe it uses EHCI, since Douglas described it as having USB 2.0
ports.
Yes, the X201 has USB 2.0 host ports. It is running a stock Ubuntu
15.10 kernel: 4.2.0-18-generic and the log indicates that the
ehci_pci driver is being used. Part of the X201's syslog is
attached in which a driver complains about the invalid maxpacket
values of 64.
So its seems that the ehci drivers as used on the X201 can work
around the invalid maxpacket value (64) while the xhci drivers
used by the X240 (due to the USB 3.0 host ports) get tripped up.
Still looking at drivers/usb/gadget/udc/atmel_usba_udc.c which
has lots of changes between lk 3.19.0-rc4 and 4.0.0-rc4 . The
maxpacket value seems (to me) to be related to the fifo-size
in the gadget section of this dts include file:
arch/arm/boot/dts/at91sam9x5.dtsi
which has 1024 for ep1 through ep5 and 64 for ep0.
So it looks like 1.5 bugs:
- one in atmel's udc driver for the at91sam9x5 family, and
- the inconsistency between the ehci driver working around
invalid maxpacket values and the xhci driver behaving
badly (lots of bus resets and a badly made SCSI storage
device [e.g. INQUIRY works but READ(10) fails]).
Doug Gilbert
usb 1-1.2: new high-speed USB device number 6 using ehci-pci
usb 1-1.2: config 1 interface 0 altsetting 0 bulk endpoint 0x81 has invalid maxpacket 64
usb 1-1.2: config 1 interface 0 altsetting 0 bulk endpoint 0x2 has invalid maxpacket 64
usb 1-1.2: New USB device found, idVendor=0525, idProduct=a4a5
usb 1-1.2: New USB device strings: Mfr=3, Product=4, SerialNumber=0
usb 1-1.2: Product: Mass Storage Gadget
usb 1-1.2: Manufacturer: Linux 4.0.0-rc4-armv5-r2 with atmel_usba_udc
link mtp-probe: checking bus 1, device 6: "/sys/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2"
link mtp-probe: bus: 1, device: 6 was not an MTP device
usb-storage 1-1.2:1.0: USB Mass Storage device detected
usb-storage 1-1.2:1.0: Quirks match for vid 0525 pid a4a5: 10000
scsi host6: usb-storage 1-1.2:1.0