[Pcsclite-cvs-commit] PCSC/src hotplug_libusb.c,1.23,1.24
rousseau@haydn.debian.org
rousseau@haydn.debian.org
Update of /cvsroot/pcsclite/PCSC/src
In directory haydn:/tmp/cvs-serv23531
Modified Files:
hotplug_libusb.c
Log Message:
do not try to restart a USB driver if the first execution fails (because
of a bug in the driver or whatever) since the next execution of the
driver will, with a great probability, also fail. The user has to
unplug/replug the reader to restart the driver. This prevents to fill
the system logs with an error message every 1 second.
Index: hotplug_libusb.c
===================================================================
RCS file: /cvsroot/pcsclite/PCSC/src/hotplug_libusb.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- hotplug_libusb.c 23 Mar 2004 17:22:27 -0000 1.23
+++ hotplug_libusb.c 1 Apr 2004 09:14:05 -0000 1.24
@@ -14,6 +14,7 @@
#include "config.h"
#ifdef HAVE_LIBUSB
+
#include <string.h>
#include <sys/types.h>
#include <stdio.h>
@@ -40,6 +41,7 @@
#define READER_ABSENT 0
#define READER_PRESENT 1
+#define READER_FAILED 2
#define FALSE 0
#define TRUE 1
@@ -364,15 +366,16 @@
return 0;
}
+ strncpy(readerTracker[i].bus_device, bus_device, BUS_DEVICE_STRSIZE);
+ readerTracker[i].bus_device[BUS_DEVICE_STRSIZE - 1] = '\0';
+
+ readerTracker[i].driver = driver;
+
if (RFAddReader(driver->readerName, PCSCLITE_HP_BASE_PORT + i,
driver->libraryPath, deviceName) == SCARD_S_SUCCESS)
- {
- strncpy(readerTracker[i].bus_device, bus_device, BUS_DEVICE_STRSIZE);
- readerTracker[i].bus_device[BUS_DEVICE_STRSIZE - 1] = '\0';
-
readerTracker[i].status = READER_PRESENT;
- readerTracker[i].driver = driver;
- }
+ else
+ readerTracker[i].status = READER_FAILED;
SYS_MutexUnLock(&usbNotifierMutex);
@@ -405,3 +408,4 @@
}
#endif
+