Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ab426141 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "HID: wacom: fix problems when device is not a valid USB device"

parents 6aa7b8f3 471de394
Loading
Loading
Loading
Loading
+12 −5
Original line number Diff line number Diff line
@@ -697,7 +697,7 @@ static void wacom_retrieve_hid_descriptor(struct hid_device *hdev,
	 * Skip the query for this type and modify defaults based on
	 * interface number.
	 */
	if (features->type == WIRELESS) {
	if (features->type == WIRELESS && intf) {
		if (intf->cur_altsetting->desc.bInterfaceNumber == 0)
			features->device_type = WACOM_DEVICETYPE_WL_MONITOR;
		else
@@ -2387,6 +2387,9 @@ static void wacom_wireless_work(struct work_struct *work)

	wacom_destroy_battery(wacom);

	if (!usbdev)
		return;

	/* Stylus interface */
	hdev1 = usb_get_intfdata(usbdev->config->interface[1]);
	wacom1 = hid_get_drvdata(hdev1);
@@ -2666,8 +2669,6 @@ static void wacom_mode_change_work(struct work_struct *work)
static int wacom_probe(struct hid_device *hdev,
		const struct hid_device_id *id)
{
	struct usb_interface *intf = to_usb_interface(hdev->dev.parent);
	struct usb_device *dev = interface_to_usbdev(intf);
	struct wacom *wacom;
	struct wacom_wac *wacom_wac;
	struct wacom_features *features;
@@ -2704,8 +2705,14 @@ static int wacom_probe(struct hid_device *hdev,
	wacom_wac->hid_data.inputmode = -1;
	wacom_wac->mode_report = -1;

	if (hid_is_usb(hdev)) {
		struct usb_interface *intf = to_usb_interface(hdev->dev.parent);
		struct usb_device *dev = interface_to_usbdev(intf);

		wacom->usbdev = dev;
		wacom->intf = intf;
	}

	mutex_init(&wacom->lock);
	INIT_DELAYED_WORK(&wacom->init_work, wacom_init_work);
	INIT_WORK(&wacom->wireless_work, wacom_wireless_work);