Skip to content

Commit

Permalink
Use present property over online as some drivers use the online prope…
Browse files Browse the repository at this point in the history
…rty to indicate charging is enabled.

Signed-off-by: Philippe De Swert <philippe.deswert@jollamobile.com>
  • Loading branch information
philippedeswert committed Jun 26, 2013
1 parent 2b4e802 commit bc06958
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/usb_moded-udev.c
Expand Up @@ -178,11 +178,12 @@ static void udev_parse(struct udev_device *dev)
const char *tmp;
static int cable = 0, charger = 0; /* track if cable was connected as we cannot distinguish charger and cable disconnects */

tmp = udev_device_get_property_value(dev, "POWER_SUPPLY_ONLINE");
/* Check for present first as some drivers use online for when charging is enabled */
tmp = udev_device_get_property_value(dev, "POWER_SUPPLY_PRESENT");
if(!tmp)
{
tmp = udev_device_get_property_value(dev, "POWER_SUPPLY_PRESENT");
log_warning("Using present property\n");
tmp = udev_device_get_property_value(dev, "POWER_SUPPLY_ONLINE");
log_warning("Using online property\n");
}
if(!tmp)
{
Expand Down

0 comments on commit bc06958

Please sign in to comment.