[Bug 231076] libusb_cancel_transfer() does NOT cancel a transfer after the USB device is removed

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Mon Sep 3 16:32:47 UTC 2018


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=231076

--- Comment #3 from Ludovic Rousseau <ludovic.rousseau+freebsd at gmail.com> ---
I added logs in my code.
When I start the transfer I have:
00000006 ccid_usb.c:1329:InterruptRead() uxfer->dev_handle: 0x28c0c9c0

When I cancel the transfer I have:
00000004 ccid_usb.c:1399:InterruptStop() uxfer->dev_handle: 0x28c0c9c0

So the problem is not at line 1501 as I initially mentioned.
https://github.com/freebsd/freebsd/blob/master/lib/libusb/libusb10.c#L1501

No, the handle has not been closed. libusb_close() is called _after_ the
transfer is cancelled.

Yes, the transfer has started. At least I get no error when I start it.

Yes, I get data from the interrupt pipe when a smart card is inserted or
removed. So the USB communication does work with the interrupt pipe.

Yes, I can cancel the transfer when the USB device is present. The program does
that when Ctrl-C is used to stop it.

The problem happens when the USB device is no more connected.

I added a call to libusb_set_debug(ctx, LIBUSB_LOG_LEVEL_DEBUG); in my code but
I don't see more debug.
I see that libusb uses DPRINTF(). How can I get the generated log messages?

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-usb mailing list