Saturday, February 26, 2011

pcscd now uses libudev instead of libhal

pcsc-lite first started (in the previous century) when only serial readers were in use. The serial readers are configured using the /etc/reader.conf file. The problem is that the configuration is static and can't be used with a USB reader.

History of USB plug-n-play mechanism

To detect the insertion or removal of a USB reader different mechanisms have been used in the last 10 years.


hotplug_linux.c: introduced at least in (or before) version 1.0.2beta2 (20 Dec, 2001).

The problem is that the code is Linux specific.


hotplug_libusb.c: introduced in version 1.2.0-rc1 (26 August, 2003). From the changelog:
- src/hotplug_libusb.c: Add support of libusb. Allow to use USB readers on
*BSD or any plateform supported by libusb. Thanks to Toni Andjelkovic for
the great job.
The problem of libusb is that pcscd is constantly polling the USB bus to detect reader hotplug.


hotplug_libhal.c: introduced in version 1.4.100 (23 March 2008). From the changelog:

- add libhal support to avoid polling the USB bus.  libusb is still
  supported but libhal is now the default

The problem is that libhal has been deprecated upstream in May 2008 (2 months after pcscd started using it). Some distributions are actively migrating out of libhal. See Debian bug #587979
"pcscd: uses deprecated HAL" for example. And the wiki page "HALRemoval".


hotplug_libudev.c: introduced in version 1.6.8 (not yet released as of February 2011).

It looks like libudev is a good choice for the future. I don't know if it is supported by other systems than GNU/Linux. I removed the support of libhal but support of libusb is still present.

Mac OS X

Mac OS X has its own hotplug mechanism in hotplug_macosx.c. Apple maintains its own forked version of pcsc-lite. So I do not plan to change anything Mac OS X specific in pcsc-lite.


The hotplug mechanism is a fast moving target on GNU/Linux. I hope libudev will last at least a few months before I have to move to something else.

Flattr this