Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[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: Simo Piiroinen <simo.piiroinen@jollamobile.com>
  • Loading branch information
spiiroin committed Oct 18, 2016
1 parent b70f679 commit b1d7a18
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/usb_moded-udev.c
Expand Up @@ -311,6 +311,20 @@ static void setup_charger_connection(void)
cancel_cable_connection_timeout();

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;
cable = 0;
set_charger_connected(TRUE);
Expand Down

0 comments on commit b1d7a18

Please sign in to comment.