HID: wacom: actually report the battery level for wireless connected
authorBenjamin Tissoires <benjamin.tissoires@redhat.com>
Wed, 13 Jul 2016 16:05:48 +0000 (18:05 +0200)
committerJiri Kosina <jkosina@suse.cz>
Fri, 5 Aug 2016 11:39:11 +0000 (13:39 +0200)
Since fd5f92b ("HID: wacom: reuse wacom_parse_and_register() in
wireless_work"), wacom->shared->type is not set.
Send the information of the battery if we have one.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Acked-by: Ping Cheng <pingc@wacom.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/wacom_wac.c

index 1eae13cdc5020b5ec5dbcfe05f452f5528e8b958..d6746caf71cbb3b0229de40a06b4597036ec147d 100644 (file)
@@ -2125,6 +2125,7 @@ static int wacom_bamboo_pad_irq(struct wacom_wac *wacom, size_t len)
 
 static int wacom_wireless_irq(struct wacom_wac *wacom, size_t len)
 {
+       struct wacom *w = container_of(wacom, struct wacom, wacom_wac);
        unsigned char *data = wacom->data;
        int connected;
 
@@ -2152,7 +2153,7 @@ static int wacom_wireless_irq(struct wacom_wac *wacom, size_t len)
                        wacom_schedule_work(wacom);
                }
 
-               if (wacom->shared->type)
+               if (w->battery)
                        wacom_notify_battery(wacom, battery, charging, 1, 0);
 
        } else if (wacom->pid != 0) {