Comment 0 for bug 1061947

Revision history for this message
Bart (bart2pub) wrote :

Kernel : Linux 3.2.0-31-generic-pae (i686)
Distribution : Ubuntu 12.04.1 LTS
Desktop : XFCE 4
pcscd : 1.7.4-2ubuntu2

Information on how to start pcscd the right way is very limited. What I found out after digging in for some days ... : --help and man pcscd are not really helpful. After installing the packet, pcscd doesn't launch itself.

After a while I found out there is a script /etc/init.d/pcscd (not mentioned in man) that is supposed to start the daemon at startup, but it has a line 'exit 0' in it preventing it from running ..., and a comment that is not very helpful for an average Linux user. So I think ok, it doesn't need to run at startup. Let me try to start the daemon myself ...

And then troubles begin. It's damn easy to f*! it up: As I found out (and it took me a while, believe me...) running pcscd as simple user (not as root) hangs further well behaviour of the daemon. Only if you use it with the -x option, it will kill itself after 60s. Otherwise it just states it is already running but can't access a card reader.

So please, state clearly in man that you have to run pcscd as root to start it as a daemon ! Or, alternatively, make the timeout of 60 s the default so that you can get out of a blocking situation !

To check the good working of a card reader, pcsc_scan can be used. But also here, if you start it as a regular user and pcscd isn't launched yet, it launches the daemon for you, but hey, you are not root, so bingo, blocked again. Luckily, it seams to be launched with the -x option, so (only) after 60s you can try again, as root this time ... To make the whole a little more confusing, once the daemon is running, you can launch pcsc_scan as regular user without problem. But that's good, I think, after all, since it means (as far as I understand) that applications can get to the card reader without any augmented permissions.

So stays the question: how do I start the daemon the right way ? I haven't found out yet ...
I could use /etc/init.d/pcscd and comment out the 'exit 0'. But I fear the daemon will be very diligent to do its work, probing my machine for the heck of it (as I noted running sudo pcscd -x -d and watching syslog).

Ideally, the daemon would be started on startup, with the right permissions, but without it probing constantly for some reader. Then an application that wants to get access to a reader, could 'tickle' the daemon so it starts probing for some time, the application does its thing, and the daemon stops probing when not needed anymore.

If someone knows this is possible, or if there is another preferred scenario, I would be glad to hear about it ! Read also that a new version of pcscd will use another mean to start automatically, but it's not supported (yet?) on Ubuntu ?
Meanwhile, I hope this info can already help someone taming this one ...

Bart.

The technical stuff:

After boot (daemon not running) executing 'sudo pcsc_scan' -- it's working !
Information for reader is displayed. Even if after that (within 60s) I just run
'pcsc_scan', the information is displayed again.
syslog messages (had some logging enabled in my driver):
  Oct 4 16:31:22 BP-LIN pcscd: debuglog.c:269:DebugLogSetLevel() debug level=debug
  Oct 4 16:31:22 BP-LIN kernel: [ 3379.177470] OZSCRLX ozscr_open: called
  Oct 4 16:31:22 BP-LIN kernel: [ 3379.177489] OZSCRLX ozscr_ioctl: OZSCR_STATUS
  ...
  Oct 4 16:32:28 BP-LIN kernel: [ 3445.597205] OZSCRLX ozscr_ioctl: OZSCR_STATUS
  Oct 4 16:32:28 BP-LIN kernel: [ 3445.997318] OZSCRLX ozscr_ioctl: OZSCR_STATUS
  Oct 4 16:32:29 BP-LIN kernel: [ 3446.398025] OZSCRLX ozscr_close: called

Ok, now relaunching 'pcsc_scan' as regular user. The daemon just keeps waiting
for a reader, no information for the reader displayed.
syslog states:
  Oct 4 16:34:26 BP-LIN pcscd: dyn_unix.c:81:DYN_GetAddress() IFDHCreateChannelByName: /usr/local/o2micro/lib_OZSCR.so: undefined symbol: IFDHCreateChannelByName
  Oct 4 16:34:26 BP-LIN pcscd: readerfactory.c:965:RFInitializeReader() Open Port 0xF10000 Failed (/dev/o2scr0)
  Oct 4 16:34:26 BP-LIN pcscd: readerfactory.c:275:RFAddReader() O2Micro SmartCardBus Reader init failed.

Escaping and trying to run 'pcsc_scan' again. No luck ...
syslog states:
  Oct 4 16:36:38 BP-LIN pcscd: pcscdaemon.c:342:main() file /var/run/pcscd/pcscd.comm already exists.
  Oct 4 16:36:38 BP-LIN pcscd: pcscdaemon.c:344:main() Another pcscd (pid: 5208) seems to be running.