Skip to contentSkip to conversation

HID: Fix dropped device-specific quirks

PATCH In review Zoltan Karcagi 2 participants 2 messages May 4, 2009 – May 6, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 HID: Fix dropped device-specific quirks

Hi,

(Originally sent to linux-usb, description slightly rephrased.)

Please consider for merging. Without this patch, the device below does not work at all on kernel 2.6.28 and upwards.

Device-specific quirks are set up correctly in their respective vendor-specific driver, then get overwritten in usbhid_parse().
Found on a Microsoft Wireless Optical Desktop 3.0 [045e:009d].

drivers/hid/usbhid/hid-core.c 2009-05-03 14:43:47.000000000 +0200 renamed from drivers/hid/usbhid/hid-core.c 2009-05-01 12:06:18.000000000 +0200 +0 -0
diff -r -U 5 linux-2.6.30-rc4/drivers/hid/usbhid/hid-core.c linux-2.6.30-rc4-fixed/drivers/hid/usbhid/hid-core.c
@@ -896,11 +896,11 @@
if (ret) {
    dbg_hid("parsing report descriptor failed\n");
    goto err;
}

- hid->quirks = quirks;
+ hid->quirks |= quirks;

return 0;
err:
return ret;
}

#1 lore raw
Quoted 3 lines · Zoltan Karcagi

Device-specific quirks are set up correctly in their respective vendor-specific driver, then get overwritten in usbhid_parse(). Found on a Microsoft Wireless Optical Desktop 3.0 [045e:009d].

Good catch, thanks. Fortunately this affects only a few devices out there, for which specialized drivers set hdrv->quirks specifically (mostly NOGET quirk only).

Quoted 18 lines

diff -r -U 5 linux-2.6.30-rc4/drivers/hid/usbhid/hid-core.c linux-2.6.30-rc4-fixed/drivers/hid/usbhid/hid-core.c
--- linux-2.6.30-rc4/drivers/hid/usbhid/hid-core.c 2009-05-01
12:06:18.000000000 +0200
+++ linux-2.6.30-rc4-fixed/drivers/hid/usbhid/hid-core.c 2009-05-03
14:43:47.000000000 +0200

(quoted diff) +1 -1
@@ -896,11 +896,11 @@
 if (ret) {
    dbg_hid("parsing report descriptor failed\n");
    goto err;
 }
 
-    hid->quirks = quirks;
+    hid->quirks |= quirks;
 
 return 0;
Quoted 3 lines

err:
return ret;
}

The patch has been whitespace damaged, please fix this for your further submissions.

I have fixed it manually and applied.

Thanks,

Signature · 2 lines
Jiri Kosina
SUSE Labs