USB Ethernet Gadget setup

Which system do you use? Android, Ubuntu, OOWOW or others?

Ubuntu 22.04

Which version of system do you use? Khadas official images, self built images, or others?

Khadas official images

Please describe your issue below:

Has anyone been able to make the Edge2 to work as an USB Ethernet gadget? I have enabled the usb-gadget-khadas service as described in the Edge 2 documentation. The gadget is setup correctly as I’m able to bring the usb0 interface up.

However, the Edge2 is not recognized as a RNDIS gadget by my client device (a MacBook Pro M1). The device shows in my list of USB devices (see logs below), but it does not show in my list of network interfaces. For comparison, this is how my RPI4 shows with a similar setup and configuration.

Has anyone been able to make the setup work, with either Linux or Mac clients?

Thank you

Post a console log of your issue below:

# On the Edge 2
$ systemctl status usb-gadget-khadas.service
● usb-gadget-khadas.service - USB Gadget
     Loaded: loaded (/lib/systemd/system/usb-gadget-khadas.service; enabled; vendor preset: enabled)
     Active: active (exited) since Thu 2024-05-16 04:06:42 UTC; 4 days ago
    Process: 1247 ExecStart=/usr/local/bin/usb-gadget (code=exited, status=0/SUCCESS)
   Main PID: 1247 (code=exited, status=0/SUCCESS)
        CPU: 44ms

May 16 04:06:42 vesta systemd[1]: Starting USB Gadget...
May 16 04:06:42 vesta usb-gadget[1247]: Done creating RNDIS USB Gadget...(unnamed net_device)
May 16 04:06:42 vesta systemd[1]: Finished USB Gadget.

# On the Mac terminal
$ system_profiler SPUSBDataType
USB:

    USB 3.1 Bus:

      Host Controller Driver: AppleT6000USBXHCI

        Edge2:

          Product ID: 0x4e26
          Vendor ID: 0x18d1  (Google Inc.)
          Version: 1.00
          Serial Number: 3b16c51030d6
          Speed: Up to 5 Gb/s
          Manufacturer: Khadas
          Location ID: 0x00200000 / 1
          Current Available (mA): 900
          Extra Operating Current (mA): 0

# The raspberry PI as a USB gadget on the Mac

    USB 3.1 Bus:

      Host Controller Driver: AppleT6000USBXHCI

        RNDIS/Ethernet Gadget:

          Product ID: 0xa4a2
          Vendor ID: 0x0525  (PLX Technology, Inc.)
          Version: 5.15
          Speed: Up to 480 Mb/s
          Manufacturer: Linux 5.15.92 with 20980000.usb
          Location ID: 0x00100000 / 1
          Current Available (mA): 500
          Current Required (mA): 0
          Extra Operating Current (mA): 0


Mac don’t like RNDIS as Windows please try other configuration g_ncm or g_ether

1 Like

Thanks for the repiy @hyphop. Could you give me some more information about what you mean or point me to some documentation? Thanks again!

NCM configuration must works well under MacOS, same as in Linux

i think you can easily google it

Seems g_ncm support is not included with the kernel

sudo modprobe g_ncm
modprobe: FATAL: Module g_ncm not found in directory /lib/modules/5.10.198

However I got it to work by replacing

modprobe usb_f_rndis

with

modprobe g_ether

On /usr/local/bin/usb-gadget

One thing that I have not been able to solve is that if I boot the device while connected to the RNDIS client, the usb connection goes into a connect/disconnect loop and only after disconnecting the usb-c cable and re-connecting, the usb connection is properly established

[  138.994027] g_ether gadget: Ethernet Gadget, version: Memorial Day 2008
[  138.994028] g_ether gadget: g_ether ready
[  139.005435] dwc3 fc000000.usb: device reset
[  139.144397] dwc3 fc000000.usb: device disconnect
[  139.387351] dwc3 fc000000.usb: device reset
[  141.288977] dwc3 fc000000.usb: device disconnect
[  142.193809] dwc3 fc000000.usb: device reset