Page 1 of 1

Problems with usb_mass

Posted: Mon Nov 01, 2004 2:00 am
by raipsu
Hi!

I have been trying to use usb_mass without success. I have a Transcend 256MB JetFlash. I'm trying to test with mass_example.elf. It jams when trying to read directory listing. I added some XPRINTFs to the iop mass_stor.c and noticed that it jams when usb_bulk_status() is calling WaitSema(). I have tested with usbd.irx from a demo disc and npm-usbd.irx.

Output when executing mass_example.elf, debug messages turned on in usb_mass.irx:

Code: Select all

# ps2client execee host:mass_example.elf
loadelf: fname host:mass_example.elf secname all
Input ELF format filename = host:mass_example.elf
0 00100000 00006f28 .
Loaded, host:mass_example.elf
start address 0x100008
gp address 00000000
loadmodule: fname rom0:SIO2MAN args 0 arg
loadmodule: id 34, ret 1
loadmodule: fname rom0:PADMAN args 0 arg
Pad driver. (99/11/22)
loadmodule: id 35, ret 0
loadmodule: fname mc0:/BOOT/usbd.irx args 0 arg
USB Driver (Version 0.14.0 Tue Sep 19 10:51:41 JST 2000)
loadmodule: id 36, ret 0
usbd.irx ok  ret=36
loadmodule: fname host:../iop/usb_mass.irx args 0 arg
usb_mass: version 0.22
mass_stor: registerDriver=0
loadmodule: id 37, ret 0
usbtest.irx ok. ret=37
okusb_mass: connect: devId=1
register Intput endpoint id =1 addr=81 packetSize=64
register Output endpoint id =2 addr=02 packetSize=64
usb_mass: connect ok: epI=1, epO=2
DIRECTORY LIST -------------- mass_stor: getting status...
wait reset semaId=24516449
Usb - callback: res 0, bytes 0, arg 1761761
wait clear halt semaId=24516451
Usb - callback: res 0, bytes 0, arg 1761763
setting configuration controlEp=0, confNum=1
Waiting for config done...
Usb - callback: res 0, bytes 0, arg 1761765
mass_stor: warm up called !
-INQUIRY
Usb - callback: res 0, bytes 31, arg 1761767
-INQUIRY READ DATA
Usb - callback: res 8, bytes 0, arg 1761769
 retCode=8 retSize=0
-INQUIRY STATUS
...waiting for status 1 ...
usbbulktransfer..
usbbulktransfer done.. (0)
USB: WaitSema..
It jams here. If I'll remove the usb stick, it will (sometimes) continue:

Code: Select all

Usb - callback: res 5, bytes 0, arg 176176b
USB: WaitSema done..
Usb: bulk csw.status: 0
buld done 0

Inquiry data
usb_mass: disconnect: devId=1
usb_mass: disconnect ok.
------------
Vendor   : JetFlash
Prod id  :TS256MJF2A
Prod rev :1.00
-START COMMAND
Usb: Error sending bulk command
-START COMMAND STATUS
...waiting for status 1 ...
usbbulktransfer..
usbbulktransfer done.. (258)
Usb: Error sending csw bulk command
buld done -1
Is there something that could be done? Or will I just buy another usb-stick for PS2? :)

Posted: Mon Nov 01, 2004 4:08 am
by raipsu
I commented this line from mass_stor_warmup():

usb_bulk_manage_status(dev, -TAG_INQUIRY);

and from usb_bulk_manage_status():

usb_bulk_reset(dev, 1); /* Perform reset recovery */

Now it seems to work just fine. :) Maybe my stick is non-standard or the warmup sequence is incorrect? More error handling should be added.. Seems that UsbBulkTransfer() does not necessary ever call usb_callback() functions. Some timeout should be added?

usb_mass fioDopen() etc.

Posted: Mon Nov 01, 2004 6:45 am
by raipsu
I added fioDopen(), fioDclose(), fioDread() and fioGetStat() support to usb_mass. Here's the patch:

http://ruoho.org/ps2/usb_mass_dopen_patch.diff

Posted: Wed Nov 03, 2004 12:00 am
by ole
Is there something that could be done? Or will I just buy another usb-stick for PS2? :)
The warmup content is experimental, it is quite possible it will not work for all devices. You can try to find more reliable warmup sequence.

I've experienced lock-ups of the usb part when the debugging printf are used. When the printfs are removed then program works (most of the time :-) fine.

Thanks for the diff, I will update the sources soon.

Posted: Wed Nov 03, 2004 7:00 pm
by jum
I also had the lockup problem with my Transcend 128MB stick.

Looking forward to using usb_mass in one of my projects :)

- Jum