2020年6月1日 星期一

How to make smartcard reader on Dell Latitude 5480 working with Ubuntu

Dell Latitude 5480 has an embedded smartcard reader which should be based on BCM5880 secure processor from Broadcom. BCM5880 supports not only smartcard reader but also fingerprint reader. This article deals only the smartcard reader part. As for fingerprint reader, as of today, Ubuntu 20.04, still cannot have a working driver for that (see ref 1).

rick@E5480:~$ lsusb
Bus 002 Device 003: ID 0bda:8153 Realtek Semiconductor Corp. RTL8153 Gigabit Ethernet Adapter
Bus 002 Device 002: ID 0424:5807 Microchip Technology, Inc. (formerly SMSC) Hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 002: ID 8087:0a2b Intel Corp. 
Bus 001 Device 014: ID 413c:3016 Dell Computer Corp. Optical 5-Button Wheel Mouse
Bus 001 Device 011: ID 05e3:0610 Genesys Logic, Inc. 4-port hub
Bus 001 Device 010: ID 0bda:4014 Realtek Semiconductor Corp. 
Bus 001 Device 015: ID 05e3:0723 Genesys Logic, Inc. GL827L SD/MMC/MS Flash Card Reader
Bus 001 Device 017: ID 1a2c:0c21 China Resource Semico Co., Ltd 
Bus 001 Device 012: ID 13fd:1340 Initio Corporation Hi-Speed USB to SATA Bridge
Bus 001 Device 009: ID 05e3:0608 Genesys Logic, Inc. Hub
Bus 001 Device 018: ID 058f:9520 Alcor Micro Corp. Watchdata W 1981
Bus 001 Device 005: ID 0424:2807 Microchip Technology, Inc. (formerly SMSC) Hub
Bus 001 Device 004: ID 0c45:6717 Microdia Integrated_Webcam_HD
Bus 001 Device 003: ID 0a5c:5834 Broadcom Corp. 5880
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

The default Ubuntu 20.04 desktop installation does not install the necessary driver for smartcard reader to work. Did a search on google and find ref.2 is kind of close to my problem. But the document is quite old and it is referring to Ubuntu 9.04!! Since my Ubuntu 20.04 is installed on ZFS file system I decided to try that procedure. Before the installation I can do a quick zfs snapshot of my root filesystem and if anything go wrong I can take the chance to practice how to rollback to previous snapshot, I hope...

The installation turns out pretty strait forward. Just one command line and you are all set.
rick@E5480:~$ sudo apt install pcscd libpcsc-perl pcsc-tools libccid 
Per the instruction, pcscd needs to be restarted.
rick@E5480:~$ sudo /etc/init.d/pcscd restart
Restarting pcscd (via systemctl): pcscd.service.
Then use pcsc_scan to make sure smartcard reader is really working. I have card inserted and I can see ATR response from my card, nice ~
rick@E5480:~$ pcsc_scan 
Using reader plug'n play mechanism
Scanning present readers...
0: Broadcom Corp 5880 [Contacted SmartCard] (0123456789ABCD) 00 00
1: Broadcom Corp 5880 [Contactless SmartCard] (0123456789ABCD) 01 00
2: Alcor Micro AU9520 02 00
 
Mon Jun  1 14:04:07 2020
 Reader 0: Broadcom Corp 5880 [Contacted SmartCard] (0123456789ABCD) 00 00
  Event number: 0
  Card state: Card removed, 
 Reader 1: Broadcom Corp 5880 [Contactless SmartCard] (0123456789ABCD) 01 00
  Event number: 0
  Card state: Card removed, 
 Reader 2: Alcor Micro AU9520 02 00
  Event number: 0
  Card state: Card inserted, 
  ATR: 3B D8 96 00 81 B1 FE 45 1F 07 43 48 54 47 50 4B 49 4A DD

ATR: 3B D8 96 00 81 B1 FE 45 1F 07 43 48 54 47 50 4B 49 4A DD
+ TS = 3B --> Direct Convention
+ T0 = D8, Y(1): 1101, K: 8 (historical bytes)
  TA(1) = 96 --> Fi=512, Di=32, 16 cycles/ETU
    250000 bits/s at 4 MHz, fMax for Fi = 5 MHz => 312500 bits/s
  TC(1) = 00 --> Extra guard time: 0
  TD(1) = 81 --> Y(i+1) = 1000, Protocol T = 1 
-----
  TD(2) = B1 --> Y(i+1) = 1011, Protocol T = 1 
-----
  TA(3) = FE --> IFSC: 254
  TB(3) = 45 --> Block Waiting Integer: 4 - Character Waiting Integer: 5
  TD(3) = 1F --> Y(i+1) = 0001, Protocol T = 15 - Global interface bytes following 
-----
  TA(4) = 07 --> Clock stop: not supported - Class accepted by the card: (3G) A 5V B 3V C 1.8V 
+ Historical bytes: 43 48 54 47 50 4B 49 4A
  Category indicator byte: 43 (proprietary format)
+ TCK = DD (correct checksum)

Possibly identified card (using /usr/share/pcsc/smartcard_list.txt):
3B D8 96 00 81 B1 FE 45 1F 07 43 48 54 47 50 4B 49 4A DD
	Citizen Digital Certificate, Taiwan (PKI)
	http://moica.nat.gov.tw/

Now I can happily use online ATM and report my tax on Ubuntu (^_^)

[Reference]

沒有留言: