Hello,
I’m developing a USB smart card device conforming to the 1.1 CCID specification, and I’m having some problems making the device work with the windows usbccid.sys driver.
I have a sample application on top of the driver that allows me to interact with a smart card device (send, get, reset commands).
This is the ATR that I return on power on:
0x3f, 0xfc, 0x13, 0x25, 0x02, 0x50, 0x00, 0x0f, 0x33, 0xb0, 0x08, 0xff, 0xff, 0x4a, 0x50, 0x90, 0x00, 0x00, 0x49, 0x4f.
And the CCID descriptor:
length = 0x36;
descriptor_type = 0x21;
release_number = 0x0100;
max_slot_index = 0;
voltage_support = 0x01;
protocols = 0x00000001;
default_clock = 0x000012c0;
maximum_clock = 0x000012c0;
num_clock_supported = 0x00;
data_rate = 0x00002580;
max_data_rate = 0x00002580;
num_data_rate_supported = 0x00;
max_ifsd = 0x000000FE;
sync_protocols = 0x00000000;
mechanical = 0;
desc->features = 0x0000003e;
(AUTOMATIC_PARAMETER_CONFIG
AUTOMATIC_ACTIVATION_ICC_ON_INSERTING
AUTOMATIC_ICC_VOLTAGE_SELECTION
AUTOMATIC_ICC_CLOCK_FREQ
AUTOMATIC_BAUD_RATE )
max_ccid_message_length = 0x0000010f;
class_get_response = 0xff;
class_envelope = 0xff;
lcd_layout = 0;
pin_support = 0;
max_ccid_busy_slots = 1;
When the device is attached, it gets power off, power on, to which I reply with the above ATR, Set parameters (11, 00, 02, 0f, 00) which I return, and set freq and baud rate with the only values that I specified in the descriptor, which I also return.
Now I can connect to the device with the sample application. I’m getting the ATR and the card status (inserted/not inserted), but as I try any command, I’m getting errors:
This is what I get when trying the send command : 48 72 00 00 01 data: aa
USB bus: The out transfer (xfer_block)is successful.
Then I’m getting the token from the host for the in transfer (data_block with data 90 00), and the device sends the data (which is correct), Now the host should ack the transfer (a USB ack), which it never does.
I’m getting the following errors in the event viewer:
Event
Type : Error
Source: USBCCID
Category: None
Event ID: 0
Description:
The description for Event ID ( 0 ) in Source ( USBCCID ) cannot be found. The local computer may not have the necessary registry information or message DLL files to display messages from a remote computer. You may be able to use the /AUXSOURCE= flag to retrieve this description; see Help and Support for details. The following information is part of the event: , IOCTL TRANSMIT failed with status 0xc0000001.
Data:
0000: 00 00 00 00 02 00 58 00 …X.
0008: 00 00 00 00 00 00 00 00 …
0010: 00 00 00 00 00 00 00 00 …
0018: 00 00 00 00 00 00 00 00 …
0020: 00 00 00 00 00 00 00 00 …
Event
Type: Error
Source: SCardSvr
Category: None
Event ID: 610
Description:
Smart Card Reader ‘Card 0’ rejected IOCTL TRANSMIT: A device attached to the system is not functioning.
I have another smart card, which is working fine with the driver, and the sample application. I’ve tried to emulate the exact same USB bus transfers with my device, but the windows driver sends me different set parameters command, and my reply does not satisfy it, and after 3 retries it stops trying and I cant connect to the device with the sample app. It seems that when I specify different baud rate and clock frequency, the windows driver is not happy with my reply to set parameters.
Can the windows class driver detect baud rate/clock frequency of the device over the USB?
I’m guessing that there are some inconsistencies with the ATR and/or ccid descriptor that I specify, that the windows driver finds not to its liking.
I have tried a different driver for ccid (Omnikey cardman), and by emulating the usb transfers of the Omnikey reader, I was able to use my device to send and get data.
I’m hoping that someone has some clue to the reason I’m getting errors from the usbccid driver.
Thanks,
Tamir.