[SOLVED] g_ether with linux

Started by timnis76, May 20, 2021, 09:49:15 AM

Previous topic - Next topic

timnis76

I trying to get network connection to work via gadget mode, but not yet succeed.


Latest olimex image icludes g_ether module and looks like it loads ok
root@a20-olinuxino:~# uname -a
Linux a20-olinuxino 5.10.36-olimex #105318 SMP Thu May 13 10:54:34 UTC 2021 armv7l GNU/Linux
[  897.275687] using random self ethernet address
[  897.275713] using random host ethernet address
[  897.275725] using host ethernet address: 00:11:22:33:44:55
[  897.276884] usb0: HOST MAC 00:11:22:33:44:55
[  897.277060] usb0: MAC a2:a6:ea:c0:87:db
[  897.277125] using random self ethernet address
[  897.277135] using random host ethernet address
[  897.277248] g_ether gadget: Ethernet Gadget, version: Memorial Day 2008
[  897.277262] g_ether gadget: g_ether ready

I have modified /etc/modules like this (not loading g_serial)
# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.

#g_serial
sun4i_ts
g_ether host_addr=00:11:22:33:44:55

But when I plug USB_OTG cable to Windows 10, I see only new COM port "USB Serial Device (COM9)" but not any new ethernet interfaces?



Ideas?

timnis76

Looks like you need to install RNDIS driver to Windows 10. I followed this guide https://supportcommunity.zebra.com/s/article/Install-RNDIS-Driver-to-connect-RFID-reader-via-USB?language=en_US and now I have "USB Ethernet/RNDIS Gadget" network interface on Windows 10, but it says "cable not connected".


timnis76

Got it.

In linux side I need  to setup ip address for the usb0 interface get it up
root@a20-olinuxino:~# ifconfig usb0 192.168.11.11
root@a20-olinuxino:~# ifconfig usb0 up

And also put ip address to interface on Windows side, and now it works. Looks like the speed is equivalent as 100 Ethernet NIC.

timnis76

Initially I followed this thread https://www.olimex.com/forum/index.php?topic=3916.0 but it not worked for me.

Here is how I get it to work

On A20-OLinuXino with latest Olimex debian buster image
1. add line "g_ether" to  /etc/modules file
2. add file /etc/network/interfaces.d/usb0 and put following lines (gateway if needed)
allow-hotplug usb0
iface usb0 inet static
        address 10.0.1.2
        netmask 255.255.255.0
        network 10.0.1.0
        broadcast 10.0.1.255
        #gateway 10.0.1.1
3. reboot linux

At this point Windows 10 identified Gadget RNDIS device wrongly to "USB Serial Device (COM9)". Driver must be changed to get device "USB Ethernet/RNDIS Gadget" installed. To get working driver follow this guide https://supportcommunity.zebra.com/s/article/Install-RNDIS-Driver-to-connect-RFID-reader-via-USB?language=en_US .

Now I have working network connection between A20-OLinuXino and Windows 10 via USB cable and it works directly from (re)boot.