OSDN Git Service

HID: add autodetection of multitouch devices
[android-x86/kernel.git] / drivers / hid / hid-input.c
index 33dde87..c713215 100644 (file)
@@ -462,6 +462,10 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
                        map_key_clear(BTN_STYLUS2);
                        break;
 
+               case 0x51: /* ContactID */
+                       device->quirks |= HID_QUIRK_MULTITOUCH;
+                       goto unknown;
+
                default:  goto unknown;
                }
                break;
@@ -934,6 +938,16 @@ int hidinput_connect(struct hid_device *hid, unsigned int force)
                }
        }
 
+       if (hid->quirks & HID_QUIRK_MULTITOUCH) {
+               if (!strncmp(hid->driver->name, "generic-", 8)) {
+                       /* generic hid does not know how to handle multitouch devices */
+                       if (hidinput)
+                               goto out_cleanup;
+                       goto out_unwind;
+               }
+               hid->quirks &= ~HID_QUIRK_MULTITOUCH;
+       }
+
        if (hidinput && input_register_device(hidinput->input))
                goto out_cleanup;