Smartcard Problem

All,

I’m developing a SmartCard Reader driver that is more or less based on pscr.
I’m currently testing on 32-bit, WinXP. The driver *seems* to work OK. I can
connect to it, query the ATR, select/read the master file, etc. During
testing I have a trace on all IOCTLs and all callbacks. If the system is
just sitting idel, I see the Resource Manager constantly reset the card,
power it down, and then reset it. A full trace from EvtEnterD0 to the point
where the system is sitting idel is shown below. Can anyone explain why the
constant resets/power down/resets?

TIA!

Trace:
EvtEnterD0 (0x1): ID-00 Card State. State: 0x4.
UpdateCardState (0x1): Report state change. Cur State: 0. Next State: 0x4.
ReportCardStateChange (0x1): No Notification IRP Available.
EvtDeviceControl (0x1): IoControlCode: 0x310008.
EvtDeviceControl (0x1): IoControlCode: 0x310008.
EvtDeviceControl (0x1): IoControlCode: 0x310008.
EvtDeviceControl (0x1): IoControlCode: 0x310008.
EvtDeviceControl (0x1): IoControlCode: 0x310028.
EvtDeviceControl (0x1): IoControlCode: 0x310038.
EvtDeviceControl (0x1): IoControlCode: 0x310004.
CardPwrCallback (0x1): Reset card.
CardPwrCallback (0x1): Card Present.
EvtDeviceControl (0x1): IoControlCode: 0x31000c.
SmCompletion: Request failed. IOCTL: 0x31000c. Status: 0xc00000bb.
EvtDeviceControl (0x1): IoControlCode: 0x310038.
EvtDeviceControl (0x1): IoControlCode: 0x310008.
EvtDeviceControl (0x1): IoControlCode: 0x31002c.
CardTrackingCallback (0x1): Queue notification IRP.
EvtDeviceControl (0x1): IoControlCode: 0x310004.
CardPwrCallback (0x1): Reset card.
CardPwrCallback (0x1): Power Down.
UpdateCardState (0x1): Report state change. Cur State: 0x6. Next State: 0x2.
EvtDeviceControl (0x1): IoControlCode: 0x310028.
EvtDeviceControl (0x1): IoControlCode: 0x310038.
EvtDeviceControl (0x1): IoControlCode: 0x310004.
CardPwrCallback (0x1): Reset card.
CardPwrCallback (0x1): Card Present.
EvtDeviceControl (0x1): IoControlCode: 0x310038.
EvtDeviceControl (0x1): IoControlCode: 0x310008.
EvtDeviceControl (0x1): IoControlCode: 0x31002c.
CardTrackingCallback (0x1): Queue notification IRP.

Hello Jimmy,

Verify how you change the status of the card present.
Because, with smclib, if card is not used the api send a powerOff command for unpower the card.

Use the readerCaps.currentState = SCARD_SWALLOWED and CardCaps.Protocol.Selected = SCARD_PROTOCOl_DEFAULT for powerOff IOCTL.

Regards,

Moulefrite