From owner-svn-src-user@FreeBSD.ORG Wed Jan 30 23:57:20 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id F33E3B21; Wed, 30 Jan 2013 23:57:19 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id C35E8DF4; Wed, 30 Jan 2013 23:57:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r0UNvJeu040868; Wed, 30 Jan 2013 23:57:19 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r0UNvJHd040867; Wed, 30 Jan 2013 23:57:19 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201301302357.r0UNvJHd040867@svn.freebsd.org> From: Adrian Chadd Date: Wed, 30 Jan 2013 23:57:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r246136 - user/adrian/ath_radar_stuff/lib/libradarpkt X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Jan 2013 23:57:20 -0000 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);