From: Thomas Huth <thuth@redhat.com>
To: qemu-devel@nongnu.org, Richard Henderson <richard.henderson@linaro.org>
Cc: Junjie Cao <junjie.cao@linux.dev>,
Peter Maydell <peter.maydell@linaro.org>
Subject: [PULL 3/5] usb-host: reset the open retry count after a successful open
Date: Mon, 2 Nov 2026 17:30:42 +0100 [thread overview]
Message-ID: <20261102163044.644663-4-thuth@redhat.com> (raw)
In-Reply-To: <20261102163044.644663-1-thuth@redhat.com>
From: Junjie Cao <junjie.cao@linux.dev>
usb_host_auto_check() gives up on a matching device once three opens
have failed, and clears the failure count only when a scan finds no
matching device at all. A device that re-enumerates, e.g. after a
firmware reboot, is closed on NO_DEVICE and usb_host_close() rescans at
once, while libusb still lists the old address: that open fails and
counts, the next 2 s scan opens the new address, and nothing clears the
count. After the third such cycle the device is skipped until a scan
finds it absent or the usb-host device is re-added.
Clear the count once an open succeeds. A device that cannot be opened at
all still stops after three attempts.
The source-level fixture attached to #4673 reproduces the same sequence;
its remaining cases expect a failure budget per enumerated device, which
this change does not add.
Fixes: 3ee886c5ba77 ("usb-host: limit open retries")
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/4631
Buglink: https://gitlab.com/qemu-project/qemu/-/issues/4673
Cc: qemu-stable@nongnu.org
Reported-by: Farid <fa1rid@live.com>
Reported-by: Prateek Rungta <https://gitlab.com/prateek2>
Suggested-by: Farid <fa1rid@live.com>
Signed-off-by: Junjie Cao <junjie.cao@linux.dev>
Message-ID: <20261028160727.780978-1-junjie.cao@linux.dev>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
hw/usb/host-libusb.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c
index 8f7ced95cfe..5a369e2ebf5 100644
--- a/hw/usb/host-libusb.c
+++ b/hw/usb/host-libusb.c
@@ -1924,6 +1924,7 @@ static void usb_host_auto_check(void *unused)
s->errcount++;
continue;
}
+ s->errcount = 0;
break;
}
}
--
2.56.0
next prev parent reply other threads:[~2026-11-02 16:31 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-02 16:30 [PULL 0/5] Misc patches before the v11.2 softfreeze Thomas Huth
2026-11-02 16:30 ` [PULL 1/5] tests: Add a target to run all tests in thorough mode Thomas Huth
2026-11-02 16:30 ` [PULL 2/5] hw/m68k/next-cube: Show deprecation notice to users Thomas Huth
2026-11-02 16:30 ` Thomas Huth [this message]
2026-11-02 16:30 ` [PULL 4/5] hw/usb/hcd-xhci: fail Address Device when the DCBAA entry is unreadable Thomas Huth
2026-11-02 16:30 ` [PULL 5/5] tests/qtest/usb-hcd-xhci: test Address Device with an unreadable DCBAA Thomas Huth
2026-11-03 15:24 ` [PULL 0/5] Misc patches before the v11.2 softfreeze Richard Henderson
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=20261102163044.644663-4-thuth@redhat.com \
--to=thuth@redhat.com \
--cc=junjie.cao@linux.dev \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.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.