Вопросы:
- в коробке на CD идут драйвера для Windows. На сайте я скачал драйвера на Linux в zip-архиве. Стоит ли заморачиваться с установкой драйверов производителя или встроенный в Linux драйвер будет нормально работать?
- если лучше установить драйвер производителя, то как это сделать (я новичок в Линуксе). Инструкция производителя вогнала меня в шок.
Инструкция.
1. Development Environment
System version: Ubuntu 14.04.1 Kernel version: 3.16.0-30-generic Gcc version:4.8.2
2. Compile the Driver
2.1. Compilation tool and kernel sources
Before you compile the driver, please make sure you have the correct compile tool and kernel sources. We can install compile tool gcc by command “apt-get install gcc” Note : We recommend you use a suitable compile tool to compile our driver. For example:
According to the command “cat /proc/version”, we could see your linux system is compiled by gcc4.8.2. So we recommend you use gcc4.8.2 to compile our driver if possible. 2.2. Compile and install the Driver
1. Access the directory of driver. 2. Before compile, make sure the parameters in “makefile.c” is suitable for your compile environment of your Linux system. ifeq ($(CONFIG_PLATFORM_I386_PC), y) EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN SUBARCH := $(shell uname -m | sed -e s/i.86/i386/) ARCH ?= $(SUBARCH) CROSS_COMPILE ?= KVER := $(shell uname -r) KSRC := /lib/modules/$(KVER)/build MODDESTDIR := /lib/modules/$(KVER)/kernel/drivers/net/wireless/ INSTALL_PREFIX := endif Explanation: · KSRC is used to specify the kernel source path for driver compilation. · CROSS_COMPILE is used to specify the toolchain. · ARCH is used to specify the target platform's CPU architectures such as arm, mips, i386 and so on.
1
If your Linux kernel does not support 802.11, please annotate macro “CONFIG_IOCTL_CFG80211” in “makefile.c”. CONFIG_IOCTL_CFG80211=n ifeq ($(strip &(CONFIG_IOCTL_CFG80211)),y) EXTRA_CFLAGS + = -DCONFIG_IOCTL_CFG80211 = 1 EXTRA_CFLAGS + = -DRTW_USE_CFG80211_STA_EVENT = 1 endif
3. Type “sudo make” to compile the driver file.
4. Type “sudo make install” to install the driver file.
3. Join the Wireless Network
3.1. Use the Graphical Interface
1. Enable your network shown as below.
2. Select the desired wireless network and specify the corresponding adapter interface for connection.
3. The wireless icon indicates a successful connection.
3.2. Use the Command
3.2.1. Identify the device Insert the USB adapter and run the following command to check if the adapter is
identified. lsusb 3.2.2. Create the interface Run the following command to check if the wireless network interface is created. ifconfig 3.2.3. Change the interface status to up Check if the WLAN interface is up. If not, run the following command. Here we use wlan1 as an example. ifconfig wlan1 up
If it failed to change to up, run the following command. rfkill unblock wifi ifconfig wlan1 up 3.2.4. Start wpa_supplicant in the background Run the following command: wpa_supplicant –Dnl80211 –iwlan1 –c ./ wpa_0_8.conf -B
Note: wpa_0_8.conf is a file in the current driver directory, go to the driver directory when running the command. If the command above is not effective, run the following command to end the wpa_supplicant procedure and then run the above command again. killall wpa_supplicant
If your Linux kernel does not support 802.11, run the following command. wpa_supplicant -Dwext -iwlan0 -c ./wpa_0_8.conf -B
3.2.5. Scan AP and See Results Run the following command: wpa_cli –p /var/run/wpa_supplicant scan wpa_cli –p /var/run/wpa_supplicant scan_results 3.2.6. Connect to the AP
1) Open
Run the following command: wpa_cli –p /var/run/wpa_supplicant remove_network 0 wpa_cli –p /var/run/wpa_supplicant ap_scan 1 wpa_cli –p /var/run/wpa_supplicant add_network wpa_cli –p /var/run/wpa_supplicant set_network 0 ssid '"tplink"' //tplink is the SSID of the desired AP. The SSID is in double quotation marks and then as a whole
4
enclosed by single quotation marks. wpa_cli –p /var/run/wpa_supplicant set_network 0 key_mgmt NONE wpa_cli –p /var/run/wpa_supplicant select_network 0
2) WEP40 with open system
wpa_cli –p /var/run/wpa_supplicant remove_network 0 wpa_cli –p /var/run/wpa_supplicant ap_scan 1 wpa_cli –p /var/run/wpa_supplicant add_network wpa_cli –p /var/run/wpa_supplicant set_network 0 ssid '"tplink"' wpa_cli –p /var/run/wpa_supplicant set_network 0 key_mgmt NONE wpa_cli –p /var/run/wpa_supplicant set_network 0 wep_key0 1234567890 wpa_cli –p /var/run/wpa_supplicant set_network 0 wep_tx_keyidx 0 wpa_cli –p /var/run/wpa_supplicant select_network 0
3) WEP40 with shared key
wpa_cli –p /var/run/wpa_supplicant remove_network 0 wpa_cli –p /var/run/wpa_supplicant ap_scan 1 wpa_cli –p /var/run/wpa_supplicant add_network wpa_cli –p /var/run/wpa_supplicant set_network 0 ssid '"tplink"' wpa_cli –p /var/run/wpa_supplicant set_network 0 key_mgmt NONE wpa_cli –p /var/run/wpa_supplicant set_network 0 wep_key0 1234567890 wpa_cli –p /var/run/wpa_supplicant set_network 0 wep_tx_keyidx 0 wpa_cli –p /var/run/wpa_supplicant set_network 0 auth_alg SHARED wpa_cli –p /var/run/wpa_supplicant select_network 0
4) WEP 104 with open system
wpa_cli –p /var/run/wpa_supplicant remove_network 0 wpa_cli -p /var/run/wpa_supplicant ap_scan 1 wpa_cli -p /var/run/wpa_supplicant add_network wpa_cli -p /var/run/wpa_supplicant set_network 0 ssid '"tplink"' wpa_cli –p /var/run/wpa_supplicant set_network 0 key_mgmt NONE wpa_cli -p /var/run/wpa_supplicant set_network 0 wep_key0 12345678901234567890123456 wpa_cli -p /var/run/wpa_supplicant set_network 0 wep_tx_keyidx 0 wpa_cli -p /var/run/wpa_supplicant select_network 0
5) WEP 104 with shared key
wpa_cli –p /var/run/wpa_supplicant remove_network 0
5
wpa_cli –p /var/run/wpa_supplicant ap_scan 1 wpa_cli –p /var/run/wpa_supplicant add_network wpa_cli –p /var/run/wpa_supplicant set_network 0 ssid '"tplink"' wpa_cli –p /var/run/wpa_supplicant set_network 0 key_mgmt NONE wpa_cli –p /var/run/wpa_supplicant set_network 0 wep_key0 12345678901234567890123456 wpa_cli –p /var/run/wpa_supplicant set_network 0 wep_tx_keyidx 0 wpa_cli –p /var/run/wpa_supplicant set_network 0 auth_alg SHARED wpa_cli –p /var/run/wpa_supplicant select_network 0
Note: If the WEP key is ASCII, run the following command: · WEP40: wpa_cli -p/var/run/wpa_supplicant set_network 0 wep_key0 '"12345"' · WEP104: wpa_cli -p/var/run/wpa_supplicant set_network 0 wep_key0 '"1234567890123"' If the index for WEP key is 0-3, run the following command · wpa_cli -p/var/run/wpa_supplicant set_network 0 wep_keyX 12345678901234567890123456 · wpa_cli -p/var/run/wpa_supplicant set_network 0 wep_tx_keyidx X
6) TIKP/AES
wpa_cli –p /var/run/wpa_supplicant remove_network 0 wpa_cli –p /var/run/wpa_supplicant ap_scan 1 wpa_cli –p /var/run/wpa_supplicant add_network wpa_cli –p /var/run/wpa_supplicant set_network 0 ssid '"tplink"' wpa_cli –p /var/run/wpa_supplicant set_network 0 psk '"12345678"' wpa_cli –p /var/run/wpa_supplicant select_network 0 3.2.7. Enable DHCP client Run the following command dhclient wlan1 After running the command, the adapter will get an IP assigned by the AP. Then you can run the ping command to check if the wireless connection is successful.
6
Note: Run the commands under the root account.
System version: Ubuntu 14.04.1 Kernel version: 3.16.0-30-generic Gcc version:4.8.2
2. Compile the Driver
2.1. Compilation tool and kernel sources
Before you compile the driver, please make sure you have the correct compile tool and kernel sources. We can install compile tool gcc by command “apt-get install gcc” Note : We recommend you use a suitable compile tool to compile our driver. For example:
According to the command “cat /proc/version”, we could see your linux system is compiled by gcc4.8.2. So we recommend you use gcc4.8.2 to compile our driver if possible. 2.2. Compile and install the Driver
1. Access the directory of driver. 2. Before compile, make sure the parameters in “makefile.c” is suitable for your compile environment of your Linux system. ifeq ($(CONFIG_PLATFORM_I386_PC), y) EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN SUBARCH := $(shell uname -m | sed -e s/i.86/i386/) ARCH ?= $(SUBARCH) CROSS_COMPILE ?= KVER := $(shell uname -r) KSRC := /lib/modules/$(KVER)/build MODDESTDIR := /lib/modules/$(KVER)/kernel/drivers/net/wireless/ INSTALL_PREFIX := endif Explanation: · KSRC is used to specify the kernel source path for driver compilation. · CROSS_COMPILE is used to specify the toolchain. · ARCH is used to specify the target platform's CPU architectures such as arm, mips, i386 and so on.
1
If your Linux kernel does not support 802.11, please annotate macro “CONFIG_IOCTL_CFG80211” in “makefile.c”. CONFIG_IOCTL_CFG80211=n ifeq ($(strip &(CONFIG_IOCTL_CFG80211)),y) EXTRA_CFLAGS + = -DCONFIG_IOCTL_CFG80211 = 1 EXTRA_CFLAGS + = -DRTW_USE_CFG80211_STA_EVENT = 1 endif
3. Type “sudo make” to compile the driver file.
4. Type “sudo make install” to install the driver file.
3. Join the Wireless Network
3.1. Use the Graphical Interface
1. Enable your network shown as below.
2. Select the desired wireless network and specify the corresponding adapter interface for connection.
3. The wireless icon indicates a successful connection.
3.2. Use the Command
3.2.1. Identify the device Insert the USB adapter and run the following command to check if the adapter is
identified. lsusb 3.2.2. Create the interface Run the following command to check if the wireless network interface is created. ifconfig 3.2.3. Change the interface status to up Check if the WLAN interface is up. If not, run the following command. Here we use wlan1 as an example. ifconfig wlan1 up
If it failed to change to up, run the following command. rfkill unblock wifi ifconfig wlan1 up 3.2.4. Start wpa_supplicant in the background Run the following command: wpa_supplicant –Dnl80211 –iwlan1 –c ./ wpa_0_8.conf -B
Note: wpa_0_8.conf is a file in the current driver directory, go to the driver directory when running the command. If the command above is not effective, run the following command to end the wpa_supplicant procedure and then run the above command again. killall wpa_supplicant
If your Linux kernel does not support 802.11, run the following command. wpa_supplicant -Dwext -iwlan0 -c ./wpa_0_8.conf -B
3.2.5. Scan AP and See Results Run the following command: wpa_cli –p /var/run/wpa_supplicant scan wpa_cli –p /var/run/wpa_supplicant scan_results 3.2.6. Connect to the AP
1) Open
Run the following command: wpa_cli –p /var/run/wpa_supplicant remove_network 0 wpa_cli –p /var/run/wpa_supplicant ap_scan 1 wpa_cli –p /var/run/wpa_supplicant add_network wpa_cli –p /var/run/wpa_supplicant set_network 0 ssid '"tplink"' //tplink is the SSID of the desired AP. The SSID is in double quotation marks and then as a whole
4
enclosed by single quotation marks. wpa_cli –p /var/run/wpa_supplicant set_network 0 key_mgmt NONE wpa_cli –p /var/run/wpa_supplicant select_network 0
2) WEP40 with open system
wpa_cli –p /var/run/wpa_supplicant remove_network 0 wpa_cli –p /var/run/wpa_supplicant ap_scan 1 wpa_cli –p /var/run/wpa_supplicant add_network wpa_cli –p /var/run/wpa_supplicant set_network 0 ssid '"tplink"' wpa_cli –p /var/run/wpa_supplicant set_network 0 key_mgmt NONE wpa_cli –p /var/run/wpa_supplicant set_network 0 wep_key0 1234567890 wpa_cli –p /var/run/wpa_supplicant set_network 0 wep_tx_keyidx 0 wpa_cli –p /var/run/wpa_supplicant select_network 0
3) WEP40 with shared key
wpa_cli –p /var/run/wpa_supplicant remove_network 0 wpa_cli –p /var/run/wpa_supplicant ap_scan 1 wpa_cli –p /var/run/wpa_supplicant add_network wpa_cli –p /var/run/wpa_supplicant set_network 0 ssid '"tplink"' wpa_cli –p /var/run/wpa_supplicant set_network 0 key_mgmt NONE wpa_cli –p /var/run/wpa_supplicant set_network 0 wep_key0 1234567890 wpa_cli –p /var/run/wpa_supplicant set_network 0 wep_tx_keyidx 0 wpa_cli –p /var/run/wpa_supplicant set_network 0 auth_alg SHARED wpa_cli –p /var/run/wpa_supplicant select_network 0
4) WEP 104 with open system
wpa_cli –p /var/run/wpa_supplicant remove_network 0 wpa_cli -p /var/run/wpa_supplicant ap_scan 1 wpa_cli -p /var/run/wpa_supplicant add_network wpa_cli -p /var/run/wpa_supplicant set_network 0 ssid '"tplink"' wpa_cli –p /var/run/wpa_supplicant set_network 0 key_mgmt NONE wpa_cli -p /var/run/wpa_supplicant set_network 0 wep_key0 12345678901234567890123456 wpa_cli -p /var/run/wpa_supplicant set_network 0 wep_tx_keyidx 0 wpa_cli -p /var/run/wpa_supplicant select_network 0
5) WEP 104 with shared key
wpa_cli –p /var/run/wpa_supplicant remove_network 0
5
wpa_cli –p /var/run/wpa_supplicant ap_scan 1 wpa_cli –p /var/run/wpa_supplicant add_network wpa_cli –p /var/run/wpa_supplicant set_network 0 ssid '"tplink"' wpa_cli –p /var/run/wpa_supplicant set_network 0 key_mgmt NONE wpa_cli –p /var/run/wpa_supplicant set_network 0 wep_key0 12345678901234567890123456 wpa_cli –p /var/run/wpa_supplicant set_network 0 wep_tx_keyidx 0 wpa_cli –p /var/run/wpa_supplicant set_network 0 auth_alg SHARED wpa_cli –p /var/run/wpa_supplicant select_network 0
Note: If the WEP key is ASCII, run the following command: · WEP40: wpa_cli -p/var/run/wpa_supplicant set_network 0 wep_key0 '"12345"' · WEP104: wpa_cli -p/var/run/wpa_supplicant set_network 0 wep_key0 '"1234567890123"' If the index for WEP key is 0-3, run the following command · wpa_cli -p/var/run/wpa_supplicant set_network 0 wep_keyX 12345678901234567890123456 · wpa_cli -p/var/run/wpa_supplicant set_network 0 wep_tx_keyidx X
6) TIKP/AES
wpa_cli –p /var/run/wpa_supplicant remove_network 0 wpa_cli –p /var/run/wpa_supplicant ap_scan 1 wpa_cli –p /var/run/wpa_supplicant add_network wpa_cli –p /var/run/wpa_supplicant set_network 0 ssid '"tplink"' wpa_cli –p /var/run/wpa_supplicant set_network 0 psk '"12345678"' wpa_cli –p /var/run/wpa_supplicant select_network 0 3.2.7. Enable DHCP client Run the following command dhclient wlan1 After running the command, the adapter will get an IP assigned by the AP. Then you can run the ping command to check if the wireless connection is successful.
6
Note: Run the commands under the root account.