MiSTer-devel / Linux-Kernel_MiSTer

Other
14 stars 19 forks source link

WiFi region always "world" even when specified otherwise in wpa_supplicant.conf #23

Open coolbho3k opened 2 years ago

coolbho3k commented 2 years ago

The WiFi region on MiSTer seems to always be "world", even if it's set to TW or US or anything else in wpa_supplicant.conf.

As a result, I can't see my 5 GHz access point when it's set to certain US-specific channels, even when wpa_supplicant.conf is set to US. Being set to world may also limit the transmit power of the USB dongle, but this is a less critical issue.

Talking with @birdybro in the channel, we think that we need CRDA to be able to set the WiFi region correctly. Can we add it?

My adapter is a Asus AC-53 Nano (RTL8812BU), but from what I understand this doesn't matter.

Symptoms:

sorgelig commented 2 years ago

i've tried to add crda which didn't fix the issue. iw reg set US doesn't change the region. What i've read is that region is handled by kernel itself. It reads /lib/firmware/regulatory.db and then should handle it somehow. I have no idea how it works, so if you know more then you can tinker with kernel config to find a working solution.

coolbho3k commented 2 years ago

Thanks, I'll keep poking. Firmware is definitely there.

coolbho3k commented 2 years ago

I think I may have narrowed it down to the fact that cfg80211 was trying to load regulatory.db prior to the rootfs being mounted, similar to the problem this person was facing: https://unix.stackexchange.com/questions/513449/unable-to-load-regulatory-database

Their solution was to build cfg80211 as a module.

So the reason I think this is that I get this log in dmesg: regulatory.0: direct firmware load for regulatory.db failed with error -2

Prior to seeing messages about the rootfs being mounted.

sorgelig commented 2 years ago

ok. i will try it as a module. probably tomorrow

coolbho3k commented 2 years ago

Thanks. @amstan and I have also been hacking at it so will let you know if we get to it first.

sorgelig commented 2 years ago

yes, i can set region now. Although i'm not sure how to test it. I will post test version here later.

sorgelig commented 2 years ago

try this test build of linux+kernel: https://mega.nz/file/MQIgXbSZ#5ycVQd8XvMn-hUYtMV30wRwv62JqxHdHNNkqJaBv8ic

coolbho3k commented 2 years ago

I'll try this tonight. My way of trying it is to set my router's channel to 100 and just see if the MiSTer can find the SSID before and after.

coolbho3k commented 2 years ago

I think it's still worth keeping CONFIG_CFG80211=m. That's definitely better as iw reg set now works, and the kernel is now respecting the region set in wpa_supplicant.conf too.

It actually doesn't work for me - I can't scan channel 52 or 100. But I suspect my problem now might be specific to Realtek chipsets. I've read we might need to set CONFIG_RTW_IOCTL_SET_COUNTRY=y for Realtek.

This is a rabbit hole. If you don't have the adapter or the time, I can keep debugging as well.