Saturday, June 25, 2011

Happy birthday: 10 years with pcsc-lite

10 years ago

I started working on pcsc-lite 10 years ago.

$ pcscd --version
pcsc-lite version 1.7.4.
Copyright (C) 1999-2002 by David Corcoran <>.
Copyright (C) 2001-2011 by Ludovic Rousseau <>.
Copyright (C) 2003-2004 by Damien Sauveron <>.
Report bugs to <>.
Enabled features: MacOS i386-apple-darwin10.8.0 serial usb usbdropdir=/tmp/lib/pcsc/drivers ipcdir=/tmp/run/pcscd configdir=/tmp/etc/reader.conf.d

I do not have a trace of my exact first change in 2001. Maybe it was before CVS was used to manage the source code. The oldest trace I found is in the ChangeLog file:

pcsc-lite-1.0.2beta: (Ludovic Rousseau)
29 Nov, 2001

I released version 1.0.2beta in November 2001. But I started hacking on the code a few months before that.

First source code commit

My first CVS commit is a test :-) now know under SVN revision number 23.
2002-04-04  Ludovic Rousseau
    * [r23] ChangeLog: test

My next change (revision 24) is a "complete and automatic reindentation of *.c and *.h files". 54 files were affected by this patch. Yes, I do not like to work on badly formatted files.

My history

I already blogged about pcsc-lite history in October 2010 in Subversion statistics for pcsc-lite at September 2010. You can also access a specific page for each maintainer. My page is here.

One nice graphic is the activity by hour. You can clearly find the two lunch times and sleep time.

Next 10 years


The PC/SC API is (should be) fixed by the PC/SC workgroup. But Microsoft does not want to change anything in its implementation. So the PC/SC workgroup does not propose any change that would need a modification of the Microsoft parts. Any change made by the PC/SC workgroup are implemented by drivers instead.

So I do not expect any change of the WinSCard API.


The pcsc-lite TODO list contains only 3 points.
  1. include Apple patches and improvements (if possible/needed)
  2. allow to have pcscd and libpcsclite on two different machines.
    That would be needed to support remote PAM login. Maybe use unix2tcp (
  3. manage power suspend/resume (in a laptop for example) and coordinate with the driver (when/if possible)
Point 1: Apple has its own version of pcsc-lite, now hosted on I don't think Apple is interested in merging their code with the "official" pcsc-lite version.

Point 2: It is more of less already possible by redirecting /var/run/pcscd/pcscd.comm (see PC/SC client and server on two different hosts). Or using another remote desktop solution like rdesktop.

Point 3: I do not have a laptop any more. So I have no idea of what is needed here. The only request I have is Debian bug #382282 "pcscd needs to be restarted across suspend" opened since Aug 2006.

New blood?

I do not see any new blood on the MUSCLE mailing list working on pcsc-lite code. The pcsc-lite project may suffer from the bus factor.


I am happy to continue maintaining pcsc-lite for the next few years. Maybe I will also create a new blog entry for my 20 years with pcsc-lite.

Flattr this

Thursday, June 23, 2011

New version of pcsc-lite: 1.7.4

I just released new version of pcsc-lite 1.7.4 just 1 day after version 1.7.3.

pcsc-lite-1.7.4: Ludovic Rousseau
23 June 2011
  • Fix a stupid bug from the previous version. T=1 cards were not working.

Trying to fix compiler warnings is a good idea but should be made with extreme care, especially just before a release. I got caught by fixing "warning: variable `TCi' set but not used" the wrong way.

Flattr this

Wednesday, June 22, 2011

New version of pcsc-lite: 1.7.3

I just released new version of pcsc-lite 1.7.3.

pcsc-lite-1.7.3: Ludovic Rousseau
22 June 2011
  • COPYING: Add my name as copyright holder
  • hotplug libudev: support libudev >= 171
  • hotplug libusb: Fix a memory leak
  • pcscd: exit immediately in case of SIGTERM
    Closes Debian bug #620305 "pcscd slows down shutdown/restart"
  • Send logs to stdout instead of stderr
    It is now possible to use tee(1) to redirect logs in a file without first redirecting stderr to stdout
  • Add command line option -T, --color: force use of colored logs
    The idea is to have colored logs even if they are redirected to a file or a pipe.
  • Define g_rgSCardT?Pci as const structures to be more Windows like
    I do not expect a regression or compilation problem in WinSCard API users but how knows...
  • log at level PCSC_LOG_DEBUG instead of PCSC_LOG_ERROR to avoid filling the system log file
  • Remove the deprecated define FEATURE_MCT_READERDIRECT (replaced by FEATURE_MCT_READER_DIRECT)
  • better Hurd support
  • some other minor improvements and bug corrections

Flattr this

Friday, June 17, 2011

SCardGetAttrib by pcsc-lite


An application may need to know specific values from a smart card reader/driver. It is the job of the SCardGetAttrib() function at the PC/SC level. The list of possible questions is:

The PC/SC call SCardGetAttrib is implemented by redirecting the question to the reader driver IFDHGetCapabilities() method.

My CCID driver implements some of them.


The case of SCARD_ATTR_DEVICE_FRIENDLY_NAME is different. The driver does not know the reader name used at the PC/SC level. The name is chosen by pcsc-lite, not by the driver. See also a previous blog article: What is in a PC/SC reader name?.

So what pcsc-lite does is first ask the driver about SCARD_ATTR_DEVICE_FRIENDLY_NAME, and if the driver returns the error IFD_ERROR_TAG then pcsc-lite will answer itself with the name pcsc-lite selected.

_A and _W variants

pcsc-lite does not support UNICODE or ASCII modes. On Unix Unicode is encoded as UTF-8 instead of UTF-16 as on Windows. Since UTF-8 includes ASCII you do not need to differentiate two configurations.


Remote desktop in mixed environment

Remote desktop solutions using RDP (Remote Desktop Protocol) like rdesktop or ICA (Independent Computing Architecture) like Citrix XenApp can also do remote smart card operation.
If the smart card reader is connected on a Unix system using pcsc-lite and the application is on a Windows system the remoting system must do some "translation" work. In particular if the application on the windows side ask for SCARD_ATTR_DEVICE_FRIENDLY_NAME_A the remote application must translate the question into SCARD_ATTR_DEVICE_FRIENDLY_NAME and convert it back to the correct encoding.

Different feature levels

An application designed and tested on Windows may be surprised by PC/SC answers when run through rdesktop or Citrix XenApp. In that case the answers from the PC/SC layer comes from pcsc-lite and not from the Windows winscard library. Some services may not be supported like SCARD_ATTR_DEVICE_FRIENDLY_NAME on Mac OS X but expected by the application.

The Windows application designers should keep in mind that the PC/SC layer they are talking to may not be the one provided by Windows. It can be a PC/SC layer running on GNU/Linux, Mac OS X, Solaris or some other even more bizarre Unixes.


An application may run inside a virtual machine. So the hardware seen by the application is not real.
A Windows application may run inside Wine. So the Windows is not a Microsoft one.
A Windows application may talk to a remote PC/SC layer with different features.

Flattr this