Hello,
I have been trying to connect Android 9(master, host) in iMX8QuadXPlus MEK board with the Ubuntu board (sub, device) throught the usb port.
To use ethernet function on USB, I rebuilt the Adroid kernel with the configuration CONFIG_USB_NET_RNDIS_HOST.
The Ubuntu board have been installed USB RNDIS gadget driver for usb ethernet.
I already checked to operate the Ubuntu board (other board) successfully to connect the HOST PC. (Windows and Ubuntu both)
When I connected USB between two boards, I saw the debug messages on iMX8 Android machine as below.
[ 7938.107680] usb 1-1.4: new high-speed USB device number 5 using cdns-usb3
[ 7938.212464] usb 1-1.4: New USB device found, idVendor=18d1, idProduct=4ee2
[ 7938.219383] usb 1-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 7938.226738] usb 1-1.4: Product: RNDIS Ethernet Data
[ 7938.231652] usb 1-1.4: Manufacturer: RNDIS Communications Control
[ 7938.237789] usb 1-1.4: SerialNumber: RNDIS
[ 7938.258632] rndis_host 1-1.4:1.0 usb1: register 'rndis_host' at usb-xhci-cdns3-1.4, RNDIS device, 3a:86:80:db:1f:cc
# ifconfig -a
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope: Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 TX bytes:0
...
usb1 Link encap:Ethernet HWaddr 3a:86:80:db:1f:cc Driver rndis_host
BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 TX bytes:0
I confirmed the new interface was created as usb1 and set the ip address information as below.
# ifconfig usb1 192.168.5.12 netmask 255.255.255.0 broadcast 192.168.5.255 up
# ifconfig
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope: Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 TX bytes:0
eth0 Link encap:Ethernet HWaddr 00:04:9f:05:c8:84 Driver fec
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 TX bytes:0
usb1 Link encap:Ethernet HWaddr 3a:86:80:db:1f:cc Driver rndis_host
inet addr:192.168.5.12 Bcast:192.168.5.255 Mask:255.255.255.0
inet6 addr: fe80::3886:80ff:fedb:1fcc/64 Scope: Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:9 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 TX bytes:1122
The Ubuntu machine has an ip address 192.168.5.5 so I try to ping
ping 192.168.5.5
connect: Network is unreachable
I met the message "connect: Network is unreachable"
I don't know why it happens and What I will do more.
I hope anyone help me.
Thanks in advance.