svn commit: r246136 - user/adrian/ath_radar_stuff/lib/libradarpkt

Adrian Chadd adrian at FreeBSD.org
Wed Jan 30 23:57:20 UTC 2013


Author: adrian
Date: Wed Jan 30 23:57:19 2013
New Revision: 246136
URL: http://svnweb.freebsd.org/changeset/base/246136

Log:
  Fixes!
  
  * the RSSI from the hardware is in units of dB*2, so we need to
    divide it by 2 to get an actual dB value;
  
  * Do the frame length check at the beginning of the loop, in case we
    get frames that are 0 bytes in length.
  
  * Don't print out the full spectral data here.
  
  This doesn't fix the MAC/BB issues surrounding corrupted HT20/HT40
  frame lengths; that'll come later.

Modified:
  user/adrian/ath_radar_stuff/lib/libradarpkt/ar9280_radar.c

Modified: user/adrian/ath_radar_stuff/lib/libradarpkt/ar9280_radar.c
==============================================================================
--- user/adrian/ath_radar_stuff/lib/libradarpkt/ar9280_radar.c	Wed Jan 30 23:49:36 2013	(r246135)
+++ user/adrian/ath_radar_stuff/lib/libradarpkt/ar9280_radar.c	Wed Jan 30 23:57:19 2013	(r246136)
@@ -142,9 +142,9 @@ convert_data_ht20(struct radar_entry *re
 
 		/* Use upper if i >= bin 64; captures both HT20 and HT40 modes */
 		if (i < 64) {
-			pwr_val += (float) fe->lower.nf + (float) fe->lower.rssi - bsum_lower;
+			pwr_val += (float) fe->lower.nf + ((float) fe->lower.rssi / 2.0) - bsum_lower;
 		} else {
-			pwr_val += (float) fe->upper.nf + (float) fe->upper.rssi - bsum_upper;
+			pwr_val += (float) fe->upper.nf + ((float) fe->upper.rssi / 2.0) - bsum_upper;
 		}
 
 		fe->bins[i].dBm = pwr_val;
@@ -260,7 +260,10 @@ ar9280_radar_spectral_decode_ht40(struct
 	struct radar_fft_entry *fe;
 
 	if (len < AR9280_SPECTRAL_SAMPLE_SIZE_HT40) {
-		printf("%s: got %d bytes, wanted %d bytes\n", __func__, len, AR9280_SPECTRAL_SAMPLE_SIZE_HT40);
+		printf("%s: got %d bytes, wanted %d bytes\n",
+		    __func__,
+		    len,
+		    AR9280_SPECTRAL_SAMPLE_SIZE_HT40);
 		return (-1);
 	}
 
@@ -358,24 +361,25 @@ ar9280_radar_spectral_decode(struct ieee
 	int fr_len = len;
 
 	for (i = 0; i < MAX_SPECTRAL_SCAN_SAMPLES_PER_PKT; i++) {
+		if (fr_len <= 0)
+			break;
+
 		/* HT20 or HT40? */
 		if (re->re_flags & (IEEE80211_CHAN_HT40U | IEEE80211_CHAN_HT40D)) {
 			if (ar9280_radar_spectral_decode_ht40(rh, fr, fr_len, re, i) != 0) {
 				break;
 			}
-			ar9280_radar_spectral_print(&re->re_spectral_entries[i]);
+			//ar9280_radar_spectral_print(&re->re_spectral_entries[i]);
 			fr_len -= AR9280_SPECTRAL_SAMPLE_SIZE_HT40;
 			fr += AR9280_SPECTRAL_SAMPLE_SIZE_HT40;
 		} else {
 			if (ar9280_radar_spectral_decode_ht20(rh, fr, fr_len, re, i) != 0) {
 				break;
 			}
-			ar9280_radar_spectral_print(&re->re_spectral_entries[i]);
+			//ar9280_radar_spectral_print(&re->re_spectral_entries[i]);
 			fr_len -= AR9280_SPECTRAL_SAMPLE_SIZE_HT20;
 			fr += AR9280_SPECTRAL_SAMPLE_SIZE_HT20;
 		}
-		if (fr_len < 0)
-			break;
 	}
 
 //	printf("  Spectral: %d samples\n", i);


More information about the svn-src-user mailing list