eiwd

no dbus iwd with iwctl functionality
git clone https://git.daat.foo/repos/eiwd.git
Log | Files | Refs | Submodules | README | LICENSE

commit c1c2ca5e7f03f43e8d140b2b354ef29975fd5c88
parent be4ab2826ff30661a262e179dcbc94b75041e13a
Author: James Prestwood <prestwoj@gmail.com>
Date:   Mon, 18 Nov 2019 10:35:54 -0800

rrm: remove use of floating point math

The RCPI value was using floating point values as per the spec. But instead
we can just use the signal strength coming from the kernel in mili mdm and
scale the hard coded values by a factor of 100.

Diffstat:
Msrc/rrm.c | 8+++-----
1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/src/rrm.c b/src/rrm.c @@ -25,7 +25,6 @@ #endif #include <stdint.h> -#include <math.h> #include <linux/if_ether.h> #include <ell/ell.h> @@ -247,7 +246,6 @@ static size_t build_report_for_bss(struct rrm_beacon_req_info *beacon, uint8_t *to) { uint8_t *start = to; - double dbms = bss->signal_strength / 100; *to++ = beacon->oper_class; *to++ = scan_freq_to_channel(bss->frequency, NULL); @@ -259,10 +257,10 @@ static size_t build_report_for_bss(struct rrm_beacon_req_info *beacon, *to++ = rrm_phy_type(bss); /* 802.11 Table 9-154 - RCPI values */ - if (dbms < -109.5) + if (bss->signal_strength < -10950) *to++ = 0; - else if (dbms >= -109.5 && dbms < 0) - *to++ = (uint8_t)floor(2 * (dbms + 110)); + else if (bss->signal_strength >= -10950 && bss->signal_strength < 0) + *to++ = (uint8_t)((2 * (bss->signal_strength + 11000)) / 100); else *to++ = 220;