Hi lynxis! On Thu, May 26, 2016 at 02:57:28AM +0200, Alexander Couzens wrote: > ... > I really like this commit.
Good to hear that. I believe it's long overdue and the current situation led to quite a lot of problems (such as people needing hackish tools to simply set the regulatory domain to the place they are actually located). Whatever the strategy (if any) was in the past, the recent re-regulation quite clearly hints that this strategy has failed. > Can you set the country *explicit* to world in /etc/config/wireless > before appling this patch? I'm also not entirely opposed to hinting, ie. if there is something meaningful set in the on-flash-EEPROM or there is any other way to know the supposed target market, such as https://git.lede-project.org/?p=source.git;a=blob;f=target/linux/ar71xx/base-files/lib/ar71xx.sh;h=b06c60ed70d5c34cb5b64eaef9850c7b9f0e4e23;hb=HEAD#l260 we shall use that as an initial assumption. It could look like this in terms of code: diff --git a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh index 02c195e..5fd9b33 100644 --- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh +++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh @@ -680,13 +680,15 @@ drv_mac80211_setup() { # convert channel to frequency [ "$auto_channel" -gt 0 ] || freq="$(get_freq "$phy" "$channel")" - [ -n "$country" ] && { - iw reg get | grep -q "^country $country:" || { - iw reg set "$country" - sleep 1 - } + country="${country:=00}" + + iw reg get | grep -q "^country $country:" || { + iw reg set "$country" + sleep 1 } + iw reg get | grep -q "^country $country:" || return 1 + hostapd_conf_file="/var/run/hostapd-$phy.conf" no_ap=1 Or did you really just mean to add an option to /etc/config/wireless such as (draft!): diff --git a/package/kernel/mac80211/files/lib/wifi/mac80211.sh b/package/kernel/mac80211/files/lib/wifi/mac80211.sh index 77247cb..72717ee 100644 --- a/package/kernel/mac80211/files/lib/wifi/mac80211.sh +++ b/package/kernel/mac80211/files/lib/wifi/mac80211.sh @@ -109,6 +109,13 @@ detect_mac80211() { dev_id=" option macaddr $(cat /sys/class/ieee80211/${dev}/macaddress)" fi + countryline="# option country <ISO/IEC 3166-1 alpha2 country code>" + + reghint="$( iw reg get | grep "^country ..:.*$" | + sed 's/^country \(.*\):.*$/\1/' | xargs | + cut -d' ' -f1 )" + [ "$reghint" != "00" ] && countryline="option country $reghint" + cat <<EOF config wifi-device radio$devidx option type mac80211 @@ -116,6 +123,8 @@ config wifi-device radio$devidx option hwmode 11${mode_band} $dev_id $ht_capab + # SET YOUR COUNTRY CODE! + $countryline # REMOVE THIS LINE TO ENABLE WIFI: option disabled 1 Cheers Daniel _______________________________________________ Lede-dev mailing list Lede-dev@lists.infradead.org http://lists.infradead.org/mailman/listinfo/lede-dev