Commit b1d7a18f authored by spiiroin's avatar spiiroin

[udev] Cancel mode selection when charger is detected. Fixes MER#1677

When charger is connected, usb-moded can see first "USB" (=cable)
connection event from udev followed by "USB_CDP" (=charger) event.
Due to cached something-connected flag usb moded still behaves as
if pc cable were connected - which leaves ui thinking mode selection
can/should be done etc.

If dedicated charger is reported after pc cable, clear the low level
something-connected flag before acting on charger connected info.
Signed-off-by: spiiroin's avatarSimo Piiroinen <simo.piiroinen@jollamobile.com>
parent b70f679e
...@@ -311,6 +311,20 @@ static void setup_charger_connection(void) ...@@ -311,6 +311,20 @@ static void setup_charger_connection(void)
cancel_cable_connection_timeout(); cancel_cable_connection_timeout();
log_debug("UDEV:USB dedicated charger connected\n"); log_debug("UDEV:USB dedicated charger connected\n");
if (cable) {
/* The connection was initially reported incorrectly
* as pc cable, then later on declared as charger.
*
* Clear "connected" boolean flag so that the
* set_charger_connected() call below acts as if charger
* were detected already on connect: mode gets declared
* as dedicated charger (and the mode selection dialog
* shown by ui gets closed).
*/
set_usb_connection_state(FALSE);
}
charger = 1; charger = 1;
cable = 0; cable = 0;
set_charger_connected(TRUE); set_charger_connected(TRUE);
......
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