Skip to contentSkip to conversation

hw: canokey: Remove HS support as not compliant to the spec

PATCH Superseded MkfsSion 2 participants 3 messages Jun 24, 2022

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

MkfsSion

author
#0 lore raw

PATCH v3 1/2 hw: canokey: Remove HS support as not compliant to the spec

Canokey core currently using 16 bytes as maximum packet size for control endpoint, but to run the device in high-speed a 64 bytes maximum packet size is required according to USB 2.0 specification. Since we don't acutally need to run the device in high-speed, simply don't assign high member in USBDesc.

When canokey-qemu is used with xhci, xhci would drive canokey in high speed mode, since the bcdUSB in canokey-core is 2.1, yet canokey-core set bMaxPacketSize0 to be 16, this is out of the spec as the spec said that ``The allowable maximum control transfer data payload sizes...for high-speed devices, it is 64 bytes''.

In this case, usb device validation in Windows 10 LTSC 2021 as the guest would fail. It would complain USB\DEVICE_DESCRIPTOR_VALIDATION_FAILURE.

Note that bcdUSB only identifies the spec version the device complies, but it has no indication of its speed. So it is allowed for the device to run in FS but comply the 2.1 spec.

To solve the issue we decided to just drop the high speed support. This only affects usb-ehci as usb-ehci would complain speed mismatch when FS device is attached to a HS port. That's why the .high member was initialized in the first place. Meanwhile, xhci is not affected as it works well with FS device. Since everyone is now using xhci, it does no harm to most users.

---
 hw/usb/canokey.c | 1 -
 1 file changed, 1 deletion(-)
hw/usb/canokey.c +0 -1
index 4a08b1cbd7..6a7ab965a5 100644
@@ -56,7 +56,6 @@ static const USBDesc desc_canokey = {
         .iSerialNumber     = STR_SERIALNUMBER,
     },
     .full = &desc_device_canokey,
-    .high = &desc_device_canokey,
     .str  = desc_strings,
 };
 
Signature · 1 line
2.36.1
author
#1 lore raw

PATCH v3 2/2 docs/system/devices/canokey: Document limitations on usb-ehci

---
 docs/system/devices/canokey.rst | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)
docs/system/devices/canokey.rst +3 -9
index 169f99b8eb..650702ad8a 100644
@@ -146,15 +146,9 @@ multiple CanoKey QEMU running, namely you can not
 Also, there is no lock on canokey-file, thus two CanoKey QEMU instance
 can not read one canokey-file at the same time.
 
-Another limitation is that this device is not compatible with ``qemu-xhci``,
-in that this device would hang when there are FIDO2 packets (traffic on
-interrupt endpoints). If you do not use FIDO2 then it works as intended,
-but for full functionality you should use old uhci/ehci bus and attach canokey
-to it, for example
-
-.. parsed-literal::
-
-   |qemu_system| -device piix3-usb-uhci,id=uhci -device canokey,bus=uhci.0
+Another limitation is that this device is not compatible with ``usb-ehci``
+since we removed high-speed mode support. When a full-speed device attach
+to a high-speed port, ``usb-ehci`` would complain about speed mismatch.
 
 References
 ==========
Signature · 1 line
2.36.1
#2 lore raw

Re: [PATCH v3 2/2] docs/system/devices/canokey: Document limitations on usb-ehci

docs/system/devices/canokey.rst multiple CanoKey QEMU running, namely you can not · line 157

Quoted 10 lines · MkfsSion
docs/system/devices/canokey.rst +0 -9
-Another limitation is that this device is not compatible with ``qemu-xhci``,
-in that this device would hang when there are FIDO2 packets (traffic on
-interrupt endpoints). If you do not use FIDO2 then it works as intended,
-but for full functionality you should use old uhci/ehci bus and attach canokey
-to it, for example
-
-.. parsed-literal::
-
-   |qemu_system| -device piix3-usb-uhci,id=uhci -device canokey,bus=uhci.0

Hi, the fix for the limitation on qemu-xhci has not been landed and should not be removed by this patch.

docs/system/devices/canokey.rst multiple CanoKey QEMU running, namely you can not · line 151

Quoted 3 lines
docs/system/devices/canokey.rst +3 -0
+Another limitation is that this device is not compatible with ``usb-ehci``
+since we removed high-speed mode support. When a full-speed device attach
+to a high-speed port, ``usb-ehci`` would complain about speed mismatch.

I think we could rephrase the limitation here. Instead of saying "we removed the high-speed mode", how about saying "this device only provides the full-speed mode".

Also you should list the changes between two PATCH versions below the --- line just after your commit message so the mailing list can track what happened.

Regards,

Hongren