Hello David!
I've got an "Utimaco Safeware Compact" smartcard reader, which is a re-labeled
Omnikey 2010. Until recently I used an omnikey driver; but that stopped
working some time ago with a message like "Card not transacted: 612". Another
(updated) driver (Omnikey 3x21) works fine, so I don't blame pcscd itself - I
expect that pcscd has just evolved to an incompatible state (using PNP for
USB, etc).
Omnikey has no support for the 2010 anymore.
So now I'm trying to use the 2010 driver, but that doesn't work.
In the debug output I got only "Read error"s, so I've had a quick look into
the driver and found that the status codes returned by my reader are not
0x6?, but 0x5? (0x52 for not inserted, 0x56 for inserted).
I've done a quick patch (see below), which helps a bit - it works up to
"Initializing reader at: /dev/pcsc/1"
But now I'm stuck. In the debug log I get
-> fe fe fe fe fe ...
-> 00
-> 00
<- -> 03 00 00 80
-> 00 00 00 00
-> 00
<-
cardman.c:00233: CMAN_Status: Read Error
-> 89
-> 00 00 00 00
-> 00
<-
cardman.c:00233: CMAN_Status: Read Error
-> 89
-> 00 00 00 00
-> 00
<-
cardman.c:00378: CMAN_IsCardInserted: Status Error
What I can't explain (from looking at the code) is how IO_Read can return
without ending the line with "\n" (the line "<- -> ..." above).
And another problem is that the Cardman doesn't want to speak to me :-(
Please help me!
Regards,
Phil
=== cardman.c
==================================================================
--- cardman.c (revision 50)
+++ cardman.c (local)
@@ -26,6 +26,11 @@
int cardmode;
} CardManOpts;
+
+#define STATUS_NOT_INSERTED(s) ((s) == 0x52 || (s) == 0x62)
+#define STATUS_POWERED(s) ((s) == 0x54 || (s) == 0x64)
+#define STATUS_INSERTED(s) ((s) == 0x56 || (s) == 0x66 || STATUS_POWERED(s))
+
void CMAN_DebugLog( char *pcMessage, char *pcFile, int iLine ) {
printf("%25s:%05d: %s\n", pcFile, iLine, pcMessage);
@@ -240,10 +245,10 @@
*stat = stabuf[0];
- if( stabuf[0] == 0x62 ) { /* Card not inserted */
+ if( STATUS_NOT_INSERTED(stabuf[0])) {
return STATUS_SUCCESS;
} else {
- if( stabuf[0] == 0x66 || stabuf[0] == 0x64)/* 66=card in, no power */
+ if( STATUS_INSERTED(stabuf[0])) /* 66=card in, no power */
{ /* 64=card in & power */
return STATUS_SUCCESS;
} else {
@@ -293,7 +298,7 @@
return STATUS_IO_TIMEOUT;
}
- if ( stabuf[0] == 0x66 || stabuf[0] == 0x64 ) {
+ if ( STATUS_INSERTED(stabuf[0])) {
atrlen = stabuf[1];
}
@@ -333,7 +338,7 @@
return STATUS_IO_TIMEOUT;
}
- if ( stabuf[0] == 0x66 || stabuf[0] == 0x64 ) {
+ if ( STATUS_INSERTED(stabuf[0])) {
atrlen = stabuf[1];
}
@@ -374,9 +379,9 @@
return status;
}
- if( stat == 0x66 || stat == 0x64 ) {
+ if( STATUS_INSERTED(stat) ) {
return STATUS_SUCCESS;
- } else if ( stat == 0x62 ) {
+ } else if ( STATUS_NOT_INSERTED(stat)) {
return STATUS_UNSUCCESSFUL;
} else {
return STATUS_IO_TIMEOUT;
@@ -399,7 +404,7 @@
}
- if( stat == 0x64 ) {
+ if( STATUS_POWERED(stat) ) {
return STATUS_SUCCESS;
} else {
return STATUS_UNSUCCESSFUL;
=== serial.c
==================================================================
--- serial.c (revision 50)
+++ serial.c (local)
@@ -243,7 +243,7 @@
#endif
} else {
#ifdef PCSC_DEBUG
- printf("\n");
+ printf(" WRITE ERROR \n");
#endif
return FALSE;
}
_______________________________________________
Muscle mailing list
[email protected]
http://lists.drizzle.com/mailman/listinfo/muscle