[Pcsclite-git-commit] [PCSC] 02/04: format display of SCARD_ATTR_VENDOR_IFD_VERSION
Ludovic Rousseau
rousseau at moszumanska.debian.org
Fri Jun 26 15:39:55 UTC 2015
This is an automated email from the git hooks/post-receive script.
rousseau pushed a commit to branch master
in repository PCSC.
commit 7a905f4bf5e917240c3529f0def63aafb40fe098
Author: Ludovic Rousseau <ludovic.rousseau at gmail.com>
Date: Fri Jun 26 10:31:34 2015 +0200
format display of SCARD_ATTR_VENDOR_IFD_VERSION
Display the value of SCARD_ATTR_VENDOR_IFD_VERSION using the documented
format: MM.mm.bbbb where MM = major version, mm = minor version, and
bbbb = build number.
---
src/testpcsc.c | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/src/testpcsc.c b/src/testpcsc.c
index 322c565..dd8247d 100644
--- a/src/testpcsc.c
+++ b/src/testpcsc.c
@@ -374,15 +374,28 @@ wait_for_card_again:
test_rv(rv, hContext, DONT_PANIC);
if (rv == SCARD_S_SUCCESS)
{
+ int valid = 1; /* valid value by default */
+ long value;
printf("Vendor IFD version\t\t: ");
if (dwBufLen == sizeof(DWORD))
- printf(GREEN "0x%08lX\n" NORMAL, buf.as_DWORD);
+ value = buf.as_DWORD;
else
{
if (dwBufLen == sizeof(uint32_t))
- printf(GREEN "0x%08X\n" NORMAL, buf.as_uint32_t);
+ value = buf.as_uint32_t;
else
+ {
printf(RED "Unsupported size\n" NORMAL);
+ valid = 0; /* invalid value */
+ }
+ }
+
+ if (valid)
+ {
+ int M = (value & 0xFF000000) >> 24; /* Major */
+ int m = (value & 0x00FF0000) >> 16; /* Minor */
+ int b = (value & 0x0000FFFF); /* build */
+ printf(GREEN "%d.%d.%d\n" NORMAL, M, m, b);
}
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pcsclite/PCSC.git
More information about the Pcsclite-cvs-commit
mailing list