[Pcsclite-muscle] need to restart pcscd for USB after boot

Johannes Berg johannes at sipsolutions.net
Thu Aug 17 00:32:39 PDT 2023


On Wed, 2023-08-16 at 18:05 +0200, Ludovic Rousseau wrote:
> 
> "SCardConnect() Error Reader Exclusive" indicates that a program asked
> for a exclusive access to the reader.
> And another program tried to also use the same reader.
> The second program will receive an error and will not be able to use the reader.

Right. I think I got rid of that with the previous link, but the whole
behaviour persists as is.

> I would suggest to increase the log level of gpg and your other
> applications that use the smart card reader.
> I guess one of the application will complain.

I'm not sure that's the case, I don't see anything like that. See below,
I believe pcscd is connecting to the reader in both good and bad cases,
at least I see "Using the reader polling thread" and "Card ATR" log
messages etc.

Hey, I might very well be doing something completely stupid, and
honestly I've long forgotten how I even set this up.

But if I just stop pcscd, it gets restarted automatically by socket
activation when I actually try to use the key for ssh, and then it
actually works, so it's not that I don't need it at all and it's just
fighting for a key when other apps want to use it directly. So maybe I
should just always set it to socket activation ;-)


> > Which is kind of why I was wondering about how to enable the logging if
> > I cannot run the --foreground listed on the website; maybe just add
> > similar command line options to the systemd unit so it starts like that
> > on boot?
> 
> You can use the --debug argument.

Right, thanks. I hope this log didn't end up containing my password or
something, but if it does I guess I can just change it :)


I booted

Aug 17 09:12:21 machine systemd[1]: Started pcscd.service - PC/SC Smart Card Daemon.

logged in (I think this is something I have in my session connecting):

Aug 17 09:12:22 machine pcscd[2280]: 00605117 winscard_svc.c:340:ContextThread() Authorized PC/SC client

(here I also tried to use it for ssh a few times just to see what would
happen in the log)

and plugged in the yubikey

Aug 17 09:13:54 machine pcscd[2280]: 00292149 hotplug_libudev.c:647:HPEstablishUSBNotifications() USB Device add
...
Aug 17 09:13:54 machine pcscd[2280]: 00000005 ccid_usb.c:757:OpenUSBByName() bNumDataRatesSupported is 0
Aug 17 09:13:54 machine pcscd[2280]: 00017265 ifdhandler.c:389:IFDHGetCapabilities() tag: 0xFB3, usb:1050/0407:libudev:2:/dev/bus/usb/007/006 (lun: 0)
Aug 17 09:13:54 machine pcscd[2280]: 00000012 readerfactory.c:398:RFAddReader() Using the reader polling thread
Aug 17 09:13:54 machine pcscd[2280]: 00000256 ifdhandler.c:389:IFDHGetCapabilities() tag: 0xFAE, usb:1050/0407:libudev:2:/dev/bus/usb/007/006 (lun: 0)
Aug 17 09:13:54 machine pcscd[2280]: 00000007 ifdhandler.c:487:IFDHGetCapabilities() Reader supports 1 slot(s)
Aug 17 09:13:54 machine pcscd[2280]: 00000515 ifdhandler.c:1246:IFDHPowerICC() action: PowerUp, usb:1050/0407:libudev:2:/dev/bus/usb/007/006 (lun: 0)
Aug 17 09:13:54 machine pcscd[2280]: 00000269 eventhandler.c:289:EHStatusHandlerThread() powerState: POWER_STATE_POWERED
Aug 17 09:13:54 machine pcscd[2280]: 00000013 Card ATR: 3B F8 13 00 00 81 31 FE 15 59 75 62 69 6B 65 79 34 D4


but now it doesn't work, I tried a few times to use it for ssh login.

Then I restarted pcscd and basically the same things happen, except it
works?

Full log here:
https://p.sipsolutions.net/01897e99bf26357a.txt

Thanks,
johannes



More information about the pcsclite-muscle mailing list