* [9front] [patch] nusb/serial: rndis handled by nusbrc
@ 2021-04-07 7:49 Romano
0 siblings, 0 replies; 2+ messages in thread
From: Romano @ 2021-04-07 7:49 UTC (permalink / raw)
To: 9front
[-- Attachment #1: Type: text/plain, Size: 544 bytes --]
See attached.
These changes keep nusb/serial from attempting to use an RNDIS
endpoint. Without this patch, nusb/serial will generate an error
like:
nusb/serial: getdev: '/dev/usb/ep17.0/data' device or object already in use
when an RNDIS endpoint has already been found (e.g., a pinephone usb
tether). I had unfortunately overlooked this part when I submitting
my previous patch for nusb/ether.
Additionally, if there is no ethernet on boot, don't attempt to look
for an address.
The last bit is just updating a comment to match the code.
[-- Attachment #2: nusb.patch --]
[-- Type: text/plain, Size: 1311 bytes --]
diff -r 18e1e1c3aaf1 rc/bin/cpurc
--- a/rc/bin/cpurc Tue Apr 06 14:43:38 2021 +0200
+++ b/rc/bin/cpurc Wed Apr 07 00:39:55 2021 -0700
@@ -59,7 +59,8 @@
addrs=`{ndb/query -a sys $sysname ether}
if(! ~ $#addrs 0){
for(ether in /net/ether*){
- addr=`{cat $ether/addr}
+ if (test -d $ether)
+ addr=`{cat $ether/addr}
switch($addr){
case $addrs
# try /lib/ndb first, then do dhcp/slaac
diff -r 18e1e1c3aaf1 rc/bin/nusbrc
--- a/rc/bin/nusbrc Tue Apr 06 14:43:38 2021 +0200
+++ b/rc/bin/nusbrc Wed Apr 07 00:39:55 2021 -0700
@@ -14,8 +14,9 @@
case *01
nusb/audio $id
case *02
- # serial and ethernet
- nusb/serial $id
+ # serial and ethernet: 0xff0202 is RNDIS, handled by nusbrc
+ if (! ~ $4 ff0202)
+ nusb/serial $id
# handled /sys/src/9/boot/nusbrc
# nusb/ether $id
case *03
diff -r 18e1e1c3aaf1 sys/src/cmd/nusb/ether/ether.c
--- a/sys/src/cmd/nusb/ether/ether.c Tue Apr 06 14:43:38 2021 +0200
+++ b/sys/src/cmd/nusb/ether/ether.c Wed Apr 07 00:39:55 2021 -0700
@@ -849,7 +849,7 @@
nerr = 0;
for(;;){
- /* receive allocates buffer and calls etheriq(b, 1); */
+ /* receive allocates buffer and calls etheriq(b); */
if((*epreceive)(epin) < 0){
rerrstr(err, sizeof(err));
if(strstr(err, "interrupted") || strstr(err, "timed out"))
^ permalink raw reply [flat|nested] 2+ messages in thread
* [9front] [patch] nusb/serial: rndis handled by nusbrc
@ 2021-04-07 7:50 Romano
0 siblings, 0 replies; 2+ messages in thread
From: Romano @ 2021-04-07 7:50 UTC (permalink / raw)
To: 9front
[-- Attachment #1: Type: text/plain, Size: 544 bytes --]
See attached.
These changes keep nusb/serial from attempting to use an RNDIS
endpoint. Without this patch, nusb/serial will generate an error
like:
nusb/serial: getdev: '/dev/usb/ep17.0/data' device or object already in use
when an RNDIS endpoint has already been found (e.g., a pinephone usb
tether). I had unfortunately overlooked this part when I submitting
my previous patch for nusb/ether.
Additionally, if there is no ethernet on boot, don't attempt to look
for an address.
The last bit is just updating a comment to match the code.
[-- Attachment #2: nusb.patch --]
[-- Type: text/plain, Size: 1311 bytes --]
diff -r 18e1e1c3aaf1 rc/bin/cpurc
--- a/rc/bin/cpurc Tue Apr 06 14:43:38 2021 +0200
+++ b/rc/bin/cpurc Wed Apr 07 00:39:55 2021 -0700
@@ -59,7 +59,8 @@
addrs=`{ndb/query -a sys $sysname ether}
if(! ~ $#addrs 0){
for(ether in /net/ether*){
- addr=`{cat $ether/addr}
+ if (test -d $ether)
+ addr=`{cat $ether/addr}
switch($addr){
case $addrs
# try /lib/ndb first, then do dhcp/slaac
diff -r 18e1e1c3aaf1 rc/bin/nusbrc
--- a/rc/bin/nusbrc Tue Apr 06 14:43:38 2021 +0200
+++ b/rc/bin/nusbrc Wed Apr 07 00:39:55 2021 -0700
@@ -14,8 +14,9 @@
case *01
nusb/audio $id
case *02
- # serial and ethernet
- nusb/serial $id
+ # serial and ethernet: 0xff0202 is RNDIS, handled by nusbrc
+ if (! ~ $4 ff0202)
+ nusb/serial $id
# handled /sys/src/9/boot/nusbrc
# nusb/ether $id
case *03
diff -r 18e1e1c3aaf1 sys/src/cmd/nusb/ether/ether.c
--- a/sys/src/cmd/nusb/ether/ether.c Tue Apr 06 14:43:38 2021 +0200
+++ b/sys/src/cmd/nusb/ether/ether.c Wed Apr 07 00:39:55 2021 -0700
@@ -849,7 +849,7 @@
nerr = 0;
for(;;){
- /* receive allocates buffer and calls etheriq(b, 1); */
+ /* receive allocates buffer and calls etheriq(b); */
if((*epreceive)(epin) < 0){
rerrstr(err, sizeof(err));
if(strstr(err, "interrupted") || strstr(err, "timed out"))
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-04-07 8:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-07 7:49 [9front] [patch] nusb/serial: rndis handled by nusbrc Romano
2021-04-07 7:50 Romano
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).