PCSC-Lite for PC/SC Readers On Raspberry Pi With Linux

PC/SC is short for “Personal Computers/Smart Card “. It’s a specification to facilitate integration of smart cards into computer environments. PC/SC Readers has a good support on Windows, as Microsoft lead a good reference implementation built on it. Linux and Mac need to use the open source pcsc-lite package.

MUTEK PC/SC readers are compliant with standards PC/SC and CCID. And thanks to PCSC-Lite CCID driver, these products are usable on non-Windows operating systems like Linux/Unix/Mac OS X.

This guide is about the testing and deployment of MUTEK PC/SC readers on Linux. This guide is done on a Raspberry Pi Raspbian release with a PT3901 PC/SC reader and will be similar for other PC/SC Readers and Linux releases.

Preparation

  1. Install PC/SC-Lite and PCSC Tools on Raspberry Pi(Raspbian).

sudo apt-get install libusb-dev libusb++
sudo apt-get install libccid
sudo apt-get install pcscd
sudo apt-get install libpcsclite1
sudo apt-get install libpcsclite-dev
sudo apt-get install libpcsc-perl
sudo apt-get install pcsc-tools
sudo apt-get update
Optional

  1. Update PC/SC Info.plist (Important!)
    1. PCSC-Lite Info.plist file stores all verified PC/SC readers.
    2. Readers from MUTEK or small vendors is not included in Info.plist, so vid/pid and reader description should be appended manually. This is the most ignoble
    3. Firstly plug the reader to the USB port and:
      1. lsusb to list all connected usb devices. MUTEK readers usually starts with 4143(vid) with a PID name(3901, 3500 etc.).
      2. sudo find / -name Info.plist to find out the location of the Info.plist, which may be as /usr/local/lib/pcsc/drivers/ifd-ccid.bundle/Contents/Info.plist. File position may vary for different Linux/Unix releases.
      3. Edit the Info.plist and add the vid/pid/description under the respected key arrays, structure as in quoted text.
    4. Reboot!

<key>ifdVendorID</key>
  <array>
      …
      <string>0x4143</string>
  </array>
<key>ifdProductID</key> 
  <array>
      …
      <string>0x3901</string>
  </array>
 <key>ifdFriendlyName</key>
  <array>
      …
      <string>MUTEK PT3901-2 PCSC Reader</string>
  </array>

Info.plist with respective elements added to the end of each array. ifdVendorID and ifdProductID must follow the reader information from lsusb. ifdFriendlyName can be whatever strings you like.

Testing

Now you can start testing the PC/SC reader plugged. Two major commands are applied:

  1. pcsc_scan to list all readers and update reader status when card is inserted or removed.
  2. scriptor to operate card reader and transmit APDU commands.