MT7612U - How to get it to start automatically

Hello,

Got an issue with USB wifi not starting automatically, hoping for some advice.

OpenWRT 22.03.2 x86_64 acting as router.

PCIE slots are used up, so added a USB WiFi adapter to get 2g and to hopefully ensure easy access to router should the 5g card fail (or i miss-configure it when tweaking it outside of luci).
But after power failure / poweroff, the USB device does not re-appear as a WiFi device without some hoop jumping which requires access to the router.
I have to unplug it and re-plug it in and then /etc/init.d/network restart

The device is a Mediatek M7612U on a USB extension cable + docking station that it came with.

Upon startup wlan1 is not showing, device 0e8d:2870 is.
I unplug it, plug it back in, restart network and it becomes 0e8d:7612 WLAN device and wlan1 is working fine.

Do you know it its possible to tweak something so it starts correctly after bootup?

dmesg:
[  332.654376] usb 1-3: new high-speed USB device number 4 using xhci_hcd
[  332.837242] usb-storage 1-3:1.0: USB Mass Storage device detected
[  332.838437] scsi host4: usb-storage 1-3:1.0
[  332.965338] usb 1-3: USB disconnect, device number 4
[  333.974281] usb 1-3: new high-speed USB device number 5 using xhci_hcd
[  334.304513] usb 1-3: reset high-speed USB device number 5 using xhci_hcd
[  334.486261] mt76x2u 1-3:1.0: ASIC revision: 76120044
[  334.511557] mt76x2u 1-3:1.0: ROM patch build: 20141115060606a
[  334.680414] mt76x2u 1-3:1.0: Firmware Version: 0.0.00
[  334.680953] mt76x2u 1-3:1.0: Build: 1
[  334.681376] mt76x2u 1-3:1.0: Build Time: 201607111443____


Powered on (USB already plugged in) shows wlan1 (and wlan1-1) missing even though mt76x2u module loaded:

root@Router:~# 
root@Router:~# 
root@Router:~# iw dev
phy#0
	Interface wlan0-1
		ifindex 28
		wdev 0x5
		addr 66:6c:80:b3:4c:5b
		ssid 5-Guest
		type AP
		channel 44 (5220 MHz), width: 80 MHz, center1: 5210 MHz
		txpower 15.00 dBm
		multicast TXQ:
			qsz-byt	qsz-pkt	flows	drops	marks	overlmt	hashcol	tx-bytes	tx-packets
			0	0	0	0	0	0	0	0		0
	Interface wlan0
		ifindex 27
		wdev 0x4
		addr 64:6c:80:b3:4c:5b
		ssid 5-LAN
		type AP
		channel 44 (5220 MHz), width: 80 MHz, center1: 5210 MHz
		txpower 15.00 dBm
		multicast TXQ:
			qsz-byt	qsz-pkt	flows	drops	marks	overlmt	hashcol	tx-bytes	tx-packets
			0	0	35	0	0	0	0	2724		35


root@Router:~# lsusb
Bus 001 Device 003: ID 090c:1000  Flash Disk
Bus 002 Device 001: ID 1d6b:0003 Linux 5.10.146 xhci-hcd xHCI Host Controller
Bus 001 Device 002: ID 0e8d:2870 Љ Љ
Bus 001 Device 001: ID 1d6b:0002 Linux 5.10.146 xhci-hcd xHCI Host Controller
root@Router:~# 
root@Router:~# 




Unplug + plug back in USB wifi.  wlan1 appears, but not the config from /etc/config/wireless:

root@Router:~# 
root@Router:~# iw dev
phy#1
	Interface wlan1
		ifindex 25
		wdev 0x100000001
		addr 00:13:ef:1f:10:2c
		type managed
		txpower 20.00 dBm
		multicast TXQ:
			qsz-byt	qsz-pkt	flows	drops	marks	overlmt	hashcol	tx-bytes	tx-packets
			0	0	0	0	0	0	0	0		0
phy#0
	Interface wlan0-1
		ifindex 20
		wdev 0x3
		addr 66:6c:80:b3:4c:5b
		ssid 5-Guest
		type AP
		channel 44 (5220 MHz), width: 80 MHz, center1: 5210 MHz
		txpower 15.00 dBm
		multicast TXQ:
			qsz-byt	qsz-pkt	flows	drops	marks	overlmt	hashcol	tx-bytes	tx-packets
			0	0	1	0	0	0	0	360		1
	Interface wlan0
		ifindex 19
		wdev 0x2
		addr 64:6c:80:b3:4c:5b
		ssid 5-LAN
		type AP
		channel 44 (5220 MHz), width: 80 MHz, center1: 5210 MHz
		txpower 15.00 dBm
		multicast TXQ:
			qsz-byt	qsz-pkt	flows	drops	marks	overlmt	hashcol	tx-bytes	tx-packets
			0	0	145	0	0	0	0	21864		145
root@Router:~# lsusb

Device id changed from 0e8d:2870 to 0e8d:7612 and now showing as MediaTek Inc. 802.11ac WLAN

oot@Router:~# lsusb
Bus 001 Device 002: ID 090c:1000  Flash Disk
Bus 002 Device 001: ID 1d6b:0003 Linux 5.10.146 xhci-hcd xHCI Host Controller
Bus 001 Device 004: ID 0e8d:7612 MediaTek Inc. 802.11ac WLAN
Bus 001 Device 001: ID 1d6b:0002 Linux 5.10.146 xhci-hcd xHCI Host Controller


/etc/init.d/network restart

Everything is now fine:

oot@Router:~# iw dev
phy#1
	Interface wlan1-1
		ifindex 30
		wdev 0x100000003
		addr 02:13:ef:1f:10:2c
		ssid 2-Guest
		type AP
		channel 11 (2462 MHz), width: 40 MHz, center1: 2452 MHz
		txpower 20.00 dBm
		multicast TXQ:
			qsz-byt	qsz-pkt	flows	drops	marks	overlmt	hashcol	tx-bytes	tx-packets
			0	0	0	0	0	0	0	0		0
	Interface wlan1
		ifindex 29
		wdev 0x100000002
		addr 00:13:ef:1f:10:2c
		ssid 2-LAN
		type AP
		channel 11 (2462 MHz), width: 40 MHz, center1: 2452 MHz
		txpower 20.00 dBm
		multicast TXQ:
			qsz-byt	qsz-pkt	flows	drops	marks	overlmt	hashcol	tx-bytes	tx-packets
			0	0	0	0	0	0	0	0		0
phy#0
	Interface wlan0-1
		ifindex 31
		wdev 0x5
		addr 66:6c:80:b3:4c:5b
		ssid 5-Guest
		type AP
		channel 44 (5220 MHz), width: 80 MHz, center1: 5210 MHz
		txpower 15.00 dBm
		multicast TXQ:
			qsz-byt	qsz-pkt	flows	drops	marks	overlmt	hashcol	tx-bytes	tx-packets
			0	0	12	0	0	0	0	1326		12
	Interface wlan0
		ifindex 28
		wdev 0x4
		addr 64:6c:80:b3:4c:5b
		ssid 5-LAN
		type AP
		channel 44 (5220 MHz), width: 80 MHz, center1: 5210 MHz
		txpower 15.00 dBm
		multicast TXQ:
			qsz-byt	qsz-pkt	flows	drops	marks	overlmt	hashcol	tx-bytes	tx-packets
			0	0	147	0	0	0	0	10480		147


root@Router:~# lsusb -vt
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/10p, 5000M
    ID 1d6b:0003  
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/16p, 480M
    ID 1d6b:0002  
    |__ Port 3: Dev 4, If 0, Class=, Driver=mt76x2u, 480M
        ID 0e8d:7612  
    |__ Port 4: Dev 2, If 0, Class=, Driver=usb-storage, 480M



lsusb -v

Bus 001 Device 005: ID 0e8d:7612 MediaTek Inc. 802.11ac WLAN
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.10
  bDeviceClass            0 
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x0e8d 
  idProduct          0x7612 
  bcdDevice            1.00
  iManufacturer           1 MediaTek Inc.
  iProduct                2 802.11ac WLAN
  iSerial                 3 000000000
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength       0x004a
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          2 802.11ac WLAN
    bmAttributes         0xa0
      (Bus Powered)
      Remote Wakeup
    MaxPower              200mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           8
      bInterfaceClass       255 
      bInterfaceSubClass    255 
      bInterfaceProtocol    255 
      iInterface              2 802.11ac WLAN
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x84  EP 4 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x85  EP 5 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x08  EP 8 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x04  EP 4 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x05  EP 5 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x06  EP 6 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x07  EP 7 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x09  EP 9 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
Binary Object Store Descriptor:
  bLength                 5
  bDescriptorType        15
  wTotalLength       0x0016
  bNumDeviceCaps          2
  USB 2.0 Extension Device Capability:
    bLength                 7
    bDescriptorType        16
    bDevCapabilityType      2
    bmAttributes   0x0000f41e
      BESL Link Power Management (LPM) Supported
    BESL value     1024 us 
    Deep BESL value    61440 us 
  SuperSpeed USB Device Capability:
    bLength                10
    bDescriptorType        16
    bDevCapabilityType      3
    bmAttributes         0x00
    wSpeedsSupported   0x000e
      Device can operate at Full Speed (12Mbps)
      Device can operate at High Speed (480Mbps)
      Device can operate at SuperSpeed (5Gbps)
    bFunctionalitySupport   1
      Lowest fully-functional device speed is Full Speed (12Mbps)
    bU1DevExitLat          10 micro seconds
    bU2DevExitLat         180 micro seconds
Device Status:     0x0002
  (Bus Powered)
  Remote Wakeup Enabled


iw list

Wiphy phy1
	wiphy index: 1
	max # scan SSIDs: 4
	max scan IEs length: 2243 bytes
	max # sched scan SSIDs: 0
	max # match sets: 0
	Retry short limit: 7
	Retry long limit: 4
	Coverage class: 0 (up to 0m)
	Device supports AP-side u-APSD.
	Device supports T-DLS.
	Available Antennas: TX 0x3 RX 0x3
	Configured Antennas: TX 0x3 RX 0x3
	Supported interface modes:
		 * IBSS
		 * managed
		 * AP
		 * AP/VLAN
		 * monitor
		 * mesh point
		 * P2P-client
		 * P2P-GO
	Band 1:
		Capabilities: 0x1ff
			RX LDPC
			HT20/HT40
			SM Power Save disabled
			RX Greenfield
			RX HT20 SGI
			RX HT40 SGI
			TX STBC
			RX STBC 1-stream
			Max AMSDU length: 3839 bytes
			No DSSS/CCK HT40
		Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
		Minimum RX AMPDU time spacing: No restriction (0x00)
		HT TX/RX MCS rate indexes supported: 0-15
		Frequencies:
			* 2412 MHz [1] (20.0 dBm)
			* 2417 MHz [2] (20.0 dBm)
			* 2422 MHz [3] (20.0 dBm)
			* 2427 MHz [4] (20.0 dBm)
			* 2432 MHz [5] (20.0 dBm)
			* 2437 MHz [6] (20.0 dBm)
			* 2442 MHz [7] (20.0 dBm)
			* 2447 MHz [8] (20.0 dBm)
			* 2452 MHz [9] (20.0 dBm)
			* 2457 MHz [10] (20.0 dBm)
			* 2462 MHz [11] (20.0 dBm)
			* 2467 MHz [12] (20.0 dBm)
			* 2472 MHz [13] (20.0 dBm)
			* 2484 MHz [14] (disabled)
	Band 2:
		Capabilities: 0x1ff
			RX LDPC
			HT20/HT40
			SM Power Save disabled
			RX Greenfield
			RX HT20 SGI
			RX HT40 SGI
			TX STBC
			RX STBC 1-stream
			Max AMSDU length: 3839 bytes
			No DSSS/CCK HT40
		Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
		Minimum RX AMPDU time spacing: No restriction (0x00)
		HT TX/RX MCS rate indexes supported: 0-15
		VHT Capabilities (0x318001b0):
			Max MPDU length: 3895
			Supported Channel Width: neither 160 nor 80+80
			RX LDPC
			short GI (80 MHz)
			TX STBC
			RX antenna pattern consistency
			TX antenna pattern consistency
		VHT RX MCS set:
			1 streams: MCS 0-9
			2 streams: MCS 0-9
			3 streams: not supported
			4 streams: not supported
			5 streams: not supported
			6 streams: not supported
			7 streams: not supported
			8 streams: not supported
		VHT RX highest supported: 0 Mbps
		VHT TX MCS set:
			1 streams: MCS 0-9
			2 streams: MCS 0-9
			3 streams: not supported
			4 streams: not supported
			5 streams: not supported
			6 streams: not supported
			7 streams: not supported
			8 streams: not supported
		VHT TX highest supported: 0 Mbps
		Frequencies:
			* 5180 MHz [36] (19.0 dBm)
			* 5200 MHz [40] (19.0 dBm)
			* 5220 MHz [44] (19.0 dBm)
			* 5240 MHz [48] (19.0 dBm)
			* 5260 MHz [52] (19.0 dBm) (radar detection)
			* 5280 MHz [56] (19.0 dBm) (radar detection)
			* 5300 MHz [60] (19.0 dBm) (radar detection)
			* 5320 MHz [64] (19.0 dBm) (radar detection)
			* 5500 MHz [100] (19.0 dBm) (radar detection)
			* 5520 MHz [104] (19.0 dBm) (radar detection)
			* 5540 MHz [108] (19.0 dBm) (radar detection)
			* 5560 MHz [112] (19.0 dBm) (radar detection)
			* 5580 MHz [116] (19.0 dBm) (radar detection)
			* 5600 MHz [120] (19.0 dBm) (radar detection)
			* 5620 MHz [124] (19.0 dBm) (radar detection)
			* 5640 MHz [128] (19.0 dBm) (radar detection)
			* 5660 MHz [132] (19.0 dBm) (radar detection)
			* 5680 MHz [136] (19.0 dBm) (radar detection)
			* 5700 MHz [140] (19.0 dBm) (radar detection)
			* 5720 MHz [144] (19.0 dBm) (radar detection)
			* 5745 MHz [149] (19.0 dBm)
			* 5765 MHz [153] (19.0 dBm)
			* 5785 MHz [157] (19.0 dBm)
			* 5805 MHz [161] (19.0 dBm)
			* 5825 MHz [165] (19.0 dBm)
			* 5845 MHz [169] (disabled)
			* 5865 MHz [173] (disabled)
	valid interface combinations:
		 * #{ IBSS } <= 1, #{ managed, AP, mesh point, P2P-client, P2P-GO } <= 2,
		   total <= 2, #channels <= 1, STA/AP BI must match
	HT Capability overrides:
		 * MCS: ff ff ff ff ff ff ff ff ff ff
		 * maximum A-MSDU length
		 * supported channel width
		 * short GI for 40 MHz
		 * max A-MPDU length exponent
		 * min MPDU start spacing
	max # scan plans: 1
	max scan plan interval: -1
	max scan plan iterations: 0
	Supported extended features:
		* [ VHT_IBSS ]: VHT-IBSS
		* [ RRM ]: RRM
		* [ FILS_STA ]: STA FILS (Fast Initial Link Setup)
		* [ CQM_RSSI_LIST ]: multiple CQM_RSSI_THOLD records
		* [ CONTROL_PORT_OVER_NL80211 ]: control port over nl80211
		* [ TXQS ]: FQ-CoDel-enabled intermediate TXQs
		* [ AIRTIME_FAIRNESS ]: airtime fairness scheduling
		* [ AQL ]: Airtime Queue Limits (AQL)
		* [ SCAN_RANDOM_SN ]: use random sequence numbers in scans
		* [ SCAN_MIN_PREQ_CONTENT ]: use probe request with only rate IEs in scans
		* [ CONTROL_PORT_NO_PREAUTH ]: disable pre-auth over nl80211 control port support
		* [ DEL_IBSS_STA ]: deletion of IBSS station support
		* [ SCAN_FREQ_KHZ ]: scan on kHz frequency support
		* [ CONTROL_PORT_OVER_NL80211_TX_STATUS ]: tx status for nl80211 control port support

Thank you!

@pigeon35

It seems to be the same problem as described here:

I'd say, give it a try.

1 Like

Even with usb-modeswitch, the radio interface may not be available until after the rest of the network has been started. This may be because the USB event required for usb-modeswitch to do it's magic either never gets triggered or gets triggered when there's nothing available (yet) to process it. Once the radio is available, just restarting the network should be all that is required. How to get the device activated I can't tell you but would suggest starting by looking at how hotplug works and whether a suitable hotplug event can be initiated perhaps in /etc/rc.local.

1 Like

Unfortunately usb-modeswitch didn't seem to do anything, no activity, nothing in dmesg. With/without the verbose swtich. But it would require access to the router to be full solution as effectively I'm doing similar now (logging onto router and running commands, which is what I was trying to avoid).

Will see if can figure out anything with hotplug, but now have managed to lose client access with bridge further downstream, so will park this for a bit.

Thanks for suggestions!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.