shithub: front

Download patch

ref: bada582e187efc6514e4b2a518da0f9532c7da96
parent: ebf3e9067d2a56c3c2bb9f574d7767173601e983
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sun Nov 3 07:13:22 EST 2024

nusb/lib: do not retry port status requests

We want the hub to detect a failed hub as soon as possible,
to not delay device detaches.

--- a/sys/src/cmd/nusb/lib/dev.c
+++ b/sys/src/cmd/nusb/lib/dev.c
@@ -449,6 +449,13 @@
 			if(r == 0)
 				werrstr("no data from device");
 		}
+
+		/* don't retry GET_STATUS requests */
+		if(type == (Rd2h|Rclass|Rother)
+		&& req == Rgetstatus
+		&& value == 0)
+			break;
+
 		nerr++;
 		if(*err == 0)
 			rerrstr(err, sizeof(err));
--