Skip to content

Commit

Permalink
[charger] Debounce charger connection info. Fixes: JB#24913
Browse files Browse the repository at this point in the history
Stop sending signals the whole time when the charger is connected. As
we can get lots of spurious signals from the kernel, just like with the
regular cable connection.

Signed-off-by: Philippe De Swert <philippe.deswert@jollamobile.com>
  • Loading branch information
philippedeswert committed Dec 4, 2014
1 parent 7025528 commit 04cc660
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/usb_moded.c
Expand Up @@ -192,16 +192,23 @@ if(!get_usb_connection_state())
*/
void set_charger_connected(gboolean state)
{
/* check if charger is already connected
to avoid spamming dbus */
if(current_mode.connected)
return;

if(state)
{
usb_moded_send_signal(CHARGER_CONNECTED);
set_usb_mode(MODE_CHARGER);
current_mode.connected = TRUE;
}
else
{
current_mode.connected = FALSE;
usb_moded_send_signal(CHARGER_DISCONNECTED);
set_usb_mode(MODE_UNDEFINED);
current_mode.connected = FALSE;
}
}

Expand Down

0 comments on commit 04cc660

Please sign in to comment.