diff mbox series

[1/8] scan: add [Rank].BandModifier2_4Ghz

Message ID 20230925185422.2242494-1-prestwoj@gmail.com (mailing list archive)
State Accepted, archived
Headers show
Series [1/8] scan: add [Rank].BandModifier2_4Ghz | expand

Checks

Context Check Description
tedd_an/pre-ci_am fail error: patch failed: src/scan.c:53 error: src/scan.c: patch does not apply hint: Use 'git am --show-current-patch' to see the failed patch

Commit Message

James Prestwood Sept. 25, 2023, 6:54 p.m. UTC
Similar to the 5/6Ghz options, allow modifying the rank for 2.4Ghz
scan results.
---
 src/scan.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Denis Kenzior Sept. 27, 2023, 7:48 p.m. UTC | #1
Hi James,

On 9/25/23 13:54, James Prestwood wrote:
> Similar to the 5/6Ghz options, allow modifying the rank for 2.4Ghz
> scan results.
> ---
>   src/scan.c | 8 ++++++++
>   1 file changed, 8 insertions(+)

Patches 1-4 applied, thanks.

Regards,
-Denis
diff mbox series

Patch

diff --git a/src/scan.c b/src/scan.c
index 5a972efb..3979dc03 100644
--- a/src/scan.c
+++ b/src/scan.c
@@ -53,6 +53,7 @@ 
 #include "src/scan.h"
 
 /* User configurable options */
+static double RANK_2G_FACTOR;
 static double RANK_5G_FACTOR;
 static double RANK_6G_FACTOR;
 static uint32_t SCAN_MAX_INTERVAL;
@@ -1634,6 +1635,9 @@  static void scan_bss_compute_rank(struct scan_bss *bss)
 
 	rank = (double)bss->data_rate / max_rate * USHRT_MAX;
 
+	if (bss->frequency < 3000)
+		rank *= RANK_2G_FACTOR;
+
 	/* Prefer 5G networks over 2.4G and 6G */
 	if (bss->frequency >= 4900 && bss->frequency < 5900)
 		rank *= RANK_5G_FACTOR;
@@ -2355,6 +2359,10 @@  static int scan_init(void)
 
 	scan_contexts = l_queue_new();
 
+	if (!l_settings_get_double(config, "Rank", "BandModifier2_4Ghz",
+					&RANK_2G_FACTOR))
+		RANK_2G_FACTOR = 1.0;
+
 	if (!l_settings_get_double(config, "Rank", "BandModifier5Ghz",
 					&RANK_5G_FACTOR))
 		RANK_5G_FACTOR = 1.0;