Giter VIP home page Giter VIP logo

remarkable_mouse's Introduction

remarkable_mouse

Use your reMarkable as a graphics tablet.

Special thanks to canselcik and LinusCDE for inspiration.

Quick Start

On the host machine with the tablet plugged in via USB:

pip install remarkable-mouse
remouse

By default, 10.11.99.1 is used as the address. Find your password in the reMarkable's settings menu. If you are on Linux using X11, you can use the --evdev option for pressure support.

To use the --region flag, you may need to install the python3-tk or python3-tkinter package with your package manager.

Examples

specify monitor, orientation, password

remouse --orientation right --mode fit --monitor 1 --password foobar

passwordless login

ssh-keygen -m PEM -t rsa -f ~/.ssh/remarkable -N ''
ssh-copy-id -i ~/.ssh/remarkable.pub [email protected]
remouse

running with pressure sensitivity (Linux only)

sudo --preserve-env=USER,PATH env remouse --evdev

Usage

usage: remouse [-h] [--debug] [--key PATH] [--password PASSWORD] [--address ADDRESS] [--mode {fit,fill,stretch}] [--orientation {top,left,right,bottom}] [--monitor NUM] [--region] [--threshold THRESH]
               [--evdev]

use reMarkable tablet as a mouse input

optional arguments:
  -h, --help            show this help message and exit
  --debug               enable debug messages
  --key PATH            ssh private key
  --password PASSWORD   ssh password
  --address ADDRESS     device address
  --mode {fit,fill,stretch}
                        Scale setting. Fit (default): take up the entire tablet, but not necessarily the entire monitor. Fill: take up the entire monitor, but not necessarily the entire tablet. Stretch:
                        take up both the entire tablet and monitor, but don't maintain aspect ratio.
  --orientation {top,left,right,bottom}
                        position of tablet buttons
  --monitor NUM         monitor to output to
  --region              Use a GUI to position the output area. Overrides --monitor
  --threshold THRESH    stylus pressure threshold (default 600)
  --evdev               use evdev to support pen pressure (requires root, Linux only)

remarkable_mouse's People

Contributors

bennofs avatar bordaigorl avatar bsiegel avatar catskul avatar chabad360 avatar dmelcer9 avatar evidlo avatar laib3 avatar linuscde avatar matteodelabre avatar morgaesis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

remarkable_mouse's Issues

SSH key format issue, paramiko

paramiko.ssh_exception.SSHException: not a valid RSA private key file

I guess I'm using a newer version of openssh. Not sure why this hasn't been handled upstream yet, but it's pretty annoying. The workaround mentioned here to generate new keys seems to have worked:

ssh-keygen -m PEM -t rsa

paramiko/paramiko#1015 (comment)

Don't pass around `args` object

I believe that passing container objects like args to all your subroutines is eventually asking for trouble. By using such a container, functions are allowed to hide what fields of the container they are actually using. And those functions are not reusable, as I have to first create an args container with all the right fields.

If you search for args you will find it is used in open_remote_device(), pipe_device(), and read_tablet(). But actually

  • open_input_device() is using args.address, and optionally args.key and args.password.
  • pipe_device() is using args.orientation, args.monitor, args.threshold, args.mode, and args.debug
  • read_tablet() is using args.orientation, args.monitor, args.threshold, and args.mode

That fact is completely hidden in the generic function(args) interface.

Instead of a function

def foo(args):
    print(args.address, args.debug)

foo(args)

I would recommend unpacking the arguments in the call

def foo(address, debug=False)
    print(address, debug)

foo(args.address, args.debug)

undefined symbol: libevdev_event_value_get_name

When I run remouse with --evdev, it crashes after Debugging enabled...:

Traceback (most recent call last):
  File "/home/ash/.local/bin/remouse", line 8, in <module>
    sys.exit(main())
  File "/home/ash/.local/venvs/remarkable-mouse/lib/python3.8/site-packages/remarkable_mouse/remarkable_mouse.py", line 108, in main
    local_device = create_local_device()
  File "/home/ash/.local/venvs/remarkable-mouse/lib/python3.8/site-packages/remarkable_mouse/evdev.py", line 25, in create_local_device
    import libevdev
  File "/home/ash/.local/venvs/remarkable-mouse/lib/python3.8/site-packages/libevdev/__init__.py", line 23, in <module>
    from .device import Device, InputAbsInfo
  File "/home/ash/.local/venvs/remarkable-mouse/lib/python3.8/site-packages/libevdev/device.py", line 29, in <module>
    from .event import InputEvent
  File "/home/ash/.local/venvs/remarkable-mouse/lib/python3.8/site-packages/libevdev/event.py", line 23, in <module>
    from .const import EventType, EventCode
  File "/home/ash/.local/venvs/remarkable-mouse/lib/python3.8/site-packages/libevdev/const.py", line 413, in <module>
    _load_consts()
  File "/home/ash/.local/venvs/remarkable-mouse/lib/python3.8/site-packages/libevdev/const.py", line 338, in _load_consts
    Libevdev()  # classmethods, need to make sure it's loaded at once
  File "/home/ash/.local/venvs/remarkable-mouse/lib/python3.8/site-packages/libevdev/_clib.py", line 395, in __init__
    super(Libevdev, self).__init__()
  File "/home/ash/.local/venvs/remarkable-mouse/lib/python3.8/site-packages/libevdev/_clib.py", line 76, in __init__
    self._load()
  File "/home/ash/.local/venvs/remarkable-mouse/lib/python3.8/site-packages/libevdev/_clib.py", line 85, in _load
    func = getattr(cls._lib, name)
  File "/usr/local/lib/python3.8/ctypes/__init__.py", line 382, in __getattr__
    func = self.__getitem__(name)
  File "/usr/local/lib/python3.8/ctypes/__init__.py", line 387, in __getitem__
    func = self._FuncPtr((name_or_ordinal, self))
AttributeError: /usr/lib/x86_64-linux-gnu/libevdev.so.2: undefined symbol: libevdev_event_value_get_name

I'm on Ubuntu 18.04; is this just "your system libevdev is too old"?

evdev: libinput ignores the events because tablet resolution is missing

Step to reproduce on Ubuntu 19.10, running wayland:

  • start remouse like that:
$ sudo remouse --evdev --key ~/.ssh/remarkable
Created virtual input device '/dev/input/event5'
  • no virtual tablet is created/visible

  • Running libinput list-devices return the following error:

$ sudo libinput list-devices
event5  - reMarkable tablet: libinput bug: missing tablet capabilities: resolution. Ignoring this device.

According to libinput documentation, we need to specify the resolution of the tablet in a 60-evdev.hwdb entry.

Can't get this to work on OSX with a RM2

Hi,
I have been trying this on OSX with my brand new RM2 and there's no way to get it to work.
I added debug code and the code hangs while making the syscall
remote_device.read(16)
in
_, _, e_type, e_code, e_value = struct.unpack('2IHHi', remote_device.read(16))
in file pynput.py

I checked and the code tries to open device file: /dev/input/event0 but no such file exists on my mac when I connect my RM2. Is there anything I should enable on the RM2 for this to work?

doesnt connect, issues with shh might be related.

when i try to connect it gives me an error about paramiko not being installed (i tried to use the sudo command cause one post said something about trying it in root) and i also saw something in another post about seeing wether or not you could connect to the tablet with shh and i did some research but i dont seem to have it, even when i installed openshh it didn't end up working, this might be the problem but this is completely out of my area of expertise, does anyone know what the issue might be or how i could solve it? (the same issue is happening with remouseable which i had used on windows and ubuntu before i just switched to arch and the problems started)

Remarkable pen not found on RM2

I have installed the remouse with pip3
running it as bellow and getting errors

$ sudo remouse --address XX.XX.XX.XX --orientation top   --password XXXXXXXXXXX --debug --evdev
connected to XX.XX.XX.XX
Debugging enabled...
Created virtual input device '/dev/input/event18'
Error setting orientation: b'unable to find device reMarkable tablet stylus\n'
Chose monitor: Monitor(x=0, y=0, width=1920, height=1080, width_mm=340, height_mm=190, name='eDP1')
Error setting monitor: b"unable to find device 'reMarkable tablet stylus'\n"
Error setting pressure threshold: b'unable to find device reMarkable tablet stylus\n'
Wacom tablet area: 6060.843750000001 9.311070433189646e-13 14906.15625 15724.999999999998
Error setting fit: b'unable to find device reMarkable tablet stylus\n'

Running on arch Linux also tested the same on fedora gnome

Report pressure to the host

While remarkable_mouse does have access to the pressure information from the tablet, it is not reported to the host operating system, as pynput does not support it. This is unfortunate, as many graphic applications would benefit a lot of having that information.

Maybe one option would be to use a module like python-uinput to recreate a fake input device?

No argument --event-file

I'm trying to make remouse work with my RM2 and hence tried

remouse --event-file /dev/input/event1

However, my machine claims

unrecognized arguments: --event-file /dev/input/event1

In fact, when I run

remouse -h

I get

usage: remouse [-h] [--debug] [--key PATH] [--password PASSWORD]
[--address ADDRESS] [--mode {fit,fill}]
[--orientation {top,left,right,bottom}] [--monitor NUM]
[--threshold THRESH] [--evdev]

use reMarkable tablet as a mouse input

optional arguments:
-h, --help show this help message and exit
--debug enable debug messages
--key PATH ssh private key
--password PASSWORD ssh password
--address ADDRESS device address
--mode {fit,fill} scale setting
--orientation {top,left,right,bottom}
position of tablet buttons
--monitor NUM monitor to output to
--threshold THRESH stylus pressure threshold (default 600)
--evdev use evdev to support pen pressure (requires root,
Linux only)

Any suggestion as to what's wrong here and possible solutions?

Reduced space on the reMarkable for writing

I had to modify the pynput.py to make this work on MacOS. As suggested in another thread, I added this to avoid the call to get_monitors:
monitor = Monitor(
x=0,
y=0,
width=2560,
height=1440
)
The data above correspond with the resolution of my screen. Besides, I have been able to obtain those data using screeninfo in a simple Python script of my own.

Then I can run "remouse --orientation vertical" successfully, but the problem is that an important part of the top of the reMarkable screen correspond to the top part of my MacOS screen (i.e., I have to start writing on the reMarkable without using about 1/3 of its screen at the top).

Not sure if this behavior is expected...

Default should be ssh config

Currently the default for address and ssh key is hard-coded as 10.11.99.1 and ~/.ssh/id_rsa.

I suggest that instead the ssh config at ~/.ssh/config be used, and only if the remarkable host is not defined we fall back to the hard-coded values.

[osx] screeninfo.common.ScreenInfoError: No enumerators available

Hello, I've come across a weird issue on OSX:

Osx: 10.14.6
python: 3.7 (and 3.9) (installed with brew)
command: remouse --address 192.168.0.178 --key ~/.ssh/remarkable

Error:
screeninfo.common.ScreenInfoError: No enumerators available

Digging deeper I found out the error is raised from
ns_framework = autoclass('NSString').stringWithUTF8String_(framework)
in dependency's dependency of screeninfo: pyobjus .

homebrew/lib/python3.7/site-packages/pyobjus/dylib_manager.py", line 185, in load_framework
ns_framework = autoclass('NSString').stringWithUTF8String_(framework)
File "pyobjus/pyobjus.pyx", line 475, in pyobjus.ObjcMethod.__call__
File "pyobjus/pyobjus_conversions.pxi", line 240, in pyobjus.convert_cy_ret_to_py
File "pyobjus/pyobjus_conversions.pxi", line 181, in pyobjus.convert_to_cy_cls_instance
File "pyobjus/pyobjus.pyx", line 711, in pyobjus.autoclass
File "pyobjus/pyobjus.pyx", line 598, in pyobjus.resolve_super_class_methods
File "pyobjus/pyobjus.pyx", line 514, in pyobjus.class_get_methods
File "pyobjus/pyobjus.pyx", line 506, in pyobjus.objc_method_to_py
File "pyobjus/pyobjus.pyx", line 226, in pyobjus.ObjcMethod.__init__
File "pyobjus/type_enc.pxi", line 13, in pyobjus.parse_signature
File "pyobjus/type_enc.pxi", line 2, in pyobjus.seperate_encoding
IndexError: list index out of range

Packages installed:

python3.7 -m pip freeze
bcrypt==3.2.0
cffi==1.14.3
cryptography==3.2.1
Cython==0.29.21
libevdev==0.9
paramiko==2.7.2
pycparser==2.20
PyNaCl==1.4.0
pynput==1.7.1
pyobjc-core==6.2.2
pyobjc-framework-Cocoa==6.2.2
pyobjc-framework-Quartz==6.2.2
pyobjus==1.1.0
remarkable-mouse==5.2.1
screeninfo==0.6.6
six==1.15.0

The problem only happens when it is called in remouse. Following code in an interpreter just works:

from screeninfo import get_monitors
for m in get_monitors():
    print(str(m))

Any lead for me to further investigate what's going on?

Issue with mouse events in browser

This is a great program! Thanks!

I managed to get it to work on my Mac (I had to bypass screeninfo because it could not really detect my monitor and had to hardcode the Monitor object but fine).
It works well with local applications like Gimp or Krita.
It does not work with apps like sketchboard.io or awwapp.com as it seems the mouse events confuse the app enormously.
I tried with both Firefox and Chrome.
Any idea of why that could be and how to fix it?

--evdev: pen doesn't work with RM2

Hi,
Thanks for this awesome project.
I can't get --evdev to give me any pen input. Without --evdev everything seems to work OK, but with it I get touch events but no pen events. GIMP seems to recognize a pen input device being created but remouse --debug doesn't yield any event spam.

Ubuntu 20.10
Remarkable 2, latest firmware
#rm2 branch

--debug output:

sudo -E ~/.local/bin/remouse --key ~/.ssh/id_rsa  --debug --monitor 1 --orientation left --evdev                             
Debugging enabled...
Connecting to input '10.11.99.1'
Pen:/dev/input/event1
Touch:/dev/input/event2
Button:/dev/input/event0
Connected to 10.11.99.1
Created virtual input device '/dev/input/event21'
Chose monitor: Monitor(x=0, y=0, width=1920, height=1200, width_mm=518, height_mm=324, name='DVI-D-0')
Wacom tablet area: 0.0 1310.3125000000002 20967.0 14414.687500000002
Multi-touch area: 63.81249999999999 0.0 703.1875 1023.0

SSH'd to the rm2, running xxd /dev/input/event1 seems to produce output from the pen as expected (though I can't interpret what it's saying because I'm not Keanu Reeves...)

I will have a play around as well, just touching base. :)

Jarrad

doesn't run ... syntaxe error

โ•ญโ”€andrelec1@ESD1 ~ 
โ•ฐโ”€$ remouse
Traceback (most recent call last):
  File "/home/andrelec1/.local/bin/remouse", line 5, in <module>
    from remarkable_mouse.remarkable_mouse import main
  File "/home/andrelec1/.local/lib/python3.8/site-packages/remarkable_mouse/remarkable_mouse.py", line 12, in <module>
    import paramiko
  File "/home/andrelec1/.local/lib/python3.8/site-packages/paramiko/__init__.py", line 30, in <module>
    from paramiko.transport import SecurityOptions, Transport
  File "/home/andrelec1/.local/lib/python3.8/site-packages/paramiko/transport.py", line 66, in <module>
    from paramiko.sftp_client import SFTPClient
  File "/home/andrelec1/.local/lib/python3.8/site-packages/paramiko/sftp_client.py", line 41, in <module>
    from paramiko.sftp_file import SFTPFile
  File "/home/andrelec1/.local/lib/python3.8/site-packages/paramiko/sftp_file.py", line 66
    self._close(async=True)
                ^
SyntaxError: invalid syntax

what i can do ?

Only RSA keys work

Only RSA keys can be used in this program.
I need ECDSA support, since my OS deprecated RSA keys (Fedora 34).

Can't stop process on windows when running Terminal

I'm running remouse on Windows 10 (19041.330) inside Powershell (7.0.2) using Windows Terminal (1.0.1401.0). It works great but I can't seem to stop the process using CTRL+C. Am I missing something?

(as an aside, this is an awesome utility for the remarkable!!)

Error installing from pip on fedora 34

I'm getting this issue trying to install through pip on fedora 34:

[jared@fedora ~]$ pip3 install remarkable-mouse
Defaulting to user installation because normal site-packages is not writeable
Collecting remarkable-mouse
  Using cached remarkable_mouse-6.0.0-py3-none-any.whl (21 kB)
Collecting paramiko
  Using cached paramiko-2.7.2-py2.py3-none-any.whl (206 kB)
Collecting pynput
  Using cached pynput-1.7.3-py2.py3-none-any.whl (99 kB)
Collecting screeninfo
  Using cached screeninfo-0.7.tar.gz (10 kB)
Collecting libevdev
  Using cached libevdev-0.9.tar.gz (27 kB)
Collecting bcrypt>=3.1.3
  Using cached bcrypt-3.2.0-cp36-abi3-manylinux2010_x86_64.whl (63 kB)
Requirement already satisfied: pynacl>=1.0.1 in ./.local/lib/python3.9/site-packages (from paramiko->remarkable-mouse) (1.4.0)
Collecting cryptography>=2.5
  Using cached cryptography-3.4.8-cp36-abi3-manylinux_2_24_x86_64.whl (3.0 MB)
Requirement already satisfied: cffi>=1.1 in /usr/lib64/python3.9/site-packages (from bcrypt>=3.1.3->paramiko->remarkable-mouse) (1.14.5)
Requirement already satisfied: six>=1.4.1 in /usr/lib/python3.9/site-packages (from bcrypt>=3.1.3->paramiko->remarkable-mouse) (1.15.0)
Requirement already satisfied: pycparser in /usr/lib/python3.9/site-packages (from cffi>=1.1->bcrypt>=3.1.3->paramiko->remarkable-mouse) (2.20)
Requirement already satisfied: ply==3.11 in /usr/lib/python3.9/site-packages (from pycparser->cffi>=1.1->bcrypt>=3.1.3->paramiko->remarkable-mouse) (3.11)
Requirement already satisfied: python-xlib>=0.17 in ./.local/lib/python3.9/site-packages (from pynput->remarkable-mouse) (0.31)
Collecting evdev>=1.3
  Using cached evdev-1.4.0.tar.gz (26 kB)
Using legacy 'setup.py install' for libevdev, since package 'wheel' is not installed.
Using legacy 'setup.py install' for evdev, since package 'wheel' is not installed.
Using legacy 'setup.py install' for screeninfo, since package 'wheel' is not installed.
Installing collected packages: evdev, cryptography, bcrypt, screeninfo, pynput, paramiko, libevdev, remarkable-mouse
    Running setup.py install for evdev ... error
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-2oeyv1ic/evdev_6176bcaed9734dc5bd61b7d70f32ab48/setup.py'"'"'; __file__='"'"'/tmp/pip-install-2oeyv1ic/evdev_6176bcaed9734dc5bd61b7d70f32ab48/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-k06ptj8v/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/jared/.local/include/python3.9/evdev
         cwd: /tmp/pip-install-2oeyv1ic/evdev_6176bcaed9734dc5bd61b7d70f32ab48/
    Complete output (29 lines):
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.9
    creating build/lib.linux-x86_64-3.9/evdev
    copying evdev/util.py -> build/lib.linux-x86_64-3.9/evdev
    copying evdev/uinput.py -> build/lib.linux-x86_64-3.9/evdev
    copying evdev/genecodes.py -> build/lib.linux-x86_64-3.9/evdev
    copying evdev/ff.py -> build/lib.linux-x86_64-3.9/evdev
    copying evdev/evtest.py -> build/lib.linux-x86_64-3.9/evdev
    copying evdev/events.py -> build/lib.linux-x86_64-3.9/evdev
    copying evdev/eventio_async.py -> build/lib.linux-x86_64-3.9/evdev
    copying evdev/eventio.py -> build/lib.linux-x86_64-3.9/evdev
    copying evdev/ecodes.py -> build/lib.linux-x86_64-3.9/evdev
    copying evdev/device.py -> build/lib.linux-x86_64-3.9/evdev
    copying evdev/__init__.py -> build/lib.linux-x86_64-3.9/evdev
    running build_ext
    running build_ecodes
    writing ecodes.c (using /usr/include/linux/input.h /usr/include/linux/input-event-codes.h /usr/include/linux/uinput.h)
    building 'evdev._input' extension
    creating build/temp.linux-x86_64-3.9
    creating build/temp.linux-x86_64-3.9/evdev
    gcc -pthread -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/include/python3.9 -c evdev/input.c -o build/temp.linux-x86_64-3.9/evdev/input.o -std=c99 -Wno-error=declaration-after-statement
    evdev/input.c:10:10: fatal error: Python.h: No such file or directory
       10 | #include <Python.h>
          |          ^~~~~~~~~~
    compilation terminated.
    error: command '/usr/bin/gcc' failed with exit code 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-2oeyv1ic/evdev_6176bcaed9734dc5bd61b7d70f32ab48/setup.py'"'"'; __file__='"'"'/tmp/pip-install-2oeyv1ic/evdev_6176bcaed9734dc5bd61b7d70f32ab48/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-k06ptj8v/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/jared/.local/include/python3.9/evdev Check the logs for full command output.

Am I doing something wrong?

Support for remarkable2

Hi,

I wanted to try this for the reMarkable2. It turns out that the event file is different from rM1:

/dev/input/event0 => /dev/input/event1

I think one extra command line arg (something like --remarkable2) would help future users of this library without breaking backwards compatibility.

Wayland/xwayland issue

Starting remouse (commit 89505ec) this morning on Ubuntu 20.04 on a wayland session, I get these errors:

$ sudo remouse --address 192.168.0.23 --key ~/.ssh/remarkable --monitor 1 --evdev
connected to 192.168.0.23
Created virtual input device '/dev/input/event25'
Error setting orientation: b'WARNING: running xinput against an Xwayland server. See the xinput man page for details.\nunable to find device reMarkable tablet stylus\n'
Error setting monitor: b"WARNING: running xinput against an Xwayland server. See the xinput man page for details.\nunable to find device 'reMarkable tablet stylus'\n"
Error setting pressure threshold: b'WARNING: running xinput against an Xwayland server. See the xinput man page for details.\nunable to find device reMarkable tablet stylus\n'
Error setting fit: b'WARNING: running xinput against an Xwayland server. See the xinput man page for details.\nunable to find device reMarkable tablet stylus\n'

and indeed, the monitor is not properly selected.

...not sure why xinput and xwayland are triggered here... any idea?

libinput list-devices does list the tablet, as expect.

Assign Lamy button to some other key

Hello and thank you for this amazing piece of software :)

I'm using it on RM2 using evdev to allow me to use the button on my Lamy pen (actually a Samsung Tab S6 pen but it shouldn't matter). The problem I'm experiencing is that since I want to use it for collaborative whiteboarding, some of the platforms available have shortcuts for the rubber tool, but never mapped to the middle mouse as the tool wants. Often times this shortcut can be changed to some other key in the keyboard, but not to the middle mouse.

Is it possible to bind the Lamy button to some other key rather than the middle mouse button? And if so, is there any reference on how to achieve that?

Thanks!

evdev ignores monitor

Looks like the evdev option ignores the monitor and scales over the whole screen (i have dual screen in extension mode). So instead of being locked into on of the screen it scales the whole remarkable surface to both screens stretching it.

Expectation: --monitor parameter selects to scale on the selected screen.

Documentation

Would be nice to have proper documentation for the not so savy.

Connects to ReMarkable2, but doesn't "do" anything

OS: Ubuntu 20.04
Python 3.8

Output isn't helpful:

$ remouse --address 192.168.0.151
connected to 192.168.0.151

Debug output isn't helpful either:

$ remouse --address 192.168.0.151 --debug
connected to 192.168.0.151
Debugging enabled...
Chose monitor: Monitor(x=0, y=0, width=1600, height=900, width_mm=344, height_mm=194, name='eDP-1')

If I monitor journalctl output on the ReMarkable2, I can see that it makes an attempt to ssh and succeeds (using a key). But it doesn't seem to "do" anything. I can't see any new process running on the ReMarkable2 after running remouse.

Tablet active area

Hi,
Since the tablet is so big, sometimes when using a small monitor it feels weird having such a big area,
That's why i suggest adding a tablet area setting so that we can increase its "sensitivity"

Slow cursor on reMarkable 2 on Ubuntu 18.04

I'm using the rm2 branch for my reMarkable2, and I seem to be experiencing some sort of lag. My cursor does not move as quickly as my marker does. As a result if I move my marker for a long time, my cursor will keep moving even after my marker has stopped. I tried the script from #37 (comment), and it seemed normal, total = 2.32. My suspicion is that processing the input from the reMarkable happens slower than real time.

As a work around, I changed the script to update the cursor less often and the lag disappeared, but the mouse movement got more choppy. Here's the change I made.

diff --git a/remarkable_mouse/pynput.py b/remarkable_mouse/pynput.py
index c9734d8..d4e1ccf 100644
--- a/remarkable_mouse/pynput.py
+++ b/remarkable_mouse/pynput.py
@@ -1,4 +1,5 @@
 import logging
+import random
 import struct
 from screeninfo import get_monitors
 
@@ -103,7 +104,7 @@ def read_tablet(args, remote_device):
 
 
             # only move when x and y are updated for smoother mouse
-            if new_x and new_y:
+            if new_x and new_y and random.randrange(20) == 0:
                 mapped_x, mapped_y = remap(
                     x, y,
                     wacom_width, wacom_height,

I have previously used remarkable_mouse on my same computer with a reMarkable 1 with no lag.

There's no need to make any changes if I'm the only one having this problem; I'm mostly posting this to see if others are dealing with the same thing.

Changing the size of the input area on the tablet

Loving this script so far and want to experiment with the wide array of possibilities. Is there any semi-easy way to configure the input area to use a smaller area of the tablet for games like osu? I saw that LinusCDE who inspired you to make achieved this but his solution seemed rather complex and I'm not experienced enough to apply his solution without possibly breaking something.

Warranty concerns

Hello,
I've taken some time reading bits of the code and it looks like it doesn't actually make any change to the tablet,
Am I correct to assume that this is essentially just connecting via SSH to read the 3 devices?
Meaning the warranty shouldn't pop, If I'm right, I believe it would be good to have it shown on the main page, so more people take interest in this project

Connection error

When I try to use remouse, I get an error saying Exception: Error reading SSH protocol banner[Errno 104] Connection reset by peer

The full output reads:

(base) fernando@pop-os:~$ remouse 
Password for '10.11.99.1': 
Exception: Error reading SSH protocol banner[Errno 104] Connection reset by peer
Traceback (most recent call last):
  File "/home/fernando/anaconda3/lib/python3.7/site-packages/paramiko/transport.py", line 2211, in _check_banner
    buf = self.packetizer.readline(timeout)
  File "/home/fernando/anaconda3/lib/python3.7/site-packages/paramiko/packet.py", line 380, in readline
    buf += self._read_timeout(timeout)
  File "/home/fernando/anaconda3/lib/python3.7/site-packages/paramiko/packet.py", line 607, in _read_timeout
    x = self.__socket.recv(128)
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/fernando/anaconda3/lib/python3.7/site-packages/paramiko/transport.py", line 2039, in run
    self._check_banner()
  File "/home/fernando/anaconda3/lib/python3.7/site-packages/paramiko/transport.py", line 2216, in _check_banner
    "Error reading SSH protocol banner" + str(e)
paramiko.ssh_exception.SSHException: Error reading SSH protocol banner[Errno 104] Connection reset by peer

Traceback (most recent call last):
  File "/home/fernando/anaconda3/lib/python3.7/site-packages/paramiko/transport.py", line 2211, in _check_banner
    buf = self.packetizer.readline(timeout)
  File "/home/fernando/anaconda3/lib/python3.7/site-packages/paramiko/packet.py", line 380, in readline
    buf += self._read_timeout(timeout)
  File "/home/fernando/anaconda3/lib/python3.7/site-packages/paramiko/packet.py", line 607, in _read_timeout
    x = self.__socket.recv(128)
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/fernando/anaconda3/bin/remouse", line 10, in <module>
    sys.exit(main())
  File "/home/fernando/anaconda3/lib/python3.7/site-packages/remarkable_mouse/remarkable_mouse.py", line 81, in main
    remote_device = open_remote_device(args)
  File "/home/fernando/anaconda3/lib/python3.7/site-packages/remarkable_mouse/remarkable_mouse.py", line 58, in open_remote_device
    look_for_keys=False
  File "/home/fernando/anaconda3/lib/python3.7/site-packages/paramiko/client.py", line 406, in connect
    t.start_client(timeout=timeout)
  File "/home/fernando/anaconda3/lib/python3.7/site-packages/paramiko/transport.py", line 660, in start_client
    raise e
  File "/home/fernando/anaconda3/lib/python3.7/site-packages/paramiko/transport.py", line 2039, in run
    self._check_banner()
  File "/home/fernando/anaconda3/lib/python3.7/site-packages/paramiko/transport.py", line 2216, in _check_banner
    "Error reading SSH protocol banner" + str(e)
paramiko.ssh_exception.SSHException: Error reading SSH protocol banner[Errno 104] Connection reset by peer

Any ideas what is going on? Thanks.

SSH connection error

When I try to SHH the remarkable, it gives me the following error:
ssh_exchange_identification: read: Connection reset by peer
Any idea how to solve it?

Installation guide

Would be amazing if there was an installation guide explaning how to install it on a freshly bought reMarkable.

not working on a macosx

Not working on my Mac:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.7/bin/remouse", line 11, in <module>
    sys.exit(main())
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/remarkable_mouse/remarkable_mouse.py", line 165, in main
    read_tablet(args)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/remarkable_mouse/remarkable_mouse.py", line 106, in read_tablet
    monitor = get_monitors()[args.monitor]
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/screeninfo/screeninfo.py", line 412, in get_monitors
    enumerator = _ENUMERATORS[name] if name else _get_enumerator()
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/screeninfo/screeninfo.py", line 407, in _get_enumerator
    raise NotImplementedError('This environment is not supported.')
NotImplementedError: This environment is not supported.

Segmentation fault (cored dumped)

OS: Ubuntu 18.04 LTS
python version: 2.7.15+
python3 version: 3.6.8

When I try to install I get the following error:

Successfully built screeninfo dataclasses
Installing collected packages: six, enum34, python-xlib, pynput, dataclasses, screeninfo, pycparser, cffi, pynacl, bcrypt, asn1crypto, ipaddress, cryptography, paramiko, remarkable-mouse
Successfully installed asn1crypto-1.1.0 bcrypt-3.1.7 cffi-1.12.3 cryptography-2.7 dataclasses-0.6 enum34-1.1.6 ipaddress-1.0.22 paramiko-2.6.0 pycparser-2.19 pynacl-1.3.0 pynput-1.4.4 python-xlib-0.25 remarkable-mouse-4.1 screeninfo-0.4.1 six-1.12.0
Segmentation fault (core dumped)

Then remouse produces the following error:

 Traceback (most recent call last):
  File "/home/USER/.local/bin/remouse", line 7, in 
    from remarkable_mouse.remarkable_mouse import main
  File "/home/USER/.local/lib/python2.7/site-packages/remarkable_mouse/remarkable_mouse.py", line 12, in 
    from screeninfo import get_monitors
  File "/home/USER/.local/lib/python2.7/site-packages/screeninfo/__init__.py", line 1, in 
    from .common import Enumerator, Monitor
  File "/home/USER/.local/lib/python2.7/site-packages/screeninfo/common.py", line 10
    x: int
     ^
SyntaxError: invalid syntax

Specifying --password seems to have no effect

Hi. I'm trying 24ca4f6 and the following command line:

remouse --password=MyPaSsWoRd --mode=stretch --orientation=left

The password prompt appears despite the fact that I already specified it using the command line. Entering it again interactively works fine (the gui window appears). Could it be the second SSH connection which doesn't reuse password or smth other?

Error: No enumerators available

I am trying to connect to RM2 from Win10 using the following command:
remouse --address 10.11.99.1 --debug --orientation right --mode fit --monitor 1 --password XXXX

and get the following output:
\site-packages\screeninfo\screeninfo.py", line 37, in get_monitors
raise ScreenInfoError("No enumerators available")
screeninfo.common.ScreenInfoError: No enumerators available
EOF in transport thread

Any help?

problem connecting to rm2

I'm trying to connect to the rm2, following the instructions in the readme.

I tried both with password flag, and using the flag to supply a key

both methods fail on authentication

[joakim@192 ~]$  .local/bin/remouse --debug --key ~/.ssh/remarkable --address 192.168.50.249 --evdev
Debugging enabled...
Connecting to input '192.168.50.249'
Traceback (most recent call last):
  File "/home/joakim/.local/bin/remouse", line 8, in <module>
    sys.exit(main())
  File "/home/joakim/.local/lib/python3.10/site-packages/remarkable_mouse/remarkable_mouse.py", line 131, in main
    rm_inputs = open_rm_inputs(
  File "/home/joakim/.local/lib/python3.10/site-packages/remarkable_mouse/remarkable_mouse.py", line 71, in open_rm_inputs
    client.connect(
  File "/home/joakim/.local/lib/python3.10/site-packages/paramiko/client.py", line 435, in connect
    self._auth(
  File "/home/joakim/.local/lib/python3.10/site-packages/paramiko/client.py", line 766, in _auth
    raise saved_exception
  File "/home/joakim/.local/lib/python3.10/site-packages/paramiko/client.py", line 702, in _auth
    self._transport.auth_publickey(username, key)
  File "/home/joakim/.local/lib/python3.10/site-packages/paramiko/transport.py", line 1634, in auth_publickey
    return self.auth_handler.wait_for_response(my_event)
  File "/home/joakim/.local/lib/python3.10/site-packages/paramiko/auth_handler.py", line 258, in wait_for_response
    raise e
paramiko.ssh_exception.AuthenticationException: Authentication failed.

when i try to ssh to rm2 with the key I produced according to the instructions, it also fails:

ssh -vvv -i ~/.ssh/remarkable [email protected]

debug1: send_pubkey_test: no mutual signature algorithm

ssh with password works well though.

Crash after connection

I'm on Windows 11 with a remarkable 2

Console output:

>remouse
Password for '10.11.99.1':
Connected to 10.11.99.1
Traceback (most recent call last):
  File "C:\Program Files\Python310\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Program Files\Python310\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Users\xaver\AppData\Roaming\Python\Python310\Scripts\remouse.exe\__main__.py", line 7, in <module>
  File "C:\Users\xaver\AppData\Roaming\Python\Python310\site-packages\remarkable_mouse\remarkable_mouse.py", line 148, in main
    from remarkable_mouse.pynput import read_tablet
  File "C:\Users\xaver\AppData\Roaming\Python\Python310\site-packages\remarkable_mouse\pynput.py", line 4, in <module>
    import libevdev
  File "C:\Users\xaver\AppData\Roaming\Python\Python310\site-packages\libevdev\__init__.py", line 23, in <module>
    from .device import Device, InputAbsInfo
  File "C:\Users\xaver\AppData\Roaming\Python\Python310\site-packages\libevdev\device.py", line 29, in <module>
    from .event import InputEvent
  File "C:\Users\xaver\AppData\Roaming\Python\Python310\site-packages\libevdev\event.py", line 23, in <module>
    from .const import EventType, EventCode
  File "C:\Users\xaver\AppData\Roaming\Python\Python310\site-packages\libevdev\const.py", line 427, in <module>
    _load_consts()
  File "C:\Users\xaver\AppData\Roaming\Python\Python310\site-packages\libevdev\const.py", line 352, in _load_consts
    Libevdev()  # classmethods, need to make sure it's loaded at once
  File "C:\Users\xaver\AppData\Roaming\Python\Python310\site-packages\libevdev\_clib.py", line 395, in __init__
    super(Libevdev, self).__init__()
  File "C:\Users\xaver\AppData\Roaming\Python\Python310\site-packages\libevdev\_clib.py", line 76, in __init__
    self._load()
  File "C:\Users\xaver\AppData\Roaming\Python\Python310\site-packages\libevdev\_clib.py", line 83, in _load
    cls._lib = cls._cdll()
  File "C:\Users\xaver\AppData\Roaming\Python\Python310\site-packages\libevdev\_clib.py", line 123, in _cdll
    return ctypes.CDLL("libevdev.so.2", use_errno=True)
  File "C:\Program Files\Python310\lib\ctypes\__init__.py", line 374, in __init__
    self._handle = _dlopen(self._name, mode)
FileNotFoundError: Could not find module 'libevdev.so.2' (or one of its dependencies). Try using the full path with constructor syntax.

Does not seem to work on Windows using rM2 on 2.7.0.51

Python version 3.9.5, Windows 10 build 19042.928. Installed the normal way (pip install remarkable-mouse)

I plug the rM2 in using USB and run remouse --debug. Output:

Password for '10.11.99.1':
connected to 10.11.99.1
Debugging enabled...
Chose monitor: Monitor(x=2560, y=233, width=1920, height=1200, width_mm=518, height_mm=324, name='\\\\.\\DISPLAY1')

The process does not exit, but stays here. On the reMarkable nothing changes, and using the pen on the tablet works like normal (no UI changes, the PC does not react at all).

Also had no luck trying different options (setting orientation to something different, choosing a different monitor or mode).

--password parameter not working

I noticed that the --password parameter was not working, so I downloaded the source and modified your code successfuly so that I can connect to my rM with: $ remouse --password <password>. (i did a $ python setup.py install)
But then I have this error:
NameError: name 'WACOM_EVCODE_YPOS' is not defined
Do you know from where it come from ?

Thx

Missing license

Hey, could you add a license file so other developers can know what they can, and cannot do with your code?

mouse input is stuttering on Windows

The lib is working perfectly fine on Linux (to be exact, Pop!OS 20.10)
On Windows, the mouse stutters (like it doesn't have enough resolution). You can see it jump from Point A to Point B when swiping fast. video here

The smooth one is moving the mouse directly, the laggy one is using the reMarkable.

Remarkable connected to remouse program. But mouse cursor doesn't respond to tablet.

I am using a W10 laptop and a RM2 Tablet. I downloaded remarkable-mouse from pip successfully. The program runs on cmd. I also connect successfully to the tablet through my root password. But once connected the tablet doesn't work as a mouse input at all. I can draw fine on the tablet, but it doesn't translate to a mouse input on my laptop. I would love if someone could help me resolve this issue.

failed to create process

Hello, I could make it work once, but now for some reason I get "failed to create process". What should I do ? Thx

C:\Users\stnsl>remouse
failed to create process.

Couldn't make it work on Windows 10

Hi!

I'm deeply interested in using this on my computer, but so far I've tried a WSL2+VCXSRV, it connected to the display but the mouse wasn't moving, same with an admin powershell or an admin cmd prompt, it connects but the mouse doesn't move.

The command I tried: remouse --password XXXXXXXX --mode fit --orientation top --debug

On powershell and cmd prompt I have this output:

connected to 10.11.99.1
Debugging enabled...
Chose monitor: Monitor(x=0, y=0, width=1920, height=1080, width_mm=293, height_mm=165, name='\\\\.\\DISPLAY1')

On WSL2, only the monitor changes

Thanks in advance

Support for Lamy pen

I'm using the Lamy pen with my rM1 and it works great. It has an extra button that is mapped to eraser tool in rM. I was wondering if it would be possible to use it also for the remarkable_mouse?

From remarkable-hacks#19 I got this info:

In /dev/input/event0 you get:

    type: 1 code: 331 value: 1 on button down
    type: 1 code: 331 value: 0 on button up

Would it be possible to support these events so in xournal++ I can map it to an eraser tool as well.

cannot use it on Windows

I installed this tool on my windows device, but cannot run it:

PS C:\Users\khali> pip install remarkable-mouse
Requirement already satisfied: remarkable-mouse in c:\python38\lib\site-packages (6.0.0)
Requirement already satisfied: screeninfo in c:\python38\lib\site-packages (from remarkable-mouse) (0.6.7)
Requirement already satisfied: libevdev in c:\python38\lib\site-packages (from remarkable-mouse) (0.9)
Requirement already satisfied: pynput in c:\python38\lib\site-packages (from remarkable-mouse) (1.7.3)
Requirement already satisfied: paramiko in c:\python38\lib\site-packages (from remarkable-mouse) (2.7.2)
Requirement already satisfied: six in c:\users\khali\appdata\roaming\python\python38\site-packages (from pynput->remarkable-mouse) (1.15.0)
Requirement already satisfied: pynacl>=1.0.1 in c:\python38\lib\site-packages (from paramiko->remarkable-mouse) (1.4.0)
Requirement already satisfied: cryptography>=2.5 in c:\users\khali\appdata\roaming\python\python38\site-packages (from paramiko->remarkable-mouse) (2.9.2)
Requirement already satisfied: bcrypt>=3.1.3 in c:\python38\lib\site-packages (from paramiko->remarkable-mouse) (3.2.0)
Requirement already satisfied: cffi>=1.4.1 in c:\users\khali\appdata\roaming\python\python38\site-packages (from pynacl>=1.0.1->paramiko->remarkable-mouse) (1.14.3)
Requirement already satisfied: pycparser in c:\users\khali\appdata\roaming\python\python38\site-packages (from cffi>=1.4.1->pynacl>=1.0.1->paramiko->remarkable-mouse) (2.20)
WARNING: You are using pip version 20.2.3; however, version 21.2.2 is available.
You should consider upgrading via the 'c:\python38\python.exe -m pip install --upgrade pip' command.
PS C:\Users\khali> remouse
remouse: The term 'remouse' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
PS C:\Users\khali> python
Python 3.8.5 (tags/v3.8.5:580fbb0, Jul 20 2020, 15:57:54) [MSC v.1924 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()
PS C:\Users\khali>

Any idea

Tilt scaling to [-90, 90]

First of all, thank you for this wonderful software. I've tried using it in --evdev mode with krita editor. It works great apart from tilt detection.

evdev.py lists limits for ABS_TILT_X/ABS_TILT_Y as [-9000, 9000]. On remarkable 2 the seem to be [-6400, 6400] where 64k correspond to a 90 degree angle. Actual detectable range is around [-6300, 6300] for X axis and [-4000, 4000] for Y axis. But it looks like graphic editor ignores these ranges altogether and requires values in degrees: [-90, 90] range. I suspect that it is the range that wacom tablets have, though I can't test it as I don't own one.

I was able to get appropriate behaviour by scaling tilt events with this crude hack:

        if event.code in [libevdev.EV_ABS.ABS_TILT_X, libevdev.EV_ABS.ABS_TILT_Y]:
            event.value = int(90 * float(event.value) / 6400)

Though it could be the case that the bug is actually in the graphic editor, it still would be nice to have support for this scaling in the mainline version of remarkable_mouse.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.