2

I have two readers (HID OMNIKEY 5321) in system (every reader performs a different function)

  • reader 1 - "Smart Card Reader 0"
  • reader 2 - "Smart Card Reader 1"

In my program is set up that

  • "Smart Card Reader 0" - action 1
  • "Smart Card Reader 1" - action 2

but sometimes (without rebooting, perhaps lost contact)

  • reader 1 gets name "Smart Card Reader 1"
  • reader 2 gets name "Smart Card Reader 0"

and the program does not do what users need. I use SCardGetStatusChange (requires the name of the reader) in WinScard.dll

What to do? Is there a way to change the name of the reader (firmware, drivers...)? Is it possible to use the serial number of the reader?

I also looked, but no result Smartcard reader naming: when removing any reader, the name of the rest changes How are PCSC smart card reader 'friendly names' constructed?

Community
  • 1
  • 1
Yuriy
  • 131
  • 11

2 Answers2

3

found a solution Getting PCSC reader serial number with WinSCard

serial number reader

...
SCardConnect(hContext, readerName, SCARD_SHARE_DIRECT, SCARD_PROTOCOL_UNDEFINED, ref hCard, ref protocol);
SCardGetAttrib(hCard, SCARD_ATTR_VENDOR_IFD_SERIAL_NO, receiveBuffer, ref receivebufferLen);
...
Community
  • 1
  • 1
Yuriy
  • 131
  • 11
  • Would have been nice if you had included the variable declarations so we know what you are sending and expecting back. I have an idea but don't want to get it wrong. – user692942 Jan 09 '15 at 15:53
  • Thank you for posting it, @Yuriy -- just used it in my code. – tsul Mar 05 '16 at 17:49
0

Maybe you should focus on the smartcard inserted in / connected to the reader rather than the reader itself and use card specific information (i.e. serial number or label) to choose the correct reader.

jariq
  • 11,681
  • 3
  • 33
  • 52
  • My application is designed for wakeboarding cable park. Each client has one card. action 1 - electronic queue, action 2 - start/stop – Yuriy Jul 07 '14 at 20:32
  • Different location. Reader 1 - starting area. Reader 2 - front of the screen (electronic queue) – Yuriy Jul 08 '14 at 07:36