Difference between revisions of "Talk:USB to WiFi adapter"

From ArmadeusWiki
Jump to: navigation, search
m (Chipset Atheros AR9271)
m (Chipset Atheros AR9271)
 
Line 178: Line 178:
  
 
== Chipset Atheros AR9271 ==
 
== Chipset Atheros AR9271 ==
The Netgear N150 WNA 1100 WLAN stick is based upon the Atheros AR9271 Chipset. The kernel 2.6.35.3 contains the driver for that chipset, but the specific USB ID for the Netgear stick is not listed in the source. Therefore I applied a little manual patch to the file  
+
The Netgear N150 WNA 1100 WLAN stick is based upon the Atheros AR9271 Chipset. The kernel 2.6.35.3 contains the driver for that chipset, but the specific USB ID for the Netgear stick is not listed in the source. Therefore I applied a little manual patch to the file ''buildroot/output/build/linux-2.6.35.3/drivers/net/wireless/ath/ath9k/hif_usb.c'' changing the current device ID against the ID  0x0846, 0x9030 of the Netgear device. (Maybe someone can add in here how to add instead how to change...)
<br> ''buildroot/output/build/linux-2.6.35.3/drivers/net/wireless/ath/ath9k/hif_usb.c''
+
 
<br> changing the current device ID against the ID  0x0846, 0x9030 of the Netgear device. (Maybe someone can add in here how to add instead how to change...)
+
The file will only exist after you change the ''linux-menuconfig'' as below and do the first make
<br>The file will only exist after you change the ''linux-menuconfig'' as below and do the first make
+
 
<pre class="host">
 
<pre class="host">
 
#include "htc.h"
 
#include "htc.h"
Line 194: Line 193:
 
{ },
 
{ },
 
};
 
};
 
 
</pre>
 
</pre>
  

Latest revision as of 14:48, 9 July 2013

About Zydas zd1211 tries

JulienB 09:52, 4 February 2009 (UTC) : now working

Chipset RTL8188CUS

I will give you the details for the RTL8188CUS driver for the APF28:

  1. the build procedure
  2. the error I got for AFP28 with AFP28dev
  3. and the workaround to fix it

Build procedure

I build the driver for chip RTL8188CUS from source rtl8188C_8192C_usb_linux_v3.4.3_4369.20120622 . You can get the driver here (chose RTL8188CUS) : [1]

Add those option in the makefile :

- change line 39 :
CONFIG_PLATFORM_I386_PC = n
- add line 40 :
CONFIG_PLATFORM_ARM_ARMADEUS = y

- Near line 261 add:
ifeq ($(CONFIG_PLATFORM_ARM_ARMADEUS), y)
EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_WEXT_PRIV
ARCH := arm
CROSS_COMPILE := /path-to-your/armadeus/buildroot/output/host/usr/bin/arm-linux-
KVER  := 2.6.35.3
KSRC ?= /path-to-your/armadeus/buildroot/output/build/linux-2.6.35.3
endif

And I need to rebuild the linux kernel with define WEXT_PRIV :

make linux-menuconfig

I use this trick for that :

Device Drivers  --->  
 [*] Network device support  --->   
   [*]   Wireless LAN  --->
     <M>   USB ZD1201 based Wireless device support   

Which give me :

  │   Selects: WIRELESS_EXT [=y] && WEXT_PRIV [=n] && FW_LOADER [=y]

Rebuild the kernel :

make linux-rebuild

finally copy the driver to the target directory :

cp 8192cu.ko /path-to-your/armadeus/buildroot/output/target/lib/modules/2.6.35.3\+/kernel/drivers/net/wireless/

Known issue

Here is the test I made :

insmod /lib/modules/2.6.35.3\+/kernel/drivers/net/wireless/8192cu.ko
wpa_supplicant -iwlan0 -c /etc/wpa_supplicant.conf -Dwext -B dhclient
udhcpc -i wlan0

Then I can ping wifi adress with 0% packet loss.

I connect with ssh it work ok for the few command I did.

Then I try to connect with SFTP from my PC (using FileZilla) :

the wifi goes down and the usb with it.

Here is the part of "messages" where the error is :

Jan 10 01:23:29 armadeus kern.warn kernel: reg 0x608, usb read 4 fail, status:-19 value=0x0, vendorreq_times:1
Jan 10 01:23:29 armadeus kern.warn kernel: reg 0x608, usb read 4 fail, status:-19 value=0x0, vendorreq_times:2
Jan 10 01:23:29 armadeus kern.warn kernel: reg 0x608, usb read 4 fail, status:-19 value=0x0, vendorreq_times:3
Jan 10 01:23:29 armadeus kern.err kernel: fsl-ehci fsl-ehci.0: fatal error
Jan 10 01:23:29 armadeus kern.debug kernel: fsl-ehci fsl-ehci.0: fatal command 010028 (park)=0 ithresh=1 Async period=256 HALT
Jan 10 01:23:29 armadeus kern.debug kernel: fsl-ehci fsl-ehci.0: fatal status 49098 Async Halt FATAL FLR
Jan 10 01:23:29 armadeus kern.debug kernel: fsl-ehci fsl-ehci.0: reset command 01002a (park)=0 ithresh=1 Async period=256 Reset HALT
Jan 10 01:23:29 armadeus kern.warn kernel: ###=> usb_read_port_complete => urb status(-108)
Jan 10 01:23:29 armadeus kern.err kernel: fsl-ehci fsl-ehci.0: HC died; cleaning up
Jan 10 01:23:29 armadeus kern.debug kernel: hub 2-0:1.0: state 0 ports 1 chg 0000 evt 0000
Jan 10 01:23:29 armadeus kern.info kernel: usb 2-1: USB disconnect, address 2
Jan 10 01:23:29 armadeus kern.debug kernel: usb 2-1: unregistering device
Jan 10 01:23:29 armadeus kern.debug kernel: usb 2-1: usb_disable_device nuking all URBs
Jan 10 01:23:29 armadeus kern.debug kernel: usb 2-1: unregistering interface 2-1:1.0
Jan 10 01:23:29 armadeus kern.warn kernel: reg 0x608, usb read 4 fail, status:-19 value=0x0, vendorreq_times:4
Jan 10 01:23:29 armadeus kern.warn kernel: [dvobjpriv:c8aa401c][ERROR] continual_urb_error:5 > 4
Jan 10 01:23:29 armadeus kern.warn kernel: issue_deauth to 00:18:84:19:e1:62
Jan 10 01:23:29 armadeus kern.warn kernel: rtw_sta_flush
Jan 10 01:23:30 armadeus kern.warn kernel: (2)871x_drv - drv_close, bup=1, hw_init_completed=1
Jan 10 01:23:30 armadeus kern.warn kernel: -871x_drv - drv_close, bup=1
Jan 10 01:23:30 armadeus kern.warn kernel: ===> rtw_dev_unload
Jan 10 01:23:30 armadeus kern.warn kernel: usb_read_port_cancel
Jan 10 01:23:30 armadeus kern.warn kernel: usb_write_port_cancel
Jan 10 01:23:30 armadeus kern.warn kernel: ###> rtw_cmd_thread break.................
Jan 10 01:23:30 armadeus kern.warn kernel: rtw_cmd_thread: leaving... check & free all cmd_obj resources
Jan 10 01:23:30 armadeus kern.warn kernel: rtw_cmd_thread: leaving... call up terminate_cmdthread_sema
Jan 10 01:23:30 armadeus kern.warn kernel: <=== rtw_dev_unload
Jan 10 01:23:30 armadeus kern.warn kernel: +r871xu_dev_remove, hw_init_completed=1
Jan 10 01:23:30 armadeus kern.warn kernel: free_recv_skb_queue not empty, 5
Jan 10 01:23:30 armadeus kern.warn kernel: =====> rtl8192c_free_hal_data =====
Jan 10 01:23:30 armadeus kern.warn kernel: <===== rtl8192c_free_hal_data =====
Jan 10 01:23:30 armadeus kern.warn kernel: -r871xu_dev_remove, done
Jan 10 01:23:40 armadeus kern.err kernel: FEC: MDIO read timeout
Jan 10 01:23:42 armadeus kern.err kernel: FEC: MDIO read timeout

And the error by using iperf -c to connect to an iperf server :

fsl-ehci fsl-ehci.0: fatal error
###=> usb_read_port_complete => urb status(-108)
fsl-ehci fsl-ehci.0: HC died; cleaning up
usb 2-1: USB disconnect, address 2
+rtw_dev_remove
rtw_set_ps_mode(): Busy Traffic , Leave 802.11 power save..
rtl8192c_set_FwPwrMode_cmd(): Mode = 0, SmartPS = 0
reg 0x1cc, usb read 1 fail, status:-19 value=0x0, vendorreq_times:1
reg 0x1cc, usb read 1 fail, status:-19 value=0x0, vendorreq_times:2
reg 0x1cc, usb read 1 fail, status:-19 value=0x0, vendorreq_times:3
reg 0x1cc, usb read 1 fail, status:-19 value=0x0, vendorreq_times:4
[dvobjpriv:c8abd01c][ERROR] continual_urb_error:5 > 4
issue_deauth to 00:18:84:19:e1:62
rtw_sta_flush
(2)871x_drv - drv_close, bup=1, hw_init_completed=1
-871x_drv - drv_close, bup=1
===> rtw_dev_unload
usb_read_port_cancel 
usb_write_port_cancel 
###> rtw_cmd_thread break.................
rtw_cmd_thread: leaving... check & free all cmd_obj resources
rtw_cmd_thread: leaving... call up terminate_cmdthread_sema
<=== rtw_dev_unload
+r871xu_dev_remove, hw_init_completed=1
free_recv_skb_queue not empty, 4
=====> rtl8192c_free_hal_data =====
<===== rtl8192c_free_hal_data =====
-r871xu_dev_remove, done
FEC: MDIO read timeout
FEC: MDIO read timeout

--Sly 20:33, 31 July 2012 (UTC)

It should work now with the last git dev branch (5.1)

old Workaround

Here is the workaround to fix this issue: Disable dynamic frequency scaling by setting the scaling_governor to "userspace" or "performance"

1st solution: change governor at runtime

echo userspace > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

you will have to use this command each time you boot your board.

2nd solution: rebuild your kernel with default governor set to userspace or performance

make linux-menuconfig
CPU Power Management  --->
      Default CPUFreq governor (userspace)  --->  
            ( ) performance
            ( ) powersave
            (X) userspace
            ( ) ondemand 
            ( ) conservative

build and update your APF kernel..


Chipset Atheros AR9271

The Netgear N150 WNA 1100 WLAN stick is based upon the Atheros AR9271 Chipset. The kernel 2.6.35.3 contains the driver for that chipset, but the specific USB ID for the Netgear stick is not listed in the source. Therefore I applied a little manual patch to the file buildroot/output/build/linux-2.6.35.3/drivers/net/wireless/ath/ath9k/hif_usb.c changing the current device ID against the ID 0x0846, 0x9030 of the Netgear device. (Maybe someone can add in here how to add instead how to change...)

The file will only exist after you change the linux-menuconfig as below and do the first make

#include "htc.h"

#define ATH9K_FW_USB_DEV(devid, fw)					\
	{ USB_DEVICE(0x0846, 0x9030), .driver_info = (unsigned long) fw }
// 	{ USB_DEVICE(0x0cf3, devid), .driver_info = (unsigned long) fw }

static struct usb_device_id ath9k_hif_usb_ids[] = {
	ATH9K_FW_USB_DEV(0x9271, "ar9271.fw"),
	ATH9K_FW_USB_DEV(0x1006, "ar9271.fw"),
	{ },
};

After the fist compile change the file, do a linux-clean and make again.
Rather than compiling the driver as a module, I compiled it directly into the kernel.

make linux-menuconfig
  Device Drivers  --->     
           Generic Driver Options  --->        
                            (/sbin/hotplug) path to uevent helper 
                            [*] Maintain a devtmpfs filesystem to mount at /dev    
                            [*]   Automount devtmpfs at /dev, after the kernel mounted the rootfs  
                            [ ] Select only drivers that don't need compile-time external firmware   
                            [ ] Prevent firmware from being built     
                            -*- Userspace firmware loading support    
                            [*]   Include in-kernel firmware blobs in kernel binary  
                            ()    External firmware blobs to build into the kernel binary 


        [*] Network device support  --->      
                [*]   Wireless LAN  --->               
                     <*>   Atheros Wireless Cards  --->        
                            --- Atheros Wireless Cards    
                            [*]   Atheros wireless debugging             
                            <*>   Atheros HTC based wireless cards support    
                            [*]     Atheros ath9k_htc debugging  
                            <*>   Atheros AR9170 802.11n USB support    


        < > Hardware Monitoring support  --->    
        [*] USB support  --->      
                <*>     Enable Wireless USB extensions (EXPERIMENTAL) 

The Atheros driver needs some firmware to be installed. I got it from http://git.kernel.org/?p=linux/kernel/git/firmware/linux-firmware.git
You must download the entire reository and extract the ar9721.fw file locally.

# ls -al /lib/firmware
total 52
drwxr-xr-x    2 root     root           232 Jan  1 00:54 .
drwxr-xr-x    6 root     root          2672 Dec 14  2012 ..
-rwxr-xr-x    1 root     root         49280 Jan  1  1970 ar9271.fw


With this setup no modprobe is necessary. On Plugin of the Netgear WNA1100 the following should print:

usb 2-1: New USB device strings: Mfr=16, Product=32, SerialNumber=48
usb 2-1: Product: WNA1100
usb 2-1: Manufacturer: NETGEAR WNA
usb 2-1: SerialNumber: 12345
usb 2-1: ath9k_htc: Transferred FW: ar9271.fw, size: 49280
usb 2-1: ath9k_htc: USB layer initialized

Let's assume you need to connect to share myshare on the SMB network drive to be mounted under /media/mydrive
The following script /usr/bin/wlan_up will bring your WLAN up:

#!/bin/sh
until iwconfig | grep wlan0; do sleep 5; echo " tick "; done
ifconfig wlan0 up
wpa_supplicant -iwlan0 -c /etc/wpa_supplicant.conf -Dwext -B dhclient
udhcpc -i wlan0
ifconfig eth0 down
ifconfig wlan0 192.168.178.31
mount.cifs //192.168.178.28/myshare /media/mydrive/ -o user= -o pass=

The script starts up the WLAN wit WPA2 encryption. This requires the /etc/wpa_supplicant.conf file to be configured properly:

ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=wheel
network={
ssid="your SSID"
scan_ssid=1
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP
group=TKIP
psk="your secret network password"
}


The below script /etc/init.d/S99wlan will call the wlan_up script automatically at boot in case the wired LAN is not present:

#!/bin/sh
if mount.cifs //192.168.178.28/myshare /media/mydrive/ -o user= -o pass=;
then 
echo Using Wired LAN
else
echo Starting WLAN
/usr/bin/wlan_up &
fi

The whole setup is not yet perfect -for example the IP address used by the scripts is hardcoded and of course must match the one that will be received from the dns server. Suggestions for improvement are welcome!
--MartinH 22:51, 23 December 2012 (UTC)