I'm currently doing some research and testing on multiple smart card reader identification to determine which reader is connected to which USB port.
Lets say that I plug in Reader A into USB port 1. By invoking SCardListReaders function, I retrieve the following friendly name:
- ACS ACR1281 1S Dual Reader PICC 0
Then I plug in another reader (Reader B) into USB port 2. Now I have 2 readers connected to the same PC. Invoking SCardListReaders will give me:
- ACS ACR1281 1S Dual Reader PICC 0
- ACS ACR1281 1S Dual Reader PICC 1
I'm aware of how these names are generated (How are PCSC smart card reader 'friendly names' constructed?) and I know that plugging in the readers in different sequence (plug in Reader B first then Reader A) will change the SCARD_ATTR_DEVICE_UNIT thus affecting the friendly names.
Based on the above scenario, how can I ensure that the PC will always automatically connect to PICC reader in USB port 1 regardless of its friendly name?
Any help will be much appreciated. Thank you.
来源:https://stackoverflow.com/questions/12401845/how-to-connect-to-smart-card-reader-based-on-its-usb-port-location