Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 04 Jan 2017 13:39:36 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-usb@FreeBSD.org
Subject:   [Bug 215765] libusb_handle_events_completed() hangs after device removal
Message-ID:  <bug-215765-17@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D215765

            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@FreeBSD.org
          Reporter: kjopek@gmail.com

Created attachment 178508
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D178508&action=
=3Dedit
Logs from pcscd

pcscd installed on FreeBSD 11.0-CURRENT has serious problems when YubiKey w=
as
detached and reattached to machine. It looks like one of pcscd's threads ha=
ngs
after device removal on function libusb_handle_events_completed() from libu=
sb.

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), det=
ach
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 libu=
sb
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 t=
he
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=20=20=20=20
root@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@musclecard.com>.
Copyright (C) 2001-2015 by Ludovic Rousseau <ludovic.rousseau@free.fr>.
Copyright (C) 2003-2004 by Damien Sauveron <sauveron@labri.fr>.
Report bugs to <pcsclite-muscle@lists.alioth.debian.org>.
Enabled features: FreeBSD amd64-portbld-freebsd11.0 serial usb libusb
usbdropdir=3D/usr/local/lib/pcsc/drivers/ ipcdir=3D/var/run/pcscd
configdir=3D/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.

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-215765-17>