domenica 5 aprile 2009

p54usb and the wrong regulatory domain

In these days I used often my flybook. It is equipped with a WiFi Usb integrated dongle.
It came out that it's a prism54 chipset. So I could use p54usb module from the kernel.
But I discovered a problem. My netbook doesn't associate in any way to my Access Point.
At first I couldn't figure out why. So I gave up. I thought that was a problem in my hardware.
Yesterday, I noticed an error message from the kernel:


[ 193.290086] phy0: frequency change failed
[ 193.290155] phy0: failed to set freq to 2467 MHz for scan


This arouses my suspicion.
I decided to figure out more about this error.
So I looked for this string in drivers/net/wireless/p54/*.{c,h}.

denever@v33i:~$ grep -l "frequency change failed" driver/net/wireless/p54/*.{c,h}
p54common.c

I took a look to the code. And I decided to add some printf line to figure out where the problem is.
Then I discovered that p54common tries more frequencies to find the right one.
But if none of the set available matches then print out that error message.
So how is choosed the frequencies set?
Looking more carefully to the dmesg I found this line:

[ 131.901612] cfg80211: Using static regulatory domain info
[ 131.901621] cfg80211: Regulatory domain: US

So here we are!!!
My usb dongle uses the wrong frequency set.
But how can I change this frequency set?
I googled around discovering some interesting things.
First of all, I discovered that cfg80211 implements a regulatory compliance.
And actually since cfg80211 came in to the kernel I experimented problems with my wifi dongle.
Reading here, I discovere that is possible to choose the regulatory domain setting a parameter of the cfg80211 module.
So I wrote a config file for modprobe and I placed it in my /etc/modprobe.d/.
Here follows my cfg80211.conf:

denever@v33i:~$ cat /etc/modprobe.d/cfg80211.conf
options cfg80211 ieee80211_regdom=EU

And now my dongle connect really fine :)
My dmesg:

denever@v33i:~$ dmesg | grep cfg80211
[ 131.901612] cfg80211: Using static regulatory domain info
[ 131.901621] cfg80211: Regulatory domain: EU

1 commento:

  1. Grazzie Mile :)

    This is exactly what I was looking for. My case is that I had bought a Wireless network card that was supposed to be 802.11n. I installed it but wouldn't download anything faster than 50k/s. After I realised that it was using China as its reg_dom (I bought it on eBay from China), I just had to create the same file but using AU instead of EU (as I'm in Australia).
    After that I'm downloading the same file at 1M/s :)
    What a difference!!!

    Ciao
    Paolo

    RispondiElimina