Re: Remove NetChip from cdce

2019-11-14 Thread Stuart Henderson
On 2019/11/13 18:40, Aaron Bieber wrote:
> Hi,
> 
> I have a raspberry pi 0 that attaches as:
>   cdce0 at uhub0 port 3 configuration 2 interface 0 "Linux 4.19.75+ with \
> 2098.usb RNDIS/Ethernet Gadget" rev 2.00/4.19 addr 10
> 
> Unfortunately the cdce interface does not work with this particular device.
> 
> On the linux end, it turns out that cdc and rndis are being presented. When
> NetChip is removed from the cdce driver, urndis(4) picks up the slack and
> things work as expected! Linux also has the product id defined as RNDIS.
> 
> Debugged with patrick@ who is awesome and I now owe a beer or two for his
> help! :D
> 
> OK?

I agree with Patrick + this diff, we should remove the hardcoding for the
vid/pid and just match on USB class.

OK sthen@


> Cheers,
> Aaron
> 
> diff --git a/sys/dev/usb/if_cdce.c b/sys/dev/usb/if_cdce.c
> index abf0521ccd6..816bdc29c10 100644
> --- a/sys/dev/usb/if_cdce.c
> +++ b/sys/dev/usb/if_cdce.c
> @@ -100,7 +100,6 @@ const struct cdce_type cdce_devs[] = {
>  {{ USB_VENDOR_MOTOROLA2, USB_PRODUCT_MOTOROLA2_USBLAN }, CDCE_CRC32 },
>  {{ USB_VENDOR_MOTOROLA2, USB_PRODUCT_MOTOROLA2_USBLAN2 }, CDCE_CRC32 },
>  {{ USB_VENDOR_GMATE, USB_PRODUCT_GMATE_YP3X00 }, 0 },
> -{{ USB_VENDOR_NETCHIP, USB_PRODUCT_NETCHIP_ETHERNETGADGET }, 0 },
>  {{ USB_VENDOR_COMPAQ, USB_PRODUCT_COMPAQ_IPAQLINUX }, 0 },
>  {{ USB_VENDOR_AMBIT, USB_PRODUCT_AMBIT_NTL_250 }, CDCE_SWAPUNION },
>  };
> 
> -- 
> PGP: 0x1F81112D62A9ADCE / 3586 3350 BFEA C101 DB1A  4AF0 1F81 112D 62A9 ADCE
> 



Re: Remove NetChip from cdce

2019-11-13 Thread Patrick Wildt
On Wed, Nov 13, 2019 at 06:40:00PM -0700, Aaron Bieber wrote:
> Hi,
> 
> I have a raspberry pi 0 that attaches as:
>   cdce0 at uhub0 port 3 configuration 2 interface 0 "Linux 4.19.75+ with \
> 2098.usb RNDIS/Ethernet Gadget" rev 2.00/4.19 addr 10
> 
> Unfortunately the cdce interface does not work with this particular device.
> 
> On the linux end, it turns out that cdc and rndis are being presented. When
> NetChip is removed from the cdce driver, urndis(4) picks up the slack and
> things work as expected! Linux also has the product id defined as RNDIS.

The thing is that Linux provides multiple "configurations" (as in:
urndis(4), cdce(4), ...) over the same device.  Hardcoding this
combination of vendor/product id will make cdce(4) always attach,
even though the configuration is actually urndis(4).  In this case
Linux improved well enough so that our match function checking for
class/subclass should be the right thing to do.

Thus, ok patrick@

> Debugged with patrick@ who is awesome and I now owe a beer or two for his
> help! :D
> 
> OK?
> 
> Cheers,
> Aaron
> 
> diff --git a/sys/dev/usb/if_cdce.c b/sys/dev/usb/if_cdce.c
> index abf0521ccd6..816bdc29c10 100644
> --- a/sys/dev/usb/if_cdce.c
> +++ b/sys/dev/usb/if_cdce.c
> @@ -100,7 +100,6 @@ const struct cdce_type cdce_devs[] = {
>  {{ USB_VENDOR_MOTOROLA2, USB_PRODUCT_MOTOROLA2_USBLAN }, CDCE_CRC32 },
>  {{ USB_VENDOR_MOTOROLA2, USB_PRODUCT_MOTOROLA2_USBLAN2 }, CDCE_CRC32 },
>  {{ USB_VENDOR_GMATE, USB_PRODUCT_GMATE_YP3X00 }, 0 },
> -{{ USB_VENDOR_NETCHIP, USB_PRODUCT_NETCHIP_ETHERNETGADGET }, 0 },
>  {{ USB_VENDOR_COMPAQ, USB_PRODUCT_COMPAQ_IPAQLINUX }, 0 },
>  {{ USB_VENDOR_AMBIT, USB_PRODUCT_AMBIT_NTL_250 }, CDCE_SWAPUNION },
>  };
> 
> -- 
> PGP: 0x1F81112D62A9ADCE / 3586 3350 BFEA C101 DB1A  4AF0 1F81 112D 62A9 ADCE
> 



Remove NetChip from cdce

2019-11-13 Thread Aaron Bieber
Hi,

I have a raspberry pi 0 that attaches as:
  cdce0 at uhub0 port 3 configuration 2 interface 0 "Linux 4.19.75+ with \
2098.usb RNDIS/Ethernet Gadget" rev 2.00/4.19 addr 10

Unfortunately the cdce interface does not work with this particular device.

On the linux end, it turns out that cdc and rndis are being presented. When
NetChip is removed from the cdce driver, urndis(4) picks up the slack and
things work as expected! Linux also has the product id defined as RNDIS.

Debugged with patrick@ who is awesome and I now owe a beer or two for his
help! :D

OK?

Cheers,
Aaron

diff --git a/sys/dev/usb/if_cdce.c b/sys/dev/usb/if_cdce.c
index abf0521ccd6..816bdc29c10 100644
--- a/sys/dev/usb/if_cdce.c
+++ b/sys/dev/usb/if_cdce.c
@@ -100,7 +100,6 @@ const struct cdce_type cdce_devs[] = {
 {{ USB_VENDOR_MOTOROLA2, USB_PRODUCT_MOTOROLA2_USBLAN }, CDCE_CRC32 },
 {{ USB_VENDOR_MOTOROLA2, USB_PRODUCT_MOTOROLA2_USBLAN2 }, CDCE_CRC32 },
 {{ USB_VENDOR_GMATE, USB_PRODUCT_GMATE_YP3X00 }, 0 },
-{{ USB_VENDOR_NETCHIP, USB_PRODUCT_NETCHIP_ETHERNETGADGET }, 0 },
 {{ USB_VENDOR_COMPAQ, USB_PRODUCT_COMPAQ_IPAQLINUX }, 0 },
 {{ USB_VENDOR_AMBIT, USB_PRODUCT_AMBIT_NTL_250 }, CDCE_SWAPUNION },
 };

-- 
PGP: 0x1F81112D62A9ADCE / 3586 3350 BFEA C101 DB1A  4AF0 1F81 112D 62A9 ADCE