Skip to content

Commit 1db1f39

Browse files
jigpuJiri Kosina
authored andcommitted
HID: wacom: Ensure bootloader PID is usable in hidraw mode
Some Wacom devices have a special "bootloader" mode that is used for firmware flashing. When operating in this mode, the device cannot be used for input, and the HID descriptor is not able to be processed by the driver. The driver generates an "Unknown device_type" warning and then returns an error code from wacom_probe(). This is a problem because userspace still needs to be able to interact with the device via hidraw to perform the firmware flash. This commit adds a non-generic device definition for 056a:0094 which is used when devices are in "bootloader" mode. It marks the devices with a special BOOTLOADER type that is recognized by wacom_probe() and wacom_raw_event(). When we see this type we ensure a hidraw device is created and otherwise keep our hands off so that userspace is in full control. Signed-off-by: Jason Gerecke <[email protected]> Tested-by: Tatsunosuke Tobita <[email protected]> Cc: <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent 53ffa6a commit 1db1f39

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

drivers/hid/wacom_sys.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,9 @@ static int wacom_raw_event(struct hid_device *hdev, struct hid_report *report,
155155
{
156156
struct wacom *wacom = hid_get_drvdata(hdev);
157157

158+
if (wacom->wacom_wac.features.type == BOOTLOADER)
159+
return 0;
160+
158161
if (size > WACOM_PKGLEN_MAX)
159162
return 1;
160163

@@ -2785,6 +2788,11 @@ static int wacom_probe(struct hid_device *hdev,
27852788
return error;
27862789
}
27872790

2791+
if (features->type == BOOTLOADER) {
2792+
hid_warn(hdev, "Using device in hidraw-only mode");
2793+
return hid_hw_start(hdev, HID_CONNECT_HIDRAW);
2794+
}
2795+
27882796
error = wacom_parse_and_register(wacom, false);
27892797
if (error)
27902798
return error;

drivers/hid/wacom_wac.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4882,6 +4882,9 @@ static const struct wacom_features wacom_features_0x3dd =
48824882
static const struct wacom_features wacom_features_HID_ANY_ID =
48834883
{ "Wacom HID", .type = HID_GENERIC, .oVid = HID_ANY_ID, .oPid = HID_ANY_ID };
48844884

4885+
static const struct wacom_features wacom_features_0x94 =
4886+
{ "Wacom Bootloader", .type = BOOTLOADER };
4887+
48854888
#define USB_DEVICE_WACOM(prod) \
48864889
HID_DEVICE(BUS_USB, HID_GROUP_WACOM, USB_VENDOR_ID_WACOM, prod),\
48874890
.driver_data = (kernel_ulong_t)&wacom_features_##prod
@@ -4955,6 +4958,7 @@ const struct hid_device_id wacom_ids[] = {
49554958
{ USB_DEVICE_WACOM(0x84) },
49564959
{ USB_DEVICE_WACOM(0x90) },
49574960
{ USB_DEVICE_WACOM(0x93) },
4961+
{ USB_DEVICE_WACOM(0x94) },
49584962
{ USB_DEVICE_WACOM(0x97) },
49594963
{ USB_DEVICE_WACOM(0x9A) },
49604964
{ USB_DEVICE_WACOM(0x9F) },

drivers/hid/wacom_wac.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,7 @@ enum {
243243
MTTPC,
244244
MTTPC_B,
245245
HID_GENERIC,
246+
BOOTLOADER,
246247
MAX_TYPE
247248
};
248249

0 commit comments

Comments
 (0)