This patch adds battery/ac reporting for Intuos4 WL. It uses existing sysfs code, but the device reports battery capacity in more fine-grained way, so there has to be a separate lookup table (called batcap_i4).
Signed-off-by: Przemo Firszt <prz...@firszt.eu> --- drivers/hid/hid-wacom.c | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-) diff --git a/drivers/hid/hid-wacom.c b/drivers/hid/hid-wacom.c index 1d19ccb..2c89c8a 100644 --- a/drivers/hid/hid-wacom.c +++ b/drivers/hid/hid-wacom.c @@ -54,6 +54,8 @@ struct wacom_data { /*percent of battery capacity for Graphire 7th value means AC online and show 100% capacity */ static unsigned short batcap_gr[8] = { 1, 15, 25, 35, 50, 70, 100, 100 }; +/*percent of battery capacity for Intuos4 WL, AC has a separate bit*/ +static unsigned short batcap_i4[8] = { 1, 15, 30, 45, 60, 70, 85, 100 }; static enum power_supply_property wacom_battery_props[] = { POWER_SUPPLY_PROP_PRESENT, @@ -455,6 +457,8 @@ static int wacom_raw_event(struct hid_device *hdev, struct hid_report *report, struct input_dev *input; unsigned char *data = (unsigned char *) raw_data; int i; + __u8 battery; + __u8 ps_connected; if (!(hdev->claimed & HID_CLAIMED_INPUT)) return 0; @@ -482,6 +486,14 @@ static int wacom_raw_event(struct hid_device *hdev, struct hid_report *report, wacom_i4_parse_report(hdev, wdata, input, data + i); i += 10; wacom_i4_parse_report(hdev, wdata, input, data + i); + battery = data[i+10] & 0x07; + if (batcap_i4[battery] != wdata->battery_capacity) + wdata->battery_capacity = batcap_i4[battery]; + + ps_connected = data[i+10] & 0x08; + if (ps_connected != wdata->ps_connected) + wdata->ps_connected = ps_connected; + break; default: hid_err(hdev, "Unknown report: %d,%d size:%d\n", -- 1.7.6.4 ------------------------------------------------------------------------------ This SF email is sponsosred by: Try Windows Azure free for 90 days Click Here http://p.sf.net/sfu/sfd2d-msazure _______________________________________________ Linuxwacom-devel mailing list Linuxwacom-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel