Merge tag '6.7-rc2-smb3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6
[linux-2.6-microblaze.git] / drivers / hid / hid-input.c
index 851ee86..c8b20d4 100644 (file)
@@ -358,6 +358,9 @@ static const struct hid_device_id hid_battery_quirks[] = {
        { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE,
                USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI),
          HID_BATTERY_QUIRK_PERCENT | HID_BATTERY_QUIRK_FEATURE },
+       { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE,
+               USB_DEVICE_ID_APPLE_MAGICTRACKPAD),
+         HID_BATTERY_QUIRK_IGNORE },
        { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ELECOM,
                USB_DEVICE_ID_ELECOM_BM084),
          HID_BATTERY_QUIRK_IGNORE },
@@ -406,6 +409,8 @@ static const struct hid_device_id hid_battery_quirks[] = {
          HID_BATTERY_QUIRK_IGNORE },
        { HID_I2C_DEVICE(USB_VENDOR_ID_ELAN, I2C_DEVICE_ID_HP_SPECTRE_X360_14T_EA100_V2),
          HID_BATTERY_QUIRK_IGNORE },
+       { HID_I2C_DEVICE(USB_VENDOR_ID_ELAN, I2C_DEVICE_ID_HP_ENVY_X360_15_EU0556NG),
+         HID_BATTERY_QUIRK_IGNORE },
        {}
 };
 
@@ -988,6 +993,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
                        return;
 
                case 0x3c: /* Invert */
+                       device->quirks &= ~HID_QUIRK_NOINVERT;
                        map_key_clear(BTN_TOOL_RUBBER);
                        break;
 
@@ -1013,9 +1019,13 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
                case 0x45: /* ERASER */
                        /*
                         * This event is reported when eraser tip touches the surface.
-                        * Actual eraser (BTN_TOOL_RUBBER) is set by Invert usage when
-                        * tool gets in proximity.
+                        * Actual eraser (BTN_TOOL_RUBBER) is set and released either
+                        * by Invert if tool reports proximity or by Eraser directly.
                         */
+                       if (!test_bit(BTN_TOOL_RUBBER, input->keybit)) {
+                               device->quirks |= HID_QUIRK_NOINVERT;
+                               set_bit(BTN_TOOL_RUBBER, input->keybit);
+                       }
                        map_key_clear(BTN_TOUCH);
                        break;
 
@@ -1580,6 +1590,15 @@ void hidinput_hid_event(struct hid_device *hid, struct hid_field *field, struct
                else if (report->tool != BTN_TOOL_RUBBER)
                        /* value is off, tool is not rubber, ignore */
                        return;
+               else if (*quirks & HID_QUIRK_NOINVERT &&
+                        !test_bit(BTN_TOUCH, input->key)) {
+                       /*
+                        * There is no invert to release the tool, let hid_input
+                        * send BTN_TOUCH with scancode and release the tool after.
+                        */
+                       hid_report_release_tool(report, input, BTN_TOOL_RUBBER);
+                       return;
+               }
 
                /* let hid-input set BTN_TOUCH */
                break;