Skip to content

Commit

Permalink
HID: wacom: Fail probe if HID_GENERIC device has unknown device_type
Browse files Browse the repository at this point in the history
The last patch was careful to maintain backwards-compatible behavior
by forcing device_type to BTN_TOOL_PEN (and printing a warning) if it
were still uninitialized after scanning the HID descriptor and applying
quirks. We should be more strict with HID_GENERIC devices, however,
since there is no a priori guarantee that it is a tablet or touchpad.
If the device_type is still uninitialized for a HID_GENERIC device then
we assume that it isn't something the driver can work with and so fail
the probe.

Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
Reviewed-by: Ping Cheng <pingc@wacom.com>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
  • Loading branch information
Jason Gerecke authored and Jiri Kosina committed May 4, 2015
1 parent 042628a commit 8e116d3
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion drivers/hid/wacom_sys.c
Original file line number Diff line number Diff line change
Expand Up @@ -1528,8 +1528,14 @@ static int wacom_probe(struct hid_device *hdev,
wacom_setup_device_quirks(wacom);

if (!features->device_type && features->type != WIRELESS) {
error = features->type == HID_GENERIC ? -ENODEV : 0;

dev_warn(&hdev->dev, "Unknown device_type for '%s'. %s.",
hdev->name, "Assuming pen");
hdev->name,
error ? "Ignoring" : "Assuming pen");

if (error)
goto fail_shared_data;

features->device_type = BTN_TOOL_PEN;
}
Expand Down

0 comments on commit 8e116d3

Please sign in to comment.