I'm looking at the _ykusb_write()
function from the Yubikey-Personalization package and the first line of code executed is
int rc = usb_claim_interface((usb_dev_handle *)dev, 0);
Why is the zeroth USB interface claimed? From what I can tell from the lsusb
output (see below) that interface is an HID and not the smartcard itself. I would had expected the 2nd interface to be claimed instead, but I do not understand this part of Yubikey very well. Where is it documented? Thank you for your help.
bNumInterfaces 3
Interface Descriptor:
bInterfaceNumber 0
bInterfaceClass 3 Human Interface Device
bInterfaceSubClass 1 Boot Interface Subclass
bInterfaceProtocol 1 Keyboard
iInterface 0
Interface Descriptor:
bInterfaceNumber 1
bInterfaceClass 3 Human Interface Device
bInterfaceSubClass 0
bInterfaceProtocol 0
iInterface 0
Interface Descriptor:
bInterfaceNumber 2
bInterfaceClass 11 Chip/SmartCard
bInterfaceSubClass 0
bInterfaceProtocol 0
iInterface 0
ChipCard Interface Descriptor:
The YubiKey Personalization package referenced dates back to the YubiKey 1/2 models, which did not have CCID/Smart card support. The YubiKey 1/2 devices could only be communicated to via the HID keyboard interface, and identified to host devices as a USB keyboard. As such, the package attempts to connect to a YubiKey as if it was a keyboard.
The YubiKey Personalization package does not communicate over CCID/Smart card, but instead uses the HID keyboard interface. Yubico maintains this project as modern devices which support the touch-triggered OTP functions also can be programmed over the HID keyboard interface, and as such it remains useful for specific cases.