views:

181

answers:

1

Hello.

I am writting a smartcard application. This application connects card in reader and sometimes works with it. I need to watch when reader is no longer available (either card is ejected or reader is removed from USB).

Readers are watched using SCardGetStatusChangeA. This function requires reader name to watch.

I insert two readers with cards into USB slots. They are recognized as "USB Smart Card Reader 0" and "USB Smart Card Reader 1". I remove one reader. Windows says, "USB Smart Card Reader 1" is still connected. I insert it - again both available. Now I remove the second one. Windows still says "USB Smart Card Reader 1" is connected. And this is the problem because it should be "USB Smart Card Reader 0" which is still connected. Tracking routine can't watch reader because it's name is changed.

Is it a driver problem or XP smartcard subsystem problem? Driver used is USB CCID Compliant version 5.2.3790.1830 (VID 076B, PID A021), usbccid.sys.

+2  A: 

We ran into this problem on a project and handled it by iterating through each available reader and checking to see if a card is inserted in that reader. You will encounter this naming problem with several brands of usb readers.

My company has a product that lets you integrate smart cards with websites; one of our demos lists the smart card readers currently available and it might help you with testing different reader scenarios: https://cardboss.cometway.com/content.agent?page_name=GetReaders+Demo

Damien