Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
ath9k_htc module and country code resp. regdomain issues
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
msst
Apprentice
Apprentice


Joined: 07 Jun 2011
Posts: 213

PostPosted: Thu Jun 13, 2013 6:08 pm    Post subject: ath9k_htc module and country code resp. regdomain issues Reply with quote

I am using a TP-LINK TL-WN722N, which works ok with the exception that its eeprom seems to be set to China regdomain, thereby only allowing channel 1-11 for wlan. Now I wanted to use channel 13 (legal here - and I don't care anyway) to bypass some network congestion. Well, after searching this forum and google for quite a while I did find several hints which all use some parameters in modprobe.conf.

I found both some uses for override_eeprom_regdomain and a countrycode parameter, but it seems I cannot get the ath module to accept it. I also tried the 3 other companion ath modules (ath9k_htc, ath9k_hw, ath9k_common), but same thing:

ath: `0x60' invalid for parameter `override_eeprom_regdomain'
[ 99.738880] ath: `0x60' invalid for parameter `override_eeprom_regdomain'
[ 138.483388] ath: `0' invalid for parameter `override_eeprom_regdomain'
[ 162.503897] ath: `392' invalid for parameter `countrycode'

Bah! After another spoiled hour looking around for a solution I have now patched away that broken regdomain bull**** by adding the lines

ch = &sband->channels[11];
ch->flags &= ~IEEE80211_CHAN_PASSIVE_SCAN;
ch = &sband->channels[12];
ch->flags &= ~IEEE80211_CHAN_PASSIVE_SCAN;
ch = &sband->channels[13];
ch->flags &= ~IEEE80211_CHAN_PASSIVE_SCAN;

right at the end to the function

ath_reg_apply_active_scan_flags(struct wiphy *wiphy,
enum nl80211_reg_initiator initiator)

in

drivers/net/wireless/ath/regd.c

That does the trick - at least until the next kernel update. Feel free to duplicate this patch if you are also annoyed by a wrong regdomain setting in the eeprom.

And if anyone knows how to "properly" fix these issues, please let me know.
Back to top
View user's profile Send private message
cwr
Veteran
Veteran


Joined: 17 Dec 2005
Posts: 1968

PostPosted: Sun Jun 16, 2013 5:40 pm    Post subject: Reply with quote

I use a TL-WN851N adapter, and it loads correctly _provided_ that
the drivers are loaded as modules.

In hostapd.conf I have:
Code:

hostapd.conf:country_code=GB
hostapd.conf:driver=nl80211


And the modules loaded are:
Code:

Module                  Size  Used by
ath9k                  65877  0
mac80211              314796  1 ath9k
ath9k_common            1430  1 ath9k
ath9k_hw              328079  2 ath9k,ath9k_common
ath                    12145  3 ath9k,ath9k_common,ath9k_hw
cfg80211              145617  3 ath9k,mac80211,ath
scsi_wait_scan           483  0


The /var/log/messages file has the following comments; apparently the chip
is set up three times, once on startup (with world defaults), once when the
initial (CN) domain is found in the card's ROM, and once by hostapd to GB.

Code:

cfg80211: Calling CRDA to update world regulatory domain
cfg80211: World regulatory domain updated:
cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
cfg80211:   (2402000 KHz - 2472000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
cfg80211:   (2457000 KHz - 2482000 KHz @ 20000 KHz), (300 mBi, 2000 mBm)
cfg80211:   (2474000 KHz - 2494000 KHz @ 20000 KHz), (300 mBi, 2000 mBm)
cfg80211:   (5170000 KHz - 5250000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
cfg80211:   (5735000 KHz - 5835000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
cfg80211: Updating information on frequency 2412 MHz for a 20 MHz width channel with regulatory rule:
cfg80211: 2402000 KHz - 2472000 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
cfg80211: Updating information on frequency 2417 MHz for a 20 MHz width channel with regulatory rule:
cfg80211: 2402000 KHz - 2472000 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
cfg80211: Updating information on frequency 2422 MHz for a 20 MHz width channel with regulatory rule:
cfg80211: 2402000 KHz - 2472000 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
cfg80211: Updating information on frequency 2427 MHz for a 20 MHz width channel with regulatory rule:
cfg80211: 2402000 KHz - 2472000 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
cfg80211: Updating information on frequency 2432 MHz for a 20 MHz width channel with regulatory rule:
cfg80211: 2402000 KHz - 2472000 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
cfg80211: Updating information on frequency 2437 MHz for a 20 MHz width channel with regulatory rule:
cfg80211: 2402000 KHz - 2472000 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
cfg80211: Updating information on frequency 2442 MHz for a 20 MHz width channel with regulatory rule:
cfg80211: 2402000 KHz - 2472000 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
cfg80211: Updating information on frequency 2447 MHz for a 20 MHz width channel with regulatory rule:
cfg80211: 2402000 KHz - 2472000 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
cfg80211: Updating information on frequency 2452 MHz for a 20 MHz width channel with regulatory rule:
cfg80211: 2402000 KHz - 2472000 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
cfg80211: Updating information on frequency 2457 MHz for a 20 MHz width channel with regulatory rule:
cfg80211: 2402000 KHz - 2472000 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
cfg80211: Updating information on frequency 2462 MHz for a 20 MHz width channel with regulatory rule:
cfg80211: 2402000 KHz - 2472000 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
cfg80211: Disabling freq 2467 MHz as custom regd has no rule that fits a 20 MHz wide channel
cfg80211: Disabling freq 2472 MHz as custom regd has no rule that fits a 20 MHz wide channel
cfg80211: Disabling freq 2484 MHz as custom regd has no rule that fits a 20 MHz wide channel
cfg80211: Updating information on frequency 2412 MHz for a 20 MHz width channel with regulatory rule:
cfg80211: 2402000 KHz - 2472000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
cfg80211: Updating information on frequency 2417 MHz for a 20 MHz width channel with regulatory rule:
cfg80211: 2402000 KHz - 2472000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
cfg80211: Updating information on frequency 2422 MHz for a 20 MHz width channel with regulatory rule:
cfg80211: 2402000 KHz - 2472000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
cfg80211: Updating information on frequency 2427 MHz for a 20 MHz width channel with regulatory rule:
cfg80211: 2402000 KHz - 2472000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
cfg80211: Updating information on frequency 2432 MHz for a 20 MHz width channel with regulatory rule:
cfg80211: 2402000 KHz - 2472000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
cfg80211: Updating information on frequency 2437 MHz for a 20 MHz width channel with regulatory rule:
cfg80211: 2402000 KHz - 2472000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
cfg80211: Updating information on frequency 2442 MHz for a 20 MHz width channel with regulatory rule:
cfg80211: 2402000 KHz - 2472000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
cfg80211: Updating information on frequency 2447 MHz for a 20 MHz width channel with regulatory rule:
cfg80211: 2402000 KHz - 2472000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
cfg80211: Updating information on frequency 2452 MHz for a 20 MHz width channel with regulatory rule:
cfg80211: 2402000 KHz - 2472000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
cfg80211: Updating information on frequency 2457 MHz for a 20 MHz width channel with regulatory rule:
cfg80211: 2402000 KHz - 2472000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
cfg80211: Updating information on frequency 2462 MHz for a 20 MHz width channel with regulatory rule:
cfg80211: 2402000 KHz - 2472000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
cfg80211: Updating information on frequency 2467 MHz for a 20 MHz width channel with regulatory rule:
cfg80211: 2457000 KHz - 2482000 KHz @ 20000 KHz), (300 mBi, 2000 mBm)
cfg80211: Updating information on frequency 2472 MHz for a 20 MHz width channel with regulatory rule:
cfg80211: 2457000 KHz - 2482000 KHz @ 20000 KHz), (300 mBi, 2000 mBm)
cfg80211: Updating information on frequency 2484 MHz for a 20 MHz width channel with regulatory rule:
cfg80211: 2474000 KHz - 2494000 KHz @ 20000 KHz), (300 mBi, 2000 mBm)
cfg80211: Calling CRDA for country: CN
cfg80211: Updating information on frequency 2412 MHz for a 20 MHz width channel with regulatory rule:
cfg80211: 2402000 KHz - 2482000 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
cfg80211: Updating information on frequency 2417 MHz for a 20 MHz width channel with regulatory rule:
cfg80211: 2402000 KHz - 2482000 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
cfg80211: Updating information on frequency 2422 MHz for a 20 MHz width channel with regulatory rule:
cfg80211: 2402000 KHz - 2482000 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
cfg80211: Updating information on frequency 2427 MHz for a 20 MHz width channel with regulatory rule:
cfg80211: 2402000 KHz - 2482000 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
cfg80211: Updating information on frequency 2432 MHz for a 20 MHz width channel with regulatory rule:
cfg80211: 2402000 KHz - 2482000 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
cfg80211: Updating information on frequency 2437 MHz for a 20 MHz width channel with regulatory rule:
cfg80211: 2402000 KHz - 2482000 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
cfg80211: Updating information on frequency 2442 MHz for a 20 MHz width channel with regulatory rule:
cfg80211: 2402000 KHz - 2482000 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
cfg80211: Updating information on frequency 2447 MHz for a 20 MHz width channel with regulatory rule:
cfg80211: 2402000 KHz - 2482000 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
cfg80211: Updating information on frequency 2452 MHz for a 20 MHz width channel with regulatory rule:
cfg80211: 2402000 KHz - 2482000 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
cfg80211: Updating information on frequency 2457 MHz for a 20 MHz width channel with regulatory rule:
cfg80211: 2402000 KHz - 2482000 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
cfg80211: Updating information on frequency 2462 MHz for a 20 MHz width channel with regulatory rule:
cfg80211: 2402000 KHz - 2482000 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
cfg80211: Updating information on frequency 2467 MHz for a 20 MHz width channel with regulatory rule:
cfg80211: 2402000 KHz - 2482000 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
cfg80211: Updating information on frequency 2472 MHz for a 20 MHz width channel with regulatory rule:
cfg80211: 2402000 KHz - 2482000 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
cfg80211: Disabling freq 2484 MHz
cfg80211: Regulatory domain changed to country: CN
cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
cfg80211:   (2402000 KHz - 2482000 KHz @ 40000 KHz), (N/A, 2000 mBm)
cfg80211:   (5735000 KHz - 5835000 KHz @ 40000 KHz), (N/A, 3000 mBm)
cfg80211: Calling CRDA for country: GB
cfg80211: Updating information on frequency 2412 MHz for a 20 MHz width channel with regulatory rule:
cfg80211: 2402000 KHz - 2482000 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
cfg80211: Updating information on frequency 2417 MHz for a 20 MHz width channel with regulatory rule:
cfg80211: 2402000 KHz - 2482000 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
cfg80211: Updating information on frequency 2422 MHz for a 20 MHz width channel with regulatory rule:
cfg80211: 2402000 KHz - 2482000 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
cfg80211: Updating information on frequency 2427 MHz for a 20 MHz width channel with regulatory rule:
cfg80211: 2402000 KHz - 2482000 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
cfg80211: Updating information on frequency 2432 MHz for a 20 MHz width channel with regulatory rule:
cfg80211: 2402000 KHz - 2482000 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
cfg80211: Updating information on frequency 2437 MHz for a 20 MHz width channel with regulatory rule:
cfg80211: 2402000 KHz - 2482000 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
cfg80211: Updating information on frequency 2442 MHz for a 20 MHz width channel with regulatory rule:
cfg80211: 2402000 KHz - 2482000 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
cfg80211: Updating information on frequency 2447 MHz for a 20 MHz width channel with regulatory rule:
cfg80211: 2402000 KHz - 2482000 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
cfg80211: Updating information on frequency 2452 MHz for a 20 MHz width channel with regulatory rule:
cfg80211: 2402000 KHz - 2482000 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
cfg80211: Updating information on frequency 2457 MHz for a 20 MHz width channel with regulatory rule:
cfg80211: 2402000 KHz - 2482000 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
cfg80211: Updating information on frequency 2462 MHz for a 20 MHz width channel with regulatory rule:
cfg80211: 2402000 KHz - 2482000 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
cfg80211: Updating information on frequency 2467 MHz for a 20 MHz width channel with regulatory rule:
cfg80211: 2402000 KHz - 2482000 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
cfg80211: Updating information on frequency 2472 MHz for a 20 MHz width channel with regulatory rule:
cfg80211: 2402000 KHz - 2482000 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
cfg80211: Disabling freq 2484 MHz
cfg80211: Regulatory domain changed to country: GB
cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
cfg80211:   (2402000 KHz - 2482000 KHz @ 40000 KHz), (N/A, 2000 mBm)
cfg80211:   (5170000 KHz - 5250000 KHz @ 40000 KHz), (N/A, 2000 mBm)
cfg80211:   (5250000 KHz - 5330000 KHz @ 40000 KHz), (N/A, 2000 mBm)
cfg80211:   (5490000 KHz - 5710000 KHz @ 40000 KHz), (N/A, 2700 mBm)


Will
Back to top
View user's profile Send private message
msst
Apprentice
Apprentice


Joined: 07 Jun 2011
Posts: 213

PostPosted: Sun Jun 16, 2013 6:54 pm    Post subject: Reply with quote

Thanks for the hint. It seems I am missing something around this cfg80211 stuff.

lsmod:
Code:
ath9k_htc              56316  0
ath9k_common            1824  1 ath9k_htc
ath9k_hw              367169  2 ath9k_common,ath9k_htc
ath                    14673  3 ath9k_common,ath9k_htc,ath9k_hw


What I have in the logs with an unpatched driver is:
Code:
Apr  2 21:34:40 localhost kernel: [ 1204.990591] ath9k_htc 2-1.7:1.0: usb_probe_interface
Apr  2 21:34:40 localhost kernel: [ 1204.990596] ath9k_htc 2-1.7:1.0: usb_probe_interface - got id
Apr  2 21:34:40 localhost kernel: [ 1204.990602] usb 2-1.7: ath9k_htc: Firmware htc_9271.fw requested
Apr  2 21:34:40 localhost kernel: [ 1204.990624] usbcore: registered new interface driver ath9k_htc
Apr  2 21:34:40 localhost kernel: [ 1205.272625] usb 2-1.7: ath9k_htc: Transferred FW: htc_9271.fw, size: 51272
Apr  2 21:34:40 localhost kernel: [ 1205.507502] ath9k_htc 2-1.7:1.0: ath9k_htc: HTC initialized with 33 credits
Apr  2 21:34:40 localhost kernel: [ 1205.696474] ath9k_htc 2-1.7:1.0: ath9k_htc: FW Version: 1.3
Apr  2 21:34:40 localhost kernel: [ 1205.696478] ath: EEPROM regdomain: 0x809c
Apr  2 21:34:40 localhost kernel: [ 1205.696480] ath: EEPROM indicates we should expect a country code
Apr  2 21:34:40 localhost kernel: [ 1205.696481] ath: doing EEPROM country->regdmn map search
Apr  2 21:34:40 localhost kernel: [ 1205.696483] ath: country maps to regdmn code: 0x52
Apr  2 21:34:40 localhost kernel: [ 1205.696484] ath: Country alpha2 being used: CN
Apr  2 21:34:40 localhost kernel: [ 1205.696486] ath: Regpair used: 0x52
Apr  2 21:34:40 localhost kernel: [ 1205.696758] ieee80211 phy0: Atheros AR9271 Rev:1
Apr  2 21:35:01 localhost kernel: [ 1226.314501] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
Apr  2 21:35:02 localhost kernel: [ 1227.319662] wlan0: authenticate with MAC-ADDR
Apr  2 21:35:02 localhost kernel: [ 1227.365008] wlan0: capabilities/regulatory prevented using AP HT/VHT configur
ation, downgraded


I am not using hostapd and I do not need its functionality. Hmm, how would I configure that correctly without?
I have set in wpa_supplicant.conf

Code:
# Country code
# The ISO/IEC alpha2 country code for the country in which this device is
# currently operating.
country=JP


but it does not seem to kick in?

P.S.:
Another hour googling got me to emerge crda and iw. But neither "iw reg set JP" nor using crda with an appropriate variable set works. crda gave
Code:
Failed to set regulatory domain: -7

here. 8-;

One thing is for sure, this whole regulatory domain crap is a piece of undocumented ****
Back to top
View user's profile Send private message
cwr
Veteran
Veteran


Joined: 17 Dec 2005
Posts: 1968

PostPosted: Mon Jun 17, 2013 9:18 am    Post subject: Reply with quote

Hmm, it used to be a real pain a while back, and I couldn't get it to work for a couple
of years (not that I tried very hard). But the current incarnation installed with no
problems; however, I haven't tried it without hostapd.

Will

In fact I have a laptop has a built-in wireless and no hostapd, and that says:
Code:

kernel cfg80211: Ignoring regulatory request Set by core since the driver uses its own custom regulatory domain

in the system log. I'll dig a bit deeper.
Back to top
View user's profile Send private message
msst
Apprentice
Apprentice


Joined: 07 Jun 2011
Posts: 213

PostPosted: Mon Jun 17, 2013 6:56 pm    Post subject: Reply with quote

It seems to either work out of the box or not at all. Phie.

The worst about these packages is the absence of any meaningful documentation. Almost as if someone wants to make this a secret.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum