2009/12/1 Simon Posnjak <[email protected]>:
> Hi all!
>
> I am developing a reader which will support direct mode. I modified
> the pcsc_demo.c example so that i changed:
> 1. SCARD_SHARE_SHARED => SCARD_SHARE_DIRECT
> 2. SCARD_PROTOCOL_T0 | SCARD_PROTOCOL_T1 => SCARD_PROTOCOL_RAW
>
> And tried to send the reader some APDUs. But I found no success. In
> the pcsc log I get the following:
>
> 04913895 winscard_msg_srv.c:239:SHMProcessEventsServer() Common
> channel packet arrival
> 00000044 winscard_msg_srv.c:248:SHMProcessEventsServer()
> SHMProcessCommonChannelRequest detects: 7
> 00000019 pcscdaemon.c:147:SVCServiceRunLoop() A new context thread
> creation is requested: 7
> 00000119 winscard_svc.c:133:ContextThread() Thread is started: 7
> 00000058 winscard_msg_srv.c:317:SHMProcessEventsContext() command
> CMD_VERSION received by client 7
> 00000018 winscard_svc.c:189:ContextThread() Client is protocol version 3:0
> 00000138 winscard_msg_srv.c:317:SHMProcessEventsContext() command
> ESTABLISH_CONTEXT received by client 7
> 00000049 winscard.c:242:SCardEstablishContext() Establishing Context: 17037171
> 00000676 winscard_msg_srv.c:317:SHMProcessEventsContext() command
> CONNECT received by client 7
> 00000021 winscard.c:303:SCardConnect() Attempting Connect to
> TestReader (2332333) 00 00 using protocol: 4
> 00000017 winscard.c:452:SCardConnect() Direct access: no protocol selected
> 00000019 winscard.c:459:SCardConnect() hCard Identity: 1ee28
> 00000357 winscard_msg_srv.c:317:SHMProcessEventsContext() command
> STATUS received by client 7
> 00000797 winscard_msg_srv.c:317:SHMProcessEventsContext() command
> TRANSMIT received by client 7
> 00000022 winscard.c:1647:SCardTransmit() Send Protocol: T=4
> 00000015 winscard.c:1671:SCardTransmit() Card not transacted: 0x8010001F
> 00000181 winscard_msg_srv.c:317:SHMProcessEventsContext() command
> RELEASE_CONTEXT received by client 7
> 00000020 winscard.c:253:SCardReleaseContext() Releasing Context: 17037171
> 00000016 winscard.c:880:SCardDisconnect() Active Contexts: 1
> 00003207 winscard_msg_srv.c:306:SHMProcessEventsContext() Client has
> disappeared: 7
> 00000033 winscard_svc.c:146:ContextThread() Client die: 7
>
> I checked wincard.c for what hapend and found that on line 1651 you do:
>
>        if (pioSendPci->dwProtocol == SCARD_PROTOCOL_RAW)
>        {
>                rv = IFDControl_v2(rContext, (PUCHAR) pbSendBuffer, 
> cbSendLength,
>                        pbRecvBuffer, &dwRxLength);
>        } else
>        {
>                rv = IFDTransmit(rContext, sSendPci, (PUCHAR) pbSendBuffer,
>                        cbSendLength, pbRecvBuffer, &dwRxLength, &sRecvPci);
>        }
>
> So you call IFDControl_v2 which is fine if you use IFD_HVERSION_2_0,
> but I use IFD_HVERSION_3_0.
>
> My question is how can I use SCARD_PROTOCOL_RAW with IFD_HVERSION_3_0?

This bug is already corrected [1] in pcsc-lite but not yet released in
the stable version. But you can get a snapshot of pcsc-lite at [2]
with the correction included.

pcsc-lite will then call IFDTransmit() in your case.

Bye

[1] 
http://lists.alioth.debian.org/pipermail/pcsclite-cvs-commit/2009-September/003917.html
[2] http://ludovic.rousseau.free.fr/softwares/pcsc-lite/

-- 
 Dr. Ludovic Rousseau

_______________________________________________
Muscle mailing list
[email protected]
http://lists.drizzle.com/mailman/listinfo/muscle

Reply via email to