Hi,

On Thu, 2012-04-05 at 22:38 +0300, [email protected] wrote:
> @@ -146,6 +148,20 @@ static void parse_config(GKeyFile *config)
>       g_strfreev(str_list);
>  
>       g_clear_error(&error);
> +
> +     str_list = g_key_file_get_string_list(config, "General",
> +                     "PreferredTechnologies", &len, &error);
> +
> +     if (error == NULL)
> +             connman_settings.preferred_techs =
> +                     parse_service_types(str_list, len);
> +     else
> +             connman_settings.preferred_techs =
> +                     parse_service_types(default_auto_connect, 3);

The 'else' part is a bug. There are no defaults for preferred
technologies. The patch I'm about to apply upstream will have that part
removed like so:

commit 661056f4f12bee125567bcbbf93a0a8c0e5b83b0
Author: Patrik Flykt <[email protected]>
Date:   Thu Apr 5 22:38:40 2012 +0300

    main: Add 'PreferredTechnologies' configuration file option
    
    The main.conf 'PreferredTechnologies' is a list of service
    type strings but converted to a list of service type enums.
    Thus the configuration option is accessible via the function
    connman_setting_get_uint_list().

diff --git a/src/main.c b/src/main.c
index 354734d..9feab70 100644
--- a/src/main.c
+++ b/src/main.c
@@ -46,10 +46,12 @@ static struct {
        connman_bool_t bg_scan;
        char **pref_timeservers;
        unsigned int *auto_connect;
+       unsigned int *preferred_techs;
 } connman_settings  = {
        .bg_scan = TRUE,
        .pref_timeservers = NULL,
        .auto_connect = NULL,
+       .preferred_techs = NULL,
 };
 
 static GKeyFile *load_config(const char *file)
@@ -146,6 +148,17 @@ static void parse_config(GKeyFile *config)
        g_strfreev(str_list);
 
        g_clear_error(&error);
+
+       str_list = g_key_file_get_string_list(config, "General",
+                       "PreferredTechnologies", &len, &error);
+
+       if (error == NULL)
+               connman_settings.preferred_techs =
+                       parse_service_types(str_list, len);
+
+       g_strfreev(str_list);
+
+       g_clear_error(&error);
 }
 
 static GMainLoop *main_loop = NULL;
@@ -309,6 +322,9 @@ unsigned int *connman_setting_get_uint_list(const char *key)
        if (g_str_equal(key, "DefaultAutoConnectTechnologies") == TRUE)
                return connman_settings.auto_connect;
 
+       if (g_str_equal(key, "PreferredTechnologies") == TRUE)
+               return connman_settings.preferred_techs;
+
        return NULL;
 }
 
@@ -497,6 +513,7 @@ int main(int argc, char *argv[])
                g_strfreev(connman_settings.pref_timeservers);
 
        g_free(connman_settings.auto_connect);
+       g_free(connman_settings.preferred_techs);
 
        g_free(option_debug);
 


_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman

Reply via email to