mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-23 01:10:04 +00:00
HID: wacom: generic: Ignore HID_DG_BATTERYSTRENTH == 0
AES sensors use the value 0 to indicate "not available" rather than "completely dead". Such values are often sent for dozens of reports while the pen is being brought into proximity and can cause userspace to get the wrong impression about the actual battery state. Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com> Reviewed-by: Ping Cheng <ping.cheng@wacom.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
This commit is contained in:
parent
37d1601938
commit
f496c09c07
1 changed files with 2 additions and 0 deletions
|
@ -2036,6 +2036,8 @@ static void wacom_wac_pen_event(struct hid_device *hdev, struct hid_field *field
|
|||
wacom_wac->hid_data.sense_state = value;
|
||||
return;
|
||||
case HID_DG_BATTERYSTRENGTH:
|
||||
if (value == 0) /* "not available" */
|
||||
break;
|
||||
value = value * 100 / (field->logical_maximum - field->logical_minimum);
|
||||
wacom_wac->hid_data.battery_capacity = value;
|
||||
wacom_wac->hid_data.bat_connected = 1;
|
||||
|
|
Loading…
Reference in a new issue