MichaIng / DietPi

Lightweight justice for your single-board computer!
https://dietpi.com/
GNU General Public License v2.0
4.72k stars 492 forks source link

DietPi-Config | Add ability to set regulatory domain (WiFi) #313

Closed k-plan closed 8 years ago

k-plan commented 8 years ago

@Fourdee

we need a option, like in the new raspi-config version, to get e.g. RPi 3 Wifi Channel 12+13 working with Kernel 4.4x ("unstable").

raspberry_change_wifi_country

Please see: "Test and set the correct regulatory domain"

root@RPi-3-test:~# iw reg get
country 00: DFS-UNSET
        (2402 - 2472 @ 40), (N/A, 20), (N/A)
        (2457 - 2482 @ 40), (N/A, 20), (N/A), NO-IR
        (2474 - 2494 @ 20), (N/A, 20), (N/A), NO-OFDM, NO-IR
        (5170 - 5250 @ 80), (N/A, 20), (N/A), NO-IR
        (5250 - 5330 @ 80), (N/A, 20), (0 ms), DFS, NO-IR
        (5490 - 5730 @ 160), (N/A, 20), (0 ms), DFS, NO-IR
        (5735 - 5835 @ 80), (N/A, 20), (N/A), NO-IR
        (57240 - 63720 @ 2160), (N/A, 0), (N/A)

root@RPi-3-test:~# iw reg set DE

root@RPi-3-test:~# iw reg get
country DE: DFS-ETSI
        (2400 - 2483 @ 40), (N/A, 20), (N/A)
        (5150 - 5250 @ 80), (N/A, 20), (N/A), NO-OUTDOOR
        (5250 - 5350 @ 80), (N/A, 20), (0 ms), NO-OUTDOOR, DFS
        (5470 - 5725 @ 160), (N/A, 26), (0 ms), DFS
        (57000 - 66000 @ 2160), (N/A, 40), (N/A)

root@RPi-3-test:~# iwlist wlan0 channel
wlan0     13 channels in total; available frequencies :
          Channel 01 : 2.412 GHz
          Channel 02 : 2.417 GHz
          Channel 03 : 2.422 GHz
          Channel 04 : 2.427 GHz
          Channel 05 : 2.432 GHz
          Channel 06 : 2.437 GHz
          Channel 07 : 2.442 GHz
          Channel 08 : 2.447 GHz
          Channel 09 : 2.452 GHz
          Channel 10 : 2.457 GHz
          Channel 11 : 2.462 GHz
          Channel 12 : 2.467 GHz
          Channel 13 : 2.472 GHz
          Current Frequency:2.412 GHz (Channel 1)

root@RPi-3-test:~# sed -i "s/REGDOMAIN=/REGDOMAIN=DE/g" /etc/default/crda

root@RPi-3-test:~# cat /etc/default/crda
# Set REGDOMAIN to a ISO/IEC 3166-1 alpha2 country code so that iw(8) may set
# the initial regulatory domain setting for IEEE 802.11 devices which operate
# on this system.
#
# Governments assert the right to regulate usage of radio spectrum within
# their respective territories so make sure you select a ISO/IEC 3166-1 alpha2
# country code suitable for your location or you may infringe on local
# legislature. See `/usr/share/zoneinfo/zone.tab' for a table of timezone
# descriptions containing ISO/IEC 3166-1 alpha2 country codes.

REGDOMAIN=DE

Hint: Tested on RPi 3, Odroid C1+ and C2. Working as well. If setting Regulatory Domain to the correct country code, and the same as the Access-Point (WiFi Router) I will get a higher bandwidth and a more solid connection.

root@oDroid-C1-TEST2:~# iw reg set 00

root@oDroid-C1-TEST2:~# iw reg get
country 00: DFS-UNSET

root@oDroid-C1-TEST2:~# iperf -s
[  4]  0.0-90.1 sec   747 MBytes  69.5 Mbits/sec
root@oDroid-C1-TEST2:~# iw reg set DE

root@oDroid-C1-TEST2:~# iw reg get
country DE: DFS-ETSI

root@oDroid-C1-TEST2:~# iperf -s
[  4]  0.0-90.0 sec  1.02 GBytes  97.4 Mbits/sec
Fourdee commented 8 years ago

@k-plan Excellent idea, will look into it :+1:

k-plan commented 8 years ago

@Fourdee

Verry nice! 😄 👍

Some testing result from RPi 3:

root@RPi-3-test:~# uname -a
Linux RPi-3-test 4.1.19-v7+ #858 SMP Tue Mar 15 15:56:00 GMT 2016 armv7l GNU/Linux

-------------------

root@RPi-3-test:~# iw reg get
country 00: DFS-UNSET

root@RPi-3-test:~# iwlist wlan0 channel
wlan0     11 channels in total; available frequencies :

root@RPi-3-test:~# iperf -s 
. . .
[  4]  0.0-90.4 sec   109 MBytes  10.1 Mbits/sec

--------------------

root@RPi-3-test:~# iw reg get
country DE: DFS-ETSI

root@RPi-3-test:~# iwlist wlan0 channel
wlan0     11 channels in total; available frequencies :

root@RPi-3-test:~# iperf -s 
. . .
[  4]  0.0-90.2 sec   176 MBytes  16.4 Mbits/sec

=================

root@RPi-3-test:~# uname -a
Linux RPi-3-test 4.4.8-v7+ #881 SMP Sat Apr 30 12:16:50 BST 2016 armv7l GNU/Linux

-------------------

root@RPi-3-test:~# iw reg get
country 00: DFS-UNSET

root@RPi-3-test:~# iwlist wlan0 channel
wlan0     11 channels in total; available frequencies :

root@RPi-3-test:~# iperf -s 
. . .
[  4]  0.0-90.1 sec   130 MBytes  12.1 Mbits/sec

--------------------

root@RPi-3-test:~# iw reg get
country DE: DFS-ETSI

root@RPi-3-test:~# iwlist wlan0 channel
wlan0     13 channels in total; available frequencies :

root@RPi-3-test:~# iperf -s 
. . .
[  4]  0.0-90.3 sec   197 MBytes  18.3 Mbits/sec

-------------------

Reference result from eth0:

root@RPi-3-test:~# iperf -s 
. . .
[  4]  0.0-90.0 sec  1010 MBytes  94.1 Mbits/sec
Fourdee commented 8 years ago

Country codes: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2

Current country code

iw reg get | grep -m1 'country' | awk '{print $2}' | tr -d ':'

Menu select common codes -GB -RU -US +manual entry option etc

Location: Network Options: Adapters > Wifi ? (menu too big already?, convert to scrollable menu?) Network Options: Adapters > WiFi Country?

Merge Menu_WifiHotspot into Menu_NetworkAdapters_Wifi() , create whiptail array to only show required menu options, depending on mode. Allows for https://github.com/Fourdee/DietPi/issues/311. Possible issue with top stats being too many lines,

k-plan commented 8 years ago

@Fourdee

Location: Network Options: Adapters > Wifi ? (menu too big already?, convert to scrollable menu?) Network Options: Adapters > WiFi Country?

Difficult question. Both have pros and cons. If scrollable, someone can miss it. If it will be a new list point, it will blow up the list. May be a issue, if you must have to put in new options later.

Merge Menu_WifiHotspot into Menu_NetworkAdapters_Wifi() , create whiptail array to only show required menu options, depending on mode. Allows for #311. Possible issue with top stats being too many lines,

Hmm ... it's the same here.


Menu select common codes -GB -RU -US +manual entry option etc

Hmm ..

Menu select common codes -GB -US -JP +manual entry option etc.

Menu select common codes -GB -US -CN +manual entry option etc.

WLAN Frequency

Can you please build a version with all possible option and check in via testing branch, so we can have a look?

Fourdee commented 8 years ago

@k-plan Thanks for the extra info :+1:

Started on this today. I havn't done any real "programming" for a while, so little rusty lol. Will let you know when its available for testing.

image

k-plan commented 8 years ago

@Fourdee

your screenshot is looking very handsome.
2.4 GHz (802.11b/g/n) is a good choice to start. (RPi 3 build-in WLAN module)

Fourdee commented 8 years ago

CRDA was not applying our saved setting during reboots, reverts to 00:

# - Apply to system configs, for reboots
echo -e "REGDOMAIN=$wifi_country_code_target" > /etc/default/crda
echo -e "options cfg80211 ieee80211_regdom=$wifi_country_code_target" > /etc/modprobe.d/cfg80211.conf

Fixed :)

Fourdee commented 8 years ago

@k-plan Uploaded to testing branch.

For now, I've just added the ability to change WiFi country code when running in non-AP mode. Also been playing around with the menu code (select "change mode") to resolve the height issue. Country Code is available in Network Options: Adapters > Wifi

Commit: https://github.com/Fourdee/DietPi/commit/49aa00bb3b272e10ec723a36cff9632dd52da332

I'll work on the AP mode menu next.

EDIT: And test 5ghz country code support for non-AP mode.

Turns out I do not own a 5ghz capable USB WiiFi dongle, and the RPi 3 is 2.4ghz only. :( lol

I might have to purchase one of these: http://www.edimax.com/edimax/merchandise/merchandise_detail/data/edimax/global/wireless_adapters_ac600_dual-band/ew-7811utc

Good list of RPi USB WiFi adapters: http://elinux.org/RPi_USB_Wi-Fi_Adapters

Fourdee commented 8 years ago

As far as I can tell, country code iw reg set has no effect on Hostapd.

Fourdee commented 8 years ago

Hostapd:

I can not get 2.4ghz N (150mbit) to work on hostapd with driver=rtl871xdrv and :

Bus 002 Device 002: ID 7392:7811 Edimax Technology Co., Ltd EW-7811Un 802.11n Wireless Adapter [Realtek RTL8188CUS]

Tried using:

hw_mode=n
wwm_enabled=1
ieee80211n=1

Any of these option prevents hostapd service from starting, no error codes/info from systemctl status hostapd -l

Tried with RPi 3

interface=wlan0
#driver=none
ssid=DietPi-HotSpot
hw_mode=g
channel=3
macaddr_acl=0
auth_algs=1
ssid=DietPi-HotSpot
wpa=2
wpa_passphrase=dietpihotspot
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
#wwm_enabled=1
ieee80211n=1

Seems to work with N (72mbit max on this device): image

So as far as I can tell, Wireless N support is only available for devices that use the driver=nl80211

k-plan commented 8 years ago

@Fourdee

wow, you are to quick for me. 😄
Sorry, have to catch up.

Starting now with gitbranch=testing

Fourdee commented 8 years ago

@k-plan I broke the RPi 3 hotspot. Turns out the internal BCM does not like any driver unless its disabled #driver=none. I've sent a new commit: https://github.com/Fourdee/DietPi/commit/746fa36b3fa3e2027527c625f12560560833936d you just need to grab dietpi-software if you are going to test RPi 3 with hotspot.

k-plan commented 8 years ago

@Fourdee

CRDA was not applying our saved setting during reboots, reverts to 00: Fixed :)

Hmm .. doesn't work here:

160508-0002

root@oDroid-C1-TEST:~# iw reg get
country DE: DFS-ETSI
        (2400 - 2483 @ 40), (N/A, 20), (N/A)
        (5150 - 5250 @ 80), (N/A, 20), (N/A), NO-OUTDOOR
        (5250 - 5350 @ 80), (N/A, 20), (0 ms), NO-OUTDOOR, DFS
        (5470 - 5725 @ 160), (N/A, 26), (0 ms), DFS
        (57000 - 66000 @ 2160), (N/A, 40), (N/A)

root@oDroid-C1-TEST:~#reboot

root@oDroid-C1-TEST:~# iw reg get
country 00: DFS-UNSET
        (2402 - 2472 @ 40), (6, 20), (N/A)
        (2457 - 2482 @ 40), (6, 20), (N/A), PASSIVE-SCAN
        (2474 - 2494 @ 20), (6, 20), (N/A), NO-OFDM, PASSIVE-SCAN
        (5170 - 5250 @ 160), (6, 20), (N/A), PASSIVE-SCAN
        (5250 - 5330 @ 160), (6, 20), (0 ms), DFS, PASSIVE-SCAN
        (5490 - 5730 @ 160), (6, 20), (0 ms), DFS, PASSIVE-SCAN

root@oDroid-C1-TEST:~# cat /etc/default/crda
REGDOMAIN=DE

root@oDroid-C1-TEST:~# cat /etc/modprobe.d/cfg80211.conf
options cfg80211 ieee80211_regdom=DE

160508-0001

Fourdee commented 8 years ago

@k-plan

root@oDroid-C1-TEST:~#reboot

root@oDroid-C1-TEST:~# iw reg get

Strange, run it twice:

reboot

iw reg get
sleep 5
iw reg get
Fourdee commented 8 years ago

Odroid C2 dmesg. It is being applied for me:

[    7.992802] cfg80211: Calling CRDA for country: GB
[    8.005850] cfg80211: Regulatory domain changed to country: GB
[    8.006045] cfg80211:  DFS Master region: ETSI
[    8.010317] cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
[    8.012946] cfg80211:   (2402000 KHz - 2482000 KHz @ 40000 KHz), (N/A, 2000 mBm)
[    8.020294] cfg80211:   (5170000 KHz - 5250000 KHz @ 80000 KHz), (N/A, 2000 mBm)
[    8.027643] cfg80211:   (5250000 KHz - 5330000 KHz @ 80000 KHz), (N/A, 2000 mBm)
[    8.034937] cfg80211:   (5490000 KHz - 5710000 KHz @ 160000 KHz), (N/A, 2700 mBm)
[    8.042425] cfg80211:   (57000000 KHz - 66000000 KHz @ 2160000 KHz), (N/A, 4000 mBm)
k-plan commented 8 years ago
root@oDroid-C1-TEST:~# reboot

root@oDroid-C1-TEST:~# iw reg get
country 00: DFS-UNSET
        (2402 - 2472 @ 40), (6, 20), (N/A)
        (2457 - 2482 @ 40), (6, 20), (N/A), PASSIVE-SCAN
        (2474 - 2494 @ 20), (6, 20), (N/A), NO-OFDM, PASSIVE-SCAN
        (5170 - 5250 @ 160), (6, 20), (N/A), PASSIVE-SCAN
        (5250 - 5330 @ 160), (6, 20), (0 ms), DFS, PASSIVE-SCAN
        (5490 - 5730 @ 160), (6, 20), (0 ms), DFS, PASSIVE-SCAN

root@oDroid-C1-TEST:~# dmesg 
 . . .      
 [   17.081693] usbcore: registered new interface driver rtl8192cu

root@oDroid-C1-TEST:~# cat /var/log/syslog | grep cfg 
May  8 19:50:51 oDroid-C1-TEST kernel: [  440.785811@0] cfg80211: Calling CRDA for country: DE
May  8 19:50:51 oDroid-C1-TEST kernel: [  440.798204@3] cfg80211: Regulatory domain changed to country: DE
May  8 19:50:51 oDroid-C1-TEST kernel: [  440.798292@3] cfg80211:  DFS Master region: ETSI
May  8 19:50:51 oDroid-C1-TEST kernel: [  440.798340@3] cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp), (dfs_cactime)
May  8 19:50:51 oDroid-C1-TEST kernel: [  440.798440@3] cfg80211:   (2400000 KHz - 2483500 KHz @ 40000 KHz), (N/A, 2000 mBm), (N/A)
May  8 19:50:51 oDroid-C1-TEST kernel: [  440.798585@3] cfg80211:   (5150000 KHz - 5250000 KHz @ 80000 KHz, 200000 KHz AUTO), (N/A, 2000 mBm), N/A)
May  8 19:50:51 oDroid-C1-TEST kernel: [  440.798705@3] cfg80211:   (5250000 KHz - 5350000 KHz @ 80000 KHz, 200000 KHz AUTO), (N/A, 2000 mBm), 0 s)
May  8 19:50:51 oDroid-C1-TEST kernel: [  440.798818@3] cfg80211:   (5470000 KHz - 5725000 KHz @ 160000 KHz), (N/A, 2698 mBm), (0 s)
May  8 19:50:51 oDroid-C1-TEST kernel: [  440.798914@3] cfg80211:   (57000000 KHz - 66000000 KHz @ 2160000 KHz), (N/A, 4000 mBm), (N/A)
May  8 19:58:50 oDroid-C1-TEST kernel: [    0.177597@0] cfg80211: Calling CRDA to update world regulatory domain

But I have to say, my C1+ is running DietPi from USB device at the moment and have installed "SoftEther"

I will make a fresh install on a new sd-card ...

k-plan commented 8 years ago

@Fourdee

starting with a fresh sd-card installation:

root@oDroid-C1-TEST:~# lsusb
Bus 001 Device 003: ID 7392:7822 Edimax Technology Co., Ltd
Bus 001 Device 002: ID 05e3:0610 Genesys Logic, Inc. 4-port hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

root@oDroid-C1-TEST:~# dmesg
 . . .
[    0.177589] cfg80211: Calling CRDA to update world regulatory domain
[    7.030012] usbcore: registered new interface driver rtl8192cu

root@oDroid-C1-TEST:~# cat /var/log/syslog | grep cfg
May  8 20:24:46 oDroid-C1-TEST kernel: [    0.177589@0] cfg80211: Calling CRDA to update world regulatory domain

root@oDroid-C1-TEST:~# iw reg get
country 00: DFS-UNSET
        (2402 - 2472 @ 40), (6, 20), (N/A)
        (2457 - 2482 @ 40), (6, 20), (N/A), PASSIVE-SCAN
        (2474 - 2494 @ 20), (6, 20), (N/A), NO-OFDM, PASSIVE-SCAN
        (5170 - 5250 @ 160), (6, 20), (N/A), PASSIVE-SCAN
        (5250 - 5330 @ 160), (6, 20), (0 ms), DFS, PASSIVE-SCAN
        (5490 - 5730 @ 160), (6, 20), (0 ms), DFS, PASSIVE-SCAN

root@oDroid-C1-TEST:~# cat /etc/default/crda
# Set REGDOMAIN to a ISO/IEC 3166-1 alpha2 country code so that iw(8) may set
# the initial regulatory domain setting for IEEE 802.11 devices which operate
# on this system.
#
# Governments assert the right to regulate usage of radio spectrum within
# their respective territories so make sure you select a ISO/IEC 3166-1 alpha2
# country code suitable for your location or you may infringe on local
# legislature. See `/usr/share/zoneinfo/zone.tab' for a table of timezone
# descriptions containing ISO/IEC 3166-1 alpha2 country codes.

REGDOMAIN=

root@oDroid-C1-TEST:~# cat /etc/modprobe.d/cfg80211.conf
cat: /etc/modprobe.d/cfg80211.conf: No such file or directory
root@oDroid-C1-TEST:~# iw reg get
country GB: DFS-ETSI
        (2402 - 2482 @ 40), (N/A, 20), (N/A)
        (5170 - 5250 @ 80), (N/A, 20), (N/A)
        (5250 - 5330 @ 80), (N/A, 20), (0 ms), DFS
        (5490 - 5710 @ 160), (N/A, 27), (0 ms), DFS
        (57000 - 66000 @ 2160), (N/A, 40), (N/A)

root@oDroid-C1-TEST:~# cat /etc/default/crda
REGDOMAIN=GB

root@oDroid-C1-TEST:~# cat /etc/modprobe.d/cfg80211.conf
options cfg80211 ieee80211_regdom=GB

root@oDroid-C1-TEST:~# reboot
root@oDroid-C1-TEST:~# iw reg get
country 00: DFS-UNSET
        (2402 - 2472 @ 40), (6, 20), (N/A)
        (2457 - 2482 @ 40), (6, 20), (N/A), PASSIVE-SCAN
        (2474 - 2494 @ 20), (6, 20), (N/A), NO-OFDM, PASSIVE-SCAN
        (5170 - 5250 @ 160), (6, 20), (N/A), PASSIVE-SCAN
        (5250 - 5330 @ 160), (6, 20), (0 ms), DFS, PASSIVE-SCAN
        (5490 - 5730 @ 160), (6, 20), (0 ms), DFS, PASSIVE-SCAN

root@oDroid-C1-TEST:~# cat /etc/default/crda
REGDOMAIN=GB

root@oDroid-C1-TEST:~# cat /etc/modprobe.d/cfg80211.conf
options cfg80211 ieee80211_regdom=GB

root@oDroid-C1-TEST:~# dmesg | grep cfg
[    0.177442] cfg80211: Calling CRDA to update world regulatory domain

root@oDroid-C1-TEST:~# cat /var/log/syslog | grep cfg
May  8 20:24:46 oDroid-C1-TEST kernel: [    0.177589@0] cfg80211: Calling CRDA to update world regulatory domain
May  8 20:43:43 oDroid-C1-TEST kernel: [ 1140.399978@3] cfg80211: Calling CRDA to update world regulatory domain
May  8 20:43:43 oDroid-C1-TEST kernel: [ 1140.424219@3] cfg80211: World regulatory domain updated:
May  8 20:43:43 oDroid-C1-TEST kernel: [ 1140.424304@3] cfg80211:  DFS Master region: unset
May  8 20:43:43 oDroid-C1-TEST kernel: [ 1140.424357@3] cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp), (dfs_cac_time)
May  8 20:43:43 oDroid-C1-TEST kernel: [ 1140.424450@3] cfg80211:   (2402000 KHz - 2472000 KHz @ 40000 KHz), (N/A, 2000 mBm), (N/A)
May  8 20:43:43 oDroid-C1-TEST kernel: [ 1140.424533@3] cfg80211:   (2457000 KHz - 2482000 KHz @ 40000 KHz), (N/A, 2000 mBm), (N/A)
May  8 20:43:43 oDroid-C1-TEST kernel: [ 1140.424614@3] cfg80211:   (2474000 KHz - 2494000 KHz @ 20000 KHz), (N/A, 2000 mBm), (N/A)
May  8 20:43:43 oDroid-C1-TEST kernel: [ 1140.424691@3] cfg80211:   (5170000 KHz - 5250000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2000 mBm), (N/A)
May  8 20:43:43 oDroid-C1-TEST kernel: [ 1140.424785@3] cfg80211:   (5250000 KHz - 5330000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2000 mBm), (0 s)
May  8 20:43:43 oDroid-C1-TEST kernel: [ 1140.424878@3] cfg80211:   (5490000 KHz - 5730000 KHz @ 160000 KHz), (N/A, 2000 mBm), (0 s)
May  8 20:43:43 oDroid-C1-TEST kernel: [ 1140.424954@3] cfg80211:   (5735000 KHz - 5835000 KHz @ 80000 KHz), (N/A, 2000 mBm), (N/A)
May  8 20:43:43 oDroid-C1-TEST kernel: [ 1140.425040@3] cfg80211:   (57240000 KHz - 63720000 KHz @ 2160000 KHz), (N/A, 0 mBm), (N/A)
May  8 20:43:43 oDroid-C1-TEST kernel: [ 1140.425370@3] cfg80211: Calling CRDA for country: GB
May  8 20:43:43 oDroid-C1-TEST kernel: [ 1140.437968@2] cfg80211: Regulatory domain changed to country: GB
May  8 20:43:43 oDroid-C1-TEST kernel: [ 1140.438046@2] cfg80211:  DFS Master region: ETSI
May  8 20:43:43 oDroid-C1-TEST kernel: [ 1140.438092@2] cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp), (dfs_cac_time)
May  8 20:43:43 oDroid-C1-TEST kernel: [ 1140.438185@2] cfg80211:   (2402000 KHz - 2482000 KHz @ 40000 KHz), (N/A, 2000 mBm), (N/A)
May  8 20:43:43 oDroid-C1-TEST kernel: [ 1140.440388@2] cfg80211:   (5170000 KHz - 5250000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2000 mBm), (N/A)
May  8 20:43:43 oDroid-C1-TEST kernel: [ 1140.442580@2] cfg80211:   (5250000 KHz - 5330000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2000 mBm), (0 s)
May  8 20:43:43 oDroid-C1-TEST kernel: [ 1140.444730@2] cfg80211:   (5490000 KHz - 5710000 KHz @ 160000 KHz), (N/A, 2700 mBm), (0 s)
May  8 20:43:43 oDroid-C1-TEST kernel: [ 1140.446875@2] cfg80211:   (57000000 KHz - 66000000 KHz @ 2160000 KHz), (N/A, 4000 mBm), (N/A)

May  8 20:46:08 oDroid-C1-TEST kernel: [    0.177442@0] cfg80211: Calling CRDA to update world regulatory domain

root@oDroid-C1-TEST:~# crda
COUNTRY environment variable not set.

Will test as well 'DE' but I think it's the same.

k-plan commented 8 years ago

@Fourdee

is it possible we missed something (packet, config, db ..) ?

https://wireless.wiki.kernel.org/en/developers/regulatory/crda

https://wireless.wiki.kernel.org/en/developers/Regulatory

xenfomation commented 8 years ago

My brain has been squished from LLMP, BUT I wanted to ask both of you --

Based on the dietpi-software and configure options:

The angle I am coming from is ensuring this is set as close to pre init 3 run-level as possible and also leaving a config option cache to avoid the kick back to !DE, but 00.

Thanks again for everyone's time to listen to my ideas as the code will come, oh trust me, but group work is far superior to a myopic approach!

Cheers to you both!

k-plan commented 8 years ago

Testing some tips I have read:

root@oDroid-C1-TEST:~# cat /etc/udev/rules.d/regulatory.rules
# WLAN-Regionseinstellungen festlegen

 KERNEL=="regulatory*", ACTION=="change", SUBSYSTEM=="platform", RUN+="/sbin/iw reg set DE"

## KERNEL=="regulatory*", ACTION=="change", SUBSYSTEM=="platform", RUN+="/sbin/crda"

But without success ...


Strange, run it twice:

root@oDroid-C1-TEST:~# iw reg get
country 00: DFS-UNSET
        (2402 - 2472 @ 40), (6, 20), (N/A)
        (2457 - 2482 @ 40), (6, 20), (N/A), PASSIVE-SCAN
        (2474 - 2494 @ 20), (6, 20), (N/A), NO-OFDM, PASSIVE-SCAN
        (5170 - 5250 @ 160), (6, 20), (N/A), PASSIVE-SCAN
        (5250 - 5330 @ 160), (6, 20), (0 ms), DFS, PASSIVE-SCAN
        (5490 - 5730 @ 160), (6, 20), (0 ms), DFS, PASSIVE-SCAN
root@oDroid-C1-TEST:~# sleep 5
root@oDroid-C1-TEST:~# iw reg get
country 00: DFS-UNSET
        (2402 - 2472 @ 40), (6, 20), (N/A)
        (2457 - 2482 @ 40), (6, 20), (N/A), PASSIVE-SCAN
        (2474 - 2494 @ 20), (6, 20), (N/A), NO-OFDM, PASSIVE-SCAN
        (5170 - 5250 @ 160), (6, 20), (N/A), PASSIVE-SCAN
        (5250 - 5330 @ 160), (6, 20), (0 ms), DFS, PASSIVE-SCAN
        (5490 - 5730 @ 160), (6, 20), (0 ms), DFS, PASSIVE-SCAN
xenfomation commented 8 years ago

KUDOS for getting on the right track!!!

https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2

While @k-plan is at the core of it, I was looking into using "iw reg set DE" before the physical interface tries to come alive...

Nice work and I will keep digging into this as it should take no longer than 15-30 minutes.

xenfomation commented 8 years ago

Despite the infinite claims for Debian/Ubuntu, I regret to report that /etc/default/crda does not promote regional codes as it should.

I was able to repeat @k-plan's issue of set manually, reboot, run iw reg get only to see "00: DFS-UNSET"

Now, as a cludge right now:

vi /etc/rc.local

#!/bin/sh -e
iw reg set DE
/DietPi/dietpi/dietpi-services start
/DietPi/dietpi/dietpi-banner 0
echo " Default Login:\n Username = root\n Password = dietpi\n"
exit 0

On reboot, I obviously retain this good config @k-plan needs:

iw reg get
country DE: DFS-ETSI
        (2400 - 2483 @ 40), (N/A, 20), (N/A)
        (5150 - 5250 @ 80), (N/A, 20), (N/A), NO-OUTDOOR
        (5250 - 5350 @ 80), (N/A, 20), (0 ms), NO-OUTDOOR, DFS
        (5470 - 5725 @ 160), (N/A, 26), (0 ms), DFS
        (57000 - 66000 @ 2160), (N/A, 40), (N/A)

So, looking to move this type of param-set/config option into native DietPi territory -- will post shortly.

xenfomation commented 8 years ago

I have a work around (that could become a fix) right now for retaining the regulatory code desired. I do not have the menu items updated to inject this data for the DietAdmin (at present) I do not have any real error handling, default values, etc -- it tries to work with what is defined.

Environment

I am running PI 2 B + DietPi v117 CRDA, it's "default config file", clean environment, etc

Work-Around/Partial Fix:

DE output before and after reboot

iw reg get country DE: DFS-ETSI (2400 - 2483 @ 40), (N/A, 20), (N/A) (5150 - 5250 @ 80), (N/A, 20), (N/A), NO-OUTDOOR (5250 - 5350 @ 80), (N/A, 20), (0 ms), NO-OUTDOOR, DFS (5470 - 5725 @ 160), (N/A, 26), (0 ms), DFS (57000 - 66000 @ 2160), (N/A, 40), (N/A)

GB output before and after reboot

iw reg get country GB: DFS-ETSI (2402 - 2482 @ 40), (N/A, 20), (N/A) (5170 - 5250 @ 80), (N/A, 20), (N/A) (5250 - 5330 @ 80), (N/A, 20), (0 ms), DFS (5490 - 5710 @ 160), (N/A, 27), (0 ms), DFS (57000 - 66000 @ 2160), (N/A, 40), (N/A)

Code Changed, but not checking in until all can look and provide feedback

/DietPi/config.txt (needs to be populated, read, and maintained by dietpi-config, etc) This will also ideally feedback into the menu system for COUNTRY as to ensure no more loss of COUNTRY Alpha-2 Characters:

#-------Wifi Country/ISO Code--
Wifi_REGION=DE

/DietPi/dietpi/boot (minor error checking to ensure Wifi_REGION is not null, commented out, etc) This is merely to follow the lay of the land; ensuring that as services are started, regulatory country codes are applied for Wifi (under Run_Init )

                #See if Wifi_REGION is set and if so, apply it via iw reg set
                Wifi_REGION=$(cat /DietPi/config.txt | grep -m1 '^Wifi_REGION' | sed 's/.*=//')
                iw reg set $Wifi_REGION

Nothing special, gets the job done and can be leveraged by the dietpi config utilities (as mentioned before) as long as all approve.

I hope this helps, @Fourdee as maybe it isn't the cleanest solution, but with an hour - 2 hours of integrating this with the WiFi COUNTRY setting (check, create, update dietpi data, as well as updating the native /etc/default/crda file) -- I do believe this will work as a fix.

I look forward to the feedback and pardon the delay -- had to swim through SD cards to start fresh.

Fourdee commented 8 years ago

@xenfomation

Based on your ideas :+1: , I'am going to do the following:

This will allow users to declare their country code prior to first run. Also ensures country code will always be applied during boot. I've tested iw reg set in boot script, gets applied.

Fourdee commented 8 years ago

Decided to make a function script for applying/changing WiFi country code, so we can use it in multiple scripts.

Following applies Country code to system. with value stored in dietpi.txt if set wifi_country_code= :

/DietPi/dietpi/func/dietpi-set_wificountrycode

Following changes value in dietpi.txt, known system configs, and applies new country code to system

/DietPi/dietpi/func/dietpi-set_wificountrycode GB

this function is called during boot, and when changing country code in dietpi-config

commit: https://github.com/Fourdee/DietPi/commit/f499ba6ce2b0c645ee109ca171f10d8e5ed683e2

Fourdee commented 8 years ago

Tests:

Set US

root@DietPi:~# /DietPi/dietpi/func/dietpi-set_wificountrycode US && iw reg get && cat /DietPi/dietpi.txt | grep country_code && cat /etc/default/crda && cat /etc/modprobe.d/cfg80211.conf
country US: DFS-FCC
        (2402 - 2472 @ 40), (N/A, 30), (N/A)
        (5170 - 5250 @ 80), (N/A, 17), (N/A)
        (5250 - 5330 @ 80), (N/A, 23), (N/A), DFS
        (5735 - 5835 @ 80), (N/A, 30), (N/A)
        (57240 - 63720 @ 2160), (N/A, 40), (N/A)
wifi_country_code=US
REGDOMAIN=US
options cfg80211 ieee80211_regdom=US

Set GB

root@DietPi:~# /DietPi/dietpi/func/dietpi-set_wificountrycode GB && iw reg get && cat /DietPi/dietpi.txt | grep country_code && cat /etc/default/crda && cat /etc/modprobe.d/cfg80211.conf
country GB: DFS-ETSI
        (2402 - 2482 @ 40), (N/A, 20), (N/A)
        (5170 - 5250 @ 80), (N/A, 20), (N/A)
        (5250 - 5330 @ 80), (N/A, 20), (N/A), DFS
        (5490 - 5710 @ 160), (N/A, 27), (N/A), DFS
        (57000 - 66000 @ 2160), (N/A, 40), (N/A)
wifi_country_code=GB
REGDOMAIN=GB
options cfg80211 ieee80211_regdom=GB

Set US, reboot:

root@DietPi:~# /DietPi/dietpi/func/dietpi-set_wificountrycode US

root@DietPi:~# reboot

root@DietPi:~# iw reg get && cat /DietPi/dietpi.txt | grep country_code && cat /etc/default/crda && cat /etc/modprobe.d/cfg80211.conf                           
country US: DFS-FCC
        (2402 - 2472 @ 40), (N/A, 30), (N/A)
        (5170 - 5250 @ 80), (N/A, 17), (N/A)
        (5250 - 5330 @ 80), (N/A, 23), (N/A), DFS
        (5735 - 5835 @ 80), (N/A, 30), (N/A)
        (57240 - 63720 @ 2160), (N/A, 40), (N/A)
wifi_country_code=US
REGDOMAIN=US
options cfg80211 ieee80211_regdom=US
xenfomation commented 8 years ago

@Fourdee -- slick! Especially with it being scriptable. Nicely done and for miscellaneous trivia, if they don't know their country code.... 00 works as a default ;-) Kinda breaks their own ISEC/ISO standards, but I am glad you knocked this out!

Fourdee commented 8 years ago

@xenfomation Yep, if only the system called /etc/default/crda during boot and used the value set there. Maybe there's something we missed.

Either way, this function script was needed so we can call it across multiple other scripts, based on a global country code value set in dietpi.txt

xenfomation commented 8 years ago

Indeed! Sad thing about it is... I haven't found anything to even imply it was missed by anyone. My reasoning for this is many have complained about this and it coincides with the whole "systemd" nonsense (IMHO).

I should have pull requests (sorry about the last two!!) to "testing" for #295 and #246 in a few hours for your review. This means I can get back to LLMP, but make a double-random sweep for CRDA. I mean, the three of us clearly see dmesg invoking CRDA, so yes: What are you not doing or doing ad-hoc, Mr. Debian?

Example from the maintainer and someone with the same questions as us! https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=721865

However, this is why I think nothing is missed (you have it all in DietPi!): http://raspberrypi.stackexchange.com/questions/40738/jessie-cfg80211-calling-crda-to-update-world-regulatory-domain

 dpkg --list | grep -i "iw\|crda\|wireless-regdb"
ii  crda                      3.13-1                    armhf        wireless Central Regulatory Domain Agent
ii  iw                        3.17-1                    armhf        tool for configuring Linux wireless devices
ii  libiw30:armhf             30~pre9-8                 armhf        Wireless tools - library
ii  wireless-regdb            2014.11.18-1              all          wireless regulatory database

Cheers!

k-plan commented 8 years ago

@Fourdee

Set via dietpi-config country code 00 -> DE (readout) ==>> reboot = DE (readout) setting -> CN (readout) ==> reboot = CN (readout) setting -> US (readout) ==>> reboot = US (readout) (I spare the log output here)

It works, nice. 👍


Here are some outputs, connected to a 5 GHz Network Access-Point:

May  9 20:14:07 oDroid-C1-TEST kernel: [  687.012837@3] RTL871X: VID = 0x0BDA, PID = 0x8812
May  9 20:14:07 oDroid-C1-TEST kernel: [  687.015625@3] RTL871X: Customer ID: 0x00, SubCustomer ID: 0xCD
May  9 20:14:07 oDroid-C1-TEST kernel: [  687.018707@3] RTL871X: hal_ReadMACAddress_8812AU MAC Address from EFUSE = 00:c0:ca:
May  9 20:14:07 oDroid-C1-TEST kernel: [  687.021876@3] RTL871X: ==>mpt_GetChnlGroup8812A in 5G, but Channel 163 in Group not found
May  9 20:14:07 oDroid-C1-TEST kernel: [  687.024869@3] RTL871X: ==>mpt_GetChnlGroup8812A in 5G, but Channel 163 in Group not found
May  9 20:14:07 oDroid-C1-TEST kernel: [  687.027777@3] RTL871X: ==>mpt_GetChnlGroup8812A in 5G, but Channel 163 in Group not found
May  9 20:14:07 oDroid-C1-TEST kernel: [  687.031541@3] RTL871X: ==>mpt_GetChnlGroup8812A in 5G, but Channel 163 in Group not found
May  9 20:14:07 oDroid-C1-TEST kernel: [  687.034350@3] RTL871X: EEPROMRegulatory = 0x0 TxPwrCalibrateRate=0x0
May  9 20:14:07 oDroid-C1-TEST kernel: [  687.036970@3] RTL871X: Board Type: 0x 0
May  9 20:14:07 oDroid-C1-TEST kernel: [  687.039595@3] RTL871X: mlmepriv.ChannelPlan = 0x7f
May  9 20:14:07 oDroid-C1-TEST kernel: [  687.042012@3] RTL871X: CrystalCap: 0x20
May  9 20:14:07 oDroid-C1-TEST kernel: [  687.043690@3] RTL871X: ThermalMeter = 0x23
May  9 20:14:07 oDroid-C1-TEST kernel: [  687.045333@3] RTL871X: SWAS: bHwAntDiv = 0, TRxAntDivType = 3
May  9 20:14:07 oDroid-C1-TEST kernel: [  687.046961@3] RTL871X: pHalData->PAType_2G is 0x3, pHalData->ExternalPA_2G = 0
May  9 20:14:07 oDroid-C1-TEST kernel: [  687.048668@3] RTL871X: pHalData->PAType_5G is 0x3, pHalData->ExternalPA_5G = 1
May  9 20:14:07 oDroid-C1-TEST kernel: [  687.050516@3] RTL871X: pHalData->LNAType_2G is 0x88, pHalData->ExternalLNA_2G = 1
May  9 20:14:07 oDroid-C1-TEST kernel: [  687.052236@3] RTL871X: pHalData->LNAType_5G is 0x88, pHalData->ExternalLNA_5G = 1
May  9 20:14:07 oDroid-C1-TEST kernel: [  687.053932@3] RTL871X: pHalData->TypeGPA = 0x0
May  9 20:14:07 oDroid-C1-TEST kernel: [  687.055590@3] RTL871X: pHalData->TypeAPA = 0x0
May  9 20:14:07 oDroid-C1-TEST kernel: [  687.057232@3] RTL871X: pHalData->TypeGLNA = 0x0
May  9 20:14:07 oDroid-C1-TEST kernel: [  687.058946@3] RTL871X: pHalData->TypeALNA = 0x0
May  9 20:14:07 oDroid-C1-TEST kernel: [  687.060755@3] RTL871X: RFE Type: 0x 3
May  9 20:14:07 oDroid-C1-TEST kernel: [  687.062404@3] RTL871X: PID= 0x8812, VID=  bda
May  9 20:14:07 oDroid-C1-TEST kernel: [  687.064038@3] RTL871X: PID= 0x8812, VID=  bda
May  9 20:14:07 oDroid-C1-TEST kernel: [  687.065646@3] RTL871X: Customer ID: 0x 0
May  9 20:14:07 oDroid-C1-TEST kernel: [  687.071109@3] RTL871X: ReadAdapterInfo8812AU <====
May  9 20:14:07 oDroid-C1-TEST kernel: [  687.072891@3] RTL871X: init_channel_set ChannelPlan ID 7f Chan num:38
May  9 20:14:07 oDroid-C1-TEST kernel: [  687.074993@3] RTL871X: rtw_register_early_suspend
May  9 20:14:07 oDroid-C1-TEST kernel: [  687.076668@3] RTL871X: rtw_macaddr_cfg MAC Address  = 00:c0:ca:
May  9 20:14:07 oDroid-C1-TEST kernel: [  687.078358@3] RTL871X: bDriverStopped:1, bSurpriseRemoved:0, bup:0, hw_init_completed:0
May  9 20:14:07 oDroid-C1-TEST kernel: [  687.080148@3] RTL871X: rtw_ndev_init(wlan0)
May  9 20:14:07 oDroid-C1-TEST kernel: [  687.083046@3] RTL871X: _rtw_drv_register_netdev, MAC Address (if1) = 00:c0:ca:
root@oDroid-C1-TEST:~# lsusb
Bus 001 Device 008: ID 0bda:8812 Realtek Semiconductor Corp.
Bus 001 Device 002: ID 05e3:0610 Genesys Logic, Inc. 4-port hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
root@oDroid-C1-TEST:~# iw reg get && cat /DietPi/dietpi.txt | grep country_code && cat /etc/default/crda && cat /etc/modprobe.d/cfg80211.conf
country DE: DFS-ETSI
        (2400 - 2483 @ 40), (N/A, 20), (N/A)
        (5150 - 5250 @ 80), (N/A, 20), (N/A), NO-OUTDOOR
        (5250 - 5350 @ 80), (N/A, 20), (0 ms), NO-OUTDOOR, DFS
        (5470 - 5725 @ 160), (N/A, 26), (0 ms), DFS
        (57000 - 66000 @ 2160), (N/A, 40), (N/A)
wifi_country_code=DE
REGDOMAIN=DE
options cfg80211 ieee80211_regdom=DE
root@oDroid-C1-TEST:~# iwlist wlan1 channel
wlan1     32 channels in total; available frequencies :
          Channel 01 : 2.412 GHz
          Channel 02 : 2.417 GHz
          Channel 03 : 2.422 GHz
          Channel 04 : 2.427 GHz
          Channel 05 : 2.432 GHz
          Channel 06 : 2.437 GHz
          Channel 07 : 2.442 GHz
          Channel 08 : 2.447 GHz
          Channel 09 : 2.452 GHz
          Channel 10 : 2.457 GHz
          Channel 11 : 2.462 GHz
          Channel 12 : 2.467 GHz
          Channel 13 : 2.472 GHz
          Channel 14 : 2.484 GHz
          Channel 36 : 5.18 GHz
          Channel 40 : 5.2 GHz
          Channel 44 : 5.22 GHz
          Channel 48 : 5.24 GHz
          Channel 52 : 5.26 GHz
          Channel 56 : 5.28 GHz
          Channel 60 : 5.3 GHz
          Channel 64 : 5.32 GHz
          Channel 100 : 5.5 GHz
          Channel 104 : 5.52 GHz
          Channel 108 : 5.54 GHz
          Channel 112 : 5.56 GHz
          Channel 116 : 5.58 GHz
          Channel 120 : 5.6 GHz
          Channel 124 : 5.62 GHz
          Channel 128 : 5.64 GHz
          Channel 132 : 5.66 GHz
          Channel 136 : 5.68 GHz
          Current Frequency:5.22 GHz (Channel 44)
root@oDroid-C1-TEST:~# iwlist wlan1 bit
wlan1     4 available bit-rates :
          1 Mb/s
          2 Mb/s
          5.5 Mb/s
          11 Mb/s
          Current Bit Rate:780 Mb/s
root@oDroid-C1-TEST:~# dmesg | grep cfg80211
[    0.177797] cfg80211: Calling CRDA to update world regulatory domain
[   19.546552] cfg80211: Calling CRDA to update world regulatory domain
[   19.687861] cfg80211: World regulatory domain updated:
[   19.690672] cfg80211:  DFS Master region: unset
[   19.690742] cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp), (dfs_cac_time)
[   19.696840] cfg80211:   (2402000 KHz - 2472000 KHz @ 40000 KHz), (N/A, 2000 mBm), (N/A)
[   19.700340] cfg80211:   (2457000 KHz - 2482000 KHz @ 40000 KHz), (N/A, 2000 mBm), (N/A)
[   19.702670] cfg80211:   (2474000 KHz - 2494000 KHz @ 20000 KHz), (N/A, 2000 mBm), (N/A)
[   19.704960] cfg80211:   (5170000 KHz - 5250000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2000 mBm), (N/A)
[   19.707305] cfg80211:   (5250000 KHz - 5330000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2000 mBm), (0 s)
[   19.710775] cfg80211:   (5490000 KHz - 5730000 KHz @ 160000 KHz), (N/A, 2000 mBm), (0 s)
[   19.712939] cfg80211:   (5735000 KHz - 5835000 KHz @ 80000 KHz), (N/A, 2000 mBm), (N/A)
[   19.715088] cfg80211:   (57240000 KHz - 63720000 KHz @ 2160000 KHz), (N/A, 0 mBm), (N/A)
[   19.717534] cfg80211: Calling CRDA for country: DE
[   19.739466] cfg80211: Regulatory domain changed to country: DE
[   19.741744] cfg80211:  DFS Master region: ETSI
[   19.741803] cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp), (dfs_cac_time)
[   19.746577] cfg80211:   (2400000 KHz - 2483500 KHz @ 40000 KHz), (N/A, 2000 mBm), (N/A)
[   19.750475] cfg80211:   (5150000 KHz - 5250000 KHz @ 80000 KHz, 200000 KHz AUTO), (N/A, 2000 mBm), (N/A)
[   19.753011] cfg80211:   (5250000 KHz - 5350000 KHz @ 80000 KHz, 200000 KHz AUTO), (N/A, 2000 mBm), (0 s)
[   19.755223] cfg80211:   (5470000 KHz - 5725000 KHz @ 160000 KHz), (N/A, 2698 mBm), (0 s)
[   19.757417] cfg80211:   (57000000 KHz - 66000000 KHz @ 2160000 KHz), (N/A, 4000 mBm), (N/A)

Get it on work is the first time a little tricky. The 2.4 GHz USB adapter was wlan0 before, so you have to plug 5 GHz USB adapter in / out and have to enable-disabel-enable WiFi network via dietpi-config because it is now wlan1. No big deal. You can as well edit /etc/network/interfaces by hand, but I want to test, it it will work without doing this.

But setting, reboot, switching country code works fine as well! 👍


Here some fun. I hope, the bottleneck is USB 2.0 Port of the C1+ :

root@oDroid-C1-TEST:~# iperf -s -i 12
[ ID] Interval       Transfer     Bandwidth
[  4]  0.0-90.0 sec  1.20 GBytes   114 Mbits/sec

😄

And the 802.11ac AC1200 Dual-Band USB 3.0 Adapter is really chatty in dmesg !

May  9 20:44:28 oDroid-C1-TEST kernel: [   54.242902@3] RTL871X: rtw_set_ps_mode(wlan1) Leave 802.11 power save - WIFI-TRAFFIC_BUSY
May  9 20:44:28 oDroid-C1-TEST kernel: [   54.275530@3] RTL871X: rtl8812_set_FwPwrMode_cmd: Mode=0 SmartPS=2 UAPSD=0
May  9 20:44:34 oDroid-C1-TEST kernel: [   60.242958@3] RTL871X: rtw_set_ps_mode(wlan1) Enter 802.11 power save - WIFI-TRAFFIC_IDLE
May  9 20:44:34 oDroid-C1-TEST kernel: [   60.279145@1] RTL871X: rtl8812_set_FwPwrMode_cmd: Mode=1 SmartPS=2 UAPSD=0
May  9 20:45:44 oDroid-C1-TEST kernel: [  130.497941@3] RTL871X:  ~~~~set sta key:groupkey
May  9 20:45:44 oDroid-C1-TEST rsyslogd-2007: action 'action 17' suspended, next retry is Mon May  9 20:46:14 2016 [try http://www.rsyslog.com/e/2007 ]
May  9 20:45:44 oDroid-C1-TEST kernel: [  130.514566@3] RTL871X: ==> rtw_set_key algorithm(4),keyid(2),key_mask(0)
May  9 20:45:44 oDroid-C1-TEST kernel: [  130.517661@3] RTL871X: set group key to hw: alg:4(WEP40-1 WEP104-5 TKIP-2 AES-4) keyid:2
May  9 20:45:44 oDroid-C1-TEST kernel: [  130.519934@0] RTL871X: send eapol packet
May  9 20:45:44 oDroid-C1-TEST kernel: [  130.521791@3] RTL871X: SetHwReg8812A, 5985, RCR= f40760ce
May  9 20:48:40 oDroid-C1-TEST kernel: [  306.242776@3] RTL871X: rtw_set_ps_mode(wlan1) Leave 802.11 power save - WIFI-TRAFFIC_BUSY
May  9 20:48:40 oDroid-C1-TEST rsyslogd-2007: action 'action 17' suspended, next retry is Mon May  9 20:49:10 2016 [try http://www.rsyslog.com/e/2007 ]
May  9 20:48:40 oDroid-C1-TEST kernel: [  306.280362@3] RTL871X: rtl8812_set_FwPwrMode_cmd: Mode=0 SmartPS=2 UAPSD=0
May  9 20:48:44 oDroid-C1-TEST kernel: [  310.243146@3] RTL871X: rtw_set_ps_mode(wlan1) Enter 802.11 power save - WIFI-TRAFFIC_IDLE
May  9 20:48:44 oDroid-C1-TEST kernel: [  310.282610@3] RTL871X: rtl8812_set_FwPwrMode_cmd: Mode=1 SmartPS=2 UAPSD=0
May  9 20:49:04 oDroid-C1-TEST kernel: [  330.240331@3] RTL871X: rtw_set_ps_mode(wlan1) Leave 802.11 power save - WIFI-TRAFFIC_BUSY
May  9 20:49:04 oDroid-C1-TEST kernel: [  330.259697@3] RTL871X: rtl8812_set_FwPwrMode_cmd: Mode=0 SmartPS=2 UAPSD=0
May  9 20:49:12 oDroid-C1-TEST kernel: [  338.242936@3] RTL871X: rtw_set_ps_mode(wlan1) Enter 802.11 power save - WIFI-TRAFFIC_IDLE
May  9 20:49:12 oDroid-C1-TEST rsyslogd-2007: action 'action 17' suspended, next retry is Mon May  9 20:49:42 2016 [try http://www.rsyslog.com/e/2007 ]
May  9 20:49:12 oDroid-C1-TEST kernel: [  338.284009@3] RTL871X: rtl8812_set_FwPwrMode_cmd: Mode=1 SmartPS=2 UAPSD=0
May  9 20:50:44 oDroid-C1-TEST kernel: [  430.535366@3] RTL871X:  ~~~~set sta key:groupkey
May  9 20:50:44 oDroid-C1-TEST rsyslogd-2007: action 'action 17' suspended, next retry is Mon May  9 20:51:14 2016 [try http://www.rsyslog.com/e/2007 ]
May  9 20:50:44 oDroid-C1-TEST kernel: [  430.555041@3] RTL871X: ==> rtw_set_key algorithm(4),keyid(1),key_mask(0)
May  9 20:50:44 oDroid-C1-TEST kernel: [  430.575130@3] RTL871X: set group key to hw: alg:4(WEP40-1 WEP104-5 TKIP-2 AES-4) keyid:1
May  9 20:50:44 oDroid-C1-TEST kernel: [  430.577789@3] RTL871X: send eapol packet
May  9 20:50:44 oDroid-C1-TEST kernel: [  430.582544@3] RTL871X: SetHwReg8812A, 5985, RCR= f40760ce
May  9 20:55:44 oDroid-C1-TEST kernel: [  730.579506@3] RTL871X:  ~~~~set sta key:groupkey
May  9 20:55:44 oDroid-C1-TEST kernel: [  730.620225@3] RTL871X: ==> rtw_set_key algorithm(4),keyid(2),key_mask(0)
May  9 20:55:44 oDroid-C1-TEST rsyslogd-2007: action 'action 17' suspended, next retry is Mon May  9 20:56:14 2016 [try http://www.rsyslog.com/e/2007 ]
May  9 20:55:44 oDroid-C1-TEST kernel: [  730.622736@3] RTL871X: set group key to hw: alg:4(WEP40-1 WEP104-5 TKIP-2 AES-4) keyid:2
May  9 20:55:44 oDroid-C1-TEST kernel: [  730.625377@3] RTL871X: send eapol packet
Fourdee commented 8 years ago

@k-plan Thanking you for in-depth testing and results as always :+1:

And the 802.11ac AC1200 Dual-Band USB 3.0 Adapter is really chatty in dmesg !

Holy cow lol. Looks like its reporting everytime it switches from powersaving modes.

I'll mark this as closed. I will take a look into https://github.com/Fourdee/DietPi/issues/311 next (which is a continuation of code changes here) and see what we can do.

k-plan commented 8 years ago

@Fourdee

just a quick late hint, work as well:

cat /etc/network/interfaces
#/etc/network/interfaces
#Please use DietPi-Config to modify network settings.
 . . 
# Wifi
allow-hotplug wlan0
iface wlan0 inet dhcp
metric 1
 . . .
#dns-nameservers 8.8.8.8 8.8.4.4
pre-up iw dev wlan0 set power_save off && iw reg set DE
post-down iw dev wlan0 set power_save on

https://www.raspberrypi.org/forums/viewtopic.php?p=919552#p919552

https://www.raspberrypi.org/forums/viewtopic.php?f=28&t=138731


rsyslogd-2007: action 'action 17' suspended, next retry is Mon May 9 20:49:42 2016 [try http://www.rsyslog.com/e/2007 ]

https://github.com/RPi-Distro/repo/issues/28#issuecomment-216640318

Fourdee commented 8 years ago

@k-plan

pre-up iw dev wlan0 set power_save off
post-down iw dev wlan0 set power_save on

Nice find. If this works with all adapters, would be a better solution than the current:

echo -e "options 8192cu rtw_power_mgnt=0" > /etc/modprobe.d/8192cu.conf
echo -e "options 8188eu rtw_power_mgnt=0" > /etc/modprobe.d/8188eu.conf

I'll have to give it a test with a few devices. If it doesn't break WiFi for the devices we have, cant see any reason not to add it in.