Solved Ralink RT5390R WIFI in FreeBSD

zetrotrack000

Active Member

Reaction score: 13
Messages: 143

Hi
I have installed FreeBSD on my HP Pavilion G6 2298SE. This laptop has "Ralink RT5390R" wireless card. FreeBSD did not detect this card. After some searching, I have found this link:
which says:
Code:
To    compile    this driver into the kernel, place the following lines in your
     kernel configuration file:

       device ehci
       device uhci
       device ohci
       device usb
       device run
       device wlan
       device wlan_amrr

     Firmware is also needed, and provided by:

       device runfw
Can any guide me that where is kernel configuration file? After adding these lines to that file, do I need to run any command?

Also, this post says that the solution is available here:
But I don't know how to implement this solution. So, kindly guide to solve this problem.
Thanks
 

Phishfry

Son of Beastie

Reaction score: 1,779
Messages: 4,838

Ignore the kernel stuff. It is already built in.
You will need these settings:

/boot/loader.conf
Code:
if_run_load="YES"
runfw_load="YES"


/etc/rc.conf
Code:
wlans_run0="wlan0"
ifconfig_wlan0="WPA DHCP"
 
OP
Z

zetrotrack000

Active Member

Reaction score: 13
Messages: 143

Ignore the kernel stuff. It is already built in.
You will need these settings:

/boot/loader.conf
Code:
if_run_load="YES"
runfw_load="YES"


/etc/rc.conf
Code:
wlans_run0="wlan0"
ifconfig_wlan0="WPA DHCP"
Nope. Still not detected. Still only Ethernet card (re0) is appearing in "ifconfig" list.
 
OP
Z

zetrotrack000

Active Member

Reaction score: 13
Messages: 143

The run(4) driver supports USB 2.0 wireless adapters, yours is a internal wireless card, try ral(4), that driver supports PCI/PCIe/CardBus wireless adapters.
I have just tried that also. On following page:
it says to add (if_ral_load="YES") to /boot/loader.conf, which I dit, but still wifi card is not appearing under ifconfig.
 
OP
Z

zetrotrack000

Active Member

Reaction score: 13
Messages: 143

I have just tried that also. On following page:
it says to add (if_ral_load="YES") to /boot/loader.conf, which I dit, but still wifi card is not appearing under ifconfig.
Then if i try to create device by
Code:
ifconfig wlan0 create wlandev ral
It says:
"SIOCIFCREATE2: Device not configured"
 

T-Daemon

Aspiring Daemon

Reaction score: 336
Messages: 815

In the source code the only reference to RT5390R is in the pci_vendors list, and only RT5390 in the PCI/Cardbus front-end for the ral(4) driver, section ral_pci_ident ral_pci_ids .

I'm asking myself if this a device identification problem and adding the device id to the front-end source code and building a new kernel would be sufficient to recognize and support the device.

E.g. adding between line 103 and 104 the line
Code:
{ 0x1814, 0x539b, "Ralink Technology RT5392R" },
 
OP
Z

zetrotrack000

Active Member

Reaction score: 13
Messages: 143

In the source code the only reference to RT5390R is in the pci_vendors list, and only RT5390 in the PCI/Cardbus front-end for the ral(4) driver, section ral_pci_ident ral_pci_ids .

I'm asking myself if this a device identification problem and adding the device id to the front-end source code and building a new kernel would be sufficient to recognize and support the device.

E.g. adding between line 103 and 104 the line
Code:
{ 0x1814, 0x539b, "Ralink Technology RT5392R" },
Is there anything I can do in this case? Kindly guide me I will test it.
Regards
 

T-Daemon

Aspiring Daemon

Reaction score: 336
Messages: 815

Is there anything I can do in this case?
Obtain a FreeBSD source code (handbook), and build a new kernel.

After having the code, cd /usr/src/sys/dev/ral, edit if_ral_pci.c, go to line 103, write below the line the id line I wrote in the previous post, cd /usr/src , execute make -j4 kernel . This will build and install the new kernel to /boot/kernel, the old kernel will be renamed to /boot/kernel.old.

If you have problems booting the new kernel, you can choose the old kernel at the boot menu pressing the 5 key
 
OP
Z

zetrotrack000

Active Member

Reaction score: 13
Messages: 143

Obtain a FreeBSD source code (handbook), and build a new kernel.

After having the code, cd /usr/src/sys/dev/ral, edit if_ral_pci.c, go to line 103, write below the line the id line I wrote in the previous post, cd /usr/src , execute make -j4 kernel . This will build and install the new kernel to /boot/kernel, the old kernel will be renamed to /boot/kernel.old.

If you have problems booting the new kernel, you can choose the old kernel at the boot menu pressing the 5 key
You asked me to put following:
Code:
 { 0x1814, 0x539b, "Ralink Technology RT5392R" }
In line 104. But shouldn't I following:
Code:
 { 0x1814, 0x539b, "Ralink Technology RT5390R" }
Because my card is RT5390R, and not RT5392R?
Regards
 

T-Daemon

Aspiring Daemon

Reaction score: 336
Messages: 815

Thats a typo by my side. The pci id 0x539b is correct, just change to RT5390R.
 

T-Daemon

Aspiring Daemon

Reaction score: 336
Messages: 815

It seems that wireless card isn't supported. I assume it works with operating systems other than FreeBSD, so it can be ruled out to be defective.

You could get a supported USB wireless dongle, or if you don't like sticking dongles from the side of the laptop, an internal card. Looking at the laptops manual, the card is easy replaceable.

USB dongles are cheap nowadays, also internal wlan modules. Should you consider the latter, preferable intel chip based are the better choise. There are Intel based cards on the market or ebay around 5-15 $/£/€.

The laptops manual has a list with recomanded wlan modules, on that list there are two Intel Centrino Wireless-N adapters, 1000 and 1030, both supported by the iwn(4) driver. There is also a list of supported Intel chipsets in the iwn driver manual.

If replacing the module or buying a dongle is an option, here is the Hardware Compatibility List for 12.0-RELEASE, scrolldown to 3.4. Wireless Network Interfaces.
 
OP
Z

zetrotrack000

Active Member

Reaction score: 13
Messages: 143

It seems that wireless card isn't supported. I assume it works with operating systems other than FreeBSD, so it can be ruled out to be defective.

You could get a supported USB wireless dongle, or if you don't like sticking dongles from the side of the laptop, an internal card. Looking at the laptops manual, the card is easy replaceable.

USB dongles are cheap nowadays, also internal wlan modules. Should you consider the latter, preferable intel chip based are the better choise. There are Intel based cards on the market or ebay around 5-15 $/£/€.

The laptops manual has a list with recomanded wlan modules, on that list there are two Intel Centrino Wireless-N adapters, 1000 and 1030, both supported by the iwn(4) driver. There is also a list of supported Intel chipsets in the iwn driver manual.

If replacing the module or buying a dongle is an option, here is the Hardware Compatibility List for 12.0-RELEASE, scrolldown to 3.4. Wireless Network Interfaces.
Thanks a lot for such a detailed answer. of course HCL helps to purchase supported hardware. But in my case HCL rarely helps because, here, in my town (in a developing country), you are stick with wifi cards available with computer shops. The most a shopkeeper can favor you is that he can try all (3 or 4) wifi cards in your laptop. So, my question here is that if I manage to find a supported wifi card then does my (already installed) FreeBSD manage to detect it? Or a hardware change will require re-installation?
Thanks
 

T-Daemon

Aspiring Daemon

Reaction score: 336
Messages: 815

... you are stick with wifi cards available with computer shops. The most a shopkeeper can favor you is that he can try all (3 or 4) wifi cards in your laptop.
Instead of try and error, building the cards in and out multiple times, in the process easily a damage can arise, I suggest you investigate all wifi cards available beforehand (I assume by wifi cards you are refering to internal wlan modules).

Go to the shops, take pictures of the cards model numbers, on the package or the card itself, at home finalize your investigation. After you have found a suitable card pass over replacing the card in the shop.
So, my question here is that if I manage to find a supported wifi card then does my (already installed) FreeBSD manage to detect it?
Yes, the already installed FreeBSD will detect it. You will here encounter two possible situations.

First situation, a kernel modul (driver) will attache automatically to the card.

The second situation is the card needs an additional kernel modul loaded.
Or a hardware change will require re-installation?
No, no hardware change requiers a reinstallation.
 

T-Daemon

Aspiring Daemon

Reaction score: 336
Messages: 815

Nope. Still not detected. Still only Ethernet card (re0) is appearing in "ifconfig" list.
it says to add (if_ral_load="YES") to /boot/loader.conf, which I dit, but still wifi card is not appearing under ifconfig
I was re-reading the thread, you are checking with ifconfig if the card is supported, I missed that, twice.

With ifconfig you can't see if a card is supported or not. Try ral(4) again. This time execute sysctl net.wlan.devices with the default kernel and the modified kernel.

For creating a network interface you need to execute ifconfig wlan0 create wlandev ral0 ral0, not ral. [EDIT] refering to your post #6
 
OP
Z

zetrotrack000

Active Member

Reaction score: 13
Messages: 143

I posted a bug at:
A developer informed that it is supported by FreeBSD and suggest following as solution:
1. Put (wlans_ral0="wlan0") in /etc/rc.conf
2. Run command (ifconfig wlan0 create wlandev ral0)
Thanks to Michael Zhilin and T-Daemon for taking interest in my problem :)
The developer posted this method:
Committed into head under revision 352260, MFC after 5 days.
Whats does it mean?
 
OP
Z

zetrotrack000

Active Member

Reaction score: 13
Messages: 143

Solution for future reference:

1. open (/usr/src/sys/dev/ral/if_ral_pci.c) in text editor.

2. put:
{ 0x1814, 0x539b, "Ralink Technology RT5390R" }
in line 104

3. then "cd /usr/src"

4. then run command: make -j4 kernel

5. then put (wlans_ral0="wlan0") in /etc/rc.conf

6. then reboot

7. finally, run command (ifconfig wlan0 create wlandev ral0)
 
Top