Commit 057238a0 authored by Bastien Nocera's avatar Bastien Nocera

linux: Don't treat device batteries like laptop batteries

Use the correct refresh function for device batteries which aren't of a
known type. This fixes battery information not getting updated on many
Logitech wireless devices.

Reproducer:
- Unplug Logitech receiver
- Replug Logitech receiver
- Press button on Logitech keyboard
- Move mouse/touchpad

The touchpad battery would be stuck in "unknown" and with a "type" of
battery. This commit forces the correct refresh function to be used, one
that reads the capacity_level on those devices, and will update the
overall battery level.

Closes: #72
parent c7104a19
......@@ -1192,17 +1192,14 @@ up_device_supply_refresh (UpDevice *device)
UpDeviceState state;
g_object_get (device, "type", &type, NULL);
switch (type) {
case UP_DEVICE_KIND_LINE_POWER:
if (type == UP_DEVICE_KIND_LINE_POWER) {
ret = up_device_supply_refresh_line_power (supply);
break;
case UP_DEVICE_KIND_BATTERY:
} else if (type == UP_DEVICE_KIND_BATTERY &&
supply->priv->is_power_supply) {
up_device_supply_disable_unknown_poll (device);
ret = up_device_supply_refresh_battery (supply, &state);
break;
default:
} else {
ret = up_device_supply_refresh_device (supply, &state);
break;
}
/* reset time if we got new data */
......
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