Bug 205182

Summary: pcsc daemon wakes up once per second for NO REASON
Product: [Fedora] Fedora Reporter: Arjan van de Ven <arjan>
Component: pcsc-liteAssignee: Bob Relyea <rrelyea>
Status: CLOSED WONTFIX QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 9CC: ludovic.rousseau, pknirsch
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-07-14 14:28:25 EDT Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Bug Depends On:    
Bug Blocks: 204948, 418441    

Description Arjan van de Ven 2006-09-05 07:39:21 EDT
Description of problem:

The pcsc daemon wakes up once per second for no reason at all.
It has a 1 second select loop time out, but all it does on timeout is loop again.
Might as well use a much longer timeout, or infinite!
Comment 1 Ludovic Rousseau 2006-09-05 08:02:18 EDT
This mechanism is used to scan new USB devices and hotplug them.

A better way whould be to use udev to send a signal to pcscd or something similar. It is already possible 
to send a signal to pcscd so that it rescan its configuration for serial devices. This should be extended to 
USB devices as well. I note it in the TODO file for pcsc-lite. Thanks
Comment 2 Arjan van de Ven 2006-09-05 08:07:47 EDT
are you sure?
Can you look at the codepaths again; the ones that happen when the select times
out. As far as I can see the only thing that happens is just that the select
loop gets entered again...
Comment 3 Ludovic Rousseau 2006-09-05 12:50:36 EDT
We are both right in fact :-)

Two threads use a 1 second timeout:
- one SYS_Sleep(1) in hotplug_libusb.c to detect USB changes.
- one 1 second timeout select() in winscard_msg_srv.c

I think the select timeout can be removed since it is used to detect a Ctrl-C
but this signal already interrupt the select() syscall. I changed the code in
subversion. This change will be available in the next pcsc-lite version.
Comment 4 Arjan van de Ven 2006-09-09 06:58:10 EDT
Bob Relyea: would it be possible to pull this one fix into rawhide?
Thanks.
Comment 5 Ludovic Rousseau 2006-09-09 09:39:41 EDT
The patch is in
http://lists.alioth.debian.org/pipermail/pcsclite-cvs-commit/2006-September/002304.html

I have no idea when I will release a new version of pcsc-lite.
Comment 6 Bob Relyea 2006-09-18 16:25:47 EDT
Fixed in:
pcsc-lite-1.3.1-7
Comment 7 Arjan van de Ven 2007-02-06 03:05:13 EST
pcsc-lite-1.3.2-1 still wakes up once per second....
Comment 8 Ludovic Rousseau 2007-02-06 04:21:11 EST
Does it still wakes up if you have NO reader driver installed?

The CCID driver has been improved to use udev instead of a polling in pcscd. You
have to configure the CCID driver (libccid version 1.2.0 or later) using
--enable-udev

If you have a driver without the IFD_GENERATE_HOTPLUG feature (all drivers
except libccid AFAIK) then pcsd will poll the USB bus every 1 second.
Comment 9 Arjan van de Ven 2007-02-06 05:44:40 EST
I have no smartcard hardware whatsoever.. this is just standard fedora install...
Comment 10 Ludovic Rousseau 2007-02-06 07:14:06 EST
What is the output of "find /usr/lib/pcsc/"?
Comment 11 Arjan van de Ven 2007-02-06 07:15:21 EST
# find /usr/lib64/pcsc/
/usr/lib64/pcsc/
/usr/lib64/pcsc/drivers
/usr/lib64/pcsc/drivers/serial
/usr/lib64/pcsc/drivers/serial/libccidtwin.so.1.1.0
/usr/lib64/pcsc/drivers/ifd-egate.bundle
/usr/lib64/pcsc/drivers/ifd-egate.bundle/Contents
/usr/lib64/pcsc/drivers/ifd-egate.bundle/Contents/Linux
/usr/lib64/pcsc/drivers/ifd-egate.bundle/Contents/Linux/libifd_egate.so
/usr/lib64/pcsc/drivers/ifd-egate.bundle/Contents/Info.plist
/usr/lib64/pcsc/drivers/ifd-ccid.bundle
/usr/lib64/pcsc/drivers/ifd-ccid.bundle/Contents
/usr/lib64/pcsc/drivers/ifd-ccid.bundle/Contents/Linux
/usr/lib64/pcsc/drivers/ifd-ccid.bundle/Contents/Linux/libccid.so.1.1.0
/usr/lib64/pcsc/drivers/ifd-ccid.bundle/Contents/Info.plist
Comment 12 Ludovic Rousseau 2007-02-06 08:51:12 EST
The egate driver is installed and does not support IFD_GENERATE_HOTPLUG
The CCID driver 1.1.0 is too old and does not support IFD_GENERATE_HOTPLUG

-> remove the egate driver
-> install libccid 1.2.0 or later
Comment 13 Bob Relyea 2007-02-06 11:56:36 EST
So 2 things need to happen on my part: 
1) pick up ccid 1.2
2) add IFD_GENERATE_HOTPLUG to ifd-egate

I'll get on the first right away.

bob
Comment 14 Bob Relyea 2007-06-01 20:32:46 EDT
These changes where included in F-7.

ifd-egate-0.05-16
ccid-1.2.1-1

Comment 15 Song, Youquan 2008-03-02 22:23:37 EST
Fedora9 Alpha with kernel-2.6.24-2.fc9,
FC9 includes:
pcsc-lite-1.4.4-2.fc9
ifd-egate-0.05-19
ccid-1.2.1-3.fc8
I do not find the issue again.
Comment 16 Ludovic Rousseau 2008-03-03 02:50:24 EST
You will have wake ups again in two cases:
- you connect a smart card reader supported by the CCID driver (wake up every 400ms to check a card 
movement)
- you use a PC/SC application calling SCardGetStatusChange() (like pcsc_scan from pcsc-tools http://ludovic.rousseau.free.fr/softwares/pcsc-tools/index.html)

The first problem will be solved with libusb 1.0. 

The second problem is on my TODO list.

Note: the latest pcsc-lite upstream version is 1.4.99
Comment 17 Bug Zapper 2008-05-13 22:19:42 EDT
Changing version to '9' as part of upcoming Fedora 9 GA.
More information and reason for this action is here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Comment 18 Phil Knirsch 2009-04-07 07:31:15 EDT
According to the pcsc-lite changelog this has been fixed in pcsc-lite-1.4.100:

- add libhal support to avoid polling the USB bus.  libusb is still
  supported but libhal is now the default
- add support of TAG_IFD_POLLING_THREAD to use an asynchronous card
  movements detection instead of an active polling. The reader driver
  need to support TAG_IFD_POLLING_THREAD to use this feature

Can anyone with the necessary hardware verify if thats the case?

Thanks & regards, Phil
Comment 19 Ludovic Rousseau 2009-04-07 08:02:25 EDT
(In reply to comment #18)
> According to the pcsc-lite changelog this has been fixed in pcsc-lite-1.4.100:
> 
> - add libhal support to avoid polling the USB bus.  libusb is still
>   supported but libhal is now the default
> - add support of TAG_IFD_POLLING_THREAD to use an asynchronous card
>   movements detection instead of an active polling. The reader driver
>   need to support TAG_IFD_POLLING_THREAD to use this feature
> 
> Can anyone with the necessary hardware verify if thats the case?

You do not need any hardware to check the first point.

The second point is more problematic. The only driver that supports TAG_IFD_POLLING_THREAD is my CCID driver and this feature is not active by default. You have to configure the driver using --enable-usb-interrupt. And you also need to use a CCID reader that can support that.
Comment 20 Bug Zapper 2009-06-09 18:16:35 EDT
This message is a reminder that Fedora 9 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 9.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '9'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 9's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 9 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Comment 21 Bug Zapper 2009-07-14 14:28:25 EDT
Fedora 9 changed to end-of-life (EOL) status on 2009-07-10. Fedora 9 is 
no longer maintained, which means that it will not receive any further 
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of 
Fedora please feel free to reopen this bug against that version.

Thank you for reporting this bug and we are sorry it could not be fixed.