The idea is to give money to the people doing things you like. So if you like this blog or my smart card project you can say so by clicking the flattr icon
Thanks
I moved my blog from https://ludovicrousseau.blogspot.com/ to https://blog.apdu.fr/ . Why? I wanted to move away from Blogger (owne...
SCARD_READERSTATE structure: SCARD_READERSTATE_WszReader field is a LPCWSTR using wide charactersSCARD_READERSTATE_AszReader field is a LPCSTR using normal charactersSCARD_READERSTATE externally and programs should never use SCARD_READERSTATE_W or SCARD_READERSTATE_A.SCARD_READERSTATE_A PSCARD_READERSTATE_A and LPSCARD_READERSTATE_A typesLPSCARD_READERSTATE_A instead and we have seen why it was a bad idea.SCARD_W_INSERTED_CARD error code was specific to pcsc-lite and was never used. I removed its declaration.
~/.ltrace.confltrace -l/usr/lib/libpcsclite.so your_applicationpcscd to generate logs using --debug but these logs are mainly to trace problems at the reader level, not at the application level.ltrace is a debugging utility in Linux to monitor the library calls used by a program and all the signals it receives. It can also show system calls, used by a program.
$ ltrace .libs/testpcsc
__libc_start_main(0x8048c5a, 1, 0xbfdfadb4, 0x8049dc0, 0x8049db0
puts("\nMUSCLE PC/SC Lite unitary test "...
MUSCLE PC/SC Lite unitary test Program
) = 41
puts("\033[35mTHIS PROGRAM IS NOT DESIGNE"...THIS PROGRAM IS NOT DESIGNED AS A TESTING TOOL FOR END USERS!
) = 67
printf("Do NOT use it unless you really "...Do NOT use it unless you really know what you do.
) = 55
printf("Testing SCardEstablishContext\t:"...) = 32
SCardEstablishContext(2, 0, 0, 0xbfdfacd8, 0) = 0
pcsc_stringify_error(0, 0xb77b73a0, 0xb778780d, 0xb7764ff4, 0) = 0xb778c340
puts("Command successful."Testing SCardEstablishContext : Command successful.
) = 20
printf("Testing SCardIsValidContext\t: ") = 30
SCardIsValidContext(0x103a3a0, 0x103a3a0, 0, 0xbfdfacd8, 0) = 0
pcsc_stringify_error(0, 0, 0xbfdfa568, 0xb77855ce, 0x103a3a0) = 0xb778c340
puts("Command successful."Testing SCardIsValidContext : Command successful.
) = 20
printf("Testing SCardIsValidContext\t: ") = 30
SCardIsValidContext(0x103a3a1, 0x103a3a0, 0, 0xbfdfacd8, 0) = 0x80100003
pcsc_stringify_error(0x80100003, 0, 0xbfdfa568, 0xb77855ce, 0xbfdfa574) = 0xb778c340
printf("\033[34m%s (don't panic)\n\033[0"..., "Invalid handle."Testing SCardIsValidContext : Invalid handle. (don't panic)
) = 39
printf("Testing SCardListReaderGroups\t:"...) = 32
SCardListReaderGroups(0x103a3a0, 0xbfdfac08, 0xbfdfac04, 0xbfdfacd8, 0) = 0
pcsc_stringify_error(0, 0xb77b73a0, 0xbfdfac08, 0xb7764ff4, 0) = 0xb778c340
puts("Command successful."Testing SCardListReaderGroups : Command successful.
) = 20
printf("\033[32mGroup %02d: %s\n\033[0m", 1, "SCard$DefaultReaders"Group 01: SCard$DefaultReaders
) = 40
printf("Testing SCardFreeMemory\t\t: ") = 27
SCardFreeMemory(0x103a3a0, 0x96ea0f8, 0x96ea0f8, 0xbfdfacd8, 0) = 0
pcsc_stringify_error(0, 0xb77b73a0, 0x96ea0f8, 0xb77855e0, 0xb77855e9) = 0xb778c340
puts("Command successful."Testing SCardFreeMemory : Command successful.
) = 20
printf("Testing SCardListReaders\t: ") = 27
SCardListReaders(0x103a3a0, 0, 0, 0xbfdfac88, 0) = 0
pcsc_stringify_error(0, 0xb77b73a0, 0, 0xb7764ff4, 0) = 0xb778c340
puts("Command successful."Testing SCardListReaders : Command successful.
) = 20
printf("Testing SCardListReaders\t: ") = 27
SCardListReaders(0x103a3a0, 0, 0xbfdfac80, 0xbfdfac88, 0) = 0
pcsc_stringify_error(0, 0xb7669260, 0xb77654c0, 0xbfdfac88, 0) = 0xb778c340
puts("Command successful."Testing SCardListReaders : Command successful.
) = 20
printf("\033[32mReader %02d: %s\n\033[0m", 1, "Lenovo Integrated Smart Card Rea"...Reader 01: Lenovo Integrated Smart Card Reader 00 00
) = 62
printf("Waiting for card insertion\t: ") = 29
fflush(0xb77654c0Waiting for card insertion : ) = 0
SCardGetStatusChange(0x103a3a0, -1, 0xbfdfaca0, 1, 0) = 0
pcsc_stringify_error(0, 0xb77b73a0, 0xbfdfaca0, 0xbfdfac88, 0) = 0xb778c340
puts("Command successful."Command successful.
) = 20
printf("Testing SCardConnect\t\t: ") = 24
SCardConnect(0x103a3a0, 0x96ea118, 2, 3, 0xbfdfacdc) = 0
pcsc_stringify_error(0, 0xb77b73a0, 0xbfdfacdc, 0xbfdfac88, 0) = 0xb778c340
puts("Command successful."Testing SCardConnect : Command successful.
) = 20
printf("Select file:") = 12
memcpy(0xbfdfaaa8, "", 7) = 0xbfdfaaa8
printf(" %02X", 0) = 3
printf(" %02X", 0xa4) = 3
printf(" %02X", 0) = 3
printf(" %02X", 0) = 3
printf(" %02X", 0x2) = 3
printf(" %02X", 0x3f) = 3
printf(" %02X", 0) = 3
putchar(10, 0, 7, 3, 0xbfdfacdcSelect file: 00 A4 00 00 02 3F 00
) = 10
printf("Testing SCardTransmit\t\t: ") = 25
SCardTransmit(105074, 0xbfdfabb0, 0xbfdfaaa8, 7, 0xbfdfabb8) = 0
pcsc_stringify_error(0, 0xb77b73a0, 0xbfdfabb0, 0xbfdfac88, 0) = 0xb778c340
puts("Command successful."Testing SCardTransmit : Command successful.
) = 20
printf(" card response:\033[32m") = 20
printf(" %02X", 0x6f) = 3
printf(" %02X", 0x14) = 3
printf(" %02X", 0x84) = 3
printf(" %02X", 0xd) = 3
printf(" %02X", 0x70) = 3
printf(" %02X", 0x3c) = 3
printf(" %02X", 0x71) = 3
printf(" %02X", 0xb7) = 3
printf(" %02X", 0x6c) = 3
printf(" %02X", 0x3a) = 3
printf(" %02X", 0x8) = 3
printf(" %02X", 0x9) = 3
printf(" %02X", 0x2f) = 3
printf(" %02X", 0x2d) = 3
printf(" %02X", 0x73) = 3
printf(" %02X", 0xb7) = 3
printf(" %02X", 0xff) = 3
printf(" %02X", 0xa5) = 3
printf(" %02X", 0x3) = 3
printf(" %02X", 0x88) = 3
printf(" %02X", 0x1) = 3
printf(" %02X", 0) = 3
printf(" %02X", 0x90) = 3
printf(" %02X", 0) = 3
printf("\n\033[0m" card response: 6F 14 84 0D 70 3C 71 B7 6C 3A 08 09 2F 2D 73 B7 FF A5 03 88 01 00 90 00
) = 5
printf("Testing SCardControl\t\t: ") = 24
SCardControl(105074, 0x42000001, 0xbfdfa598, 1, 0xbfdfa598) = 0x80100016
pcsc_stringify_error(0x80100016, 0xb77b73a0, 0xbfdfa598, 0xbfdfa598, 0) = 0xb778c340
printf("\033[34m%s (don't panic)\n\033[0"..., "Transaction failed."Testing SCardControl : Transaction failed. (don't panic)
) = 43
printf("Testing SCardGetAttrib\t\t: ") = 26
SCardGetAttrib(105074, 0x7fff0003, 0xbfdfac10, 0xbfdfac0c, 0xbfdfa598) = 0
pcsc_stringify_error(0, 0xb77b73a0, 0xbfdfac10, 0xbfdfa598, 0) = 0xb778c340
puts("Command successful."Testing SCardGetAttrib : Command successful.
) = 20
printf("SCARD_ATTR_DEVICE_FRIENDLY_NAME:"...SCARD_ATTR_DEVICE_FRIENDLY_NAME: Lenovo Integrated Smart Card Reader 00 00
) = 84
printf("Testing SCardFreeMemory\t\t: ") = 27
SCardFreeMemory(0x103a3a0, 0x96ea198, 1, 0xbfdfac0c, 0xbfdfa598) = 0
pcsc_stringify_error(0, 0xb7669260, 0xb77654c0, 0x8049fbe, 0xb77855e9) = 0xb778c340
puts("Command successful."Testing SCardFreeMemory : Command successful.
) = 20
printf("Testing SCardGetAttrib\t\t: ") = 26
SCardGetAttrib(105074, 590595, 0xbfdfac10, 0xbfdfac0c, 0xbfdfa598) = 0
pcsc_stringify_error(0, 0xb7669260, 0xb77654c0, 0xbfdfa598, 0) = 0xb778c340
puts("Command successful."Testing SCardGetAttrib : Command successful.
) = 20
printf("SCARD_ATTR_ATR_STRING length: \033"...SCARD_ATTR_ATR_STRING length: 23
) = 42
printf("SCARD_ATTR_ATR_STRING: \033[32m") = 28
printf("%02X ", 0x3b) = 3
printf("%02X ", 0x9f) = 3
printf("%02X ", 0x95) = 3
printf("%02X ", 0x81) = 3
printf("%02X ", 0x31) = 3
printf("%02X ", 0xfe) = 3
printf("%02X ", 0x9f) = 3
printf("%02X ", 0) = 3
printf("%02X ", 0x65) = 3
printf("%02X ", 0x46) = 3
printf("%02X ", 0x53) = 3
printf("%02X ", 0x5) = 3
printf("%02X ", 0x30) = 3
printf("%02X ", 0x6) = 3
printf("%02X ", 0x71) = 3
printf("%02X ", 0xdf) = 3
printf("%02X ", 0) = 3
printf("%02X ", 0) = 3
printf("%02X ", 0) = 3
printf("%02X ", 0x81) = 3
printf("%02X ", 0x61) = 3
printf("%02X ", 0x16) = 3
printf("%02X ", 0xc0) = 3
printf("\n\033[0m"SCARD_ATTR_ATR_STRING: 3B 9F 95 81 31 FE 9F 00 65 46 53 05 30 06 71 DF 00 00 00 81 61 16 C0
) = 5
printf("Testing SCardFreeMemory\t\t: ") = 27
SCardFreeMemory(0x103a3a0, 0x96ea198, 1, 0xbfdfac0c, 0xbfdfa598) = 0
pcsc_stringify_error(0, 0xb7669260, 0xb77654c0, 0x8049fbe, 0xb77855e9) = 0xb778c340
puts("Command successful."Testing SCardFreeMemory : Command successful.
) = 20
printf("Testing SCardGetAttrib\t\t: ") = 26
SCardGetAttrib(105074, 65794, 0xbfdfac18, 0xbfdfac14, 0xbfdfa598) = 0
pcsc_stringify_error(0, 0xb7669260, 0xb77654c0, 0xbfdfa598, 0) = 0xb778c340
puts("Command successful."Testing SCardGetAttrib : Command successful.
) = 20
printf("Vendor IFD version\t\t: \033[32m"...Vendor IFD version : 0x0103000D
) = 42
printf("Testing SCardGetAttrib\t\t: ") = 26
SCardGetAttrib(105074, 499719, 0xbfdfac18, 0xbfdfac14, 0xbfdfa598) = 0
pcsc_stringify_error(0, 0xb7669260, 0xb77654c0, 0xbfdfa598, 0) = 0xb778c340
puts("Command successful."Testing SCardGetAttrib : Command successful.
) = 20
printf("Max message length\t\t: \033[32m"..., 261Max message length : 261
) = 35
printf("Testing SCardGetAttrib\t\t: ") = 26
SCardGetAttrib(105074, 65792, 0xbfdfac18, 0xbfdfac14, 0xbfdfa598) = 0
pcsc_stringify_error(0, 0xb7669260, 0xb77654c0, 0xbfdfa598, 0) = 0xb778c340
puts("Command successful."Testing SCardGetAttrib : Command successful.
) = 20
printf("Vendor name\t\t\t: \033[32m%s\n\033"..., "Ludovic Rousseau"Vendor name : Ludovic Rousseau
) = 42
printf("Testing SCardSetAttrib\t\t: ") = 26
SCardSetAttrib(105074, 590595, 0x804a2ab, 1, 0xbfdfa598) = 0x80100016
pcsc_stringify_error(0x80100016, 0x804a2ab, 0xbfdfa57c, 0xb77867a0, 105074) = 0xb778c340
printf("\033[34m%s (don't panic)\n\033[0"..., "Transaction failed."Testing SCardSetAttrib : Transaction failed. (don't panic)
) = 43
printf("Testing SCardStatus\t\t: ") = 23
SCardStatus(105074, 0xbfdfac84, 0xbfdfac9c, 0xbfdfac98, 0xbfdfac94) = 0
pcsc_stringify_error(0, 0xb77b73a0, 0xbfdfac84, 0xbfdfac90, 0) = 0xb778c340
puts("Command successful."Testing SCardStatus : Command successful.
) = 20
printf("Current Reader Name\t\t: \033[32"..., "Lenovo Integrated Smart Card Rea"...Current Reader Name : Lenovo Integrated Smart Card Reader 00 00
) = 74
printf("Current Reader State\t\t: \033[3"...Current Reader State : 0x10034
) = 41
printf("Current Reader Protocol\t\t: T=\033"...Current Reader Protocol : T=1
) = 40
printf("Current Reader ATR Size\t\t: \033"...Current Reader ATR Size : 23 bytes
) = 45
printf("Current Reader ATR Value\t: \033"...) = 32
printf("%02X ", 0x3b) = 3
printf("%02X ", 0x9f) = 3
printf("%02X ", 0x95) = 3
printf("%02X ", 0x81) = 3
printf("%02X ", 0x31) = 3
printf("%02X ", 0xfe) = 3
printf("%02X ", 0x9f) = 3
printf("%02X ", 0) = 3
printf("%02X ", 0x65) = 3
printf("%02X ", 0x46) = 3
printf("%02X ", 0x53) = 3
printf("%02X ", 0x5) = 3
printf("%02X ", 0x30) = 3
printf("%02X ", 0x6) = 3
printf("%02X ", 0x71) = 3
printf("%02X ", 0xdf) = 3
printf("%02X ", 0) = 3
printf("%02X ", 0) = 3
printf("%02X ", 0) = 3
printf("%02X ", 0x81) = 3
printf("%02X ", 0x61) = 3
printf("%02X ", 0x16) = 3
printf("%02X ", 0xc0) = 3
puts("\033[0m"Current Reader ATR Value : 3B 9F 95 81 31 FE 9F 00 65 46 53 05 30 06 71 DF 00 00 00 81 61 16 C0
) = 5
printf("Testing SCardFreeMemory\t\t: ") = 27
SCardFreeMemory(0x103a3a0, 0x96ea198, 0, 0xbfdfac98, 0xbfdfac94) = 0
pcsc_stringify_error(0, 0xb7669260, 0xb77654c0, 0x8049fbe, 0xb77855e9) = 0xb778c340
puts("Command successful."Testing SCardFreeMemory : Command successful.
) = 20
printf("Testing SCardFreeMemory\t\t: ") = 27
SCardFreeMemory(0x103a3a0, 0x96ea0f8, 0, 0xbfdfac98, 0xbfdfac94) = 0
pcsc_stringify_error(0, 0xb7669260, 0xb77654c0, 0x8049fbe, 0xb77855e9) = 0xb778c340
puts("Command successful."Testing SCardFreeMemory : Command successful.
) = 20
printf("Press enter: ") = 13
getchar(0x804a396, 0x103a3a0, 0, 0xbfdfac98, 0xbfdfac94Press enter:
) = 10
printf("Testing SCardReconnect\t\t: ") = 26
SCardReconnect(105074, 2, 3, 2, 0xbfdfac8c) = 0
pcsc_stringify_error(0, 0xb77b73a0, 0xbfdfac8c, 0xbfdfac90, 0) = 0xb778c340
puts("Command successful."Testing SCardReconnect : Command successful.
) = 20
printf("Testing SCardDisconnect\t\t: ") = 27
SCardDisconnect(105074, 2, 0, 2, 0xbfdfac8c) = 0
pcsc_stringify_error(0, 0xb77b73a0, 0xbfdfa4b4, 0xbfdfac90, 0) = 0xb778c340
puts("Command successful."Testing SCardDisconnect : Command successful.
) = 20
printf("Testing SCardFreeMemory\t\t: ") = 27
SCardFreeMemory(0x103a3a0, 0x96ea118, 0, 2, 0xbfdfac8c) = 0
pcsc_stringify_error(0, 0xb7669260, 0xb77654c0, 0x8049fbe, 0xb77855e9) = 0xb778c340
puts("Command successful."Testing SCardFreeMemory : Command successful.
) = 20
printf("Testing SCardReleaseContext\t: ") = 30
SCardReleaseContext(0x103a3a0, 0x103a3a0, 0, 2, 0xbfdfac8c) = 0
pcsc_stringify_error(0, 0xb77b73a0, 0xbfdfa4b4, 0xbfdfac90, 0) = 0xb778c340
puts("Command successful."Testing SCardReleaseContext : Command successful.
) = 20
putchar(10, 0x103a3a0, 0, 2, 0xbfdfac8c
) = 10
puts("PC/SC Test Completed Successfull"...PC/SC Test Completed Successfully !
) = 36
+++ exited (status 0) +++
-l/usr/lib/libpcsclite.soSCardConnect(0x103a3a0, 0x96ea118, 2, 3, 0xbfdfacdc) = 0 is really doing.SCardConnect I used:scarderror SCardConnect(scardcontext, string, share_mode, protocol, +scardhandle*, +protocol*);~/.ltrace.conf.$ ltrace -l/usr/lib/libpcsclite.so .libs/testpcsc
MUSCLE PC/SC Lite unitary test Program
THIS PROGRAM IS NOT DESIGNED AS A TESTING TOOL FOR END USERS!
Do NOT use it unless you really know what you do.
SCardEstablishContext(SCARD_SCOPE_SYSTEM, NULL, NULL, 0x103d6cb) = SCARD_S_SUCCESS
pcsc_stringify_error(SCARD_S_SUCCESS) = "Command successful."
Testing SCardEstablishContext : Command successful.
SCardIsValidContext(0x103d6cb) = SCARD_S_SUCCESS
pcsc_stringify_error(SCARD_S_SUCCESS) = "Command successful."
Testing SCardIsValidContext : Command successful.
SCardIsValidContext(0x103d6cc) = SCARD_E_INVALID_HANDLE
pcsc_stringify_error(SCARD_E_INVALID_HANDLE) = "Invalid handle."
Testing SCardIsValidContext : Invalid handle. (don't panic)
SCardListReaderGroups(0x103d6cb, "SCard$DefaultReaders", 22) = SCARD_S_SUCCESS
pcsc_stringify_error(SCARD_S_SUCCESS) = "Command successful."
Testing SCardListReaderGroups : Command successful.
Group 01: SCard$DefaultReaders
SCardFreeMemory(0x103d6cb, 0x09eb70f8) = SCARD_S_SUCCESS
pcsc_stringify_error(SCARD_S_SUCCESS) = "Command successful."
Testing SCardFreeMemory : Command successful.
SCardListReaders(0x103d6cb, NULL, NULL, 43) = SCARD_S_SUCCESS
pcsc_stringify_error(SCARD_S_SUCCESS) = "Command successful."
Testing SCardListReaders : Command successful.
SCardListReaders(0x103d6cb, NULL, "Lenovo Integrated Smart Card Rea"..., 43) = SCARD_S_SUCCESS
pcsc_stringify_error(SCARD_S_SUCCESS) = "Command successful."
Testing SCardListReaders : Command successful.
Reader 01: Lenovo Integrated Smart Card Reader 00 00
Waiting for card insertion : SCardGetStatusChange(0x103d6cb, -1, { "Lenovo Integrated Smart Card Rea"..., 0x00000001, 16, 34, 23, [ ';', '\237', '\225', '\201'... ] }, 1) = SCARD_S_SUCCESS
pcsc_stringify_error(SCARD_S_SUCCESS) = "Command successful."
Command successful.
SCardConnect(0x103d6cb, "Lenovo Integrated Smart Card Rea"..., SCARD_SHARE_SHARED, SCARD_PROTOCOL_T0_SCARD_PROTOCOL_T1, 126261, SCARD_PROTOCOL_T1) = SCARD_S_SUCCESS
pcsc_stringify_error(SCARD_S_SUCCESS) = "Command successful."
Testing SCardConnect : Command successful.
Select file: 00 A4 00 00 02 3F 00
SCardTransmit(126261, { SCARD_PROTOCOL_T1, 8 }, [ '\000', '\244', '\000', '\000'... ], 7, { 0xbfe04130, -1216591178 }, 'o', 24) = SCARD_S_SUCCESS
pcsc_stringify_error(SCARD_S_SUCCESS) = "Command successful."
Testing SCardTransmit : Command successful.
card response: 6F 14 84 0D 70 3C 71 B7 6C 3A 08 09 2F 2D 73 B7 FF A5 03 88 01 00 90 00
SCardControl(126261, 1107296257, [ '\002' ], 1, [ '\002', '\000', '\000', '\000'... ], 1024, 0) = SCARD_E_NOT_TRANSACTED
pcsc_stringify_error(SCARD_E_NOT_TRANSACTED) = "Transaction failed."
Testing SCardControl : Transaction failed. (don't panic)
SCardGetAttrib(126261, SCARD_ATTR_DEVICE_FRIENDLY_NAME, [ ], 42) = SCARD_S_SUCCESS
pcsc_stringify_error(SCARD_S_SUCCESS) = "Command successful."
Testing SCardGetAttrib : Command successful.
SCARD_ATTR_DEVICE_FRIENDLY_NAME: Lenovo Integrated Smart Card Reader 00 00
SCardFreeMemory(0x103d6cb, 0x09eb7198) = SCARD_S_SUCCESS
pcsc_stringify_error(SCARD_S_SUCCESS) = "Command successful."
Testing SCardFreeMemory : Command successful.
SCardGetAttrib(126261, SCARD_ATTR_ATR_STRING, [ ], 23) = SCARD_S_SUCCESS
pcsc_stringify_error(SCARD_S_SUCCESS) = "Command successful."
Testing SCardGetAttrib : Command successful.
SCARD_ATTR_ATR_STRING length: 23
SCARD_ATTR_ATR_STRING: 3B 9F 95 81 31 FE 9F 00 65 46 53 05 30 06 71 DF 00 00 00 81 61 16 C0
SCardFreeMemory(0x103d6cb, 0x09eb7198) = SCARD_S_SUCCESS
pcsc_stringify_error(SCARD_S_SUCCESS) = "Command successful."
Testing SCardFreeMemory : Command successful.
SCardGetAttrib(126261, SCARD_ATTR_VENDOR_IFD_VERSION, [ ], 4) = SCARD_S_SUCCESS
pcsc_stringify_error(SCARD_S_SUCCESS) = "Command successful."
Testing SCardGetAttrib : Command successful.
Vendor IFD version : 0x0103000D
SCardGetAttrib(126261, SCARD_ATTR_MAXINPUT, [ ], 4) = SCARD_S_SUCCESS
pcsc_stringify_error(SCARD_S_SUCCESS) = "Command successful."
Testing SCardGetAttrib : Command successful.
Max message length : 261
SCardGetAttrib(126261, SCARD_ATTR_VENDOR_NAME, [ ], 17) = SCARD_S_SUCCESS
pcsc_stringify_error(SCARD_S_SUCCESS) = "Command successful."
Testing SCardGetAttrib : Command successful.
Vendor name : Ludovic Rousseau
SCardSetAttrib(126261, SCARD_ATTR_ATR_STRING, , 1) = SCARD_E_NOT_TRANSACTED
pcsc_stringify_error(SCARD_E_NOT_TRANSACTED) = "Transaction failed."
Testing SCardSetAttrib : Transaction failed. (don't panic)
SCardStatus(126261, "Lenovo Integrated Smart Card Rea"..., 42, 52, SCARD_PROTOCOL_T1, [ '\370', 'p', '\353', '\t'... ], 23) = SCARD_S_SUCCESS
pcsc_stringify_error(SCARD_S_SUCCESS) = "Command successful."
Testing SCardStatus : Command successful.
Current Reader Name : Lenovo Integrated Smart Card Reader 00 00
Current Reader State : 0x0034
Current Reader Protocol : T=1
Current Reader ATR Size : 23 bytes
Current Reader ATR Value : 3B 9F 95 81 31 FE 9F 00 65 46 53 05 30 06 71 DF 00 00 00 81 61 16 C0
SCardFreeMemory(0x103d6cb, 0x09eb7198) = SCARD_S_SUCCESS
pcsc_stringify_error(SCARD_S_SUCCESS) = "Command successful."
Testing SCardFreeMemory : Command successful.
SCardFreeMemory(0x103d6cb, 0x09eb70f8) = SCARD_S_SUCCESS
pcsc_stringify_error(SCARD_S_SUCCESS) = "Command successful."
Testing SCardFreeMemory : Command successful.
Press enter:
SCardReconnect(126261, SCARD_SHARE_SHARED, SCARD_PROTOCOL_T0_SCARD_PROTOCOL_T1, SCARD_UNPOWER_CARD, SCARD_PROTOCOL_T1) = SCARD_S_SUCCESS
pcsc_stringify_error(SCARD_S_SUCCESS) = "Command successful."
Testing SCardReconnect : Command successful.
SCardDisconnect(126261, SCARD_UNPOWER_CARD) = SCARD_S_SUCCESS
pcsc_stringify_error(SCARD_S_SUCCESS) = "Command successful."
Testing SCardDisconnect : Command successful.
SCardFreeMemory(0x103d6cb, 0x09eb7118) = SCARD_S_SUCCESS
pcsc_stringify_error(SCARD_S_SUCCESS) = "Command successful."
Testing SCardFreeMemory : Command successful.
SCardReleaseContext(0x103d6cb) = SCARD_S_SUCCESS
pcsc_stringify_error(SCARD_S_SUCCESS) = "Command successful."
Testing SCardReleaseContext : Command successful.
PC/SC Test Completed Successfully !
+++ exited (status 0) +++
SCardConnect example we now have:SCardConnect(0x103d6cb, "Lenovo Integrated Smart Card Rea"..., SCARD_SHARE_SHARED, SCARD_PROTOCOL_T0_SCARD_PROTOCOL_T1, 126261, SCARD_PROTOCOL_T1) = SCARD_S_SUCCESS0x103d6cb"Lenovo Integrated Smart Card Rea"...SCARD_SHARE_SHAREDSCARD_PROTOCOL_T0_SCARD_PROTOCOL_T1126261SCARD_PROTOCOL_T1SCARD_S_SUCCESSThis function returns the status of the card inserted in the reader/slot specified by Lun.
TAG_IFD_STOP_POLLING_THREAD and use of the asynchronous libusb API to be able to stop a transfer.TAG_IFD_STOP_POLLING_THREAD definedTAG_IFD_STOP_POLLING_THREAD. This is used so that pcscd can ask the driver to stop its polling function.TAG_IFD_STOP_POLLING_THREAD has only be included in pcsc-lite 1.6.2. This is why you need pcsc-lite 1.6.2 to compile libccid 1.4.0.TAG_IFD_STOP_POLLING_THREAD to request the stop of the driver polling function.pcscd is started by libpcsclite then close all file handles except stdin, stdout and stderr so that pcscd does not confiscate resources allocated by the applicationsrc/hotplug_libusb.c: port from libusb-0.1 to libusb-1.0$sysconfdir/reader.conf.dsrc/PCSC/winscard.h: Remove definitions of SCARD_READERSTATE_A PSCARD_READERSTATE_A and LPSCARD_READERSTATE_A typesThe interrupt pipe is mandatory for a CCID that supports ICC insertion/removal. It is optional for a CCID with ICCs that are always inserted and are not removable. If there is an Interrupt-In endpoint, then theRDR_to_PC_NotifySlotChangemessage is required and all other messages are optional.
bMessageType and its value is 0x50 indicating RDR_to_PC_NotifySlotChange.bmSlotICCState:This field is reported on byte granularity.
The size is ( 2 bits * number of slots ) rounded up to the nearest byte.
Each slot has 2 bits. The least significant bit reports the current state of the slot (0b = no ICC present, 1b = ICC present). The most significant bit reports whether the slot has changed state since the lastRDR_to_PC_NotifySlotChangemessage was sent (0b = no change, 1b = change).
If no slot exists for a given location, the field returns 00b in those 2 bits.
Example: A 3 slot CCID reports a single byte with the following format:
Bit 0 = Slot 0 current state
Bit 1 = Slot 0 changed status
Bit 2 = Slot 1 current state
Bit 3 = Slot 1 changed status
Bit 4 = Slot 2 current state
Bit 5 = Slot 2 changed status
Bit 6 = 0b
Bit 7 = 0b
0x50 0x03 when a card is removed and 0x50 0x02 when a card is inserted.TAG_IFD_STOP_POLLING_THREAD is requested by pcscd to the driver.--disable-serial and --disable-usb options to remove code that will not be used.--disable-serial removes support of /etc/reader.conf.--disable-usb removes support of USB hotplugNO_LOG is defined a minimal pcsc_stringify_error() is used. The function is still available but only the error code in hex is displayed in this case.--enable-embedded (default is no) configure option to build pcsc-lite for an embedded system. This will activate the NO_LOG option to disable logging and limit RAM and disk consumption.--enable-embedded is used and you disable the communication interface you do not use (serial or USB) you can expect a gain of 40% on the code size and then a reduced disk/flash space and memory used.