Hi,
My app needs be able  to read & write (to different enpoint) at same time,
and my code is not working. but if I change the call to Synchronous
, everything works fine, could any one tell me what I did wrong here?
thx

CallBackData* userdata=new CallBackData();
userdata->ExitTransfer=false;
int err =0;
libusb_transfer* transfer =libusb_alloc_transfer(0);
 if (!transfer)
 {
   err=-ENOMEM;
   return NULL;
 }
 libusb_fill_bulk_transfer
(transfer,m_handle,endpoint,reinterpret_cast<unsigned char*>
(pbBuffer),
c_uiLength,LibUSBDevice::WriteCallback,userdata,ITP_TRANSFER_TIMEOUT);

 if (!err)
 {
   err = libusb_claim_interface(this->m_handle, 0);
   err=libusb_submit_transfer(transfer);
   while (!userdata->ExitTransfer)
  {
      //I also added Lock here for the whole block here and
to serialize the call to
      //libusb_handle_events_timeout_completed, but it still does not work.
       struct timeval tv = { 1, 0 };
       int completed =0;

      err = libusb_handle_events_timeout_completed(NULL, &tv,&completed );
 }
}
...
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel

Reply via email to