diff options
author | Alon Levy <alevy@redhat.com> | 2010-09-08 12:24:18 +0300 |
---|---|---|
committer | Alon Levy <alevy@redhat.com> | 2010-09-08 12:24:18 +0300 |
commit | eb6a437d8d356026db180bf5d9830032ad01a37d (patch) | |
tree | 2558c4afef3f9d4f8c04af6200337883ba201841 | |
parent | 2019f6bf4006063ff7b5fbaa9a4c27b50ad8d432 (diff) |
fix ATR for windows usbccid.sys compat: correct length of historical bytes, and send TA1==0x13
-rw-r--r-- | vcard_emul_nss.c | 3 | ||||
-rw-r--r-- | vcardt.h | 5 |
2 files changed, 7 insertions, 1 deletions
diff --git a/vcard_emul_nss.c b/vcard_emul_nss.c index 21da5f2..906f97b 100644 --- a/vcard_emul_nss.c +++ b/vcard_emul_nss.c @@ -354,6 +354,9 @@ vcard_emul_get_atr(VCard *card, unsigned char *atr, int *atr_len) ASSERT(atr != NULL); memcpy(atr, nss_atr, len); + // set the hb_length correctly (length of historical bytes), second byte, T1 + // last nibble. Windows usbccid.sys needs this to be correct. + atr[1] = (atr[1] & 0xf0) + sizeof(nss_atr) - VCARD_ATR_MAIN_LENGTH; *atr_len = len; return; } @@ -28,7 +28,10 @@ typedef struct VCardEmulStruct VCardEmul; #define MAX_CHANNEL 4 /* create an ATR with appropriate historical bytes */ -#define VCARD_ATR_PREFIX 0x3b, 0x6f, 0x00, 0xff, 'V', 'C', 'A', 'R', 'D', '_' +#define VCARD_ATR_PREFIX 0x3b, 0x7f, 0x13, 0x00, 0xff, 'V', 'C', 'A', 'R', 'D', '_' + +/* length of non historical bytes part */ +#define VCARD_ATR_MAIN_LENGTH 5 typedef enum { VCARD_DONE, |