LudovicRousseau / pcsc-tools

Some tools to be used with smart cards and PC/SC
https://pcsc-tools.apdu.fr/
GNU General Public License v2.0
195 stars 62 forks source link

Can't allocate Chipcard::PCSC::Card object: Unknown reader specified. #88

Closed jananii23 closed 2 weeks ago

jananii23 commented 2 weeks ago

Hi, I am validating the Smart Card Bridge SEC1210 in our Custum board, but I am facing the following error when I run the command:

pcsc_scan

PC/SC device scanner V 1.7.2 (c) 2001-2024, Ludovic Rousseau ludovic.rousseau@free.fr Using reader plug'n play mechanism Scanning present readers... 0: USX101x SmartCard Reader [CCID Interface] (F58FA6DC) 00 00 1: USX101x SmartCard Reader [CCID Interface] (F58FA6DC) 01 00

Wed Oct 16 05:07:42 2024 Reader 0: USX101x SmartCard Reader [CCID Interface] (F58FA6DC) 00 00 Event number: 0 Card state: Card removed Reader 1: USX101x SmartCard Reader [CCID Interface] (F58FA6DC) 01 00 Event number: 0 Card state: Card inserted, Unresponsive card

My card is in Reader 1, but I am experiencing an unresponsive card issue.

Then, when I run the scriptor command, I get the following output:

scriptor -r "USX101x SmartCard Reader [CCID Interface] (F58FA6DC) 01 00" -p "T=0"

Trying T=0 protocol Using given card reader: USX101x SmartCard Reader [CCID Interface] (F58FA6DC) 01 00 Can't allocate Chipcard::PCSC::Card object: Unknown reader specified.

Could you please provide a solution to resolve this issue?

Regards,
Janani

LudovicRousseau commented 2 weeks ago

That is very strange bug. Try to use gscriptor (the graphical version).

jananii23 commented 2 weeks ago

Hi, Can I get to know why pcsc_scan contains the below error: Card state: Card inserted, Unresponsive card What is the meaning of Unresponsive card, how can this be resolved

jananii23 commented 2 weeks ago

Hi, When I run the command gscriptor,

gscriptor

(gscriptor:1033): Gtk-WARNING **: 00:01:16.368: cannot open display:

LudovicRousseau commented 2 weeks ago

"Unresponsive card" is the PC/SC error SCARD_W_UNRESPONSIVE_CARD https://pcsclite.apdu.fr/api/group__ErrorCodes.html#ga359a9e85e3b7c83c76507a096452b74f

It means "The smart card is not responding to a reset. ".

Maybe the card is dead, or inserted in a wrong way, or the electrical contacts are dirty, or...

jananii23 commented 2 weeks ago

Ok, I'll check on this. Iam not able to run gscriptor command too. What may be the reason for Can't allocate Chipcard::PCSC::Card object: Unknown reader specified. How this can be resolved.

Hi, When I run the command gscriptor,

gscriptor

(gscriptor:1033): Gtk-WARNING **: 00:01:16.368: cannot open display:

LudovicRousseau commented 2 weeks ago

Do you start gscriptor from a graphical interface ?

what is the result of the command: echo $DISPLAY

jananii23 commented 2 weeks ago

Hi, After doing some changes hardware wise, Iam able to communicate with sim. When I'll give the below commands, pcsc_scan PC/SC device scanner V 1.7.2 (c) 2001-2024, Ludovic Rousseau ludovic.rousseau@free.fr Using reader plug'n play mechanism Scanning present readers... 0: USX101x Dual Slot SmartCard Reader [CCID Interface] (B58FB5FC) 00 00 1: USX101x Dual Slot SmartCard Reader [CCID Interface] (B58FB5FC) 01 00

ATR: 3B 9F 96 80 1F C7 80 31 E0 73 FE A1 1B 64 50 09 61 00 82 90 00 79

Possibly identified card (using /home/iwave/.cache/smartcard_list.txt): NONE

Your card is not present in the database. Please submit your unknown card at: https://smartcard-atr.apdu.fr/parse?ATR=3B9F96801FC78031E073FEA11B645009610082900079

Reader 1: USX101x Dual Slot SmartCard Reader [CCID Interface] (B58FB5FC) 01 00 Event number: 0 Card state: Card inserted, Unresponsive card, 2) scriptor -r "USX101x Dual Slot SmartCard Reader [CCID Interface] (B58FB5FC) 00 00" -p "T=0" file.txt Trying T=0 protocol Using given card reader: USX101x Dual Slot SmartCard Reader [CCID Interface] (B58FB5FC) 00 00 Using T=0 protocol Using given file: file.txt …A0 C0 00 00 16

A0 C0 00 00 16 < 00 00 98 07 3F 00 01 00 0F FF FF 01 15 B1 05 0B 0E 00 83 8A 83 8A 90 00 : Normal processing.

Select DF Telecom (7F10)

A0 A4 00 00 02 7F 10
A0 A4 00 00 02 7F 10
< 9F 22 : Error not defined by ISO 7816

Here file.txt contains,

reset the card

reset

Select MF 3F00

A0 A4 00 00 02 3F 00

Get Reponse

16 is the expected value of second SW from the previous command

A0 C0 00 00 16

Select DF Telecom (7F10)

A0 A4 00 00 02 7F 10

So, I need to know how we can read and write in the SIM, Is this procedure proper.

LudovicRousseau commented 2 weeks ago

So scriptor is working fine. It was a bug on your side.

For SIM cards see my blog https://blog.apdu.fr/categories/sim/

jananii23 commented 2 weeks ago

Is there any GUI application for arm64, which supports read and write to SIM for Ubuntu or Linux'