9front - general discussion about 9front
 help / color / mirror / Atom feed
* [9front] [patch] nusb/ether -t rndis
@ 2021-04-01 10:46 Romano
  2021-04-01 10:56 ` Sigrid Solveig Haflínudóttir
  2021-04-01 12:17 ` Maurizio Boriani
  0 siblings, 2 replies; 6+ messages in thread
From: Romano @ 2021-04-01 10:46 UTC (permalink / raw)
  To: 9front

[-- Attachment #1: Type: text/plain, Size: 575 bytes --]

The attached patch fixes ethernet tethering to work with a PinePhone.

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/patch/?id=64e049102d3de3e61409cb6019403a9e689dfda6
mentions that the typical RNDIS is a variant of CDC ACM with CSP
0xff0202, so I added that and also noted that the existing value works
with Nexus 5 (as mentioned in the original commit).

I also updated the man page for nusb to fix a typo and to enumerate
the current list of supported types, and updated sys/src/9/boot/nusbrc
to automatically detect when an RNDIS device is connected.

[-- Attachment #2: Type: text/plain, Size: 1534 bytes --]

diff -r a62bc34fa4fa sys/man/4/nusb
--- a/sys/man/4/nusb	Wed Mar 31 17:50:25 2021 +0200
+++ b/sys/man/4/nusb	Thu Apr 01 10:14:27 2021 -0700
@@ -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
diff -r a62bc34fa4fa sys/src/9/boot/nusbrc
--- a/sys/src/9/boot/nusbrc	Wed Mar 31 17:50:25 2021 +0200
+++ b/sys/src/9/boot/nusbrc	Thu Apr 01 10:14:27 2021 -0700
@@ -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
diff -r a62bc34fa4fa sys/src/cmd/nusb/ether/rndis.c
--- a/sys/src/cmd/nusb/ether/rndis.c	Wed Mar 31 17:50:25 2021 +0200
+++ b/sys/src/cmd/nusb/ether/rndis.c	Thu Apr 01 10:14:27 2021 -0700
@@ -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){

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [9front] [patch] nusb/ether -t rndis
  2021-04-01 10:46 [9front] [patch] nusb/ether -t rndis Romano
@ 2021-04-01 10:56 ` Sigrid Solveig Haflínudóttir
  2021-04-01 12:17 ` Maurizio Boriani
  1 sibling, 0 replies; 6+ messages in thread
From: Sigrid Solveig Haflínudóttir @ 2021-04-01 10:56 UTC (permalink / raw)
  To: 9front

Quoth Romano <unobe@cpan.org>:
> The attached patch fixes ethernet tethering to work with a PinePhone.
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/patch/?id=64e049102d3de3e61409cb6019403a9e689dfda6
> mentions that the typical RNDIS is a variant of CDC ACM with CSP
> 0xff0202, so I added that and also noted that the existing value works
> with Nexus 5 (as mentioned in the original commit).
> 
> I also updated the man page for nusb to fix a typo and to enumerate
> the current list of supported types, and updated sys/src/9/boot/nusbrc
> to automatically detect when an RNDIS device is connected.

Thanks, applied.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [9front] [patch] nusb/ether -t rndis
  2021-04-01 10:46 [9front] [patch] nusb/ether -t rndis Romano
  2021-04-01 10:56 ` Sigrid Solveig Haflínudóttir
@ 2021-04-01 12:17 ` Maurizio Boriani
  2021-04-01 12:24   ` Sigrid Solveig Haflínudóttir
  1 sibling, 1 reply; 6+ messages in thread
From: Maurizio Boriani @ 2021-04-01 12:17 UTC (permalink / raw)
  To: 9front


Romano writes:

> The attached patch fixes ethernet tethering to work with a PinePhone.

mey be I've lost something... 9front works on PinePhone?


-- 
Maurizio Boriani 
PGP key: 0xCC0FBF8F

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [9front] [patch] nusb/ether -t rndis
  2021-04-01 12:17 ` Maurizio Boriani
@ 2021-04-01 12:24   ` Sigrid Solveig Haflínudóttir
  2021-04-01 15:38     ` Maurizio Boriani
  2021-04-01 18:53     ` Romano
  0 siblings, 2 replies; 6+ messages in thread
From: Sigrid Solveig Haflínudóttir @ 2021-04-01 12:24 UTC (permalink / raw)
  To: 9front

Quoth Maurizio Boriani <baux@boriani.cloud>:
> 
> Romano writes:
> 
> > The attached patch fixes ethernet tethering to work with a PinePhone.
> 
> mey be I've lost something... 9front works on PinePhone?

No. What works is connecting a PinePhone to a 9front machine via USB
and tethering using RNDIS.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [9front] [patch] nusb/ether -t rndis
  2021-04-01 12:24   ` Sigrid Solveig Haflínudóttir
@ 2021-04-01 15:38     ` Maurizio Boriani
  2021-04-01 18:53     ` Romano
  1 sibling, 0 replies; 6+ messages in thread
From: Maurizio Boriani @ 2021-04-01 15:38 UTC (permalink / raw)
  To: 9front


> Sigrid Solveig Haflínudóttir writes:
> > Quoth Maurizio Boriani <baux@boriani.cloud>:
> >> Romano writes:

> >> The attached patch fixes ethernet tethering to work with a PinePhone.

> > mey be I've lost something... 9front works on PinePhone?

> No. What works is connecting a PinePhone to a 9front machine via USB
> and tethering using RNDIS.

sadness... ;-) but that's interesting too, thank you :-)

-- 
Maurizio Boriani 
PGP key: 0xCC0FBF8F

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [9front] [patch] nusb/ether -t rndis
  2021-04-01 12:24   ` Sigrid Solveig Haflínudóttir
  2021-04-01 15:38     ` Maurizio Boriani
@ 2021-04-01 18:53     ` Romano
  1 sibling, 0 replies; 6+ messages in thread
From: Romano @ 2021-04-01 18:53 UTC (permalink / raw)
  To: 9front, Sigrid Solveig Haflínudóttir

drawterm on pinephone (postmarketos) works. I ended up using a keymapper utility to map the vol up and down buttons to middle and right click, and it's not as smooth as a real 3-button mouse, of course, but it does work. Ihaven't tested much beyond that. I can try to write up my steps and post to the wiki on a-b.xyz

Also, Sigrid, thanks for doing the initial rndis work! I had first tried to make the bcm ethernet on my macbook work, but wasn't getting far. I was encouraged by your native 9front setup so am trying to follow suit. I have an rpi4 running 9front, but I want something I can port around to do actual work on.

On April 1, 2021 12:24:45 PM UTC, "Sigrid Solveig Haflínudóttir" <ftrvxmtrx@gmail.com> wrote:
>Quoth Maurizio Boriani <baux@boriani.cloud>:
>> 
>> Romano writes:
>> 
>> > The attached patch fixes ethernet tethering to work with a
>PinePhone.
>> 
>> mey be I've lost something... 9front works on PinePhone?
>
>No. What works is connecting a PinePhone to a 9front machine via USB
>and tethering using RNDIS.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-04-02  9:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-01 10:46 [9front] [patch] nusb/ether -t rndis Romano
2021-04-01 10:56 ` Sigrid Solveig Haflínudóttir
2021-04-01 12:17 ` Maurizio Boriani
2021-04-01 12:24   ` Sigrid Solveig Haflínudóttir
2021-04-01 15:38     ` Maurizio Boriani
2021-04-01 18:53     ` 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).