shithub: riscv

Download patch

ref: 9d49fcdb377f698366ba0bd7f45efd85a607652b
parent: e321b1b9d2dcaa3176608496b419eb5a079f51ba
author: cinap_lenrek <[email protected]>
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));