All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Hongren (Zenithal) Zheng" <i@zenithal.me>
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: qemu-devel@nongnu.org, contact@canokeys.org,
	MkfsSion <myychina28759@gmail.com>
Subject: [PATCH v2 1/3] hw/usb/canokey: Fix CCID ZLP
Date: Mon, 13 Jun 2022 20:14:19 +0800	[thread overview]
Message-ID: <YqcqGz0s3+LE42ms@Sun> (raw)
In-Reply-To: <YqcptnhfCtUn2+T6@Sun>

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>
---
 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 4a08b1cbd7..86548923eb 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.35.1



  reply	other threads:[~2022-06-13 12:42 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-13 12:12 [PATCH v2 0/3] CanoKey: Fix xHCI compatibility and CCID ZLP Hongren (Zenithal) Zheng
2022-06-13 12:14 ` Hongren (Zenithal) Zheng [this message]
2022-06-13 12:15 ` [PATCH v2 2/3] hw/usb/canokey: fix compatibility of qemu-xhci Hongren (Zenithal) Zheng
2022-06-13 12:15 ` [PATCH v2 3/3] docs/system/devices/usb/canokey: remove limitations on qemu-xhci Hongren (Zenithal) Zheng
2022-06-23 15:16 ` [PATCH v2 0/3] CanoKey: Fix xHCI compatibility and CCID ZLP Hongren (Zenithal) Zheng
2022-06-23 16:21   ` Hongren (Zenithal) Zheng
2022-07-01 10:51   ` Gerd Hoffmann
2022-07-02 10:58     ` Hongren (Zenithal) Zheng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YqcqGz0s3+LE42ms@Sun \
    --to=i@zenithal.me \
    --cc=contact@canokeys.org \
    --cc=kraxel@redhat.com \
    --cc=myychina28759@gmail.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.