[Pcsclite-cvs-commit] r6750 - trunk/PCSC/src
ludovic.rousseau at free.fr
ludovic.rousseau at free.fr
Thu Sep 12 14:52:08 UTC 2013
Author: rousseau
Date: 2013-09-12 14:52:08 +0000 (Thu, 12 Sep 2013)
New Revision: 6750
Modified:
trunk/PCSC/src/hotplug_libudev.c
trunk/PCSC/src/hotplug_libusb.c
trunk/PCSC/src/pcscdaemon.c
Log:
Add support of --reader-name-no-serial and --reader-name-no-interface
It is now possible to NOT add the USB serial number of the reader using
--reader-name-no-serial
It is now possible to NOT add the CCID interface name of the reader using
--reader-name-no-interface
See also "What is in a PC/SC reader name?"
http://ludovicrousseau.blogspot.fr/2010/05/what-is-in-pcsc-reader-name.html
Closes Alioth bug [#314338] Add an option to remove serial number and interface name from the PC/CS reader name
https://alioth.debian.org/tracker/index.php?func=detail&aid=314338&group_id=30105&atid=410088
Modified: trunk/PCSC/src/hotplug_libudev.c
===================================================================
--- trunk/PCSC/src/hotplug_libudev.c 2013-09-10 18:31:48 UTC (rev 6749)
+++ trunk/PCSC/src/hotplug_libudev.c 2013-09-12 14:52:08 UTC (rev 6750)
@@ -31,12 +31,13 @@
#include "strlcpycat.h"
#undef DEBUG_HOTPLUG
-#define ADD_SERIAL_NUMBER
-#define ADD_INTERFACE_NAME
#define FALSE 0
#define TRUE 1
+extern char Add_Interface_In_Name;
+extern char Add_Serial_In_Name;
+
pthread_mutex_t usbNotifierMutex;
static pthread_t usbNotifyThread;
@@ -347,13 +348,11 @@
return;
}
-#ifdef ADD_INTERFACE_NAME
- sInterfaceName = udev_device_get_sysattr_value(dev, "interface");
-#endif
+ if (Add_Interface_In_Name)
+ sInterfaceName = udev_device_get_sysattr_value(dev, "interface");
-#ifdef ADD_SERIAL_NUMBER
- sSerialNumber = udev_device_get_sysattr_value(parent, "serial");
-#endif
+ if (Add_Serial_In_Name)
+ sSerialNumber = udev_device_get_sysattr_value(parent, "serial");
/* name from the Info.plist file */
strlcpy(fullname, driver->readerName, sizeof(fullname));
Modified: trunk/PCSC/src/hotplug_libusb.c
===================================================================
--- trunk/PCSC/src/hotplug_libusb.c 2013-09-10 18:31:48 UTC (rev 6749)
+++ trunk/PCSC/src/hotplug_libusb.c 2013-09-12 14:52:08 UTC (rev 6750)
@@ -46,7 +46,6 @@
#include "utils.h"
#undef DEBUG_HOTPLUG
-#define ADD_SERIAL_NUMBER
/* format is "%d:%d:%d", bus_number, device_address, interface */
#define BUS_DEVICE_STRSIZE 10+1+10+1+10+1
@@ -58,6 +57,8 @@
#define FALSE 0
#define TRUE 1
+extern char Add_Serial_In_Name;
+
/* we use the default libusb context */
#define ctx NULL
@@ -544,8 +545,7 @@
sizeof(readerTracker[i].bus_device));
readerTracker[i].bus_device[sizeof(readerTracker[i].bus_device) - 1] = '\0';
-#ifdef ADD_SERIAL_NUMBER
- if (desc.iSerialNumber)
+ if (Add_Serial_In_Name && desc.iSerialNumber)
{
libusb_device_handle *device;
int ret;
@@ -580,7 +580,6 @@
}
}
else
-#endif
readerTracker[i].fullName = strdup(driver->readerName);
if (RFAddReader(readerTracker[i].fullName, PCSCLITE_HP_BASE_PORT + i,
Modified: trunk/PCSC/src/pcscdaemon.c
===================================================================
--- trunk/PCSC/src/pcscdaemon.c 2013-09-10 18:31:48 UTC (rev 6749)
+++ trunk/PCSC/src/pcscdaemon.c 2013-09-12 14:52:08 UTC (rev 6750)
@@ -60,6 +60,8 @@
static int ExitValue = EXIT_FAILURE;
int HPForceReaderPolling = 0;
static int pipefd[] = {-1, -1};
+char Add_Serial_In_Name = TRUE;
+char Add_Interface_In_Name = TRUE;
/*
* Some internal functions
@@ -171,10 +173,12 @@
{"max-card-handle-per-thread", 1, NULL, 's'},
{"max-card-handle-per-reader", 1, NULL, 'r'},
{"auto-exit", 0, NULL, 'x'},
+ {"reader-name-no-serial", 0, NULL, 'S'},
+ {"reader-name-no-interface", 0, NULL, 'I'},
{NULL, 0, NULL, 0}
};
#endif
-#define OPT_STRING "c:fTdhvaeCHt:r:s:x"
+#define OPT_STRING "c:fTdhvaeCHt:r:s:xSI"
newReaderConfig = NULL;
setToForeground = FALSE;
@@ -306,6 +310,14 @@
TIME_BEFORE_SUICIDE);
break;
+ case 'S':
+ Add_Serial_In_Name = FALSE;
+ break;
+
+ case 'I':
+ Add_Interface_In_Name = FALSE;
+ break;
+
default:
print_usage (argv[0]);
return EXIT_FAILURE;
@@ -790,6 +802,8 @@
printf(" -s, --max-card-handle-per-thread maximum number of card handle per thread (default: %d)\n", PCSC_MAX_CONTEXT_CARD_HANDLES);
printf(" -r, --max-card-handle-per-reader maximum number of card handle per reader (default: %d)\n", PCSC_MAX_READER_HANDLES);
printf(" -x, --auto-exit pcscd will quit after %d seconds of inactivity\n", TIME_BEFORE_SUICIDE);
+ printf(" -S, --reader-name-no-serial do not include the USB serial number in the name\n");
+ printf(" -I, --reader-name-no-interface do not include the USB interface name in the name\n");
#else
printf(" -a log APDU commands and results\n");
printf(" -c path to reader.conf\n");
More information about the Pcsclite-cvs-commit
mailing list