How to manually switch wifi driver on OpenWrt

Hey guys,
I have a firmware for MT300N box. It has been using mac80211 as the wifi driver. However, I found the wifi is really not stable and kept kick connected device offline. So I found there is kmod-mt7628 which is included in the official firmware package.
opkg files kmod-mt7628
Package kmod-mt7628 (4.14.63+4.0.2-4) is installed on root and has the following files:
/etc/wireless/mt7628/mt7628.dat
/lib/modules/4.14.63/mt7628.ko
/etc/modules.d/90-mt7628
So if I want to keep my firmware without using its imagebuilder, Is there a way to manually switched it? I have tried to pack these 3 files and copied into the my firmware. However, if I changed the type in /etc/config/wireless from mac80211 to mt7628, it tells me
(mt7628)Interface type not supported
It seems not just insmod the module itself. Is there any more step to make it using mt7628 driver rather than mac80211?

Thanks,

No, the vendor drivers are neither packaged or otherwise available for OpenWrt. Kernel modules have a very strict dependency on the running host kernel, you can't install kernel modules from some vendor kernel on OpenWrt and expect them to work (at best they will be silently skipped, otherwise they will crash hard) - for that you would need their source (and a lot of development efforts to integrate them, efforts that would be better spent on improving mt76).

Aside from the kernel module itself, OpenWrt has no support at all for configuring (mt7628.dat) or supporting (hostapd) this vendor driver.

1 Like

I realize this is an old thread but my question is very related.
I built a firmware using image generator but can't get wifi to work.

wifi
mt7628(mt7628): Interface type not supported
mt7628(mt7628): Interface type not supported

After reading this thread, I understand why but might you have a lead or hint on how I can add the correct wireless driver for the gl-mt300n V2?

I'm installing openwrt 22.03.3.

Have you tested with a standard release build? Is wifi not working on that?

To be honest, I'm not really sure what to post as I've become rather confused with all this.
Also, to be clear, I'm not using any luci/gui, all from the command line only.

I did take a standard release to compare but it's not clear which package is missing.

I'm at this point now but can't seem to find the package/s I need to continue.

$ iw list
nl80211 not found.

Looking through search engine results, I found a post that suggested I was missing these so I installed them.

$ opkg install kmod-cfg80211 kmod-mac80211

Still nothing.

This is how my network and wireless files look, almost identical to default build.

$ cat network

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

config globals 'globals'
    option ula_prefix 'fd21:c667:49ef::/48'

config device
    option name 'br-lan'
    option type 'bridge'
    list ports 'eth0.1'

config interface 'lan'
    option device 'br-lan'
    option proto 'dhcp'
    option ip6assign '60'

config interface 'wan'
    option device 'eth0.2'
    option proto 'dhcp'

config interface 'wan6'
    option device 'eth0.2'
    option proto 'dhcpv6'

config switch
    option name 'switch0'
    option reset '1'
    option enable_vlan '1'

config switch_vlan
    option device 'switch0'
    option vlan '1'
    option ports '1 6t'

config switch_vlan
    option device 'switch0'
    option vlan '2'
    option ports '0 6t'

$ cat wireless

config wifi-device 'radio0'
    option type 'mac80211'
    option channel '1'
    option path 'platform/10300000.wmac'
    option band '2g'
    option htmode 'HT20'
    option disabled '0'

config wifi-iface 'default_radio0'
    option device 'radio0'
    option network 'lan'
    option mode 'sta'
    option ssid 'xxx'
    option encryption 'xxx'
    option key 'xxx'

To me, there is an interface missing for the wifi. In the previous version of openwrt, I had one additional interface called wwan for example but I read that in the newer openwrt, you re-use lan or wan.

Wish I could provide better information but this has now gotten over my head at this point as I never use wifi.

Instead of using your own build, download and install the official stable release build for your device. Do not keep settings when you run the upgrade.

Reconfigure from scratch and then test.

Yes, I've done that. I have two devices running to compare. One is running the official and the other is running my own build which is the one I'm trying to get working.

On the personal build, I run 'wifi up' and that seems to work.
I then run 'wifi status' and I see what is mainly my wireless config file.

This is what I get when using the default build;

Sun Apr 16 17:12:22 2023 daemon.info dnsmasq[1]: read /tmp/hosts/odhcpd - 2 addresses
Sun Apr 16 17:13:28 2023 daemon.notice netifd: Wireless device 'radio0' is now down
Sun Apr 16 17:13:28 2023 daemon.notice netifd: radio0 (5299): Interface 0 setup failed: BRIDGE_NOT_ALLOWED
Sun Apr 16 17:13:28 2023 daemon.notice netifd: Wireless device 'radio0' is now up

This is what I get when using my own build;

Sun Apr 16 17:18:20 2023 daemon.notice netifd: radio0 (29263): Phy not found
Sun Apr 16 17:18:20 2023 daemon.notice netifd: radio0 (29263): Could not find PHY for device 'radio0'
Sun Apr 16 17:18:20 2023 daemon.notice netifd: Wireless device 'radio0' set retry=0
Sun Apr 16 17:18:20 2023 daemon.crit netifd: Wireless device 'radio0' setup failed, retry=0
Sun Apr 16 17:18:21 2023 daemon.notice netifd: radio0 (29270): WARNING: Variable 'data' does not exist or is not an array/object
Sun Apr 16 17:18:21 2023 daemon.notice netifd: radio0 (29270): Bug: PHY is undefined for device 'radio0'
Sun Apr 16 17:18:21 2023 daemon.notice netifd: Wireless device 'radio0' is now down

I have radio0 defined with lan based on what I've read but I used to always have an interface called wwan in the network so it's not clear what's changed since 18.02 or so.

Also made sure to have the following installed;

kmod-cfg80211 kmod-mac80211 wpad-basic and first tried wpad-openssl

It is possible that the ART partition (i.e. where the wireless calibration data from the factory) may have been erased or corrupted. That would explain why the radio is not initializing properly.

Thee are 4 combinations you should look at (assuming they are identical devices):

  • Router A with custom build,
  • Router A with default build
  • Router B with custom build
  • Router B with default build

What we want to know is if the problem (and details in the logs) follows the device or the build.

I'm really curious about this issue:

Can we see the network and wireless files?

Please copy the output of the following commands and post it here using the "Preformatted text </> " button:
grafik
Remember to redact passwords, MAC addresses and any public IP addresses you may have:

cat /etc/config/network
cat /etc/config/wireless

Hi, sure.

The hardware 100% identical glinet mt300n V2 routers. Just got them from Amazon.
My old build works on both, wifi comes up, everything is good but when I go to 22.03.3 is when some things have changed which I'm trying to understand to get wireless back up.

The problem follows the devices. I mean that when I first got them, I installed my usual older version since it does what I need but wanted to upgrade. Once I upgraded, found the wifi issue which I'm sure is just me not understanding the changes in the new version.

I then decided to install the default download build onto one of them to compare files/packages and this is where I'm at since.

Here is the network and wireless from the default downloaded build;

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

config globals 'globals'
	option ula_prefix 'fd21:c667:49ef::/48'

config device
	option name 'br-lan'
	option type 'bridge'
	list ports 'eth0.1'

config interface 'lan'
	option device 'br-lan'
	option proto 'dhcp'
	option ip6assign '60'

config interface 'wan'
	option device 'eth0.2'
	option proto 'dhcp'

config interface 'wan6'
	option device 'eth0.2'
	option proto 'dhcpv6'

config switch
	option name 'switch0'
	option reset '1'
	option enable_vlan '1'

config switch_vlan
	option device 'switch0'
	option vlan '1'
	option ports '1 6t'

config switch_vlan
	option device 'switch0'
	option vlan '2'
	option ports '0 6t'

And wifi;

config wifi-device 'radio0'
	option type 'mac80211'
	option path 'platform/10300000.wmac'
	option channel '1'
	option band '2g'
	option htmode 'HT20'
	option disabled '0'

config wifi-iface 'default_radio0'
	option device 'radio0'
	option network 'lan'
	option mode 'sta'
	option ssid 'xxx'
	option encryption 'xxx'
        option key 'xxx'

And this one from my build;

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

config globals 'globals'
    option ula_prefix 'fd21:c667:49ef::/48'

config device
    option name 'br-lan'
    option type 'bridge'
    list ports 'eth0.1'

config interface 'lan'
    option device 'br-lan'
    option proto 'dhcp'
    option ip6assign '60'

config interface 'wan'
    option device 'eth0.2'
    option proto 'dhcp'

config interface 'wan6'
    option device 'eth0.2'
    option proto 'dhcpv6'

config switch
    option name 'switch0'
    option reset '1'
    option enable_vlan '1'

config switch_vlan
    option device 'switch0'
    option vlan '1'
    option ports '1 6t'

config switch_vlan
    option device 'switch0'
    option vlan '2'
    option ports '0 6t'

And wifi;

config wifi-device 'radio0'
    option type 'mac80211'
    option channel '11'
    option path 'platform/10300000.wmac'
    option band '2g'
    option htmode 'HT20'
    option disabled '0'

config wifi-iface 'default_radio0'
    option device 'radio0'
    option network 'lan'
    option mode 'sta'
    option ssid 'gst2'
    option encryption 'psk2'
    option key 'n0m0recats2'

On the default build;

# iw list
Wiphy phy0
	wiphy index: 0
	max # scan SSIDs: 4
	max scan IEs length: 2257 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
***snip***
On my own build;
$ iw list
nl80211 not found.

I'm not sure what's missing on the default build to fire up the wireless and I'm missing a driver/package on my own build even after installing all of the above.

I've posted some of the output of the logread and happy to share something more specific if you need.

Not sure what else to add here. Where else could I get help if not in these forums?

Can anyone help me with this. I'm at a loss and don't have enough experience to know how to get this working.

  • Just make a custom firmware. Simply do not make changes; or
  • Use an official build

To be clear, are you still attempting to use some other (possibly incompatible) driver?

It's included in the offcial build.

Or you simply setup WWAN again - there's actually a wizard in the web GUI. I'm not sure where you got that information.

???

I used both an official build as something to follow and my own using image builder.
There might be an old driver but if there is, it's not something I'm purposely trying to do, it's just my not being aware of it.

I compared the packages in the official build with what I have and as noted above in this thread, tried various packages based on information I found online.

I'm not using a GUI, command line only as mentioned in the thread :).

It's gotten over my head because I have no experience what so ever with wifi, it's not something I use much preferring wired Ethernet. Also because even using the official build, wifi is not coming up (shared above).

However, I'm trying to learn by doing it but not getting too far.

I asked about a new driver (i.e. the topic of this thread) - but OK. You lost me.

That didn't change that the information about WWAN was incorrect.

I suggested the web GUI because of the difficulties you're expressing.

Did you add that line?

:bulb: Also, did you set a country in WiFi?

I was hoping you expound on this, but it seems you just reiterated the same information.

:warning: Ummmmmm...AP and client aren't listed. That's a problem. Did you accidentally snip that relevant of the line?

There might be an old driver

I asked about a new driver (i.e. the topic of this thread) - but OK. You lost me.

If I knew what the driver files/packages were, I'd have tried them and maybe I have. Did you read what I've shared in this post?

That didn't change that the information about WWAN was incorrect.
I suggested the web GUI because of the difficulties you're expressing.

As I've said and reiterated, I do not use the GUI so probably not a good idea to install a large number of packages only to remove them.
Besides, as mentioned I have an official build on one device and mine on another.

I can see the GUI on the official build...

As I had mentioned earlier, even on the official build, from the command line, it seems wifi is not associated to anything.

Yes, you suggested using wwan which I'll look into but I mentioned that the wifi would not come up even on the official build. Did you see that? Pretty sure the wifi needs to come up before any other steps are taken.

option disabled '0'

Did you add that line?

What are you asking me on this point? The wireless file always has this line unless something's changed.
It disables or enables wifi.
This is what the official wireless file looks like;

# cat wireless 

config wifi-device 'radio0'
	option type 'mac80211'
	option path 'platform/10300000.wmac'
	option channel '1'
	option band '2g'
	option htmode 'HT20'
	option disabled '0'

config wifi-iface 'default_radio0'
	option device 'radio0'
	option network 'lan'
	option mode 'sta'
	option ssid 'gst'
	option encryption '111'
        option key '111'

Also, did you set a country in WiFi?

Can I ask how this is pertinent to what I'm trying to do? I've never even seen such an option needed to use wireless.

It's gotten over my head because I have no experience what so ever with wifi, it's not something I

I was hoping you expound on this, but it seems you just reiterated the same information.

I'm not sure how. All you did was put '???' as your comment and now you say all I did was to reiterate so how exactly do you want me to further expand on that? I'll be happy to provide what ever information someone helping me wants but your questions are simply not clear.

Which part do you want me to explain again? That I don't have much knowledge with wifi or that it's gotten over my head without asking for help?

Sorry but many of your comments are simply cryptic and not very helpful. You sort of hint at this and that but never say very much that is useful.

Ummmmmm...AP and client aren't listed. That's a problem. Did you accidentally snip that relevant
of the line?

You can clearly see what is being shared, you didn't include the pertinent part.

***snip***
On my own build;
$ iw list
nl80211 not found.

The official build shows the information that should show up on my build once I have it right.
The official sees the AP so I snipped that info to show that my build is not even getting to that point.
The important part is what you didn't comment on, 'nl80211 not found'.

I'm kind of guessing that the solution is finding what ever that driver is that's not found, nl80211 and once I have that and related packages, can likely get wifi working on my own build.

Though, I'm not clear why the official build seems to show it has a problem with wireless being associated with a radio (I think).

I appreciate it but can you please be a little more informative. My goal is not who's right or who's wrong, it's trying to understand what I have to do to fix this issue with limited knowledge.

Imma try one more time:

OK, I've never seen it that in an official build.

Well it is, and my statement therefore literally means what it says. You must set the correct country so the radio knows the legal parameters in which it can transmit. Information in the wiki.

See: https://openwrt.org/docs/guide-user/network/wifi/basic

I'll try again here.

What you pasted says theres no AP functionality on your device. Since I'm not being cryptic and I asked if you snipped the line. Since you seem confused, I assume not.

:spiral_notepad: Therefore there's something seriously wrong and your device is not capable of being an Access Point nor a STA (i.e. client).

Since you seem unclear as to why, and beleive I'm being cryptic, perhaps someone else can assist better with troubleshooting that issue with you.

I think the direction of the last few comments are pointless and I believe the problem is simple to someone who knows this well. To me, it's simply a missing driver. But, which packages are needed or need to be replaced, that's the key.

To try and see the difference, I created a wireless connecting using the GUI and the official build.
In the network file, I see an interface called 'wwan' but ifconfig shows the wireless interface as wlan0.
It comes up as it should.

I then added that interface to my build and the wireless file, edited to my own network and used 'wifi up'.

I'm not sure where 'Phy' is coming from but...

Sun Apr 23 15:40:38 2023 daemon.notice netifd: radio0 (10909): Phy not found
Sun Apr 23 15:40:38 2023 daemon.notice netifd: radio0 (10909): Could not find PHY for device 'radio0'
Sun Apr 23 15:40:38 2023 daemon.notice netifd: Wireless device 'radio0' set retry=0
Sun Apr 23 15:40:38 2023 daemon.crit netifd: Wireless device 'radio0' setup failed, retry=0
Sun Apr 23 15:40:38 2023 daemon.notice netifd: radio0 (10918): WARNING: Variable 'data' does not exist or is not an array/object
Sun Apr 23 15:40:38 2023 daemon.notice netifd: radio0 (10918): Bug: PHY is undefined for device 'radio0'
Sun Apr 23 15:40:38 2023 daemon.notice netifd: Wireless device 'radio0' is now down

... it must be related to this missing driver/package. In my little knowledge eyes, I have to solve the following then everything else will come together.

$ iw list
nl80211 not found.

I spent a lot of time searching Google about this 'nl80211 not found' only to find a lot of posts but none that supplied an answer which is why I posted here finally.

I dont mean this part, I mean this:

When you ran this on "official firmware" it responded IBSS only (i.e. ad-hoc or infrastructure mode). The following are missing:

  • AP (or Access Point)
  • STA (managed or client- needed for WWAN)

Example:

Supported interface modes:
                 * IBSS
                 * managed
                 * AP
                 * AP/VLAN
                 * monitor
                 * mesh point
                 * P2P-client
                 * P2P-GO

I wanted to verify this is not an issue.

If you're insisting on proceeding the mismatched configs, things not being identical, etc. - someone else may be able assist. I would suggest clarifying this first.

Then we can proceed to this.

Since you seem unclear as to why, and beleive I'm being cryptic, perhaps someone else
can assist better with troubleshooting that issue with you.

What is unclear is mostly how you're helping. I'm sorry but it's just confusing. I said I appreciate your help AND I said I'm more than happy to provide what ever is needed but it's not always clear what you're suggesting, asking or commenting. This reply is the most clear one yet :).

OK, I've never seen it that in an official build.

Ok well, I've never seen it not be so we're even :).

Also, did you set a country in WiFi?

Well it is, and my statement therefore literally means what it says. You must set the correct
country so the radio knows the legal parameters in which it can transmit. Information in the wiki.

I'm not trying to be argumentative here but just never seen that. I've built dozens of these routers using my own build but they were 18.x.x. In those, I never had to deal with country so it's not something I've had to do. Yes, I'm aware of it but no, it's not something I recall ever seeing in the wireless file. It's also not in the official file I shared so, what am I missing?

See: https://openwrt.org/docs/guide-user/network/wifi/basic

I'll check that out then. Looking at that, it's optional and not required. Looking at the official build, it's not specified in there either. Where do you feel I should be putting or missing this?

What you pasted says theres no AP functionality on your device. Since I'm not being cryptic and
I asked if you snipped the line. Since you seem confused, I assume not.

Actually, I shared the wireless file which shows that this router is to act as a client to an external AP, the AP on the LAN that it should connect to. Maybe that's the confusion on your side and I should have explained that better?

Therefore there's something seriously wrong and your device is not capable of being an
Access Point nor a STA (i.e. client).

The problem seems to be the nl80211 driver being missing from what I can tell.

However, these packages are installed but there must be something missing in my config that is not using it;
kmod-lib80211 - 5.10.161+5.15.81-1-1
kmod-mac80211 - 5.10.161+5.15.81-1-1

When I ran iw list, I didn't bother sharing all the details as I was just pointing out that on my second router running my build, nothing but the error showed.

Here is the full info from the official build which is now connected to wifi using GUI.

# iw list
Wiphy phy0
	wiphy index: 0
	max # scan SSIDs: 4
	max scan IEs length: 2257 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: 0x1fe
			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) (no IR)
			* 2472 MHz [13] (20.0 dBm) (no IR)
			* 2484 MHz [14] (20.0 dBm) (no IR)
	valid interface combinations:
		 * #{ IBSS } <= 1, #{ managed, AP, mesh point, P2P-client, P2P-GO } <= 4,
		   total <= 4, #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:
		* [ 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
1 Like