AN1962 SEC1110/SEC1210 Linux Setup
Total Page:16
File Type:pdf, Size:1020Kb
AN1962 SEC1110/SEC1210 Linux Setup Author: VishnuPriya Padmanabhan Microchip Technology Inc. INTRODUCTION This document explains the installation of SEC1110/SEC1210 CCID reader in Linux on different platforms. Smartcard reader installation under Linux x86 The below described setup was done using Fedora 14 with kernel version 2.6.35.6-45 REQUIRED LIBRARIES The following libraries are prerequisite to install a USB smartcard reader under Linux x86. 1. libusb 1.0.8 2. pcsc-tools 3. libpcsc-lite 4. libccid Following are the dependencies for the installation of above libraries: 1. gnu gcc,make 2. libudev 3. libtool 4. perl-Gtk2 LIBUSB-1.0.8 Obtain the libusb package from sourceforge.net/projects/libusb/ % tar xvjf libusb-1.0.8.tar.bz2 % cd libusb-1.0.8 %su #As ROOT perform % ./configure % make % make install Note 1: There is a limitation in using Microchip’s Dual Slot Reader with libusb where the slot with card always pres- ent is not accessible or simply stated, the second interface of the reader is not accessible. The limitation is not noticed when tested with pcsclite-1.7.4 compiled using libudev enabled and libusb disabled. 2: The author has added support for libudev since pcsclite -1.6.8, while removing libhal. http://ludovicrous- seau.blogspot.com/2011/02/pcscd-now-uses-libudev-instead-of.html LIBUDEV-DEV In case of a Fedora system Install libudev development files as: %yum install libudev-devel Or in case of Ubuntu, use: %sudo apt-get install libudev-dev 2015 Microchip Technology Inc. DS00001962A-page 1 AN1962 PCSC-LITE Obtain tar file for the pcsc-lite version 1.7.4 from https://alioth.debian.org/frs/?group_id=30105 % tar xvjf pcsc-lite-1.7.4.tar.bz2 % cd pcsc-lite-1.7.4 %su #As ROOT perform % ./configure –enable-libusb –disable-libudev --enable-debugatr % make % make install In case of following with section 2.1.3 use below configuration: % ./configure –enable-libudev –disable-libusb --enable-debugatr % make % make install PCSC-TOOLS Obtain tar file for pcsc-tools from http://ludovic.rousseau.free.fr/softwares/pcsc-tools/ % tar xvf pcsc-tools-1.4.17.tar.gz % cd pcsc-tools-1.4.17 %su #As ROOT perform % ./configure % make % make install CCID FREE SOFTWARE DRIVER Obtain a copy of the free driver ccid-1.4.4.tar.bz2 from http://pcsclite.alioth.debian.org/ccid.html % tar xvjf ccid-1.4.4.tar.bz2 % cd ccid-1.4.4 % cd readers Here is present a file “supported_readers.txt” containing the list of supported readers. Microchip's smart card reader SEC1110/SEC1210 needs to be added to this list along with its VID and PID. Add the following at the end of the “sup- ported_readers.txt” for Microchip device to be detected as smartcard reader. For Single Slot device # SMSC 0x0424:0x1011:SEC1x10 SmartCard Reader For Dual Slot device # SMSC 0x0424:0x1200:SEC1x10 Dual Slot SmartCard Reader Where 0x0424 Stands for Microchip’s VID and following value corresponds to the PID of the Device. Now as ROOT do: % ./configure % make % make install PERL-GTK2 This dependency will be required to run the tools obtained using pcsc-tools. In Fedora use: %su %yum install perl-Gtk2 OTHER DEPENDENCIES For other dependency library installation follow the general steps % tar xvf library.tar.gz Or: % tar xvjf library.tar.bz2 % cd library DS00001962A-page 2 2015 Microchip Technology Inc. AN1962 As ROOT perform: % ./configure % make % make install OPENSC OpenSC is a tool that can be used to list the smartcard readers installed in a system. This tool can be installed manually as: % tar xvf opensc-0.12.0.tar.gz % cd opensc-0.12.0 %su #As ROOT perform % ./configure % make % make install Note: A possible issue while running OpenSC after manual installation would be with accessing libpcsclite.so.In that case, follow the solution mentioned in OpenSC website http://www.opensc-project.org/opensc/wiki/ FrequentlyAskedQuestions SMART CARD READER INSTALLATION UNDER ARM PLATFORM To Setup the SmartCard Reader on an embedded ARM platform we will be using a HOST Linux PC to Cross Compile the required libraries and then copy the compiled libraries and resources to the ARM device. In this Setup: HOST DEVICE:Ubuntu Linux 11.04 TARGET DEVICE: OpenRD Tasman System Required Libraries and Tools Create a directory to copy the libraries required for the cross compilation Toolchain. % cd /home/smsc/Desktop/ % mkdir toolchain Obtain the source tar bals for the libraries from their online repositories 1. libusb-1.0.8.tar.bz2 2. pcsc-lite 1.7.4.tar.bz2 3. ccid-1.4.4.tar.bz2 Copy these source files to our toolchain directory (/home/smsc/Desktop/toolchain/) from the place of Download. Copy OpenRD’s gcc compiler for their ARM platform from the given media to the toolchain directory % cp /home/openrd/openrd-tasman-devkit-v1.0/openrd-tasman_host_swsupportpackage/linux/gcc.tar.bz2 /home/smsc/Desktop/toolchain/ % cd /home/smsc/Desktop/toolchain/ % tar -xjvf /home/smsc/Desktop/toolchain/gcc.tar.bz2 Add this gcc location to the PATH environment variable % export PATH=/home/smsc/Desktop/toolchain/gcc/bin:$PATH Now Set the compiler variables to utilize the OpenRD compiler. % export CC=arm-none-linux-gnueabi-gcc AR= arm-none-linux-gnueabi -ar LD= arm-none-linux-gnueabi - ld STRIP= arm-none-linux-gnueabi-strip The above variables CC, AR, LD, STRIP and the corresponding names will be present as executables in the declared PATH variable. Extract Libraries Libusb,Pcsclite,Ccid Create a Separate Directory to install the cross-compiled toolchain. % mkdir –p /home/smsc/Desktop/Target % cd /home/smsc/Desktop/Target 2015 Microchip Technology Inc. DS00001962A-page 3 AN1962 LIBUSB-1.0.8 Obtain the libusb package from sourceforge.net/projects/libusb/ % tar xvjf libusb-1.0.8.tar.bz2 % cd libusb-1.0.8 %./configure --host=arm-none-linux-gnueabi --prefix=/usr % make %su #As ROOT perform % make install prefix=/home/smsc/Desktop/Target/ Now just make sure that the compiled library files support the ARM platform and not the host architecture i.e X86 Cd =/home/smsc/Desktop/Target/lib/ File lib* The command output should show that the file is supported for ARM. PCSC-LITE % tar xvjf pcsc-lite-1.7.4.tar.bz2 % cd pcsc-lite-1.7.4 % ./configure --host=arm-none-linux-gnueabi --prefix=/usr –enable-libusb –disable-libudev -- enable-debugatr PKG_CONFIG_PATH==/home/smsc/Desktop/toolchain/OpenRD/lib/pkg-config LIBUSB_CFLAGS=-I/home/smsc/Desktop/Target/include/libusb-1.0/ LIBUSB_LIBS=/home/smsc/Desktop/ Target/lib/libusb-1.0.so % make % make install prefix=/home/smsc/Desktop/Target/ Check the compatibility for ARM as done before. CCID FREE SOFTWARE DRIVER Obtain a copy of the free driver ccid-1.4.4.tar.bz2 from http://pcsclite.alioth.debian.org/ccid.html % tar xvjf ccid-1.4.4.tar.bz2 % cd ccid-1.4.4 % cd readers Here is present a file “supported_readers.txt” containing the list of supported readers. Microchip's smart card reader SEC1x10 needs to be added to this list along with its VID and PID. Add the following at the end of the “supported_read- ers.txt” for Microchip device to be detected as smartcard reader. # SMSC 0x0424:0x1011:SEC1x10 SmartCard Reader 0x0424:0x1200:SEC1x10 Dual Slot SmartCard Reader Where 0x0424 Stands for Microchip’s VID and following value corresponds to the PID of the Device. %cd /home/smsc/Desktop/toolchain/ccid-1.4.4 % ./configure --host=arm-none-linux-gnueabi –prefix=/usr PCSC_CFLAGS=-I/home/smsc/Desktop/ Target/include/PCSC/ LIBUSB_CFLAGS=-I/home/smsc/Desktop/Target/include/libusb-1.0/ LIBUSB_LIBS=/ home/smsc/Desktop/Target/lib/libusb-1.0.so --enable-usbdropdir=/home/smsc/Desktop/Target/lib/ drivers PCSC_LIBS=/home/smsc/Desktop/Target/lib/libpcsclite.so.1.0.0 //(Kindly check NOTE: in section2.3 method1) % make % make install prefix=/home/smsc/Desktop/Target/ Check the compatibility for ARM as done before. Also check for the driver file at /home/smsc/Desktop/Target//lib/driv- ers/ifd-ccid.bundle/Contents/Linux/libccid.so Copying the Installed Libraries to the ARM Device: The Directory used as prefix in the library configuration will now hold the following cross-compiled Resources: /home/smsc/Desktop/Target/lib /home/smsc/Desktop/Target/include /home/smsc/Desktop/Target/sbin /home/smsc/Desktop/Target/share The contents of these directories now need to be copied to their corresponding directories in the ARM device as follows: DS00001962A-page 4 2015 Microchip Technology Inc. AN1962 /usr/include /usr/lib /usr/share /usr/sbin To copy the compiled libraries from the host to OpenRD, two methods can be followed: Method 1: Tar the folder containing the libraries in the host and copy to the OpenRD using a USB storage device and untar the file To create a tar file of the location /home/smsc/Desktop/Target type: %tar cvjf tools.bzip2 /home/smsc/Desktop/Target %cp –f /home/smsc/Desktop/Target/tools.bzip2 /media/pendrive Move the pendrive to the OpenRD system and mount it. %cp –f /media/pendrive/tools.bzip2 /home/openrd/Desktop %cd /home/openrd/Desktop %tar xvjf tools.bzip2 %cd Target %cp –fr include/ /usr/ %cp –fr /lib/usr/ %cp –fr /sbin /usr/ The current method of setup requires a copy of the driver “libccid.so” to be copied in the same directory structure as in the host. So Create the below directory: %mkdir -p /home/smsc/Desktop/Target/lib/pcsc/drivers/ifd-ccid.bundle/Contents/Linux/ Now make a copy of the libccid.so file created in section3.2.3 to the new directory Note: This can be overcome while cross-compiling ccid-1.4.4, by changing the flag --enable-usbdropdir=/usr/lib/pcsc/drivers/ifd-ccid.bundle/Contents/Linux/ and copy the libccid.so to the OpenRD Method 2: If tar is not possible, simply copy the directory: /home/smsc/Desktop/Target While doing so an error like “the filesystem does not support copying symbolic links”, may be posted if the pendrive is in FAT filesystem.