Br-lan interface is missing?

Hi all,

Im working on 22.03 branch, we enable USB-Ethernet feature at kernel option.

root@101c:~# ifconfig usb0
usb0      Link encap:Ethernet  HWaddr 62:47:0E:FF:7C:83  
          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 (0.0 B)  TX bytes:0 (0.0 B)

I try to add following setting at /etc/config/network.

root@101c:~# cat /etc/config/network 

config interface 'loopback'
        option device 'lo'
        option proto 'static'
        option ipaddr '127.0.0.1'
        option netmask '255.0.0.0'

config device
        option name 'br-lan'
        option type 'bridge'
        list ports 'usb0'

config interface 'lan'
        option device 'br-lan'
        option proto 'static'
        option ipaddr '192.168.1.1'
        option netmask '255.255.255.0'
        list dns '172.21.1.6'

I try to restart network, but br-lan did not show up.

root@101c:~# brctl show

Questions:

  1. What kernel options should I enable it to support soft-ap?
  2. Is it possible the problem from usb0 device, netifd should recv notify? what kind of notify?
  3. Anything else I can do to debug?

Please help. Thank.

which once is it, wired ?

or wireless ?

post a dmesg snipped from after you've plugged in the device, and the output.from lsusb.

Hi @frollic

Thanks for quick reply.

dmesg: This is 100M wired usb-ethernet only, not wireless.

[    0.699364] using random self ethernet address
[    0.703960] using random host ethernet address
[    0.709458] usb0: HOST MAC 02:a1:fe:db:87:20
[    0.713844] usb0: MAC 46:80:42:3d:17:a2
[    0.717778] using random self ethernet address
[    0.722243] using random host ethernet address
[    0.727006] g_ether gadget: Ethernet Gadget, version: Memorial Day 2008
[    0.733704] g_ether gadget: g_ether ready

lsusb is empty!!!!

root@rd8000-101c:~# lsusb 
lsusb: /sys/bus/usb/devices: No such file or directory

What should I do? Thanks.

which usb related packages have you got installed ?

Hi @frollic

At openwrt

CONFIG_USB_SUPPORT=y

At kernel

CONFIG_USB_ETH=y
CONFIG_USB_ETH_RNDIS=y
CONFIG_USB_ETH_RNDIS_OV=y
CONFIG_USB_LIBCOMPOSITE=y
CONFIG_USB_U_ETHER=y
CONFIG_USB_F_ECM=y
CONFIG_USB_F_SUBSET=y
CONFIG_USB_F_RNDIS=y
CONFIG_USB_F_UVC=y
CONFIG_USB_CONFIGFS=y

Anything else I can provide? Thanks.

While there is 'generic' USB support in the form of rndis (covering a subset of USB ethernet devices), most need their chipset specific kernel modules instead - but it is a little unclear what you're dealing with right now.

Hi @slh

Im going to add usb0 into lan, so device can be soft-ap, lease IP to my PC.
But, right now, usb0 can not be auto added into br-lan, looks like netifd doesn't have enough info to create it? Thanks.

This is the "USB gadget" driver which makes the router CPU run as a USB device (not a host) and look like a USB adapter, realizing a virtual Ethernet connection. This requires support from hardware for the port to operate in device mode, commonly called "On The Go."

usb0 will be created and destroyed dynamically as the host PC is connected and disconnected. The empty_bridge option can be used to make the bridge persist even though it is empty.

As would be expected, since OpenWrt is itself a USB device in this case, not a USB host.

2 Likes

Hi @mk24

Thanks for explain lsusb question. ^^

Hi @frollic

Do you have idea how to dig further? Thanks.

Hi @frollic

I try to dump interface from my device. Do you know how to debug "NO_DEVICE"? Thanks.

root@rd8000-101c:~# ubus call network.interface dump
{
        "interface": [
                {
                        "interface": "lan",
                        "up": false,
                        "pending": false,
                        "available": false,
                        "autostart": true,
                        "dynamic": false,
                        "proto": "static",
                        "device": "br-lan",
                        "data": {

                        },
                        "errors": [
                                {
                                        "subsystem": "interface",
                                        "code": "NO_DEVICE"
                                }
                        ]
                },