Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Support for remarkable paper pro #92

Open
danimateos opened this issue Oct 17, 2024 · 8 comments
Open

[Feature Request] Support for remarkable paper pro #92

danimateos opened this issue Oct 17, 2024 · 8 comments

Comments

@danimateos
Copy link

I got my remarkable paper pro yesterday and I love it... but I've realized that remarkable_mouse was a huge part of the value proposition of the remarkable 2 for me. I use as a digital whiteboard in lessons and it works great.

I've set up ssh access with the same key that I used for RM2 and it works fine.

when I try to use it as is with the RMPP I get the following error:

[dani@flecha:~] [base] % remouse --debug --key ~/.ssh/remarkable --address 10.11.99.1 
Debugging enabled...
Connecting to input '10.11.99.1'
Pen:/dev/input/event2
Touch:/dev/input/event2
Button:/dev/input/event0
Connected to 10.11.99.1
Chose monitor: Monitor(x=0, y=0, width=1680, height=1050, width_mm=None, height_mm=None, name=None, is_primary=True)
Screen size: (4240, 1050)
Chose monitor: Monitor(x=0, y=0, width=1680, height=1050, width_mm=None, height_mm=None, name=None, is_primary=True)
Traceback (most recent call last):
  File "/Users/dani/opt/mambaforge/bin/remouse", line 8, in <module>
    sys.exit(main())
  File "/Users/dani/opt/mambaforge/lib/python3.10/site-packages/remarkable_mouse/remarkable_mouse.py", line 170, in main
    read_tablet(
  File "/Users/dani/opt/mambaforge/lib/python3.10/site-packages/remarkable_mouse/pynput.py", line 49, in read_tablet
    if codes[e_type][e_code] == 'ABS_X':
KeyError: 65392

The KeyError is different in each run. I've gotten 220, 65392, and 29834 so far.

My naive hope is that it would be enough to update the codes.py dictionary... I have some Python experience so maybe I could help.

@Evidlo
Copy link
Owner

Evidlo commented Oct 17, 2024

Can you try again with the latest commit and this time with the --debug option? That should print out e_type, e_code, etc before the error occurs.

Those are also weirdly large numbers. The biggest e_type is 31 and e_code is 767. Those are defined by libevdev. Maybe the data isn't being unpacked correctly?

@danimateos
Copy link
Author

I cloned the repo and installed using python setup.py install. I got some fresh codes: 40898, 42550, 22872, 35596...

See below:

[dani@flecha:~/repos/remarkable_mouse] [remarkable_mouse] master 25s
± remouse --debug --key ~/.ssh/remarkable --address 10.11.99.1
Debugging enabled...
Connecting to input '10.11.99.1'
Pen:/dev/input/event2
Touch:/dev/input/event2
Button:/dev/input/event0
Connected to 10.11.99.1
Chose monitor: Monitor(x=0, y=0, width=1680, height=1050, width_mm=None, height_mm=None, name=None, is_primary=True)
Screen size: (1680, 1050)
Chose monitor: Monitor(x=0, y=0, width=1680, height=1050, width_mm=None, height_mm=None, name=None, is_primary=True)
Traceback (most recent call last):
  File "/Users/dani/opt/mambaforge/envs/remarkable_mouse/bin/remouse", line 33, in <module>
    sys.exit(load_entry_point('remarkable-mouse==7.1.1', 'console_scripts', 'remouse')())
  File "/Users/dani/opt/mambaforge/envs/remarkable_mouse/lib/python3.10/site-packages/remarkable_mouse-7.1.1-py3.10.egg/remarkable_mouse/remarkable_mouse.py", line 175, in main
  File "/Users/dani/opt/mambaforge/envs/remarkable_mouse/lib/python3.10/site-packages/remarkable_mouse-7.1.1-py3.10.egg/remarkable_mouse/pynput.py", line 49, in read_tablet
KeyError: 40898
[dani@flecha:~/repos/remarkable_mouse] [remarkable_mouse] master 8s 1
± remouse --debug --key ~/.ssh/remarkable --address 10.11.99.1
Debugging enabled...
Connecting to input '10.11.99.1'
Pen:/dev/input/event2
Touch:/dev/input/event2
Button:/dev/input/event0
Connected to 10.11.99.1
Chose monitor: Monitor(x=0, y=0, width=1680, height=1050, width_mm=None, height_mm=None, name=None, is_primary=True)
Screen size: (1680, 1050)
Chose monitor: Monitor(x=0, y=0, width=1680, height=1050, width_mm=None, height_mm=None, name=None, is_primary=True)
Traceback (most recent call last):
  File "/Users/dani/opt/mambaforge/envs/remarkable_mouse/bin/remouse", line 33, in <module>
    sys.exit(load_entry_point('remarkable-mouse==7.1.1', 'console_scripts', 'remouse')())
  File "/Users/dani/opt/mambaforge/envs/remarkable_mouse/lib/python3.10/site-packages/remarkable_mouse-7.1.1-py3.10.egg/remarkable_mouse/remarkable_mouse.py", line 175, in main
  File "/Users/dani/opt/mambaforge/envs/remarkable_mouse/lib/python3.10/site-packages/remarkable_mouse-7.1.1-py3.10.egg/remarkable_mouse/pynput.py", line 49, in read_tablet
KeyError: 42550
[dani@flecha:~/repos/remarkable_mouse] [remarkable_mouse] master 3s 1
± remouse --debug --key ~/.ssh/remarkable --address 10.11.99.1
Debugging enabled...
Connecting to input '10.11.99.1'
Pen:/dev/input/event2
Touch:/dev/input/event2
Button:/dev/input/event0
Connected to 10.11.99.1
Chose monitor: Monitor(x=0, y=0, width=1680, height=1050, width_mm=None, height_mm=None, name=None, is_primary=True)
Screen size: (1680, 1050)
Chose monitor: Monitor(x=0, y=0, width=1680, height=1050, width_mm=None, height_mm=None, name=None, is_primary=True)
Traceback (most recent call last):
  File "/Users/dani/opt/mambaforge/envs/remarkable_mouse/bin/remouse", line 33, in <module>
    sys.exit(load_entry_point('remarkable-mouse==7.1.1', 'console_scripts', 'remouse')())
  File "/Users/dani/opt/mambaforge/envs/remarkable_mouse/lib/python3.10/site-packages/remarkable_mouse-7.1.1-py3.10.egg/remarkable_mouse/remarkable_mouse.py", line 175, in main
  File "/Users/dani/opt/mambaforge/envs/remarkable_mouse/lib/python3.10/site-packages/remarkable_mouse-7.1.1-py3.10.egg/remarkable_mouse/pynput.py", line 49, in read_tablet
KeyError: 22872

@Evidlo
Copy link
Owner

Evidlo commented Oct 22, 2024

Can you log in to the tablet and run this command and paste the output here?

ls -l /dev/input/touchscreen0

Also in /dev/input there should be files like event0, event1, event2, ... that correspond to pen input, touch input, button input, etc.

For each one, can you do cat /dev/input/eventXXX to figure out what input it's associated with? It should show nothing until you touch the screen with stylus/finger or press a button (doesn't exist on rM pro?)

For example, on my rM1 I get this when I run cat /dev/input/event2 and touch the screen with my finger:

[root@reMarkable ~] cat /dev/input/event2
�$g�9
     �$g�5
          �$g�6T�$g�:��$g�4�$g��$g��	5
�$g��	6U�$g��	:_�$g��	4�$g��	�$gf�	�$gf�	6W�$gf�	:H�$gf�	4�$gf�	�$g�X
9�����$g�X
�$g�&5��$g�&6��$g�&:��$g�&4�$g�&�$guM5��$guM:~�$guM4�$guM�$g'w5��$g'w:|�$g'w1�$g'w4�$g'w�$g5��$g6��$g:z�$g0�$g4�$g�$g��5��$g��6��$g��:w�$g��1	�$g��4�$g���$g��5��$g��6��$g��:p�$g���$g^5��$g^6��$g^:j�$g^�$g}J5��$g}J6��$g}J:a�$g}J�$g�t5��$g�t6��$g�t:1�$g�t0	�$g�t4�$g�t�$g�9�����$g�^C

@locallium
Copy link

Greetings, thought I would hop in since I am having the same issue.
Tried doing the latest instructions for the events, this is what I got:

event0 -> power on/off button
event1 -> pen attach/detach
event2 -> stylus interaction (hovering/writing)
event3 -> hand interaction (touching the screen)

@Evidlo
Copy link
Owner

Evidlo commented Oct 23, 2024

@locallium

Thanks. What about these commands:

cat /sys/class/input/event*/device/capabilities/ev
ls -l /dev/input/touchscreen0

Also there's going to be some more work ahead to figure out the new coordinate mappings for all these inputs

  • min/max values for X and Y for touch and stylus inputs
  • coordinates positions relative to screen (e.g. on rm1 and rm2 +X for the stylus is down (towards the charge port), but something different for the touch input)

Once the --debug option is working it should be straightforward to figure this stuff out.

@danimateos
Copy link
Author

Thanks @Evidlo and @locallium !

$ cat /sys/class/input/event*/device/capabilities/ev
3
21
b
b

$ ls -l /dev/input/touchscreen0
lrwxrwxrwx    1 root     root             6 Oct 17 12:39 /dev/input/touchscreen0 -> event2

I'm available to do the remaining work that you mention. Thanks a lot for the responsiveness!!

@Evidlo
Copy link
Owner

Evidlo commented Oct 25, 2024

I've added the rmpro branch which should let you connect to the tablet and at least move the cursor around. It looks like the pen/touch coordinate systems on the Pro are not the same as rm1/rm2. We need to know the new mapping (use the --debug flag).

For example rm1/rm2 looks like this:

       TABLET COORDINATES

        PEN          TOUCH
    +---------+   +---------+
    | X       |   |       Y |
    | |       |   |       | |
    | |       |   |       | |
    | +--- Y  |   |  X ---+ |
    |         |   |         |
    |---------|   |---------|
    | USB PORT|   | USB PORT|
    +---------+   +---------+

@locallium
Copy link

Thanks to both of you!

Installed the new branch, it did let me connect. Unfortunately, it does not move the cursor. Also it throws the following error just as soon as I touch the screen with my finger.

Debugging enabled...
Connecting to input '10.11.99.1'
Password for '10.11.99.1':
Pen:/dev/input/event3
Touch:/dev/input/event2
Button:/dev/input/event0
Connected to 10.11.99.1
Chose monitor: Monitor(x=0, y=0, width=2560, height=1440, width_mm=597, height_mm=336, name='\\\\.\\DISPLAY1', is_primary=True)
Screen size: (5120, 1440)
Chose monitor: Monitor(x=0, y=0, width=2560, height=1440, width_mm=597, height_mm=336, name='\\\\.\\DISPLAY1', is_primary=True)
Traceback (most recent call last):
  File "C:\Users\lauri\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\lauri\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Users\lauri\AppData\Local\Programs\Python\Python310\Scripts\remouse.exe\__main__.py", line 7, in <module>
  File "C:\Users\lauri\AppData\Local\Programs\Python\Python310\lib\site-packages\remarkable_mouse\remarkable_mouse.py", line 175, in main
    read_tablet(
  File "C:\Users\lauri\AppData\Local\Programs\Python\Python310\lib\site-packages\remarkable_mouse\pynput.py", line 49, in read_tablet
    if codes[e_type][e_code] == 'ABS_X':
KeyError: 61892

I've noticed that the events are different, I'm not sure whether that changes anything, just something I've noticed 😅.
Running the previous command also outputs a different event from the one @danimateos had. Again, unsure whether that changes anything, but I just wanted to let you know.

$ ls -l /dev/input/touchscreen0
lrwxrwxrwx    1 root     root             6 Oct 25 23:07 /dev/input/touchscreen0 -> event3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants