Skip to content

grwlf/rm2env

Repository files navigation

ReMarkable 2 tools

This is a umbrella project containing author's Nix build expressions for various Remarkable2 tablet software.

What works and what doesn't

  • SSH connectivity systemd service.
  • Host-device library folder synchronisation using rsync.
  • Importing PDF documents to the library.
  • Exporting documents from the library (rm2svg seems to be broken)
  • RM2 stylus capturing using remarkable_mouse.

Contents

Usage

Nix development shell

We use Nix to track the library dependencies. Main expressions are defined in default.nix. flake.nix describes the relationships to other Nix repositories, inclding the main Nixpkgs repo.

To run the development shell, type:

$ export NIXPKGS_ALLOW_INSECURE=1 # needed to allow the buggy xpdf dependency
$ nix develop --impure # Impure is needed for Nix to notice the above variable

To build a specific Nix expression (e.g. rmsynctools_def):

$ nix build '.#rmsynctools_def' --impure

To enable the specific configuration without installing scripts, link it into the ./_rmconfig file in the current directory and source ./sh/rmcommon.

$ ln -s ./sh/nixconfig.sh _rmconfig
$ . ./sh/rmcommon # Optionally

Then you could run ./sh/rm* in-place scripts wihtout installing them into the system.

Establishing wireless SSH connection

To enable SSH access to the Remarkable tablet we rely on a third-party server with a public IP address (the VPS). We use rmssh-install to setup a Systemd service on the device and to send the necessary SSH keys to the VPS. The tablet then maintains a connection to the VPS by keeping certain ports opened so the users can establish a wireless connection to the tablet using VPS as a relay.

Given the successful installation, one can run the rmssh script in order to reach the tablet without connecting its USB cable.

$ rmssh remarkable

Sub-projects

Rmsynctools

Rmsynctools is a set of shell scripts for synchronizing document trees between the Host and RM2 device. Our approach is inspired by Dr Fraga's work. In contrast to it, we use rsync rather then sshfuse to manage the actual data transfer.

The workflow:

  1. Adjust the rmcommon that defines the main configuration environment variables.
  2. Optionally run the rmssh-install to install the systemd service rule to the RM2 device. Provided with the VPS requisites, the script will install the RM2 systemd running the reverse SSH tunnel from VPS host to RM2 device. allowing the wireless access to RM2 device. rmssh script can be used to connect to the device using this tunnel.
  3. Run the rmpull to pull the xochitl tree from RM2 device to Host. Pass --delete argument to also remove Host files that don't present on the tablet.
  4. View or modify the Host copy of xochitl using one of the following scripts:
    • rmls Lists the folder's content
    • rmfind Gets the document UUID by name
    • rmconvert of Dr.Fraga builds the annotated PDF by UUID.
      • Currently, getting annotaded documents doesn't rely on the Remarkable web-server. Unfortunately, rmconvert is pretty slow and has some issues with SVG graphics in PDF documents.
    • rmadd adds new document to the file tree
  5. Run rmpush to push the modified xochitl tree back to the RM2 device. rmpush doesn't remove anything from the tablet.

All transport scripts support accessing up to two RM2 devices using the reverse SSH tunnel. See -D (A|B) command line argument.

Remouse

To link the RM2 stylus with the Host mouse, do

$ echo 'password' >_pass.txt # RM2 root password
$ ./runmouse.sh

Issues:

Various low-level actions

Enabling the older SSH key format support.

In the Host's Nix configuration:

{
#...
  programs.ssh = let
    algos = ["+ssh-rsa"];
  in {
    hostKeyAlgorithms = algos;
    pubkeyAcceptedKeyTypes = algos;
  };
#...
}

Setting up the Host IP to connect via the USB cable

$ sudo ifconfig enp3s0u1 10.11.99.2 netmask 255.255.255.0

.. or set up NetworkManager to automatically assign IP address

Manually syncing the xochitl

Remarkable->Host transfer with deletion (remove --dry-run)

$ rsync -i -avP --dry-run --delete -e ssh remarkable:/home/root/.local/share/remarkable/xochitl/ _xochitl/

Host->Remarkable transfer without deletion (remove --dry-run)

$ rsync -i -avP --no-owner --no-group --dry-run -e ssh _xochitl/ remarkable:/home/root/.local/share/remarkable/xochitl/

Resources

General

Synchronization

Screen sharing

Other projects

About

reMarkable2 Nix environment

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published