[Bug 215765] libusb_handle_events_completed() hangs after device removal
bugzilla-noreply at freebsd.org
bugzilla-noreply at freebsd.org
Wed Jan 4 13:39:37 UTC 2017
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=215765
Bug ID: 215765
Summary: libusb_handle_events_completed() hangs after device
removal
Product: Base System
Version: 11.0-RELEASE
Hardware: Any
OS: Any
Status: New
Severity: Affects Some People
Priority: ---
Component: usb
Assignee: freebsd-usb at FreeBSD.org
Reporter: kjopek at gmail.com
Created attachment 178508
--> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=178508&action=edit
Logs from pcscd
pcscd installed on FreeBSD 11.0-CURRENT has serious problems when YubiKey was
detached and reattached to machine. It looks like one of pcscd's threads hangs
after device removal on function libusb_handle_events_completed() from libusb.
Steps to reproduce:
Install pcsc-lite either from ports or packages. Start pcscd demon in
foreground mode with logging enabled:
pcscd -f -a -I
Try to attach YubiKey, list YubiKey status in GPG (gpg2 --card-status), detach
it, reattach, list card status in GPG.
In my case the second attempt shows something like:
$ gpg2 --card-status
gpg: selecting openpgp failed: Operation not supported by device
while pcscd logs the following error:
02006441 ccid_usb.c:1323:InterruptStop() libusb_cancel_transfer failed: -5
14759547 winscard.c:261:SCardConnect() Reader Yubico Yubikey 4 OTP+U2F+CCID 00
00 Not Found
Expected result is that pcscd correctly reinitializes YubiKey and gpg shows
correctly status of a YubiKey.
Also, there are questions from maintainer of pcscd and ccid related to libusb
implementation in FreeBSD:
- Why libusb_handle_events_completed() does not return on device removal?
- How to cancel a transfer after device removal if libusb_cancel_transfer()
fails with LIBUSB_ERROR_NOT_FOUND since the device is removed?
Please notice that on MacOS libusb_handle_events_completed() returns when the
USB device is removed.
Here are the details about platform and installed software:
FreeBSD AMDC2690 11.0-RELEASE-p2 FreeBSD 11.0-RELEASE-p2 #0: Mon Oct 24
06:55:27 UTC 2016
root at amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC amd64
pcscd --version
pcsc-lite version 1.8.18.
Copyright (C) 1999-2002 by David Corcoran <corcoran at musclecard.com>.
Copyright (C) 2001-2015 by Ludovic Rousseau <ludovic.rousseau at free.fr>.
Copyright (C) 2003-2004 by Damien Sauveron <sauveron at labri.fr>.
Report bugs to <pcsclite-muscle at lists.alioth.debian.org>.
Enabled features: FreeBSD amd64-portbld-freebsd11.0 serial usb libusb
usbdropdir=/usr/local/lib/pcsc/drivers/ ipcdir=/var/run/pcscd
configdir=/usr/local/etc/reader.conf.d
ccid version is 1.4.25 patched to add more verbose logging.
Logs from verbose version of ccid are also attached to this mail.
Respects for Ludovico Rousseau for his help on debugging ccid and pcscd.
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the freebsd-usb
mailing list