Smart card readers with udev

Recently Debian unstable finally dropped support for the old hotplug system in favour of udev. This has mostly worked fine and been an improvement, especially for my Cube which had been creaking under the strain of processing the lists of supported devices during startup. That now boots approximately twice as quickly as it did before.

The “mostly” because all my hardware is supported out of the box, including policy things like allowing me to access audio devices when I’m logged in. The one thing that didn’t work was my smart card reader – I’d manually configured hotplugging for that using the FSF Europe instructions. Fortunately, this was easily rectified by adding this:


BUS=="usb", ACTION=="add", SYSFS{idVendor}=="04e6", SYSFS{idProduct}=="e003", RUN+="/etc/hotplug/usb/gnupg-ccid"

to /etc/udev/rules.d/local.rules. This tells udev that if it sees a device with the given idVendor and idProduct tags in /sysfs then it should run /etc/hotplug/usb/gnupg-ccid. This script is the same one as was used for the old hotplug system – it’s a noddy thing which chmods and chowns the node so that I have read/write access to it – the path to the device is passed in as the enviroment variable DEVICE and the environment variable ACTION will be defined to “add” for addition. Untested lines for generic smart card readers and another SCR one based on the FSF site would be:


BUS=="usb", ACTION=="add", SYSFS{bDeviceClass}=="0x0B", RUN+="/etc/hotplug/usb/gnupg-ccid"
BUS=="usb", ACTION=="add", SYSFS{idVendor}=="04e6", SYSFS{idProduct}=="5115", RUN+="/etc/hotplug/usb/gnupg-ccid"

If that doesn’t work the relevant idVendor and idProduct tags can be figured out by running lsub with the device plugged in. In my case that says:

Bus 002 Device 010: ID 04e6:e003 SCM Microsystems, Inc. SPR532 PinPad SmartCard Reader

All very easy, as far as adding support for unsupported hardware goes.

One thought on “Smart card readers with udev

  1. Pingback: Technicalities

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.