Page 1 of 1

usb_mass patch for old and small usb keys

Posted: Fri Sep 10, 2004 9:38 am
by spooo
Hi,

I have a one line patch to make my old 32MB usb key working with the usb_mass iop driver.

For recent usb memory keys, it seems that the interface subclass is 6 but for my small key, it's 5.

I transformed the following line in cvs usb_mass/iop/mass_stor.c :

Code: Select all

        if(     (intf->bInterfaceClass          != USB_CLASS_MASS_STORAGE) ||
!               (intf->bInterfaceSubClass       != USB_SUBCLASS_MASS_SCSI) ||
                (intf->bInterfaceProtocol       != USB_PROTOCOL_MASS_BULK_ONLY) ||
by this

Code: Select all

        if(     (intf->bInterfaceClass          != USB_CLASS_MASS_STORAGE) ||
!               (intf->bInterfaceSubClass       != USB_SUBCLASS_MASS_SCSI &&
!                intf->bInterfaceSubClass       != USB_SUBCLASS_MASS_SFF_8070I) ||
                (intf->bInterfaceProtocol       != USB_PROTOCOL_MASS_BULK_ONLY) ||
I've tested only with the mass_example.c test but at least it displays the root directory correctly.

Also I had problem to compile the latest cvs usb_mass using the latest cvs ps2sdk.
Some irx filename.h are defined twice (namely sifcmd.h) and I had to add a symbolic link sifcmdx.h->sifcmd.h (in ps2sdk/iop/kernel//include) and include this file, otherwise it is ps2sdk/common/include/sifcmd.h which is included.
I could not do better, and I don't know where is the good place to talk about that.

cheers

--
spooo - who would love to build a basic graphical to choose and launch elves directly from usb key

Posted: Fri Sep 10, 2004 10:28 am
by Drakonite
Hmm... interesting.
Usually subclass 5 is for Floppy drives IIRC, and often uses a different command set for talking to the device... I'd be careful blindly trying to use any subclass 5 device using the subclass 6 stuff personally.

But then again, I'm not an expert on all of this.

Posted: Tue Sep 14, 2004 5:50 am
by ole
Very interesting :)
I checked the doc for 8070i protocol (found here: ftp://ftp.seagate.com/sff/INF-8070.PDF) and to my surprise it's sort of ATAPI protocol, which is compatible (at least to some level) to SCSI command set. I roughly compared the commands and they seem to be identical!
Thanks spooo for noticing/testing, I will add the patch to cvs.

Posted: Thu Mar 17, 2005 8:53 pm
by MisterJP
Hello,

First, be kind if waht i say is non-sense cause it's my first day in the ps2 dev scene :-)
Second, I am french, so excuse me for my english.

I didnt manage to make any of my usb stick to work. Apparently the usb_mass driver freeze.
It seems to freeze in mass_stor_warmup when checking the CSW after the INQUIRY or the START_STOP command. I cannot experiment much cause i am still waiting for my naplink cable, however here is my guess on what happen :
I think the device issue a CHECK_CONDITION tag after these commands : IMO, this is due, either to a timing issue or (for the START_STOP command) a non-supported command.
But as this tag is not what is expected, the code treated it as a phase error and perform a bulk reset. Instead it should issue a REQUEST_SENSE command to get the error code and take apropriate action to recover.

Has anyone looked in that direction ? Does this even make sense for you ?
Anyway, i will make some more experiment next week when i will receive my cable.

Regards,
JP.

Posted: Fri Mar 18, 2005 8:08 am
by ole
It seems to freeze in mass_stor_warmup
Exactly - the warmup causes the freeze on some devices. Unfortunately none of my devices freeze this way so I can't test the suggested solution. All I can do is to implement the CHECK_CONDITION command and then let others to test it. If you are willing to help please pm me.