diff mbox series

[v12,2/3] HID: quirks: Invert X/Y values for rM2 Wacom

Message ID 20211021095107.116292-2-alistair@alistair23.me (mailing list archive)
State New, archived
Headers show
Series [v12,1/3] HID: quirks: Allow inverting the absolute X/Y values | expand

Commit Message

Alistair Francis Oct. 21, 2021, 9:51 a.m. UTC
Enable the HID_QUIRK_XY_INVERT quirk for the Wacom digitiser used on the
reMarkable 2.

Signed-off-by: Alistair Francis <alistair@alistair23.me>
---
 drivers/hid/hid-ids.h    | 2 ++
 drivers/hid/hid-quirks.c | 1 +
 2 files changed, 3 insertions(+)

Comments

Benjamin Tissoires Oct. 21, 2021, 10:05 a.m. UTC | #1
On Thu, Oct 21, 2021 at 11:51 AM Alistair Francis
<alistair@alistair23.me> wrote:
>
> Enable the HID_QUIRK_XY_INVERT quirk for the Wacom digitiser used on the
> reMarkable 2.
>
> Signed-off-by: Alistair Francis <alistair@alistair23.me>
> ---
>  drivers/hid/hid-ids.h    | 2 ++
>  drivers/hid/hid-quirks.c | 1 +
>  2 files changed, 3 insertions(+)
>
> diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
> index 29564b370341..9dc17bf3e550 100644
> --- a/drivers/hid/hid-ids.h
> +++ b/drivers/hid/hid-ids.h
> @@ -1260,8 +1260,10 @@
>  #define USB_DEVICE_ID_VTL_MULTITOUCH_FF3F      0xff3f
>
>  #define USB_VENDOR_ID_WACOM            0x056a
> +#define USB_VENDOR_ID_WACOM_HID                0x2D1F
>  #define USB_DEVICE_ID_WACOM_GRAPHIRE_BLUETOOTH 0x81
>  #define USB_DEVICE_ID_WACOM_INTUOS4_BLUETOOTH   0x00BD
> +#define I2C_DEVICE_ID_WACOM_REMARKABLE2                0x0095
>
>  #define USB_VENDOR_ID_WALTOP                           0x172f
>  #define USB_DEVICE_ID_WALTOP_SLIM_TABLET_5_8_INCH      0x0032
> diff --git a/drivers/hid/hid-quirks.c b/drivers/hid/hid-quirks.c
> index 2e104682c22b..b081af3329a5 100644
> --- a/drivers/hid/hid-quirks.c
> +++ b/drivers/hid/hid-quirks.c
> @@ -186,6 +186,7 @@ static const struct hid_device_id hid_quirks[] = {
>         { HID_USB_DEVICE(USB_VENDOR_ID_TURBOX, USB_DEVICE_ID_TURBOX_KEYBOARD), HID_QUIRK_NOGET },
>         { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_KNA5), HID_QUIRK_MULTI_INPUT },
>         { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_TWA60), HID_QUIRK_MULTI_INPUT },
> +       { HID_I2C_DEVICE(USB_VENDOR_ID_WACOM_HID, I2C_DEVICE_ID_WACOM_REMARKABLE2), HID_QUIRK_XY_INVERT },

Well, there is no guarantee that this PID will always be installed in
this particular configuration.

Can you instead set the quirk in i2c_hid?:
- retrieve that information from the DT in
drivers/hid/i2c-hid/i2c-hid-of.c (with the generic touchscreen OF
properties)
- amend the signature of i2c_hid_core_probe() to account for extra quirks
- after having allocated the device, add the provided quirks

Then I still need to figure out how we can add tests for the quirk.

Cheers,
Benjamin

>         { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_MEDIA_TABLET_10_6_INCH), HID_QUIRK_MULTI_INPUT },
>         { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_MEDIA_TABLET_14_1_INCH), HID_QUIRK_MULTI_INPUT },
>         { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_SIRIUS_BATTERY_FREE_TABLET), HID_QUIRK_MULTI_INPUT },
> --
> 2.31.1
>
diff mbox series

Patch

diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 29564b370341..9dc17bf3e550 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -1260,8 +1260,10 @@ 
 #define USB_DEVICE_ID_VTL_MULTITOUCH_FF3F	0xff3f
 
 #define USB_VENDOR_ID_WACOM		0x056a
+#define USB_VENDOR_ID_WACOM_HID		0x2D1F
 #define USB_DEVICE_ID_WACOM_GRAPHIRE_BLUETOOTH	0x81
 #define USB_DEVICE_ID_WACOM_INTUOS4_BLUETOOTH   0x00BD
+#define I2C_DEVICE_ID_WACOM_REMARKABLE2		0x0095
 
 #define USB_VENDOR_ID_WALTOP				0x172f
 #define USB_DEVICE_ID_WALTOP_SLIM_TABLET_5_8_INCH	0x0032
diff --git a/drivers/hid/hid-quirks.c b/drivers/hid/hid-quirks.c
index 2e104682c22b..b081af3329a5 100644
--- a/drivers/hid/hid-quirks.c
+++ b/drivers/hid/hid-quirks.c
@@ -186,6 +186,7 @@  static const struct hid_device_id hid_quirks[] = {
 	{ HID_USB_DEVICE(USB_VENDOR_ID_TURBOX, USB_DEVICE_ID_TURBOX_KEYBOARD), HID_QUIRK_NOGET },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_KNA5), HID_QUIRK_MULTI_INPUT },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_TWA60), HID_QUIRK_MULTI_INPUT },
+	{ HID_I2C_DEVICE(USB_VENDOR_ID_WACOM_HID, I2C_DEVICE_ID_WACOM_REMARKABLE2), HID_QUIRK_XY_INVERT },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_MEDIA_TABLET_10_6_INCH), HID_QUIRK_MULTI_INPUT },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_MEDIA_TABLET_14_1_INCH), HID_QUIRK_MULTI_INPUT },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_SIRIUS_BATTERY_FREE_TABLET), HID_QUIRK_MULTI_INPUT },