shithub: plan9front

Download patch

ref: a398a097831f619fbebf064134b8931cb24ca051
parent: fcc93463a3e2fec9738330b1d82a11b077c96315
author: Romano <unobe@cpan.org>
date: Thu Apr 1 06:54:08 EDT 2021

[9front] [patch] nusb/ether -t rndis

--- a/sys/man/4/nusb	Wed Mar 31 11:50:25 2021
+++ b/sys/man/4/nusb	Thu Apr  1 06:54:08 2021
@@ -60,7 +60,7 @@
 .I usbd
 take the decimal usb 
 .I devid
-of the device they should handle as ther last argument. A
+of the device they should handle as their last argument. A
 driver's instance handles only one device at a time.
 .PP
 Drivers that provide file systems make them available as shares under
@@ -181,6 +181,9 @@
 such as
 .BR rndis ,
 .BR smsc ,
+.BR url ,
+.BR lan78xx ,
+.BR aue ,
 .BR a88772
 or
 .BR a88178
--- a/sys/src/9/boot/nusbrc	Wed Mar 31 11:50:25 2021
+++ b/sys/src/9/boot/nusbrc	Thu Apr  1 06:54:08 2021
@@ -34,8 +34,11 @@
 			case *03
 				nusb/kb $id
 			case *02
-				# CDC ethernet
-				nusb/ether $etherargs $id
+				# RNDIS, otherwise CDC ethernet
+				if(~ $4 ff0202)
+					nusb/ether -t rndis $etherargs $id
+				if not
+					nusb/ether $etherargs $id
 			case *08
 				if(nusb/disk $id) @{
 					rfork ne
--- a/sys/src/cmd/nusb/ether/rndis.c	Wed Mar 31 11:50:25 2021
+++ b/sys/src/cmd/nusb/ether/rndis.c	Thu Apr  1 06:54:08 2021
@@ -118,7 +118,8 @@
 	for(i = 0; i < nelem(d->usb->ep); i++){
 		if((ep = d->usb->ep[i]) == nil)
 			continue;
-		if(ep->iface->csp == 0x000301e0)
+		// ff0202 is canonical CSP per Linux kernel; 301e0 used by Nexus 5
+		if(ep->iface->csp == 0xff0202 || ep->iface->csp == 0x000301e0)
 			r = 1;
 	}
 	if(!r){