LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Using a detected USB RNDIS gadget as network adapter (https://www.linuxquestions.org/questions/linux-networking-3/using-a-detected-usb-rndis-gadget-as-network-adapter-4175698461/)

somanyquestions 07-29-2021 09:48 AM

Using a detected USB RNDIS gadget as network adapter
 
I have a RaspberyPi module, with USB connected to another module computer (as USB host) running a down-sized Linux. The RasPi is configured as USB ethernet gadget.

Once I boot the RasPi, and enter dmesg on the host computer, I see:

Code:

[    3.077758] dwc3-of-simple ff9d0000.usb0: dwc3_simple_set_phydata: Can't find usb3-phy
[    3.091950] dwc3-of-simple ff9e0000.usb1: dwc3_simple_set_phydata: Can't find usb3-phy
[    3.115028] usb0: HOST MAC 46:01:81:46:ba:bb
[    3.119307] usb0: MAC e2:8d:53:c9:16:82
...
[ 2918.585759] usb 1-1: new high-speed USB device number 2 using xhci-hcd
[ 2918.738352] usb 1-1: New USB device found, idVendor=0525, idProduct=a4a2, bcdDevice= 5.10
[ 2918.746521] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 2918.753649] usb 1-1: Product: RNDIS/Ethernet Gadget
[ 2918.758523] usb 1-1: Manufacturer: Linux 5.10.17-v7+ with 3f980000.usb

So the Raspi is detected as gadget on the USB host computer.
Although I wonder why a "usb0" is indeed assigned a MAC address, and the "usb 1-1" thing is the gadget. Those seem to be different meanings ("name spaces"), as "usb0" has no space before the number, right?

But unlike a previous experiment, where I used yet another RaspberryPi as the host, where it also detected the 1st raspi as gadget and created a usb0 network adapter and assigned an IP configuration to it, this is not the case here. No usb-anything under ifconfig -a. Not listing it with the -a option means that no network device usb0 exists, configured or not, right?

The current host computer runs a rather down-sized Linux based on buildroot/busybox.

Is there perhaps a certain configuration missing that allows using this detected RNDIS gadget for networking - which just happens to be done automatically on the default Raspi Linux distribution - but not necessarily on the buildroot configuration I have?

somanyquestions 07-30-2021 07:26 AM

I was looking through the unpacked file that I find in /proc/config.gz on the host system.

Edit: removed another question, now as own question in the kernel subforum.
--
The option # CONFIG_USB_NET_DRIVERS is not set sounds possibly relevant, I have not found an exact definition of what it does, though.

What I also found is that, the host side counterpart to the gadget device's g_ether driver, is supposedly the cdc_ether driver.
I found mentions of CONFIG_USB_NET_CDCETHER, CONFIG_USB_USBNET and other USB_NET options that supposedly need to be on.
But my config file does not contain that text except for the mentioned CONFIG_USB_NET_DRIVERS.
(I currently don't have access to the buildroot config stuff that created this Linux image, so I'm looking for clues in the config as-is on system)

Edit:

As mentioned here: https://www.linuxquestions.org/quest...el-4175698502/,
dependant options may not be included in a config file if the main option is disabled.

My kernel configuration has now these things on and I now get a "usb0" interface shown under "ifconfig -a":
  • CONFIG_USB_NET_DRIVERS
  • CONFIG_USB_USBNET
  • CONFIG_USB_NET_CDCETHER
  • CONFIG_USB_NET_CDC_EEM

next to options generally enabling USB and enable it as a host (or dual role).


All times are GMT -5. The time now is 01:03 PM.