[Pcsclite-cvs-commit] HandlerTest/Host handler_test.c,1.11,1.12
rousseau@haydn.debian.org
rousseau@haydn.debian.org
Update of /cvsroot/pcsclite/HandlerTest/Host
In directory haydn:/tmp/cvs-serv1521
Modified Files:
handler_test.c
Log Message:
add test of IFDHControl()
Index: handler_test.c
===================================================================
RCS file: /cvsroot/pcsclite/HandlerTest/Host/handler_test.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- handler_test.c 9 Feb 2004 13:42:56 -0000 1.11
+++ handler_test.c 9 Jun 2004 13:17:27 -0000 1.12
@@ -74,7 +74,7 @@
RESPONSECODE (*IFDHTransmitToICC)(DWORD, SCARD_IO_HEADER, PUCHAR,
DWORD, PUCHAR, PDWORD,
PSCARD_IO_HEADER);
- //RESPONSECODE IFDHControl ( DWORD, PUCHAR, DWORD, PUCHAR, PDWORD );
+ RESPONSECODE (*IFDHControl)(DWORD, DWORD, PUCHAR, DWORD, PUCHAR, DWORD, PDWORD);
RESPONSECODE (*IFDHICCPresence)(DWORD);
};
@@ -227,6 +227,7 @@
DLSYM(IFDHPowerICC)
DLSYM(IFDHTransmitToICC)
DLSYM(IFDHICCPresence)
+ DLSYM(IFDHControl)
f.IFDHCreateChannelByName = dlsym(lib_handle, "IFDHCreateChannelByName");
if (f.IFDHCreateChannelByName == NULL && device_name)
@@ -280,6 +281,27 @@
}
}
+#define SCARD_CTL_CODE(code) (0x42000000 + (code))
+
+#define IOCTL_SMARTCARD_VENDOR_IFD_EXCHANGE SCARD_CTL_CODE(1)
+
+ {
+ unsigned char cmd[] = "\x02";
+ unsigned char res[100];
+ DWORD length;
+
+ rv = f.IFDHControl(LUN, IOCTL_SMARTCARD_VENDOR_IFD_EXCHANGE,
+ cmd, sizeof(cmd)-1, res, sizeof(res), &length);
+ if (IFD_SUCCESS == rv)
+ {
+ debug_xxd("Firmware: ", res, length);
+ res[length] = '\0';
+ printf("Firmware: %s\n", res);
+ }
+ else
+ pcsc_error(rv);
+ }
+
rv = f.IFDHICCPresence(LUN);
pcsc_error(rv);
@@ -697,6 +719,10 @@
{
switch (rv)
{
+ case IFD_SUCCESS:
+ DEBUG("IFD: success");
+ break;
+
case IFD_ICC_PRESENT:
DEBUG("IFD: card present");
break;
@@ -718,7 +744,7 @@
break;
default:
- DEBUG2("IFD: undocumented error: %X", rv);
+ DEBUG2("IFD: undocumented error: 0x%X", rv);
}
} /* pcsc_error */