reMarkable / linux

Linux kernel for reMarkable 1 & 2. zero-sugar is rM2 and zero-gravitas is rM1.
Other
283 stars 41 forks source link

Support mainline Wacom inputs in Xochitl #15

Open alistair23 opened 2 years ago

alistair23 commented 2 years ago

There is support for the Wacom I2C input device in the mainline kernel. It's not using the old wacom_i2c driver, but instead uses the hid-over-i2c driver.

The new driver (with Linux 5.18) works with most userspace software on the rM2 but it doesn't work with Xochitl. When using the hid-over-i2c driver Xochitl doesn't detect any Wacom stylus events.

I'm not sure why, but I would guess Xochitl is expecting some hardcoded condition that is no longer true with the generic driver. Can you please look into fixing this? As Xochitl is closed source I'm unable to. Let me know if there is a startup log or other information that would be useful and I can attach it

@schultzern

matteodelabre commented 2 years ago

Xochitl logs give a clue:

rm.digitizer             Device  "/dev/input/event2"  has no distance axis

When running evtest to check the axis reported by the driver, one can see that the ABS_DISTANCE axis is indeed missing when using the hid-over-i2c driver. Here’s a diff of the evtest output for hid-over-i2c against the output for wacom_i2c (omitting the lines showing the current axis value):

--- wacom_i2c   2022-06-25 18:20:30.341879716 -0400
+++ hid-over-i2c    2022-06-25 18:20:23.633675712 -0400
@@ -1,38 +1,50 @@
 Input driver version is 1.0.1
-Input device ID: bus 0x18 vendor 0x56a product 0x0 version 0x31
-Input device name: "Wacom I2C Digitizer"
+Input device ID: bus 0x18 vendor 0x2d1f product 0x95 version 0x100
+Input device name: "hid-over-i2c 2D1F:0095 Stylus"
 Supported events:
   Event type 0 (EV_SYN)
   Event type 1 (EV_KEY)
     Event code 320 (BTN_TOOL_PEN)
     Event code 321 (BTN_TOOL_RUBBER)
     Event code 330 (BTN_TOUCH)
     Event code 331 (BTN_STYLUS)
     Event code 332 (BTN_STYLUS2)
   Event type 3 (EV_ABS)
     Event code 0 (ABS_X)
       Min        0
       Max    20966
       Resolution     100
     Event code 1 (ABS_Y)
       Min        0
       Max    15725
       Resolution     100
+    Event code 2 (ABS_Z)
+      Min     -255
+      Max        0
+      Resolution      10
     Event code 24 (ABS_PRESSURE)
       Min        0
       Max     4095
-    Event code 25 (ABS_DISTANCE)
-      Min        0
-      Max      255
     Event code 26 (ABS_TILT_X)
       Min    -9000
       Max     9000
+      Resolution    5730
     Event code 27 (ABS_TILT_Y)
       Min    -9000
       Max     9000
+      Resolution    5730
+    Event code 40 (ABS_MISC)
+      Min        0
+      Max        3
+  Event type 4 (EV_MSC)
+    Event code 4 (MSC_SCAN)
+Properties:
+  Property type 1 (INPUT_PROP_DIRECT)