0

I am developing a USB driver in linux kernel space Where my usb interface as two bulk endpoints (IN and OUT).I am using ONE URB to send and receive data. Can i use the same usb_alloc_urb() for sending and receive data.

I am using the below steps to send and receive data using urb

usb_alloc_urb() ---> created only one's

usb_fill_bulk_urb()---> using usb_sndbulkpipe

usb_sumbit_urb() ----> sumbited successfully

usb_fill_bulk_urb()---> using usb_rcvbulkpipe

usb_submit_urb() -----> In this point i am getting ERROR -16.

Is the above followed steps are correct/possible ?

Thank you

kar
  • 2,505
  • 9
  • 30
  • 32

1 Answers1

1

You cannot use the same URB for two transfers at the same time.

To be able to reuse a URB, you must wait until it has been completed (successfully or with an error).

To use full-duplex transfers, you need two URBs.

To get high transfer rates, you must pipeline URBs, i.e., you need even more.

CL.
  • 173,858
  • 17
  • 217
  • 259
  • If there are 3 URB like A,B,C for IN(A) and OUT(B,C) ENDpoint. Where URB A is using usb_sndbulkpipe (pipe) in fill_bulk_urb, URB B and C is using usb_rcvbulkpipe (pipe) in fill_bulk_urb. Now to which URB the received data will go?. – kar Nov 21 '13 at 13:36