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

From ArmadeusWiki
Jump to: navigation, search
(New page: == About Zydas zd1211 tries == tshado> polo35: tu es la ? <bruno> oui <tshado> polo35: le zd1211 (zydas) c'est le chipset pour une clé WIFI ? ... <polo35> j'ai un soucis au moment o...)
 
m (Chipset Atheros AR9271)
 
(39 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 
== About Zydas zd1211 tries ==
 
== About Zydas zd1211 tries ==
tshado> polo35: tu es la ?
+
[[User:JulienB|JulienB]] 09:52, 4 February 2009 (UTC) : now working
<bruno> oui
+
 
<tshado> polo35: le zd1211 (zydas) c'est le chipset pour une clé WIFI ?
+
== Chipset RTL8188CUS ==
...
+
 
<polo35> j'ai un soucis au moment où le driver cherche à charger le firmware, qui se trouve pourtant au bon endroit :(
+
I will give you the details for the RTL8188CUS driver for the APF28:
<tshado> polo35: quel modele de clé wifi as tu ? et comment s tu fait pour le driver linux ?
+
# the build procedure
<polo35> j'ai une smc wusb-g
+
# the error I got for AFP28 with AFP28dev
<bruno> jorasse merci pour l'aide je m'absente un moment, je reviendrais
+
# and the workaround to fix it
<polo35> ya pas de probleme avec ce driver normalement, il correspond bien à ma clé (d'ailleurs essayé sur mon pc portable et aucun soucis)
+
 
<polo35> et pour le driver j'ai juste activé l'option correspondante au driver dans le linux-menuconfig
+
===Build procedure===
<tshado> polo35: le driver linux etait fournit avec ta clé usb ?
+
I build the driver for chip RTL8188CUS from source rtl8188C_8192C_usb_linux_v3.4.3_4369.20120622 .
<polo35> non pas besoin
+
You can get the driver here (chose RTL8188CUS) :
<jorasse> bruno: je doit m absente aussi
+
[http://www.realtek.com.tw/downloads/downloadsView.aspx?Langid=1&PNid=21&PFid=48&Level=5&Conn=4&DownTypeID=3&GetDown=false&Downloads=true]
<polo35> les sources ont été libre un moment, résultat tu peux tres bien recompiler le driver si tu veux (d'ailleurs une communauté le tient à jour)
+
 
  <tshado> polo35: tu veux dire y a ce qu il faut pour linux2.6.27 ?
+
Add those option in the makefile :
<polo35> oui
+
<pre class="host">
<polo35> c'est simplement un probleme propre au module, ou au kernell qui bloque le fait que celui ci veuille charger le firmware
+
- change line 39 :
<Artemys> polo35: comment tu sais que ça merde au chargement du firmware ?
+
CONFIG_PLATFORM_I386_PC = n
<polo35> parcque je récupere le message suivant :
+
- add line 40 :
  <polo35> usb 1-1.2: Could not load firmware file zd1211/zd1211b_ub. Error number -2
+
CONFIG_PLATFORM_ARM_ARMADEUS = y
  <polo35> zd1211rw 1-1.2:1.0: couldn't load firmware. Error number -2
+
 
<tshado> polo35: ca m interesse car je voudrais aussi mettre une clé usb wifi
+
- Near line 261 add:
  <polo35> en fait, normalement ca se fait en 3 tours de main.. ya juste ce probleme qui est bloquant et j'arrive pas à le résoudre
+
ifeq ($(CONFIG_PLATFORM_ARM_ARMADEUS), y)
<Artemys> effectivement C flagrant
+
EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_WEXT_PRIV
<polo35> on m'a parlé d'une option au moment de compiler le noyau, je suis en train de regarder
+
ARCH := arm
<Artemys> polo35: vi /etc/hotplug
+
CROSS_COMPILE := /path-to-your/armadeus/buildroot/output/host/usr/bin/arm-linux-
<Artemys> et tu mets ça dedans:
+
KVER := 2.6.35.3
<Artemys> #!/bin/sh
+
KSRC ?= /path-to-your/armadeus/buildroot/output/build/linux-2.6.35.3
if [ "$FIRMWARE" != "" ]; then
+
endif
HOTPLUG_FW_DIR=/lib/firmware/
+
</pre>
echo 1 > /sys/$DEVPATH/loading
+
 
cat $HOTPLUG_FW_DIR/$FIRMWARE > /sys/$DEVPATH/data
+
And I need to rebuild the linux kernel with define WEXT_PRIV :
echo 0 > /sys/$DEVPATH/loading
+
<pre class="host">
fi
+
make linux-menuconfig
<tshado> polo35: question ce firmware zd1211rw 1-1.2:1.0 il se trouve ou ?
+
</pre>
<Artemys> et ton firmware tu le mets dans /lib/firmware sur la carte
+
 
<polo35> ahh
+
I use this trick for that :
<polo35> merci je vais voir ca
+
<pre class="config">
<Artemys> polo35: tu nous fileras la ref de ta clef qu'on la teste et la mette sur le wiki stp ?
+
Device Drivers ---> 
|<-- jorasse_ has left irc.rezosup.org (Quit: bye!)
+
  [*] Network device support  --->  
<polo35> ouais bien sur ;)
+
  [*]  Wireless LAN --->
<polo35> quand ca marche je vous fournirai toutes les infos
+
    <M>   USB ZD1201 based Wireless device support 
<polo35> (je vous met un copier coller des options à activer lors de la compil)
+
</pre>
<tshado> polo35: oui ça interessera du monde
+
 
<polo35> make menuconfig Networking ----> then set <M> Generic IEEE802.11 Networking Stack <M> Software MAC add-on to the IEEE 802.11 netowrking  tack all other module capable IEEE 80211 items will have automatically set themselves to <M> Also check that: Device Drivers ----> Network device support ----> Wireless LAN (non-hamradio) ----> <M> ZyDAS ZD1211/ZD1211B USB-wireless support is also set to <M> Exit out and save the config
+
Which give me :
<polo35> oups c'est pas tres propre désolé
+
<pre class="config">
<tshado> polo35 mais tu as pas répondu à ma question .....ce firmware zd1211rw 1-1.2:1.0 il se trouve ou
+
  │  Selects: WIRELESS_EXT [=y] && WEXT_PRIV [=n] && FW_LOADER [=y]
<tshado> tu pourrais me dire ?
+
</pre>
<tshado> polo35: ah j'ai pigé c 'est que dans les options du menuconfig c ça ?
+
Rebuild the kernel :
<polo35> le firmware on le trouve sur internet ;)
+
<pre class="host">
<polo35> sinon au moment de la compilation du noyau il faut activer les options suivantes :
+
make linux-rebuild
<tshado> Artemys: polo35 lien interessant pour savoir si on a le chipset zd1211 http://doc.ubuntu-fr.org/wifi_chipset_zd1211
+
</pre>
<polo35> Networking ---->
+
finally copy the driver to the target directory :
<polo35> <M> Generic IEEE802.11 Networking Stack
+
<pre class="host">
<polo35> <M> Software MAC add-on to the IEEE 802.11 netowrking stack
+
cp 8192cu.ko /path-to-your/armadeus/buildroot/output/target/lib/modules/2.6.35.3\+/kernel/drivers/net/wireless/
<polo35> Device Drivers ----> Network device support ---->
+
</pre>
<polo35> <M> ZyDAS ZD1211/ZD1211B
+
 
<polo35> ok merci :)
+
===Known issue===
<Artemys> I'll be back....
+
Here is the test I made :
[INFO] You are now marked as away (User is away.). Click the nickname button or use the |/back| command to return from being away.
+
<pre class="apf">
<tshado> polo35: ok merci j'ai compris ...c simple ...juste menuconfig options
+
insmod /lib/modules/2.6.35.3\+/kernel/drivers/net/wireless/8192cu.ko
<tshado> polo35: mise a part ton pb
+
wpa_supplicant -iwlan0 -c /etc/wpa_supplicant.conf -Dwext -B dhclient
<polo35> voila
+
udhcpc -i wlan0
  <tshado> Artemys: polo35 encore mieux http://www.linuxwireless.org/en/users/Drivers/zd1211rw/devices#Hardwaresupported
+
</pre>
<polo35> oué j'ai fait le tour de ces pages un peu :)
+
Then I can ping wifi adress with 0% packet loss.
<polo35> il y a pas mal de dongle qui sont compatibles avec le driver
+
 
<jorasse> bonne soiree a tous...
+
I connect with ssh it work ok for the few command I did.
<--| jorasse has left #armadeus
+
 
<tshado> je reviens dans un moment
+
'''Then I try to connect with SFTP from my PC (using FileZilla) :'''
<tshado> a+
+
 
<Artemys> alors polo35 ça marche mieux ?
+
'''the wifi goes down and the usb with it.'''
<polo35> non :(
+
 
<polo35> j'ai essayé de flasher avec l'option CONFIG_FW_LOADER à off
+
Here is the part of "messages" where the error is :
  <polo35> hm pardon c CONFIG_STANDALONE
+
<pre class="host">
  <Artemys> tu passes dans /sbin/hotlug quand même ?
+
Jan 10 01:23:29 armadeus kern.warn kernel: reg 0x608, usb read 4 fail, status:-19 value=0x0, vendorreq_times:1
<polo35> dans /etc/hotplug ? avec le code que tu m'as donné ?
+
Jan 10 01:23:29 armadeus kern.warn kernel: reg 0x608, usb read 4 fail, status:-19 value=0x0, vendorreq_times:2
  === sbin/hotplug Unknown command
+
Jan 10 01:23:29 armadeus kern.warn kernel: reg 0x608, usb read 4 fail, status:-19 value=0x0, vendorreq_times:3
  <Artemys> /sbin/hotplug oui
+
Jan 10 01:23:29 armadeus kern.err kernel: fsl-ehci fsl-ehci.0: fatal error
  <Artemys> si tu met un echo "COUCOU" > /tmp/tmp.txt
+
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
<polo35> oui je l'ai bien mis dans /sbin
+
Jan 10 01:23:29 armadeus kern.debug kernel: fsl-ehci fsl-ehci.0: fatal status 49098 Async Halt FATAL FLR
  <Artemys> il est éxécutable ?
+
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
<polo35> j'ai fait chmod +x /sbin/hotplug
+
Jan 10 01:23:29 armadeus kern.warn kernel: ###=> usb_read_port_complete => urb status(-108)
  <polo35> donc j'aurai tendance à dire que oui :)
+
Jan 10 01:23:29 armadeus kern.err kernel: fsl-ehci fsl-ehci.0: HC died; cleaning up
<polo35> et quand je débranche/rebranche le dongle c'est censé executé ce bash c'est bien ca ?
+
Jan 10 01:23:29 armadeus kern.debug kernel: hub 2-0:1.0: state 0 ports 1 chg 0000 evt 0000
<Artemys> quand tu charge le driver je dirais
+
Jan 10 01:23:29 armadeus kern.info kernel: usb 2-1: USB disconnect, address 2
<polo35> ok
+
Jan 10 01:23:29 armadeus kern.debug kernel: usb 2-1: unregistering device
  <polo35> bon j'ai des nouveaux trucs c'est bon signe ^
+
Jan 10 01:23:29 armadeus kern.debug kernel: usb 2-1: usb_disable_device nuking all URBs
<polo35> modprobe zd1211rw
+
Jan 10 01:23:29 armadeus kern.debug kernel: usb 2-1: unregistering interface 2-1:1.0
<polo35> usb 1-1.2: reset high speed USB device using isp1761 and address 8
+
Jan 10 01:23:29 armadeus kern.warn kernel: reg 0x608, usb read 4 fail, status:-19 value=0x0, vendorreq_times:4
<polo35> zd1211rw 1-1.2:1.0: eth1
+
Jan 10 01:23:29 armadeus kern.warn kernel: [dvobjpriv:c8aa401c][ERROR] continual_urb_error:5 > 4
<polo35> usbcore: registered new interface driver zd1211rw
+
Jan 10 01:23:29 armadeus kern.warn kernel: issue_deauth to 00:18:84:19:e1:62
<polo35> # ifconfig eth1 up
+
Jan 10 01:23:29 armadeus kern.warn kernel: rtw_sta_flush
  <polo35> intr period 1 uframes,
+
Jan 10 01:23:30 armadeus kern.warn kernel: (2)871x_drv - drv_close, bup=1, hw_init_completed=1
<polo35> ifconfig: SIOCSIFFLAGS: Connection timed out
+
Jan 10 01:23:30 armadeus kern.warn kernel: -871x_drv - drv_close, bup=1
<polo35> et à partir de ce moment le voyant du dongle s'éteint
+
Jan 10 01:23:30 armadeus kern.warn kernel: ===> rtw_dev_unload
-->| bruno (bsuarez@RZ-9d8b50f2.adsl.proxad.net) has joined #armadeus
+
Jan 10 01:23:30 armadeus kern.warn kernel: usb_read_port_cancel
<bruno> re bonjour,
+
Jan 10 01:23:30 armadeus kern.warn kernel: usb_write_port_cancel
<Artemys> polo35: C mieux ;-)
+
Jan 10 01:23:30 armadeus kern.warn kernel: ###> rtw_cmd_thread break.................
<bruno> les fichiers image en téléchargement sur armadeus.com sont ils compatibles aec la carte apf avec 8 M de flash
+
Jan 10 01:23:30 armadeus kern.warn kernel: rtw_cmd_thread: leaving... check & free all cmd_obj resources
  <Artemys> bruno: oui toujours
+
Jan 10 01:23:30 armadeus kern.warn kernel: rtw_cmd_thread: leaving... call up terminate_cmdthread_sema
<polo35> maintenant j'ai USB control request for firmware upload failed. Error number -110
+
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
 +
</pre>
 +
 
 +
And the error by using iperf -c to connect to an iperf server :
 +
 
 +
<pre class="host">
 +
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
 +
</pre>
 +
 
 +
--[[User:Sly|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====
 +
 
 +
<pre class="apf">
 +
echo userspace > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
 +
</pre>
 +
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====
 +
<pre class="host">
 +
make linux-menuconfig
 +
</pre>
 +
 
 +
<pre class="config">
 +
CPU Power Management --->
 +
      Default CPUFreq governor (userspace)  ---> 
 +
            ( ) performance
 +
            ( ) powersave
 +
            (X) userspace
 +
            ( ) ondemand
 +
            ( ) conservative
 +
</pre>
 +
 
 +
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
 +
<pre class="host">
 +
#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"),
 +
{ },
 +
};
 +
</pre>
 +
 
 +
After the fist compile change the file, do a ''linux-clean'' and ''make'' again.
 +
<br>Rather than compiling the driver as a module, I compiled it directly into the kernel.
 +
<pre class="host">
 +
make linux-menuconfig
 +
</pre>
 +
 
 +
<pre class="config">
 +
  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) </pre>
 +
 
 +
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
 +
<br>You must download the entire reository and extract the ar9721.fw file locally.
 +
<pre class="apf">
 +
# 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
 +
</pre>
 +
 
 +
<br>With this setup no modprobe is necessary. On Plugin of the Netgear WNA1100 the following should print:
 +
<pre class="apf">
 +
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
 +
</pre>
 +
Let's assume you need to connect to share myshare on the SMB network drive to be mounted under /media/mydrive
 +
<br>The following script /usr/bin/wlan_up will  bring your WLAN up:
 +
<pre class="host">
 +
#!/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=
 +
</pre>
 +
 
 +
The script starts up the WLAN wit WPA2 encryption. This requires the /etc/wpa_supplicant.conf file to be configured properly:
 +
<pre class="host">
 +
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"
 +
}
 +
</pre>
 +
 
 +
 
 +
The below script /etc/init.d/S99wlan will call the wlan_up script automatically at boot in case the wired LAN is not present:
 +
<pre class="host">
 +
#!/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
 +
</pre>
 +
 
 +
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!<br>
 +
--[[User:MartinH|MartinH]] 22:51, 23 December 2012 (UTC)

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)