git: 069662d05f73 - stable/12 - usb(4): Quirk for non-compliant USB devices.

From: Hans Petter Selasky <hselasky_at_FreeBSD.org>
Date: Sat, 03 Sep 2022 10:23:03 UTC
The branch stable/12 has been updated by hselasky:

URL: https://cgit.FreeBSD.org/src/commit/?id=069662d05f730453cd8968e237ba540840c6a163

commit 069662d05f730453cd8968e237ba540840c6a163
Author:     Hans Petter Selasky <hselasky@FreeBSD.org>
AuthorDate: 2022-08-27 06:50:51 +0000
Commit:     Hans Petter Selasky <hselasky@FreeBSD.org>
CommitDate: 2022-09-03 10:22:29 +0000

    usb(4): Quirk for non-compliant USB devices.
    
    Some non-compliant USB devices do not implement the
    clear endpoint halt feature. Silently ignore such
    failures, when they at least responded correctly
    passing up a valid STALL PID packet.
    
    Tested by:      Doug Ambrisko <ambrisko@ambrisko.com>
    Sponsored by:   NVIDIA Networking
    
    (cherry picked from commit 4e2d8cd3e29bc885567f61ff358f8c9459d621ce)
---
 sys/dev/usb/usb_request.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/sys/dev/usb/usb_request.c b/sys/dev/usb/usb_request.c
index 13117c0b9c77..cb05a8b6308a 100644
--- a/sys/dev/usb/usb_request.c
+++ b/sys/dev/usb/usb_request.c
@@ -314,6 +314,16 @@ tr_setup:
 		 */
 		if (usb_no_cs_fail)
 			goto tr_transferred;
+
+		/*
+		 * Some non-compliant USB devices do not implement the
+		 * clear endpoint halt feature. Silently ignore such
+		 * devices, when they at least respond correctly
+		 * passing up a valid STALL PID packet.
+		 */
+		if (error == USB_ERR_STALLED)
+			goto tr_transferred;
+
 		if (udev->clear_stall_errors == USB_CS_RESET_LIMIT)
 			goto tr_setup;