Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reader not detected when disconnecting / connecting usb hub #20

Closed
santigimeno opened this issue Jun 8, 2017 · 4 comments
Closed

Reader not detected when disconnecting / connecting usb hub #20

santigimeno opened this issue Jun 8, 2017 · 4 comments

Comments

@santigimeno
Copy link

Scenario description

OS: Debian Jessie
[email protected]
[email protected]
Two card readers connected through a USB HUB. The readers are:

  • OMNIKEY CardMan (076B:5121) 5121
  • OMNIKEY CardMan (076B:3021) 3021

I'm using the proprietary ccid driver from OMNIKEY

From time to time, if the hub is disconnected and connected immediately the second reader(3021) is not correctly opened by pcscd even though is correctly detected by the kernel. The relevant logs from pcscd seem to be:

00000073 winscard.c:927:SCardDisconnect() Error powering down card: -2146435049 0x80100017
00000061 winscard.c:1040:SCardDisconnect() UnrefReader() count was: 1
00000031 eventhandler.c:173:EHDestroyEventHandler() Stomping thread.
00000028 eventhandler.c:202:EHDestroyEventHandler() Waiting polling thread
00219585 eventhandler.c:334:EHStatusHandlerThread() Error communicating to: OMNIKEY CardMan (076B:3021) 3021 01 00
00083070 hotplug_libudev.c:651:HPEstablishUSBNotifications() USB Device add
00000868 hotplug_libudev.c:297:get_driver() Looking for a driver for VID: 0x076B, PID: 0x3021, path: /dev/bus/usb/001/104
00000472 hotplug_libudev.c:436:HPAddDevice() Adding USB device: OMNIKEY CardMan (076B:3021) 3021
00000602 readerfactory.c:246:RFAddReader() Duplicate reader found.
00000379 hotplug_libudev.c:523:HPAddDevice() Failed adding USB device: OMNIKEY CardMan (076B:3021) 3021
00000056 readerfactory.c:246:RFAddReader() Duplicate reader found.
00000029 hotplug_libudev.c:533:HPAddDevice() Failed adding USB device: OMNIKEY CardMan (076B:3021) 3021
00314770 eventhandler.c:502:EHStatusHandlerThread() Die
00000346 eventhandler.c:213:EHDestroyEventHandler() Thread stomped.
00000052 readerfactory.c:1124:RFUnInitializeReader() Attempting shutdown of OMNIKEY CardMan (076B:3021) 3021 01 00.

Find attached the full pcscd log:

log2.txt

Any help with this issue would be appreciated.

Thanks in advance.

@LudovicRousseau
Copy link
Owner

This is because the 3021 reader is added before it has been completely removed (from pcscd point of view).

Do you have the same problem if you use my CCID driver instead?
http:https://pcsclite.alioth.debian.org/ccid.html

@LudovicRousseau
Copy link
Owner

Can you try to apply the attached patch and try again?

--- /var/folders/5h/3d1x67_x5g30t36wypgxpmpc0000gn/T//OepuQa_readerfactory.c	2017-06-08 15:45:31.000000000 +0200
+++ src/readerfactory.c	2017-06-08 15:45:14.000000000 +0200
@@ -241,7 +241,8 @@ LONG RFAddReader(const char *readerNameL
 				lpcStripReader[tmplen - 6] = 0;
 
 				if ((strcmp(readerName, lpcStripReader) == 0) &&
-					(port == sReadersContexts[i]->port))
+					(port == sReadersContexts[i]->port)
+					&& (strcmp(device, sReadersContexts[i]->device) == 0))
 				{
 					Log1(PCSC_LOG_ERROR, "Duplicate reader found.");
 					return SCARD_E_DUPLICATE_READER;

@santigimeno
Copy link
Author

Do you have the same problem if you use my CCID driver instead?

It seems it doesn't happen but I can't use your driver because I'm using SLE4442 cards that apparently need the proprietary driver.

Can you try to apply the attached patch and try again?

Compiling it now. Thanks!!

@santigimeno
Copy link
Author

After some initial testing it looks like it works correctly. I'll give more feedback in a few days. Thanks a lot @LudovicRousseau !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants