macOS Sonoma: The reader name should include the USB serial number

This is part of the series: macOS Sonoma and smart cards: known bugs.

If you have two identical smart card readers connected then it is hard to differentiate the readers.

See also

I reported this idea of improvement to Apple as FB13274416 "The reader name should include the USB serial number".

Example

For example I have 2 Gemalto ID Bridge CT 30 readers.

/images/2023/10/readersLow.png

I will use the tool pcsc_scan from pcsc-tools as this application works fine and is available for the 3 major plateforms.

On macOS Sonoma, I connect one reader and the PC/SC name is Gemalto USB SmartCard Reader. I connect the second reader and the PC/SC name is Gemalto USB SmartCard Reader 01.

The only difference is the 01 appended to the second reader name.

rousseau@MacBook-Pro-de-Ludovic pcsc-tools-1.7.0 % ./pcsc_scan
PC/SC device scanner
V 1.7.0 (c) 2001-2022, Ludovic Rousseau <ludovic.rousseau@free.fr>
Plug'n play reader name not supported. Using polling every 3600000 ms.
Scanning present readers...
Waiting for the first reader... found one
Scanning present readers...
0: Gemalto USB SmartCard Reader

Fri Oct 13 15:55:38 2023
 Reader 0: Gemalto USB SmartCard Reader
  Event number: 0
  Card state: Card removed,
 Scanning present readers...
0: Gemalto USB SmartCard Reader 01
1: Gemalto USB SmartCard Reader

Fri Oct 13 15:55:44 2023
 Reader 0: Gemalto USB SmartCard Reader 01
  Event number: 0
  Card state: Card removed,
 Reader 1: Gemalto USB SmartCard Reader
  Event number: 0
  Card state: Card removed,

Screenshot (with nice colors):

screenshot of the pcsc_scan command on Sonoma

The reader (re)ordering is also visible if you insert a smart card in the first reader. You have:

rousseau@MacBook-Pro-de-Ludovic pcsc-tools-1.7.0 % ./pcsc_scan
PC/SC device scanner
V 1.7.0 (c) 2001-2022, Ludovic Rousseau <ludovic.rousseau@free.fr>
Plug'n play reader name not supported. Using polling every 3600000 ms.
Scanning present readers...
Waiting for the first reader... found one
Scanning present readers...
0: Gemalto USB SmartCard Reader

Fri Oct 13 15:58:55 2023
 Reader 0: Gemalto USB SmartCard Reader
  Event number: 0
  Card state: Card inserted,
  ATR: 3B 6F 00 00 80 5A 28 13 02 10 12 2B 75 0D D3 82 82 90 00
 Scanning present readers...
0: Gemalto USB SmartCard Reader 01
1: Gemalto USB SmartCard Reader

Fri Oct 13 15:58:58 2023
 Reader 0: Gemalto USB SmartCard Reader 01
  Event number: 0
  Card state: Card removed,
 Reader 1: Gemalto USB SmartCard Reader
  Event number: 0
  Card state: Card inserted,
  ATR: 3B 6F 00 00 80 5A 28 13 02 10 12 2B 75 0D D3 82 82 90 00
rousseau@MacBook-Pro-de-Ludovic pcsc-tools-1.7.0 %

The smart card is inserted in the reader connected first. But after the second reader is connected the reader with the smart card inserted becomes the second reader in the list. This should not be problematic for applications but it is a bit surprising.

Windows

On Windows I get results very similar to macOS.

PS C:\Users\Ludovic\Downloads> .\pcsc_scan.exe
PC/SC device scanner
V 1.7.0 (c) 2001-2022, Ludovic Rousseau <ludovic.rousseau@free.fr>
Press shift key to quit
Using reader plug'n play mechanism
Scanning present readers...
Waiting for the first reader... found one
Scanning present readers...
0: Gemalto USB Smart Card Reader 0

Sat Oct 14 10:59:42 2023
 Reader 0: Gemalto USB Smart Card Reader 0
  Event number: 0
  Card state: Card removed,
 Reader 1: \\?PnP?\Notification
  Event number: 1
  Card state:
 Scanning present readers...
0: Gemalto USB Smart Card Reader 0
1: Gemalto USB Smart Card Reader 1

Sat Oct 14 10:59:44 2023
 Reader 0: Gemalto USB Smart Card Reader 0
  Event number: 0
  Card state: Card removed,
 Reader 1: Gemalto USB Smart Card Reader 1
  Event number: 0
  Card state: Card removed,
 Reader 2: \\?PnP?\Notification
  Event number: 2
  Card state:
PS C:\Users\Ludovic\Downloads>

The first reader name is Gemalto USB Smart Card Reader 0. The second reader name is Gemalto USB Smart Card Reader 1.

Screenshot:

screenshot of the pcsc_scan command on Windows

GNU/Linux

On GNU/Linux I get:

[rousseau:~/Documents/sc/pcsc-tools] master* 2s ± ./pcsc_scan
PC/SC device scanner
V 1.7.0 (c) 2001-2022, Ludovic Rousseau <ludovic.rousseau@free.fr>
Using reader plug'n play mechanism
Scanning present readers...
Waiting for the first reader... found one
Scanning present readers...
0: Gemalto PC Twin Reader (F8345B4A) 00 00

Fri Oct 13 11:46:11 2023
 Reader 0: Gemalto PC Twin Reader (F8345B4A) 00 00
  Event number: 0
  Card state: Card removed,
 Scanning present readers...
0: Gemalto PC Twin Reader (F8345B4A) 00 00
1: Gemalto PC Twin Reader (70D7E2EE) 01 00

Fri Oct 13 11:46:15 2023
 Reader 0: Gemalto PC Twin Reader (F8345B4A) 00 00
  Event number: 0
  Card state: Card removed,
 Reader 1: Gemalto PC Twin Reader (70D7E2EE) 01 00
  Event number: 0
  Card state: Card removed,

Here the PC/SC reader name includes an hexadecimal number (F8345B4A or 70D7E2EE). This number is the USB device serial number.

Screenshot:

screenshot of the pcsc_scan command on GNU/Linux

So even if you change the order to connect the readers you will always have one reader name containing F8345B4A and the other reader name containing 70D7E2EE. You have a link between a physical reader and a PC/SC reader name.

USB serial number

The USB serial number is visible on macOS using the system_profiler command.

rousseau@MacBook-Pro-de-Ludovic ~ % system_profiler SPUSBDataType
USB:

        USB 3.1 Bus:

          Host Controller Driver: AppleT8103USBXHCI

                USB SmartCard Reader:

                  Product ID: 0x3437
                  Vendor ID: 0x08e6  (Gemalto SA)
                  Version: 2.01
                  Serial Number: F8345B4A
                  Speed: Up to 12 Mb/s
                  Manufacturer: Gemalto
                  Location ID: 0x00100000 / 1
                  Current Available (mA): 500
                  Current Required (mA): 50
                  Extra Operating Current (mA): 0

        USB 3.1 Bus:

          Host Controller Driver: AppleT8103USBXHCI

                USB SmartCard Reader:

                  Product ID: 0x3437
                  Vendor ID: 0x08e6  (Gemalto SA)
                  Version: 2.00
                  Serial Number: 70D7E2EE
                  Speed: Up to 12 Mb/s
                  Manufacturer: Gemalto
                  Location ID: 0x01100000 / 1
                  Current Available (mA): 500
                  Current Required (mA): 50
                  Extra Operating Current (mA): 0

Not all USB devices have a serial number.

For example with an older model of the same reader I have:

rousseau@MacBook-Pro-de-Ludovic ~ % system_profiler SPUSBDataType
USB:

        USB 3.1 Bus:

          Host Controller Driver: AppleT8103USBXHCI

                USB SmartCard Reader:

                  Product ID: 0x3437
                  Vendor ID: 0x08e6  (Gemalto SA)
                  Version: 1.00
                  Speed: Up to 12 Mb/s
                  Manufacturer: Gemplus
                  Location ID: 0x00100000 / 1
                  Current Available (mA): 500
                  Current Required (mA): 200
                  Extra Operating Current (mA): 0

No "Serial Number:" field is displayed.

My proposal to add the USB serial number in the PC/SC name will not work with all the smart card readers. But at least it will be usable with the USB devices providing the serial number.

Conclusion

It is not a bug in macOS Sonoma. It is not a regression compared to the previous macOS version, or compared to Windows.

But it would be nice to be have a strong link between a physical smart card reader and the corresponding PC/SC reader name.

See also What is in a PC/SC reader name? to know how a PC/SC reader name is generated by pcsc-lite on GNU/Linux.