Smart card reader emulator not working

Hi guys,

I’m working on an USB smart card emulator through a dev board and am trying to implement a CCID compliant firmware.

However, I am having a weird response from the CCID host driver (Windows XP). Just after enumeration, the Event Viewer logs the following message:

Smart Card Reader ‘CCID Demo 0’ rejected IOCTL GET_STATE: The device has been removed.

And of course I can’t connect to this virtual smart card reader. The following message is reported when I try to do so:

Try to connect to: CCID Demo 0
Unable to connect error n. 0x80100069:
The smart card has been removed, so that further communication is not possible.

The dev board has a crystal clock of 20MHz and I am setting the baud rate to 115200, but am not sure if this has something to do with why usbccid.sys stops communicating with the board just after enumeration.

Just wonder if any good soul here could give me a little hand to solve this. The following is my CCID class specific descriptor:

0x36, // (bLength*) Size of this description
0x21, // (bDescriptorType*) Description type
0x0110, // (bcdCCID*) Specification Release Number in BCD
0x00, // (bMaxSlotIndex*)
0x01, // (bVoltageSupport) 01h indicates 5.0 volts
0x01, 0x00, 0x00, 0x00, // (dwProtocols*)
0x20, 0x4E, 0x00, 0x00, // dwDefaultClock (20Mhz given in Khz)
0x20, 0x4E, 0x00, 0x00, // dwMaximumClock (20Mhz given in Khz)
0x00, // bNumClockSupported => no manual setting
0x00, 0xC2, 0x01, 0x00, // (115200) dwDataRate, 1C200h
0x00, 0xC2, 0x01, 0x00, // (115200) dwMaxDataRate, 1C200h
0x00, // bNumDataRatesSupported
0x00, 0x00, 0x00, 0x00, // dwMaxIFSD (for T1 this should be 254 (0xFE)
0x00, 0x00, 0x00, 0x00, // dwSynchProtocols
0x00, 0x00, 0x00, 0x00, // dwMechanical
0x3E, 0x00, 0x00, 0x00, // dwFeatures
0x0F, 0x01, 0x00, 0x00, // dwMaxCCIDMessageLength (271 is 0x010F)
0xFF, // bClassGetResponse
0xFF, // bClassEnvelope
0x00, 0x00, // wLcdLayout
0x00, // bPINSupport
0x01 // bMaxCCIDBusySlots

Thanks a lot.

Did you look at the URB and their associated payloads that the ccid driver is sending? I would bet that one of these is failing on reading from an endpoint and that should give you a pretty good clue as to what is going wrong.

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@hotmail.com
Sent: Sunday, November 09, 2008 7:16 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Smart card reader emulator not working

Hi guys,

I’m working on an USB smart card emulator through a dev board and am trying to implement a CCID compliant firmware.

However, I am having a weird response from the CCID host driver (Windows XP). Just after enumeration, the Event Viewer logs the following message:

Smart Card Reader ‘CCID Demo 0’ rejected IOCTL GET_STATE: The device has been removed.

And of course I can’t connect to this virtual smart card reader. The following message is reported when I try to do so:

Try to connect to: CCID Demo 0
Unable to connect error n. 0x80100069:
The smart card has been removed, so that further communication is not possible.

The dev board has a crystal clock of 20MHz and I am setting the baud rate to 115200, but am not sure if this has something to do with why usbccid.sys stops communicating with the board just after enumeration.

Just wonder if any good soul here could give me a little hand to solve this. The following is my CCID class specific descriptor:

0x36, // (bLength*) Size of this description
0x21, // (bDescriptorType*) Description type
0x0110, // (bcdCCID*) Specification Release Number in BCD
0x00, // (bMaxSlotIndex*)
0x01, // (bVoltageSupport) 01h indicates 5.0 volts
0x01, 0x00, 0x00, 0x00, // (dwProtocols*)
0x20, 0x4E, 0x00, 0x00, // dwDefaultClock (20Mhz given in Khz)
0x20, 0x4E, 0x00, 0x00, // dwMaximumClock (20Mhz given in Khz)
0x00, // bNumClockSupported => no manual setting
0x00, 0xC2, 0x01, 0x00, // (115200) dwDataRate, 1C200h
0x00, 0xC2, 0x01, 0x00, // (115200) dwMaxDataRate, 1C200h
0x00, // bNumDataRatesSupported
0x00, 0x00, 0x00, 0x00, // dwMaxIFSD (for T1 this should be 254 (0xFE)
0x00, 0x00, 0x00, 0x00, // dwSynchProtocols
0x00, 0x00, 0x00, 0x00, // dwMechanical
0x3E, 0x00, 0x00, 0x00, // dwFeatures
0x0F, 0x01, 0x00, 0x00, // dwMaxCCIDMessageLength (271 is 0x010F)
0xFF, // bClassGetResponse
0xFF, // bClassEnvelope
0x00, 0x00, // wLcdLayout
0x00, // bPINSupport
0x01 // bMaxCCIDBusySlots

Thanks a lot.


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Thank you, Doron.

I have looked at the packets through a software analyzer, but am having a hard time interpreting the data. Do you think the default clock / baud rate could be the culprit? Do you see anything suspect in my definition of the CCID class?
I’m using two endpoints (1 in, 1 out) with no interrupt endpoint as I don’t care to report events to the host. Would that be a problem?

Thanks.
J

xxxxx@hotmail.com wrote:

I’m using two endpoints (1 in, 1 out) with no interrupt endpoint as I don’t care to report events to the host. Would that be a problem?

If you do not support insertion/removal, then the interrupt pipe is
optional.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

Thank you, Tim.

You confirmed what I thought.

J

I don’t remember the specifics of CCID, I am just giving you some pointers to investigate next. The format for the data on the URBs should be well known to you if you are simulating a USB device, look to see what URBs are coming down and not succeeding (if any)

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@hotmail.com
Sent: Tuesday, November 11, 2008 3:36 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Smart card reader emulator not working

Thank you, Doron.

I have looked at the packets through a software analyzer, but am having a hard time interpreting the data. Do you think the default clock / baud rate could be the culprit? Do you see anything suspect in my definition of the CCID class?
I’m using two endpoints (1 in, 1 out) with no interrupt endpoint as I don’t care to report events to the host. Would that be a problem?

Thanks.
J


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer