Fix an incorrect value being used for signal score calculation 05/265405/3
authorJaehyun Kim <jeik01.kim@samsung.com>
Mon, 18 Oct 2021 10:24:51 +0000 (19:24 +0900)
committerJaehyun Kim <jeik01.kim@samsung.com>
Wed, 24 Nov 2021 12:55:33 +0000 (21:55 +0900)
Change-Id: Ie09830257b804efdfb6990b9ea7030ba497ac542
Signed-off-by: Jaehyun Kim <jeik01.kim@samsung.com>
gsupplicant/supplicant.c
src/service.c

index 906f0ea..d9d69ea 100755 (executable)
@@ -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
index 36379b2..f35ed68 100755 (executable)
@@ -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);