reMarkableWiki

Everything about the reMarkable Paper Tablet

User Tools

Site Tools


Sidebar

Topics

devel:handling_input

Handling Input

Reading raw events

Both reMarkable devices have 3 distinct devices:

Name Path on rM 1 Path on rM 2
Wacom Digitizer (Pen input) /dev/input/event0 /dev/input/event1
Multitouch (Finger input) /dev/input/event1 /dev/input/event2
GPIO (Buttons) /dev/input/event2 /dev/input/event0

These devices are standard linux evdev devices. This struct are the binary packets it spits out. All input event codes can be found here (or here for relevant codes per device).

Toltec includes an evtest tool which might come handy during debugging. It gives you human readable output out of the evdev files. Here is also a simple python example that reads out the data of the Wacom pen without any libraries on the rM 1 (but every major programming language has a evdev library to make it easier).

Note that many launchers may grab, inject/overflow or intercept these input events to make switching between multiple running programs possible.

Here is an example of debugging the GPIO (Buttons) device and pressing the middle button on once (on a reMarkable 1):

reMarkable: /home/root/ evtest
No device specified, trying to scan all of /dev/input/event*
Available devices:
/dev/input/event0:      Wacom I2C Digitizer
/dev/input/event1:      cyttsp5_mt
/dev/input/event2:      gpio-keys
Select the device event number [0-2]: 2
Input driver version is 1.0.1
Input device ID: bus 0x19 vendor 0x1 product 0x1 version 0x100
Input device name: "gpio-keys"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
    Event code 102 (KEY_HOME)
    Event code 105 (KEY_LEFT)
    Event code 106 (KEY_RIGHT)
    Event code 116 (KEY_POWER)
    Event code 143 (KEY_WAKEUP)
Properties:
Testing ... (interrupt to exit)
Event: time 1611410679.061331, type 1 (EV_KEY), code 102 (KEY_HOME), value 1
Event: time 1611410679.061331, -------------- EV_SYN ------------
Event: time 1611410679.191312, type 1 (EV_KEY), code 102 (KEY_HOME), value 0
Event: time 1611410679.191312, -------------- EV_SYN ------------

libremarkable is a library for the reMarkable in Rust that contains logic to read the inputs of both the reMarkable 1 and 2.

QT applications also support most types of input by default with the provided libraries. Though you might also want to look into Oxide's APIs for improved multitasking support / launcher integration.

Oxide

Oxide handles informing you of buttons being held in the API, but not normal button presses. Oxide never lets power button presses through (code, so only useful for rM1).

You have triggers in the Oxide API for when your device wakes from sleep (deviceResuming, but make sure your app is a background(able) app).

A bug to be aware of when using Oxide: Launching remarkable-hacks patched xochitl with Oxide breaks L+R shortcut for Zen Mode

Draft

You can have a look at button-capture-reMarkable (don't know whether this still works).

Full Outputs of evtest for RM1 and RM2

RM1: event0, Wacom I2C Digitizer

reMarkable: ~/ evtest /dev/input/event0
Input driver version is 1.0.1
Input device ID: bus 0x18 vendor 0x56a product 0x0 version 0x36
Input device name: "Wacom I2C Digitizer"
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)
      Value  20246
      Min        0
      Max    20967
    Event code 1 (ABS_Y)
      Value  13733
      Min        0
      Max    15725
    Event code 24 (ABS_PRESSURE)
      Value      0
      Min        0
      Max     4095
    Event code 25 (ABS_DISTANCE)
      Value     62
      Min        0
      Max      255
    Event code 26 (ABS_TILT_X)
      Value      0
      Min    -9000
      Max     9000
    Event code 27 (ABS_TILT_Y)
      Value      0
      Min    -9000
      Max     9000

RM1: event1, touchscreen

reMarkable: ~/ evtest /dev/input/event1
Input driver version is 1.0.1
Input device ID: bus 0x0 vendor 0x0 product 0x0 version 0x0
Input device name: "cyttsp5_mt"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
  Event type 2 (EV_REL)
  Event type 3 (EV_ABS)
    Event code 25 (ABS_DISTANCE)
      Value      0
      Min        0
      Max      255
    Event code 47 (ABS_MT_SLOT)
      Value      0
      Min        0
      Max       31
    Event code 48 (ABS_MT_TOUCH_MAJOR)
      Value      0
      Min        0
      Max      255
    Event code 49 (ABS_MT_TOUCH_MINOR)
      Value      0
      Min        0
      Max      255
    Event code 52 (ABS_MT_ORIENTATION)
      Value      0
      Min     -127
      Max      127
    Event code 53 (ABS_MT_POSITION_X)
      Value      0
      Min        0
      Max      767
    Event code 54 (ABS_MT_POSITION_Y)
      Value      0
      Min        0
      Max     1023
    Event code 55 (ABS_MT_TOOL_TYPE)
      Value      0
      Min        0
      Max        1
    Event code 57 (ABS_MT_TRACKING_ID)
      Value      0
      Min        0
      Max    65535
    Event code 58 (ABS_MT_PRESSURE)
      Value      0
      Min        0
      Max      255
 

RM1: event2, GPIO buttons

reMarkable: ~/ evtest /dev/input/event2
Input driver version is 1.0.1
Input device ID: bus 0x19 vendor 0x1 product 0x1 version 0x100
Input device name: "gpio-keys"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
    Event code 102 (KEY_HOME)
    Event code 105 (KEY_LEFT)
    Event code 106 (KEY_RIGHT)
    Event code 116 (KEY_POWER)
    Event code 143 (KEY_WAKEUP)

RM2: event0, Power Button

reMarkable: ~/ evtest /dev/input/event0
Input driver version is 1.0.1
Input device ID: bus 0x19 vendor 0x0 product 0x0 version 0x0
Input device name: "30370000.snvs:snvs-powerkey"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
    Event code 116 (KEY_POWER)

RM2: event1, Wacom I2C digitizer

reMarkable: ~/ evtest /dev/input/event1
Input driver version is 1.0.1
Input device ID: bus 0x18 vendor 0x56a product 0x0 version 0x31
Input device name: "Wacom I2C Digitizer"
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)
      Value   5291
      Min        0
      Max    20966
    Event code 1 (ABS_Y)
      Value  10464
      Min        0
      Max    15725
    Event code 24 (ABS_PRESSURE)
      Value      0
      Min        0
      Max     4095
    Event code 25 (ABS_DISTANCE)
      Value     78
      Min        0
      Max      255
    Event code 26 (ABS_TILT_X)
      Value  -2800
      Min    -9000
      Max     9000
    Event code 27 (ABS_TILT_Y)
      Value   2900
      Min    -9000
      Max     9000

RM2: event2, touchscreen

reMarkable: ~/ evtest /dev/input/event2
Input driver version is 1.0.1
Input device ID: bus 0x0 vendor 0x0 product 0x0 version 0x0
Input device name: "pt_mt"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
    Event code 59 (KEY_F1)
    Event code 60 (KEY_F2)
    Event code 61 (KEY_F3)
    Event code 62 (KEY_F4)
    Event code 63 (KEY_F5)
    Event code 64 (KEY_F6)
    Event code 65 (KEY_F7)
    Event code 66 (KEY_F8)
  Event type 2 (EV_REL)
  Event type 3 (EV_ABS)
    Event code 25 (ABS_DISTANCE)
      Value      0
      Min        0
      Max      255
    Event code 47 (ABS_MT_SLOT)
      Value      0
      Min        0
      Max       31
    Event code 48 (ABS_MT_TOUCH_MAJOR)
      Value      0
      Min        0
      Max      255
    Event code 49 (ABS_MT_TOUCH_MINOR)
      Value      0
      Min        0
      Max      255
    Event code 52 (ABS_MT_ORIENTATION)
      Value      0
      Min     -127
      Max      127
    Event code 53 (ABS_MT_POSITION_X)
      Value      0
      Min        0
      Max     1403
    Event code 54 (ABS_MT_POSITION_Y)
      Value      0
      Min        0
      Max     1871
    Event code 55 (ABS_MT_TOOL_TYPE)
      Value      0
      Min        0
      Max        1
    Event code 57 (ABS_MT_TRACKING_ID)
      Value      0
      Min        0
      Max    65535
    Event code 58 (ABS_MT_PRESSURE)
      Value      0
      Min        0
      Max      255
This website uses cookies for visitor traffic analysis. By using the website, you agree with storing the cookies on your computer.More information
devel/handling_input.txt · Last modified: 2021/06/20 00:31 by isaacwisdom