Installation of Linux CCID driver For NFC Reader

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Installation of Linux CCID driver For NFC Reader

Installation of Linux CCID driver For NFC Reader

Recently, some NFC customer want to use CCID driver to communcate with NFC reader on Linux platform, but they encontered some errors during installing CCID driver for linux. I tested it and installed it to ubuntu 16.04 LTS successfully. Let me share complete steps with those users who want to devevlope NFC applications based on linux platform. If we want to use CCID driver on linux, we need to install these packages:

--libusb

--pcsc-lite

--ccid driver

--opensc

Before starting to install above packages, probably we need to install necessary dependency packages:

# sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev libc6-dev lib32ncurses5-dev

# sudo apt-get install x11proto-core-dev libx11-dev lib32readline-gplv2-dev lib32z1-dev

# sudo apt-get install libgl1-mesa-dev mingw32 tofrodos python-markdown libxml2-utils xsltproc uuid-dev:i386 liblzo2-dev:i386

# sudo apt-get install gcc-multilib g++-multilib

# sudo apt-get install subversion

# sudo apt-get install openssh-server openssh-client

# sudo apt-get install libudev-dev

# sudo apt-get install openssl 

# sudo apt-get install libssl-dev

1. libus installation

(1) Download it from : libusb

File name is libusb-1.0.9.tar.bz2

(2)Decompressing it

# tar jxvf libusb-1.0.9.tar.bz2

# cd ~/ccid/libusb-1.0.9
# ./configure
# make

pastedImage_15.png

# sudo make install

pastedImage_16.png

(3) test it

# lsusb

pastedImage_24.png

2. pcsc-lite installation

(1) Downloading pcsc-lite package: MUSCLE 

Filename is : pcsc-lite-1.8.22.tar.bz2 

(2) Decompressing it

# tar jxvf pcsc-lite-1.8.22.tar.bz2 

(3) compiling it

# cd pcsc-lite-1.8.22
# ./configure

pastedImage_29.png

pastedImage_30.png

# make

...

pastedImage_31.png

# sudo make install

...

pastedImage_32.png

3. CCID driver installation

(1) Downloading it from : Alioth: Muscle PCSC lite: Project Filelist 

file name is : ccid-1.4.27.tar.bz2

(2) Decompressing it

# tar jxvf ccid-1.4.27.tar.bz2

(3) Compiling it

# cd ccid-1.4.27
# ./configure

After runing configure command, information below will be displayed:

...

pastedImage_37.png

# make

...

pastedImage_38.png

# sudo make install

...

pastedImage_39.png

4. opensc installation

(1) Downloading it from : OpenSC - Browse /OpenSC/opensc-0.16.0 at SourceForge.net 

File name is : opensc-0.16.0.tar.gz

(2) Decompressing it

# tar zxvf cd opensc-0.16.0.tar.gz

(3)Compiling it

# cd opensc-0.16.0

# ./configure --enable-openssl --enable-pcsc

pastedImage_44.png

# make

pastedImage_45.png

# sudo make install

pastedImage_47.png

Up to now, above 4 software packages have been installed to ubuntu 16.04 LTS.

(4) Add library file path

   open /etc/ld.so.conf , and add one line at the end of the file :  include /usr/local/lib , save and exit, run 'sudo ldconfig -v' to update it.

# sudo gedit /etc/ld.so.conf 

# sudo sudo ldconfig -v

5. Add Vendor ID & Product ID to info.plist

We should add Vendor ID & Product ID of NFC reader to info.plist, the file is at the path : /usr/local/lib/pcsc/drivers/ifd-ccid.bundle/Contents/. For example , PN7462's vendor ID is 0x1FC9, and product ID is 0x0117.

[Note] This requires Firmware on NFC reader board should support USB CCID, if not, customer should replace it with firmware that supports USB CCID, for the purpose, customer can refer to UM10915.pdf(http://www.nxp.com/docs/en/user-guide/UM10915.pdf ) to do it.

TIC team Weidong Sun

Comments

Hello I tried instalation of PN7462 reader but don't work 

I have this error :

12280717 hotplug_libudev.c:651:HPEstablishUSBNotifications() USB Device add
00000084 hotplug_libudev.c:297:get_driver() Looking for a driver for VID: 0x1FC9, PID: 0x0117, path: /dev/bus/usb/003/029
00000007 hotplug_libudev.c:436:HPAddDevice() Adding USB device: PN7462 Card Reader
00000029 readerfactory.c:1074:RFInitializeReader() Attempting startup of PN7462 Card Reader (1.00) 00 00 using /usr/local/lib/pcsc/drivers/ifd-ccid.bundle/Contents/Linux/libccid.so
00000104 readerfactory.c:949:RFBindFunctions() Loading IFD Handler 3.0
00000016 ifdhandler.c:1965:init_driver() Driver version: 1.4.28
00000463 ifdhandler.c:1982:init_driver() LogLevel: 0x0003
00000005 ifdhandler.c:1993:init_driver() DriverOptions: 0x0000
00000144 ifdhandler.c:111:CreateChannelByNameOrChannel() Lun: 0, device: usb:1fc9/0117:libudev:0:/dev/bus/usb/003/029
00000011 ccid_usb.c:302:OpenUSBByName() Using: /usr/local/lib/pcsc/drivers/ifd-ccid.bundle/Contents/Info.plist
00000448 ccid_usb.c:320:OpenUSBByName() ifdManufacturerString: Ludovic Rousseau (ludovic.rousseau@free.fr)
00000004 ccid_usb.c:321:OpenUSBByName() ifdProductString: Generic CCID driver
00000002 ccid_usb.c:322:OpenUSBByName() Copyright: This driver is protected by terms of the GNU Lesser General Public License version 2.1, or (at your option) any later version.
00000529 ccid_usb.c:656:OpenUSBByName() Found Vendor/Product: 1FC9/0117 (PN7462 Card Reader)
00000004 ccid_usb.c:658:OpenUSBByName() Using USB bus/device: 3/29
00000002 ccid_usb.c:717:OpenUSBByName() bNumDataRatesSupported is 0
00067645 ccid_usb.c:849:WriteUSB() write failed (3/29): -99 LIBUSB_ERROR_OTHER
00000134 ccid_usb.c:849:WriteUSB() write failed (3/29): -99 LIBUSB_ERROR_OTHER
00000244 ccid_usb.c:888:ReadUSB() read failed (3/29): -99 LIBUSB_ERROR_OTHER
00000006 ifdhandler.c:195:CreateChannelByNameOrChannel() failed
00000023 ccid_usb.c:189:close_libusb_if_needed() libusb_exit
00000015 readerfactory.c:1105:RFInitializeReader() Open Port 0x200000 Failed (usb:1fc9/0117:libudev:0:/dev/bus/usb/003/029)
00000002 readerfactory.c:376:RFAddReader() PN7462 Card Reader (1.00) init failed.
00000003 readerfactory.c:609:RFRemoveReader() UnrefReader() count was: 1
00000003 readerfactory.c:1125:RFUnInitializeReader() Attempting shutdown of PN7462 Card Reader (1.00) 00 00.
00000004 readerfactory.c:986:RFUnloadReader() Unloading reader driver.
00000047 hotplug_libudev.c:523:HPAddDevice() Failed adding USB device: PN7462 Card Reader

What can i do ?

thanks in advance.

ND2

Hello @Wingros Sun

Can you please confirm is the installation instructions that you have provided will work for both contact as well as contactless? or is it just for contact interface?

Thanks

Neel.

Hello Nell Shah,

    Sorry, I forgot to give user's the procedure of validation, I tested it today again, see below, please!

---------------------------------------------------------------------------------------------------------------------------------

1. Run lsusb command.

weidong@ubuntu:~$ lsusb
Bus 002 Device 002: ID 0e0f:0003 VMware, Inc. Virtual Mouse
Bus 002 Device 003: ID 0e0f:0002 VMware, Inc. Virtual USB Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 004: ID 0e0f:0008 VMware, Inc.
Bus 002 Device 005: ID 1fc9:0117 NXP Semiconductors
weidong@ubuntu:~$

pastedImage_5.png

2. Open 2 terminals on Ubuntu desktop

(1) One is used to run "/usr/local/sbin/pcscd -adf"

weidong@ubuntu:~$ sudo /usr/local/sbin/pcscd -adf
[sudo] password for weidong:
00000000 pcscdaemon.c:345:main() pcscd set to foreground with debug send to stdout
00095256 configfile.l:361:DBGetReaderList() Parsing conf file: /usr/local/etc/reader.conf.d
00000062 pcscdaemon.c:658:main() pcsc-lite 1.8.22 daemon ready.
00020970 hotplug_libudev.c:297:get_driver() Looking for a driver for VID: 0x1D6B, PID: 0x0001, path: /dev/bus/usb/002/001
00000133 hotplug_libudev.c:297:get_driver() Looking for a driver for VID: 0x1D6B, PID: 0x0001, path: /dev/bus/usb/002/001
00000112 hotplug_libudev.c:297:get_driver() Looking for a driver for VID: 0x0E0F, PID: 0x0003, path: /dev/bus/usb/002/002
00000124 hotplug_libudev.c:297:get_driver() Looking for a driver for VID: 0x1D6B, PID: 0x0001, path: /dev/bus/usb/002/001
00000227 hotplug_libudev.c:297:get_driver() Looking for a driver for VID: 0x0E0F, PID: 0x0002, path: /dev/bus/usb/002/003
00000175 hotplug_libudev.c:297:get_driver() Looking for a driver for VID: 0x0E0F, PID: 0x0008, path: /dev/bus/usb/002/004
00000110 hotplug_libudev.c:297:get_driver() Looking for a driver for VID: 0x0E0F, PID: 0x0008, path: /dev/bus/usb/002/004
00000142 hotplug_libudev.c:297:get_driver() Looking for a driver for VID: 0x0E0F, PID: 0x0002, path: /dev/bus/usb/002/003
00000094 hotplug_libudev.c:297:get_driver() Looking for a driver for VID: 0x1FC9, PID: 0x0117, path: /dev/bus/usb/002/005
00000016 hotplug_libudev.c:436:HPAddDevice() Adding USB device: PN7462 USB Reader
00000048 readerfactory.c:1074:RFInitializeReader() Attempting startup of PN7462 USB Reader (1.00) 00 00 using /usr/local/lib/pcsc/drivers/ifd-ccid.bundle/Contents/Linux/libccid.so
00035459 readerfactory.c:949:RFBindFunctions() Loading IFD Handler 3.0
00000140 ifdhandler.c:1965:init_driver() Driver version: 1.4.27
00000452 ifdhandler.c:1982:init_driver() LogLevel: 0x0003
00000016 ifdhandler.c:1993:init_driver() DriverOptions: 0x0000
00000185 ifdhandler.c:111:CreateChannelByNameOrChannel() Lun: 0, device: usb:1fc9/0117:libudev:0:/dev/bus/usb/002/005
00000087 ccid_usb.c:302:OpenUSBByName() Using: /usr/local/lib/pcsc/drivers/ifd-ccid.bundle/Contents/Info.plist
00000387 ccid_usb.c:320:OpenUSBByName() ifdManufacturerString: Ludovic Rousseau (ludovic.rousseau@free.fr)
00000016 ccid_usb.c:321:OpenUSBByName() ifdProductString: Generic CCID driver
00000024 ccid_usb.c:322:OpenUSBByName() Copyright: This driver is protected by terms of the GNU Lesser General Public License version 2.1, or (at your option) any later version.
00000375 ccid_usb.c:656:OpenUSBByName() Found Vendor/Product: 1FC9/0117 (PN7462 USB Reader)
00000026 ccid_usb.c:658:OpenUSBByName() Using USB bus/device: 2/5
00000002 ccid_usb.c:717:OpenUSBByName() bNumDataRatesSupported is 0
00382852 ifdhandler.c:382:IFDHGetCapabilities() tag: 0xFB3, usb:1fc9/0117:libudev:0:/dev/bus/usb/002/005 (lun: 0)
00000024 readerfactory.c:396:RFAddReader() Using the reader polling thread
00003700 ifdhandler.c:382:IFDHGetCapabilities() tag: 0xFAE, usb:1fc9/0117:libudev:0:/dev/bus/usb/002/005 (lun: 0)
00000008 ifdhandler.c:477:IFDHGetCapabilities() Reader supports 1 slot(s)
00000178 hotplug_libudev.c:297:get_driver() Looking for a driver for VID: 0x0E0F, PID: 0x0002, path: /dev/bus/usb/002/003
00000212 hotplug_libudev.c:297:get_driver() Looking for a driver for VID: 0x1D6B, PID: 0x0002, path: /dev/bus/usb/001/001
00000090 readerfactory.c:1409:RFWaitForReaderInit() Waiting init for reader: PN7462 USB Reader (1.00) 00 00

pastedImage_9.png

(2) The other is used to run "testpcsc " in pcsc-lite/src source code

weidong@ubuntu:~/ccid/pcsc-lite-1.8.22/src$ ./testpcsc

MUSCLE PC/SC Lite unitary test Program

THIS PROGRAM IS NOT DESIGNED AS A TESTING TOOL FOR END USERS!
Do NOT use it unless you really know what you do.

Testing SCardEstablishContext    : Command successful.
Testing SCardIsValidContext    : Command successful.
Testing SCardIsValidContext    : Invalid handle. (don't panic)
Testing SCardListReaderGroups    : Command successful.
Group 01: SCard$DefaultReaders
Testing SCardFreeMemory        : Command successful.
Testing SCardListReaders    : Command successful.
Testing SCardListReaders    : Command successful.
Reader 01: PN7462 USB Reader (1.00) 00 00

pastedImage_10.png

[Note] if you are using vmware player on your windows PC, don't forget to connect PN7462 board to ubuntu, see below, please!

pastedImage_11.png

Have a nice day!

Best Regards,

Weidong

Hello Neel,

       The firmware for PN7462 DEMO BOARD must be released version,  not debug version.

Have a nice day!

Best regards,

weidong

ND2

Hi Wingros,

Are you used the phExCCID example code for the PN7462AU?

Can you please share exactly the firmware file you are using? Did you modify the firmware file for running it on the Linux environment?

We are NOT able to see the PN7462AU in the lsusb command. I can send you a screenshot if you'd like.

At the same time we are able to see the ACR contact reader there.

Neel.

P.S. Will the same instructions work for a UNIX operating system as well? Do you have any idea about that?

ND2

pastedImage_1.jpg

Hi Wingros,

The USB card reader has been connected. It has a SAM inserted as well as a DESFire card on the antenna.

Not sure why the SCardListReaders is saying: "Cannot find a smart card reader."

Please suggest.

Neel.

Hi, Neel,

     You shoud follow steps introduced in UM10915.pdf, compile source code with released mode , then download it to demo board.

Best Regards,

Weidong

ND2

We know what is released mode Wingros.

Our board has the release mode firmware as suggested in the UM10915.pdf

Not sure still why the driver for the USB is not getting picked up by the OS.

Neel.

--

Regards

Neel Shah.

That is right! Please check 3.6 Release mode setup in UM10915 as well.


Have a great day,
Kan

No ratings
Version history
Last update:
‎07-13-2017 10:55 PM
Updated by: