Skip to content

Commit 86e88f0

Browse files
jigpuJiri Kosina
authored andcommitted
HID: wacom: Call 'wacom_query_tablet_data' only after 'hid_hw_start'
When connecting the Cintiq Companion 2 as an external tablet (i.e., using it in "hybrid" mode) it has been seen to cause the kernel of the machine it is connected to to Oops. The cause has been traced to us attempting to switch the tablet's mode prior to actually starting HID device (resulting in the eventual dereference of the uninitialized control URB). Commit 3b164a0 moved the mode switch from occuring post-start to occurring pre-start. The change was not seen to cause issues largely due to the fact that most devices mode switch with 'hid_hw_raw_request' (which is safe to call prior to start) rather than 'hid_hw_request'. Moving the call back to its original location resolves the issue, but causes some touch-only Bamboo tablets (e.g. 056a:00d0) to stop working. The affected tablets require us to perform a mode switch on their vestigial pen interface prior ignoring with -ENODEV, meaning that the code which is responsible for doing the ignoring has to move as well. Signed-off-by: Jason Gerecke <[email protected]> Reviewed-by: Ping Cheng <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent 8253d42 commit 86e88f0

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

drivers/hid/wacom_sys.c

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1778,24 +1778,6 @@ static int wacom_probe(struct hid_device *hdev,
17781778
features->device_type |= WACOM_DEVICETYPE_PEN;
17791779
}
17801780

1781-
/* Note that if query fails it is not a hard failure */
1782-
wacom_query_tablet_data(hdev, features);
1783-
1784-
/* touch only Bamboo doesn't support pen */
1785-
if ((features->type == BAMBOO_TOUCH) &&
1786-
(features->device_type & WACOM_DEVICETYPE_PEN)) {
1787-
error = -ENODEV;
1788-
goto fail_shared_data;
1789-
}
1790-
1791-
/* pen only Bamboo neither support touch nor pad */
1792-
if ((features->type == BAMBOO_PEN) &&
1793-
((features->device_type & WACOM_DEVICETYPE_TOUCH) ||
1794-
(features->device_type & WACOM_DEVICETYPE_PAD))) {
1795-
error = -ENODEV;
1796-
goto fail_shared_data;
1797-
}
1798-
17991781
wacom_calculate_res(features);
18001782

18011783
wacom_update_name(wacom);
@@ -1833,6 +1815,24 @@ static int wacom_probe(struct hid_device *hdev,
18331815
goto fail_hw_start;
18341816
}
18351817

1818+
/* Note that if query fails it is not a hard failure */
1819+
wacom_query_tablet_data(hdev, features);
1820+
1821+
/* touch only Bamboo doesn't support pen */
1822+
if ((features->type == BAMBOO_TOUCH) &&
1823+
(features->device_type & WACOM_DEVICETYPE_PEN)) {
1824+
error = -ENODEV;
1825+
goto fail_hw_start;
1826+
}
1827+
1828+
/* pen only Bamboo neither support touch nor pad */
1829+
if ((features->type == BAMBOO_PEN) &&
1830+
((features->device_type & WACOM_DEVICETYPE_TOUCH) ||
1831+
(features->device_type & WACOM_DEVICETYPE_PAD))) {
1832+
error = -ENODEV;
1833+
goto fail_hw_start;
1834+
}
1835+
18361836
if (features->device_type & WACOM_DEVICETYPE_WL_MONITOR)
18371837
error = hid_hw_open(hdev);
18381838

0 commit comments

Comments
 (0)