[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 5/8] hw/usb/canokey: Fix CCID ZLP
From: |
Gerd Hoffmann |
Subject: |
[PULL 5/8] hw/usb/canokey: Fix CCID ZLP |
Date: |
Mon, 4 Jul 2022 09:59:43 +0200 |
From: "Hongren (Zenithal) Zheng" <i@zenithal.me>
CCID could send zero-length packet (ZLP)
if we invoke two data_in, two packets would be concated
and we could not distinguish them.
The CANOKEY_EMU_EP_CTAPHID is imported from canokey-qemu.h
Reported-by: MkfsSion <myychina28759@gmail.com>
Signed-off-by: Hongren (Zenithal) Zheng <i@zenithal.me>
Message-Id: <YqcqGz0s3+LE42ms@Sun>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/usb/canokey.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/hw/usb/canokey.c b/hw/usb/canokey.c
index 4a08b1cbd776..86548923eb16 100644
--- a/hw/usb/canokey.c
+++ b/hw/usb/canokey.c
@@ -109,11 +109,10 @@ int canokey_emu_transmit(
* Note: this is a quirk for CanoKey CTAPHID
* because it calls multiple emu_transmit in one device_loop
* but w/o data_in it would stuck in device_loop
- * This has no side effect for CCID as it is strictly
- * OUT then IN transfer
- * However it has side effect for Control transfer
+ * This has side effect for CCID since CCID can send ZLP
+ * This also has side effect for Control transfer
*/
- if (ep_in != 0) {
+ if (ep_in == CANOKEY_EMU_EP_CTAPHID) {
canokey_emu_data_in(ep_in);
}
return 0;
--
2.36.1
- [PULL 0/8] Kraxel 20220704 patches, Gerd Hoffmann, 2022/07/04
- [PULL 1/8] Rename docs/specs/fw_cfg.txt to .rst, Gerd Hoffmann, 2022/07/04
- [PULL 7/8] docs/system/devices/usb/canokey: remove limitations on qemu-xhci, Gerd Hoffmann, 2022/07/04
- [PULL 2/8] Convert fw_cfg.rst to reStructuredText syntax, Gerd Hoffmann, 2022/07/04
- [PULL 6/8] hw/usb/canokey: fix compatibility of qemu-xhci, Gerd Hoffmann, 2022/07/04
- [PULL 3/8] ui/console: allow display device to be labeled with given id, Gerd Hoffmann, 2022/07/04
- [PULL 4/8] ui/cocoa: Fix clipboard text release, Gerd Hoffmann, 2022/07/04
- [PULL 5/8] hw/usb/canokey: Fix CCID ZLP,
Gerd Hoffmann <=
- [PULL 8/8] hw: canokey: Remove HS support as not compliant to the spec, Gerd Hoffmann, 2022/07/04
- Re: [PULL 0/8] Kraxel 20220704 patches, Richard Henderson, 2022/07/04