Skip to content
Permalink
Browse files
[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 b1d7a18f5de5e6233408db76354b37e0fc2a2de7
Showing with 14 additions and 0 deletions.
  1. +14 −0 src/usb_moded-udev.c
@@ -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);

0 comments on commit b1d7a18

Please sign in to comment.