USB Mass Storage Class Driver

bridged with qdn.public.ddk.usb
Post Reply
Harald Groetterud

USB Mass Storage Class Driver

Post by Harald Groetterud » Tue Jul 08, 2003 9:27 pm

Hi,
 
I am implementing a USB mass storage class driver for a USB flash memory
stick, following the specification
of USB Mass Storage for bulk-only transport and using the reduced block
command set for SCSI commands.
This is done for QNX6 and I use the DDK 6.2.1
 
I have started with the class driver for the printer, an modified it for
the MS class.
The first step is to use the flash memory for storage of one file,
typically a .tgz file.
So far I can transfer files of some 100s kB of data, but in some cases I
get timeouts during the transfer.
When reading from the USB flash, the same happens.
 
When writing data to the device, the driver is doing the following
sequence:
1) Sending CBW (Code Block Wrapper) to bulk out endpoint, holding the SCSI
WRITE cammand
2) Sending one block of data (512 bytes) to the bulk out endpoint
3) Receiving CSW (Code Status Wrapper) from the bulk in endpoint, holding
status info of the data transfer
 
In each of the previous bulk transfers the follwing is executed:
- usbd_bulk_setup; URB setup, either in or out
- usbd_io; submitting the URB with a timeout valuse set 30 sec.
- usbd_urb_status; performed in a loop including also
pthread_sleepon_wait(urb)
 
I believe the timeouts comes from the devu-uhci USB stack, and seems not
to be the timeout used in the
usbd_io call.
Are there any restrictions using the devu-uhci or any known bugs ?
 
Any other tips will be most helpfully.
 
Thank you !
 
Regards
Harald Groetterud
ARX Innovation
E-mail: harald@arxi.no

john eddy

Re: USB Mass Storage Class Driver

Post by john eddy » Sat Jul 12, 2003 12:06 am

Harald,

Any more progress on this....
My brother just bought a thumb drive, and really wants to be able to use it
in qnx.
Thumb drives would kick ass compared to floppies on embedded systems for
file transfer.
Some systems even let you boot from them.

Sorry I can't help you with details on usb interface.
I haven't gone there yet.

Keep up the good work,

John Eddy


"Harald Groetterud" <harald@arxi.no> wrote in message
news:befd02$6sa$1@tiger.openqnx.com...
Hi,

I am implementing a USB mass storage class driver for a USB flash memory
stick, following the specification
of USB Mass Storage for bulk-only transport and using the reduced block
command set for SCSI commands.
This is done for QNX6 and I use the DDK 6.2.1

I have started with the class driver for the printer, an modified it for
the MS class.
The first step is to use the flash memory for storage of one file,
typically a .tgz file.
So far I can transfer files of some 100s kB of data, but in some cases I
get timeouts during the transfer.
When reading from the USB flash, the same happens.

When writing data to the device, the driver is doing the following
sequence:
1) Sending CBW (Code Block Wrapper) to bulk out endpoint, holding the SCSI
WRITE cammand
2) Sending one block of data (512 bytes) to the bulk out endpoint
3) Receiving CSW (Code Status Wrapper) from the bulk in endpoint, holding
status info of the data transfer

In each of the previous bulk transfers the follwing is executed:
- usbd_bulk_setup; URB setup, either in or out
- usbd_io; submitting the URB with a timeout valuse set 30 sec.
- usbd_urb_status; performed in a loop including also
pthread_sleepon_wait(urb)

I believe the timeouts comes from the devu-uhci USB stack, and seems not
to be the timeout used in the
usbd_io call.
Are there any restrictions using the devu-uhci or any known bugs ?

Any other tips will be most helpfully.

Thank you !

Regards
Harald Groetterud
ARX Innovation
E-mail: harald@arxi.no

Harald Grøtterud

Re: USB Mass Storage Class Driver

Post by Harald Grøtterud » Thu Sep 11, 2003 6:23 am

The problem is now hopefully solved. I believe I have misunderstood the
timeout values to be put into the usbd_io function call. The documentation
says that this value is milliseconds. I have a feeling that is in
microseconds ?
However, setting USBD_TIMEOUT_INFINITY seems to work.

Harald Groetterud wrote:
Hi,
�
I am implementing a USB mass storage class driver for a USB flash memory
stick, following the specification
of USB Mass Storage for bulk-only transport and using the reduced block
command set for SCSI commands.
This is done for QNX6 and I use the DDK 6.2.1
�
I have started with the class driver for the printer, an modified it for
the MS class.
The first step is to use the flash memory for storage of one file,
typically a .tgz file.
So far I can transfer files of some 100s kB of data, but in some cases I
get timeouts during the transfer.
When reading from the USB flash, the same happens.
�
When writing data to the device, the driver is doing the following
sequence:
1) Sending CBW (Code Block Wrapper) to bulk out endpoint, holding the SCSI
WRITE cammand
2) Sending one block of data (512 bytes) to the bulk out endpoint
3) Receiving CSW (Code Status Wrapper) from the bulk in endpoint, holding
status info of the data transfer
�
In each of the previous bulk transfers the follwing is executed:
- usbd_bulk_setup; URB setup, either in or out
- usbd_io; submitting the URB with a timeout valuse set 30 sec.
- usbd_urb_status; performed in a loop including also
pthread_sleepon_wait(urb)
�
I believe the timeouts comes from the devu-uhci USB stack, and seems not
to be the timeout used in the
usbd_io call.
Are there any restrictions using the devu-uhci or any known bugs ?
�
Any other tips will be most helpfully.
�
Thank you !
�
Regards
Harald Groetterud
ARX Innovation
E-mail: harald@arxi.no

Post Reply

Return to “qdn.public.ddk.usb”