[Pcsclite-cvs-commit] r2871 - in /trunk/Drivers/ccid/src: ccid.h ccid_serial.c ccid_usb.c ifdhandler.c
rousseau at users.alioth.debian.org
rousseau at users.alioth.debian.org
Tue Apr 8 09:34:13 UTC 2008
Author: rousseau
Date: Tue Apr 8 09:34:13 2008
New Revision: 2871
URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=2871
Log:
Simulate card absence for the GemCore SIM Pro
Modified:
trunk/Drivers/ccid/src/ccid.h
trunk/Drivers/ccid/src/ccid_serial.c
trunk/Drivers/ccid/src/ccid_usb.c
trunk/Drivers/ccid/src/ifdhandler.c
Modified: trunk/Drivers/ccid/src/ccid.h
URL: http://svn.debian.org/wsvn/pcsclite/trunk/Drivers/ccid/src/ccid.h?rev=2871&op=diff
==============================================================================
--- trunk/Drivers/ccid/src/ccid.h (original)
+++ trunk/Drivers/ccid/src/ccid.h Tue Apr 8 09:34:13 2008
@@ -100,6 +100,14 @@
* bNumEndpoints
*/
int bNumEndpoints;
+
+ /*
+ * GemCore SIM PRO slot status management
+ * The reader always reports a card present even if no card is inserted.
+ * If the Power Up fails the driver will report IFD_ICC_NOT_PRESENT instead
+ * of IFD_ICC_PRESENT
+ */
+ int dwSlotStatus;
} _ccid_descriptor;
/* Features from dwFeatures */
Modified: trunk/Drivers/ccid/src/ccid_serial.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/Drivers/ccid/src/ccid_serial.c?rev=2871&op=diff
==============================================================================
--- trunk/Drivers/ccid/src/ccid_serial.c (original)
+++ trunk/Drivers/ccid/src/ccid_serial.c Tue Apr 8 09:34:13 2008
@@ -585,6 +585,7 @@
serialDevice[reader_index].ccid.dwMaxDataRate = 344086;
serialDevice[reader_index].ccid.bMaxSlotIndex = 0;
serialDevice[reader_index].ccid.arrayOfSupportedDataRates = SerialTwinDataRates;
+ serialDevice[reader_index].ccid.dwSlotStatus = IFD_ICC_PRESENT;
serialDevice[reader_index].echo = TRUE;
/* change some values depending on the reader */
Modified: trunk/Drivers/ccid/src/ccid_usb.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/Drivers/ccid/src/ccid_usb.c?rev=2871&op=diff
==============================================================================
--- trunk/Drivers/ccid/src/ccid_usb.c (original)
+++ trunk/Drivers/ccid/src/ccid_usb.c Tue Apr 8 09:34:13 2008
@@ -30,6 +30,7 @@
# include <sys/types.h>
# endif
#include <usb.h>
+#include <ifdhandler.h>
#include "misc.h"
#include "ccid.h"
@@ -340,6 +341,8 @@
*usbDevice[reader_index].nb_opened_slots += 1;
usbDevice[reader_index].ccid.bCurrentSlotIndex++;
+ usbDevice[reader_index].ccid.dwSlotStatus =
+ IFD_ICC_PRESENT;
DEBUG_INFO2("Opening slot: %d",
usbDevice[reader_index].ccid.bCurrentSlotIndex);
goto end;
@@ -442,6 +445,7 @@
usbDevice[reader_index].ccid.arrayOfSupportedDataRates = get_data_rates(reader_index, dev);
usbDevice[reader_index].ccid.bInterfaceProtocol = usb_interface->altsetting->bInterfaceProtocol;
usbDevice[reader_index].ccid.bNumEndpoints = usb_interface->altsetting->bNumEndpoints;
+ usbDevice[reader_index].ccid.dwSlotStatus = IFD_ICC_PRESENT;
goto end;
}
}
Modified: trunk/Drivers/ccid/src/ifdhandler.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/Drivers/ccid/src/ifdhandler.c?rev=2871&op=diff
==============================================================================
--- trunk/Drivers/ccid/src/ifdhandler.c (original)
+++ trunk/Drivers/ccid/src/ifdhandler.c Tue Apr 8 09:34:13 2008
@@ -954,6 +954,10 @@
if (CmdPowerOn(reader_index, &nlength, pcbuffer, PowerOnVoltage)
!= IFD_SUCCESS)
{
+ /* used by GemCore SIM PRO: no card is present */
+ get_ccid_descriptor(reader_index)->dwSlotStatus
+ = IFD_ICC_NOT_PRESENT;;
+
DEBUG_CRITICAL("PowerUp failed");
return_value = IFD_ERROR_POWER_ACTION;
goto end;
@@ -1183,6 +1187,12 @@
ccid_descriptor = get_ccid_descriptor(reader_index);
+ if (GEMCORESIMPRO == ccid_descriptor->readerID)
+ {
+ return_value = ccid_descriptor->dwSlotStatus;
+ goto end;
+ }
+
/* save the current read timeout computed from card capabilities */
oldReadTimeout = ccid_descriptor->readTimeout;
@@ -1287,6 +1297,7 @@
}
}
+end:
DEBUG_PERIODIC2("Card %s",
IFD_ICC_PRESENT == return_value ? "present" : "absent");
More information about the Pcsclite-cvs-commit
mailing list