2013/3/11 Ludovic Rousseau <[email protected]>:
> 2013/3/11 HARBI-ASSYSTEM Rachid (MORPHO) <[email protected]>:
>> Hi,
>
> Hello,
>
>> I am trying to send proprietary commands to a smart card reader through the
>> PC/SC SCardControl interface using the FEATURE_CCID_ESC_COMMAND feature.
>> What I noticed is that the Microsoft CCID driver supports time extension
>> requests in escape commands while the generic CCID driver libccid does not:
>> the CmdEscape() function in Drivers/ccid/src/commands.c only sets a static
>> timeout to 30 seconds since revision 3354.
>>
>>
>>
>> I know this feature is in the first place dedicated to the card for
>> notifying the host it needs more time to process the command but AFAIK the
>> CCID specifications
>> (http://www.usb.org/developers/devclass_docs/DWG_Smart-Card_CCID_Rev110.pdf)
>> do not forbid the utilization of time extension requests in RDR_to_PC_Escape
>> messages. And a way for smart card readers to notify they need extra time to
>> process a proprietary escape command is very useful.
>>
>>
>>
>> Is there a specific reason explaining that the Time Extension bit of bStatus
>> byte in RDR_to_PC_Escape messages is ignored?
>
> No specific reason. That is a missing feature.
> I just opened a new bug at [1] to not forget it.
>
> If you can provide a patch that would be great.
>
> Bye
>
> [1] 
> https://alioth.debian.org/tracker/index.php?func=detail&aid=314061&group_id=30105&atid=410088

Please try the attached patch and tell me if it fixes the problem.

Bye

-- 
 Dr. Ludovic Rousseau
Index: src/commands.c
===================================================================
--- src/commands.c      (révision 6565)
+++ src/commands.c      (copie de travail)
@@ -855,6 +855,8 @@ again:
                goto end;
        }
 
+time_request:
+       length_out = 10 + *RxLength;
        res = ReadPort(reader_index, &length_out, cmd_out);
 
        /* replay the command if NAK
@@ -885,6 +887,12 @@ again:
                goto end;
        }
 
+       if (cmd_out[STATUS_OFFSET] & CCID_TIME_EXTENSION)
+       {
+               DEBUG_COMM2("Time extension requested: 0x%02X", 
cmd_out[ERROR_OFFSET]);
+               goto time_request;
+       }
+
        if (cmd_out[STATUS_OFFSET] & CCID_COMMAND_FAILED)
        {
                ccid_error(cmd_out[ERROR_OFFSET], __FILE__, __LINE__, 
__FUNCTION__);    /* bError */
_______________________________________________
Muscle mailing list
[email protected]
http://lists.musclecard.com/mailman/listinfo/muscle_lists.musclecard.com

Reply via email to