OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
[Muscle] reducing polling inside pcsc-lite (libusb issue)

From: Ludovic Rousseau (ludovic.rousseaugmail.com)
Date: Thu Feb 14 2008 - 10:27:40 CST


Hello,

Up to now pcscd is polling the card driver every 400ms
(PCSCLITE_STATUS_POLL_RATE) to detect a card movement. This will wake
up the CPU constantly and consume power.

Many CCID readers (but not all) can use an asynchronous message to
send a card movement event to the host. This is supported in the CCID
driver [1] version 1.3.3 with support of TAG_IFD_POLLING_THREAD.
You need to use a snapshot of pcsc-lite [2] to use this feature.

My problem is that the libusb function usb_interrupt_read() is not
efficient and will poll using a 1ms timeout.
So instead of a polling every 400ms by pcscd we have a polling every
1ms by libusb. The situation is worse regarding CPU usage :-(

The problem in libusb has been discovered thanks to powertop [3] and
be corrected in the subversion revision 657 [4] of
/trunk/libusb/linux.c [5]. I backported the patch (attached) for
libusb 0.1.12.
But I have no idea when a new stable version of libusb (with the
correction) will be available.

So what should I do?
I plan to disable TAG_IFD_POLLING_THREAD in the CCID driver by default
and allow a way to activate it using the driver Info.plist file.
Other ideas? proposals? comments?

libusb 0.1.x will not evolve much. libusb 1.0 [6] is on its way and is
in competition with OpenUSB [7]. libusb 1.0 or OpenUSB have no stable
release yet.

Regards,

[1] http://pcsclite.alioth.debian.org/ccid.html
[2] http://ludovic.rousseau.free.fr/softwares/pcsc-lite/
[3] http://www.lesswatts.org/projects/powertop/
[4] http://libusb.svn.sourceforge.net/viewvc/libusb/trunk/libusb/linux.c?r1=597&r2=657
[5] http://libusb.svn.sourceforge.net/viewvc/libusb/trunk/libusb/linux.c?view=log
|6] http://libusb.wiki.sourceforge.net/Libusb1.0
[7] http://openusb.sourceforge.net/

--
 Dr. Ludovic Rousseau

_______________________________________________
Muscle mailing list
Musclelists.musclecard.com
http://lists.drizzle.com/mailman/listinfo/muscle