Skip to content

Commit

Permalink
Do not test for diag mode and modelist when creating the list of supp…
Browse files Browse the repository at this point in the history
…orted modes.

We cannot test for diag mode and modelist at the same time, since the conditions
might not always be both met. Also always call read_mode_list with the
correct argument.

Signed-off-by: Philippe De Swert <philippe.deswert@jollamobile.com>
  • Loading branch information
philippedeswert committed Mar 21, 2014
1 parent 66cbaf3 commit c933fd9
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions src/usb_moded.c
Expand Up @@ -407,9 +407,10 @@ gchar *get_mode_list(void)

modelist_str = g_string_new(NULL);

if(!diag_mode)
{
/* check dynamic modes */
if(modelist && !diag_mode)
if(modelist)
{
GList *iter;

Expand All @@ -420,16 +421,17 @@ gchar *get_mode_list(void)
modelist_str = g_string_append(modelist_str, ", ");
}
}
else
{
/* diag mode. there is only one active mode */
g_string_append(modelist_str, MODE_DIAG);
return(g_string_free(modelist_str, FALSE));
}

/* end with charging mode */
g_string_append(modelist_str, MODE_CHARGING);
return(g_string_free(modelist_str, FALSE));
}
else
{
/* diag mode. there is only one active mode */
g_string_append(modelist_str, MODE_DIAG);
return(g_string_free(modelist_str, FALSE));
}
/* end with charging mode */
g_string_append(modelist_str, MODE_CHARGING);
return(g_string_free(modelist_str, FALSE));
}

/** get the usb mode
Expand Down Expand Up @@ -626,7 +628,8 @@ static void sigint_handler(int signum)
set_usb_mode_data(NULL);
/* free and read in modelist again */
free_mode_list(modelist);
modelist = read_mode_list(0);

modelist = read_mode_list(diag_mode);

send_supported_modes_signal();
}
Expand Down

0 comments on commit c933fd9

Please sign in to comment.