Evidlo / remarkable_mouse

use your reMarkable as a graphics tablet
GNU General Public License v3.0
514 stars 49 forks source link

Broken on Windows since version 7 #73

Closed natpbs closed 2 years ago

natpbs commented 2 years ago

Hello, first of all thanks for the great work, this is a tool I find very useful!

Recently I changed my PC and had to reinstall remarkable_mouse all over again. Unfortunatly when I run the command remouse and enter the ssh password I get the following error.

Password for '10.11.99.1':
Connected to 10.11.99.1
Traceback (most recent call last):
  File "C:\Users\IT-PC-HTY4CK3\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\IT-PC-HTY4CK3\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Users\IT-PC-HTY4CK3\AppData\Local\Programs\Python\Python310\Scripts\remouse.exe\__main__.py", line 7, in <module>
  File "C:\Users\IT-PC-HTY4CK3\AppData\Local\Programs\Python\Python310\lib\site-packages\remarkable_mouse\remarkable_mouse.py", line 148, in main
    from remarkable_mouse.pynput import read_tablet
  File "C:\Users\IT-PC-HTY4CK3\AppData\Local\Programs\Python\Python310\lib\site-packages\remarkable_mouse\pynput.py", line 4, in <module>
    import libevdev
  File "C:\Users\IT-PC-HTY4CK3\AppData\Local\Programs\Python\Python310\lib\site-packages\libevdev\__init__.py", line 23, in <module>
    from .device import Device, InputAbsInfo
  File "C:\Users\IT-PC-HTY4CK3\AppData\Local\Programs\Python\Python310\lib\site-packages\libevdev\device.py", line 29, in <module>
    from .event import InputEvent
  File "C:\Users\IT-PC-HTY4CK3\AppData\Local\Programs\Python\Python310\lib\site-packages\libevdev\event.py", line 23, in <module>
    from .const import EventType, EventCode
  File "C:\Users\IT-PC-HTY4CK3\AppData\Local\Programs\Python\Python310\lib\site-packages\libevdev\const.py", line 427, in <module>
    _load_consts()
  File "C:\Users\IT-PC-HTY4CK3\AppData\Local\Programs\Python\Python310\lib\site-packages\libevdev\const.py", line 352, in _load_consts
    Libevdev()  # classmethods, need to make sure it's loaded at once
  File "C:\Users\IT-PC-HTY4CK3\AppData\Local\Programs\Python\Python310\lib\site-packages\libevdev\_clib.py", line 395, in __init__
    super(Libevdev, self).__init__()
  File "C:\Users\IT-PC-HTY4CK3\AppData\Local\Programs\Python\Python310\lib\site-packages\libevdev\_clib.py", line 76, in __init__
    self._load()
  File "C:\Users\IT-PC-HTY4CK3\AppData\Local\Programs\Python\Python310\lib\site-packages\libevdev\_clib.py", line 83, in _load
    cls._lib = cls._cdll()
  File "C:\Users\IT-PC-HTY4CK3\AppData\Local\Programs\Python\Python310\lib\site-packages\libevdev\_clib.py", line 123, in _cdll
    return ctypes.CDLL("libevdev.so.2", use_errno=True)
  File "C:\Users\IT-PC-HTY4CK3\AppData\Local\Programs\Python\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.

I believe the issue was caused by commit https://github.com/Evidlo/remarkable_mouse/commit/31e1d776c12c3f2e26b5db4b944596bc563f9626 which among other things added the import to libevdev to pyinput.py. As far as I know, libevdev is not supported at all on windows and simply importing it causes the error.

To make sure that the issue is unrelated to my specific machine I tried and successfully run an older version of remarkable_mouse, specifically https://github.com/Evidlo/remarkable_mouse/commit/6ed83f14cbfa996be2d7a6463ba68b81d041eb64 which is the last commit before the addition of the import of libevdev to pyinput.py.

I also insatlled the previous version (6.0.0) of remarkable_mouse through pip and ensured that it works properly on my machine.

For reference, the commands I used to do this are as follows.

pip uninstall remarkable_mouse
pip install remarkable_mouse==6.0.0

Since I wish for the project to continue to be maintained for windows I am available to submit a pull request rolling back pyinput.py to the last working version (at least for the windows platform) and in any case I am willing to test a candidate solution on my windows machine.

OS: Windows 11 Python: 3.10.2

Evidlo commented 2 years ago

This should be fixed in 7.0.2