Chadster766 / McDebian

Linksys WRT3200ACM, WRT1900AC, WRT1900ACS, WRT1200AC and WRT32X Router Debian Implementation
99 stars 14 forks source link

WRT1900ACS V2 5ghz not working on McDebian 4.7.5 and 4.8.15 #22

Closed con7 closed 7 years ago

con7 commented 8 years ago

Hi!

I'm running McDebian 4.7.5 on my WRT1900ACSv2 (EU version), but i can't get the 5ghz wifi to work.

I've tried different country codes, channels etc. but i always get this error:

root@MCDEBIAN:/etc/hostapd# hostapd /etc/hostapd/wlan0.conf 
Configuration file: /etc/hostapd/wlan0.conf
rfkill: Cannot open RFKILL control device
wlan0: interface state UNINITIALIZED->COUNTRY_UPDATE
wlan0: IEEE 802.11 Configured channel (40) not found from the channel list of current mode (2) IEEE 802.11a
wlan0: IEEE 802.11 Hardware does not support configured channel
Could not select hw_mode and channel. (-3)
wlan0: interface state COUNTRY_UPDATE->DISABLED
wlan0: AP-DISABLED 
hostapd_free_hapd_data: Interface wlan0 wasn't started

A single time it worked, but some minutes later it didn't worked again with the same config, so i think it's not a config issue.

My current config:

country_code=AT
interface=wlan0
bridge=br0
driver=nl80211
ctrl_interface=/var/run/hostapd
ssid=test-5ghz
ignore_broadcast_ssid=0
hw_mode=a
channel=36
auth_algs=1
wmm_enabled=1
ieee80211n=1
ht_capab=[LDPC][HT40+][SHORT-GI-20][SHORT-GI-40]
ieee80211ac=1
ieee80211d=1
vht_capab=[RXLDPC][SHORT-GI-80][RX-STBC-1][SU-BEAMFORMER][SU-BEAMFORMEE][MAX-A-MPDU-LEN-EXP7][RX-ANTENNA-PATTERN][TX-ANTENNA-PATTERN]
vht_oper_chwidth=1
vht_oper_centr_freq_seg0_idx=42

wpa=2
wpa_passphrase=mcdebian123
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
root@MCDEBIAN:~# cat /sys/kernel/debug/ieee80211/phy1/mwlwifi/device_pwrtbl

power table loaded from dts: no
firmware region code: 0x30
number of channel: 38

Any suggestions? Thanks!

Chadster766 commented 8 years ago

Remove line "ieee80211d=1" from wlan0.conf

con7 commented 8 years ago

Already tried that, but i get the same error.

Chadster766 commented 8 years ago

Test change country code to "country_code=US"

ValCher1961 commented 8 years ago

Hi! You execute a command after the first run of the nucleus - "depmod -a", try this command and reboot.

con7 commented 8 years ago

thanks, @Chadster766 already tried different country codes.. but it didn't help. @ValCher1961 just tried that.. but after a reboot wlan0 doesn't come up. Really strange.. no matter which settings i try, it just wont work.

Chadster766 commented 8 years ago

Try channel=40 with vht_oper_centr_freq_seg0_idx=46

con7 commented 8 years ago

Thanks, but already tried that.. i've just flashed McDebian 4.4.16 and 5ghz wifi is working out of the box.. maybe the problem is because of the newer mwlwifi driver?

ValCher1961 commented 8 years ago

You have the latest driver WiFi?

con7 commented 8 years ago

I haven't changed wifi driver, i've just tested with stock mcdebian (4.7.5: not working, 4.4.16: working).

Chadster766 commented 8 years ago

Interesting, did you run all the upgrade scripts for the WRT1900AC ACS?

https://github.com/Chadster766/McDebian/wiki/X.-McDebian-Updates#installation-instructions-for-wrt1900ac-v2-wrt1900acs-and-wrt1200ac-from-a-live-mcdebian-router

con7 commented 8 years ago

Yes, I did. I'm currently running 4.4.16, will try 4.7.5 tomorrow again and report back. Thanks!

con7 commented 7 years ago

Just upgraded again from 4.4.16 to 4.7.5 - same problem, can't get 5ghz wifi to work, no matter which settings. I will further try to find out what causes the problem.

Chadster766 commented 7 years ago

I recommend you wait a bit on troubleshooting this :smiley:

Instead let me put together 4.8.12 update with the latest mwlwifi driver updates for you to try.

con7 commented 7 years ago

ok, thanks 😃 but i just found the issue.. the issue is the mwlwifi firmware at /lib/firmware/mwlwifi. i replaced the fw-files with the files of 4.4.16, rebooted and wifi is now working without any problems.. i'll check with the latest firmware files in a few minutes..

con7 commented 7 years ago

As i thought.. with the latest mwlwifi firmware from the kaloz repo it doesn't work.

con7 commented 7 years ago

I'll wait for 4.8.12 update with the latest mwlwifi driver to check further. Thanks! ;)

Chadster766 commented 7 years ago

Please test McDebian v4.8.15 on your WRT1900ACS V2:

Commands to Upgrade a live McDebian v4.7.5 WRT1900ACS V1\V2 or WRT1900AC V2 system to McDebian v4.8.15:

cd /
wget --user=mcdebian --password=mcdebian123 http://www.protechs-online.com/downloads/McDebian/firmwares/McDebian-WRT1900AC-V2-FW_VER1_kernel_4_8_15.img
wget --user=mcdebian --password=mcdebian123 http://www.protechs-online.com/downloads/McDebian/rootfs-updates/mcdebian-rootfs-update-v4_8_15.gz
tar zxf ./mcdebian-rootfs-update-v4_8_15.gz

flash_erase /dev/mtd4 0 0
flash_erase /dev/mtd6 0 0
nandwrite -p /dev/mtd4 McDebian-WRT1900AC-V2-FW_VER1_kernel_4_8_15.img
nandwrite -p /dev/mtd6 McDebian-WRT1900AC-V2-FW_VER1_kernel_4_8_15.img

#optional
rm -rf /mnt/usbkey/lib/modules/4.7.5
Chadster766 commented 7 years ago

I'm going to close this until I hear back from you :smile:

jbsky commented 7 years ago

Hi @Chadster766, Please, can you give a link of .config file?

Le 19 déc. 2016 à 05:38, Chad McCue notifications@github.com a écrit :

Closed #22.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

Chadster766 commented 7 years ago

I will upload it to the repo tomorrow :smile:

con7 commented 7 years ago

Thanks! But same problem with the new 4.8.15 update and the newer mwlwifi firmware files. I think it's a V2 only related problem..

Chadster766 commented 7 years ago

Would you be willing to do a Skype discussion on this issue?

Skype name: chad. mccue766

con7 commented 7 years ago

Yes sure, but i'm currently not at home. Will add you asap :) Maybe it's because of the hostapd version? McDebian's hostapd version is 2.3, LEDE (for example) 2.6.

Chadster766 commented 7 years ago

Ok I'm on central time.

SplicedNZ commented 7 years ago

Hi there, I'd like to report this issue on the 1900v1 also, started after a recent apt upgrade.

It can't seem to set crda properly, iw reg set US runs without error but it remains unset. I get this error in journalctl:

/sbin/crda terminated by signal 11 (segmentation fault) I'm on 4.7.5

EDIT:

Problem seems to be solved by updating hostapd and crda packages to sid versions

Chadster766 commented 7 years ago

When the issue appeared did you do a general Jessie "apt-update" and then "apt-get upgrade" with the current McDebian apt sources or something else?

Chadster766 commented 7 years ago

Troubleshooting with @con7 has proven the issue exists on McDebian 4.7.5 and 4.8.15 :disappointed:

SplicedNZ commented 7 years ago

@Chadster766 it was just a general "apt update", "apt upgrade". I hadn't noticed the issue because I hadn't rebooted for a couple of days after.

Chadster766 commented 7 years ago

@JTRealms you should be able to extract the 4.8.15 rootfs update to get those kernel drivers back into operation.

con7 commented 7 years ago

Got the 5ghz wifi to work if i set "REGDOMAIN" in /etc/default/crda (in my case AT). Then after a reboot hostapd starts without any problems.. but if i restart hostapd again, it isn't working anymore - it just works only directly after rebooting the device.

Chadster766 commented 7 years ago

Try setting both crda and wlan0.conf to the same country code.

con7 commented 7 years ago

It is already the same country code.

Chadster766 commented 7 years ago

In your testing have you tried a clean rootfs with no apt-get upgrades?

con7 commented 7 years ago

Yes, i tested without any upgrades.

Chadster766 commented 7 years ago

Ok thanks for the update :smile:

con7 commented 7 years ago

One more thing i've just found out: If i debug the communication between the kernel and udev i see country code changes to "EU" every few seconds:

UDEV  [532.978056] change   /devices/platform/regulatory.0 (platform)
ACTION=change
COUNTRY=00
DEVPATH=/devices/platform/regulatory.0
MODALIAS=platform:regulatory
SEQNUM=2528
SUBSYSTEM=platform
USEC_INITIALIZED=2970300

UDEV  [532.984440] change   /devices/platform/regulatory.0 (platform)
ACTION=change
COUNTRY=EU
DEVPATH=/devices/platform/regulatory.0
MODALIAS=platform:regulatory
SEQNUM=2529
SUBSYSTEM=platform
USEC_INITIALIZED=77448

Maybe this is the reason why it won't work after a hostapd restart. Because if i set the country-code to EU in /etc/default/crda and hostapd config, wifi wont work even after rebooting the device.

I'll try to find out more :)

con7 commented 7 years ago

Ok, the cause of the problem is crda. crda tries to set country to EU but the regulatory.bin in /lib/crda doesn't have country_code "EU".

root@MCDEBIAN:/lib/crda# regdbdump regulatory.bin | grep EU
root@MCDEBIAN:/lib/crda#

I've added EU to db.txt and generated my own regulatory.bin, now it is working without any problems (no matter if I set EU or AT in /etc/default/crda and hostapd config). But I don't know why crda want's implicitly to set country to EU.

I think everything would work if using static regulatory database (CONFIG_CFG80211_INTERNAL_REGDB) instead of crda, but that is not a solution of the cause.

Chadster766 commented 7 years ago

Thanks a lot for your great troubleshooting.

So will a newer crda db fix the issue?

con7 commented 7 years ago

A crda db with country_code "EU" would fix the issue, but EU is not a valid ISO 3166 country code, so the crda-db without EU is in point of fact correct (i believe) I think the main problem is, that in my case crda want's to set country to EU, which should not happen.

EDIT: I believe crda want's to set country to EU because of the firmware region code:

root@MCDEBIAN:~# cat /sys/kernel/debug/ieee80211/phy1/mwlwifi/device_pwrtbl

power table loaded from dts: no
firmware region code: 0x30
number of channel: 38
.....

@ 0x30 seems to be EU. So it looks like the only way to get it working with crda is to add "EU" to regulatory.bin

Chadster766 commented 7 years ago

Great troubleshooting :smile:

I should be able to reproduce the issue on my WRT3200ACM setting my wireless to a different country code than the driver.

The EU country code is an odd situation. I wonder why Marvell would hardcode a none standard country code into the firmware file or on chip. My guess is that Marvell must have provided a proprietary utility for that to OEM manufactures.

con7 commented 7 years ago

I'll open an issue at mwlwifi driver at github, maybe they would change region code mapping in driver - this is the relevant code:

https://github.com/kaloz/mwlwifi/blob/master/main.c

static const struct region_code_mapping regmap[] = {
    {"US", 0x10}, /* US FCC */
    {"CA", 0x20}, /* Canada */
    {"EU", 0x30}, /* ETSI   */
    {"ES", 0x31}, /* Spain  */
    {"FR", 0x32}, /* France */
    {"JP", 0x40}, /* Japan  */
    {"TW", 0x80}, /* Taiwan */
    {"AU", 0x81}, /* Australia */
    {"CN", 0x90}, /* China (Asia) */
};

All other country codes are valid.

con7 commented 7 years ago

Just found the same issue here with an other Marvell driver: https://patchwork.kernel.org/patch/7768381/ 😄

con7 commented 7 years ago

Opened new issue at mwlwifi: https://github.com/kaloz/mwlwifi/issues/130

Chadster766 commented 7 years ago

Excellent I hope it can be changed to a valid country code otherwise we can customise the crda db

Chadster766 commented 7 years ago

Sorry I mean we can customize mwlwifi

con7 commented 7 years ago

Thanks @Chadster766. Already recompiled mwlwifi with a valid country code for 0x30 and wifi is working perfectly for me now. We will see if it will be changed in mwlwifi repo too, but for now everything is fine 👍

5GHz iperf results:

$ ./iperf3 -c 192.168.1.1
Connecting to host 192.168.1.1, port 5201
[  4] local 192.168.1.190 port 53451 connected to 192.168.1.1 port 5201
[ ID] Interval           Transfer     Bandwidth
[  4]   0.00-1.00   sec  66.4 MBytes   556 Mbits/sec                  
[  4]   1.00-2.00   sec  71.0 MBytes   597 Mbits/sec                  
[  4]   2.00-3.00   sec  71.1 MBytes   596 Mbits/sec                  
[  4]   3.00-4.00   sec  72.9 MBytes   611 Mbits/sec                  
[  4]   4.00-5.00   sec  73.8 MBytes   619 Mbits/sec                  
[  4]   5.00-6.00   sec  71.7 MBytes   602 Mbits/sec                  
[  4]   6.00-7.00   sec  72.0 MBytes   603 Mbits/sec                  
[  4]   7.00-8.00   sec  74.9 MBytes   630 Mbits/sec                  
[  4]   8.00-9.00   sec  72.2 MBytes   605 Mbits/sec                  
[  4]   9.00-10.00  sec  73.3 MBytes   614 Mbits/sec                  
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bandwidth
[  4]   0.00-10.00  sec   719 MBytes   603 Mbits/sec                  sender
[  4]   0.00-10.00  sec   719 MBytes   603 Mbits/sec                  receiver

iperf Done.
Chadster766 commented 7 years ago

@con7 can you test a new beta for me?

It has EU added to the crda database, basically a copy of FR which should allow you to run an unmodified mwlwifi module.

The update also includes WRT3200 driver and firmware for it's 3rd radio. The udev script has been modified to work with the WRT3200 as well.

If it runs on your WRT1900ACM V2 then that would confirm the udev script for me.

wget --user=mcdebian --password=mcdebian123 http://www.protechs-online.com/downloads/McDebian/firmwares/McDebian-WRT1900AC-V2-FW_VER2_kernel_4_8_15.img
wget --user=mcdebian --password=mcdebian123 http://www.protechs-online.com/downloads/McDebian/rootfs-updates/mcdebian-rootfs-update-v4_8_15-VER2.gz
con7 commented 7 years ago

@Chadster766 I've just tested it and everything works 👍

Chadster766 commented 7 years ago

Thanks so much :smile:

lantis1008 commented 7 years ago

What functionality do you hope to get out of the Bluetooth module? The same as in OEM? Or can we use it as a standalone Bluetooth?