Skip to content

Commit

Permalink
COMPOSITE_AS_MULTISLOT : Add Kapelse readers
Browse files Browse the repository at this point in the history
  • Loading branch information
bmoraine committed Oct 20, 2023
1 parent cfa2953 commit 8743a58
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/ccid.h
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,10 @@ typedef struct
#define ACS_ACR1252 0x072F223B
#define ACS_ACR1252IMP 0x072F2259
#define ACS_ACR1552 0x072F2303
#define KAPELSE_KAPLIN2 0x29470105
#define KAPELSE_KAPECV 0x29470112

#define VENDOR_KAPELSE 0x2947
#define VENDOR_GEMALTO 0x08E6
#define GET_VENDOR(readerID) ((readerID >> 16) & 0xFFFF)

Expand Down
34 changes: 34 additions & 0 deletions src/ccid_usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,39 @@ status_t OpenUSBByName(unsigned int reader_index, /*@null@*/ char *device)
}
#endif

#ifdef USE_COMPOSITE_AS_MULTISLOT
if (VENDOR_KAPELSE == GET_VENDOR(readerID))
{
switch (readerID)
{
case KAPELSE_KAPECV :
/* KAP-eCV : only first interface is a ccid one */
max_interface_number=0;
DEBUG_INFO1("Kapelse reader forced as monoslot!");
break;

case KAPELSE_KAPLIN2 :
/* KAP&LINK2 : only 3 first interfaces are ccid ones */
if(config_desc->bNumInterfaces > 3)
{
max_interface_number=2;
DEBUG_INFO1("Kapelse reader restricted as multislot with 3 slots!");
}
else
{
max_interface_number=config_desc->bNumInterfaces-1;
DEBUG_INFO2("Kapelse reader forced as multislot with %d slots!",max_interface_number+1);
}
break;

default :
/* Kapelse : all interfaces are ccid ones */
max_interface_number=config_desc->bNumInterfaces-1;
DEBUG_INFO2("Kapelse reader forced as multislot with %d slots!",max_interface_number+1);
break;
}
}
#endif

usb_interface = get_ccid_usb_interface(config_desc, &num);
if (usb_interface == NULL)
Expand Down Expand Up @@ -723,6 +756,7 @@ status_t OpenUSBByName(unsigned int reader_index, /*@null@*/ char *device)
|| (ACS_ACR1252 == readerID)
|| (ACS_ACR1252IMP == readerID)
|| (ACS_ACR1552 == readerID)
|| (VENDOR_KAPELSE == GET_VENDOR(readerID))
|| (FEITIANR502DUAL == readerID))
{
/* use the next interface for the next "slot" */
Expand Down

0 comments on commit 8743a58

Please sign in to comment.