static unsigned short batcap_i4[8] = { 1, 15, 30, 45, 60, 70, 85, 100 };
static void wacom_notify_battery(struct wacom_wac *wacom_wac,
- int bat_capacity, bool bat_charging, bool ps_connected)
+ int bat_capacity, bool bat_charging, bool bat_connected,
+ bool ps_connected)
{
struct wacom *wacom = container_of(wacom_wac, struct wacom, wacom_wac);
bool changed = wacom_wac->battery_capacity != bat_capacity ||
wacom_wac->bat_charging != bat_charging ||
+ wacom_wac->bat_connected != bat_connected ||
wacom_wac->ps_connected != ps_connected;
if (changed) {
wacom_wac->battery_capacity = bat_capacity;
wacom_wac->bat_charging = bat_charging;
+ wacom_wac->bat_connected = bat_connected;
wacom_wac->ps_connected = ps_connected;
if (wacom->battery.dev)
battery_capacity = batcap_gr[rw];
ps_connected = rw == 7;
wacom_notify_battery(wacom, battery_capacity, ps_connected,
- ps_connected);
+ 1, ps_connected);
}
exit:
return retval;
ps_connected = (power_raw & 0x10) ? 1 : 0;
battery_capacity = batcap_i4[power_raw & 0x07];
wacom_notify_battery(wacom, battery_capacity, bat_charging,
+ battery_capacity || bat_charging,
ps_connected);
break;
default:
}
if (wacom->shared->type)
- wacom_notify_battery(wacom, battery, charging, 0);
+ wacom_notify_battery(wacom, battery, charging, 1, 0);
} else if (wacom->pid != 0) {
/* disconnected while previously connected */
wacom->pid = 0;
wacom_schedule_work(wacom);
- wacom_notify_battery(wacom, 0, 0, 0);
+ wacom_notify_battery(wacom, 0, 0, 0, 0);
}
return 0;
bool charging = !!(data[8] & 0x80);
wacom_notify_battery(wacom_wac, battery, charging,
- 1);
+ battery || charging, 1);
if (!wacom->battery.dev &&
!(features->quirks & WACOM_QUIRK_BATTERY)) {
features->quirks &= ~WACOM_QUIRK_BATTERY;
INIT_WORK(&wacom->work, wacom_battery_work);
wacom_schedule_work(wacom_wac);
- wacom_notify_battery(wacom_wac, 0, 0, 0);
+ wacom_notify_battery(wacom_wac, 0, 0, 0, 0);
}
return 0;
}