It would be very interesting to see somebody try attaching this to a Windows or Mac OS system. In principle it _should_ work.
Alan Stern
Alan,
We at NetChip had been working on a mass storage driver ourselves (it lacked a fair amount of error handling and only implemented a RAM disk). In any case, we're now looking at your driver to point a couple customers to.
Anyway, I've tried running it with a 2280 board attached to a Windows XP host and ran into some problems. I don't know if you've ever watched what mass storage on Windows does, but it seems to always try to execute SCSI command 0x23. What this is, I have no idea (it's vendor specific according to the SCSI spec) In any case, naturally this command fails and the endpoint is stalled and an INVALID COMMAND status is returned in the CSW. So far so good.
After the failed command, a REQUEST SENSE (0x03) command is called by the host to see what happened. Unfortuantely, for some reason, the CBW is sent with bCBWCBLENGTH == 12, while the spec indicates command 0x03 is a 6 byte command. I confirmed this is really happening with a CATC trace. Of course 12 != 6 so the device reports a phase error, resets, and this repeats forever. My driver simply didn't check if the lengths were sane so I never encountered this problem, but it looks to me like Windows isn't following the spec, although I haven't seen anyone else mention this problem. Disabling the cmnd_size == fsg->cmnd_size in check_command gets around that (temporarily for testing purposes anyway)
From there I can partition the drive just fine and its state is remembered when the device is disconnected. Unfortunately, the partitions won't format for me. Odd, since the partition is created just fine. I'm not entirely sure why this is. A trace show no obvious errors (no stalling, resets, etc.). And I can see a successful CSW returned for the last CBW sent out. But CBWs just stop coming for some reason.
I tried formatting from Linux, but mkfs.msdos appeared to have hung. Eventually I pulled the plug and switched it to a Windows host and saw that it had formatted fine. The last commands I see are disk reads, so I have a feeling that the drive is getting formatted more or less correctly, but something's failing when it's verifying the filesystem. If I try to format it as ext2, it makes it past "writing inode tables" but hangs on "writing superblocks and filesystem accounting information".
Additionally, and I don't know if this is related or not, just after enumeration I see a MODE SENSE requested with a page code of 0x1c. This stalls since it's an unhandled page code, and is followed by a REQUEST SENSE. Then a MODE SENSE with page_code=0x3f is sent. It returns the 16 bytes that it should and I see them on the USB. But a CSW is never sent and the device resets. Here's a little except from syslog (it has a few extra printks I put in to see what was going on, since I don't know your code that well):
file-storage gadget: SCSI command length = 10: 25 00 00 00 00 00 00 00 00 00
file-storage gadget: SCSI command length = 6: 1a 00 1c 00 c0 00
valid_page=0, page_code=0x1c
!valid_page (0) || len (4) > limit (255), page_code=0x1c
file-storage gadget: phase-error=0, reply=-22, stalling
file-storage gadget: sending command-failure status 336896
file-storage gadget: SCSI command length = 12: 03 00 00 00 12 00 00 00 00 00 00 00
SC_REQUEST_SENSE
file-storage gadget: SCSI command length = 6: 1a 00 3f 00 c0 00
valid_page=1, page_code=0x3f
file-storage gadget: Returning 16
net2280 0000:00:0e.0: disconnect file-storage
file-storage gadget: bulk_out_complete --> -108, 0/31
file-storage gadget: invalid CBW: status -108 len 0 sig f cmdlen 255
file-storage gadget: reset config
file-storage gadget: reset interface
net2280 0000:00:0e.0: high speed
net2280 0000:00:0e.0: disconnect file-storage
net2280 0000:00:0e.0: high speed
file-storage gadget: set interface 0
net2280 0000:00:0e.0: enabled ep-a (ep1in-bulk) dma max 0200
net2280 0000:00:0e.0: enabled ep-b (ep2out-bulk) dma max 0200
Right now the disk file is pointed to a 100MB file dd'd from /dev/zero (I don't have a spare drive to try in there).
I can provide you with a CATC trace of an attempted format, if you have a way to view it (there is a free viewer for Windows available from http://www.catc.com, but I don't know if there's a way to do it from Linux).
Anyway, I'll keep looking into these problems, but I've got several things on my plate right now so I don't know how much help I can be, but it'd be great if we can get this up and running. It looks like it's almost there. Not bad at all, considering you've been doing this without hardware!
regards, Alex Sanks NetChip Technology, Inc.
------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ [EMAIL PROTECTED] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel