Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ATR210 LIBUSB_ERROR_NO_DEVICE after disconnecting #95

Closed
benclerix-cegeka opened this issue Feb 4, 2021 · 5 comments
Closed

ATR210 LIBUSB_ERROR_NO_DEVICE after disconnecting #95

benclerix-cegeka opened this issue Feb 4, 2021 · 5 comments

Comments

@benclerix-cegeka
Copy link

Issue

  1. When I insert the ATR210 and restart the docker container everything works, I can use pcsc_scan to detect cards etc.
  2. When I remove and insert the ATR210 I get issues in pcscd logs (LIBUSB_ERROR_NO_DEVICE).
    In the log file I provided I did
    first step 1 and then 2.

I am aware that the ATR210 is in this list: https://ccid.apdu.fr/ccid/shouldwork.html with a CCID version of '1.4.32".
However 1.4.30-1 is the last version that I could find via apt install.
Should I get a later version from https://ccid.apdu.fr/files/ and install that manually ?

I manually added these snippets to /usr/lib/pcsc/drivers/ifd-ccid.bundle/Contents/Info.plist:

vendorid
		<string>0x0DB5</string>
		<string>0x0DB5</string>
		<string>0x0DB5</string>
productid
		<string>0x0140</string>
		<string>0x0180</string>
		<string>0x0170</string>
and some friendly values in the other list

I hope I provided enough information, if I missed anything, did something wrong or can provide more info, please let me know.

Versions
smart card reader driver name and version

I think this is ccid?

root@7d2eb4356ec7:/app# apt show libccid
Package: libccid
Version: 1.4.30-1
Priority: optional
Section: libs
Source: ccid
Maintainer: Ludovic Rousseau <[email protected]>
Installed-Size: 485 kB
Provides: pcsc-ifd-handler
Depends: libc6 (>= 2.15), libusb-1.0-0 (>= 2:1.0.9)
Suggests: pcmciautils
Homepage: https://ccid.apdu.fr/
Tag: role::shared-lib
Download-Size: 328 kB
APT-Manual-Installed: no
APT-Sources: http:https://deb.debian.org/debian buster/main armhf Packages
Description: PC/SC driver for USB CCID smart card readers

pcsc-lite version

root@7d2eb4356ec7:/app# apt show libpcsclite1
Package: libpcsclite1
Version: 1.8.24-1
Priority: optional
Section: libs
Source: pcsc-lite
Maintainer: Ludovic Rousseau <[email protected]>
Installed-Size: 82.9 kB
Depends: libc6 (>= 2.15)
Suggests: pcscd (= 1.8.24-1)
Breaks: libpcsclite-dev (<< 1.8.24-1), pcscd (<< 1.8.24-1)
Homepage: https://pcsclite.apdu.fr/
Tag: role::shared-lib
Download-Size: 55.4 kB
APT-Manual-Installed: yes
APT-Sources: http:https://deb.debian.org/debian buster/main armhf Packages
Description: Middleware to access a smart card using PC/SC (library)

the output of the command "/usr/sbin/pcscd --version"

root@7d2eb4356ec7:/app# /usr/sbin/pcscd --version
pcsc-lite version 1.8.24.
Copyright (C) 1999-2002 by David Corcoran <[email protected]>.
Copyright (C) 2001-2015 by Ludovic Rousseau <[email protected]>.
Copyright (C) 2003-2004 by Damien Sauveron <[email protected]>.
Report bugs to <[email protected]>.
Enabled features: Linux arm-unknown-linux-gnueabihf libsystemd serial usb libudev usbdropdir=/usr/lib/pcsc/drivers ipcdir=/var/run/pcscd configdir=/etc/reader.conf.d

Platform
Operating system or GNU/Linux distribution name and version

root@7d2eb4356ec7:/app# cat /etc/debian_version
10.7
root@7d2eb4356ec7:/app# uname -a
Linux 7d2eb4356ec7 4.19.75 #1 SMP Mon Mar 23 11:57:05 UTC 2020 armv7l GNU/Linux

Smart card middleware name and version
I'm unsure about this, how can I give you this information?
Smart card reader manufacturer name and reader model name:
AccessIS ATR210 https://www.access-is.com/products/atr210-triptick
Smart card name

Possibly identified card (using /usr/share/pcsc/smartcard_list.txt):
3B 81 80 01 80 80
        RFID - ISO 14443 Type A - NXP DESFire or DESFire EV1
        "Reiner LoginCard" (or "OWOK", how they name it) - they have been distributed by a german computer magazine ("Computer BILD")
        https://cardlogin.reiner-sct.com/
        Belgium A-kaart (Antwerp citycard)
        Oyster card - Transport for London
        http:https://en.wikipedia.org/wiki/Oyster_card
        Kaba Legic Advant 4k
        Sydney Opal card public transport ticket (Transport)
        https://www.opal.com.au
        TH Köln (University of Applied Sciences Cologne) - Student Identity Card
        https://www.th-koeln.de/en/academics/multica_5893.php
        German red cross blood donation service
        http:https://www.blutspende-nordost.de/
        Greater Toronto/Hamilton/Ottawa PRESTO contactless fare card
        http:https://en.wikipedia.org/wiki/Presto_card

More on the platform:
I'm running the code in a docker container using BalenaOS (based on Yocto).
Running on a BalenaFin (similar to a RPI 3, ARMV7): https://www.balena.io/fin/
using this base image (to enable UDEV): balenalib/generic-armv7ahf-dotnet:3.1-buster-20210201 as described in these resources:

Log
log.txt

@LudovicRousseau
Copy link
Owner

The USB device removal is NOT notified by libudev.
Maybe libudev does not work correctly inside a docker container.

You can run udevadm monitor and add & remove your reader to see what logs you get.

@benclerix-cegeka
Copy link
Author

benclerix-cegeka commented Feb 5, 2021

I ran udevadm monitor inside the docker container and it seems to detect the remove and add but only on the kernel level.
udevadm_monitor_container.txt
When I run udevadm monitor on the host I get events for both kernel and udev.
udevadm_monitor_host.txt

I also checked if udevd is running inside the container:

root@8de138db034b:/app# service udev status
[ ok ] systemd-udevd is running.

Are there other things I can try to debug this issue? Thanks already for the fast feedback.

I also created an issue with Balena to see if they can help me with the UDEV events and I'll keep you posted: https://forums.balena.io/t/udev-events-not-showing-up-in-service/250035

@LudovicRousseau
Copy link
Owner

You found the problem.
You can try to ask on the pcsclite-muscle mailing list https://ludovicrousseau.blogspot.com/2020/11/how-to-get-smart-card-support.html
But since it is a udev/docker issue I don't know if that would help.

@LudovicRousseau
Copy link
Owner

You can also rebuild pcsc-lite using ./configure --disable-libudev
It should then use libusb instead.

@benclerix-cegeka
Copy link
Author

Thanks for that feedback.
We fixed the issue on the udev/docker side: https://forums.balena.io/t/udev-events-not-showing-up-in-service/250035

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants