shithub: misc

ref: f54501c2592bd7cee283a243391d07f2dd131373
dir: /9legacy/usb_uas_and_close_ep.diff/

View raw version
--- sys/src/cmd/usb/disk/disk.c	Wed Dec 14 00:35:47 2011
+++ /sys/src/cmd/usb/disk/disk.c	Sat Jun 19 11:45:37 2021
@@ -663,7 +663,7 @@
 			continue;
 		csp = ep->iface->csp;
 		sc = Subclass(csp);
-		if(!(Class(csp) == Clstorage && (Proto(csp) == Protobulk)))
+		if(!(Class(csp) == Clstorage && (Proto(csp) == Protobulk || Proto(csp) == Protouas)))
 			continue;
 		if(sc != Subatapi && sc != Sub8070 && sc != Subscsi)
 			fprint(2, "disk: subclass %#ulx not supported. trying anyway\n", sc);
--- sys/src/cmd/usb/disk/ums.h	Wed Feb 13 22:22:23 2013
+++ /sys/src/cmd/usb/disk/ums.h	Sat Jun 19 11:44:13 2021
@@ -13,6 +13,7 @@
 	Protocbi =	0,	/* control/bulk/interrupt; mainly floppies */
 	Protocb =	1,	/*   "  with no interrupt; mainly floppies */
 	Protobulk =	0x50,	/* bulk only */
+	Protouas =	0x62,	/* USB-attached SCSI */
 
 	Subrbc =	1,	/* reduced blk cmds */
 	Subatapi =	2,	/* cd/dvd using sff-8020i or mmc-2 cmd blks */
diff -uPr sys/src/9/bcm/devusb.c /sys/src/9/bcm/devusb.c
--- sys/src/9/bcm/devusb.c	Thu Jun 24 18:58:13 2021
+++ /sys/src/9/bcm/devusb.c	Sun Jun 13 17:21:28 2021
@@ -389,6 +389,10 @@
 		if(ep->ep0 != ep){
 			putep(ep->ep0);
 			ep->ep0 = nil;
+		} else if(d != nil){
+			if(d->free != nil)
+				(*d->free)(d->aux);
+			free(d);
 		}
 		free(ep->info);
 		free(ep->name);