]> Git Repo - linux.git/commitdiff
Merge branch 'for-6.13/wacom' into for-linus
authorJiri Kosina <[email protected]>
Mon, 18 Nov 2024 20:29:33 +0000 (21:29 +0100)
committerJiri Kosina <[email protected]>
Mon, 18 Nov 2024 20:29:33 +0000 (21:29 +0100)
- Sanitization of BTN_TOOL_RUBBER handling (Jason Gerecke)

1  2 
drivers/hid/hid-core.c
drivers/hid/i2c-hid/i2c-hid-core.c
drivers/hid/wacom_wac.c

diff --combined drivers/hid/hid-core.c
index 4aee4eae50fd38b4ec28b1ce6e132c59abf7c479,612ee6ddfc8db01228f9a4b960c709713864ac23..582fd234eec7892c3e0f0a64884d4c9bd054cc68
@@@ -20,7 -20,7 +20,7 @@@
  #include <linux/list.h>
  #include <linux/mm.h>
  #include <linux/spinlock.h>
- #include <asm/unaligned.h>
+ #include <linux/unaligned.h>
  #include <asm/byteorder.h>
  #include <linux/input.h>
  #include <linux/wait.h>
@@@ -1875,7 -1875,7 +1875,7 @@@ u8 *hid_alloc_report_buf(struct hid_rep
  
        u32 len = hid_report_len(report) + 7;
  
 -      return kmalloc(len, flags);
 +      return kzalloc(len, flags);
  }
  EXPORT_SYMBOL_GPL(hid_alloc_report_buf);
  
index 8914c7db94718feab8e7577c185ecbf8ba1a4ef5,be5d342d5d13c05272377977141f85711014885f..43664a24176fca008977b860537817b4941b950e
@@@ -36,7 -36,7 +36,7 @@@
  #include <linux/kernel.h>
  #include <linux/hid.h>
  #include <linux/mutex.h>
- #include <asm/unaligned.h>
+ #include <linux/unaligned.h>
  
  #include <drm/drm_panel.h>
  
@@@ -50,7 -50,6 +50,7 @@@
  #define I2C_HID_QUIRK_BAD_INPUT_SIZE          BIT(3)
  #define I2C_HID_QUIRK_NO_WAKEUP_AFTER_RESET   BIT(4)
  #define I2C_HID_QUIRK_NO_SLEEP_ON_SUSPEND     BIT(5)
 +#define I2C_HID_QUIRK_DELAY_WAKEUP_AFTER_RESUME BIT(6)
  
  /* Command opcodes */
  #define I2C_HID_OPCODE_RESET                  0x01
@@@ -141,8 -140,6 +141,8 @@@ static const struct i2c_hid_quirks 
        { USB_VENDOR_ID_ELAN, HID_ANY_ID,
                 I2C_HID_QUIRK_NO_WAKEUP_AFTER_RESET |
                 I2C_HID_QUIRK_BOGUS_IRQ },
 +      { I2C_VENDOR_ID_GOODIX, I2C_DEVICE_ID_GOODIX_0D42,
 +               I2C_HID_QUIRK_DELAY_WAKEUP_AFTER_RESUME },
        { 0, 0 }
  };
  
@@@ -984,13 -981,6 +984,13 @@@ static int i2c_hid_core_resume(struct i
                return -ENXIO;
        }
  
 +      /* On Goodix 27c6:0d42 wait extra time before device wakeup.
 +       * It's not clear why but if we send wakeup too early, the device will
 +       * never trigger input interrupts.
 +       */
 +      if (ihid->quirks & I2C_HID_QUIRK_DELAY_WAKEUP_AFTER_RESUME)
 +              msleep(1500);
 +
        /* Instead of resetting device, simply powers the device on. This
         * solves "incomplete reports" on Raydium devices 2386:3118 and
         * 2386:4B33 and fixes various SIS touchscreens no longer sending
diff --combined drivers/hid/wacom_wac.c
index 5a599c90e7a2c79ef00abc9f657962533c947f6d,fd0de9bae3d9a60ac6efb16974454ae3be6183a8..5501a560fb07ff574a49cff4148996b34b8c9fc4
@@@ -1353,9 -1353,9 +1353,9 @@@ static void wacom_intuos_pro2_bt_pen(st
                                        rotation -= 1800;
  
                                input_report_abs(pen_input, ABS_TILT_X,
 -                                               (char)frame[7]);
 +                                               (signed char)frame[7]);
                                input_report_abs(pen_input, ABS_TILT_Y,
 -                                               (char)frame[8]);
 +                                               (signed char)frame[8]);
                                input_report_abs(pen_input, ABS_Z, rotation);
                                input_report_abs(pen_input, ABS_WHEEL,
                                                 get_unaligned_le16(&frame[11]));
@@@ -2422,9 -2422,11 +2422,11 @@@ static void wacom_wac_pen_event(struct 
                        wacom_wac->hid_data.sense_state = value;
                return;
        case HID_DG_INVERT:
-               wacom_wac->hid_data.invert_state = value;
+               wacom_wac->hid_data.eraser |= value;
                return;
        case HID_DG_ERASER:
+               wacom_wac->hid_data.eraser |= value;
+               fallthrough;
        case HID_DG_TIPSWITCH:
                wacom_wac->hid_data.tipswitch |= value;
                return;
@@@ -2565,7 -2567,7 +2567,7 @@@ static void wacom_wac_pen_report(struc
  
        if (entering_range) { /* first in range */
                /* Going into range select tool */
-               if (wacom_wac->hid_data.invert_state)
+               if (wacom_wac->hid_data.eraser)
                        wacom_wac->tool[0] = BTN_TOOL_RUBBER;
                else if (wacom_wac->features.quirks & WACOM_QUIRK_AESPEN)
                        wacom_wac->tool[0] = BTN_TOOL_PEN;
                }
  
                wacom_wac->hid_data.tipswitch = false;
+               wacom_wac->hid_data.eraser = false;
  
                input_sync(input);
        }
This page took 0.080597 seconds and 4 git commands to generate.