Bug Report:

When executing Chipcard-GlobalPlatform-0.03/examples/provision, I get:



unknown protocol -1 given at PCSC.xs line 863
         at 
/usr/lib/perl5/site_perl/5.8.3/i386-linux-thread-multi/Chipcard/PCSC/Card.pm line 216, 
<R> line 10.


That line calls Chipcard::PCSC::_Transmit which gives the error.

This problem occurs when someone request a protocol that the card does
not support, and when function PHSetProtocol in pcsc-lite/prothandler.c
is called, it returns SET_PROTOCOL_WRONG_ARGUMENT which has the value
of -1. This value is stored in pdwActiveProtocol, which is returned as
the currently active protocol.


I'm not sure what is at fault. However, I think the patch fixes or hides the problem.
According to pcsc-perl documentation, the connect call should never return a
Active Protocol value of -1.



pcsc-perl-1.4.2% diff -u PCSC.xs.~1~ PCSC.xs
--- PCSC.xs.~1~ 2004-08-06 11:22:41.000000000 -0400
+++ PCSC.xs     2004-10-14 16:11:46.000000000 -0400
@@ -592,6 +592,9 @@
                if (gnLastError != SCARD_S_SUCCESS)
                        XSRETURN_UNDEF;
  
+               if (dwActiveProtocol == -1) {
+                       XSRETURN_UNDEF;
+               }
                /* If anything was successful, push the two scalar values */
                XPUSHs (sv_2mortal(newSViv(hCard)));
                XPUSHs (sv_2mortal(newSViv(dwActiveProtocol)));


Perhaps pcsc-lite/src/winscard.c should be modified, especially around line 223. 
cardProtocol has the value of -1 in the case described, and this section
is executed:
-------------------


        *pdwActiveProtocol = rContext->readerState->cardProtocol; 

        if ((*pdwActiveProtocol != SCARD_PROTOCOL_T0)
                && (*pdwActiveProtocol != SCARD_PROTOCOL_T1))
                DebugLogB("Active Protocol: unknown %d", *pdwActiveProtocol);
        else
                DebugLogB("Active Protocol: T=%d",
------------------


This causes the system to print "Active Protocol: unknown -1"
_______________________________________________
Muscle mailing list
[EMAIL PROTECTED]
http://lists.drizzle.com/mailman/listinfo/muscle

Reply via email to