Changeset 3557
- Timestamp:
- Feb 18, 2013 8:31:19 AM (3 months ago)
- Files:
-
- 4 edited
-
cpu/arm/olpc/cl4/leds.fth (modified) (2 diffs)
-
dev/libertas.fth (modified) (11 diffs)
-
ofw/wifi/data.fth (modified) (1 diff)
-
ofw/wifi/eapol.fth (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
cpu/arm/olpc/cl4/leds.fth
r3451 r3557 31 31 d# 100 ms 32 32 hdd-led-on 33 " /wlan:quiet" test-dev33 " led-blink" $call-wlan 34 34 d# 100 ms 35 35 ols-led-off … … 43 43 44 44 : (selftest) 45 0 to wlan-ih 46 " /wlan:force" open-dev ?dup if to wlan-ih then 45 47 get-msecs d# 10000 + ( limit ) 46 48 begin 47 49 (cycle) 48 key? if drop exit then50 key? if drop wlan-ih close-dev exit then 49 51 dup get-msecs - 0< ( limit timeout? ) 50 52 until ( limit ) 51 53 drop ( ) 54 wlan-ih close-dev 52 55 ; 53 56 -
dev/libertas.fth
r3480 r3557 106 106 107 107 0 value channel 108 0 value 802.11n? \ Hardware is 802.11n capable 109 : channel-is-5ghz? ( chan# -- ) d# 14 > ; 108 110 109 111 d# 80 buffer: wpa-ie \ WPA IE saved for EAPOL phases … … 708 710 get-hw-spec 0= if ( adr ) 709 711 712 \ is 802.11n capable? 713 dup d# 34 + le-l@ h# 800 and if 714 true to 802.11n? 715 then ( adr ) 716 710 717 \ The 4-byte FWReleaseNumber field starts at offset d# 18. 711 718 \ Firmware version 2.3.4.p1 is represented in that field … … 1139 1146 h# 7ffe instance value channel-mask 1140 1147 1141 : +chan- list-tlv (-- )1148 : +chan-tlv ( channel# -- ) 1142 1149 h# 101 +xw 1143 0 +xw 'x >r ( r: 'payload ) 1144 #channels 1+ 1 do 1145 1 i lshift channel-mask and if 1146 0 +xb \ Radio type 1147 i +xb \ Channel # 1148 scan-type +xb \ Scan type - 0:active or 1:passive 1149 d# 100 +xw \ Min scan time 1150 d# 100 +xw \ Max scan time 1151 then 1152 loop 1153 'x r@ - r> 2- le-w! 1150 0 +xw 'x >r ( channel# r: payload' ) 1151 dup channel-is-5ghz? if 1 else 0 then ( channel# band# ) 1152 +xb \ Band # 1153 +xb \ Channel # 1154 scan-type +xb \ Scan type - 0:active or 1:passive 1155 d# 100 +xw \ Min scan time 1156 d# 100 +xw \ Max scan time ( r: payload' ) 1157 'x r@ - r> 2- le-w! ( ) 1154 1158 ; 1155 1159 … … 1168 1172 ; 1169 1173 1170 : (scan) ( -- error? | adr len 0 ) 1174 : (scan) ( chan -- error? | adr len 0 ) 1175 1176 \ forge success for 2.4 ghz channels disabled in the channel-mask 1177 dup channel-is-5ghz? 0= if ( chan ) 1178 1 over lshift channel-mask and 0= if ( chan ) 1179 drop respbuf 0 0 exit 1180 then 1181 then ( chan ) 1182 1183 \ forge success for 5 ghz channels if the device lacks support 1184 dup channel-is-5ghz? 802.11n? 0= and if 1185 drop respbuf 0 0 exit 1186 then 1187 1171 1188 6 ( CMD_802_11_SCAN ) start-cmd 1172 1189 resp-wait-long to resp-wait … … 1175 1192 6 +xerase \ BSS ID 1176 1193 1177 +chan- list-tlv1194 +chan-tlv 1178 1195 +probes-tlv 1179 1196 +ssid-tlv 1180 1197 1181 finish-cmd outbuf-wait dup 0= if ( error? )1182 respbuf /respbuf /fw-cmd /string rot ( adr len 0 )1198 finish-cmd outbuf-wait dup 0= if ( error? ) 1199 respbuf /respbuf /fw-cmd /string rot ( adr len 0 ) 1183 1200 then 1184 1201 ; … … 1201 1218 ; 1202 1219 1203 : scan ( adr len -- actual ) 1204 \ (scan) 1205 begin (scan) dup 1 = while drop d# 1000 ms repeat \ Retry while busy 1206 if 2drop 0 exit then ( adr len scan-adr scan-len ) 1207 rot min >r ( adr scan-adr r: len ) 1208 swap r@ move ( r: len ) 1209 r> 1210 ; 1220 : scan ( adr len chan -- actual ) 1221 dup channel-is-5ghz? 802.11n? 0= and if 3drop 0 exit then 1222 >r ( adr len r: chan ) 1223 begin 1224 r@ (scan) dup 1 = 1225 while 1226 drop d# 1000 ms \ retry while busy 1227 repeat ( adr len scan-adr scan-len err? r: chan ) 1228 r> drop ( adr len scan-adr scan-len err? ) 1229 if 2drop 0 exit then ( adr len scan-adr scan-len ) 1230 rot min >r ( adr scan-adr r: actual ) 1231 swap r@ move ( r: actual ) 1232 r> ( actual ) 1233 ; 1234 1211 1235 headers 1212 1236 … … 1551 1575 3 +xw \ element ID = DS param set 1552 1576 1 +xw \ len 1553 ( ch )+xb \ channel1577 dup +xb \ channel 1554 1578 1555 1579 \ CF param … … 1599 1623 /x save-wpa-ie \ Save IE in wpa-ie 1600 1624 then 1625 1626 \ associating with a 5 GHz channel requires the band to be specified 1627 802.11n? if +chan-tlv else drop then ( ) 1601 1628 1602 1629 \ XXX power (optional) … … 2328 2355 ; 2329 2356 2330 \ adr len is the result of (scan) - a list of APs and their characteristics2331 : test-association ( adr len -- error? )2332 " OLPCOFW" " select-ssid?" $call-supplicant if ( )2333 " (do-associate)" $call-supplicant if ( )2334 \ Success2335 do-disassociate2336 " true to ssid-reset?" ['] evaluate catch if 2drop then2337 false2338 else2339 true2340 then2341 else2342 \ There is no OLPCOFW access point, so we don't try associating2343 false2344 then2345 ;2346 2347 2357 : (scan-wifi) ( -- error? ) 2348 2358 true to force-open? … … 2350 2360 false to force-open? 2351 2361 0= if ." Can't open Marvell wireless" cr true close exit then 2352 2353 (scan) if 2354 ." Failed to scan" true cr 2355 else ( adr len ) 2356 \ drop .scan false 2357 diagnostic-mode? if ( adr len ) 2358 drop 2+ c@ if ( ) 2359 false 2360 else 2361 ." ERROR: No access points seen" cr 2362 true 2363 then 2364 else ( adr len ) 2365 \ Quiet mode is for the benefit of the LEDs test, so we can flash 2366 \ the WLAN LEDS without distracting messages appearing on the screen 2367 quiet? if ( adr len ) 2368 2drop false ( error? ) 2369 else 2370 2dup .ssids ( adr len ) 2371 test-association ( error? ) 2372 then ( error? ) 2373 then 2374 then 2375 2362 " scan-all" $call-supplicant ( error? ) 2376 2363 close 2377 2364 ; 2378 2365 2379 2366 : scan-wifi ( -- ) (scan-wifi) drop ; 2367 2368 : led-blink ( -- ) 2369 d# 6 (scan) 0= if 2drop then 2370 ; 2380 2371 2381 2372 : reassociate ( -- ) … … 2455 2446 : ta-scan ( -- ) 2456 2447 ." scan" cr 2457 (scan) ( adr len error? ) 2458 0= if .ssids cr then ( ) 2448 (scan-all) drop 2459 2449 ; 2460 2450 -
ofw/wifi/data.fth
r2917 r3557 9 9 : write-force ( adr len -- actual ) " write-force" $call-parent ; 10 10 : read-force ( adr len -- actual ) " read-force" $call-parent ; 11 : scan ( adr len -- actual ) " scan" $call-parent ;11 : scan ( adr len chan -- actual ) " scan" $call-parent ; 12 12 : enable-rsn ( -- ) " enable-rsn" $call-parent drop ; 13 13 : disable-rsn ( -- ) " disable-rsn" $call-parent drop ; -
ofw/wifi/eapol.fth
r3374 r3557 923 923 ; 924 924 925 create scan-order 926 d# 6 c, d# 1 c, d# 11 c, 927 928 d# 2 c, d# 3 c, d# 4 c, d# 5 c, d# 7 c, d# 8 c, 929 d# 9 c, d# 10 c, d# 12 c, d# 13 c, d# 14 c, 930 931 d# 36 c, d# 40 c, d# 44 c, d# 48 c, 932 d# 52 c, d# 56 c, d# 60 c, d# 64 c, 933 934 d# 100 c, d# 104 c, d# 108 c, 935 d# 112 c, d# 116 c, d# 132 c, d# 136 c, 936 937 d# 140 c, d# 149 c, d# 153 c, 938 d# 157 c, d# 161 c, d# 165 c, 939 here scan-order - constant /scan-order 940 941 : test-association ( adr len -- error? ) 942 " OLPCOFW" select-ssid? if 943 (do-associate) if 944 target-mac$ " disassociate" $call-parent 945 true to ssid-reset? 946 then 947 then 948 ; 949 950 : scan-all ( -- error? ) 951 scan-order /scan-order bounds do ( ) 952 scanbuf /buf i c@ ( adr len chan ) 953 scan dup if ( actual ) 954 scanbuf swap ( adr len ) 955 2dup .ssids ( adr len ) 956 test-association 957 else ( actual ) 958 drop unloop true exit 959 then 960 loop 961 false 962 ; 963 925 964 : scan-ssid? ( ssid$ -- found? ) 926 965 dup 0= if 2drop false exit then ( ssid$ ) … … 928 967 ssid$ " set-ssid" $call-parent ( ) 929 968 ??cr ." Scan for: " ssid$ type space ( ) 930 scanbuf /buf scan if ( ) 931 debug? if scanbuf .scan then ( ) 932 ssid$ (select-ssid?) ( found? ) 933 dup if ." found" else ." failed" then cr 934 else ( ) 935 ." not found" cr false ( found? ) 936 then ( found? ) 937 ; 969 970 scan-order /scan-order bounds do ( ) 971 scanbuf /buf i c@ ( adr len chan ) 972 scan if ( ) 973 debug? if scanbuf .scan then ( ) 974 ssid$ (select-ssid?) ( found? ) 975 if ." found" cr unloop true exit then 976 then 977 loop 978 ." not found" cr false ( found? ) 979 ; 980 938 981 : try-scan ( -- okay? ) 939 982 wifi-ssid$ scan-ssid? if true exit then
Note: See TracChangeset
for help on using the changeset viewer.
