ubus: derive RSSI from measurement report

Derive the RSSI of a measurement-report based on it's RCPI.

Signed-off-by: David Bauer <mail@david-bauer.net>
This commit is contained in:
David Bauer
2022-05-23 01:12:38 +02:00
parent 87de1ab655
commit 9059b9a537
3 changed files with 18 additions and 0 deletions

View File

@@ -20,6 +20,21 @@
LIST_HEAD(measurements);
static struct usteer_timeout_queue tq;
int
usteer_measurement_get_rssi(struct usteer_measurement_report *report)
{
/* Apple devices always set the RSNI to 0, while
* it should be set to 255 in case RSNI is unavailable.
*
* For them, RCPI seems to be calculated as RCPI = 255 + (RSSI)
*/
if (!report->rsni)
return report->rcpi - 255;
return (report->rcpi / 2) - 110;
}
void
usteer_measurement_report_node_cleanup(struct usteer_node *node)
{