[Pcsclite-git-commit] [PCSC] 01/01: RFAddReader: more correctly detect duplicate readers
Ludovic Rousseau
rousseau at moszumanska.debian.org
Mon Jun 12 15:54:19 UTC 2017
This is an automated email from the git hooks/post-receive script.
rousseau pushed a commit to branch master
in repository PCSC.
commit 88a53f3ed21aa645e7c65661162f832a053fb9de
Author: Ludovic Rousseau <ludovic.rousseau at free.fr>
Date: Fri Jun 9 09:58:52 2017 +0200
RFAddReader: more correctly detect duplicate readers
To detect a duplicate reader, checking the reader name and port is,
sometimes, not enough.
The problem was when two readers are removed and re-inserted immediately.
One of the 2 readers may not yet be completely removed (from pcscd point
of view) when it is asked to insert it again.
Fixes #20
"Reader not detected when disconnecting / connecting usb hub"
https://github.com/LudovicRousseau/PCSC/issues/20
---
src/readerfactory.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/readerfactory.c b/src/readerfactory.c
index fd93e70..ef0e673 100644
--- a/src/readerfactory.c
+++ b/src/readerfactory.c
@@ -223,7 +223,7 @@ LONG RFAddReader(const char *readerNameLong, int port, const char *library,
readerName[MAX_READERNAME - sizeof(" 00 00")] = '\0';
}
- /* Same name, same port - duplicate reader cannot be used */
+ /* Same name, same port, same device - duplicate reader cannot be used */
if (dwNumReadersContexts != 0)
{
for (i = 0; i < PCSCLITE_MAX_READERS_CONTEXTS; i++)
@@ -240,8 +240,9 @@ LONG RFAddReader(const char *readerNameLong, int port, const char *library,
tmplen = strlen(lpcStripReader);
lpcStripReader[tmplen - 6] = 0;
- if ((strcmp(readerName, lpcStripReader) == 0) &&
- (port == sReadersContexts[i]->port))
+ if ((strcmp(readerName, lpcStripReader) == 0)
+ && (port == sReadersContexts[i]->port)
+ && (strcmp(device, sReadersContexts[i]->device) == 0))
{
Log1(PCSC_LOG_ERROR, "Duplicate reader found.");
return SCARD_E_DUPLICATE_READER;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pcsclite/PCSC.git
More information about the Pcsclite-cvs-commit
mailing list