Hi.
I am having a problem and i am unable to figure out what
the problem is. I am trying to read a string which is 9 chars long.
that is written to the card. Here is the code I use:
The card that i am trying to read is a SLE 4442.
Please give me some pointers. Thank you!
---8<---
#!/usr/bin/perl
use warnings;
use strict;
use Chipcard::PCSC;
use Chipcard::PCSC::Card;
my $hContext = new Chipcard::PCSC ();
my $hCard = new Chipcard::PCSC::Card ($hContext,
"CASTLES EZ100PU 00 00",
$Chipcard::PCSC::SCARD_SHARE_DIRECT,
$Chipcard::PCSC::SCARD_PROTOCOL_RAW);
my $RecvData;
die ("Could not create PCSC object: $Chipcard::PCSC::errno\n") unless defined
$hContext;
$hCard->BeginTransaction();
$RecvData = $hCard->Transmit([0xFF,0xB0,0x00,0x2E,0x09]);
die ("Can't communicate: $Chipcard::PCSC::errno\n") unless defined $RecvData;
$hCard->EndTransaction($Chipcard::PCSC::SCARD_LEAVE_CARD);
$hCard->Disconnect($Chipcard::PCSC::SCARD_RESET);
---8<---
Here is the logfile of pcscd:
pcscdaemon.c:259:main() pcscd set to foreground with debug send to stderr
debuglog.c:211:DebugLogSetLevel() debug level=debug
readerfactory.c:1093:RFInitializeReader() Attempting startup of CASTLES EZ100PU
00 00 using /usr/lib/pcsc/drivers/ezusb.so
readerfactory.c:930:RFBindFunctions() Loading IFD Handler 2.0
pcscdaemon.c:464:main() pcsc-lite 1.3.2 daemon ready.
eventhandler.c:419:EHStatusHandlerThread() Card inserted into CASTLES EZ100PU
00 00
Card ATR: 3B BF 18 00 80 31 70 35 53 54 41 52 43 4F 53 20 53 32 31 20 43 90 00
9B
winscard_msg_srv.c:203:SHMProcessEventsServer() Common channel packet arrival
winscard_msg_srv.c:212:SHMProcessEventsServer() SHMProcessCommonChannelRequest
detects: 7
pcscdaemon.c:151:SVCServiceRunLoop() A new context thread creation is
requested: 7
winscard_svc.c:132:ContextThread() Thread is started: 7
winscard_msg_srv.c:274:SHMProcessEventsContext() correctly processed client: 7
winscard_svc.c:179:ContextThread() Client is protocol version 2:1
winscard_msg_srv.c:274:SHMProcessEventsContext() correctly processed client: 7
winscard.c:159:SCardEstablishContext() Establishing Context: 16995732
winscard_msg_srv.c:274:SHMProcessEventsContext() correctly processed client: 7
winscard.c:213:SCardConnect() Attempting Connect to CASTLES EZ100PU 00 00 using
protocol: 4
winscard.c:326:SCardConnect() Direct access: no protocol selected
winscard.c:333:SCardConnect() hCard Identity: 1ccc7
winscard_msg_srv.c:274:SHMProcessEventsContext() correctly processed client: 7
winscard.c:881:SCardBeginTransaction() Status: 0.
winscard_msg_srv.c:274:SHMProcessEventsContext() correctly processed client: 7
winscard.c:1454:SCardTransmit() Send Protocol: T=4
ifdwrapper.c:599:IFDControl_v2() Card not transacted: 612
winscard.c:1481:SCardTransmit() Card not transacted: 0x80100016
winscard_msg_srv.c:274:SHMProcessEventsContext() correctly processed client: 7
winscard.c:710:SCardDisconnect() Active Contexts: 1
winscard_msg_srv.c:274:SHMProcessEventsContext() correctly processed client: 7
winscard.c:170:SCardReleaseContext() Releasing Context: 16995732
winscard_msg_srv.c:262:SHMProcessEventsContext() Client has disappeared: 7
winscard_svc.c:145:ContextThread() Client die: 7
---8<---
And the output of pcsc_scan.
PC/SC device scanner
V 1.4.8 (c) 2001-2006, Ludovic Rousseau <[EMAIL PROTECTED]>
Compiled with PC/SC lite version: 1.3.2
Scanning present readers
0: CASTLES EZ100PU 00 00
Fri Dec 29 01:09:56 2006
Reader 0: CASTLES EZ100PU 00 00
Card state: Card inserted,
ATR: 3B BF 18 00 80 31 70 35 53 54 41 52 43 4F 53 20 53 32 31 20 43 90 00 9B
ATR: 3B BF 18 00 80 31 70 35 53 54 41 52 43 4F 53 20 53 32 31 20 43 90 00 9B
+ TS = 3B --> Direct Convention
+ T0 = BF, Y(1): 1011, K: 15 (historical bytes)
TA(1) = 18 --> Fi=372, Di=12, 31 cycles/ETU (115200 bytes/s at 3.57 MHz)
TB(1) = 00 --> VPP is not electrically connected
TD(1) = 80 --> Y(i+1) = 1000, Protocol T = 0
-----
TD(2) = 31 --> Y(i+1) = 0011, Protocol T = 1
-----
TA(3) = 70 --> IFSC: 112
TB(3) = 35 --> Block Waiting Integer: 3 - Character Waiting Integer: 5
+ Historical bytes: 53 54 41 52 43 4F 53 20 53 32 31 20 43 90 00
Category indicator byte: 53 (proprietary format)
+ TCK = 9B (correct checksum)
Possibly identified card (using /usr/share/pcsc/smartcard_list.txt):
3B BF 18 00 80 31 70 35 53 54 41 52 43 4F 53 20 53 32 31 20 43 90 00 9B
Giesecke & Devrient STARCOS S2.1
_______________________________________________
Muscle mailing list
[email protected]
http://lists.drizzle.com/mailman/listinfo/muscle