summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaehyun Kim <jeik01.kim@samsung.com>2021-10-18 19:24:51 +0900
committerJaehyun Kim <jeik01.kim@samsung.com>2021-11-24 21:55:33 +0900
commit7d0b729a491d0ee388cf3d0a73b87cd2f506c314 (patch)
tree7a14c5b3f2d2c801ce073c8ecbbe4b6f10942a29
parente5cb500cd0a676f693b1503ac59eae08fe0c05c2 (diff)
downloadconnman-7d0b729a491d0ee388cf3d0a73b87cd2f506c314.tar.gz
connman-7d0b729a491d0ee388cf3d0a73b87cd2f506c314.tar.bz2
connman-7d0b729a491d0ee388cf3d0a73b87cd2f506c314.zip
Fix an incorrect value being used for signal score calculation
Change-Id: Ie09830257b804efdfb6990b9ea7030ba497ac542 Signed-off-by: Jaehyun Kim <jeik01.kim@samsung.com>
-rwxr-xr-xgsupplicant/supplicant.c2
-rwxr-xr-xsrc/service.c11
2 files changed, 9 insertions, 4 deletions
diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c
index 906f0ea7..d9d69ea0 100755
--- a/gsupplicant/supplicant.c
+++ b/gsupplicant/supplicant.c
@@ -2170,7 +2170,7 @@ static void update_bssid_list(gpointer key, gpointer value, gpointer user_data)
bssids->score_last_connected_bssid = calculate_score_last_connected_bssid(bssids->is_last_connected);
bssids->score_assoc_reject = calculate_score_assoc_reject(bssids->assoc_reject_cnt);
bssids->score_frequency = calculate_score_frequency(bss->signal, bssids->frequency);
- bssids->score_strength = calculate_score_strength(bssids->strength);
+ bssids->score_strength = calculate_score_strength(bss->signal);
bssids->score_snr = (int)bss->snr;
bssids->score_est_throughput = calculate_score_est_throughput(bss->est_throughput);
#endif
diff --git a/src/service.c b/src/service.c
index 36379b2a..f35ed684 100755
--- a/src/service.c
+++ b/src/service.c
@@ -7954,7 +7954,7 @@ static int calculate_score_frequency(struct connman_service *service)
switch (ins_settings.preferred_freq) {
case CONNMAN_INS_PREFERRED_FREQ_24GHZ:
- if ((frequency >= FREQ_RANGE_24GHZ_CHANNEL_14 &&
+ if ((frequency >= FREQ_RANGE_24GHZ_CHANNEL_1 &&
frequency <= FREQ_RANGE_24GHZ_CHANNEL_14) &&
(service->strength >= ins_settings.signal_level3_24ghz))
score += ins_settings.preferred_freq_score;
@@ -11183,8 +11183,13 @@ static void ins_setting_init(void)
ins_settings.preferred_freq_score = connman_setting_get_uint("INSPreferredFreqScore");
ins_settings.internet_score = connman_setting_get_uint("INSInternetScore");
- ins_settings.signal_level3_5ghz = connman_setting_get_int("INSSignalLevel3_5GHz");
- ins_settings.signal_level3_24ghz = connman_setting_get_int("INSSignalLevel3_24GHz");
+ /*
+ * In ConnMan, signal strength is used after being converted
+ * to positive value(signal strength + 120).
+ * So the value for comparison should also be converted to the same.
+ */
+ ins_settings.signal_level3_5ghz = connman_setting_get_int("INSSignalLevel3_5GHz") + 120;
+ ins_settings.signal_level3_24ghz = connman_setting_get_int("INSSignalLevel3_24GHz") + 120;
DBG("last_user_selection [%s]", ins_settings.last_user_selection ? "true" : "false");
DBG("last_user_selection_time [%d]", ins_settings.last_user_selection_time);