Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keep phy2 and radio2 with Linksys WRT 3200ACM European version on 160Mhz and DTS #280

Open
p3x-robot opened this issue Mar 6, 2018 · 116 comments

Comments

@p3x-robot
Copy link

p3x-robot commented Mar 6, 2018

Hello @yuhhaurlin !

How are you today?

This is something, I found and this is what is weird for me, given it is the latest LEDE 17.01.4 and your latest driver:
Mar 6 19:37:11 192.168.78.1 digi.router hostapd: ACS: Only VHT20/40/80 is supported now

Ok, I found, I had to change the channel instead auto to 100 or 120 as sad in #226 (comment) by @BrainSlayer for Europe...

But, I still have a question. 🔢

My wifi /etc/config/wireless:

config wifi-device 'radio0'
	option type 'mac80211'
	option hwmode '11a'
	option path 'soc/soc:pcie-controller/pci0000:00/0000:00:01.0/0000:01:00.0'
	option channel 'auto'
	option country 'FR'
	option htmode 'VHT80'

config wifi-iface 'default_radio0'
	option device 'radio0'
	option network 'lan'
	option mode 'ap'
	option ssid 'patrikx3-digi'
	option encryption 'psk2+ccmp'
	option key '12345678'
	option wps_pushbutton '0'

config wifi-device 'radio1'
	option type 'mac80211'
	option hwmode '11g'
	option path 'soc/soc:pcie-controller/pci0000:00/0000:00:02.0/0000:02:00.0'
	option channel '1'
	option htmode 'HT20'
	option txpower '20'

config wifi-iface 'default_radio1'
	option device 'radio1'
	option network 'lan'
	option mode 'ap'
	option ssid 'patrikx3-digi-slow'
	option key '12345678'
	option encryption 'psk2+ccmp'
	option wps_pushbutton '1'

More info

For the next build I will wish to keep the phy2 (and the radio2 and because phy2 is fixed, I just fix it with the Europan router with this option in the radio2 and remove the option country from the radio0 and radio1:

config wifi-device 'radio1' or 'radio0'
    option country 'FR' # will remove this

Like this mwlwifi should let mwlwifi set it for you...

I found in the README.md that I can keep kmod-mwifiex-sdio and mwifiex-sdio-firmware, given I do not change the radio0, radio1 and because the phy2 is always US I could change to my router FR and it would work.

Do you have and idea what it could be or once phy2 is configured right, is it will work?

In one of your issue comment #185 (comment) you said, it might work with disable the option country for radio0 and radio1 and given radio2 is always US, I try to fix it with this option country 'FR' like:

config wifi-device 'radio2'
    option country 'FR'

What do you think master?

Thanks so much!

Patrik

@p3x-robot
Copy link
Author

p3x-robot commented Mar 6, 2018

Ok, my bad, I guess @BrainSlayer is in Europe and once I selected the 160 Mhz channel 100, it all started working, and the increase on Android from 280 Mbit went to 400 MBit, awesome!!!

But besides, so do you think I can keep phy2 and radio2 if I disable the radio0 and radio1, so remove the option country 'FR' and only fix it in radio2 so it is fixed US and fix it with the option country 'FS'.

Is that correct?

Reference: #226 (comment)

@p3x-robot p3x-robot changed the title Unable to enable 160 Mhz on Linksys WRT 3200ACM Keep phy2 and radio2 with Linksys WRT 3200ACM Mar 6, 2018
@BrainSlayer
Copy link

@p3x-robot yes i'm in europe. and 160 mhz works only with channel 100 upwards. for the region setting. it works gobally in cfg80211/mac80211. so you cannot use independend regions per radio as far as i know. but you can maybe mod the driver to hardcode a own region setting (except for mwlwifi, this one is fixed by the chipset)

@p3x-robot
Copy link
Author

@BrainSlayer Yesh, it works, you already helped me in a reference in this issue.

My only question now if I can configure to keep the phy2 and radio2 by reconfigure the US country to FR, then I can keep the kmod-mwifiex-sdio and mwifiex-sdio-firmware without having to remove, with some tweaks that @yuhhaurlin said it might work without the remove packages. I think if I can work out the phy2 with radio2, I think it might be much closer to the mwlwifi original closed source driver.

Will test though after the full build is done.

Thanks so much!

Though, it would be cool, if @yuhhaurlin could understand my poor English what I am trying to achive (with this mixed up regions from Europe but still phy2 is fixed with US, but the wireless config could be overridden). I suppose and hope.

@yuhhaurlin
Copy link
Collaborator

This will be done later.

@p3x-robot
Copy link
Author

p3x-robot commented Mar 7, 2018

Ok, the readme says either i keep the country (code 00 - unset) or remove mwifiex-sdio-firmware kmod-mwifiex-sdio, but the truth is it only works if I remove phy2 and remove mwifiex-sdio-firmware kmod-mwifiex-sdio and then set the country by hand for Europe France.

Than it works. So it either a problem with the chiip (fixed phy2 US, cannot override now way, I set it, luci, /etc/config/wireless), but it always US when i check iw reg get.

Besides need to remove the radio2 as well.

Only solutions is

opkg remove mwifiex-sdio-firmware kmod-mwifiex-sdio
# remove radio2 from /etc/config/network
# set the wifi wireless in LUCI to France and the it is cool

With the European version cannot set mwlwifi at all.

@yuhhaurlin
Copy link
Collaborator

The limitation will be removed later. The code will be modified as follows:

  1. Check if there is power table in DTS. If power table is existed, mwlwifi will load the power table to firmware.
  2. Due to firmware can check if region code and power table are programmed in EEPROM, it will reject the power setting from mwlwifi if EEPROM is programmed with region code and power table.
  3. Mapping region code to country code and rejecting setting of country code will be removed from mwlwifi.
  4. If user's setting is conflicted with region code and power table programmed in EEPROM, firmware won't let the setting work. In this way, it won't violate FCC rules and user has the flexibility to set country code.

This job will be done later.

@p3x-robot p3x-robot changed the title Keep phy2 and radio2 with Linksys WRT 3200ACM Keep phy2 and radio2 with Linksys WRT 3200ACM European version Mar 7, 2018
@p3x-robot
Copy link
Author

Hey @yuhhaurlin !

How are you?

So one more question, the phy2 I guess will be enabled.
But what we will do with the radio2? Is it gonna be enabled (which is weird, because it is open and anyone can connect and works) so we remove the radio2 or disable or how is it going to go?

@yuhhaurlin
Copy link
Collaborator

I have no idea about phy2. I only take care of mwlwifi.

@p3x-robot
Copy link
Author

Aha, so I still have to remove
opkg remove mwifiex-sdio-firmware kmod-mwifiex-sdio, is that right?
So is mwlwifi use the 3rd radio that is actually the radar, in my thinking?

@yuhhaurlin
Copy link
Collaborator

Phy2 is mwifiex which is another open source driver from Marvell. Mwlwifi is used for 88W8964 of WRT3200ACM (phy0 and phy1). You can use phy2, but I can't support it.

@p3x-robot
Copy link
Author

p3x-robot commented Mar 7, 2018

  1. Hm, so given there is no support and is not needed, in the firmware, i actually can just remove totally mwifiex-sdio-firmware , kmod-mwifiex-sdio and freely remove the radio2 in the /etc/config/wireless and that's how it will works with mwlwifi and still mwlwifi will use that 3rd radio for radar detection but in the driver instead of the /etc/config/wireless ?

  2. Now in my understanding is that mwlwifi will do everything including the radar, MU-MIMO and DFS, so only mwlwifi is required for the 3200ACM (no phy2 and no radio2).

@yuhhaurlin
Copy link
Collaborator

Mwlwifi can do everything. Phy2 is used for some purposes, but I have no idea of that.
I think what I need to do is let it can work with mwlwifi (running DFS).

@BrainSlayer
Copy link

@p3x-robot phy2 can be used as additional wifi interface. it has no influence to mwlwifi (phy0 / phy1)

@p3x-robot
Copy link
Author

@BrainSlayer you mean remove the mwifiex-sdio-firmware kmod-mwifiex-sdio, but keep the 3rd wifi radio?
or how do you complete it so that the DFS/DTS works?

@eduperez
Copy link

eduperez commented Mar 7, 2018

@BrainSlayer I am currently using phy2 as an "auxiliary channel"; I have both mwifiex-sdio-firmware and kmod-mwifiex-sdio installed. On the 5GHz band at phy0 I only use the DFS-free channels.

@p3x-robot
Copy link
Author

@eduperez, you are not in the EU, right? In USA, that's why it works?

@p3x-robot
Copy link
Author

@eduperez or using on the 5Ghz 80Mhz?

@p3x-robot p3x-robot changed the title Keep phy2 and radio2 with Linksys WRT 3200ACM European version Keep phy2 and radio2 with Linksys WRT 3200ACM European version on 160Mhz Mar 7, 2018
@p3x-robot
Copy link
Author

@eduperez yes, i confirmed, that 80 Mhz works, while 160Mhz is not :)

@eduperez
Copy link

eduperez commented Mar 7, 2018

@p3x-robot In EU, 80MHz only.

@p3x-robot
Copy link
Author

yes, so it is only non DTS frequencies. Got it.
What is weird is that radio2 is like half slower than the normal.

@p3x-robot
Copy link
Author

i guess until it is completed, 160 Mhz and DTS is not worth dealing with...

@p3x-robot p3x-robot changed the title Keep phy2 and radio2 with Linksys WRT 3200ACM European version on 160Mhz Keep phy2 and radio2 with Linksys WRT 3200ACM European version on 160Mhz and DTS Mar 7, 2018
@howl
Copy link

howl commented Apr 4, 2018

@yuhhaurlin if what I manage to understand in your explanation about what are you going to do with the country setting being locked by mwlwifi to a permissive one, that will solve a dispute we had time ago about what should be done.
If you do what you say letting mwlwifi to take country codes with same fcc rules like most of the european countries as for example FR, DE, ES... will be great.

@howl
Copy link

howl commented Aug 10, 2018

The limitation will be removed later. The code will be modified as follows:

Check if there is power table in DTS. If power table is existed, mwlwifi will load the power table to firmware.
Due to firmware can check if region code and power table are programmed in EEPROM, it will reject the power setting from mwlwifi if EEPROM is programmed with region code and power table.
Mapping region code to country code and rejecting setting of country code will be removed from mwlwifi.
If user's setting is conflicted with region code and power table programmed in EEPROM, firmware won't let the setting work. In this way, it won't violate FCC rules and user has the flexibility to set country code.

This job will be done later.

Hi @yuhhaurlin do you have an estimated date to make this change?

@p3x-robot
Copy link
Author

@BrainSlayer @yuhhaurlin @eduperez i bought a Intel® Wireless-AC 9260 for my laptop. what is weird, on if i set up 160Mhz on Windows it works, but on Linux i can get like 1-2 Mbit, but once I set it to 80 Mhz, I get the speed cool like 700Mbit.

My question, is MU-MIMO is only 160Mhz or that is independent from MU-MIMU?

PS: I think maybe the Windows driver is already using not 160Mhz but 80Mhz otherwise it would be weird. How can with 160Mhz in Windows works and in Linux not, but once I am 80Mhz 5Ghz, it flies...

@httpstorm
Copy link

You are far from the truth.
Short story: You cannot get or set TX power or break any regulations with this router. At best you can make it work.
Long story: First there is the user config. Then the system will apply some restrictions. Then we have a driver which does not support getting or setting TX power. And finally we have a firmware image in binary 88w8964.bin without any source code which runs on the radio - that has a power table and region preprogrammed. When you patch the driver so it doesn't report the region, the system will happy use the restrictions from whatever region you configure. When you patch regdb, the system will allow the maximum TX power specified there, and since the driver does not report the actual power the web interface will just show the maximum allowed value.

@bricco1981
Copy link

hi httpstorm, no I don't break any regulation, I asked just to understand,my country code and txpower are not again regulations. the only think that I'm trying to resolve on this machine is the very very low coverage on 2.4 ghz band. I never had any kind of problem on 5 ghz radio.that's all.
anyway thanks for your explanation.

@httpstorm
Copy link

Hi @bricco1981 ! There are two reasons I looked through the entire source code of the driver: 1. to make sure the radio works without any region conflicts and startup delays due to DFS scanning; 2. because I also felt that the TX power is way less than the allowed. For example my old 1043ND v4 covers my entire three story building + ceiling. While with WRT3200ACM some devices might switch from 5 GHz to 2.4 in the next room. While in the same room I'm getting 900 Mbit's with my laptop and 500 with my phone. Sadly I could not find any interface or code that affects TX power, but at lease I could disable the code which reports the region, so we can resolve point 1.
For 5GHz I recommend using channel 100. For 2.4 GHz: 8 or 5 might be a good option, but you should test what works best for you. Hove you performed any benchmarks or statistics?

@abuzaruzair
Copy link

Hi @httpstorm

If anyone is interested in testing my region free OpenWRT image for WRT3200ACM,
please let me know if it works well!
http://httpstorm.com/openwrt/

i flashed this version then rest the router, now i dont know the root password & even the wifi "ivan" password, please help 😟

@httpstorm
Copy link

Hi @abuzaruzair
Please excuse my mistake! I forgot to remove my config.
Don't worry, I will help you restore your router, it's quite easy even without a root password. To boot the previous firmware, perform these steps:

  1. Power off the router
  2. Power on, wait 10 seconds, and then power off (repeat 3 times)
  3. Power on the router, it will boot from the previous partition

You can install the new FW. I compiled and tested it on my router to make sure there are no passwords or left over config. You may use the same link:
http://httpstorm.com/openwrt/wrt3200acm/

The default Wi-Fi network is called httpstorm, and operates on channel 100, using 160 MHz. As a bonus, the new FW image is configured to mount USB storage automatically under /mnt. Pressing the reset button for less than a second, ejects all removable media. You can also access it under http://192.168.1.1:83/ - this can be disabled under System, Startup, g_httpstorm.

If you wish to run network benchmark, run the gns tool, which is preinstalled on the router. You also need to run it on a computer or another router: http://httpstorm.com/tools/net/g-net-speed/

Let me know if you still have any issues or requests, and I will help you get back to a happy router as soon as possible to compensate for my mistake! Good luck!

@abuzaruzair
Copy link

Hi @httpstorm

Thanks for fast reply and helpful solution, one more thing, the kernel version in you package is 5.4.75-1XXX and i want to install many package requires the version 5.4.87-1XXX any solution? :(

@httpstorm
Copy link

Hi @abuzaruzair
Unfortunately, even if I build the correct kernel version, you probably won't be able to install kernel modules from another source. Each build adds a unique tag to the kernel, and the kernel modules will only install on that kernel. Regular apps are not affected: I was able to install new apps on a 3 year old kernel.

You have two options:

  1. If you provide a list of all required packages, I can build a custom image for you.
  2. Create your own build environment. It's quite easy, and you can customise your image and default settings:
git clone https://github.com/httpstorm/openwrt.git
git checkout gvalkov

You may need to revert the commit labeled "Added software from gvalkov": git reset --hard HEAD~1. Or disable my apps from the build, since you don't have source code to compile them. Make sure to copy my apps and scripts from your router if you need them. If you like the default packages I have included, I can share my build config with you.

@abuzaruzair
Copy link

Dear friend @httpstorm

I dont have enough experience into building my package, but i really thank you, and feeling happy with 160mhz 5GHz wifi

i only need VPN policy based routing package with its dependencies, i think it will be like "luci-i18n-vpn-policy-routing-en" and its all sub packages like "luci-app-vpn-policy-routing" and one more package "dnsmasq-full"

Thanks ❤️

@httpstorm
Copy link

Hi @abuzaruzair
I'm glad to help you! I'll try to build an image with your packages later today after work. Perhaps I will also learn something new, and find useful packages. 😊The reason I started building my own images is because now I can update a router at a remote location and it will keep all settings and packages. Before that adding a new kernel package required physical access to reinstall all packages.
If you have some free time, please test my packages and give me some feedback.
My web server is running on port 83, you may connect a disk with music, videos and pictures and play them in a web browser http://192.168.1.1:83/
The gns network benchmark tool will test the speed and reliability of your network. I'm curious to see the results on a 160MHz Wi-Fi. If you know what USB to Serial is, these devices when connected are accessible on ports 81-83. Both TCP and WebSocket will work. The gfc command can be used to clone disks to and from another disk or file.

@httpstorm
Copy link

Hi @abuzaruzair
I have built a new image http://httpstorm.com/openwrt/wrt3200acm/2021-01-17.r14970/
Included are luci-app-vpn-policy-routing, and it's dependencies. I was not able to locate luci-i18n-vpn-policy-routing-en in the build menu, but I assume it is just translation, and since the default interface is already in English, it is should not be needed. You can install it manually. Regarding dnsmasq-full, a dependency package libnettle fails to build on macOS, but I was able to include dnsmasq-dhcpv6. I believe you can uninstall dnsmasq-dhcpv6 and install the official dnsmasq-full.

I hope that fits your needs! I also tried building from the latest GIT snapshot, unfortunately there are some packages which fail to build on macOS and that might take a long time for me to fix. Alas, unlike building on Ubuntu Linux, which is quite easy, since everyone is using it, building on macOS is often very hard, since many packages get updated and not tested to build on that platform.

Good luck! And please let me know if everything works well! I had no time to install and test the image.

@BeNeE25
Copy link

BeNeE25 commented Feb 11, 2021

Hello everyone,
I just bought the WRT3200ACM and am hapoy to see all the work here. I had no luck for now by editing with putty the wifiex file (newbie with this soft). But I am testing also @httpstorm build which is working great. I can put the maximum on Tx power that can set in my country. I will try again the other method from @eduperez but i could not find the mwifiex file only mwifiex-sdio and did not succeed to edit it. Thank for sharing your work and idea make me glad to have this router.

@httpstorm
Copy link

@BeNeE25
WRT3200ACM does not support getting or setting TX power on the main radio. What you see on the web interface is as per the database for each country. For the other radio which has a built-in antenna for radar detection, TX power can be changed – as I recall the maximum is 14 dBm. Last time I tried it was slow and unreliable, yet it covered a good distance. With my build you will still be within regulations. You are also free to select your correct country. Enjoy!

@BeNeE25
Copy link

BeNeE25 commented Feb 12, 2021

@httpstorm ok thx I understand. Just by curiosity it's mean that it is always 23db as it appear in openwrt 19.07.6 and so that in every case this router will be limited in power for 5Ghz?
Just for your information, Luci gui was not working on your build last night. I try to restart it via putty but it did not work. More easier to reinstall. Maybe i played too much with it.

@httpstorm
Copy link

@BeNeE25
Since the driver does not report the actual TX power, what you see in the GUI is irrelevant. This holds true no matter what version you are using. Luci is working fine in my builds. I have seen occasions where right after a reboot, the first page after login is not fully displayed, however everything functions correctly after you refresh the web page. If you experience any issues caused by custom changes to the configuration, you might restore the factory settings. All packages will be kept, since they are part of the firmware image.

@BeNeE25
Copy link

BeNeE25 commented Feb 13, 2021

Same for me. I just edit mwifiex-sdio according to eduperez's advice and it work fine. But normally, 160 Mhz is only working for channel 100 to 140 and channel selected is 36 (auto). I do not understand why... Somebody has an idea? Not really important because only my pc supports 160 Mhz...

@FCS001FCS
Copy link

FCS001FCS commented Feb 13, 2021

iw dev
phy#1
Interface wlan1-1
ifindex 32
wdev 0x100000008
addr 62:38:e0:b9:0a:d8
ssid WLAN1
type AP
channel 4 (2427 MHz), width: 20 MHz, center1: 2427 MHz
txpower 20.00 dBm
Interface wlan1
ifindex 31
wdev 0x100000007
addr 60:38:e0:b9:0a:d9
ssid WLAN2
type AP
channel 4 (2427 MHz), width: 20 MHz, center1: 2427 MHz
txpower 20.00 dBm
phy#0
Interface wlan0
ifindex 28
wdev 0x8
addr 60:38:e0:b9:0a:da
ssid WLAN5
type AP
channel 100 (5500 MHz), width: 80 MHz, center1: 5530 MHz
txpower 26.00 dBm

@dr-ni - Something is still not correct with your setup. Your "iw reg get" is the same as mine but your "iw dev" is missing the "phy#2" radio. BTW - In mine the "txpower" has always been at "0.00 dbm" but it does work fine except the third radio "phy#2" will rarely stop and it needs a re-boot to get going again.

My "iw dev":


OpenWrt 19.07.6, r11278-8055e38794

root@xxxxxxxxxxxxxx:~# iw dev
phy#2
Interface wlan2
ifindex 10
wdev 0x200000001
addr xx:xx:xx:xx:xx:e3
ssid N_xxxxxxxxxxxxx_2.4GHz
type AP
channel 11 (2462 MHz), width: 20 MHz, center1: 2462 MHz
txpower 0.00 dBm
phy#1
Interface wlan1
ifindex 12
wdev 0x100000002
addr xx:xx:xx:xx:xx:e1
ssid xxxxxxxxxxxxx_2.4GHz
type AP
channel 1 (2412 MHz), width: 20 MHz, center1: 2412 MHz
txpower 20.00 dBm
phy#0
Interface wlan0
ifindex 11
wdev 0x2
addr xx:xx:xx:xx:xx:e2
ssid xxxxxxxxxxxxx_5GHz
type AP
channel 100 (5500 MHz), width: 80 MHz, center1: 5530 MHz
txpower 26.00 dBm`

@eduperez
Copy link

Same for me. I just edit mwifiex-sdio according to eduperez's advice and it work fine. But normally, 160 Mhz is only working for channel 100 to 140 and channel selected is 36 (auto). I do not understand why... Somebody has an idea? Not really important because only my pc supports 160 Mhz...

Same here...but lower channels are more used around here, so want to use higher channels anyway.

@httpstorm
Copy link

I am not sure if regulations permit 160 MHz on the low channels. Technically it is possible to enable this, however db.txt does not list 160 MHz modes on lower channels.

@httpstorm
Copy link

httpstorm commented Feb 22, 2021

I am getting 920 Mbit/s down, 820 Mbit/s up using my modifications.
WRT3200 ch 100, 160 MHz. Note that my laptop MBP2019 16" only supports 80 MHz.
[ 6 GB 132 MB][ 104 MB/s] 59.9 s [592-198560 16087] down, 2 connections
[ 5 GB 562 MB][ 94 MB/s] 1:00.3 mm:ss [124-2097152 144728] up, 1 connection
http://httpstorm.com/tools/net/g-net-speed/

@httpstorm
Copy link

@dr-ni
In short: my changes allow you to use features allowed in you region, that would otherwise not work on WRT3200ACM. Please check and follow the local regulations!
I disabled reporting of the hard-coded region for both radios, so that the user specified region is honoured. This allows you to use all radios on WRT3200ACM, and enables channels above 100. The other change in db.txt for Bulgaria allows usage of 160 MHz on most channels and also disables DFS (radar detection), but you should check with your local regulations before changing this file. With WRT3200ACM you can't go outside the regulations, because the radio does not allow getting or setting TX power. Hence the values reported in LuCI are not valid.
git clone https://github.com/httpstorm/openwrt.git
git checkout gvalkov

@httpstorm
Copy link

It's around 3 meters away in the same room.
Run git log, to find the two important commits. Both have DFS in their names. Optionally reverted to network switch will let you rearrange the ports. You can git checkout a commit hash, and then git format-patch -1 to export it.

@lantis1008
Copy link

Surely you could move this to a more private chat now that it is drifting away from the core topic? I am subscribed to this topic for significant movement (as hopeless as that may be).

@httpstorm
Copy link

@dr-ni
There are only a few commits on branch gvalkov, you need these: DFS-free radio, DFS free wireless-regdb
Linksys firmware source code: https://www.linksys.com/us/support-article?articleNum=114663

@lantis1008
You are right, yet as far as I know there are no private messages on Github, and I had not been invited to help over another platform. We can perhaps use Skype? With my changes to the drivers, you can keep all radios and use 160 MHz.

@lantis1008
Copy link

A fools endeavour to get anything from the stock firmware in my opinion. You're swapping an open driver/closed firmware for a closed driver/closed firmware.
That's a step in the wrong direction :)

Discussions on the patches and how to make radio2 work and country codes play nice is on topic.
How fast does your perform? Was your laptop upside down and was the moon shining when you did the test is not. That's performance questions and wand waving.
Thats my point. Take it or leave it I don't care, but Im just getting tired of the email updates that mean nothing to me. That's my problem, but I'm asking if you guys would take it elsewhere. I'm not directing anything, I have no power here, just asking :)
If the topic circles back to some radical discovery, would be glad to get another email.

Anyway, carry on.

@httpstorm
Copy link

Analysing the OpenWRT driver took me a few days. I figured that TX power cannot be changed and the easiest way to fix the country restrictions is to return an error when asked about the hard-coded region. Here is how it works:

  1. OpenWRT queries all drivers for a hard coded region.
  2. In theory they should return the same region and the router should work happily preventing the user from setting anything else.
  3. Linksys did something very bad: radio 0 and 1 are set to EU, which a driver hack reports as FR, since EU is not defined in db.txt. Radio 2 returns US.
  4. OpenWRT doesn't like mixing regions and to be on the safe side permits only the common minimum allowed by all regions, and further disallows usage of DFS channels, so 100+ do not work, and no 160 MHz.
  5. After my changes to the drivers, querying the region returns an error, so OpenWRT thinks the hardware is region free and honours the user specified setting. Usage of these changes is fine, as longs as the correct region is selected.
  6. Changes to db.txt are grey matter. With WRT3200ACM it is not possible to go outside regulations, since TX power cannot be set. So there is the benefit of not waiting 5 minutes for DFS scanning, and the radio starts instantly. Metrological stations have long since abandoned the 5 GHz band, and not updating the regulations to remove DFS only hurts users. Still users must make sure local regulations are followed.

About the Linksys source code: I have not checked the implementation, but there are three possible options (pure guess):

  1. The system allows the user to override the region.
  2. Drivers do not report region.
  3. Radio 2 was designed to perform background scans for radars, but later remained unused. Makes me wonder if they disabled it after realising that mixing radios from different regions won't work.

With the original firmware, there is a 5 minute delay before starting radio on a DFS channel for the first time. Then if I remember correctly, the router remembers the scan result and starts without a delay.

I hope this shines some light as to why WRT3200ACM does not work as users would expect, and why people remove radio 2 to get things working. You can thank Linksys for mixing radios designed for different regions in the same device. One could argue that having a US region radio operating in EU would be illegal. To my knowledge, the only way users can set their valid region is by hacking the driver.

@dr-ni @lantis1008
I think his idea is to understand how and why things work in the official firmware. This might bring important light on the topic.
That's the reason I don't use e-mail notifications. I check GitHub periodically and it tells me if updates are available. I know your pain, and I'm sorry!

@httpstorm
Copy link

httpstorm commented Feb 24, 2021

@dr-ni

  • Yes, these are the correct changes to disable the hard-coded region for both radios. Keep in mind the commit hash changes every time I rebase my branch, so always start from the branch name.
  • Initially I spent a very long time on workarounds, setting different regions, etc. It was too complicated, hard to maintain and I wanted to use my own region. So I hacked the driver. This approach is easier to maintain. I keep my own fork, and compile firmware for my needs. Easy. My advise: make your own fork, integrate the patches you wish, add your configuration under /files and enjoy your router! I can also build an image for you to test.
  • You have the original source code. The drivers should be some there. In theory you should be able to compile it and make changes. I have not spent time on this. The OpenWRT developers needed updated sources to fix a bug, I made a request to Linksys and they provided the new source code. There were also some efforts to force Linksys to release the source code of the binary firmware. No success yet, but everyone is welcome to give them a call and explain why it is important for an open source router to be truly open source. mwlwifi: Don't lock system reg domain openwrt/openwrt#2397 (comment)

@dr-ni
Copy link

dr-ni commented Feb 25, 2021

I've removed now everything from this issue so that everybody can be happy here waiting for improvements without any noise. However, don't forget that github is an open source development platform. Issues should be used for reporting problems and discussions - not for silent version tracking :-(

@AcThPaU
Copy link

AcThPaU commented Apr 23, 2021

@httpstorm

Nice work ! Your patch is amazing and by all right should be included in the official build. However I lack the experience for building image. Could you please provide a short instruction on how to include your patch when building from official repo ?

@httpstorm
Copy link

Hello @AcThPaU !

You can build my fork:

git clone https://github.com/httpstorm/openwrt.git
cd openwrt
git checkout gvalkov
./scripts/feeds update -a
./scripts/feeds install -a
make defconfig
make menuconfig
make -j 16

Or you can export the patch and then import it on top of the official sources

# list commits
git log

# export a patch
git format-patch commit-hash
# integrate a patch on top of the official sources
git clone https://github.com/openwrt/openwrt.git
cd openwrt

# create a branch
git checkout -b gvalkov

# apply a patch
git am --signoff < patch_name.patch

@httpstorm
Copy link

Indeed my patch httpstorm/openwrt@677fef0 is necessary for the radios on WRT3200 to work properly on 5 GHz. So you are more than welcome to bring it to the attention of @kaloz @nbd @hauke or the rest of the OpenWRT maintainers. If they accept it, we can integrate my changes to master.
The reason I have not attempted to make a pull request is because I am not sure if it will be accepted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests