Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[config] Do not switch from undefined mode to charging fallback. JB#4…
…1302

USB mode white-list configuration can get applied via D-Bus during bootup.
This requires re-evaluation of the currently active usb mode - which
misfires when nothing is connected to usb port and usb mode gets changed
from undefined to charging fallback (= charging from pc).

Add explicit check for undefined usb mode.

Signed-off-by: Simo Piiroinen <simo.piiroinen@jollamobile.com>
  • Loading branch information
spiiroin committed Mar 28, 2018
1 parent b895445 commit 2ad2f47
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/usb_moded-config.c
Expand Up @@ -528,7 +528,12 @@ set_config_result_t set_mode_whitelist(const char *whitelist)
g_free(mode_setting);

current_mode = get_usb_mode();
if (strcmp(current_mode, MODE_CHARGING_FALLBACK) && strcmp(current_mode, MODE_ASK) && valid_mode(current_mode)) {
if (!strcmp(current_mode, MODE_UNDEFINED)) {
/* Disconnected -> do nothing */
}
else if (strcmp(current_mode, MODE_CHARGING_FALLBACK) && strcmp(current_mode, MODE_ASK) && valid_mode(current_mode)) {
/* Invalid mode that is not MODE_ASK or MODE_CHARGING_FALLBACK
* -> switch to MODE_CHARGING_FALLBACK */
usb_moded_mode_cleanup(get_usb_module());
set_usb_mode(MODE_CHARGING_FALLBACK);
}
Expand Down

0 comments on commit 2ad2f47

Please sign in to comment.