* [9front] [patch] nusb/ether followup to cs 8387
@ 2021-04-08 19:27 Romano
2021-04-08 19:51 ` cinap_lenrek
0 siblings, 1 reply; 4+ messages in thread
From: Romano @ 2021-04-08 19:27 UTC (permalink / raw)
To: 9front
[-- Attachment #1: Type: text/plain, Size: 215 bytes --]
Attached is a patch to address minor issues introduced by changset
8397, or when no ethernet exists at boot. If this should go to some
other mailing list (9front-bugs?), let me know, or if there are issues
with it.
[-- Attachment #2: Type: text/plain, Size: 1683 bytes --]
changeset: 8397:c13e74f20026
branch: mbp-2011
user: Romano <unobe@cpan.org>
date: Thu Apr 08 00:58:00 2021 -0700
summary: Don't attempt to load an ether interface if none exists. nusb/serial does not handle RNDIS CSP devices, so do not load those. follow-up doc fix for changeset 6370:8d9b9553c65c.
diff -r 5c114f6f0d21 -r c13e74f20026 rc/bin/cpurc
--- a/rc/bin/cpurc Thu Apr 08 00:49:59 2021 -0700
+++ b/rc/bin/cpurc Thu Apr 08 00:58:00 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 5c114f6f0d21 -r c13e74f20026 rc/bin/nusbrc
--- a/rc/bin/nusbrc Thu Apr 08 00:49:59 2021 -0700
+++ b/rc/bin/nusbrc Thu Apr 08 00:58:00 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 5c114f6f0d21 -r c13e74f20026 sys/src/cmd/nusb/ether/ether.c
--- a/sys/src/cmd/nusb/ether/ether.c Thu Apr 08 00:49:59 2021 -0700
+++ b/sys/src/cmd/nusb/ether/ether.c Thu Apr 08 00:58:00 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] 4+ messages in thread
* Re: [9front] [patch] nusb/ether followup to cs 8387
2021-04-08 19:27 [9front] [patch] nusb/ether followup to cs 8387 Romano
@ 2021-04-08 19:51 ` cinap_lenrek
2021-04-09 18:00 ` Romano
0 siblings, 1 reply; 4+ messages in thread
From: cinap_lenrek @ 2021-04-08 19:51 UTC (permalink / raw)
To: 9front
ok, but it nusbrc can be solved much simpler:
diff -r 4dfbef4fa4ac rc/bin/nusbrc
--- a/rc/bin/nusbrc Sat Apr 03 19:32:47 2021 +0200
+++ b/rc/bin/nusbrc Thu Apr 08 21:49:21 2021 +0200
@@ -13,6 +13,8 @@
switch($4){
case *01
nusb/audio $id
+ case ff0202
+ # RNDIS; handled by /sys/src/9/boot/nusbrc
case *02
# serial and ethernet
nusb/serial $id
it is not clear to me why the test -d is needed in cpurc.
you ust want to silence the error message from cat?
--
cinap
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [9front] [patch] nusb/ether followup to cs 8387
2021-04-08 19:51 ` cinap_lenrek
@ 2021-04-09 18:00 ` Romano
2021-04-10 12:12 ` cinap_lenrek
0 siblings, 1 reply; 4+ messages in thread
From: Romano @ 2021-04-09 18:00 UTC (permalink / raw)
To: 9front
On April 8, 2021 7:51:00 PM UTC, cinap_lenrek@felloff.net wrote:
>ok, but it nusbrc can be solved much simpler:
>
>diff -r 4dfbef4fa4ac rc/bin/nusbrc
>--- a/rc/bin/nusbrc Sat Apr 03 19:32:47 2021 +0200
>+++ b/rc/bin/nusbrc Thu Apr 08 21:49:21 2021 +0200
>@@ -13,6 +13,8 @@
> switch($4){
> case *01
> nusb/audio $id
>+ case ff0202
>+ # RNDIS; handled by /sys/src/9/boot/nusbrc
> case *02
> # serial and ethernet
> nusb/serial $id
Yes, that's better.
>it is not clear to me why the test -d is needed in cpurc.
>you ust want to silence the error message from cat?
Yes. I don't consider it an error to not have an ethernet interface at boot. If there's no ethernet interface, $ether will be '/net/ether*' because * won't expand. $ether/addr will not exist, because $ether is not a directory.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [9front] [patch] nusb/ether followup to cs 8387
2021-04-09 18:00 ` Romano
@ 2021-04-10 12:12 ` cinap_lenrek
0 siblings, 0 replies; 4+ messages in thread
From: cinap_lenrek @ 2021-04-10 12:12 UTC (permalink / raw)
To: 9front
> Yes. I don't consider it an error to not have an ethernet interface at boot.
> If there's no ethernet interface, $ether will be '/net/ether*' because * won't expand.
> $ether/addr will not exist, because $ether is not a directory.
ah, i see. i think in that case, it is faster to just redirect stderr to /dev/null.
--
cinap
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-04-10 12:21 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-08 19:27 [9front] [patch] nusb/ether followup to cs 8387 Romano
2021-04-08 19:51 ` cinap_lenrek
2021-04-09 18:00 ` Romano
2021-04-10 12:12 ` cinap_lenrek
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).