Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SetParameters(): return an error if there is no ICC present #30

Closed

Conversation

godfreychung
Copy link
Contributor

According to section 6.1.7 in CCID Spec Rev 1.1, there is no ICC present
if bError is ICC_MUTE and bmICCStatus is 2.

According to section 6.1.7 in CCID Spec Rev 1.1, there is no ICC present
if bError is ICC_MUTE and bmICCStatus is 2.
@LudovicRousseau
Copy link
Owner

Before your patch:
if the reader responds with Error = ICC_MUTE then SetParameters() returns IFD_COMMUNICATION_ERROR https://github.com/LudovicRousseau/CCID/blob/master/src/commands.c#L2288

After your patch:
if the reader responds with Error = ICC_MUTE and the card is present then SetParameters() returns IFD_SUCCESS
If no card is present then SetParameters() returns IFD_COMMUNICATION_ERROR (as before).

Am I correct?

Why do you want to return IFD_SUCCESS if PC_to_RDR_SetParameters fails because the card is mute? What is the use case?

@godfreychung
Copy link
Contributor Author

Yes, I tried to use memory cards on Windows/Linux. I can use the card properly on Windows but I can't connect the card on Linux. After debugging the driver, I found that SetParameters() failed on this condition and this condition is not counted as error in section 6.1.7 of CCID Spec.

@LudovicRousseau
Copy link
Owner

Can you copy/paste the part of CCID in 6.1.7 that says it is not an error?

@godfreychung
Copy link
Contributor Author

According to section 6.1.7 in CCID Spec (page 34),

The response to this message is the RDR_to_PC_Parameters message.
RDR_to_PC_Parameters could return any of the following errors.

bmICCStatus bmCommandStatus bError Description
2 1 5 bSlot does not exist
2 1 ICC_MUTE No ICC present
1 1 BUSY_WITH_AUTO_SEQUENCE Automatic sequence on-going
1 1 HW_ERROR Hardware error
0 1 0 Command not Supported
0,1,2 1 CMD_SLOT_BUSY
0 1 7 Protocol invalid or not supported
0 1 10 FI – DI pair invalid or not supported
0 1 11 Invalid TCCKTS parameter
0 1 12 Guard time not supported
0 1 13 T = 0 WI invalid or not supported T = 1 BWI or CWI invalid or not supported
0 1 14 Clock stop support requested invalid or not supported
0 1 15 IFSC size invalid or not supported
0 1 16 NAD value invalid or not supported

It does not include the following error:

bmICCStatus bmCommandStatus bError Description
0,1 1 ICC_MUTE ICC mute (Time out)

@LudovicRousseau
Copy link
Owner

I agree, the error returned in your case is not listed in the possible error cases.
This could indicate:

  • the error is not an error (as you suggest)
    or
  • the error is not valid and should never be returned

My CCID driver does not support memory cards. I don't think these cards are supported by the CCID specification.
So I guess the change is only for the ACS driver. Is it possible to have the change in your ACS driver only and not in the upstream CCID driver?

@godfreychung
Copy link
Contributor Author

Yes, it seems that the modification is not appropriate and I will use other ways to solve the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants