Author: quozl Date: Sat Oct 20 02:20:13 2012 New Revision: 3374 URL: http://tracker.coreboot.org/trac/openfirmware/changeset/3374
Log: WLAN - scan buffer display overran actual length, only seen with 8787, see http://dev.laptop.org/ticket/12144
Modified: dev/ath9k/rx.fth dev/libertas.fth ofw/wifi/eapol.fth
Modified: dev/ath9k/rx.fth ============================================================================== --- dev/ath9k/rx.fth Sat Oct 20 01:47:51 2012 (r3373) +++ dev/ath9k/rx.fth Sat Oct 20 02:20:13 2012 (r3374) @@ -338,7 +338,7 @@ restart-scan-response ." Scanning channel: " dup idx>ch .d ." ..." cr re-set-channel (scan-ch) - scanbuf .ssids + scanbuf /tsbuf .ssids ; : scan-ch-2GHz ( -- ) d# 11 0 do i scan-ch loop ; : scan-ch-5GHz-1 ( -- ) d# 18 d# 14 do i scan-ch loop ;
Modified: dev/libertas.fth ============================================================================== --- dev/libertas.fth Sat Oct 20 01:47:51 2012 (r3373) +++ dev/libertas.fth Sat Oct 20 02:20:13 2012 (r3374) @@ -19,7 +19,7 @@ : supplicant-associate ( -- flag ) " do-associate" $call-supplicant ; : supplicant-process-eapol ( adr len -- ) " process-eapol" $call-supplicant ; : .scan ( adr -- ) " .scan" $call-supplicant ; -: .ssids ( adr -- ) " .ssids" $call-supplicant ; +: .ssids ( adr len -- ) " .ssids" $call-supplicant ;
defer load-all-fw ( -- error? ) ' false to load-all-fw defer ?process-eapol ['] 2drop to ?process-eapol @@ -485,6 +485,7 @@ 0075 of ." CMD_802_11_SUBSCRIBE_EVENT" endof 0076 of ." CMD_802_11_RATE_ADAPT_RATESET" endof 007f of ." CMD_TX_RATE_QUERY" endof + 00a4 of ." CMD_802_11_RSSI_INFO" endof 00a5 of ." CMD_SET_BOOT2_VER" endof \ Thin firmware only 00a9 of ." CMD_FUNC_INIT" endof \ Multifunction versions 00aa of ." CMD_FUNC_SHUTDOWN" endof @@ -1811,6 +1812,31 @@ respbuf .log ;
+0 [if] +: set-rssi-v14 ( nbcn ndata -- ) + swap >r >r ( r: antenna action ) + 6 h# a4 ( CMD_802_11_RSSI_INFO ) prepare-cmd + 1 +xw \ ACT_SET + r> +xw \ Ndata + r> +xw \ Nbcn + outbuf-wait drop +; + +: get-rssi-v14 ( -- avg_nf avg_snr nf snr ) + 6 h# a4 ( CMD_802_11_RSSI_INFO ) prepare-cmd + 0 +xw \ ACT_GET + 0 +xw \ Ndata + 0 +xw \ Nbcn + outbuf-wait drop + respbuf >fw-data >r + r@ h# 14 + le-w@ w->n ( avg_nf ) \ dBm + r@ h# 12 + le-w@ w->n ( avg_nf avg_rssi ) \ dBm + r@ h# 10 + le-w@ w->n ( avg_nf avg_rssi nf ) \ dBm + r@ h# 0e + le-w@ w->n ( avg_nf avg_rssi nf rssi ) \ dBm + r> drop +; +[then] + : get-rssi ( -- avg_nf avg_snr nf snr ) 2 h# 1f ( CMD_802_11_RSSI ) prepare-cmd d# 32 +xw \ number of beacons (N) to average the SNR and NF over @@ -2326,7 +2352,7 @@ quiet? if ( adr len ) 2drop false ( error? ) else - over .ssids ( adr len ) + 2dup .ssids ( adr len ) test-association ( error? ) then ( error? ) then @@ -2414,7 +2440,7 @@ : ta-scan ( -- ) ." scan" cr (scan) ( adr len error? ) - 0= if drop .ssids cr then ( ) + 0= if .ssids cr then ( ) ;
: ta-n ( n -- )
Modified: ofw/wifi/eapol.fth ============================================================================== --- ofw/wifi/eapol.fth Sat Oct 20 01:47:51 2012 (r3373) +++ ofw/wifi/eapol.fth Sat Oct 20 02:20:13 2012 (r3374) @@ -641,7 +641,11 @@ endcase ;
+0 value scanbuf-end + : .ap-ssid ( adr -- ) + dup le-w@ over + 2 + scanbuf-end >= if drop exit then + ." RSSI: " dup 8 + c@ .d dup le-w@ swap 2 + swap d# 19 /string ( adr' len' ) begin dup 0> while ( adr len ) @@ -650,14 +654,22 @@ repeat 2drop ( ) ;
-: .ssids ( adr -- ) - dup 3 + ( 'ap ) +: .ssids ( adr len -- ) + over + to scanbuf-end ( adr ) + + dup le-w@ ( adr size ) + over + scanbuf-end >= if + ." scan truncated" cr + then ( adr ) + + dup 3 + ( adr 'ap ) swap 2 + c@ ( 'ap #ap ) 0 ?do ( 'ap ) dup .ap-ssid cr ( 'ap ) dup le-w@ + 2 + ( 'ap' ) + dup scanbuf-end >= if drop unloop exit then loop drop ( ) -; +;
: #ssids ( adr -- n ) 2 + c@ ;
openfirmware@openfirmware.info