Author: wmb
Date: 2009-09-14 09:41:55 +0200 (Mon, 14 Sep 2009)
New Revision: 1360
Modified:
cpu/x86/pc/olpc/via/devices.fth
dev/libertas.fth
ofw/wifi/eapol.fth
Log:
Via - fixed issues with "test /wlan"
1) It failed to display any scan results after the first time,
because a variable was unitialized
2) The scan result was too long to comprehend - switched to an
abbreviated format that shows just signal, SSID, and channel.
Modified: cpu/x86/pc/olpc/via/devices.fth
===================================================================
--- cpu/x86/pc/olpc/via/devices.fth 2009-09-10 08:48:44 UTC (rev 1359)
+++ cpu/x86/pc/olpc/via/devices.fth 2009-09-14 07:41:55 UTC (rev 1360)
@@ -234,6 +234,14 @@
fload ${BP}/dev/via/spi/bbspi.fth \ Tethered SPI FLASH programming
fload ${BP}/cpu/x86/pc/olpc/via/boardrev.fth \ Board revision decoding
+warning @ warning off
+: wlan-reset ( -- )
+ h# 4c acpi-l@ ( old )
+ dup h# 800 invert and h# 4c acpi-l! ( old )
+ d# 10 ms ( old )
+ h# 800 or h# 4c acpi-l! ( )
+;
+warning !
: cpu-mhz ( -- n )
" /cpu@0" find-package drop ( phandle )
@@ -246,7 +254,6 @@
3drop
;
-[ifdef] use-wlan
stand-init: Wireless reset
\ Hit the reset on the Marvell wireless. It sometimes (infrequently)
\ fails to enumerate after a power-cycle, and reset seems to fix it.
@@ -254,7 +261,6 @@
\ takes about 200 mS, so we are okay.
atest? 0= if wlan-reset then
;
-[then]
fload ${BP}/cpu/x86/pc/olpc/mfgdata.fth \ Manufacturing data
fload ${BP}/cpu/x86/pc/olpc/mfgtree.fth \ Manufacturing data in device tree
Modified: dev/libertas.fth
===================================================================
--- dev/libertas.fth 2009-09-10 08:48:44 UTC (rev 1359)
+++ dev/libertas.fth 2009-09-14 07:41:55 UTC (rev 1360)
@@ -19,6 +19,7 @@
: do-associate ( -- flag ) " do-associate" $call-supplicant ;
: process-eapol ( adr len -- ) " process-eapol" $call-supplicant ;
: .scan ( adr -- ) " .scan" $call-supplicant ;
+: .ssids ( adr -- ) " .ssids" $call-supplicant ;
defer load-all-fw ( -- error? ) ' false to load-all-fw
defer ?process-eapol ['] 2drop to ?process-eapol
@@ -557,7 +558,7 @@
\ Reset
\ =========================================================================
-: reset-wlan ( -- ) " wlan-reset" evaluate ;
+: reset-wlan ( -- ) " wlan-reset" evaluate ds-not-ready set-driver-state ;
: marvel-get-hw-spec ( -- true | adr false )
d# 38 h# 03 ( CMD_GET_HW_SPEC ) prepare-cmd
@@ -1578,6 +1579,7 @@
: open ( -- ok? )
my-args parse-args
set-parent-channel
+ " " set-ssid \ Instance buffers aren't necessarily initially 0
opencount @ 0= if
init-buf
/inbuf /outbuf setup-bus-io if free-buf false exit then
@@ -1693,7 +1695,8 @@
(scan) if
." Failed to scan" true cr
else ( adr len )
- drop .scan false
+\ drop .scan false
+ drop .ssids false
then
close
Modified: ofw/wifi/eapol.fth
===================================================================
--- ofw/wifi/eapol.fth 2009-09-10 08:48:44 UTC (rev 1359)
+++ ofw/wifi/eapol.fth 2009-09-14 07:41:55 UTC (rev 1360)
@@ -521,6 +521,33 @@
loop drop ( )
;
+: .ie-short ( adr -- )
+ dup c@ ( adr ie )
+ case
+ 0 of ." SSID: " dup 2 + swap 1+ c@ type 2 spaces endof
+ 3 of ." Channel: " 2 + c@ .d endof
+ ( default ) nip
+ endcase
+;
+
+: .ap-ssid ( adr -- )
+ ." RSSI: " dup 8 + c@ .d
+ dup le-w@ swap 2 + swap d# 19 /string ( adr' len' )
+ begin dup 0> while ( adr len )
+ over .ie-short ( adr len )
+ over 1+ c@ 2 + /string ( adr' len' )
+ repeat 2drop ( )
+;
+
+: .ssids ( adr -- )
+ dup 3 + ( 'ap )
+ swap 2 + c@ ( 'ap #ap )
+ 0 ?do ( 'ap )
+ dup .ap-ssid cr ( 'ap )
+ dup le-w@ + 2 + ( 'ap' )
+ loop drop ( )
+;
+
\ =======================================================================
\ Associate