On Sat, 14 Jul 2012, Sami Farin wrote: > On Fri, Jul 13, 2012 at 16:39:13 -0400, Alan Stern wrote: > > On Fri, 13 Jul 2012, Sami Farin wrote: > > > > > > The card reader has a couple of bugs in its firmware. It's odd that > > > > the errors occur only when running at SuperSpeed. You'd think the > > > > firmware would behave the same way regardless of the speed. > > > > > > > > Anyway, you can work around one of the bugs by specifying a quirk > > > > parameter for usb-storage: > > > > > > > > modprobe usb-storage quirks=8564:4000:m > > > > > > > > To fix the other bug will require adding a blacklist entry for the card > > > > reader. First let's see if the quirk alone will get it working. > > > > > > > > Alan Stern > > > > > > Unfortunately it still does not work. > > > I first re-ran mkfs.vfat when connected to usb2 port and then tried to write 512 MB > > > with usb3.. > > > > > > usbmon with quirk enabled > > > https://docs.google.com/file/d/0B_EMXtsx7o56bEtobmJwYi1TaWc/edit > > > > That's really weird. Your log confirms that the quirk was recognized: > > > > > [81577.678735] usb-storage 4-2:1.0: usb_probe_interface > > > [81577.678739] usb-storage 4-2:1.0: usb_probe_interface - got id > > > [81577.678767] usb-storage 4-2:1.0: Quirks match for vid 8564 pid 4000: 400 > > > > And yet the usbmon log shows that the quirk didn't take effect. > > That's why the problem occurred again. > > > > After the device is plugged in, what shows up in the > > /sys/block/sdg/queue/max_hw_sectors_kb file? Without the quirk it > > should contain 120; with the quirk it should contain 32. > > This is what happens.. 120 and 32. > > > The effect of the quirk is to reduce the maximum size allowed in a > > single data transfer from 120 KB to 32 KB. The usbmon trace shows that > > your card reader got an error when it was asked to write a 120-KB > > buffer. Reducing the transfer buffer size should eliminate the errors > > -- but that the latest usbmon trace still shows a 120-KB transfer. > > > > I tried doing an equivalent test on my system (using reads, not writes) > > and it worked fine. I got 32-KB transfers instead of 120-KB transfers. > > I have no idea why it didn't work on your system. > > > > Maybe you should do some tests with reads instead of writes. A simple > > test would be: > > > > dd if=/dev/sdg of=/dev/null bs=1M count=1 > > > > Let's compare the usbmon traces for that command with and without the > > quirk present. > > it worked with 1M with and without quirks, but with 300M it failed without > quirks, OK with quirks (36 MB/s, though it was advertized 85 MB/s). The usbmon logs show just what they should: 32-KB transfers with the quirk and 120-KB transfers without it (actually more like an alternating pattern of 120 KB followed by 8 KB -- I don't know why; it might be an artifact of readahead). Well, the quirk is definitely going to slow things down a little, just how much I'm not sure. But that's better than losing data. :-) As for why the non-quirk 1-MB transfer worked... It's hard to say. The bug might affect reads differently from writes. I'm still puzzled about the previous test, though. Is it possible that you posted a usbmon trace that was taken without the quirk? Tell you what: Try capturing a single trace including both a 1-MB read and your failing write test (and with the quirk present, of course). If something strange is going on, that should show it. 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