Bulk questions

bridged with qdn.public.ddk.usb
Post Reply
Jean-Louis Villecroze

Bulk questions

Post by Jean-Louis Villecroze » Tue Jul 30, 2002 6:15 am

Hello there,

I'm having a little hard time understanding how I'm suppose to send a
command to a usb device (using the Bulk protocol only) and then get the
device to answer.

From the USB 1.1 documentation for mass storage, the CBW are to be
sent on the Bulk-Out endpoint of the device, and the CSW is to
be read from the Bulk-In endpoint.

How do I specify to the URB I created to send the CBW, to wait for
data on the Bulk-In ? Do I have to create 2 URB, one for sending
and one for receiving ?

The printer example in the DDK, seems to be using only one URB ...

Here what I'm doing right now :

urb = usbd_alloc_urb(NULL);
if(urb)
{
T_CBW *cbw = (T_CBW *)buffer;

memset(cbw,0,sizeof(T_CBW));
cbw->dCBWSignature = ENDIAN_LE32(CBW_SIGNATURE);
cbw->dCBWTag
= ENDIAN_LE32((uint32_t)mass); // use a unique tag
cbw->bmCBWFlags
= CBW_DIRECTION_IN;
cbw->bCBWCBLength
= 12;

cbw->CBWCB[0] = 0; // TEST
cbw->CBWCB[1] = 0; // lun 0
cbw->CBWCB[4] = 0; // max lun buffer

usbd_setup_bulk(urb,URB_DIR_OUT,cbw,length);
status = usbd_io(urb,mass->ep_out,cb_test,mass,USBD_TIME_INFINITY);
if(status == EOK)
status = Mass_Bulk_Wait(mass,urb,mass->ep_out);

// free the urb
usbd_free_urb(urb);

}

My driver seems to be locked in the Mass_Bulk_Wait function, which is
the same that the one in the printer example.

Thanks for any help.

Regards,

jean-louis

Post Reply

Return to “qdn.public.ddk.usb”