Alcor Micro AU9540 keeps powering down when card is present

Bug #1307109 reported by Jonathan Davies
28
This bug affects 5 people
Affects Status Importance Assigned to Milestone
pcsc-lite (Ubuntu)
Confirmed
High
Unassigned

Bug Description

I have smart card reader built-into this laptop, however, whenever I insert a card - it'll read it for a few seconds, then the USB connection to the reader gets powered down and thus the card disappears in the systems eyes.

After a few seconds, it comes back and everything's happy.

Then the cycle repeats again and again and again.

ProblemType: Bug
DistroRelease: Ubuntu 14.04
Package: linux-image-3.13.0-23-generic 3.13.0-23.45 [modified: boot/vmlinuz-3.13.0-23-generic]
ProcVersionSignature: Ubuntu 3.13.0-23.45-generic 3.13.8
Uname: Linux 3.13.0-23-generic x86_64
ApportVersion: 2.14.1-0ubuntu1
Architecture: amd64
AudioDevicesInUse:
 USER PID ACCESS COMMAND
 /dev/snd/controlC1: jpds 3933 F.... pulseaudio
 /dev/snd/controlC0: jpds 3933 F.... pulseaudio
CurrentDesktop: Unity
Date: Sun Apr 6 18:37:24 2014
HibernationDevice: RESUME=UUID=05490d4c-6800-46a1-b5ba-8b32bdc57e89
InstallationDate: Installed on 2014-04-06 (0 days ago)
InstallationMedia: Ubuntu 14.04 LTS "Trusty Tahr" - Daily amd64 (20140406)
MachineType: Hewlett-Packard HP EliteBook Folio 1040 G1
ProcFB: 0 inteldrmfb
ProcKernelCmdLine: BOOT_IMAGE=/vmlinuz-3.13.0-23-generic.efi.signed root=/dev/mapper/ubuntu--vg-root ro quiet splash vt.handoff=7
RelatedPackageVersions:
 linux-restricted-modules-3.13.0-23-generic N/A
 linux-backports-modules-3.13.0-23-generic N/A
 linux-firmware 1.127
SourcePackage: linux
UpgradeStatus: No upgrade log present (probably fresh install)
dmi.bios.date: 02/09/2014
dmi.bios.vendor: Hewlett-Packard
dmi.bios.version: L83 Ver. 01.05
dmi.board.name: 213E
dmi.board.vendor: Hewlett-Packard
dmi.board.version: KBC Version 24.2A
dmi.chassis.type: 10
dmi.chassis.vendor: Hewlett-Packard
dmi.modalias: dmi:bvnHewlett-Packard:bvrL83Ver.01.05:bd02/09/2014:svnHewlett-Packard:pnHPEliteBookFolio1040G1:pvrA3009DD18303:rvnHewlett-Packard:rn213E:rvrKBCVersion24.2A:cvnHewlett-Packard:ct10:cvr:
dmi.product.name: HP EliteBook Folio 1040 G1
dmi.product.version: A3009DD18303
dmi.sys.vendor: Hewlett-Packard

Revision history for this message
Jonathan Davies (jpds) wrote :
Revision history for this message
Jonathan Davies (jpds) wrote :
description: updated
description: updated
Revision history for this message
Jonathan Davies (jpds) wrote :
Revision history for this message
Brad Figg (brad-figg) wrote : Status changed to Confirmed

This change was made by a bot.

Changed in linux (Ubuntu):
status: New → Confirmed
Jonathan Davies (jpds)
summary: - Alcor Micro AU9540 keeps powering down when card is inserted
+ Alcor Micro AU9540 keeps powering down when card is present
Revision history for this message
Jonathan Davies (jpds) wrote :
Revision history for this message
Chris J Arges (arges) wrote :

The dmesg corresponding to device removal and power on was related to a BIOS option that does "Power on if card is present" vs "Always powered on". If the BIOS option is switched to "Always powered on" these messages are not present.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in pcsc-lite (Ubuntu):
status: New → Confirmed
Revision history for this message
Jonathan Davies (jpds) wrote :

I ran 'opensc-tool' three times while running this debug.

Revision history for this message
Chris J Arges (arges) wrote :

For context I found the following thread which looked related:
http://ludovicrousseau.blogspot.fr/2010/10/card-auto-power-on-and-off.html

From bug 1161882. So I built the following packages with DISABLE_ON_DEMAND_POWER_ON defined:
http://people.canonical.com/~arges/lp1307404/

This also failed.

Revision history for this message
Jonathan Davies (jpds) wrote :

I ran 'opensc-tool' three times during this debug run. First two times, it reported that there was a card in the system; third 'No'.

Revision history for this message
Jonathan Davies (jpds) wrote :
Chris J Arges (arges)
Changed in pcsc-lite (Ubuntu):
importance: Undecided → High
Revision history for this message
Chris J Arges (arges) wrote :

An example of a non-working log:
http://pastebin.ubuntu.com/7250315/

An example of a working log:
http://pastebin.ubuntu.com/7250304/

The main differences I see start after here in the log:
00000003 winscard.c:261:SCardConnect() Attempting Connect to Alcor Micro AU9540 00 00 using protocol: 3
00000002 readerfactory.c:771:RFReaderInfo() RefReader() count was: 1

Revision history for this message
Ludovic Rousseau (ludovic-rousseau-gmail) wrote :

Why does powering down a present card is a problem?

A problem would be if the reader reports no card inserted when a card is inserted. Is that what happens?

Revision history for this message
Jonathan Davies (jpds) wrote :

Ludovic: That is exactly what happens. I'm not touching the card and as shown in comment #3, it keeps appearing and disappearing.

Revision history for this message
Ludovic Rousseau (ludovic-rousseau-gmail) wrote :

Please generates a pcscd log as in #2 but without starting any application. Just insert a smart card and wait.

Revision history for this message
Jonathan Davies (jpds) wrote :
Revision history for this message
Jonathan Davies (jpds) wrote :

That output above is what happens without touching the card or running an application - it just sits there with Card present, as soon as I do something like 'opensc-tool -l' - the card is "absent" and then it eventually loops back to present.

Revision history for this message
Ludovic Rousseau (ludovic-rousseau-gmail) wrote :

The readers report card present and then card absent. The driver can't do much to know this is not correct and must trust the reader.

I will try to find a Alcor Micro AU9540 reader and to tests. But it looks like it is a reader bug.

Revision history for this message
Jonathan Davies (jpds) wrote :

It comes built-into the HP EliteBook Folio 1040 G1, otherwise, I'm happy to do any tests on my laptop.

Changed in linux (Ubuntu):
importance: Undecided → High
tags: added: kernel-da-key
Revision history for this message
Ludovic Rousseau (ludovic-rousseau-gmail) wrote :

Maybe you can find a reader firmware update from Alcor Micro or HP.

Revision history for this message
Jonathan Davies (jpds) wrote :

This is a brand new laptop and HP appear to have shipped it with their latest firmware.

Revision history for this message
Jonathan Davies (jpds) wrote :
Revision history for this message
Jonathan Davies (jpds) wrote :
Revision history for this message
Jonathan Davies (jpds) wrote :
Revision history for this message
Jonathan Davies (jpds) wrote :

OK, in comments #22 and #23, we have outputs with ccid compiled with the patch to add some more debug in #24.

Comment #22 features a working Lenovo laptop.

Comment #23 features the HP laptop.

For some reason, the HP laptop hits the IFDHICCPresence() function's CCID_ICC_PRESENT_INACTIVE case and drops to the else statement, while this doesn't happen on the Lenovo.

Revision history for this message
Ludovic Rousseau (ludovic-rousseau-gmail) wrote :

What is strange is the response RDR_to_PC_SlotStatus (first byte 81h) when a card is present and powered.
The normal CCID frame should be:
81 00 00 00 00 00 xx _00_ 00 00
00 is: An ICC is present and active (power is on and stable, RST is inactive)

But in the case of the HP we have:
81 00 00 00 00 00 xx _01_ 00 01
01 is: An ICC is present and inactive (not activated or shut down by hardware error)
The last 01 is: Clock stopped in state L

Something (the reader? the BIOS?) decided to stop the reader clock.

I need more information about your Alcor Micro reader.
Please follow http://pcsclite.alioth.debian.org/ccid.html#CCID_compliant

Revision history for this message
Jonathan Davies (jpds) wrote :
Jonathan Davies (jpds)
description: updated
Revision history for this message
Ludovic Rousseau (ludovic-rousseau-gmail) wrote :

Your reader firmware is newer than the one I have at http://pcsclite.alioth.debian.org/ccid/readers/AU9540.txt

I confirm the reader firmware is bogus according to the output.txt you attached in #27.
  bNumDataRatesSupported: 138
   IFD does not support GET_DATA_RATES request: Resource temporarily unavailable

You should get a list of 138 values, not an error.

Revision history for this message
Chris J Arges (arges) wrote :

So I see that get_data_rates is returning an error, are there alternative Control USB bytes we need to send? Or do we think this failure is because of something else (reader clock being stopped.)

Revision history for this message
Ludovic Rousseau (ludovic-rousseau-gmail) wrote :

It may be possible to make the driver work with this reader.
I am not sure how to come back from the state "An ICC is present and inactive". Without such a reader at hand it will be hard to debug the driver.
Maybe you can offer me a "Hewlett-Packard HP EliteBook Folio 1040 G1"? :-)

Kip Warner (kip)
Changed in linux (Ubuntu):
assignee: nobody → Kip Warner (kip)
Changed in pcsc-lite (Ubuntu):
assignee: nobody → Kip Warner (kip)
Chris J Arges (arges)
no longer affects: linux (Ubuntu)
Dave Chiluk (chiluk)
Changed in pcsc-lite (Ubuntu):
assignee: Kip Warner (kip) → Dariusz Gadomski (dgadomski)
assignee: Dariusz Gadomski (dgadomski) → nobody
Revision history for this message
Chris McDonough (chrism-plope) wrote :

I have the same problem, using pcscd 1.8.14-1ubuntu1.16.04.1 on an IBM Thinkpad P50, which has the same card reader.

However, interestingly, it only happens when I use a Feitian/Entersafe A22CR card. I tried two of them with the same result, so it's not a flaky card either.

When I use a PIVKey C910 card, it does not "flap" like it does with the entersafe card. The PIVKey card works fine in the reader.

Revision history for this message
Chris McDonough (chrism-plope) wrote :

I'll also note that the A22CR card works fine (does not exhibit the flapping behavior) in an external Feitian reader.

Interestingly, the A22CR card + Alcor combibation doesn't "flap" under Windows either when running opensc-tool in a loop. Just under Linux.

Revision history for this message
Chris McDonough (chrism-plope) wrote :

Similar output of ccid conformance as James' from a few years back.

Revision history for this message
Chris McDonough (chrism-plope) wrote :

Another data point: an Aventra MyEID PKI card (http://www.aventra.fi/webshop/index.php?route=product/product&product_id=53 ; it's apparently a "version 4", on the invoice it's identified as SKU: MYEID and MPN: TH#130) works fine in this Alcor reader under OpenSC on Ubuntu. The only card that has this flapping problem with this reader under Linux so far is the Feitian/Entersafe A22CR, and again, the A22CR+Alcor combo doesn't flap the same way under Windows.

Revision history for this message
Ray (raymonster) wrote :

I personally couldn't waste anymore time troubleshooting this problem.

Ensure you are using a Smartcard Reader that is compatible with the CCID (Chip/Smart Card Interface Devices) and ICCD (Integrated Circuit(s) Card Devices) driver.

Supported CCID readers/ICCD tokens: https://ccid.apdu.fr/ccid/supported.html

Here are some Smart Card Readers that were intermittently working in Linux:
[ray@ThinkPad ~]$ lsusb
Bus 005 Device 021: ID 0bda:0165 Realtek Semiconductor Corp. Smart Card Reader Interface
Bus 003 Device 003: ID 058f:9540 Alcor Micro Corp. AU9540 Smartcard Reader

The Realtek Semiconductor Corp. Smart Card Reader Interface (0bda:0165) is actually a Stanley Global SGT111 Smart Card Reader.
The Alcor Micro Corp. AU9540 Smartcard Reader (058f:9540) is a smart card reader that I added when I bought my Lenovo ThinkPad T14 (not knowing that it had compatibility issues with Linux).

After running pcsc_scan, I could see the both of the above card readers fluctuate between:
Card state: Card removed AND Card state: Card inserted. This would cause my VMware Horizon Client to randomly disconnect from Desktop Anywhere (very annoying).

Here are the Smart Card Readers that I ended up buying on Amazon and eBay because they are fully supported by the CCID driver:

SCM Microsystems Inc. SCR 3310 USB Smart Card Reader: https://ccid.apdu.fr/ccid/supported.html#0x04E60x5116

CHERRY SmartTerminal ST-1144: https://ccid.apdu.fr/ccid/supported.html#0x046A0x002D
(Features: “One-hand operation“ possible due to heavy weight and stable base.)

[ray@ThinkPad ~]$ lsusb
Bus 005 Device 020: ID 04e6:5116 SCM Microsystems, Inc. SCR331-LC1 / SCR3310 SmartCard Reader
Bus 005 Device 022: ID 046a:002d Cherry GmbH SmartTerminal XX44

I haven't had any issues with the using the above supported Card Readers. I use the CHERRY SmartTerminal ST-1144 when I'm at my desk, and the Identiv SCR3310v2.0 USB Smart Card Reader when I have to travel for work.

To post a comment you must log in.