Bug 737988 - pcsc-lite auto power down patch not applied
Summary: pcsc-lite auto power down patch not applied
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: pcsc-lite
Version: 15
Hardware: All
OS: Linux
unspecified
low
Target Milestone: ---
Assignee: Kalev Lember
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-09-13 14:58 UTC by Manuel Bejarano
Modified: 2011-10-16 00:55 UTC (History)
4 users (show)

Fixed In Version: pcsc-lite-1.7.4-6.fc16
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-10-16 00:55:25 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
pcsc-lite debug log (118.15 KB, text/plain)
2011-09-29 22:48 UTC, Manuel Bejarano
no flags Details

Description Manuel Bejarano 2011-09-13 14:58:32 UTC
Description of problem:

Patch that disble the auto power down / suspend feature introduced in recent versions of pcsc-lite is not applied since there is a line missing in the spec file.

As a result, some readers (ARC122 in my case) are not powered on properly when a command is executed, what causes readers to hang. In order to bring it back to a working state, the reader must be unplugged and plugged back again a couple of times until it starts working.

Version-Release number of selected component (if applicable):
pcsc-lite-1.7.2-3.fc15

How reproducible:
yum install pcsc-lite pcsc-lite-ccid pcsc-lite-devel libusb libusb1 libnfc libnfc-devel libnfc-examples

Steps to Reproduce:
1. Make sure pcscd is running
2. Plug the reader
3. Execute 'nfc-list' or your favorite tool.
  
Actual results:
Reader's LED blinks as it is suspended and the commands outputs "NFC reader not found". Sometimes the reader works properly but it is not stable since you could perform a couple of good reads but sooner or later it hangs, and it does quite often.

Expected results:
nfc-list regular output.

Additional info:
Same behaviour observed in Fedora 16 Alpha.

Comment 1 Kalev Lember 2011-09-15 21:06:40 UTC
Thanks for the report!

This is indeed an oversight and there is a missing %patch line in the spec file. I'm preparing a new build for F15 with the patch correctly applied; please let me know if it fixes the issue for you.

Comment 2 Fedora Update System 2011-09-15 21:14:07 UTC
pcsc-lite-1.7.2-4.fc15 has been submitted as an update for Fedora 15.
https://admin.fedoraproject.org/updates/pcsc-lite-1.7.2-4.fc15

Comment 3 Manuel Bejarano 2011-09-16 08:45:30 UTC
Tested and update is working perfectly for the mentioned reader. The reader is powered properly since it is plugged to the USB port and it behaves OK when any command is issued.

Thanks Kalev!

Comment 4 Kalev Lember 2011-09-16 12:35:41 UTC
Dr. Ludovic Rousseau,

Do you have any idea what might be causing the ARC122 power up problems described here and what it would take to solve them without having to define DISABLE_ON_DEMAND_POWER_ON? cicloide said he tested with the pcsc-lite 1.7.4 and ccid 1.4.4 that are Fedora 16 Alpha, so the issue is likely to be present in latest upstream code too.

http://pkgs.fedoraproject.org/gitweb/?p=pcsc-lite.git;a=blob;f=pcsc-lite-1.6.6-no_auto_power_down;h=324642c537e4d702c2e3ada0a804f3e0cee15f1b;hb=f15

Comment 5 Ludovic Rousseau 2011-09-18 15:00:51 UTC
Manuel,

Can you generate a log trace as explained at http://pcsclite.alioth.debian.org/ccid.html#support with a pcscd exhibiting the problem?

Comment 6 Fedora Update System 2011-09-29 22:02:50 UTC
pcsc-lite-1.7.4-5.fc16 has been submitted as an update for Fedora 16.
https://admin.fedoraproject.org/updates/FEDORA-2011-12812

Comment 7 Manuel Bejarano 2011-09-29 22:47:26 UTC
Hi Ludovic,

Here it is a log generated as described. The steps I made were the following:

1. Connect the reader.
2. Run the daemon.
3. Run the following command to read a Mifare 1k with default keys.

--------------------------------

$ nfc-mfclassic r a test.mfd
Connected to NFC reader: ACS ACR 38U-CCID 00 00 / ACR122U102 - PN532 v1.4 (0x07)
Found MIFARE Classic 1k card with UID: XXXXXXXX
Reading out 64 blocks |.....

-->>> 30 SECONDS TO 1 MINUTE WITH NO ACTIVITY <<<--

Reading out 64 blocks |................|
Done, 64 of 64 blocks read.

---------------------------------

This command should not take more than one second to execute. Usually, it works as it is supossed to but lately it is more frequent this (these) delay(s) or input/output errors thrown by the applications accessing the reader.

It could be caused by the firmware or even by libnfc but I had not experiment such problems with previous versions of pcsc-lite, pcsc-lite-ccid or libnfc. I can try to generate different logs where it's common to get I/O errors when trying to write a mifare card or using 'nfc-list', 'lsnfc' or 'nfc-anticol'.

If you need more testing, let me know.

Comment 8 Manuel Bejarano 2011-09-29 22:48:42 UTC
Created attachment 525655 [details]
pcsc-lite debug log

Comment 9 Ludovic Rousseau 2011-09-30 07:19:51 UTC
Manuel, I do not see any problem with card power auto power down.
It looks like you have not generated the logs as I wanted so I do not have the timing information :-(

If the problem is a 60 seconds delay you may suffer from a "famous" libusb bug. See http://ludovicrousseau.blogspot.com/2011/05/new-version-of-libusb-part-2.html

Please update libusb and try again.

Comment 10 Manuel Bejarano 2011-09-30 09:05:48 UTC
Hi Ludovic,

You are right, the version that I'm running has been patched in order to disable the reader to auto power down so I guess, that's why there is no useful information in the logs about it since the feature has been disabled.

Thanks for pointing the bug in libusb since I think that's exactly what is causing the problems ;) Regarding the log, I generated it as pointed in your webpage:

# LIBCCID_ifdLogLevel=0x000F pcscd --foreground --debug --apdu

If you need me to test something different, please let me know how in order for you to see the timming information.

And finally, libusb1 has been updated in the development realease of Fedora 16:

https://admin.fedoraproject.org/updates/FEDORA-2011-12847?_csrf_token=bb7da529f916c15eeb043600e1ababd64debcf29

But, there is no updates for Fedora 15 so my question is, should we ask the maintainer to create a package for F15 or should I compile it and try by myself? Since F15 is maintained for a while after F16 realease, I think it should be better if there is one package around to fix this issue.

Comment 11 Kalev Lember 2011-09-30 09:23:04 UTC
Manuel, in the very first comment you said "Same behaviour observed in Fedora 16 Alpha.". This led me to believe it can't be that libusb issue, because F16 has updated libusb. Maybe you are running into two different bugs?

Comment 12 Manuel Bejarano 2011-09-30 09:44:05 UTC
Hi Kalev,

This behaviour was observed before the patch to disable auto power down was applied so I think that maybe there is another bug as you said. I'm going to try again against F16 alpha or the last F16 Beta RC and I will post here the logs.

Comment 13 Fedora Update System 2011-09-30 19:47:24 UTC
pcsc-lite-1.7.4-5.fc16 has been pushed to the Fedora 16 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 14 Fedora Update System 2011-10-01 01:56:06 UTC
pcsc-lite-1.7.2-4.fc15 has been pushed to the Fedora 15 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 15 Ludovic Rousseau 2011-10-01 07:14:50 UTC
Does Fedora provides a patched/fixed version of libusb?

How to know what version of libusb is provided in F16? (without installing Fedora of course :-)

Comment 16 Manuel Bejarano 2011-10-01 12:51:52 UTC
Yep, here it is:

https://admin.fedoraproject.org/updates/search/libusb1?_csrf_token=f9be9694fbc44d375f42c82c0f9393d86b164f35

http://koji.fedoraproject.org/koji/packageinfo?packageID=6233

Latest version is libusb1-1.0.9-0.3.rc1.fc16 and 1.0.9 has this patch applied.

Cheers.

Comment 17 Manuel Bejarano 2011-10-07 15:33:54 UTC
Hi,

I've tested pcsc-lite in the last Fedora 16 Beta release. This is the list of packaged installed:

libusb1-1.0.9-0.3.rc1.fc16.x86_64
pcsc-lite-1.7.4-5.fc16.x86_64
pcsc-lite-libs-1.7.4-5.fc16.x86_64
pcsc-lite-ccid-1.4.4-1.fc16.x86_64
libnfc-1.4.2-1.fc16.x86_64
libnfc-examples-1.4.2-1.fc16.x86_64

I made some extensive testing using some nfc tools provided by libnfc-examples plus some others written by myself and I can confirm that everything works flawlessly so it makes me think that everything was caused by libusb and not by the fact that the auto power down patch was not applied in pcsc-lite.

Anyway, it would be great if we can notify the libusb1 maintainer in order to make a package for F15 since the actual version in the repositories is causing major anoyance :)

Comment 18 Kalev Lember 2011-10-07 15:48:11 UTC
I'm very glad to hear that everything is working for you. Your testing is really good to have and helps ensure the upcoming F16 release is of high quality.


(In reply to comment #17)
> pcsc-lite-1.7.4-5.fc16.x86_64
> pcsc-lite-libs-1.7.4-5.fc16.x86_64
[...]
> everything works flawlessly so it makes me think that everything was
> caused by libusb and not by the fact that the auto power down patch was
> not applied in pcsc-lite.

The release -5 of pcsc-lite you tested with actually has the auto power down disabling patch applied; -4 was without it.

pcsc-lite-1.7.4-5.fc16:
http://koji.fedoraproject.org/koji/buildinfo?buildID=263854

pcsc-lite-1.7.4-4.fc16:
http://koji.fedoraproject.org/koji/buildinfo?buildID=261873


> Anyway, it would be great if we can notify the libusb1 maintainer in order
> to make a package for F15 since the actual version in the repositories is
> causing major anoyance :)

Probably better to wait until libusb 1.0.9 final release is out.

Comment 19 Manuel Bejarano 2011-10-07 16:01:28 UTC
Hi Kalev,

You are right, it's better to wait but I think we should notify the package maintainer about this issue in order to know if he plans to make a F15 release for those that won't update. I don't know how to put him in CC (jwrdegoede in FAS).

Comment 20 Kalev Lember 2011-10-08 10:56:23 UTC
Manuel, any chance you'd be willing to do some more testing and try the _older_ pcsc-lite-1.7.4-4.fc16 on F16 Beta? I know this is a lot to ask, but I'd like to be sure that we can safely remove the auto power down disabling patch.

Comment 21 Kalev Lember 2011-10-08 11:28:33 UTC
Adding Hans de Goede to CC.

Hans, do you think it would be possible to update libusb1 in F15 once 1.0.9 is out? Or is it too risky?

Comment 22 Hans de Goede 2011-10-08 11:49:26 UTC
(In reply to comment #21)
> Adding Hans de Goede to CC.
> 
> Hans, do you think it would be possible to update libusb1 in F15 once 1.0.9 is
> out? Or is it too risky?

Thanks for adding me to the CC, so 2 things. First of all the 60 seconds timeout bug was not fixed in upstream git until very recently (I know that quite well as I pushed the fix), so F-16 alpha and even F-16 beta, don't have it, they both have: libusb1-1.0.9-0.2.git212ca37c.fc16, which is a git snapshot of my private libusb1 tree, which comes down to upstream's testing branch + some patches I needed for spice's usbredirection I've been working on. This snapshot does *not* have the fix for the 60 seconds hang.

Recently upstream did a 1.0.9-rc1 release (and later an rc3 with no interesting fixes for the linux / core parts), this does have the 60 seconds fix and is available for Fedora as:
libusb1-1.0.9-0.3.rc1.fc16

This in the main F16 repository now, but not part of the beta compose, still if you install the beta and then do a yum update you should get it. At which time you could test pcsc-lite + ccid without the patch disabling the power management.

I'll go talk to libusb1 upstream and see how close a 1.0.9 release is. I definetely plan to also do a 1.0.9 update for F-15 as it contains tons of bugfixes. I might even do a libusb1-1.0.9-0.3.rc1.fc15 before that if 1.0.9 is still far away, but I expect it to be released any day now.

Comment 23 Manuel Bejarano 2011-10-10 16:28:13 UTC
Hello,

I made the test under F16 Beta with pcsc-lite-1.7.4-4.fc16 that has the power management patch disabled and everything works fine with the latest version of libusb found in the fedora repositories (pcsc-lite-1.7.4-4.fc16).

So my conclusion is that pcs-lite does not need to apply this patch anymore, at it was before I opened this ticket but, until F15 does not get a libusb update that fixes the "60 seconds" bug, it's much better to apply the patch to disable the power management since together with libusb bug was causing too many problems.

These are the packages I used this time:

libusb1-1.0.9-0.3.rc1.fc16.x86_64
-->> pcsc-lite-1.7.4-4.fc16.x86_64
-->> pcsc-lite-libs-1.7.4-4.fc16.x86_64
pcsc-lite-ccid-1.4.4-1.fc16.x86_64
libnfc-1.4.2-1.fc16.x86_64
libnfc-examples-1.4.2-1.fc16.x86_64

Comment 24 Kalev Lember 2011-10-10 16:41:10 UTC
Perfect, thanks for testing. I'll remove the patch in F16 and submit a new update.

Comment 25 Fedora Update System 2011-10-10 17:08:20 UTC
pcsc-lite-1.7.4-6.fc16 has been submitted as an update for Fedora 16.
https://admin.fedoraproject.org/updates/pcsc-lite-1.7.4-6.fc16

Comment 26 Fedora Update System 2011-10-11 02:58:56 UTC
Package pcsc-lite-1.7.4-6.fc16:
* should fix your issue,
* was pushed to the Fedora 16 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing pcsc-lite-1.7.4-6.fc16'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2011-14111
then log in and leave karma (feedback).

Comment 27 Fedora Update System 2011-10-16 00:55:25 UTC
pcsc-lite-1.7.4-6.fc16 has been pushed to the Fedora 16 stable repository.  If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.