Commit 2ad2f473 authored by spiiroin's avatar spiiroin

[config] Do not switch from undefined mode to charging fallback. JB#41302

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: spiiroin's avatarSimo Piiroinen <simo.piiroinen@jollamobile.com>
parent b895445f
......@@ -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);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment