git: 9front

Download patch

ref: adcbe5802f9d95d87209c2a8e0e192166ce3fa1a
parent: 534201f2f9102445599622af4318571b91551719
author: cinap_lenrek <cinap_lenrek@rei2.9hal>
date: Wed Dec 31 20:34:55 EST 1969

nusb: handle sub hubs

--- a/sys/src/cmd/nusb/usbd/fns.h
+++ b/sys/src/cmd/nusb/usbd/fns.h
@@ -1,2 +1,3 @@
 int	startdev(Port*);
 void	work(void);
+Hub*	newhub(char *, Dev *);
--- a/sys/src/cmd/nusb/usbd/usbd.c
+++ b/sys/src/cmd/nusb/usbd/usbd.c
@@ -311,6 +311,17 @@
 		fprint(2, "okay what?\n");
 		return -1;
 	}
+	if(d->usb->class == Clhub){
+		/*
+		 * Hubs are handled directly by this process avoiding
+		 * concurrent operation so that at most one device
+		 * has the config address in use.
+		 * We cancel kernel debug for these eps. too chatty.
+		 */
+		if((p->hub = newhub(d->dir, d)) == nil)
+			return -1;
+		return 0;
+	}
 	close(d->dfd);
 	d->dfd = -1;
 	pushevent(formatdev(d));
--