1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01:00

Support the Cherry ST-2000 card reader.

* scd/ccid-driver.c (SCM_SCR331, SCM_SCR331DI, SCM_SCR335)
(SCM_SCR3320, SCM_SPR532, CHERRY_ST2000): New constants.
(parse_ccid_descriptor): Use them.
(scan_or_find_usb_device, ccid_transceive_secure): Handle Cherry
ST-2000.  Suggested by Matthias-Christian Ott.

Conflicts:

	scd/ccid-driver.c
This commit is contained in:
Werner Koch 2011-12-02 18:09:58 +01:00 committed by NIIBE Yutaka
parent dafa7aa621
commit 08178d1e13
2 changed files with 28 additions and 12 deletions

1
THANKS
View File

@ -165,6 +165,7 @@ Martin Schulte schulte at thp.uni-koeln.de
Matt Kraai kraai at alumni.carnegiemellon.edu Matt Kraai kraai at alumni.carnegiemellon.edu
Matthew Skala mskala at ansuz.sooke.bc.ca Matthew Skala mskala at ansuz.sooke.bc.ca
Matthew Wilcox matthew at wil.cx Matthew Wilcox matthew at wil.cx
Matthias-Christian Ott ott at mirix.org
Matthias Urlichs smurf at noris.de Matthias Urlichs smurf at noris.de
Max Valianskiy maxcom at maxcom.ml.org Max Valianskiy maxcom at maxcom.ml.org
Michael Engels michael.engels at uni-duesseldorf.de Michael Engels michael.engels at uni-duesseldorf.de

View File

@ -209,9 +209,19 @@ enum {
VENDOR_SCM = 0x04e6, VENDOR_SCM = 0x04e6,
VENDOR_OMNIKEY= 0x076b, VENDOR_OMNIKEY= 0x076b,
VENDOR_GEMPC = 0x08e6, VENDOR_GEMPC = 0x08e6,
VENDOR_KAAN = 0x0d46 VENDOR_KAAN = 0x0d46,
VENDOR_FSIJ = 0x234B
}; };
/* Some product ids. */
#define SCM_SCR331 0xe001
#define SCM_SCR331DI 0x5111
#define SCM_SCR335 0x5115
#define SCM_SCR3320 0x5117
#define SCM_SPR532 0xe003
#define CHERRY_ST2000 0x003e
/* A list and a table with special transport descriptions. */ /* A list and a table with special transport descriptions. */
enum { enum {
TRANSPORT_USB = 0, /* Standard USB transport. */ TRANSPORT_USB = 0, /* Standard USB transport. */
@ -951,12 +961,12 @@ parse_ccid_descriptor (ccid_driver_t handle,
*/ */
if (handle->id_vendor == VENDOR_SCM if (handle->id_vendor == VENDOR_SCM
&& handle->max_ifsd > 48 && handle->max_ifsd > 48
&& ( (handle->id_product == 0xe001 && handle->bcd_device < 0x0516) && ( (handle->id_product == SCM_SCR331 && handle->bcd_device < 0x0516)
||(handle->id_product == 0x5111 && handle->bcd_device < 0x0620) ||(handle->id_product == SCM_SCR331DI && handle->bcd_device < 0x0620)
||(handle->id_product == 0x5115 && handle->bcd_device < 0x0514) ||(handle->id_product == SCM_SCR335 && handle->bcd_device < 0x0514)
||(handle->id_product == 0xe003 && handle->bcd_device < 0x0504) ||(handle->id_product == SCM_SPR532 && handle->bcd_device < 0x0504)
||(handle->id_product == 0x5117 && handle->bcd_device < 0x0522) ||(handle->id_product == SCM_SCR3320 && handle->bcd_device < 0x0522)
)) ))
{ {
DEBUGOUT ("enabling workaround for buggy SCM readers\n"); DEBUGOUT ("enabling workaround for buggy SCM readers\n");
@ -1136,16 +1146,20 @@ scan_or_find_usb_device (int scan_mode,
{ {
ifcdesc = (interface->altsetting + set_no); ifcdesc = (interface->altsetting + set_no);
/* The second condition is for older SCM SPR 532 who did /* The second condition is for older SCM SPR 532 who did
not know about the assigned CCID class. Instead of not know about the assigned CCID class. The third
trying to interpret the strings we simply check the condition does the same for a Cherry SmartTerminal
product ID. */ ST-2000. Instead of trying to interpret the strings
we simply check the product ID. */
if (ifcdesc && ifcdesc->extra if (ifcdesc && ifcdesc->extra
&& ((ifcdesc->bInterfaceClass == 11 && ((ifcdesc->bInterfaceClass == 11
&& ifcdesc->bInterfaceSubClass == 0 && ifcdesc->bInterfaceSubClass == 0
&& ifcdesc->bInterfaceProtocol == 0) && ifcdesc->bInterfaceProtocol == 0)
|| (ifcdesc->bInterfaceClass == 255 || (ifcdesc->bInterfaceClass == 255
&& dev->descriptor.idVendor == VENDOR_SCM && dev->descriptor.idVendor == VENDOR_SCM
&& dev->descriptor.idProduct == 0xe003))) && dev->descriptor.idProduct == SCM_SPR532)
|| (ifcdesc->bInterfaceClass == 255
&& dev->descriptor.idVendor == VENDOR_CHERRY
&& dev->descriptor.idProduct == CHERRY_ST2000)))
{ {
idev = usb_open (dev); idev = usb_open (dev);
if (!idev) if (!idev)
@ -3080,7 +3094,8 @@ ccid_transceive_secure (ccid_driver_t handle,
Lc byte to the APDU. It seems that it will be replaced with Lc byte to the APDU. It seems that it will be replaced with
the actual length instead of being appended before the APDU the actual length instead of being appended before the APDU
is send to the card. */ is send to the card. */
cherry_mode = 1; if (handle->id_product != CHERRY_ST2000)
cherry_mode = 1;
break; break;
default: default:
return CCID_DRIVER_ERR_NOT_SUPPORTED; return CCID_DRIVER_ERR_NOT_SUPPORTED;