Index: /ipk/source.sh4/swapnetwork_wlan_300/CONTROL/control
===================================================================
--- /ipk/source.sh4/swapnetwork_wlan_300/CONTROL/control	(revision 8777)
+++ /ipk/source.sh4/swapnetwork_wlan_300/CONTROL/control	(revision 8777)
@@ -0,0 +1,11 @@
+Package: enigma2-plugin-swapnetwork-wlan
+Version: 3.0
+Description: !!! For STM22 based boxes only !!! network connections via usb wireless adapters based on zydas and ralink(-n) chipsets
+Section: network
+Priority: optional
+Maintainer: AAF Forum
+Architecture: sh4
+OE: WLAN plugin for swapstick
+Homepage: http://www.aaf-digital.info
+Depends:
+Source: http://www.aaf-digital.info
Index: /ipk/source.sh4/swapnetwork_wlan_300/CONTROL/postinst
===================================================================
--- /ipk/source.sh4/swapnetwork_wlan_300/CONTROL/postinst	(revision 8777)
+++ /ipk/source.sh4/swapnetwork_wlan_300/CONTROL/postinst	(revision 8777)
@@ -0,0 +1,20 @@
+#!/bin/sh
+TMP=/tmp/.wlan
+
+echo "successfully installed"
+
+for i in "funcemu.ko rt73.ko rt2870sta.ko rt3070sta.ko zd1211.ko zd1211b.ko"; do
+	echo $i >> /var/etc/blacklist-modules
+done
+echo "modules blacklist updated"
+
+echo "syncing disk"
+sync
+
+if [ `df | grep /dev/mtdblock | grep var | sed 's/ \+/ /g' | cut -d ' ' -f4 | tail -n1 | wc -l` -eq 1 ]; then
+	SPACE=`df | grep /dev/mtdblock | grep var | sed 's/ \+/ /g' | cut -d ' ' -f4 | tail -n1`
+	FREE=`expr $SPACE - 100`
+	echo new freespace size $FREE kb
+fi
+echo "please plug your wifi adapter in a free usb port and reboot your box"
+exit 0
Index: /ipk/source.sh4/swapnetwork_wlan_300/CONTROL/postrm
===================================================================
--- /ipk/source.sh4/swapnetwork_wlan_300/CONTROL/postrm	(revision 8777)
+++ /ipk/source.sh4/swapnetwork_wlan_300/CONTROL/postrm	(revision 8777)
@@ -0,0 +1,23 @@
+#!/bin/sh
+TMP=/tmp/.wlan
+
+echo "successfully removed"
+
+MODS="funcemu.ko rt73.ko rt2870sta.ko rt3070sta.ko zd1211.ko zd1211b.ko"
+for i in $MODS; do
+   mv -f $FILE $FILE.old
+   sed -e "/^$i/d" $FILE.old > $FILE
+   rm /var/lib/modules/$i
+done 
+rm $FILE.old
+echo "modules blacklist updated and symlinks removed"
+
+echo "syncing disk"
+sync
+
+if [ `df | grep /dev/mtdblock | grep var | sed 's/ \+/ /g' | cut -d ' ' -f4 | tail -n1 | wc -l` -eq 1 ]; then
+	SPACE=`df | grep /dev/mtdblock | grep var | sed 's/ \+/ /g' | cut -d ' ' -f4 | tail -n1`
+	FREE=`expr $SPACE - 100`
+	echo new freespace size $FREE kb
+fi
+exit 0
Index: /ipk/source.sh4/swapnetwork_wlan_300/CONTROL/preinst
===================================================================
--- /ipk/source.sh4/swapnetwork_wlan_300/CONTROL/preinst	(revision 8777)
+++ /ipk/source.sh4/swapnetwork_wlan_300/CONTROL/preinst	(revision 8777)
@@ -0,0 +1,54 @@
+#!/bin/sh
+#
+TMP=/tmp/.wlan
+echo "syncing disk"
+sync
+
+model=`cat /etc/model`
+linuxver=`uname -a`; linuxver=${linuxver#*_}; linuxver=${linuxver%_*}
+
+echo""
+echo "Checking your Boxtype...."
+echo "Some Plugins will not work correctly on your $model!"
+echo ""
+if [ "$linuxver" = "stm22" ] ; then
+	echo "Linux Version: $linuxver OK"
+else
+	echo "Sorry! This Plugin is not for your $model with ($linuxver)!!! It will not work correctly!!!"
+	echo "Aborting installation..."
+	exit 1
+fi
+
+if [ `df | grep /dev/mtdblock | grep var | sed 's/ \+/ /g' | cut -d ' ' -f4 | tail -n1 | wc -l` -eq 1 ]; then
+	SPACE=`df | grep /dev/mtdblock | grep var | sed 's/ \+/ /g' | cut -d ' ' -f4 | tail -n1`
+	FREE=`expr $SPACE - 100`
+	SIZE=56
+	echo "checking freespace..."
+	echo packege size $SIZE kb
+	echo freespace size $FREE kb
+	if  [ "$FREE" -lt "$SIZE" ]; then
+		echo "sorry no freespace left on device!"
+		exit 1
+	else
+		echo ok
+	fi
+
+	echo "checking swapstick..."
+	if [ ! -d /var/swap/bin/ ]; then
+	    echo "no swapstick found!"
+	    exit 1
+	fi
+	echo "swapstick found!"
+fi
+
+echo "checking OS"
+if  [ `cat /etc/motd | grep AAF | grep M | grep rev | wc -l` -eq 0 ]; then                      
+	echo ---------------------------
+	echo DONT USE this IPK Package!!
+	echo ---
+	echo Only for AAF Image!!
+	echo ---------------------------
+	exit 1
+fi
+echo "installing wireless plugin ..."	sync
+exit 0
Index: /ipk/source.sh4/swapnetwork_wlan_300/CONTROL/prerm
===================================================================
--- /ipk/source.sh4/swapnetwork_wlan_300/CONTROL/prerm	(revision 8777)
+++ /ipk/source.sh4/swapnetwork_wlan_300/CONTROL/prerm	(revision 8777)
@@ -0,0 +1,11 @@
+#!/bin/sh
+TMP=/tmp/.wlan
+echo "syncing disk"
+sync
+if [ `df | grep /dev/mtdblock | grep var | sed 's/ \+/ /g' | cut -d ' ' -f4 | tail -n1 | wc -l` -eq 1 ]; then
+	SPACE=`df | grep /dev/mtdblock | grep var | sed 's/ \+/ /g' | cut -d ' ' -f4 | tail -n1`
+	FREE=`expr $SPACE - 100`
+	echo freespace size $FREE kb
+fi
+echo "removing wireless plugin"
+exit 0
Index: /ipk/source.sh4/swapnetwork_wlan_300/var/bin/fping
===================================================================
--- /ipk/source.sh4/swapnetwork_wlan_300/var/bin/fping	(revision 8777)
+++ /ipk/source.sh4/swapnetwork_wlan_300/var/bin/fping	(revision 8777)
@@ -0,0 +1,1 @@
+link ../swap/bin/fping
Index: /ipk/source.sh4/swapnetwork_wlan_300/var/bin/fping6
===================================================================
--- /ipk/source.sh4/swapnetwork_wlan_300/var/bin/fping6	(revision 8777)
+++ /ipk/source.sh4/swapnetwork_wlan_300/var/bin/fping6	(revision 8777)
@@ -0,0 +1,1 @@
+link ../swap/bin/fping6
Index: /ipk/source.sh4/swapnetwork_wlan_300/var/bin/ifrename
===================================================================
--- /ipk/source.sh4/swapnetwork_wlan_300/var/bin/ifrename	(revision 8777)
+++ /ipk/source.sh4/swapnetwork_wlan_300/var/bin/ifrename	(revision 8777)
@@ -0,0 +1,1 @@
+link ../swap/bin/ifrename
Index: /ipk/source.sh4/swapnetwork_wlan_300/var/bin/iwconfig
===================================================================
--- /ipk/source.sh4/swapnetwork_wlan_300/var/bin/iwconfig	(revision 8777)
+++ /ipk/source.sh4/swapnetwork_wlan_300/var/bin/iwconfig	(revision 8777)
@@ -0,0 +1,1 @@
+link ../swap/bin/iwconfig
Index: /ipk/source.sh4/swapnetwork_wlan_300/var/bin/iwevent
===================================================================
--- /ipk/source.sh4/swapnetwork_wlan_300/var/bin/iwevent	(revision 8777)
+++ /ipk/source.sh4/swapnetwork_wlan_300/var/bin/iwevent	(revision 8777)
@@ -0,0 +1,1 @@
+link ../swap/bin/iwevent
Index: /ipk/source.sh4/swapnetwork_wlan_300/var/bin/iwgetid
===================================================================
--- /ipk/source.sh4/swapnetwork_wlan_300/var/bin/iwgetid	(revision 8777)
+++ /ipk/source.sh4/swapnetwork_wlan_300/var/bin/iwgetid	(revision 8777)
@@ -0,0 +1,1 @@
+link ../swap/bin/iwgetid
Index: /ipk/source.sh4/swapnetwork_wlan_300/var/bin/iwlist
===================================================================
--- /ipk/source.sh4/swapnetwork_wlan_300/var/bin/iwlist	(revision 8777)
+++ /ipk/source.sh4/swapnetwork_wlan_300/var/bin/iwlist	(revision 8777)
@@ -0,0 +1,1 @@
+link ../swap/bin/iwlist
Index: /ipk/source.sh4/swapnetwork_wlan_300/var/bin/iwpriv
===================================================================
--- /ipk/source.sh4/swapnetwork_wlan_300/var/bin/iwpriv	(revision 8777)
+++ /ipk/source.sh4/swapnetwork_wlan_300/var/bin/iwpriv	(revision 8777)
@@ -0,0 +1,1 @@
+link ../swap/bin/iwpriv
Index: /ipk/source.sh4/swapnetwork_wlan_300/var/bin/iwspy
===================================================================
--- /ipk/source.sh4/swapnetwork_wlan_300/var/bin/iwspy	(revision 8777)
+++ /ipk/source.sh4/swapnetwork_wlan_300/var/bin/iwspy	(revision 8777)
@@ -0,0 +1,1 @@
+link ../swap/bin/iwspy
Index: /ipk/source.sh4/swapnetwork_wlan_300/var/bin/wpa_cli
===================================================================
--- /ipk/source.sh4/swapnetwork_wlan_300/var/bin/wpa_cli	(revision 8777)
+++ /ipk/source.sh4/swapnetwork_wlan_300/var/bin/wpa_cli	(revision 8777)
@@ -0,0 +1,1 @@
+link ../swap/bin/wpa_cli
Index: /ipk/source.sh4/swapnetwork_wlan_300/var/bin/wpa_supplicant
===================================================================
--- /ipk/source.sh4/swapnetwork_wlan_300/var/bin/wpa_supplicant	(revision 8777)
+++ /ipk/source.sh4/swapnetwork_wlan_300/var/bin/wpa_supplicant	(revision 8777)
@@ -0,0 +1,1 @@
+link ../swap/bin/wpa_supplicant
Index: /ipk/source.sh4/swapnetwork_wlan_300/var/etc/Wireless/RT2870STA/RT2870STA.dat
===================================================================
--- /ipk/source.sh4/swapnetwork_wlan_300/var/etc/Wireless/RT2870STA/RT2870STA.dat	(revision 8777)
+++ /ipk/source.sh4/swapnetwork_wlan_300/var/etc/Wireless/RT2870STA/RT2870STA.dat	(revision 8777)
@@ -0,0 +1,79 @@
+#The word of "Default" must not be removed
+Default
+CountryRegion=5
+CountryRegionABand=7
+CountryCode=
+ChannelGeography=1
+SSID=11n-AP
+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=OPEN
+EncrypType=NONE
+WPAPSK=
+DefaultKeyID=1
+Key1Type=0
+Key1Str=
+Key2Type=0
+Key2Str=
+Key3Type=0
+Key3Str=
+Key4Type=0
+Key4Str=
+PSMode=CAM
+AutoRoaming=0
+RoamThreshold=70
+APSDCapable=0
+APSDAC=0;0;0;0
+HT_RDG=1
+HT_EXTCHA=0
+HT_OpMode=0
+HT_MpduDensity=4
+HT_BW=1
+HT_BADecline=0
+HT_AutoBA=1
+HT_AMSDU=0
+HT_BAWinSize=64
+HT_GI=1
+HT_MCS=33
+HT_MIMOPSMode=3
+HT_DisallowTKIP=1
+HT_STBC=0
+EthConvertMode=
+EthCloneMac=
+IEEE80211H=0
+TGnWifiTest=0
+WirelessEvent=0
+MeshId=MESH
+MeshAutoLink=1
+MeshAuthMode=OPEN
+MeshEncrypType=NONE
+MeshWPAKEY=
+MeshDefaultkey=1
+MeshWEPKEY=
+CarrierDetect=0
+AntDiversity=0
+BeaconLostTime=4
+FtSupport=0
+Wapiifname=ra0
+WapiPsk=
+WapiPskType=
+WapiUserCertPath=
+WapiAsCertPath=
+PSP_XLINK_MODE=0
+WscManufacturer=
+WscModelName=
+WscDeviceName=
+WscModelNumber=
+WscSerialNumber=
+RadioOn=1
Index: /ipk/source.sh4/swapnetwork_wlan_300/var/etc/Wireless/wlan.usbmap
===================================================================
--- /ipk/source.sh4/swapnetwork_wlan_300/var/etc/Wireless/wlan.usbmap	(revision 8777)
+++ /ipk/source.sh4/swapnetwork_wlan_300/var/etc/Wireless/wlan.usbmap	(revision 8777)
@@ -0,0 +1,170 @@
+# usb module         match_flags idVendor idProduct bcdDevice_lo bcdDevice_hi bDeviceClass bDeviceSubClass bDeviceProtocol bInterfaceClass bInterfaceSubClass bInterfaceProtocol driver_info
+# - Zydas ZD1211 - #
+zd1211               0x0003      0x0ace   0x1211    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+zd1211               0x0003      0x0ace   0xa211    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+zd1211               0x0003      0x0586   0x3401    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+zd1211               0x0003      0x0586   0x3402    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+zd1211               0x0003      0x6891   0xa727    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+zd1211               0x0003      0x2019   0xc008    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+zd1211               0x0003      0x2019   0xc009    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+zd1211               0x0003      0x079b   0x004a    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+zd1211               0x0003      0x07b8   0x6001    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+zd1211               0x0003      0x0b3b   0x1630    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+zd1211               0x0003      0x0b3b   0x5630    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+zd1211               0x0003      0x0b3b   0x6630    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+zd1211               0x0003      0x0cde   0x0011    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+zd1211               0x0003      0x0df6   0x9071    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+zd1211               0x0003      0x126f   0xa006    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+zd1211               0x0003      0x129b   0x1666    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+zd1211               0x0003      0x1435   0x0711    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+zd1211               0x0003      0x0df6   0x9071    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+zd1211               0x0003      0x0105   0x145f    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+zd1211b              0x0003      0x0ace   0x1215    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+zd1211b              0x0003      0x0ace   0xa215    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+zd1211b              0x0003      0x0053   0x5301    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+zd1211b              0x0003      0x0053   0x5302    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+zd1211b              0x0003      0x2019   0x5303    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+zd1211b              0x0003      0x050d   0x4050    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+zd1211b              0x0003      0x050d   0x705c    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+zd1211b              0x0003      0x0586   0x340f    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+zd1211b              0x0003      0x0586   0x3410    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+zd1211b              0x0003      0x0586   0x3412    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+zd1211b              0x0003      0x079b   0x0062    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+zd1211b              0x0003      0x083a   0x4505    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+zd1211b              0x0003      0x083a   0xe501    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+zd1211b              0x0003      0x0baf   0x0121    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+zd1211b              0x0003      0x0cde   0x001a    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+zd1211b              0x0003      0x0df6   0x9075    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+zd1211b              0x0003      0x0f88   0x3014    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+zd1211b              0x0003      0x1233   0x0471    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+zd1211b              0x0003      0x129b   0x1667    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+zd1211b              0x0003      0x1582   0x6003    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+# - Ralink RT73 - #
+rt73                 0x0003      0x148f   0x2573    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt73                 0x0003      0x148f   0x2671    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt73                 0x0003      0x04bb   0x093d    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt73                 0x0003      0x18e8   0x6196    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt73                 0x0003      0x18e8   0x6229    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt73                 0x0003      0x18e8   0x6238    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt73                 0x0003      0x1044   0x8008    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt73                 0x0003      0x14b2   0x3c22    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt73                 0x0003      0x0db0   0x6877    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt73                 0x0003      0x0db0   0xa874    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt73                 0x0003      0x0db0   0xa861    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt73                 0x0003      0x07b8   0xb21d    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt73                 0x0003      0x0769   0x31f3    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt73                 0x0003      0x1472   0x0009    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt73                 0x0003      0x1371   0x9022    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt73                 0x0003      0x1371   0x9032    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt73                 0x0003      0x1631   0xc019    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt73                 0x0003      0x1044   0x800a    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt73                 0x0003      0x1690   0x0722    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt73                 0x0003      0x0df6   0x9712    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt73                 0x0003      0x0df6   0x90ac    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt73                 0x0003      0x148f   0x9021    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt73                 0x0003      0x0eb0   0x9021    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt73                 0x0003      0x0411   0x00d8    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt73                 0x0003      0x0586   0x3415    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt73                 0x0003      0x0b05   0x1723    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt73                 0x0003      0x0b05   0x1724    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt73                 0x0003      0x050d   0x705a    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt73                 0x0003      0x07d1   0x3c03    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt73                 0x0003      0x07d1   0x3c07    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt73                 0x0003      0x13b1   0x0023    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt73                 0x0003      0x13b1   0x0020    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+# - Ralink RT3070STA - #
+rt3070sta            0x0003      0x148f   0x3070    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt3070sta            0x0003      0x148f   0x3071    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt3070sta            0x0003      0x148f   0x3072    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt3070sta            0x0003      0x148f   0x2070    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt3070sta            0x0003      0x0db0   0x3820    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt3070sta            0x0003      0x0df6   0x003e    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt3070sta            0x0003      0x0df6   0x0042    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt3070sta            0x0003      0x14b2   0x3c12    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt3070sta            0x0003      0x18c5   0x0012    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt3070sta            0x0003      0x083a   0x7511    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt3070sta            0x0003      0x1740   0x9703    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt3070sta            0x0003      0x1740   0x9705    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt3070sta            0x0003      0x1740   0x9706    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt3070sta            0x0003      0x13d3   0x3273    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt3070sta            0x0003      0x1044   0x800d    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt3070sta            0x0003      0x2019   0xab25    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt3070sta            0x0003      0x07b8   0x3070    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt3070sta            0x0003      0x07b8   0x3071    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt3070sta            0x0003      0x07b8   0x3072    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt3070sta            0x0003      0x7392   0x7711    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt3070sta            0x0003      0x1a32   0x0304    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt3070sta            0x0003      0x1eda   0x2310    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt3070sta            0x0003      0x07d1   0x3c0a    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt3070sta            0x0003      0x07d1   0x3c0d    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt3070sta            0x0003      0x07d1   0x3c0e    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt3070sta            0x0003      0x07d1   0x3c0f    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt3070sta            0x0003      0x1d4d   0x000c    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt3070sta            0x0003      0x1d4d   0x000e    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt3070sta            0x0003      0x5a57   0x5257    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt3070sta            0x0003      0x5a57   0x0283    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt3070sta            0x0003      0x04bb   0x0945    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt3070sta            0x0003      0x203d   0x1480    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+# - Ralink RT2870STA - #
+rt2870sta            0x0003      0x148f   0x2770    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt2870sta            0x0003      0x148f   0x2870    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt2870sta            0x0003      0x07b8   0x2870    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt2870sta            0x0003      0x07b8   0x2770    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt2870sta            0x0003      0x0df6   0x0039    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt2870sta            0x0003      0x083a   0x7512    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt2870sta            0x0003      0x0789   0x0162    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt2870sta            0x0003      0x0789   0x0163    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt2870sta            0x0003      0x0789   0x0164    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt2870sta            0x0003      0x177f   0x0302    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt2870sta            0x0003      0x0b05   0x1731    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt2870sta            0x0003      0x0b05   0x1732    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt2870sta            0x0003      0x0b05   0x1742    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt2870sta            0x0003      0x0df6   0x0017    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt2870sta            0x0003      0x0df6   0x002b    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt2870sta            0x0003      0x0df6   0x002c    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt2870sta            0x0003      0x0df6   0x002d    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt2870sta            0x0003      0x14b2   0x3c06    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt2870sta            0x0003      0x14b2   0x3c28    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt2870sta            0x0003      0x2019   0xed06    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt2870sta            0x0003      0x07d1   0x3c09    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt2870sta            0x0003      0x07d1   0x3c11    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt2870sta            0x0003      0x14b2   0x3c07    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt2870sta            0x0003      0x050d   0x8053    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt2870sta            0x0003      0x050d   0x8053    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt2870sta            0x0003      0x14b2   0x3c27    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt2870sta            0x0003      0x07aa   0x002f    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt2870sta            0x0003      0x07aa   0x003c    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt2870sta            0x0003      0x07aa   0x003f    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt2870sta            0x0003      0x1044   0x800b    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt2870sta            0x0003      0x15a9   0x0006    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt2870sta            0x0003      0x083a   0xb522    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt2870sta            0x0003      0x083a   0xa618    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt2870sta            0x0003      0x083a   0x8522    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt2870sta            0x0003      0x083a   0x7522    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt2870sta            0x0003      0x0cde   0x0022    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt2870sta            0x0003      0x0586   0x3416    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt2870sta            0x0003      0x0cde   0x0025    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt2870sta            0x0003      0x1740   0x9701    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt2870sta            0x0003      0x1740   0x9702    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt2870sta            0x0003      0x0471   0x200f    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt2870sta            0x0003      0x14b2   0x3c25    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt2870sta            0x0003      0x13d3   0x3247    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt2870sta            0x0003      0x083a   0x6618    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt2870sta            0x0003      0x15c5   0x0008    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt2870sta            0x0003      0x0e66   0x0001    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt2870sta            0x0003      0x0e66   0x0003    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt2870sta            0x0003      0x129b   0x1828    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt2870sta            0x0003      0x157e   0x300e    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt2870sta            0x0003      0x050d   0x805c    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt2870sta            0x0003      0x050d   0x815c    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt2870sta            0x0003      0x1482   0x3c09    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt2870sta            0x0003      0x14b2   0x3c09    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt2870sta            0x0003      0x04e8   0x2018    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt2870sta            0x0003      0x5a57   0x0280    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt2870sta            0x0003      0x5a57   0x0282    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt2870sta            0x0003      0x7392   0x7718    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt2870sta            0x0003      0x7392   0x7717    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt2870sta            0x0003      0x1737   0x0070    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt2870sta            0x0003      0x1737   0x0071    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt2870sta            0x0003      0x0411   0x00e8    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
+rt2870sta            0x0003      0x050d   0x815c    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00               0x00               0x0
Index: /ipk/source.sh4/swapnetwork_wlan_300/var/etc/autostart/wlan
===================================================================
--- /ipk/source.sh4/swapnetwork_wlan_300/var/etc/autostart/wlan	(revision 8777)
+++ /ipk/source.sh4/swapnetwork_wlan_300/var/etc/autostart/wlan	(revision 8777)
@@ -0,0 +1,120 @@
+#######/bin/sh
+
+startWaitfor "/tmp/.hotplugready" 20
+
+if [ `df | grep /dev/mtdblock | grep var | sed 's/ \+/ /g' | cut -d ' ' -f4 | tail -n1 | wc -l` -eq 1 ]; then
+	echo "[wlan] checking swapstick..."
+	if [ ! -d /var/swap/bin/ ]; then
+	    echo "[wlan] no swapstick found!" | tee -a $WLAN_LOG
+	    return
+	fi
+	echo "[wlan] swapstick found" | tee $WLAN_LOG
+fi
+
+rm -f /tmp/.networkready
+
+if [ ! -z $WLAN_STARTMODE ] && [ $WLAN_STARTMODE == "load" ]; then
+	if  [ ! "$debug" = 'off' ]; then
+		echo $CMD ["$INPUT"] startWlan
+	fi
+        
+	[ ! -f /etc/Wireless/wlan.usbmap ] && rm -f /etc/Wireless/wlan_module && return
+	WLAN_MODULE=
+	MEM=$IFS
+	IFS=$'\012'
+	echo "[wlan] searching wireless-module ..." | tee -a $WLAN_LOG
+	USBIDS=`cat /proc/bus/usb/devices | grep ^P:`
+	if [ -f /etc/Wireless/wlan_module ]; then
+		WLAN_MODULE=`cat /etc/Wireless/wlan_module | awk {'print $1'}`
+		VID=`cat /etc/Wireless/wlan_module | awk {'print $2'}`
+		PID=`cat /etc/Wireless/wlan_module | awk {'print $3'}`
+	fi
+	if [ -z $WLAN_MODULE ] || [ -z "`echo $USBIDS | grep $VID | grep $PID`" ]; then
+		for i in $USBIDS; do
+			VID=`echo $i | awk {'print $2'} | cut -d"=" -f2`
+			PID=`echo $i | awk {'print $3'} | cut -d"=" -f2`
+			WLAN_MODULE=
+			for j in `cat /etc/Wireless/wlan.usbmap`; do
+				if [ `echo $j | awk {'print $3'}` == 0x$VID ] && [ `echo $j | awk {'print $4'}` == 0x$PID ]; then
+					WLAN_MODULE=`echo $j | awk {'print $1'}`
+					break
+				fi
+			done
+			[ ! -z $WLAN_MODULE ] && break
+		done
+		[ ! -z $WLAN_MODULE ] && echo $WLAN_MODULE $VID $PID > /etc/Wireless/wlan_module || rm -f /etc/Wireless/wlan_module
+	fi
+	[ -z $WLAN_MODULE ] && echo "[wlan] no applicable USB WLAN device found" | tee -a $WLAN_LOG && return
+	IFS=$MEM
+	echo "[wlan] loading $WLAN_MODULE.ko" | tee -a $WLAN_LOG
+	[ $WLAN_MODULE == "rt73" ] && insmod /var/swap/modules/funcemu.ko
+	insmod /var/swap/modules/$WLAN_MODULE.ko
+	sleep 1
+	[ -z "`lsmod | grep $WLAN_MODULE`" ] && echo "[wlan] could not load $WLAN_MODULE" | tee -a $WLAN_LOG && return
+	sleep 1
+	case $WLAN_MODULE in
+	    zd1211 | zd1211b )		WLAN_IF=eth1
+					WLAN_DRV=zydas
+					;;
+	    rt73 )			WLAN_IF=rausb0
+					WLAN_DRV=ralink
+					;;
+	    rt2870sta | rt3070sta )	WLAN_IF=ra0
+					WLAN_DRV=wext
+					;;
+	    * )				echo "[wlan] Unknown module $WLAN_MODULE" | tee -a $WLAN_LOG && return
+					;;
+	esac
+	ifconfig $WLAN_IF 0.0.0.0 up
+	[ -z "`ifconfig | grep $WLAN_IF`" ] && rmmod $WLAN_MODULE && echo "[wlan] $WLAN_IF not ready" | tee -a $WLAN_LOG && return
+	sleep 1
+
+	if [ -z "`cat /var/etc/network/interfaces | grep \"auto $WLAN_IF\"`" ]; then
+		echo "[wlan] wireless interface $WLAN_IF not activated" | tee -a $WLAN_LOG
+		python /var/etc/network/wlanscan.pyc $WLAN_IF
+		ifconfig $WLAN_IF down
+		return
+	fi
+	if [ ! -f /etc/wpa_supplicant.conf ]; then
+		echo "[wlan] wireless lan not yet configured" | tee -a $WLAN_LOG
+		python /var/etc/network/wlanscan.pyc $WLAN_IF
+		ifconfig $WLAN_IF down
+		return
+	fi
+fi
+if [ -z $WLAN_STARTMODE ] || [ $WLAN_STARTMODE == "load" ] || [ $WLAN_STARTMODE == "connect" ]; then
+	rm -Rf /var/run/wpa_supplicant*
+	AP_TRIES=20
+	AP=`cat /etc/wpa_supplicant.conf | grep ssid | grep -v scan_ssid | cut -d"=" -f2`
+	echo "[wlan] starting wpa_supplicant ..." | tee -a $WLAN_LOG
+	/var/bin/wpa_supplicant -B -i $WLAN_IF -P /var/run/wpa_supplicant.pid -D $WLAN_DRV -c /etc/wpa_supplicant.conf
+	while [ $AP_TRIES -gt 0 ]; do
+		AP_STATE=`/var/bin/wpa_cli -i $WLAN_IF -p /var/run/wpa_supplicant status | grep wpa_state | cut -d"=" -f2`
+		[ "$AP_STATE" == "COMPLETED" ] && echo "[wlan] association with $AP completed" | tee -a $WLAN_LOG && break
+		AP_TRIES=$((AP_TRIES-1))
+		sleep 1
+	done
+	if [ $AP_TRIES -lt 1 ]; then
+		case "$AP_STATE" in
+			"SCANNING"  )	echo -e "[wlan] access point $AP not found (scanning aborted...)" | tee -a $WLAN_LOG
+			;;
+			*           )	echo -e "[wlan] authentification to access point $AP failed" | tee -a $WLAN_LOG
+			;;
+		esac
+		python /var/etc/network/wlanscan.pyc $WLAN_IF
+		kill -9 `cat /var/run/wpa_supplicant.pid`
+		rm /var/run/wpa_supplicant.pid
+		ifconfig $WLAN_IF down
+		return
+	fi
+	python /var/etc/network/wlanscan.pyc $WLAN_IF
+	startNetwork $WLAN_IF
+	( startWaitfor "/tmp/.networkready" 30
+	  IP=`ifconfig $WLAN_IF | grep -m1 "inet addr" | sed s/"^\s*"// | sed s/" \+"/" "/g | cut -d " " -f2 | cut -d ":" -f2`
+	  NET=`echo ${IP%.*}`
+	  /var/bin/fping -l -b12 -q -i2000 -g $NET.1 $NET.254 2> /dev/null &
+	  echo "[wlan] completed, now checking recordshare by hotplug" | tee -a $WLAN_LOG
+	  /sbin/hotplug.sh checkRecordShare ) &
+else
+	echo "[wlan] unknown wireless startmode $WLAN_STARTMODE" | tee -a $WLAN_LOG && break
+fi
Index: /ipk/source.sh4/swapnetwork_wlan_300/var/etc/network/wlanscan.py
===================================================================
--- /ipk/source.sh4/swapnetwork_wlan_300/var/etc/network/wlanscan.py	(revision 8777)
+++ /ipk/source.sh4/swapnetwork_wlan_300/var/etc/network/wlanscan.py	(revision 8777)
@@ -0,0 +1,84 @@
+import string
+import cPickle
+import sys
+sys.path.append("/usr/lib/enigma2/python/Plugins/SystemPlugins/WirelessLan")
+sys.path.append("/usr/lib/enigma2/python")
+from iwlibs import Wireless, Iwscan
+from string import maketrans, strip
+
+a = ''; b = ''
+scanfile="/tmp/wlanscan"
+for i in range(0, 255):
+	a = a + chr(i)
+	if i < 32 or i > 127:
+		b = b + ' '
+	else:
+		b = b + chr(i)
+try:
+	iface=sys.argv[1];
+except:
+	msg = "No interface to scan\n";
+	o_file=open(scanfile,"w");
+	o_file.write(msg);
+	o_file.close();
+	print msg;
+	sys.exit();
+
+asciitrans = maketrans(a, b)
+ifobj = Wireless(iface) # a Wireless NIC Object
+stats, quality, discard, missed_beacon = ifobj.getStatistics()
+snr = quality.signallevel - quality.noiselevel
+scanresults = ifobj.scan()
+
+if scanresults is not None:
+	aps = {}
+	for result in scanresults:
+	
+		bssid = result.bssid
+
+		encryption = map(lambda x: hex(ord(x)), result.encode)
+		
+		if encryption[-1] == "0x8":
+			encryption = True
+		else:
+			encryption = False
+		
+		extra = []
+		for element in result.custom:
+			element = element.encode()
+			extra.append( strip(element.translate(asciitrans)) )
+				
+		if result.quality.sl is 0 and len(extra) > 0:
+			begin = extra[0].find('SignalStrength=')+15
+									
+			done = False
+			end = begin+1
+			
+			while not done:
+				if extra[0][begin:end].isdigit():
+					end += 1
+				else:
+					done = True
+					end -= 1
+			
+			signal = extra[0][begin:end]
+			#print "[Wlan.py] signal is:" + str(signal)
+
+		else:
+			signal = str(result.quality.sl)
+				
+		aps[bssid] = {
+			'active' : True,
+			'bssid': result.bssid,
+			'channel': result.frequency.getChannel(result.frequency.getFrequency()),
+			'encrypted': encryption,
+			'essid': strip(result.essid.translate(asciitrans)),
+			'iface': iface,
+			'maxrate' : result.rate[-1],
+			'noise' : result.quality.getNoiselevel(),
+			'quality' : str(result.quality.quality),
+			'signal' : signal,
+			'custom' : extra,
+		}
+		print aps[bssid]
+	cPickle.dump(aps, open(scanfile, 'wb'))
Index: /ipk/source.sh4/swapnetwork_wlan_300/var/usr/lib/enigma2/python/Plugins/SystemPlugins/WirelessLan/LICENSE
===================================================================
--- /ipk/source.sh4/swapnetwork_wlan_300/var/usr/lib/enigma2/python/Plugins/SystemPlugins/WirelessLan/LICENSE	(revision 8777)
+++ /ipk/source.sh4/swapnetwork_wlan_300/var/usr/lib/enigma2/python/Plugins/SystemPlugins/WirelessLan/LICENSE	(revision 8777)
@@ -0,0 +1,12 @@
+This plugin is licensed under the Creative Commons 
+Attribution-NonCommercial-ShareAlike 3.0 Unported 
+License. To view a copy of this license, visit
+http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to Creative
+Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
+
+Alternatively, this plugin may be distributed and executed on hardware which
+is licensed by Dream Multimedia GmbH.
+
+This plugin is NOT free software. It is open source, you are allowed to
+modify it (if you keep the license), but it may not be commercially 
+distributed other than under the conditions noted above.
Index: /ipk/source.sh4/swapnetwork_wlan_300/var/usr/lib/enigma2/python/Plugins/SystemPlugins/WirelessLan/Wlan.py
===================================================================
--- /ipk/source.sh4/swapnetwork_wlan_300/var/usr/lib/enigma2/python/Plugins/SystemPlugins/WirelessLan/Wlan.py	(revision 8777)
+++ /ipk/source.sh4/swapnetwork_wlan_300/var/usr/lib/enigma2/python/Plugins/SystemPlugins/WirelessLan/Wlan.py	(revision 8777)
@@ -0,0 +1,539 @@
+#from enigma import eListboxPythonMultiContent, eListbox, gFont, RT_HALIGN_LEFT, RT_HALIGN_RIGHT, RT_HALIGN_CENTER
+#from Components.MultiContent import MultiContentEntryText
+#from Components.GUIComponent import GUIComponent
+#from Components.HTMLComponent import HTMLComponent
+from Components.config import config, ConfigYesNo, NoSave, ConfigSubsection, ConfigText, ConfigSelection, ConfigPassword
+from Components.Console import Console
+
+from os import system
+from string import maketrans, strip
+import sys
+import types
+import cPickle
+from re import compile as re_compile, search as re_search
+from iwlibs import getNICnames, Wireless, Iwfreq
+
+list = []
+list.append("WEP")
+list.append("WPA")
+list.append("WPA2")
+list.append("WPA/WPA2")
+
+weplist = []
+weplist.append("ASCII")
+weplist.append("HEX")
+
+config.plugins.wlan = ConfigSubsection()
+config.plugins.wlan.essid = NoSave(ConfigText(default = "home", fixed_size = False))
+config.plugins.wlan.hiddenessid = NoSave(ConfigText(default = "home", fixed_size = False))
+
+config.plugins.wlan.encryption = ConfigSubsection()
+config.plugins.wlan.encryption.enabled = NoSave(ConfigYesNo(default = True))
+config.plugins.wlan.encryption.type = NoSave(ConfigSelection(list, default = "WPA/WPA2"))
+config.plugins.wlan.encryption.wepkeytype = NoSave(ConfigSelection(weplist, default = "ASCII"))
+config.plugins.wlan.encryption.psk = NoSave(ConfigPassword(default = "mysecurewlan", fixed_size = False))
+
+class Wlan:
+	def __init__(self, iface):
+		a = ''; b = ''
+		for i in range(0, 255):
+			a = a + chr(i)
+			if i < 32 or i > 127:
+				b = b + ' '
+			else:
+				b = b + chr(i)
+		
+		self.iface = iface
+		self.wlaniface = {}
+		self.WlanConsole = Console()
+		self.asciitrans = maketrans(a, b)
+
+	def stopWlanConsole(self):
+		if self.WlanConsole is not None:
+			print "killing self.WlanConsole"
+			self.WlanConsole = None
+			del self.WlanConsole
+			
+	def getDataForInterface(self, callback = None):
+		#get ip out of ip addr, as avahi sometimes overrides it in ifconfig.
+		print "self.iface im getDataForInterface",self.iface
+		if len(self.WlanConsole.appContainers) == 0:
+			self.WlanConsole = Console()
+			cmd = "/var/bin/iwconfig " + self.iface
+			self.WlanConsole.ePopen(cmd, self.iwconfigFinished, callback)
+
+	def iwconfigFinished(self, result, retval, extra_args):
+		print "self.iface im iwconfigFinished",self.iface
+		callback = extra_args
+		data = { 'essid': False, 'frequency': False, 'acesspoint': False, 'bitrate': False, 'encryption': False, 'quality': False, 'signal': False }
+		#print "result im iwconfigFinished",result
+		
+		for line in result.splitlines():
+			#print "line",line
+			line = line.strip()
+			if "ESSID" in line:
+				if "off/any" in line:
+					ssid = _("No Connection")
+				else:
+					tmpssid=(line[line.index('ESSID')+7:len(line)-1])
+					if tmpssid == '':
+						ssid = _("Hidden networkname")
+					elif tmpssid ==' ':
+						ssid = _("Hidden networkname")
+					else:
+					    ssid = tmpssid
+				#print "SSID->",ssid
+				if ssid is not None:
+					data['essid'] = ssid
+			if 'Frequency' in line:
+				frequency = line[line.index('Frequency')+10 :line.index(' GHz')]
+				#print "Frequency",frequency   
+				if frequency is not None:
+					data['frequency'] = frequency
+			if "Access Point" in line:
+				ap=line[line.index('Access Point')+14:len(line)-1]
+				#print "AP",ap
+				if ap is not None:
+					data['acesspoint'] = ap
+			if "Bit Rate" in line:
+				br = line[line.index('Bit Rate')+9 :line.index(' Mb/s')]
+				#print "Bitrate",br
+				if br is not None:
+					data['bitrate'] = br
+			if 'Encryption key' in line:
+				if ":off" in line:
+				    enc = _("Disabled")
+				else:
+				    enc = line[line.index('Encryption key')+15 :line.index('   Security')]
+				#print "Encryption key",enc 
+				if enc is not None:
+					data['encryption'] = _("Enabled")
+			if 'Quality' in line:
+				if "/100" in line:
+					qual = line[line.index('Quality')+8:line.index('/100')]
+				else:
+					qual = line[line.index('Quality')+8:line.index('Sig')]
+				#print "Quality",qual
+				if qual is not None:
+					data['quality'] = qual
+			if 'Signal level' in line:
+				signal = line[line.index('Signal level')+14 :line.index(' dBm')]
+				#print "Signal level",signal		
+				if signal is not None:
+					data['signal'] = signal
+
+		self.wlaniface[self.iface] = data
+		
+		if len(self.WlanConsole.appContainers) == 0:
+			print "self.wlaniface after loading:", self.wlaniface
+			self.WlanConsole = None
+			if callback is not None:
+				callback(True,self.wlaniface)
+
+	def getAdapterAttribute(self, attribute):
+		print "im getAdapterAttribute"
+		if self.wlaniface.has_key(self.iface):
+			print "self.wlaniface.has_key",self.iface
+			if self.wlaniface[self.iface].has_key(attribute):
+				return self.wlaniface[self.iface][attribute]
+		return None
+		
+	def asciify(self, str):
+		return str.translate(self.asciitrans)
+
+	
+	def getWirelessInterfaces(self):
+		iwifaces = None
+		try:
+			iwifaces = getNICnames()
+		except:
+			print "[Wlan.py] No Wireless Networkcards could be found"
+		
+		return iwifaces
+
+	
+	def getNetworkList(self):
+		#system("ifconfig "+self.iface+" up")
+		ifobj = Wireless(self.iface) # a Wireless NIC Object
+		
+		#Association mappings
+		#stats, quality, discard, missed_beacon = ifobj.getStatistics()
+		#snr = quality.signallevel - quality.noiselevel
+
+		#try:
+		#	scanresults = ifobj.scan()
+		#except:
+		#	scanresults = None
+		#	print "[Wlan.py] No Wireless Networks could be found"
+		scanresults = True
+		if scanresults is not None:
+			aps = {}
+			try:
+				scanfile=open('/tmp/wlanscan','rb')
+				aps = cPickle.load(scanfile)
+				scanfile.close()
+			except:
+				pass
+#			for result in scanresults:
+#			
+#				bssid = result.bssid
+#		
+#				encryption = map(lambda x: hex(ord(x)), result.encode)
+#		
+#				if encryption[-1] == "0x8":
+#					encryption = True
+#				else:
+#					encryption = False
+#		
+#				extra = []
+#				for element in result.custom:
+#					element = element.encode()
+#					extra.append( strip(self.asciify(element)) )
+#				
+#				if result.quality.sl is 0 and len(extra) > 0:
+#					begin = extra[0].find('SignalStrength=')+15
+#									
+#					done = False
+#					end = begin+1
+#					
+#					while not done:
+#						if extra[0][begin:end].isdigit():
+#							end += 1
+#						else:
+#							done = True
+#							end -= 1
+#					
+#					signal = extra[0][begin:end]
+#					#print "[Wlan.py] signal is:" + str(signal)
+#
+#				else:
+#					signal = str(result.quality.sl)
+#				
+#				aps[bssid] = {
+#					'active' : True,
+#					'bssid': result.bssid,
+#					'channel': result.frequency.getChannel(result.frequency.getFrequency()),
+#					'encrypted': encryption,
+#					'essid': strip(self.asciify(result.essid)),
+#					'iface': self.iface,
+#					'maxrate' : result.rate[-1],
+#					'noise' : result.quality.getNoiselevel(),
+#					'quality' : str(result.quality.quality),
+#					'signal' : signal,
+#					'custom' : extra,
+#				}
+#				print aps[bssid]
+			return aps
+
+		
+	def getStatus(self):
+		ifobj = Wireless(self.iface)
+		fq = Iwfreq()
+		try:
+			self.channel = str(fq.getChannel(str(ifobj.getFrequency()[0:-3])))
+		except:
+			self.channel = 0
+		#print ifobj.getStatistics()
+		status = {
+				  'BSSID': str(ifobj.getAPaddr()),
+				  'ESSID': str(ifobj.getEssid()),
+				  'quality': str(ifobj.getStatistics()[1].quality),
+				  'signal': str(ifobj.getStatistics()[1].sl),
+				  'bitrate': str(ifobj.getBitrate()),
+				  'channel': str(self.channel),
+				  #'channel': str(fq.getChannel(str(ifobj.getFrequency()[0:-3]))),
+		}
+		
+		for (key, item) in status.items():
+			if item is "None" or item is "":
+					status[key] = _("N/A")
+				
+		return status
+
+
+class wpaSupplicant:
+	def __init__(self):
+		pass
+	
+		
+	def writeConfig(self):	
+			
+			essid = config.plugins.wlan.essid.value
+			hiddenessid = config.plugins.wlan.hiddenessid.value
+			encrypted = config.plugins.wlan.encryption.enabled.value
+			encryption = config.plugins.wlan.encryption.type.value
+			wepkeytype = config.plugins.wlan.encryption.wepkeytype.value
+			psk = config.plugins.wlan.encryption.psk.value
+			fp = file('/etc/wpa_supplicant.conf', 'w')
+			fp.write('#WPA Supplicant Configuration by enigma2\n')
+			fp.write('ctrl_interface=/var/run/wpa_supplicant\n')
+			fp.write('eapol_version=1\n')
+			fp.write('fast_reauth=1\n')	
+			if essid == 'hidden...':
+				fp.write('ap_scan=2\n')
+			else:
+				fp.write('ap_scan=1\n')
+			fp.write('network={\n')
+			if essid == 'hidden...':
+				fp.write('\tssid="'+hiddenessid+'"\n')
+			else:
+				fp.write('\tssid="'+essid+'"\n')
+			fp.write('\tscan_ssid=0\n')			
+			if encrypted:
+				if encryption == 'WPA' or encryption == 'WPA2' or encryption == 'WPA/WPA2' :
+					fp.write('\tkey_mgmt=WPA-PSK\n')
+					
+					if encryption == 'WPA':
+						fp.write('\tproto=WPA\n')
+						fp.write('\tpairwise=TKIP\n')
+						fp.write('\tgroup=TKIP\n')
+					elif encryption == 'WPA2':
+						fp.write('\tproto=WPA RSN\n')
+						fp.write('\tpairwise=CCMP TKIP\n')
+						fp.write('\tgroup=CCMP TKIP\n')						
+					else:
+						fp.write('\tproto=WPA WPA2\n')
+						fp.write('\tpairwise=CCMP\n')
+						fp.write('\tgroup=TKIP\n')					
+					fp.write('\tpsk="'+psk+'"\n')
+						
+				elif encryption == 'WEP':
+					fp.write('\tkey_mgmt=NONE\n')
+					if wepkeytype == 'ASCII':
+						fp.write('\twep_key0="'+psk+'"\n')
+					else:
+						fp.write('\twep_key0='+psk+'\n')
+			else:
+				fp.write('\tkey_mgmt=NONE\n')			
+			fp.write('}')
+			fp.write('\n')
+			fp.close()
+			system("cat /etc/wpa_supplicant.conf")
+		
+	def loadConfig(self):
+		try:
+			#parse the wpasupplicant configfile
+			fp = file('/etc/wpa_supplicant.conf', 'r')
+			supplicant = fp.readlines()
+			fp.close()
+			ap_scan = False
+			essid = None
+
+			for s in supplicant:
+				split = s.strip().split('=',1)
+				if split[0] == 'ap_scan':
+					print "[Wlan.py] Got Hidden SSID Scan  Value "+split[1]
+					if split[1] == '2':
+						ap_scan = True
+					else:
+						ap_scan = False
+						
+				elif split[0] == 'ssid':
+					print "[Wlan.py] Got SSID "+split[1][1:-1]
+					essid = split[1][1:-1]
+					
+				elif split[0] == 'proto':
+					print "split[1]",split[1]
+					config.plugins.wlan.encryption.enabled.value = True
+					if split[1] == "WPA" :
+						mode = 'WPA'
+					if split[1] == "WPA WPA2" :
+						mode = 'WPA/WPA2'
+					if split[1] == "WPA RSN" :
+						mode = 'WPA2'
+					config.plugins.wlan.encryption.type.value = mode
+					print "[Wlan.py] Got Encryption: "+mode
+					
+				#currently unused !
+				#elif split[0] == 'key_mgmt':
+				#	print "split[1]",split[1]
+				#	if split[1] == "WPA-PSK" :
+				#		config.plugins.wlan.encryption.enabled.value = True
+				#		config.plugins.wlan.encryption.type.value = "WPA/WPA2"
+				#	print "[Wlan.py] Got Encryption: "+ config.plugins.wlan.encryption.type.value
+					
+				elif split[0] == 'wep_key0':
+					config.plugins.wlan.encryption.enabled.value = True
+					config.plugins.wlan.encryption.type.value = 'WEP'
+					if split[1].startswith('"') and split[1].endswith('"'):
+						config.plugins.wlan.encryption.wepkeytype.value = 'ASCII'
+						config.plugins.wlan.encryption.psk.value = split[1][1:-1]
+					else:
+						config.plugins.wlan.encryption.wepkeytype.value = 'HEX'
+						config.plugins.wlan.encryption.psk.value = split[1]						
+					print "[Wlan.py] Got Encryption: WEP - keytype is: "+config.plugins.wlan.encryption.wepkeytype.value
+					print "[Wlan.py] Got Encryption: WEP - key0 is: "+config.plugins.wlan.encryption.psk.value
+					
+				elif split[0] == 'psk':
+					config.plugins.wlan.encryption.psk.value = split[1][1:-1]
+					print "[Wlan.py] Got PSK: "+split[1][1:-1]
+				else:
+					pass
+				
+			if ap_scan is True:
+				config.plugins.wlan.hiddenessid.value = essid
+				config.plugins.wlan.essid.value = 'hidden...'
+			else:
+				config.plugins.wlan.hiddenessid.value = essid
+				config.plugins.wlan.essid.value = essid
+			wsconfig = {
+					'hiddenessid': config.plugins.wlan.hiddenessid.value,
+					'ssid': config.plugins.wlan.essid.value,
+					'encryption': config.plugins.wlan.encryption.enabled.value,
+					'encryption_type': config.plugins.wlan.encryption.type.value,
+					'encryption_wepkeytype': config.plugins.wlan.encryption.wepkeytype.value,
+					'key': config.plugins.wlan.encryption.psk.value,
+				}
+		
+			for (key, item) in wsconfig.items():
+				if item is "None" or item is "":
+					if key == 'hiddenessid':
+						wsconfig['hiddenessid'] = "home"
+					if key == 'ssid':
+						wsconfig['ssid'] = "home"
+					if key == 'encryption':
+						wsconfig['encryption'] = True				
+					if key == 'encryption':
+						wsconfig['encryption_type'] = "WPA/WPA2"
+					if key == 'encryption':
+						wsconfig['encryption_wepkeytype'] = "ASCII"
+					if key == 'encryption':
+						wsconfig['key'] = "mysecurewlan"
+
+		except:
+			print "[Wlan.py] Error parsing /etc/wpa_supplicant.conf"
+			wsconfig = {
+					'hiddenessid': "home",
+					'ssid': "home",
+					'encryption': True,
+					'encryption_type': "WPA/WPA2",
+					'encryption_wepkeytype': "ASCII",
+					'key': "mysecurewlan",
+				}
+		print "[Wlan.py] WS-CONFIG-->",wsconfig
+		return wsconfig
+
+	
+	def restart(self, iface):
+		system("start-stop-daemon -K -x /var/bin/wpa_supplicant")
+		system("start-stop-daemon -S -x /var/bin/wpa_supplicant -- -B -i"+iface+" -c/etc/wpa_supplicant.conf")
+
+class Status:
+	def __init__(self):
+		self.wlaniface = {}
+		self.backupwlaniface = {}
+		self.WlanConsole = Console()
+
+	def stopWlanConsole(self):
+		if self.WlanConsole is not None:
+			print "killing self.WlanConsole"
+			self.WlanConsole = None
+			
+	def getDataForInterface(self, iface, callback = None):
+		self.WlanConsole = Console()
+		cmd = "/var/bin/iwconfig " + iface
+		self.WlanConsole.ePopen(cmd, self.iwconfigFinished, [iface, callback])
+
+	def iwconfigFinished(self, result, retval, extra_args):
+		(iface, callback) = extra_args
+		data = { 'essid': False, 'frequency': False, 'acesspoint': False, 'bitrate': False, 'encryption': False, 'quality': False, 'signal': False }
+		for line in result.splitlines():
+			line = line.strip()
+			if "ESSID" in line:
+				if "off/any" in line:
+					ssid = _("No Connection")
+				else:
+					try:
+						tmpssid=(line[line.index('ESSID')+7:line.index('" ')])
+					except:
+						tmpssid=(line[line.index('ESSID')+7:len(line)-1])
+					if tmpssid == '':
+						ssid = _("Hidden networkname")
+					elif tmpssid ==' ':
+						ssid = _("Hidden networkname")
+					else:
+					    ssid = tmpssid
+				#print "SSID->",ssid
+				if ssid is not None:
+					data['essid'] = ssid
+			if 'Frequency' in line:
+				frequency = line[line.index('Frequency')+10 :line.index(' GHz')]
+				#print "Frequency",frequency   
+				if frequency is not None:
+					data['frequency'] = frequency
+			if "Access Point" in line:
+				ap=line[line.index('Access Point')+14:len(line)]
+				#print "AP",ap
+				if ap is not None:
+					data['acesspoint'] = ap
+					if ap == "Not-Associated":
+						data['essid'] = _("No Connection")
+			if "Bit Rate" in line:
+				if "kb" in line:
+					br = line[line.index('Bit Rate')+9 :line.index(' kb/s')]
+					if br == '0':
+						br = _("Unsupported")
+					else:
+						br += " Mb/s"
+				else:
+					br = line[line.index('Bit Rate')+9 :line.index(' Mb/s')] + " Mb/s"
+				#print "Bitrate",br
+				if br is not None:
+					data['bitrate'] = br
+			if 'Encryption key' in line:
+				if ":off" in line:
+					if data['acesspoint'] is not "Not-Associated":
+						enc = _("Unsupported")
+					else:
+						enc = _("Disabled")
+				else:
+					try:
+						enc = line[line.index('Encryption key')+15 :line.index('   Security')]
+					except:
+						enc = line[line.index('Encryption key')+15 :len(line)-1]
+					if enc is not None:
+						enc = _("Enabled")
+				#print "Encryption key",enc 
+				if enc is not None:
+					data['encryption'] = enc
+			if 'Quality' in line:
+				if "/100" in line:
+					qual = line[line.index('Quality')+8:line.index('/100')]
+				else:
+					qual = line[line.index('Quality')+8:line.index('Sig')]
+				#print "Quality",qual
+				if qual is not None:
+					data['quality'] = qual
+			if 'Signal level' in line:
+				if "dBm" in line:
+					signal = line[line.index('Signal level')+14 :line.index(' dBm')]
+					signal += " dBm"
+				elif "/100" in line:
+					signal = line[line.index('Signal level')+13:line.index('/100  Noise')]
+					signal += "%"
+				else:
+					signal = line[line.index('Signal level')+13:line.index('  Noise')]
+					signal += "%"
+				#print "Signal level",signal		
+				if signal is not None:
+					data['signal'] = signal
+
+		self.wlaniface[iface] = data
+		self.backupwlaniface = self.wlaniface
+		
+		if self.WlanConsole is not None:
+			if len(self.WlanConsole.appContainers) == 0:
+				print "self.wlaniface after loading:", self.wlaniface
+				if callback is not None:
+					callback(True,self.wlaniface)
+
+	def getAdapterAttribute(self, iface, attribute):
+		print "im getAdapterAttribute"
+		self.iface = iface
+		if self.wlaniface.has_key(self.iface):
+			print "self.wlaniface.has_key",self.iface
+			if self.wlaniface[self.iface].has_key(attribute):
+				return self.wlaniface[self.iface][attribute]
+		return None
+	
+iStatus = Status()
Index: /ipk/source.sh4/swapnetwork_wlan_300/var/usr/lib/enigma2/python/Plugins/SystemPlugins/WirelessLan/flags.py
===================================================================
--- /ipk/source.sh4/swapnetwork_wlan_300/var/usr/lib/enigma2/python/Plugins/SystemPlugins/WirelessLan/flags.py	(revision 8777)
+++ /ipk/source.sh4/swapnetwork_wlan_300/var/usr/lib/enigma2/python/Plugins/SystemPlugins/WirelessLan/flags.py	(revision 8777)
@@ -0,0 +1,104 @@
+# -*- coding: ISO-8859-1 -*-
+# python-wifi -- a wireless library to access wireless cards via python
+# Copyright (C) 2004, 2005, 2006 Róman Joost
+#
+#    This library is free software; you can redistribute it and/or
+#    modify it under the terms of the GNU Lesser General Public License
+#    as published by the Free Software Foundation; either version 2.1 of
+#    the License, or (at your option) any later version.
+#
+#    This library is distributed in the hope that it will be useful, but
+#    WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+#    Lesser General Public License for more details.
+#
+#    You should have received a copy of the GNU Lesser General Public
+#    License along with this library; if not, write to the Free Software
+#    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+#    USA 
+
+modes = ['Auto', 
+         'Ad-Hoc',
+         'Managed',
+         'Master', 
+         'Repeat',
+         'Second',
+         'Monitor']
+
+IFNAMSIZE = 16
+IW_ESSID_MAX_SIZE = 16
+
+KILO = 10**3
+MEGA = 10**6
+GIGA = 10**9
+
+# ioctl calls for the Linux/i386 kernel
+SIOCIWFIRST   = 0x8B00    # FIRST ioctl identifier
+SIOCGIFCONF   = 0x8912    # ifconf struct
+SIOCGIWNAME   = 0x8B01    # get name == wireless protocol
+SIOCGIWFREQ   = 0x8B05    # get channel/frequency
+SIOCSIWMODE   = 0x8B06    # set the operation mode
+SIOCGIWMODE   = 0x8B07    # get operation mode
+SIOCGIWSENS   = 0x8B09    # get sensitivity
+SIOCGIWAP     = 0x8B15    # get AP MAC address
+SIOCSIWSCAN   = 0x8B18    # set scanning off
+SIOCGIWSCAN   = 0x8B19    # get scanning results
+SIOCGIWRATE   = 0x8B21    # get default bit rate
+SIOCGIWRTS    = 0x8B23    # get rts/cts threshold
+SIOCGIWFRAG   = 0x8B25    # get fragmention thrh
+SIOCGIWTXPOW  = 0x8B27    # get transmit power (dBm)
+SIOCGIWRETRY  = 0x8B29    # get retry limit
+SIOCGIWRANGE  = 0x8B0B    # range
+SIOCGIWSTATS  = 0x8B0F    # get wireless statistics
+SIOCSIWESSID  = 0x8B1A    # set essid
+SIOCGIWESSID  = 0x8B1B    # get essid
+SIOCGIWPOWER  = 0x8B2D    # get power managment settings
+SIOCGIWENCODE = 0x8B2B    # get encryption information
+SIOCIWLAST    = 0x8BFF    # LAST ioctl identifier
+
+# Power management flags
+IW_POWER_ON = 0x0000        # No details ...
+IW_POWER_TYPE = 0xF000      # Type of parameter
+IW_POWER_PERIOD = 0x1000    # Value is a period/duration of
+IW_POWER_TIMEOUT = 0x2000   # Value is a timeout
+IW_POWER_MODE = 0x0F00      # Power management mode
+IW_POWER_MIN = 0x0001       # Value is a minimum
+IW_POWER_MAX = 0x0002       # Value is a maximum
+IW_POWER_RELATIVE = 0x0004  # Value is not in seconds/ms/us
+
+# Retry limits 
+IW_RETRY_TYPE = 0xF000      # Type of parameter
+
+# encoding stuff
+IW_ENCODE_DISABLED = 0x8000     # encoding is disabled
+IW_ENCODE_NOKEY = 0x0800      # key is write only, not present
+
+# constants responsible for scanning
+IW_SCAN_MAX_DATA = 4096
+
+IW_EV_LCP_LEN = 4
+IW_EV_CHAR_LEN = IW_EV_LCP_LEN + IFNAMSIZE
+IW_EV_UINT_LEN = IW_EV_LCP_LEN + 4
+IW_EV_FREQ_LEN = IW_EV_LCP_LEN + 8
+IW_EV_ADDR_LEN = IW_EV_LCP_LEN + 16
+IW_EV_POINT_LEN = IW_EV_LCP_LEN + 4
+IW_EV_PARAM_LEN = IW_EV_LCP_LEN + 8
+IW_EV_QUAL_LEN = IW_EV_LCP_LEN + 4
+
+EPERM = 1
+E2BIG = 7
+EAGAIN = 11
+
+IWHT_NULL = 0
+IWHT_CHAR = 2
+IWHT_UINT = 4
+IWHT_FREQ = 5
+IWHT_ADDR = 6
+IWHT_POINT = 8
+IWHT_PARAM = 9
+IWHT_QUAL = 10
+
+IWEVFIRST     = 0x8C00    # FIRST event identifier
+IWEVQUAL      = 0x8C01    # Quality statistics from scan
+IWEVCUSTOM    = 0x8C02    # Custom Ascii string from Driver
+IWEVLAST      = 0x8C0A    # LAST event identifier
Index: /ipk/source.sh4/swapnetwork_wlan_300/var/usr/lib/enigma2/python/Plugins/SystemPlugins/WirelessLan/iwlibs.py
===================================================================
--- /ipk/source.sh4/swapnetwork_wlan_300/var/usr/lib/enigma2/python/Plugins/SystemPlugins/WirelessLan/iwlibs.py	(revision 8777)
+++ /ipk/source.sh4/swapnetwork_wlan_300/var/usr/lib/enigma2/python/Plugins/SystemPlugins/WirelessLan/iwlibs.py	(revision 8777)
@@ -0,0 +1,1114 @@
+# -*- coding: ISO-8859-1 -*-
+# python-wifi -- a wireless library to access wireless cards via python
+# Copyright (C) 2004, 2005, 2006 Róman Joost
+# 
+# Contributions from:
+#   Mike Auty <m.auty@softhome.net> (Iwscanresult, Iwscan)
+#
+#    This library is free software; you can redistribute it and/or
+#    modify it under the terms of the GNU Lesser General Public License
+#    as published by the Free Software Foundation; either version 2.1 of
+#    the License, or (at your option) any later version.
+#
+#    This library is distributed in the hope that it will be useful, but
+#    WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+#    Lesser General Public License for more details.
+#
+#    You should have received a copy of the GNU Lesser General Public
+#    License along with this library; if not, write to the Free Software
+#    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+#    USA 
+
+from struct import pack as struct_pack, \
+	unpack as struct_unpack, \
+	calcsize as struct_calcsize
+
+from array import array
+from math import ceil, log10
+from fcntl import ioctl
+from socket import AF_INET, SOCK_DGRAM, socket
+from time import sleep
+from re import compile
+
+from flags import *    
+
+def getNICnames():
+    """ extract wireless device names of /proc/net/wireless 
+        
+        returns empty list if no devices are present
+
+        >>> getNICnames()
+        ['eth1', 'wifi0']
+    """
+    device = compile('[a-z]+[0-9]+')
+    ifnames = []
+    
+    f = open('/proc/net/wireless', 'r')
+    data = f.readlines()
+    for line in data:
+        try:
+            ifnames.append(device.search(line).group())
+        except AttributeError:
+            pass 
+    # if we couldn't lookup the devices, try to ask the kernel
+    if ifnames == []:
+        ifnames = getConfiguredNICnames()
+    
+    return ifnames
+
+def getConfiguredNICnames():
+    """get the *configured* ifnames by a systemcall
+       
+       >>> getConfiguredNICnames()
+       []
+    """
+    iwstruct = Iwstruct()
+    ifnames = []
+    buff = array('c', '\0'*1024)
+    caddr_t, length = buff.buffer_info()
+    s = iwstruct.pack('iP', length, caddr_t)
+    try:
+        result = iwstruct._fcntl(SIOCGIFCONF, s)
+    except IOError, (i, e):
+        return i, e
+   
+    # get the interface names out of the buffer
+    for i in range(0, 1024, 32):
+        ifname = buff.tostring()[i:i+32]
+        ifname = struct_unpack('32s', ifname)[0]
+        ifname = ifname.split('\0', 1)[0]
+        if ifname:
+            # verify if ifnames are really wifi devices
+            wifi = Wireless(ifname)
+            result = wifi.getAPaddr()
+            if result[0] == 0:
+                ifnames.append(ifname)
+
+    return ifnames  
+
+def makedict(**kwargs):
+    return kwargs
+
+
+class Wireless(object):
+    """Access to wireless interfaces"""
+    
+    def __init__(self, ifname):
+        self.sockfd = socket(AF_INET, SOCK_DGRAM)
+        self.ifname = ifname
+        self.iwstruct = Iwstruct()
+    
+    def getAPaddr(self):
+        """ returns accesspoint mac address 
+        
+            >>> from iwlibs import Wireless, getNICnames
+            >>> ifnames = getNICnames()
+            >>> ifnames
+            ['eth1', 'wifi0']
+            >>> wifi = Wireless(ifnames[0])
+            >>> wifi.getAPaddr()
+            '00:0D:88:8E:4E:93'
+
+            Test with non-wifi card:
+            >>> wifi = Wireless('eth0')
+            >>> wifi.getAPaddr()
+            (95, 'Operation not supported')
+
+            Test with non-existant card:
+            >>> wifi = Wireless('eth2')
+            >>> wifi.getAPaddr()
+            (19, 'No such device')
+        """
+        buff, s = self.iwstruct.pack_wrq(32)
+        i, result = self.iwstruct.iw_get_ext(self.ifname, 
+                                             SIOCGIWAP,
+                                             data=s)
+        if i > 0:
+            return result
+
+        return self.iwstruct.getMAC(result)
+   
+    def getBitrate(self):
+        """returns device currently set bit rate 
+        
+            >>> from iwlibs import Wireless
+            >>> wifi = Wireless('eth1')
+            >>> wifi.getBitrate()
+            '11 Mb/s'
+        """
+        i, result = self.iwstruct.iw_get_ext(self.ifname, 
+                                            SIOCGIWRATE)
+        if i > 0:
+            return result
+        iwfreq = Iwfreq(result)
+        return iwfreq.getBitrate()
+    
+    def getBitrates(self):
+        """returns the number of available bitrates for the device
+           
+            >>> from iwlibs import Wireless
+            >>> wifi = Wireless('eth1')
+            >>> num, rates = wifi.getBitrates()
+            >>> num == len(rates)
+            True
+        """
+        range = Iwrange(self.ifname)
+        if range.errorflag:
+            return (range.errorflag, range.error)
+        return (range.num_bitrates, range.bitrates)
+
+    def getChannelInfo(self):
+        """returns the number of channels and available frequency for
+           the device
+
+            >>> from iwlibs import Wireless
+            >>> wifi = Wireless('eth1')
+            >>> num, rates = wifi.getChannelInfo()
+            >>> num == len(rates)
+            True
+            """
+        range = Iwrange(self.ifname)
+        if range.errorflag:
+            return (range.errorflag, range.error)
+        return (range.num_channels, range.frequencies)
+
+    def getEssid(self):
+        """get essid information
+            
+            >>> from iwlibs import Wireless
+            >>> wifi = Wireless('eth1')
+            >>> wifi.getEssid()
+            'romanofski'
+        """
+        essid = ""
+        buff, s = self.iwstruct.pack_wrq(32)
+        i, result = self.iwstruct.iw_get_ext(self.ifname, 
+                                             SIOCGIWESSID, 
+                                             data=s)
+        if i > 0:
+            return result
+        str = buff.tostring()
+        return str.strip('\x00')
+
+    def setEssid(self, essid):
+        """set essid """
+        raise NotImplementedError
+        if len(essid) > IW_ESSID_MAX_SIZE:
+            return "essid to big"
+        buff, s = self.iwstruct.pack_test(essid, 32)
+        i, result = self.iwstruct.iw_get_ext(self.ifname, 
+                                             SIOCSIWESSID, 
+                                             data=s)
+        if i > 0:
+            return result
+
+    def getEncryption(self):
+        """get encryption information which is probably a string of '*',
+        'open', 'private'
+            
+            as a normal user, you will get a 'Operation not permitted'
+            error:
+        
+            >>> from iwlibs import Wireless
+            >>> wifi = Wireless('eth1')
+            >>> wifi.getEncryption()
+            (1, 'Operation not permitted')
+        """
+        iwpoint = Iwpoint(self.ifname)
+        if iwpoint.errorflag:
+            return (iwpoint.errorflag, iwpoint.error)
+        return iwpoint.getEncryptionKey()
+
+    def getFragmentation(self):
+        """returns fragmentation threshold 
+           
+           It depends on what the driver says. If you have fragmentation
+           threshold turned on, you'll get an int. If it's turned of
+           you'll get a string: 'off'.
+            >>> from iwlibs import Wireless
+            >>> wifi = Wireless('eth1')
+            >>> wifi.getFragmentation()
+            'off'
+        """
+        iwparam = Iwparam(self.ifname, SIOCGIWFRAG)
+        if iwparam.errorflag:
+            return (iwparam.errorflag, iwparam.error)
+        return iwparam.getValue()
+        
+    def getFrequency(self):
+        """returns currently set frequency of the card 
+            
+            >>> from iwlibs import Wireless
+            >>> wifi = Wireless('eth1')
+            >>> wifi.getFrequency()
+            '2.417GHz' 
+        """
+        i, r = self.iwstruct.iw_get_ext(self.ifname, 
+                                        SIOCGIWFREQ)
+        if i > 0:
+            return (i, r)
+        iwfreq = Iwfreq(r)
+        return iwfreq.getFrequency()
+    
+        
+    def getMode(self):
+        """returns currently set operation mode 
+            
+            >>> from iwlibs import Wireless
+            >>> wifi = Wireless('eth1')
+            >>> wifi.getMode()
+            'Managed' 
+        """
+        i, result = self.iwstruct.iw_get_ext(self.ifname, 
+                                             SIOCGIWMODE)
+        if i > 0:
+            return result
+        mode = self.iwstruct.unpack('i', result[:4])[0]
+        return modes[mode]
+
+    def setMode(self, mode):
+        """sets the operation mode """
+        try:
+            this_modes = [x.lower() for x in modes]
+            mode = mode.lower()
+            wifimode = this_modes.index(mode)
+        except ValueError:
+            return "Invalid operation mode!"
+        
+        s = self.iwstruct.pack('I', wifimode)
+        i, result = self.iwstruct.iw_get_ext(self.ifname, 
+                                             SIOCSIWMODE, 
+                                             data=s)
+        if i > 0:
+            return result
+    
+    def getWirelessName(self):
+        """ returns wireless name 
+            
+            >>> from iwlibs import Wireless
+            >>> wifi = Wireless('eth1')
+            >>> wifi.getWirelessName()
+            'IEEE 802.11-DS'
+        """
+        i, result = self.iwstruct.iw_get_ext(self.ifname, 
+                                             SIOCGIWNAME)
+        if i > 0:
+            return result
+        return result.split('\0')[0]
+    
+    def getPowermanagement(self):
+        """returns power management settings 
+            
+            >>> from iwlibs import Wireless
+            >>> wifi = Wireless('eth1')
+            >>> wifi.getPowermanagement()
+            'off'
+        """
+        iwparam = Iwparam(self.ifname, SIOCGIWPOWER)
+        if iwparam.errorflag:
+            return (iwparam.errorflag, iwparam.error)
+        return iwparam.getValue()
+
+    
+    def getRetrylimit(self):
+        """returns limit retry/lifetime
+
+            man iwconfig:
+            Most cards have MAC retransmissions, and some  allow  to set
+            the behaviour of the retry mechanism.
+                     
+            >>> from iwlibs import Wireless
+            >>> wifi = Wireless('eth1')
+            >>> wifi.getRetrylimit()
+            16
+        """
+        iwparam = Iwparam(self.ifname, SIOCGIWRETRY)
+        if iwparam.errorflag:
+            return (iwparam.errorflag, iwparam.error)
+        return iwparam.getValue()
+    
+    def getRTS(self):
+        """returns rts threshold 
+            
+            returns int, 'auto', 'fixed', 'off'
+        
+            man iwconfig:
+            RTS/CTS adds a handshake before each packet transmission to
+            make sure that the channel is clear. This adds overhead, but
+            increases performance in case of hidden  nodes or  a large
+            number of active nodes. This parameter sets the size of the
+            smallest packet for which the node sends RTS;  a value equal
+            to the maximum packet size disable the mechanism. 
+            
+            >>> from iwlibs import Wireless
+            >>> wifi = Wireless('eth1')
+            >>> wifi.getRTS()
+            'off'
+        """
+        iwparam = Iwparam(self.ifname, SIOCGIWRTS)
+        if iwparam.errorflag:
+            return (iwparam.errorflag, iwparam.error)
+        return iwparam.getValue()
+    
+    def getSensitivity(self):
+        """returns sensitivity information 
+        
+            man iwconfig:
+            This is the lowest signal level for which the hardware
+            attempt  packet  reception, signals  weaker  than  this are
+            ignored. This is used to avoid receiving background noise,
+            so you should  set  it according  to  the  average noise
+            level. Positive values are assumed to be the raw value used
+            by the hardware  or a percentage, negative values are
+            assumed to be dBm.
+        
+            >>> from iwlibs import Wireless
+            >>> wifi = Wireless('eth1')
+            >>> wifi.getSensitivity()
+            'off'
+            
+        """
+        iwparam = Iwparam(self.ifname, SIOCGIWSENS)
+        if iwparam.errorflag:
+            return (iwparam.errorflag, iwparam.error)
+        return iwparam.getValue()
+        
+    def getTXPower(self):
+        """returns transmit power in dBm 
+        
+            >>> from iwlibs import Wireless
+            >>> wifi = Wireless('eth1')
+            >>> wifi.getTXPower()
+            '17 dBm'
+        """
+        i, r = self.iwstruct.iw_get_ext(self.ifname, 
+                                        SIOCGIWTXPOW)
+        if i > 0:
+            return (i, r)
+        iwfreq = Iwfreq(r)
+        return iwfreq.getTransmitPower()
+         
+    def getStatistics(self):
+        """returns statistics information which can also be found in
+           /proc/net/wireless 
+        """
+        iwstats = Iwstats(self.ifname)
+        if iwstats.errorflag > 0:
+            return (iwstats.errorflag, iwstats.error)
+        return [iwstats.status, iwstats.qual, iwstats.discard,
+            iwstats.missed_beacon]
+
+    def scan(self):
+        """returns Iwscanresult objects, after a successful scan"""
+        iwscan = Iwscan(self.ifname)
+        return iwscan.scan()
+
+
+class Iwstruct(object):
+    """basic class to handle iwstruct data """
+    
+    def __init__(self):
+        self.idx = 0
+        self.sockfd = socket(AF_INET, SOCK_DGRAM)
+
+    def parse_data(self, fmt, data):
+        """ unpacks raw C data """
+        size = struct_calcsize(fmt)
+        idx = self.idx
+
+        str = data[idx:idx + size]
+        self.idx = idx+size
+        value = struct_unpack(fmt, str)
+
+        # take care of a tuple like (int, )
+        if len(value) == 1:
+            return value[0]
+        else:
+            return value
+    
+    def pack(self, fmt, *args):
+        """ calls struct_pack and returns the result """
+        return struct_pack(fmt, *args)
+
+    def pack_wrq(self, buffsize):
+        """ packs wireless request data for sending it to the kernel """
+        # Prepare a buffer
+        # We need the address of our buffer and the size for it. The
+        # ioctl itself looks for the pointer to the address in our
+        # memory and the size of it.
+        # Dont change the order how the structure is packed!!!
+        buff = array('c', '\0'*buffsize)
+        caddr_t, length = buff.buffer_info()
+        s = struct_pack('Pi', caddr_t, length)
+        return buff, s
+    
+    def pack_test(self, string, buffsize):
+        """ packs wireless request data for sending it to the kernel """
+        buffsize = buffsize - len(string)
+        buff = array('c', string+'\0'*buffsize)
+        caddr_t, length = buff.buffer_info()
+        s = struct_pack('Pii', caddr_t, length, 1)
+        return buff, s
+
+    def unpack(self, fmt, packed_data):
+        """ unpacks data with given format """
+        return struct_unpack(fmt, packed_data)
+
+    def _fcntl(self, request, args):
+        return ioctl(self.sockfd.fileno(), request, args)
+    
+    def iw_get_ext(self, ifname, request, data=None):
+        """ read information from ifname """
+        # put some additional data behind the interface name
+        if data is not None:
+            buff = IFNAMSIZE-len(ifname)
+            ifreq = ifname + '\0'*buff
+            ifreq = ifreq + data
+        else:
+            ifreq = (ifname + '\0'*32)
+            
+        try:
+            result = self._fcntl(request, ifreq)
+        except IOError, (i, e):
+            return i, e
+        
+        return (0, result[16:])
+
+    def getMAC(self, packed_data):
+        """ extracts mac addr from packed data and returns it as str """
+        mac_addr = struct_unpack('xxBBBBBB', packed_data[:8])
+        return "%02X:%02X:%02X:%02X:%02X:%02X" % mac_addr
+
+class Iwparam(object):
+    """class to hold iwparam data """
+    
+    def __init__(self, ifname, ioctl):
+        # (i) value, (b) fixed, (b) disabled, (b) flags
+        self.fmt = "ibbH"
+        self.value = 0
+        self.fixed = 0
+        self.disabled = 0
+        self.flags = 0
+        self.errorflag = 0
+        self.error = ""
+        self.ioctl = ioctl 
+        self.ifname = ifname
+        self.update()
+    
+    def getValue(self):
+        """returns the value if not disabled """
+
+        if self.disabled:
+            return 'off'
+        if self.flags & IW_RETRY_TYPE == 0:
+            return self.getRLAttributes()
+        else:
+            return self.getPMAttributes()
+
+    def getRLAttributes(self):
+        """returns a string with attributes determined by self.flags
+        """
+        return self.value
+
+    def getPMAttributes(self):
+        """returns a string with attributes determined by self.flags
+           and IW_POWER*
+        """
+        result = ""
+        
+        # Modifiers
+        if self.flags & IW_POWER_MIN == 0:
+            result = " min"
+        if self.flags & IW_POWER_MAX == 0:
+            result = " max"
+            
+        # Type
+        if self.flags & IW_POWER_TIMEOUT == 0:
+            result = " period:" 
+        else:
+            result = " timeout:"
+        # Value with or without units
+        # IW_POWER_RELATIVE - value is *not* in s/ms/us
+        if self.flags & IW_POWER_RELATIVE:
+            result += "%f" %(float(self.value)/MEGA)
+        else:
+            if self.value >= MEGA:
+                result += "%fs" %(float(self.value)/MEGA)
+            elif self.value >= KILO:
+                result += "%fms" %(float(self.value)/KILO)
+            else:
+                result += "%dus" % self.value
+
+        return result
+        
+    def update(self):
+        iwstruct = Iwstruct()
+        i, r = iwstruct.iw_get_ext(self.ifname, 
+                                   self.ioctl)
+        if i > 0:
+            self.errorflag = i
+            self.error = r
+        self._parse(r)
+    
+    def _parse(self, data):
+        """ unpacks iwparam data """
+        iwstruct = Iwstruct()
+        self.value, self.fixed, self.disabled, self.flags =\
+            iwstruct.parse_data(self.fmt, data)
+        
+class Iwfreq(object):
+    """ class to hold iwfreq data
+        delegates to Iwstruct class
+    """
+    
+    def __init__(self, data=None):
+        self.fmt = "ihbb"
+        if data is not None:
+            self.frequency = self.parse(data)
+        else:
+            self.frequency = 0
+        self.iwstruct = Iwstruct()
+        
+    def __getattr__(self, attr):
+        return getattr(self.iwstruct, attr)
+
+    def parse(self, data):
+        """ unpacks iwparam"""
+        
+        size = struct_calcsize(self.fmt)
+        m, e, i, pad = struct_unpack(self.fmt, data[:size])
+        # XXX well, its not *the* frequency - we need a better name
+        if e == 0:
+            return m
+        else:
+            return float(m)*10**e
+    
+    def getFrequency(self):
+        """returns Frequency (str) 
+            
+           data - binary data returned by systemcall (iw_get_ext())
+        """
+        freq = self.frequency
+        
+        if freq >= GIGA:
+            return "%0.3fGHz" %(freq/GIGA)
+
+        if freq >= MEGA:
+            return "%0.3fMHZ" %(freq/MEGA)
+
+        if freq >= KILO:
+            return "%0.3fKHz" %(freq/KILO)
+    
+    def getBitrate(self):
+        """ returns Bitrate in Mbit 
+        
+           data - binary data returned by systemcall (iw_get_ext())
+        """
+        bitrate = self.frequency
+
+        if bitrate >= GIGA:
+            return "%i Gb/s" %(bitrate/GIGA)
+
+        if bitrate >= MEGA:
+            return "%i Mb/s" %(bitrate/MEGA)
+        
+        if bitrate >= KILO:
+            return "%i Kb/s" %(bitrate/KILO)
+
+    def getTransmitPower(self):
+        """ returns transmit power in dbm """
+        # XXX something flaky is going on with m and e
+        # eg. m = 50 and e should than be 0, because the number is stored in
+        # m and don't needs to be recalculated
+        return "%i dBm" %self.mw2dbm(self.frequency/10)
+    
+    def getChannel(self, freq):
+        """returns channel information given by frequency
+           
+           returns None if frequency can't be converted
+           freq = frequency to convert (int)
+           iwrange = Iwrange object
+        """
+        
+        try:
+            freq = float(freq)
+        except:
+            return None
+        
+        lut = {}
+        #13 Channels beginning at 2.412GHz and inreasing by 0,005 GHz steps
+        for i in range(0,12):
+            cur = float( 2.412 + ( i * 0.005 ) )
+            lut[str(cur)] = i+1
+        # Channel 14 need special actions ;)
+        lut['2.484'] = 14
+        
+        
+        if str(freq) in lut.keys():
+                return lut[str(freq)]
+        
+        return None
+    
+          
+    def mw2dbm(self, mwatt):
+        """ converts mw to dbm(float) """
+        return ceil(10.0 * log10(mwatt))
+        
+    def _setFrequency(self, list):
+        """sets self.frequency by given list 
+           
+           currently only used by Iwrange
+        """
+        assert len(list) == 4
+        m, e, i, pad = list
+        if e == 0:
+            self.frequency = m
+        else:
+            self.frequency = m #float(m)*10**e
+
+class Iwstats(object):
+    """ class to hold iwstat data """
+
+    def __init__(self, ifname):
+        # (2B) status, 4B iw_quality, 6i iw_discarded
+        self.fmt = "2B4B6i"
+        self.status = 0
+        self.qual = Iwquality()
+        self.discard = {}
+        self.missed_beacon = 0
+        self.ifname = ifname
+        self.errorflag = 0
+        self.error = ""
+        self.update()
+
+    def update(self):
+        iwstruct = Iwstruct()
+        buff, s = iwstruct.pack_wrq(32)
+        i, result = iwstruct.iw_get_ext(self.ifname, 
+                                        SIOCGIWSTATS, 
+                                        data=s)
+        if i > 0:
+            self.error = result
+            self.errorflag = i
+        self._parse(buff.tostring())
+    
+    def _parse(self, data):
+        """ unpacks iwstruct data """
+        struct = Iwstruct()
+        iwqual = Iwquality()
+        iwstats_data = struct.parse_data(self.fmt, data)
+        
+        self.status = iwstats_data[0:2]
+        self.qual.quality, self.qual.sl, self.qual.nl,\
+            self.qual.flags = iwstats_data[2:6]
+        nwid, code, frag, retries, flags = iwstats_data[6:11]
+        self.missed_beacon = iwstats_data[11:12][0]
+        self.discard = makedict(nwid=nwid, code=code,
+            fragment=frag, retries=retries, misc=flags)
+
+class Iwquality(object):
+    """ class to hold iwquality data """
+
+    def __init__(self):
+        self.quality = 0
+        self.sl = 0
+        self.nl = 0
+        self.updated = 0
+        self.fmt = "4B"
+
+    def parse(self, data):
+        """ unpacks iwquality data """
+        struct = Iwstruct()
+        qual, sl, nl, flags = struct.parse_data(self.fmt, data)
+
+        # compute signal and noise level
+        self.signal_level = sl
+        self.noise_level = nl
+
+        # asign the other values
+        self.quality = qual
+        self.updated = flags
+
+    def setValues(self, list):
+        """ assigns values given by a list to our attributes """
+        attributes = ["quality", "signallevel", "noise_level",
+            "updated"]
+        assert len(list) == 4
+        
+        for i in range(len(list)):
+            setattr(self, attributes[i], list[i])
+    
+    def getSignallevel(self):
+        """ returns signal level """
+        return self.sl-0x100
+
+    def setSignallevel(self, sl):
+        """ sets signal level """
+        self.sl = sl
+    signallevel = property(getSignallevel, setSignallevel)
+    
+    def getNoiselevel(self):
+        """ returns noise level """
+        return self.nl - 0x100
+
+    def setNoiselevel(self):
+        raise NotImplementedError
+        self.nl = nl
+    noiselevel = property(getNoiselevel, setNoiselevel)
+
+class Iwpoint(object):
+    """ class to hold iwpoint data """
+
+    def __init__(self, ifname):
+        self.key = [0,0,0,0]
+        self.fields = 0
+        self.flags = 0
+        # (4B) pointer to data, H length, H flags
+        self.fmt = "4BHH"
+        self.errorflag = 0
+        self.error = ""
+        self.ifname = ifname
+        self.update()
+
+    def __getattr__(self, attr):
+        return getattr(self.iwstruct, attr)
+    
+    def update(self):
+        iwstruct = Iwstruct()
+        buff, s = iwstruct.pack_wrq(32)
+        i, result = iwstruct.iw_get_ext(self.ifname, 
+                                        SIOCGIWENCODE, 
+                                        data=s)
+        if i > 0:
+            self.errorflag = i
+            self.error = result
+        self._parse(result)
+        
+    def getEncryptionKey(self):
+        """ returns encryption key as '**' or 'off' as str """
+        if self.flags & IW_ENCODE_DISABLED != 0:
+            return 'off'
+        elif self.flags & IW_ENCODE_NOKEY != 0:
+            # a key is set, so print it
+            return '**' * self.fields
+    
+    def _parse(self, data):
+        """ unpacks iwpoint data
+        """
+        iwstruct = Iwstruct()
+        ptr, ptr, ptr, ptr, self.fields, self.flags =\
+            iwstruct.parse_data(self.fmt, data)
+        self.key = [ptr, ptr, ptr, ptr]
+
+class Iwrange(object):
+    """holds iwrange struct """
+    IW_MAX_FREQUENCIES = 32
+
+    def __init__(self, ifname):
+        self.fmt = "iiihb6ii4B4Bi32i2i2i2i2i3h8h2b2bhi8i2b3h2i2ihB17x"\
+            + self.IW_MAX_FREQUENCIES*"ihbb"
+        
+        self.ifname = ifname
+        self.errorflag = 0
+        self.error = ""
+        
+        # informative stuff
+        self.throughput = 0
+        
+        # nwid (or domain id)
+        self.min_nwid = self.max_nwid = 0
+        
+        # frequency for backward compatibility
+        self.old_num_channels = self.old_num_frequency = self.old_freq = 0
+        
+        # signal level threshold
+        self.sensitivity = 0
+        
+        # link quality
+        self.max_qual = Iwquality()
+        self.avg_qual = Iwquality()
+
+        # rates
+        self.num_bitrates = 0
+        self.bitrates = []
+
+        # rts threshold
+        self.min_rts = self.max_rts = 0
+
+        # fragmention threshold
+        self.min_frag = self.max_frag = 0
+
+        # power managment
+        self.min_pmp = self.max_pmp = 0
+        self.min_pmt = self.max_pmt = 0
+        self.pmp_flags = self.pmt_flags = self.pm_capa = 0
+
+        # encoder stuff
+        self.encoding_size = 0
+        self.num_encoding_sizes = self.max_encoding_tokens = 0
+        self.encoding_login_index = 0
+
+        # transmit power
+        self.txpower_capa = self.num_txpower = self.txpower = 0
+
+        # wireless extension version info
+        self.we_vers_compiled = self.we_vers_src = 0
+
+        # retry limits and lifetime
+        self.retry_capa = self.retry_flags = self.r_time_flags = 0
+        self.min_retry = self.max_retry = 0
+        self.min_r_time = self.max_r_time = 0
+
+        # frequency
+        self.num_channels = self.num_frequency = 0
+        self.frequencies = []
+        self.update()
+    
+    def update(self):
+        """updates Iwrange object by a system call to the kernel 
+           and updates internal attributes
+        """
+        iwstruct = Iwstruct()
+        buff, s = iwstruct.pack_wrq(640)
+        i, result = iwstruct.iw_get_ext(self.ifname, 
+                                        SIOCGIWRANGE, 
+                                        data=s)
+        if i > 0:
+            self.errorflag = i
+            self.error = result
+        data = buff.tostring()
+        self._parse(data)
+        
+    def _parse(self, data):
+        struct = Iwstruct()
+        result = struct.parse_data(self.fmt, data)
+        
+        # XXX there is maybe a much more elegant way to do this
+        self.throughput, self.min_nwid, self.max_nwid = result[0:3]
+        self.old_num_channels, self.old_num_frequency = result[3:5]
+        self.old_freq = result[5:11]
+        self.sensitivity = result[11]
+        self.max_qual.setValues(result[12:16])
+        self.avg_qual.setValues(result[16:20])
+        self.num_bitrates = result[20] # <- XXX
+        raw_bitrates = result[21:53]
+        for rate in raw_bitrates:
+            iwfreq = Iwfreq()
+            iwfreq.frequency = rate
+            br = iwfreq.getBitrate()
+            if br is not None:
+                self.bitrates.append(br)
+            
+        self.min_rts, self.max_rts = result[53:55]
+        self.min_frag, self.max_frag = result[55:57]
+        self.min_pmp, self.max_pmp = result[57:59]
+        self.min_pmt, self.max_pmt = result[59:61]
+        self.pmp_flags, self.pmt_flags, self.pm_capa = result[61:64]
+        self.encoding_size = result[64:72]
+        self.num_encoding_sizes, self.max_encoding_tokens = result[72:74]
+        self.encoding_login_index = result[74:76]
+        self.txpower_capa, self.num_txpower = result[76:78]
+        self.txpower = result[78:86]
+        self.we_vers_compiled, self.we_vers_src = result[86:88]
+        self.retry_capa, self.retry_flags, self.r_time_flags = result[88:91]
+        self.min_retry, self.max_retry = result[91:93]
+        self.min_r_time, self.max_r_time = result[93:95]
+        self.num_channels = result[95]
+        self.num_frequency = result[96]
+        freq = result[97:]
+        
+        i = self.num_frequency
+        for x in range(0, len(freq), 4):
+            iwfreq = Iwfreq()
+            iwfreq._setFrequency(freq[x:x+4])
+            fq = iwfreq.getFrequency()
+            if fq is not None:
+                self.frequencies.append(fq)
+            i -= 1
+            if i <= 0:
+                break
+        
+class Iwscan(object):
+    """class to handle AP scanning"""
+    
+    def __init__(self, ifname):
+        self.ifname = ifname
+        self.range = Iwrange(ifname)
+        self.errorflag = 0
+        self.error = ""
+        self.stream = None
+        self.aplist = None
+                
+    def scan(self, fullscan=True):
+        """Completes a scan for available access points,
+           and returns them in Iwscanresult format
+           
+           fullscan: If False, data is read from a cache of the last scan
+                     If True, a scan is conducted, and then the data is read
+        """
+        # By default everything is fine, do not wait
+        result = 1
+        if fullscan:
+            self.setScan()
+            if self.errorflag > EPERM:
+                raise RuntimeError, 'setScan failure ' + str(self.errorflag) + " " + str(self.error)
+                return None
+            elif self.errorflag < EPERM:
+                # Permission was NOT denied, therefore we must WAIT to get results
+                result = 250
+        
+        while (result > 0):
+            sleep(result/1000)
+            result = self.getScan()
+        
+        if result < 0 or self.errorflag != 0:
+            raise RuntimeError, 'getScan failure ' + str(self.errorflag) + " " + str(self.error)
+        
+        return self.aplist
+        
+        
+    def setScan(self):
+        """Triggers the scan, if we have permission
+        """
+        iwstruct = Iwstruct()
+        s = iwstruct.pack('Pii', 0, 0, 0)
+        i, result = iwstruct.iw_get_ext(self.ifname, 
+                                        SIOCSIWSCAN,s)
+        if i > 0:
+            self.errorflag = i
+            self.error = result
+        return result
+        
+    def getScan(self):
+        """Retreives results, stored from the most recent scan
+           Returns 0 if successful, a delay if the data isn't ready yet
+           or -1 if something really nasty happened
+        """
+        iwstruct = Iwstruct()
+        i = E2BIG
+        bufflen = IW_SCAN_MAX_DATA
+        
+        # Keep resizing the buffer until it's large enough to hold the scan
+        while (i == E2BIG):
+            buff, s = iwstruct.pack_wrq(bufflen)
+            i, result = iwstruct.iw_get_ext(self.ifname, 
+                                            SIOCGIWSCAN,
+                                            data=s)
+            if i == E2BIG:
+                pbuff, newlen = iwstruct.unpack('Pi', s)
+                if bufflen < newlen:
+                    bufflen = newlen
+                else:
+                    bufflen = bufflen * 2
+        
+        if i == EAGAIN:
+            return 100
+        if i > 0:
+            self.errorflag = i
+            self.error = result
+            return -1
+        
+        pbuff, reslen = iwstruct.unpack('Pi', s)
+        if reslen > 0:
+            # Initialize the stream, and turn it into an enumerator
+            self.aplist = self._parse(buff.tostring())
+            return 0
+        
+    def _parse(self, data):
+        """Parse the event stream, and return a list of Iwscanresult objects
+        """
+        iwstruct = Iwstruct()
+        scanresult = None
+        aplist = []
+
+        # Run through the stream, until broken
+        while 1:
+            # If we're the stream doesn't have enough space left for a header, break
+            if len(data) < IW_EV_LCP_LEN:
+                break;
+        
+            # Unpack the header
+            length, cmd = iwstruct.unpack('HH', data[:4])
+            # If the header says the following data is shorter than the header, then break
+            if length < IW_EV_LCP_LEN:
+                break;
+
+            # Put the events into their respective result data
+            if cmd == SIOCGIWAP:
+                if scanresult is not None:
+                    aplist.append(scanresult)
+                scanresult = Iwscanresult(data[IW_EV_LCP_LEN:length], self.range)
+            elif scanresult is None:
+                raise RuntimeError, 'Attempting to add an event without AP data'
+            else:
+                scanresult.addEvent(cmd, data[IW_EV_LCP_LEN:length])
+            
+            # We're finished with the preveious event
+            data = data[length:]
+        
+        # Don't forgset the final result
+        if scanresult.bssid != "00:00:00:00:00:00":
+            aplist.append(scanresult)
+        else:
+            raise RuntimeError, 'Attempting to add an AP without a bssid'
+        return aplist
+
+class Iwscanresult(object):
+    """An object to contain all the events associated with a single scanned AP
+    """
+    
+    def __init__(self, data, range):
+        """Initialize the scan result with the access point data"""
+        self.iwstruct = Iwstruct()
+        self.range = range
+        self.bssid = "%02X:%02X:%02X:%02X:%02X:%02X" % struct_unpack('BBBBBB', data[2:8])
+        self.essid = None
+        self.mode = None
+        self.rate = []
+        self.quality = Iwquality() 
+        self.frequency = None
+        self.encode = None
+        self.custom = []
+        self.protocol = None
+
+    def addEvent(self, cmd, data):
+        """Attempts to add the data from an event to a scanresult
+           Only certain data is accept, in which case the result is True
+           If the event data is invalid, None is returned
+           If the data is valid but unused, False is returned
+        """
+        if cmd <= SIOCIWLAST:
+            if cmd < SIOCIWFIRST:
+                return None
+        elif cmd >= IWEVFIRST:
+            if cmd > IWEVLAST:
+                return None
+        else:
+            return None
+            
+        if cmd == SIOCGIWESSID:
+            self.essid = data[4:]
+        elif cmd == SIOCGIWMODE:
+            self.mode = modes[self.iwstruct.unpack('i', data[:4])[0]]
+        elif cmd == SIOCGIWRATE:
+            # TODO, deal with multiple rates, or at least the highest rate
+            freqsize = struct_calcsize("ihbb")
+            while len(data) >= freqsize:
+                iwfreq = Iwfreq(data)
+                self.rate.append(iwfreq.getBitrate())
+                data = data[freqsize:]
+        elif cmd == IWEVQUAL:
+            self.quality.parse(data)
+        elif cmd == SIOCGIWFREQ:
+            self.frequency = Iwfreq(data)
+        elif cmd == SIOCGIWENCODE:
+            self.encode = data
+        elif cmd == IWEVCUSTOM:
+            self.custom.append(data[1:])
+        elif cmd == SIOCGIWNAME:
+            self.protocol = data[:len(data)-2]
+        else:
+            #print "Cmd:", cmd
+            return False
+        return True
Index: /ipk/source.sh4/swapnetwork_wlan_300/var/usr/lib/enigma2/python/Plugins/SystemPlugins/WirelessLan/plugin.py
===================================================================
--- /ipk/source.sh4/swapnetwork_wlan_300/var/usr/lib/enigma2/python/Plugins/SystemPlugins/WirelessLan/plugin.py	(revision 8777)
+++ /ipk/source.sh4/swapnetwork_wlan_300/var/usr/lib/enigma2/python/Plugins/SystemPlugins/WirelessLan/plugin.py	(revision 8777)
@@ -0,0 +1,401 @@
+from enigma import eTimer
+from Screens.Screen import Screen
+from Components.ActionMap import ActionMap, NumberActionMap
+from Components.Pixmap import Pixmap,MultiPixmap
+from Components.Label import Label
+from Components.Sources.StaticText import StaticText
+from Components.Sources.List import List
+from Components.MenuList import MenuList
+from Components.config import config, getConfigListEntry, ConfigYesNo, NoSave, ConfigSubsection, ConfigText, ConfigSelection, ConfigPassword
+from Components.ConfigList import ConfigListScreen
+from Components.Network import Network, iNetwork
+from Components.Console import Console
+from Plugins.Plugin import PluginDescriptor
+from os import system, path as os_path, listdir
+from Tools.Directories import resolveFilename, SCOPE_PLUGINS, SCOPE_SKIN_IMAGE
+from Tools.LoadPixmap import LoadPixmap
+from Wlan import Wlan, wpaSupplicant, iStatus
+
+plugin_path = "/usr/lib/enigma2/python/Plugins/SystemPlugins/WirelessLan"
+
+list = []
+list.append("WEP")
+list.append("WPA")
+list.append("WPA2")
+list.append("WPA/WPA2")
+
+weplist = []
+weplist.append("ASCII")
+weplist.append("HEX")
+
+config.plugins.wlan = ConfigSubsection()
+config.plugins.wlan.essid = NoSave(ConfigText(default = "home", fixed_size = False))
+config.plugins.wlan.hiddenessid = NoSave(ConfigText(default = "home", fixed_size = False))
+
+config.plugins.wlan.encryption = ConfigSubsection()
+config.plugins.wlan.encryption.enabled = NoSave(ConfigYesNo(default = False))
+config.plugins.wlan.encryption.type = NoSave(ConfigSelection(list, default = "WPA/WPA2" ))
+config.plugins.wlan.encryption.wepkeytype = NoSave(ConfigSelection(weplist, default = "ASCII"))
+config.plugins.wlan.encryption.psk = NoSave(ConfigPassword(default = "mysecurewlan", fixed_size = False))
+
+
+class WlanStatus(Screen):
+	skin = """
+		<screen name="WlanStatus" position="center,center" size="560,400" title="Wireless Network State" >
+			<ePixmap pixmap="skin_default/buttons/red.png" position="0,0" size="140,40" alphatest="on" />
+			<widget source="key_red" render="Label" position="0,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#9f1313" transparent="1" />
+	
+			<widget source="LabelBSSID" render="Label" position="10,60" size="250,25" valign="left" font="Regular;20" transparent="1" foregroundColor="#FFFFFF" />
+			<widget source="LabelESSID" render="Label" position="10,100" size="250,25" valign="center" font="Regular;20" transparent="1" foregroundColor="#FFFFFF" />
+			<widget source="LabelQuality" render="Label" position="10,140" size="250,25" valign="center" font="Regular;20" transparent="1" foregroundColor="#FFFFFF" />
+			<widget source="LabelSignal" render="Label" position="10,180" size="250,25" valign="center" font="Regular;20" transparent="1" foregroundColor="#FFFFFF" />
+			<widget source="LabelBitrate" render="Label" position="10,220" size="250,25" valign="center" font="Regular;20" transparent="1" foregroundColor="#FFFFFF" />
+			<widget source="LabelEnc" render="Label" position="10,260" size="250,25" valign="center" font="Regular;20" transparent="1" foregroundColor="#FFFFFF" />
+			
+			<widget source="BSSID" render="Label" position="280,60" size="270,25" valign="center" font="Regular;20" transparent="1" foregroundColor="#FFFFFF" />
+			<widget source="ESSID" render="Label" position="280,100" size="270,25" valign="center" font="Regular;20" transparent="1" foregroundColor="#FFFFFF" />
+			<widget source="quality" render="Label" position="280,140" size="270,25" valign="center" font="Regular;20" transparent="1" foregroundColor="#FFFFFF" />
+			<widget source="signal" render="Label" position="280,180" size="270,25" valign="center" font="Regular;20" transparent="1" foregroundColor="#FFFFFF" />
+			<widget source="bitrate" render="Label" position="280,220" size="270,25" valign="center" font="Regular;20" transparent="1" foregroundColor="#FFFFFF" />
+			<widget source="enc" render="Label" position="280,260" size="270,25" valign="center" font="Regular;20" transparent="1" foregroundColor="#FFFFFF" />
+	
+			<ePixmap pixmap="skin_default/div-h.png" position="0,350" zPosition="1" size="560,2" />		
+			<widget source="IFtext" render="Label" position="10,355" size="120,21" zPosition="10" font="Regular;20" halign="left" backgroundColor="#25062748" transparent="1" />
+			<widget source="IF" render="Label" position="120,355" size="400,21" zPosition="10" font="Regular;20" halign="left" backgroundColor="#25062748" transparent="1" />
+			<widget source="Statustext" render="Label" position="10,375" size="115,21" zPosition="10" font="Regular;20" halign="left" backgroundColor="#25062748" transparent="1"/>
+			<widget name="statuspic" pixmaps="skin_default/buttons/button_green.png,skin_default/buttons/button_green_off.png" position="130,380" zPosition="10" size="15,16" transparent="1" alphatest="on"/>
+		</screen>"""
+	
+	def __init__(self, session, iface):
+		Screen.__init__(self, session)
+		self.session = session
+		self.iface = iface
+				    
+		self["LabelBSSID"] = StaticText(_('Accesspoint:'))
+		self["LabelESSID"] = StaticText(_('SSID:'))
+		self["LabelQuality"] = StaticText(_('Link Quality:'))
+		self["LabelSignal"] = StaticText(_('Signal Strength:'))
+		self["LabelBitrate"] = StaticText(_('Bitrate:'))
+		self["LabelEnc"] = StaticText(_('Encryption:'))
+			
+		self["BSSID"] = StaticText()
+		self["ESSID"] = StaticText()
+		self["quality"] = StaticText()
+		self["signal"] = StaticText()
+		self["bitrate"] = StaticText()
+		self["enc"] = StaticText()
+
+		self["IFtext"] = StaticText()
+		self["IF"] = StaticText()
+		self["Statustext"] = StaticText()
+		self["statuspic"] = MultiPixmap()
+		self["statuspic"].hide()
+		self["key_red"] = StaticText(_("Close"))
+
+		self.resetList()
+		self.updateStatusbar()
+		
+		self["actions"] = NumberActionMap(["WizardActions", "InputActions", "EPGSelectActions", "ShortcutActions"],
+		{
+			"ok": self.exit,
+			"back": self.exit,
+			"red": self.exit,
+		}, -1)
+		self.timer = eTimer()
+		self.timer.timeout.get().append(self.resetList) 
+		self.onShown.append(lambda: self.timer.start(5000))
+		self.onLayoutFinish.append(self.layoutFinished)
+		self.onClose.append(self.cleanup)
+
+	def cleanup(self):
+		iStatus.stopWlanConsole()
+		
+	def layoutFinished(self):
+		self.setTitle(_("Wireless Network State"))
+		
+	def resetList(self):
+		iStatus.getDataForInterface(self.iface,self.getInfoCB)
+		
+	def getInfoCB(self,data,status):
+		if data is not None:
+			if data is True:
+				if status is not None:
+					self["BSSID"].setText(status[self.iface]["acesspoint"])
+					self["ESSID"].setText(status[self.iface]["essid"])
+					self["quality"].setText(status[self.iface]["quality"]+"%")
+					self["signal"].setText(status[self.iface]["signal"])
+					self["bitrate"].setText(status[self.iface]["bitrate"])
+					self["enc"].setText(status[self.iface]["encryption"])
+					self.updateStatusLink(status)
+
+	def exit(self):
+		self.timer.stop()
+		self.close(True)	
+
+	def updateStatusbar(self):
+		self["BSSID"].setText(_("Please wait..."))
+		self["ESSID"].setText(_("Please wait..."))
+		self["quality"].setText(_("Please wait..."))
+		self["signal"].setText(_("Please wait..."))
+		self["bitrate"].setText(_("Please wait..."))
+		self["enc"].setText(_("Please wait..."))
+		self["IFtext"].setText(_("Network:"))
+		self["IF"].setText(iNetwork.getFriendlyAdapterName(self.iface))
+		self["Statustext"].setText(_("Link:"))
+
+	def updateStatusLink(self,status):
+		if status is not None:
+			if status[self.iface]["acesspoint"] == "No Connection" or status[self.iface]["acesspoint"] == "Not-Associated" or status[self.iface]["acesspoint"] == False:
+				self["statuspic"].setPixmapNum(1)
+			else:
+				self["statuspic"].setPixmapNum(0)
+			self["statuspic"].show()		
+
+
+class WlanScan(Screen):
+	skin = """
+		<screen name="WlanScan" position="center,center" size="560,400" title="Choose a Wireless Network" >
+			<ePixmap pixmap="skin_default/buttons/red.png" position="0,0" size="140,40" alphatest="on" />
+			<ePixmap pixmap="skin_default/buttons/green.png" position="140,0" size="140,40" alphatest="on" />
+			<ePixmap pixmap="skin_default/buttons/yellow.png" position="280,0" size="140,40" alphatest="on" />
+			<widget source="key_red" render="Label" position="0,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#9f1313" transparent="1" />
+			<widget source="key_green" render="Label" position="140,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#1f771f" transparent="1" />
+			<widget source="key_yellow" render="Label" position="280,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#a08500" transparent="1" />
+			<widget source="list" render="Listbox" position="5,40" size="550,300" scrollbarMode="showOnDemand">
+				<convert type="TemplatedMultiContent">
+					{"template": [
+							MultiContentEntryText(pos = (0, 0), size = (550, 30), font=0, flags = RT_HALIGN_LEFT, text = 0), # index 0 is the essid
+							MultiContentEntryText(pos = (0, 30), size = (175, 20), font=1, flags = RT_HALIGN_LEFT, text = 5), # index 5 is the interface
+							MultiContentEntryText(pos = (175, 30), size = (175, 20), font=1, flags = RT_HALIGN_LEFT, text = 4), # index 0 is the encryption
+							MultiContentEntryText(pos = (350, 0), size = (200, 20), font=1, flags = RT_HALIGN_LEFT, text = 2), # index 0 is the signal
+							MultiContentEntryText(pos = (350, 30), size = (200, 20), font=1, flags = RT_HALIGN_LEFT, text = 3), # index 0 is the maxrate
+							MultiContentEntryPixmapAlphaTest(pos = (0, 52), size = (550, 2), png = 6), # index 6 is the div pixmap
+						],
+					"fonts": [gFont("Regular", 28),gFont("Regular", 18)],
+					"itemHeight": 54
+					}
+				</convert>
+			</widget>
+			<ePixmap pixmap="skin_default/div-h.png" position="0,340" zPosition="1" size="560,2" />		
+			<widget source="info" render="Label" position="0,350" size="560,50" font="Regular;24" halign="center" valign="center" backgroundColor="#25062748" transparent="1" />
+		</screen>"""
+
+	def __init__(self, session, iface):
+		Screen.__init__(self, session)
+		self.session = session
+		self.iface = iface
+		self.skin_path = plugin_path
+		self.oldInterfaceState = iNetwork.getAdapterAttribute(self.iface, "up")
+		self.APList = None
+		self.newAPList = None
+		self.WlanList = None
+		self.cleanList = None
+		self.oldlist = {}
+		self.listLength = None
+		self.rescanTimer = eTimer()
+		self.rescanTimer.callback.append(self.rescanTimerFired)
+		
+		self["info"] = StaticText()
+		
+		self.list = []
+		self["list"] = List(self.list)
+		
+		self["key_red"] = StaticText(_("Close"))
+		self["key_green"] = StaticText(_("Connect"))
+		self["key_yellow"] = StaticText()
+			
+		self["actions"] = NumberActionMap(["WizardActions", "InputActions", "EPGSelectActions"],
+		{
+			"ok": self.select,
+			"back": self.cancel,
+		}, -1)
+		
+		self["shortcuts"] = ActionMap(["ShortcutActions"],
+		{
+			"red": self.cancel,
+			"green": self.select,
+		})
+		self.onLayoutFinish.append(self.layoutFinished)
+		self.getAccessPoints(refresh = False)
+		
+	def layoutFinished(self):
+		self.setTitle(_("Choose a wireless network"))
+	
+	def select(self):
+		cur = self["list"].getCurrent()
+		if cur is not None:
+			self.rescanTimer.stop()
+			del self.rescanTimer
+			if cur[1] is not None:
+				if cur[1] == 'hidden...':
+					essid = cur[1]
+				else:
+					essid = cur[0]
+				self.close(essid,self.getWlanList())
+			else:
+				self.close(None,None)
+		else:
+			self.rescanTimer.stop()
+			del self.rescanTimer
+			self.close(None,None)
+	
+	def WlanSetupClosed(self, *ret):
+		if ret[0] == 2:
+			self.rescanTimer.stop()
+			del self.rescanTimer
+			self.close(None)
+	
+	def cancel(self):
+		if self.oldInterfaceState is False:
+			iNetwork.setAdapterAttribute(self.iface, "up", False)
+			iNetwork.deactivateInterface(self.iface,self.deactivateInterfaceCB)
+		else:
+			self.rescanTimer.stop()
+			del self.rescanTimer
+			self.close(None)
+
+	def deactivateInterfaceCB(self,data):
+		if data is not None:
+			if data is True:
+				self.rescanTimer.stop()
+				del self.rescanTimer
+				self.close(None)
+
+	def rescanTimerFired(self):
+		self.rescanTimer.stop()
+		self.updateAPList()
+
+	def buildEntryComponent(self, essid, bssid, encrypted, iface, maxrate, signal):
+		divpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/div-h.png"))
+		encryption = encrypted and _("Yes") or _("No")
+		if bssid == 'hidden...':
+			return((essid, bssid, None, None, None, None, divpng))
+		else:					
+			return((essid, bssid, _("Signal: ") + str(signal), _("Max. Bitrate: ") + str(maxrate), _("Encrypted: ") + encryption, _("Interface: ") + str(iface), divpng))
+
+	def updateAPList(self):
+		newList = []
+		newList = self.getAccessPoints(refresh = True)	
+		self.newAPList = []
+		tmpList = []
+		newListIndex = None
+		currentListEntry = None
+		currentListIndex = None
+
+		for ap in self.oldlist.keys():
+			data = self.oldlist[ap]['data']
+			if data is not None:
+				tmpList.append(data)
+
+		if len(tmpList):
+			if "hidden..." not in tmpList:
+				tmpList.append( ( _("enter hidden network SSID"), "hidden...", True, self.iface, _("unavailable"), "" ) )
+	
+			for entry in tmpList:
+				self.newAPList.append(self.buildEntryComponent( entry[0], entry[1], entry[2], entry[3], entry[4], entry[5] ))
+	
+			currentListEntry = self["list"].getCurrent()
+			idx = 0
+			for entry in self.newAPList:
+				if entry[0] == currentListEntry[0]:
+					newListIndex = idx
+				idx +=1
+			self['list'].setList(self.newAPList)
+			self["list"].setIndex(newListIndex)
+			self["list"].updateList(self.newAPList)
+			self.listLength = len(self.newAPList)
+			self.buildWlanList()
+			self.setInfo()
+
+	def getAccessPoints(self, refresh = False):
+		self.APList = []
+		self.cleanList = []
+		self.w = Wlan(self.iface)
+		aps = self.w.getNetworkList()
+		if aps is not None:
+			print "[WirelessLan.py] got Accespoints!"
+			tmpList = []
+			compList = []
+			for ap in aps:
+				a = aps[ap]
+				if a['active']:
+					tmpList.append( (a['essid'], a['bssid']) )
+					compList.append( (a['essid'], a['bssid'], a['encrypted'], a['iface'], a['maxrate'], a['signal']) )
+
+			for entry in tmpList:
+				if entry[0] == "":
+					for compentry in compList:
+						if compentry[1] == entry[1]:
+							compList.remove(compentry)
+			for entry in compList:
+				self.cleanList.append( ( entry[0], entry[1], entry[2], entry[3], entry[4], entry[5] ) )
+				if not self.oldlist.has_key(entry[0]):
+					self.oldlist[entry[0]] = { 'data': entry }
+				else:
+					self.oldlist[entry[0]]['data'] = entry
+		
+		if "hidden..." not in self.cleanList:
+			self.cleanList.append( ( _("enter hidden network SSID"), "hidden...", True, self.iface, _("unavailable"), "" ) )
+
+		for entry in self.cleanList:
+			self.APList.append(self.buildEntryComponent( entry[0], entry[1], entry[2], entry[3], entry[4], entry[5] ))
+		
+		if refresh is False:
+			self['list'].setList(self.APList)
+		self.listLength = len(self.APList)
+		self.setInfo()
+		self.rescanTimer.start(5000)
+		return self.cleanList
+
+	def setInfo(self):
+		length = self.getLength()
+		if length <= 1:
+			self["info"].setText(_("No wireless networks found! Please refresh."))
+		elif length == 2:
+			self["info"].setText(_("1 wireless network found!"))
+		else:
+			self["info"].setText(str(length-1)+_(" wireless networks found!"))
+
+	def buildWlanList(self):
+		self.WlanList = []
+		for entry in self['list'].list:
+			if entry[1] == "hidden...":
+				self.WlanList.append(( "hidden...",_("enter hidden network SSID") ))#continue
+			else:
+				self.WlanList.append( (entry[0], entry[0]) )
+
+	def getLength(self):
+		return self.listLength		
+
+	def getWlanList(self):
+		if self.WlanList is None:
+			self.buildWlanList()
+		return self.WlanList
+
+
+def WlanStatusScreenMain(session, iface):
+	session.open(WlanStatus, iface)
+
+
+def callFunction(iface):
+	w = Wlan(iface)
+	i = w.getWirelessInterfaces()
+	if i:
+		if iface in i:
+			return WlanStatusScreenMain
+	return None
+
+
+def configStrings(iface):
+	driver = iNetwork.detectWlanModule(iface)
+	print "Found WLAN-Driver:",driver
+	if driver  in ('ralink', 'zydas'):
+		return "	/var/bin/wpa_supplicant -i"+iface+" -c/etc/wpa_supplicant.conf -B -D"+driver+"\n	/var/bin/wpa_cli terminate"
+	else:
+		if config.plugins.wlan.essid.value == "hidden...":
+			return '	iwconfig '+iface+' essid "'+config.plugins.wlan.hiddenessid.value+'"\n	/var/bin/wpa_supplicant -i'+iface+' -c/etc/wpa_supplicant.conf -B -dd -D'+driver+'\n	/var/bin/wpa_cli terminate'
+		else:
+			return '	iwconfig '+iface+' essid "'+config.plugins.wlan.essid.value+'"\n	/var/bin/wpa_supplicant -i'+iface+' -c/etc/wpa_supplicant.conf -B -dd -D'+driver+'\n	/var/bin/wpa_cli terminate'
+
+def Plugins(**kwargs):
+	return PluginDescriptor(name=_("Wireless LAN"), description=_("Connect to a Wireless Network"), where = PluginDescriptor.WHERE_NETWORKSETUP, fnc={"ifaceSupported": callFunction, "configStrings": configStrings, "WlanPluginEntry": lambda x: "Wireless Network Configuartion..."})
