Commit 04cc660f authored by Philippe De Swert's avatar Philippe De Swert

[charger] Debounce charger connection info. Fixes: JB#24913

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: default avatarPhilippe De Swert <philippe.deswert@jollamobile.com>
parent 70255285
......@@ -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;
}
}
......
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