How to signal smart card activity at the PC/SC level? Using D-Bus? HAL?

Stanislav Brabec sbrabec at
Thu Aug 27 08:14:56 PDT 2009

Ludovic Rousseau wrote:

> Someone asked for an applet that would indicate if a card activity is
> ongoing or not. The idea is to have the equivalent of a smart card
> reader blinking LED but in a gnome applet. The idea is nice. Some of
> my readers do not blink the LED when an APDU is exchanged so it is not
> easy to know if something is happening. In general I look at the pcscd
> debug logs but a Gnome applet would be nicer/more integrated.
> My question is: what mechanism to use to convey the information?
> I was thinking of using D-Bus and also provide other information like
> reader insertion/removal, card insertion/removal. And then card
> communication status.
> I need a one-way only event mechanism to signal events. Maybe D-Bus is
> too complex and HAL is the correct answer to my problem?
> Is D-Bus a good enough mechanism for that? Or should I use something
> else? Is HAL more appropriate?
> Any comment on this idea?

D-Bus is a good generic mechanism to transport signals from the daemon
(running as root) to user space and vice versa without providing access
permissions to the device node. For an uni-directional code you can use
minimalistic signalling code (based on dbus-send or similar utility).

In the applet you can use dbus-1-glib bindings to hide all complications
of the main event loop implementation.

D-Bus destination "org.debian.alioth.pcsclite" is your playground to
start with.

You can also signal the card activity, but DBus is not optimized for
high activity, so you probably may want to delay Inactivate signal a bit
to prevent sending Active/Inactive signals say thousands times per

> This may be related to the smart_card_reader HAL name space proposed
> (and accepted) in [2].

Technically, it is possible (and I was thinking about it) to extend HAL
with a new key that indicates card presence or a whole new UDI of
"SmartCard" category.

But [2] is one of the last new features accepted to hal before HAL
become deprecated, so you probably should not use HAL. If it will help
to you, you can use new technologies like libudev, DeviceKit or so.
If kernel creates no signal for card insertion/removal, you probably
don't want to use them.

As well as I remember the discussion on the opensc-list some time ago,
detection of smart card insert/removal require support in the hardware
or polling.

> [2]

Best Regards / S pozdravem,

Stanislav Brabec
software developer
SUSE LINUX, s. r. o.                          e-mail: sbrabec at
Lihovarská 1060/12           tel: +420 284 028 966, +49 911 740538747
190 00 Praha 9                                  fax: +420 284 028 951
Czech Republic                          

More information about the xdg mailing list