Hi Pete,

>From the main thread i call this function every 500micro second on average :
static int submit_transfer(struct usb_device *dev, struct message *msg,
unsigned int lenUsbFrame)
{
struct transfer *transfer;
int status;
int i = 0;
int ret;
struct timeval tv = {1,0};
transfer = transfer_pool_alloc(dev->pool);
if (transfer == NULL)
return -1;

memcpy(transfer->buffer, msg, sizeof(struct message) + msg->hdr.len);

// On met a jour la longueur de la trame USB.
transfer->xfer->length = lenUsbFrame;

status = libusb_submit_transfer(transfer->xfer);
 if (status != 0) {
transfer_pool_free(transfer);
fprintf(stderr, "libusb_submit_transfer fail: %d\n", status);
return -1;
}
return 1;
}

and i create a thread handler :
static void *event_handler_thread(void *args)
{
struct dtlib *lib = (struct dtlib *) args;
int ret = 0;
struct timeval tv = {10,0};

while (lib->run) {
 ret = libusb_handle_events_timeout_completed(lib->ctx, &tv, NULL);
if (ret)
{
ret  = 0;/* for debug */
}
}

pthread_exit(NULL);
return NULL;
}

I have create a callback for IN and OUT bulk pipes.
After a few tens of seconds the handler start to return sometimes -1 and
the main thread which execute the submit return sometimes -11.
After a few more seconds the callback function is never be called and the
submit return always LIBUSB_ERROR_NO_MEM  and handler return -5 !!!

Regards,
Mohamed


On Sat, Dec 1, 2012 at 12:38 AM, Pete Batard <p...@akeo.ie> wrote:

> Ho Mohamed,
>
> On 2012.11.30 10:16, Mohamed HAMZAOUI wrote:
> > ret = libusb_handle_events_timeout_completed(lib->ctx, &tv, NULL);
> > if (ret)
> > {
> > ret  = 0;/* for debug */
>
> Please don't try to hide errors under the carpet, even for debug.
>
> Instead, can you enable debug logging and send us a log of what happens
> when the problem starts to occur? You also need to clarify where the
> LIBUSB_ERROR_NO_MEM you mention comes from? Is that the code returned by
> libusb_handle_events_timeout_completed()?
>
> Regards,
>
> /Pete
>
>
> ------------------------------------------------------------------------------
> Keep yourself connected to Go Parallel:
> TUNE You got it built. Now make it sing. Tune shows you how.
> http://goparallel.sourceforge.net
> _______________________________________________
> libusbx-devel mailing list
> libusbx-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/libusbx-devel
>
------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel

Reply via email to