SDB:ASUS WL-160N USB wireless adapter

Jump to: navigation, search



Tested on openSUSE

Recommended articles

Icon-manual.png

Related articles

Icon-help.png
{{{3}}}


Version: 11.1

Purpose

This page aims to be a guide on how to install and manually configure the WL-160N USB wireless Adapter. You will not be using Network manager but the drivers will be loaded and the connection made automatically as part of the startup routine.

Situation

You have installed OpenSuse 11.1 and your WL-160N adapter is not recognised or configured by YAST during install or post-install.

Reason

The Ralink 2870 chipset used by the ASUS WL-160N does not have a kernel driver pre-compiled and is not recognised by YAST. Therefore it must be setup manually.

Main Components

The main components used when manually setting up this wireless connection are:

  • ralink 2870 driver
  • wpa_supplicant
  • ifup

Assumed Knowledge

Ability to navigate within a File Manager and Terminal window. Basic knowledge of the wireless network you intend to connect to.

Process

First check that the adapter has been picked up as a USB device by logging into a console (Application - System - Terminal - Terminal Program in KDE) and typing lsusb. You should see a few lines of output similar to what is shown below, but of course depending on what actual USB devices you have plugged in.


...
andrew@linux-51jg:~> lsusb
Bus 002 Device 005: ID 0b05:1731 ASUSTek Computer, Inc. ASUS 802.11n Network Adapter
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 005: ID 09da:032b A4 Tech Co., Ltd
Bus 001 Device 004: ID 046d:c317 Logitech, Inc.
Bus 001 Device 003: ID 046d:08d7 Logitech, Inc. QuickCam Communicate STX
Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
andrew@linux-51jg:~>


...


The line we are interested in should look similar to the following:


...
Bus 002 Device 005: ID 0b05:1731 ASUSTek Computer, Inc. ASUS 802.11n Network Adapter
...


As long as you have this continue to the next step.


Driver Configuration and Build

Download the latest ralink driver from http://www.ralinktech.com/support.php?s=2. (The one supplied on the CD that came with the adapter will not compile against the latest kernels.) You are looking for the RT2870USB or RT2870WebUI driver. The WebUI driver also contains a web interface to the adapter but we will not be using this.

Unzip the file to a convenient location and follow the instructions in the README_STA file to build the driver. You will of course need the kernel source and GCC installed first. Also according to step three of the readme make sure you set the following two switches in the config.mk file before building the driver.

'HAS_WPA_SUPPLICANT=y' and 'HAS_NATIVE_WPA_SUPPLICANT_SUPPORT=y'

Once the driver has been successfully built you may want to make sure the driver will successfully load against the kernel. So within a terminal window logged in as root (type su <enter> and then the root password to become the root user) navigate to the os/linux directory of your unzipped download file and type /sbin/insmod rt2870sta.ko. The driver should load without any errors being reported back to the terminal.

Now that the driver has been successfully built, copy the newly created kernel driver file rt2870sta.ko which you will find in the os/linux directory of your unzipped download file to /lib/modules/{your kernel}-default/other. Create the 'other' directory if needed. You will need to be logged in as root to do this. The easiest way to do this if you are not sure is to go to 'Applications - System - File Manger - File Manager Super User Mode' (Within KDE) and enter the root password when instructed. Now any of the operations you do within this Konqueror window will be as the root user.

In a terminal window logged in as root run depmod -a. The driver should now be loaded automatically on subsequent boot ups. You can test the automatic loading of the driver by rebooting and then typing lsmod in a terminal window. You will see a long list of outputs but the one we are interested in will look similar to the following

...
usbcore  198656  10 snd_usb_audio,snd_usb_lib,gspca_zc3xx,isp1760,gspca_main,usbhid,rt2870sta,ehci_hcd,ohci_hcd
...


What we are interested in seeing is the rt2870sta module loaded against usbcore. If the driver is now loaded we can continue to complete the driver configuration.

First copy the RT2870STA.dat file from your unzipped download file to /etc/Wireless/RT2870STA. You will probably have to create part of this directory structure first and you will need to be logged in as the root user. Once this is done you will need to edit the file according to the instructions in the README_STA file. The exact changes you will need to make depend on your location and the type of wireless connection you need to make. Most options can stay as defaults but there are some that will need to take careful note of such as CountryRegion, CountryRegionBand,CountryCode, ChannelGeography, NetworkType, WirelessMode, AuthMode, EncrypType and WPAPSK. Once this is done we can move on to the next step.

As an example here is my configuration file but don't forget to change it according to your needs.

#The word of "Default" must not be removed
Default
CountryRegion=0
CountryRegionABand=0
CountryCode=NZ
ChannelGeography=1
NetworkType=Infra
WirelessMode=5
Channel=0
BeaconPeriod=100
TxPower=100
BGProtection=0
TxPreamble=0
RTSThreshold=2347
FragThreshold=2346
TxBurst=1
PktAggregate=0
WmmCapable=1
AckPolicy=0;0;0;0
AuthMode=WPA2PSK
EncrypType=TKIP
WPAPSK=Your_connection_key
DefaultKeyID=1
Key1Type=0
Key1Str=
Key2Type=0
Key2Str=
Key3Type=0
Key3Str=
Key4Type=0
Key4Str=
PSMode=CAM
FastRoaming=0
RoamThreshold=70
APSDCapable=0
APSDAC=0;0;0;0
HT_RDG=1
HT_EXTCHA=0
HT_OpMode=1
HT_MpduDensity=4
HT_BW=1
HT_AutoBA=1
HT_BADecline=0
HT_AMSDU=0
HT_BAWinSize=64
HT_GI=1
HT_MCS=33
HT_MIMOPSMode=3
IEEE80211H=0
TGnWifiTest=0
WirelessEvent=0
CarrierDetect=0


Configuring wpa_supplicant

Note: All the steps within this section will need to be performed as the root user

Wpa_supplicant is the program that will be used to make the actual connection to your wireless network. It should be installed by default, but in case it isn't just install wpa_supplicant and wpa_supplicant-gui using YAST Software Management.

In the directory /etc/wpa_supplicant you will find the file wpa_supplicant.conf. You will need to edit this file so it contains the line update_config=1. This will allow you to run the graphical interface to configure/update the connection profiles that will be stored here instead of creating them manually in the config file. You can of course edit the configuration file manually if you wish. A sample file for a WPA encrypted network is shown below if you wish to do this.


ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=wheel
eapol_version=2
update_config=1

network={
	ssid="yournetwork-ssid"
	psk="yournetwork-connection-key"
	proto=RSN
	key_mgmt=WPA-PSK
	pairwise=TKIP
	id_str=""
}


Now within a terminal window enter the command wpa_supplicant -Dwext -ira0 -c/etc/wpa_supplicant/wpa_supplicant.conf &. This should start wpa_supplicant. This is needed before starting the graphical interface. Now type in wpa_gui. This will start the front end to wpa_supplicant and allow you to scan for available wireless networks and set up a connection to them. Simply select your adapter and then select 'scan' to check for available networks. You should see your network in this laist as long as you have configured it to broadcast its SSID. Close this window and select the 'Manage Networks' tab, from here add/edit your network connection details. You should now be able to select your network and connect.

If all this has gone as planned then you should now be connected to your network. The remaining step is to get this to happen automatically on startup. If you still can't connect then double check the settings for wpa_supplicant and RT2870STA.dat.


ifup

Ifup is what will start your connection automatically on bootup in conjunction with wpa_supplicant. To do this we need to create a file called ifcfg-ra0 (where ra0 is the interface name that has been assigned to your network adapter). In the directory /etc/sysconfig/network create a file called ifcfg-ra0. This will need to be populated with configuration details that are dependent on your network setup but you can have a look at icfg.template to determine what is needed. Luckily you probably don't have to get too complex and some of this is the same information that you entered for wpa_supplicant. As an example here is my setup to connect to a WPA encrypted connection, assign user control over the interface and assign an IP address through DHCP.

DEVICE='ra0'
BOOTPROTO='dhcp'
STARTMODE='auto'
USERCONTROL='yes'
NAME='Whatever-you-want-to-call-this-connection'
DHCLIENT_PRIMARY_DEVICE='yes'
WIRELESS_ESSID='Your-Wireless-Network-SSID'
WIRELESS_AUTH_MODE='psk'
WIRELESS_WPA_PSK='Your-WPA-Network-key'
WIRELESS_AP_SCANMODE='1'

As another example, here is a 128-bit WEP key.

DEVICE='ra0'
BOOTPROTO='dhcp'
STARTMODE='auto'
USERCONTROL='yes'
NAME='Whatever-you-want-to-call-this-connection'
DHCLIENT_PRIMARY_DEVICE='yes'
WIRELESS_ESSID='Your-Wireless-Network-SSID'
WIRELESS_AUTH_MODE='open'
WIRELESS_KEY_LENGTH='128'
WIRELESS_KEY_0='Your WEP key here'
WIRELESS_AP_SCANMODE='1'

If all this has been setup correctly then when you reboot the connection should be made automatically for you.


<keyword>ASUS, WL160N, wireless, network, wpa_supplicant, ralink</keyword>