[ltp] "iw reg set .." on newer Thnkpads
Bjørn Mork
linux-thinkpad@linux-thinkpad.org
Sat, 09 Jul 2016 17:09:22 +0200
Hello,
fishing for opinions and experiences here since I guess I'm not the
first one to wonder about these things.
tl; dr; Background: Been using an x301 for 7.5 years. The last years
with removed BIOS whitelist, upgraded wifi to an Intel AC 7260 and
upgraded wwan to - uhm, well assorted LTE modems - the last one was a
Sierra Wireless MC7455. The combined SSD counters showed around 20000
hours uptime when the fan finally failed last Sunday. Fixing it is still
an option of course, but being without a laptop for days or weeks was
not an option. So I'm now on an X1 Carbon 4th gen instead.
This works fine, and hardware like the EM7455 LTE modem and the AC 8260
wifi are almost the same as what I used before, using the same Linux
drivers etc. Except for one annoying(?) feature: I cannot set the wifi
regulatory domain:
root@miraculix:/tmp# iw reg get
country 00: DFS-UNSET
(2402 - 2472 @ 40), (6, 20), (N/A)
(2457 - 2482 @ 20), (6, 20), (N/A), PASSIVE-SCAN
(2474 - 2494 @ 20), (6, 20), (N/A), NO-OFDM, PASSIVE-SCAN
(5170 - 5250 @ 80), (6, 20), (N/A), PASSIVE-SCAN
(5250 - 5330 @ 80), (6, 20), (0 ms), DFS, PASSIVE-SCAN
(5490 - 5730 @ 160), (6, 20), (0 ms), DFS, PASSIVE-SCAN
(5735 - 5835 @ 80), (6, 20), (N/A), PASSIVE-SCAN
(57240 - 63720 @ 2160), (N/A, 0), (N/A)
root@miraculix:/tmp# iw reg set NO
root@miraculix:/tmp# iw reg get
country 00: DFS-UNSET
(2402 - 2472 @ 40), (6, 20), (N/A)
(2457 - 2482 @ 20), (6, 20), (N/A), PASSIVE-SCAN
(2474 - 2494 @ 20), (6, 20), (N/A), NO-OFDM, PASSIVE-SCAN
(5170 - 5250 @ 80), (6, 20), (N/A), PASSIVE-SCAN
(5250 - 5330 @ 80), (6, 20), (0 ms), DFS, PASSIVE-SCAN
(5490 - 5730 @ 160), (6, 20), (0 ms), DFS, PASSIVE-SCAN
(5735 - 5835 @ 80), (6, 20), (N/A), PASSIVE-SCAN
(57240 - 63720 @ 2160), (N/A, 0), (N/A)
Listening on the uevents with "udevadm monitor -k -p" shows absolutely
nothing when I do the above. After digging around for quite a while, I
found that I can set the regdomain _before_ I load iwlwifi. Digging some
more, I found that iwlwifi actualy does set the regdomain to "NO"
regardless of what I do. And looking at the driver I found that the
source of that is an ACPI "WRDD" call in iwlwifi/mvm/nvm.c
I also vaguely remember seeing that introduced a while ago, without
thinking too much about it then since it didn't affect me. But now I
wonder: How does this work? How can possibly the BIOS know better than
me which regulatory domain I'm currenlty in? We obviously agree at the
moment, and it will take some before I'm able to test it in another
domain, but what is the source? Is it "NO" simply because that matches
my keyboard? That is going to fail, so I don't think it can be that
simple. Or is the BIOS using the LTE modem for this? That would be
pretty precise, but I wonder if that is really possible without steeping
on the OS/driver's toes? The modem is an USB device initialized and
configured by the OS. I don't see how it could be shared with another
"host", which the BIOS would appear to be in this regard. The same goes
for the GPS really, since that is just a function of the modem. And
besides, using that would be very precise but would require a map
database. A bit complex for a firmware function like this, I believe.
So the question remains: How does this work? And for those of you who
have used recent Thinkpads for a while: What experiences do you have?
Does it work all the time? Will the regdomain change as appropriate
when you move the laptop to another country?
Note that it is unnecessarily hard to figure out what domain the
BIOS/iwlwifi uses. "iw reg get" will always return "00" as shown
above. But if you do the "udevadm monitor -k -p" while loading the
driver, then you will see two messages from the regulatory driver: one
setting the regdomain to "00" and the second setting it to whatever your
BIOS returned.
Bjørn