Card state synchronisation on SEC1210 reader 2 interfaces
The next CCID driver (version 1.6.3 not yet released) will contain a custom code to change the behavior of the Microchip SEC1210 reader.
SEC1210 reader
The Microchip SEC1210 smart card reader is a chip that you can integrate in your hardware projects.
A development board is available.

The board has 2 CCID interfaces that are seen as 2 CCID readers at the USB level (it is a composite device). See the USB descriptor:
idVendor: 0x0424 iManufacturer: SMSC idProduct: 0x1202 iProduct: SMSC USX101x Reader bcdDevice: 2.22 (firmware release?) bLength: 9 bDescriptorType: 4 bInterfaceNumber: 0 bAlternateSetting: 0 bNumEndpoints: 3 bulk-IN, bulk-OUT and Interrupt-IN bInterfaceClass: 0x0B [Chip Card Interface Device Class (CCID)] [...] idVendor: 0x0424 iManufacturer: SMSC idProduct: 0x1202 iProduct: SMSC USX101x Reader bcdDevice: 2.22 (firmware release?) bLength: 9 bDescriptorType: 4 bInterfaceNumber: 1 bAlternateSetting: 0 bNumEndpoints: 2 bulk-IN and bulk-OUT bInterfaceClass: 0x0B [Chip Card Interface Device Class (CCID)]
The 2 interfaces have the same descriptor, except for:
bInterfaceNumber: 0 or 1
bNumEndpoints: 2 or 3
One interface provides the Interrupt-IN endpoint while the other interface does not. This means one interface will provide card movements notification on the interrupt pipe while the other interface will not.
In fact the 2nd interface does not support
RDR_to_PC_NotifySlotChange
but also does not support card presence
using the CCID command PC_to_RDR_GetSlotStatus
. The reader will
always report a card is inserted even if no card is inserted.
This second interface is, in general, used with a SAM (Secure access module) that is rarely removed from the reader.
New use case
A user of this reader asked me to add the option of duplicating the card presence status of the 1st interface on the 2nd interface. The idea is to be able to insert or remove 2 cards from both interfaces at the same time.
The 2nd interface can then be used as a almost normal reader.
Custom code
The patch is visible at https://salsa.debian.org/rousseau/CCID/-/commit/4842c97561794acb7269dfcba21c877d42895a4e
The code is not active by default. You need to uncomment a line and rebuild the driver:
// Uncomment if you want to synchronize the card movements on the 2 // interfaces of the Microchip SEC 1210 reader // #define SEC1210_SYNC
The code is a bit complex, as each interface is managed by a different
pcsc-lite thread. The 2 threads are synchronized with a pthread_cond
and share some states.
Conclusion
The 2 interfaces of the Microchip SEC1210 smart card reader can be used mostly as normal interfaces. The (industrial) user is happy.
If you need custom development of the CCID driver and/or pcsc-lite, please don't hesitate to contact me. See About me.