Skip to content

Commit

Permalink
HID: wacom: ask for a in-prox report when it was missed
Browse files Browse the repository at this point in the history
If noone listens to the input device when a tool comes in proximity,
the tablet does not send the in-prox event when a client becomes available.
That means that no events will be sent until the tool is taken out of
proximity.

In this situation, ask for the report WACOM_REPORT_INTUOSREAD which will
read the corresponding feature and generate an in-prox event.
To make some generation of hardware working, we need to unset the
quirk NO_GET set by hid-core because the interfaces are seen as "boot
mouse".

We don't schedule this read in a worker while we are in an IO interrupt.
We know that usbhid will do it asynchronously. If this is triggered by
uhid, then this is obviously a client side bug :)

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Acked-by: Jason Gerecke <killertofu@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
  • Loading branch information
Benjamin Tissoires authored and Jiri Kosina committed Mar 16, 2015
1 parent 71fa641 commit 5fcad16
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
3 changes: 3 additions & 0 deletions drivers/hid/wacom_sys.c
Original file line number Diff line number Diff line change
Expand Up @@ -1408,6 +1408,9 @@ static int wacom_probe(struct hid_device *hdev,

hdev->quirks |= HID_QUIRK_NO_INIT_REPORTS;

/* hid-core sets this quirk for the boot interface */
hdev->quirks &= ~HID_QUIRK_NOGET;

wacom = kzalloc(sizeof(struct wacom), GFP_KERNEL);
if (!wacom)
return -ENOMEM;
Expand Down
18 changes: 17 additions & 1 deletion drivers/hid/wacom_wac.c
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,19 @@ static int wacom_graphire_irq(struct wacom_wac *wacom)
return retval;
}

static void wacom_intuos_schedule_prox_event(struct wacom_wac *wacom_wac)
{
struct wacom *wacom = container_of(wacom_wac, struct wacom, wacom_wac);
struct hid_report *r;
struct hid_report_enum *re;

re = &(wacom->hdev->report_enum[HID_FEATURE_REPORT]);
r = re->report_id_hash[WACOM_REPORT_INTUOSREAD];
if (r) {
hid_hw_request(wacom->hdev, r, HID_REQ_GET_REPORT);
}
}

static int wacom_intuos_inout(struct wacom_wac *wacom)
{
struct wacom_features *features = &wacom->features;
Expand Down Expand Up @@ -623,8 +636,11 @@ static int wacom_intuos_inout(struct wacom_wac *wacom)
}

/* don't report other events if we don't know the ID */
if (!wacom->id[idx])
if (!wacom->id[idx]) {
/* but reschedule a read of the current tool */
wacom_intuos_schedule_prox_event(wacom);
return 1;
}

return 0;
}
Expand Down

0 comments on commit 5fcad16

Please sign in to comment.