It also contains a reference to a program called pcsc_scan so let's try running that:
$ pcsc_scanSo, yes, it is totally not discovering my reader, even though it is there.
Command 'pcsc_scan' not found, but can be installed with:
sudo apt install pcsc-tools
$ sudo apt install pcsc-tools
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
libpcsc-perl
The following NEW packages will be installed
libpcsc-perl pcsc-tools
0 to upgrade, 2 to newly install, 0 to remove and 21 not to upgrade.
Need to get 188 kB of archives.
After this operation, 730 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://archive.ubuntu.com/ubuntu jammy/universe amd64 libpcsc-perl amd64 1.4.14-5build2 [41.4 kB]
Get:2 http://archive.ubuntu.com/ubuntu jammy/universe amd64 pcsc-tools amd64 1.6.0-1 [147 kB]
Fetched 188 kB in 0s (610 kB/s)
Selecting previously unselected package libpcsc-perl.
(Reading database ... 740483 files and directories currently installed.)
Preparing to unpack .../libpcsc-perl_1.4.14-5build2_amd64.deb ...
Unpacking libpcsc-perl (1.4.14-5build2) ...
Selecting previously unselected package pcsc-tools.
Preparing to unpack .../pcsc-tools_1.6.0-1_amd64.deb ...
Unpacking pcsc-tools (1.6.0-1) ...
Setting up libpcsc-perl (1.4.14-5build2) ...
Setting up pcsc-tools (1.6.0-1) ...
Processing triggers for desktop-file-utils (0.26+mint3+victoria) ...
Processing triggers for gnome-menus (3.36.0-1ubuntu3) ...
Processing triggers for man-db (2.10.2-1) ...
Processing triggers for mailcap (3.70+nmu1ubuntu1) ...
$ pcsc_scan
Using reader plug'n play mechanism
Scanning present readers...
Waiting for the first reader...
Going down another route, the list of supported devices for the CCID project lists my reader - the ACR1552U - as "should work", and has a configuration file that gives the USB device numbers that I'm seeing.
Also worth noting is that on the pcscd output I saw the following output while the scanner was running:
11596082 [133746382832128] winscard_msg_srv.c:256:ProcessEventsServer() Common channel packet arrivalOn the subject of things I can try, here's dmesg noticing the device being plugged in:
00000042 [133746382832128] winscard_msg_srv.c:267:ProcessEventsServer() ProcessCommonChannelRequest detects: 7
00000006 [133746382832128] pcscdaemon.c:133:SVCServiceRunLoop() A new context thread creation is requested: 7
00000359 [133746355340864] winscard_svc.c:340:ContextThread() Authorized PC/SC client
00000024 [133746355340864] winscard_svc.c:343:ContextThread() Thread is started: dwClientID=7, threadContext @0x5963beea7950
00000021 [133746355340864] winscard_svc.c:361:ContextThread() Received command: CMD_VERSION from client 7
00000009 [133746355340864] winscard_svc.c:373:ContextThread() Client is protocol version 4:4
00000006 [133746355340864] winscard_svc.c:396:ContextThread() CMD_VERSION rv=0x0 for client 7
00000193 [133746355340864] winscard_svc.c:361:ContextThread() Received command: ESTABLISH_CONTEXT from client 7
00000021 [133746355340864] winscard.c:215:SCardEstablishContext() Establishing Context: 0x7C30238C
00000005 [133746355340864] winscard_svc.c:461:ContextThread() ESTABLISH_CONTEXT rv=0x0 for client 7
00000178 [133746355340864] winscard_svc.c:361:ContextThread() Received command: CMD_WAIT_READER_STATE_CHANGE from client 7
00000092 [133746355340864] winscard_svc.c:840:MSGSendReaderStates() Send reader states: 7
00001145 [133746355340864] winscard_svc.c:361:ContextThread() Received command: CMD_STOP_WAITING_READER_STATE_CHANGE from client 7
00000017 [133746355340864] winscard_svc.c:442:ContextThread() CMD_STOP_WAITING_READER_STATE_CHANGE rv=0x0 for client 7
00000096 [133746355340864] winscard_svc.c:361:ContextThread() Received command: CMD_WAIT_READER_STATE_CHANGE from client 7
00000007 [133746355340864] winscard_svc.c:840:MSGSendReaderStates() Send reader states: 7
00000121 [133746355340864] winscard_svc.c:361:ContextThread() Received command: CMD_STOP_WAITING_READER_STATE_CHANGE from client 7
00000007 [133746355340864] winscard_svc.c:442:ContextThread() CMD_STOP_WAITING_READER_STATE_CHANGE rv=0x0 for client 7
00000342 [133746355340864] winscard_svc.c:361:ContextThread() Received command: CMD_GET_READERS_STATE from client 7
00000153 [133746355340864] winscard_svc.c:361:ContextThread() Received command: CMD_GET_READERS_STATE from client 7
00000056 [133746355340864] winscard_svc.c:361:ContextThread() Received command: CMD_WAIT_READER_STATE_CHANGE from client 7
00000010 [133746355340864] winscard_svc.c:840:MSGSendReaderStates() Send reader states: 7
$ dmesgAt this point in my googling, I came across this article, which while on the surface of things, it doesn't have a lot to do with my problem since I'm not using python, there is a clue here worth following: in the self-answer to the question, there is a reference to /usr/lib/pcsc/drivers/ifd-acsccid.bundle/Contents/Info.plist and the device not being listed. Is mine listed?
[87660.824571] usb 3-1: new full-speed USB device number 35 using xhci_hcd
[87660.952315] usb 3-1: New USB device found, idVendor=072f, idProduct=2303, bcdDevice= 1.00
[87660.952320] usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[87660.952322] usb 3-1: Product: ACR1552
[87660.952323] usb 3-1: Manufacturer: ACS
[87660.952324] usb 3-1: SerialNumber: RR620-003643
[87660.956578] hid-generic 0003:072F:2303.0035: hiddev0,hidraw1: USB HID v1.11 Device [ACS ACR1552] on usb-0000:00:14.0-1/input2
$ grep 2303 /usr/lib/pcsc/drivers/ifd-acsccid.bundle/Contents/Info.plistThat would be a "no", then. I can't claim to really understand the file format here, but I can give it a go to add an entry. I'm guessing I need to add something to each of the three arrays ifdVendorID, ifdProductID and ifdFriendlyName to ifd-acsccid.bundle and see what happens. I'm going to unplug the device and back the file up first.
$ grep 2303 /usr/lib/pcsc/drivers/ifd-ccid.bundle/Contents/Info.plist
<?xml version="1.0" encoding="UTF-8"?>To be clear, it seems that rather than having one array of triples, there are three arrays here, and the code puts together each entry from the vendorid, productid, and friendlyName to produce the triples. I have added the final entry to each of these lists. And, yes, in this file, all the vendor ids are the same - 072f.
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
... a lot of stuff elided here; the file is 450+ lines ...
<key>ifdVendorID</key>
<array>
<string>0x072f</string>
<string>0x072f</string>
<string>0x072f</string>
<string>0x072f</string>
...
<string>0x072f</string>
</array>
<key>ifdProductID</key>
<array>
<string>0xb301</string>
<string>0xb304</string>
<string>0xb305</string>
<string>0x8300</string>
...
<string>0x2303</string>
</array>
<key>ifdFriendlyName</key>
<array>
<string>ACS ACR32 ICC Reader</string>
<string>ACS ACR3201 ICC Reader</string>
<string>ACS ACR3201 ICC Reader</string>
<string>ACS ACR33U-A1 3SAM ICC Reader</string>
...
<string>ACS ACR1552-M1 USB</string>
</array>
<key>Copyright</key>
<string>This driver is protected by terms of the GNU Lesser General Public License version 2.1, or (at your option) any later version.</string>
</dict>
</plist>
So,that didn't work when I plugged the device back in. No obvious output from pcscd.
Wait a minute, do I need to restart pcscd? I don't feel I should need to, but then this has been ported from Windows. I'll be lucky not to need to reinstall the OS.
And then, as if by magic:
$ sudo pcscd -f --debugAnd there's a lot more, but I'm sure you don't want to see it ...
00000000 [135352545395200] debuglog.c:299:DebugLogSetLevel() debug level=debug
00000171 [135352545395200] configfile.l:293:DBGetReaderListDir() Parsing conf directory: /etc/reader.conf.d
00000032 [135352545395200] configfile.l:329:DBGetReaderListDir() Skipping non regular file: ..
00000007 [135352545395200] configfile.l:329:DBGetReaderListDir() Skipping non regular file: .
00000005 [135352545395200] configfile.l:369:DBGetReaderList() Parsing conf file: /etc/reader.conf.d/libccidtwin
00000048 [135352545395200] pcscdaemon.c:663:main() pcsc-lite 1.9.5 daemon ready.
00004927 [135352545395200] hotplug_libudev.c:300:get_driver() Looking for a driver for VID: 0x1D6B, PID: 0x0002, path: /dev/bus/usb/001/001
00000142 [135352545395200] hotplug_libudev.c:300:get_driver() Looking for a driver for VID: 0x1D6B, PID: 0x0003, path: /dev/bus/usb/002/001
00000147 [135352545395200] hotplug_libudev.c:300:get_driver() Looking for a driver for VID: 0x1D6B, PID: 0x0002, path: /dev/bus/usb/003/001
00000085 [135352545395200] hotplug_libudev.c:300:get_driver() Looking for a driver for VID: 0x1D6B, PID: 0x0002, path: /dev/bus/usb/003/001
00000089 [135352545395200] hotplug_libudev.c:300:get_driver() Looking for a driver for VID: 0x072F, PID: 0x2303, path: /dev/bus/usb/003/036
00000005 [135352545395200] hotplug_libudev.c:441:HPAddDevice() Adding USB device: ACS ACR1552-M1 USB
00000044 [135352545395200] readerfactory.c:1097:RFInitializeReader() Attempting startup of ACS ACR1552-M1 USB [ACR1552 1S CL Reader PICC] ( RR620-003643) 00 00 using /usr/lib/pcsc/drivers/ifd-acsccid.bundle/Contents/Linux/libacsccid.so
00000283 [135352545395200] readerfactory.c:972:RFBindFunctions() Loading IFD Handler 3.0
00000016 [135352545395200] ifdhandler.c:2960:init_driver() Driver version: 1.1.8
00000171 [135352545395200] ifdhandler.c:2977:init_driver() LogLevel: 0x0003
00000006 [135352545395200] ifdhandler.c:2988:init_driver() DriverOptions: 0x0000
00000004 [135352545395200] ifdhandler.c:2996:init_driver() ACSDriverOptions: 0x0003
00000003 [135352545395200] ifdhandler.c:3004:init_driver() ACR38CardVoltage: 0
00000004 [135352545395200] ifdhandler.c:3012:init_driver() ACR38CardType: 0
00000020 [135352545395200] ifdhandler.c:162:CreateChannelByNameOrChannel() Lun: 0, device: usb:072f/2303:libudev:0:/dev/bus/usb/003/036
00000009 [135352545395200] ccid_usb.c:329:OpenUSBByName() Using: /usr/lib/pcsc/drivers/ifd-acsccid.bundle/Contents/Info.plist
00000168 [135352545395200] ccid_usb.c:347:OpenUSBByName() ifdManufacturerString: Advanced Card Systems Ltd.
00000005 [135352545395200] ccid_usb.c:348:OpenUSBByName() ifdProductString: ACS CCID driver
00000004 [135352545395200] ccid_usb.c:349:OpenUSBByName() Copyright: This driver is protected by terms of the GNU Lesser General Public License version 2.1, or (at your option) any later version.
00002604 [135352545395200] ccid_usb.c:753:OpenUSBByName() Found Vendor/Product: 072F/2303 (ACS ACR1552-M1 USB)
00000006 [135352545395200] ccid_usb.c:755:OpenUSBByName() Using USB bus/device: 3/36
00000004 [135352545395200] ccid_usb.c:934:OpenUSBByName() bNumDataRatesSupported is 0
And then I can run pcsc_scan:
$ pcsc_scanWell, that's certainly an improvement. Let's try tapping a card (this is one of my hotel keys, for completeness):
Using reader plug'n play mechanism
Scanning present readers...
0: ACS ACR1552-M1 USB [ACR1552 1S CL Reader PICC] ( RR620-003643) 00 00
1: ACS ACR1552-M1 USB [ACR1552 1S CL Reader SAM] ( RR620-003643) 01 00
Mon Jan 13 20:19:09 2025
Reader 0: ACS ACR1552-M1 USB [ACR1552 1S CL Reader PICC] ( RR620-003643) 00 00
Event number: 0
Card state: Card removed,
Reader 1: ACS ACR1552-M1 USB [ACR1552 1S CL Reader SAM] ( RR620-003643) 01 00
Event number: 0
Card state: Card inserted, Unresponsive card,
Mon Jan 13 20:19:16 2025No, right now, I have no idea of what any of that means. Except that it means that my reader is working, is configured and can read a card.
Reader 0: ACS ACR1552-M1 USB [ACR1552 1S CL Reader PICC] ( RR620-003643) 00 00
Event number: 1
Card state: Card inserted,
ATR: 3B 8F 80 01 80 4F 0C A0 00 00 03 06 03 00 01 00 00 00 00 6A
ATR: 3B 8F 80 01 80 4F 0C A0 00 00 03 06 03 00 01 00 00 00 00 6A
+ TS = 3B --> Direct Convention
+ T0 = 8F, Y(1): 1000, K: 15 (historical bytes)
TD(1) = 80 --> Y(i+1) = 1000, Protocol T = 0
-----
TD(2) = 01 --> Y(i+1) = 0000, Protocol T = 1
-----
+ Historical bytes: 80 4F 0C A0 00 00 03 06 03 00 01 00 00 00 00
Category indicator byte: 80 (compact TLV data object)
Tag: 4, len: F (initial access data)
Initial access data: 0C A0 00 00 03 06 03 00 01 00 00 00 00
+ TCK = 6A (correct checksum)
Possibly identified card (using /usr/share/pcsc/smartcard_list.txt):
3B 8F 80 01 80 4F 0C A0 00 00 03 06 03 00 01 00 00 00 00 6A
3B 8F 80 01 80 4F 0C A0 00 00 03 06 .. 00 01 00 00 00 00 ..
MIFARE Classic 1K (as per PCSC std part3)
3B 8F 80 01 80 4F 0C A0 00 00 03 06 03 00 01 00 00 00 00 6A
3B 8F 80 01 80 4F 0C A0 00 00 03 06 03 .. .. 00 00 00 00 ..
RFID - ISO 14443 Type A Part 3 (as per PCSC std part3)
3B 8F 80 01 80 4F 0C A0 00 00 03 06 03 00 01 00 00 00 00 6A
NXP/Philips MIFARE Classic 1K (as per PCSC std part3)
http://www.nxp.com/#/pip/pip=[pfp=41863]|pp=[t=pfp,i=41863]
Oyster card - Transport for London (first-gen)
https://en.wikipedia.org/wiki/Oyster_card
ACOS5/1k Mirfare
vivotech ViVOcard Contactless Test Card
Bangkok BTS Sky SmartPass
Mifare Classic 1K (block 0 re-writeable)
Electic vehicle charging card of the German Telekom, acting as EMSP GetCharge
Electic vehicle charging card of the EMSP Stadtwerke Muenchen (SWM), ladenetz.de, Germany
Electic vehicle charging card of the EMSP EinfachStromLaden of Maingau-Energie, Germany
Scouter carsharing customer card in Germany
https://scouter.de/
Mon Jan 13 20:19:17 2025
Reader 0: ACS ACR1552-M1 USB [ACR1552 1S CL Reader PICC] ( RR620-003643) 00 00
Event number: 2
Card state: Card removed,
Let's go back to trying my sample Go programs. Running apdu, I see this:
If I hold the card over the reader before running the program I see this:
please insert smart card
and it hangs. Presumably I'm expected to type something here, but I'm not sure what.
>>
With show-atr:
Waiting for card...It waits for me to tap the card, then prints a string of gobbledygook and then says "remove card" and ends. (Yes, I can see the gobblydegook is the same string of hex digits that I saw in the pcsc_scan output.)
ATR: 3b8f8001804f0ca000000306030001000000006a
Please remove card
No comments:
Post a Comment