pcsc-tools

These tools are used to test a PC/SC driver, card or reader or send commands in a friendly environment (text or graphical user interface).

Source Download

Project repository

The project is hosted at https://salsa.debian.org/rousseau/pcsc-tools and https://github.com/LudovicRousseau/pcsc-tools

Provided tools

pcsc_scan

pcsc_scan(1) regularly scans every PC/SC reader connected to the host if a card is inserted or removed a "line" is printed.

$ pcsc_scan
PC/SC device scanner
V 1.7.4 (c) 2001-2026, Ludovic Rousseau <ludovic.rousseau@free.fr>
Using reader plug'n play mechanism
Scanning present readers...
0: Gemalto PC Twin Reader (70D7E2EE) 00 00

Wed Feb 18 11:15:06 2026
 Reader 0: Gemalto PC Twin Reader (70D7E2EE) 00 00
  Event number: 0
  Card state: Card inserted, 
  ATR: 3B A7 00 40 18 80 65 A2 08 01 01 52
ATR: 3B A7 00 40 18 80 65 A2 08 01 01 52
+ TS = 3B --> Direct Convention
+ T0 = A7, Y(1): 1010, K: 7 (historical bytes)
  TB(1) = 00 --> VPP is not electrically connected
  TD(1) = 40 --> Y(i+1) = 0100, Protocol T = 0 
-----
  TC(2) = 18 --> Work waiting time: 960 x 24 x (Fi/F)
+ Historical bytes: 80 65 A2 08 01 01 52
  Category indicator byte: 80 (compact TLV data object)
    Tag: 6, len: 5 (pre-issuing data)
      Data: A2 08 01 01 52

Possibly identified card (using /home/rousseau/.cache/smartcard_list.txt):
3B A7 00 40 18 80 65 A2 08 01 01 52
3B A7 00 40 .. 80 65 A2 08 .. .. ..
	Gemplus GemSAFE Smart Card (8K)
3B A7 00 40 18 80 65 A2 08 01 01 52
	Gemplus GPK8000
	GemSAFE Smart Card (8K)
	MultiApp ID IAS ECC 72K CC (with IAS XL / IAS ECC Applet) IAS ECC Type 3 (Bank)

Insert or remove a card or a reader... \  (use Ctrl-C to exit)

Sample of a normal execution

  1. Connect a reader
  2. Insert a card
  3. Remove the card
  4. Disconnect the reader
  5. Exit pcsc_scan

Same sequence but using the debug mode

The field .dwEventState is displayed with changes compared to its previous value. It is then possible to see what bit was changed for each reader.

Readers only

$ pcsc_scan -r
PC/SC device scanner
V 1.7.4 (c) 2001-2026, Ludovic Rousseau <ludovic.rousseau@free.fr>
Using reader plug'n play mechanism
Scanning present readers...
0: Gemalto PC Twin Reader (70D7E2EE) 00 00

Cards only

$ pcsc_scan -c
PC/SC device scanner
V 1.7.4 (c) 2001-2026, Ludovic Rousseau <ludovic.rousseau@free.fr>
Using reader plug'n play mechanism
Scanning present readers...

Tue Feb 17 19:00:16 2026
 Reader 0: Gemalto PC Twin Reader (70D7E2EE) 00 00
  Event number: 0
  Card state: Card inserted, 
  ATR: 3B A7 00 40 18 80 65 A2 08 01 01 52

ATR_analysis

ATR_analysis(1) is a Perl script used to parse the smart card ATR. This script is called (by default) by pcsc_scan.

This code was originally written by Christophe in August 2000 for a Perl wrapper using "TLP driver" (and not PC/SC) to access the smartcard.

smartcard_list.txt

The smartcard_list.txt list contains ATR of some cards. The list is used by ATR_analysis to find a card model corresponding to the ATR.

This list is also use by the online ATR parser at https://smartcard-atr.apdu.fr/.

If your ATR is not already in the list then please use https://smartcard-atr.apdu.fr/ to report it. I will then add it to the list.

scriptor

scriptor(1) is a Perl script to send commands to a smart card using a batch file or stdin.

$ scriptor 
No reader given: using GemPC Twin 0 0
Using T=0 protocol
Reading commands from STDIN
reset
> RESET
< OK: 3B A7 00 40 18 80 65 A2 08 01 01 52 
00 A4 00 00 02 3F 00
> 00 A4 00 00 02 3F 00
< 61 12 : 0x12 bytes of response still available.
00 C0 00 00 12
> 00 C0 00 00 12
< 85 10 80 01 3F 00 38 00 00 00 01 00 01 00 00 00 00 6B 90 00 : Normal processing.
	

gscriptor(1)

the same idea as scriptor.pl(1) but with a Perl-Gtk3 GUI.

gscriptor screen copy

Authors

Licence

Copyright (C) 2001-2002 Lionel VICTOR
Copyright (C) 2001-2026 Ludovic ROUSSEAU

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

Debian

See also the Debian logo Debian Project page for pcsc-tools.

Windows

See "pcsc_scan on Windows" and "Better pcsc_scan on Windows"