From 73c5c7c131932b81a64bcad4d29659c38694246d Mon Sep 17 00:00:00 2001 From: Rien Maertens Date: Fri, 8 Jan 2021 11:05:06 +0100 Subject: [PATCH 01/30] Terminate script when ffmplay window closes --- reStream.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/reStream.sh b/reStream.sh index eec29d3..628beda 100755 --- a/reStream.sh +++ b/reStream.sh @@ -214,7 +214,7 @@ fi $receive_cmd \ | $decompress \ | $host_passthrough \ - | "$output_cmd" \ + | ("$output_cmd" \ -vcodec rawvideo \ -loglevel "$loglevel" \ -f rawvideo \ @@ -222,4 +222,6 @@ $receive_cmd \ -video_size "$width,$height" \ $window_title_option \ -i - \ - "$@" + "$@" \ + ; kill $$ + ) From d85938b441b7cd94a25cde87d81b1de486e6f277 Mon Sep 17 00:00:00 2001 From: f3fora <33097027+f3fora@users.noreply.github.com> Date: Sat, 30 Jan 2021 09:00:57 +0100 Subject: [PATCH 02/30] README.md: Internal broken link --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index bd7a0b4..8909a89 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,8 @@ Download [reStream.sh](https://github.com/rien/reStream/releases/latest/download ``` $ chmod +x reStream.sh ``` -> **Tip** +##### Tip + > If you save `reStream.sh` in a `PATH` directory as `reStream`, you can launch it as `reStream`. > On Ubuntu, list these folders with `echo $PATH`. One should be`/usr/local/bin`. > As root, download the executable there: From 2eb60e4c879dee9d8995a24b5e42146ed862ce5d Mon Sep 17 00:00:00 2001 From: f3fora <33097027+f3fora@users.noreply.github.com> Date: Sat, 30 Jan 2021 09:02:21 +0100 Subject: [PATCH 03/30] unsecure-connection: removed hard-coded remarkable ip --- reStream.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reStream.sh b/reStream.sh index 628beda..36f4ef6 100755 --- a/reStream.sh +++ b/reStream.sh @@ -205,7 +205,7 @@ if $unsecure_connection; then listen_port=16789 ssh_cmd "$restream_rs --listen $listen_port" & sleep 1 # give some time to restream.rs to start listening - receive_cmd="nc 10.11.99.1 $listen_port" + receive_cmd="nc $remarkable $listen_port" else receive_cmd="ssh_cmd $restream_rs" fi From edabacfb5555e8a840c820f42ed251d958770dcd Mon Sep 17 00:00:00 2001 From: f3fora <33097027+f3fora@users.noreply.github.com> Date: Sat, 30 Jan 2021 10:25:21 +0100 Subject: [PATCH 04/30] hflip: eventually restore the correct orientation of web cam --- README.md | 1 + reStream.sh | 16 +++++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 8909a89..69879c1 100644 --- a/README.md +++ b/README.md @@ -99,6 +99,7 @@ $ ssh root@10.11.99.1 'chmod +x /home/root/restream' - `-o --output`: path of the output where the video should be recorded, as understood by `ffmpeg`; if this is `-`, the video is displayed in a new window and not recorded anywhere (default: `-`) - `-f --format`: when recording to an output, this option is used to force the encoding format; if this is `-`, `ffmpeg`’s auto format detection based on the file extension is used (default: `-`). - `-w --webcam`: record to a video4linux2 web cam device. By default the first found web cam is taken, this can be overwritten with `-o`. The video is scaled to 1280x720 to ensure compatibility with MS Teams, Skype for business and other programs which need this specific format. See [Video4Linux Loopback](#video4linux-loopback) for installation instructions. +- `--hflip`: mirror the web cam video (`--webcam` has to be set). By default or as only choice, some programs, such as Zoom and Discord, mirror the camera. This flag restores the correct orientation. - `-m --measure`: use `pv` to measure how much data throughput you have (good to experiment with parameters to speed up the pipeline) - `-t --title`: set a custom window title for the video stream. The default title is "reStream". This option is disabled when using `-o --output` - `-u --unsecure-connection`: send framebuffer data over an unencrypted TCP-connection, resulting in more fps and less load on the reMarkable. See [Netcat](#netcat) for installation instructions. diff --git a/reStream.sh b/reStream.sh index 36f4ef6..c08d29f 100755 --- a/reStream.sh +++ b/reStream.sh @@ -6,6 +6,7 @@ landscape=true # rotate 90 degrees to the right output_path=- # display output through ffplay format=- # automatic output format webcam=false # not to a webcam +hflip=false # horizontal flip webcam measure_throughput=false # measure how fast data is being transferred window_title=reStream # stream window title is reStream video_filters="" # list of ffmpeg filters to apply @@ -58,6 +59,11 @@ while [ $# -gt 0 ]; do fi shift ;; + --hflip) + # do nothing if --webcam is not set + hflip=true + shift + ;; -t | --title) window_title="$2" shift @@ -68,15 +74,15 @@ while [ $# -gt 0 ]; do shift ;; -h | --help | *) - echo "Usage: $0 [-p] [-u] [-s ] [-o ] [-f ] [-t ]" + echo "Usage: $0 [-p] [-u] [-s <source>] [-o <output>] [-f <format>] [-t <title>] [-m] [-w] [--hflip]" echo "Examples:" echo " $0 # live view in landscape" echo " $0 -p # live view in portrait" echo " $0 -s 192.168.0.10 # connect to different IP" echo " $0 -o remarkable.mp4 # record to a file" echo " $0 -o udp://dest:1234 -f mpegts # record to a stream" - echo " $0 -w # write to a webcam (yuv420p + resize)" - echo " $0 -u # establish a unsecure but faster connection" + echo " $0 -w --hflip # write to a webcam (yuv420p + resize + mirror)" + echo " $0 -u # establish a unsecure but faster connection" exit 1 ;; esac @@ -174,6 +180,10 @@ if $webcam; then video_filters="$video_filters,format=pix_fmts=yuv420p" video_filters="$video_filters,scale=-1:720" video_filters="$video_filters,pad=1280:0:-1:0:#eeeeee" + + # Some applications, eg Zoom and Discord, mirror by default the webcam video + # Restore the correct orientation + $hflip && video_filters="$video_filters,hflip" fi # set each frame presentation time to the time it is received From f1efbf6d2244b4a2e7bc2770c03efc7a5218aa9d Mon Sep 17 00:00:00 2001 From: f3fora <33097027+f3fora@users.noreply.github.com> Date: Wed, 3 Feb 2021 10:50:25 +0100 Subject: [PATCH 05/30] Unsecure connection supports also ssh_config aliases. --- README.md | 2 +- reStream.sh | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 69879c1..16c02a9 100644 --- a/README.md +++ b/README.md @@ -99,7 +99,7 @@ $ ssh root@10.11.99.1 'chmod +x /home/root/restream' - `-o --output`: path of the output where the video should be recorded, as understood by `ffmpeg`; if this is `-`, the video is displayed in a new window and not recorded anywhere (default: `-`) - `-f --format`: when recording to an output, this option is used to force the encoding format; if this is `-`, `ffmpeg`’s auto format detection based on the file extension is used (default: `-`). - `-w --webcam`: record to a video4linux2 web cam device. By default the first found web cam is taken, this can be overwritten with `-o`. The video is scaled to 1280x720 to ensure compatibility with MS Teams, Skype for business and other programs which need this specific format. See [Video4Linux Loopback](#video4linux-loopback) for installation instructions. -- `--hflip`: mirror the web cam video (`--webcam` has to be set). By default or as only choice, some programs, such as Zoom and Discord, mirror the camera. This flag restores the correct orientation. +- `--mirror`: mirror the web cam video (`--webcam` has to be set). By default or as only choice, some programs, such as Zoom and Discord, mirror the camera. This flag restores the correct orientation. - `-m --measure`: use `pv` to measure how much data throughput you have (good to experiment with parameters to speed up the pipeline) - `-t --title`: set a custom window title for the video stream. The default title is "reStream". This option is disabled when using `-o --output` - `-u --unsecure-connection`: send framebuffer data over an unencrypted TCP-connection, resulting in more fps and less load on the reMarkable. See [Netcat](#netcat) for installation instructions. diff --git a/reStream.sh b/reStream.sh index c08d29f..d26a24a 100755 --- a/reStream.sh +++ b/reStream.sh @@ -59,7 +59,7 @@ while [ $# -gt 0 ]; do fi shift ;; - --hflip) + --mirror) # do nothing if --webcam is not set hflip=true shift @@ -81,7 +81,7 @@ while [ $# -gt 0 ]; do echo " $0 -s 192.168.0.10 # connect to different IP" echo " $0 -o remarkable.mp4 # record to a file" echo " $0 -o udp://dest:1234 -f mpegts # record to a stream" - echo " $0 -w --hflip # write to a webcam (yuv420p + resize + mirror)" + echo " $0 -w --mirror # write to a webcam (yuv420p + resize + mirror)" echo " $0 -u # establish a unsecure but faster connection" exit 1 ;; @@ -93,6 +93,11 @@ ssh_cmd() { ssh -o ConnectTimeout=1 -o PasswordAuthentication=no "root@$remarkable" "$@" } +# SSH_CONNECTION is a variable on reMarkable => ssh '' instead of ssh "" +remarkable_ip() { + ssh_cmd 'echo $SSH_CONNECTION' | cut -d\ -f3 +} + # check if we are able to reach the remarkable if ! ssh_cmd true; then echo "$remarkable unreachable or you have not set up an ssh key." @@ -215,7 +220,7 @@ if $unsecure_connection; then listen_port=16789 ssh_cmd "$restream_rs --listen $listen_port" & sleep 1 # give some time to restream.rs to start listening - receive_cmd="nc $remarkable $listen_port" + receive_cmd="nc $(remarkable_ip) $listen_port" else receive_cmd="ssh_cmd $restream_rs" fi From ff10c3ddc42467507ed839ab24538584a3d74de8 Mon Sep 17 00:00:00 2001 From: Rien Maertens <rien.maertens@posteo.be> Date: Wed, 30 Jun 2021 10:21:53 +0200 Subject: [PATCH 06/30] shellcheck ignore SC2016 --- reStream.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/reStream.sh b/reStream.sh index d26a24a..8eb6e7d 100755 --- a/reStream.sh +++ b/reStream.sh @@ -94,6 +94,7 @@ ssh_cmd() { } # SSH_CONNECTION is a variable on reMarkable => ssh '' instead of ssh "" +# shellcheck disable=SC2016 remarkable_ip() { ssh_cmd 'echo $SSH_CONNECTION' | cut -d\ -f3 } From 6bcee2b8f10d588b0a63c3da7e3709d39f24408d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakob=20Frantzv=C3=A5g=20Karlsmoen?= <jakob.karlsmoen@hotmail.no> Date: Tue, 2 Feb 2021 22:24:52 +0100 Subject: [PATCH 07/30] Add Fedora 33 specific checks as a result of crypto policy changes --- reStream.sh | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/reStream.sh b/reStream.sh index 8eb6e7d..ef34d01 100755 --- a/reStream.sh +++ b/reStream.sh @@ -89,8 +89,24 @@ while [ $# -gt 0 ]; do done ssh_cmd() { + OS="" + VER="" + echo "[SSH]" "$@" >&2 - ssh -o ConnectTimeout=1 -o PasswordAuthentication=no "root@$remarkable" "$@" + + if [ -f /etc/os-release ]; then + . /etc/os-release + OS=$NAME + VER=$VERSION_ID + fi + + if [ "$OS" == "Fedora" ]; then + if [ "$VER" == "33" ]; then + ssh -o ConnectTimeout=1 -o PasswordAuthentication=no "remarkable" "$@" + fi + else + ssh -o ConnectTimeout=1 -o PasswordAuthentication=no "root@$remarkable" "$@" + fi } # SSH_CONNECTION is a variable on reMarkable => ssh '' instead of ssh "" From 7fe3e4e8da3657af81c76811cf4645ec62d2797a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakob=20Frantzv=C3=A5g=20Karlsmoen?= <jakob.karlsmoen@hotmail.no> Date: Tue, 2 Feb 2021 22:25:17 +0100 Subject: [PATCH 08/30] Add Fedora 33 specific instructions as a result of crypto policy changes --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index 16c02a9..35fa29d 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,16 @@ On Ubuntu, `apt install liblz4-tool` will do the trick. 2. [Set up an SSH key and add it to the ssh-agent](https://help.github.com/en/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent), then add your key to the reMarkable with `ssh-copy-id root@10.11.99.1`. > **Note:** the reMarkable 2 doesn't support `ed25519` keys, those users should generate and `rsa` key. Try out `ssh root@10.11.99.1`, it should **not** prompt for a password. +> **Note 2:** If you are using Fedora 33 or later, RSA keys are considered ["legacy"](https://fedoraproject.org/wiki/Changes/StrongCryptoSettings2) and will no longer work out of the box. +> Therefore you need to add a section to your `~.ssh/config` file to allow use of RSA ssh keys for specified hosts. +> This example should work without any config, although the identifier needs to be "remarkable" for the reStream to work correctly: +>``` +> Host remarkable +> HostName 10.11.99.1 +> User root +> PubkeyAcceptedKeyTypes=ssh-rsa +>``` + #### Windows 1. Install [ffmpeg for windows](https://ffmpeg.org/download.html#build-windows). From c625fdd09a3793b10afa0bd5d80ccbe6c58d563f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakob=20Frantzv=C3=A5g=20Karlsmoen?= <jakob.karlsmoen@hotmail.no> Date: Tue, 2 Feb 2021 23:02:46 +0100 Subject: [PATCH 09/30] Fixed a bug where the no ssh connection would be established for any distro other than Fedora 33 --- reStream.sh | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/reStream.sh b/reStream.sh index ef34d01..65efd5b 100755 --- a/reStream.sh +++ b/reStream.sh @@ -100,12 +100,10 @@ ssh_cmd() { VER=$VERSION_ID fi - if [ "$OS" == "Fedora" ]; then - if [ "$VER" == "33" ]; then - ssh -o ConnectTimeout=1 -o PasswordAuthentication=no "remarkable" "$@" - fi + if [ "$OS" == "Fedora" ] && [ "$VER" == "33" ]; then + ssh -o ConnectTimeout=1 -o PasswordAuthentication=no "remarkable" "$@" else - ssh -o ConnectTimeout=1 -o PasswordAuthentication=no "root@$remarkable" "$@" + ssh -o ConnectTimeout=1 -o PasswordAuthentication=no "root@$remarkable" "$@" fi } From 0844329d7eb2981baf6bc0f66ed9a2e6eb12fe46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakob=20Frantzv=C3=A5g=20Karlsmoen?= <jakob.karlsmoen@hotmail.no> Date: Tue, 2 Feb 2021 23:10:09 +0100 Subject: [PATCH 10/30] Expanded error message to include note about Fedora 33+ --- reStream.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/reStream.sh b/reStream.sh index 65efd5b..cafd9ed 100755 --- a/reStream.sh +++ b/reStream.sh @@ -96,7 +96,7 @@ ssh_cmd() { if [ -f /etc/os-release ]; then . /etc/os-release - OS=$NAME + OS=$NAME VER=$VERSION_ID fi @@ -116,7 +116,7 @@ remarkable_ip() { # check if we are able to reach the remarkable if ! ssh_cmd true; then echo "$remarkable unreachable or you have not set up an ssh key." - echo "If you see a 'Permission denied' error, please visit" + echo "If you see a 'Permission denied' error or is using Fedora 33+, please visit" echo "https://github.com/rien/reStream/#installation for instructions." exit 1 fi From 55d3b2e80eb776488b3f65e84f0b592b04fe1d65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakob=20Frantzv=C3=A5g=20Karlsmoen?= <jakob.karlsmoen@hotmail.no> Date: Tue, 2 Feb 2021 23:15:04 +0100 Subject: [PATCH 11/30] Added more details around the Fedora 33+ change --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 35fa29d..c864369 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,8 @@ On Ubuntu, `apt install liblz4-tool` will do the trick. > **Note 2:** If you are using Fedora 33 or later, RSA keys are considered ["legacy"](https://fedoraproject.org/wiki/Changes/StrongCryptoSettings2) and will no longer work out of the box. > Therefore you need to add a section to your `~.ssh/config` file to allow use of RSA ssh keys for specified hosts. -> This example should work without any config, although the identifier needs to be "remarkable" for the reStream to work correctly: +> (according to [https://remarkablewiki.com/tech/ssh](https://remarkablewiki.com/tech/ssh), Remarkable devices might not work with non-RSA keys, which is the reason for why this is necessary.) +> This example should work without any config, although the identifier needs to be "remarkable" with the line `PubkeyAcceptedKeyTypes=ssh-rsa` for the reStream to work correctly: >``` > Host remarkable > HostName 10.11.99.1 From f5ece2ce251e4f23a3bf900ea1f17b354b980bce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakob=20Frantzv=C3=A5g=20Karlsmoen?= <jakob.karlsmoen@hotmail.no> Date: Sun, 14 Feb 2021 22:34:06 +0100 Subject: [PATCH 12/30] Revert "Expanded error message to include note about Fedora 33+" This reverts commit 70fa392abb1cdd4dc92f1b500b3f27b13fc6c80c. --- reStream.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/reStream.sh b/reStream.sh index cafd9ed..65efd5b 100755 --- a/reStream.sh +++ b/reStream.sh @@ -96,7 +96,7 @@ ssh_cmd() { if [ -f /etc/os-release ]; then . /etc/os-release - OS=$NAME + OS=$NAME VER=$VERSION_ID fi @@ -116,7 +116,7 @@ remarkable_ip() { # check if we are able to reach the remarkable if ! ssh_cmd true; then echo "$remarkable unreachable or you have not set up an ssh key." - echo "If you see a 'Permission denied' error or is using Fedora 33+, please visit" + echo "If you see a 'Permission denied' error, please visit" echo "https://github.com/rien/reStream/#installation for instructions." exit 1 fi From 2d1536557cb1f42afd83fec6453e52aa43e0dac3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakob=20Frantzv=C3=A5g=20Karlsmoen?= <jakob.karlsmoen@hotmail.no> Date: Sun, 14 Feb 2021 22:34:26 +0100 Subject: [PATCH 13/30] Revert "Fixed a bug where the no ssh connection would be established for any distro other than Fedora 33" This reverts commit 48547865e1760de198bf482fa53799d0b6fc79b7. --- reStream.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/reStream.sh b/reStream.sh index 65efd5b..ef34d01 100755 --- a/reStream.sh +++ b/reStream.sh @@ -100,10 +100,12 @@ ssh_cmd() { VER=$VERSION_ID fi - if [ "$OS" == "Fedora" ] && [ "$VER" == "33" ]; then - ssh -o ConnectTimeout=1 -o PasswordAuthentication=no "remarkable" "$@" + if [ "$OS" == "Fedora" ]; then + if [ "$VER" == "33" ]; then + ssh -o ConnectTimeout=1 -o PasswordAuthentication=no "remarkable" "$@" + fi else - ssh -o ConnectTimeout=1 -o PasswordAuthentication=no "root@$remarkable" "$@" + ssh -o ConnectTimeout=1 -o PasswordAuthentication=no "root@$remarkable" "$@" fi } From b32c195607bf366ae04ff58244d347e63ae7359f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakob=20Frantzv=C3=A5g=20Karlsmoen?= <jakob.karlsmoen@hotmail.no> Date: Sun, 14 Feb 2021 22:34:33 +0100 Subject: [PATCH 14/30] Revert "Add Fedora 33 specific checks as a result of crypto policy changes" This reverts commit 1114c25816be8e7e07faab5d9429238e86ee392d. --- reStream.sh | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/reStream.sh b/reStream.sh index ef34d01..8eb6e7d 100755 --- a/reStream.sh +++ b/reStream.sh @@ -89,24 +89,8 @@ while [ $# -gt 0 ]; do done ssh_cmd() { - OS="" - VER="" - echo "[SSH]" "$@" >&2 - - if [ -f /etc/os-release ]; then - . /etc/os-release - OS=$NAME - VER=$VERSION_ID - fi - - if [ "$OS" == "Fedora" ]; then - if [ "$VER" == "33" ]; then - ssh -o ConnectTimeout=1 -o PasswordAuthentication=no "remarkable" "$@" - fi - else - ssh -o ConnectTimeout=1 -o PasswordAuthentication=no "root@$remarkable" "$@" - fi + ssh -o ConnectTimeout=1 -o PasswordAuthentication=no "root@$remarkable" "$@" } # SSH_CONNECTION is a variable on reMarkable => ssh '' instead of ssh "" From 15858692725da25f657b4407f37762b7603dd769 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakob=20Frantzv=C3=A5g=20Karlsmoen?= <jakob.karlsmoen@hotmail.no> Date: Sun, 14 Feb 2021 22:37:55 +0100 Subject: [PATCH 15/30] Moved the note about crypto policy changes to Troubleshooting section and changed it to be more generalized --- README.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index c864369..1f5d9c0 100644 --- a/README.md +++ b/README.md @@ -25,17 +25,6 @@ On Ubuntu, `apt install liblz4-tool` will do the trick. 2. [Set up an SSH key and add it to the ssh-agent](https://help.github.com/en/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent), then add your key to the reMarkable with `ssh-copy-id root@10.11.99.1`. > **Note:** the reMarkable 2 doesn't support `ed25519` keys, those users should generate and `rsa` key. Try out `ssh root@10.11.99.1`, it should **not** prompt for a password. -> **Note 2:** If you are using Fedora 33 or later, RSA keys are considered ["legacy"](https://fedoraproject.org/wiki/Changes/StrongCryptoSettings2) and will no longer work out of the box. -> Therefore you need to add a section to your `~.ssh/config` file to allow use of RSA ssh keys for specified hosts. -> (according to [https://remarkablewiki.com/tech/ssh](https://remarkablewiki.com/tech/ssh), Remarkable devices might not work with non-RSA keys, which is the reason for why this is necessary.) -> This example should work without any config, although the identifier needs to be "remarkable" with the line `PubkeyAcceptedKeyTypes=ssh-rsa` for the reStream to work correctly: ->``` -> Host remarkable -> HostName 10.11.99.1 -> User root -> PubkeyAcceptedKeyTypes=ssh-rsa ->``` - #### Windows 1. Install [ffmpeg for windows](https://ffmpeg.org/download.html#build-windows). @@ -164,6 +153,17 @@ Steps you can try if the script isn't working: - [Set up an SSH key](#installation) - Update `ffmpeg` to version 4. +- Make sure RSA keys are allowed on your system: + - In some modern Unix distributions, RSA keys are considered ["legacy"](https://fedoraproject.org/wiki/Changes/StrongCryptoSettings2) and will no longer work out of the box. + - Therefore you need to add a section to your `~.ssh/config` file to allow use of RSA ssh keys for specified hosts. (according to [https://remarkablewiki.com/tech/ssh](https://remarkablewiki.com/tech/ssh), Remarkable devices might not work with non-RSA keys, which is the reason for why this is necessary.) + - This example should work without any additional configuration, although `PubkeyAcceptedKeyTypes=ssh-rsa` is required if you want to modify it: + ``` + Host remarkable + HostName 10.11.99.1 + User root + PubkeyAcceptedKeyTypes=ssh-rsa + ``` + - You can then use the -s flag to connect to the Remarkable: `./reStream.sh -s remarkable` ## Development From 0b919c7764f3fae7525a147b72b7fb20bec259dc Mon Sep 17 00:00:00 2001 From: Edgar Merino <donvodka@gmail.com> Date: Sat, 13 Feb 2021 15:52:15 -0800 Subject: [PATCH 16/30] Add instructions to the README on how to build the restream binary using docker --- README.md | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1f5d9c0..844c1a2 100644 --- a/README.md +++ b/README.md @@ -167,4 +167,18 @@ Steps you can try if the script isn't working: ## Development -If you want to play with the `restream` code, you will have to [install Rust](https://www.rust-lang.org/learn/get-started) and [setup the reMarkable toolchain](https://github.com/canselcik/libremarkable#setting-up-the-toolchain) to do cross-platform development. +If you want to play with the `restream` code, you will have to [install Rust](https://www.rust-lang.org/learn/get-started). + +There are two ways of building the required restream binary for streaming the reMarkable framebuffer. For both approaches, the generated restream binary will be located under `target/armv7-unknown-linux-gnueabihf/release/restream`. + +- Using docker and the toltec toolchain + +You can use the [toltec toolchain docker images](https://github.com/toltec-dev/toolchain) to build a restream binary compatible with the reMarkable. + +``` +docker run --rm -v $(pwd):/project -v /project/.cargo -w "/project" ghcr.io/toltec-dev/rust:latest cargo build --release --target=armv7-unknown-linux-gnueabihf +``` + +- Using the reMarkable toolchain + +[Setup the reMarkable toolchain](https://github.com/canselcik/libremarkable#setting-up-the-toolchain) to do cross-platform development. From 4d1eb7924a177c3b668eecb392f1bca16f18c305 Mon Sep 17 00:00:00 2001 From: Rien Maertens <rien.maertens@posteo.be> Date: Wed, 30 Jun 2021 10:33:25 +0200 Subject: [PATCH 17/30] README#Development: group in bullet points --- README.md | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 844c1a2..370a03e 100644 --- a/README.md +++ b/README.md @@ -171,14 +171,12 @@ If you want to play with the `restream` code, you will have to [install Rust](ht There are two ways of building the required restream binary for streaming the reMarkable framebuffer. For both approaches, the generated restream binary will be located under `target/armv7-unknown-linux-gnueabihf/release/restream`. -- Using docker and the toltec toolchain +- **Using docker and the toltec toolchain:** + You can use the [toltec toolchain docker images](https://github.com/toltec-dev/toolchain) to build a restream binary compatible with the reMarkable. -You can use the [toltec toolchain docker images](https://github.com/toltec-dev/toolchain) to build a restream binary compatible with the reMarkable. + ``` + docker run --rm -v $(pwd):/project -v /project/.cargo -w "/project" ghcr.io/toltec-dev/rust:latest cargo build --release --target=armv7-unknown-linux-gnueabihf + ``` -``` -docker run --rm -v $(pwd):/project -v /project/.cargo -w "/project" ghcr.io/toltec-dev/rust:latest cargo build --release --target=armv7-unknown-linux-gnueabihf -``` - -- Using the reMarkable toolchain - -[Setup the reMarkable toolchain](https://github.com/canselcik/libremarkable#setting-up-the-toolchain) to do cross-platform development. +- **Using the reMarkable toolchain:** + [Setup the reMarkable toolchain](https://github.com/canselcik/libremarkable#setting-up-the-toolchain) to do cross-platform development. From a342187aea6339f1ba5c9fb9bfb545f35a2c9efa Mon Sep 17 00:00:00 2001 From: Weiwu Zhang <a@colourful.land> Date: Fri, 2 Apr 2021 16:41:38 +1100 Subject: [PATCH 18/30] update fallback from ed25519 to ecdsa --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 370a03e..f3fda5c 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ On your **host** machine 1. Install `lz4` on your host with your usual package manager. On Ubuntu, `apt install liblz4-tool` will do the trick. 2. [Set up an SSH key and add it to the ssh-agent](https://help.github.com/en/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent), then add your key to the reMarkable with `ssh-copy-id root@10.11.99.1`. -> **Note:** the reMarkable 2 doesn't support `ed25519` keys, those users should generate and `rsa` key. Try out `ssh root@10.11.99.1`, it should **not** prompt for a password. +> **Note:** the reMarkable 2 doesn't support `ed25519` keys. If it's your case, try generating `ecdsa` key. Try out `ssh root@10.11.99.1`, it should **not** prompt for root@10.11.99.1's password. #### Windows From 13cdc47cd013b4edb7485905764d8b29d653df29 Mon Sep 17 00:00:00 2001 From: Weiwu Zhang <a@colourful.land> Date: Fri, 2 Apr 2021 16:42:15 +1100 Subject: [PATCH 19/30] typto --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f3fda5c..abe8496 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ On your **host** machine 1. Install `lz4` on your host with your usual package manager. On Ubuntu, `apt install liblz4-tool` will do the trick. 2. [Set up an SSH key and add it to the ssh-agent](https://help.github.com/en/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent), then add your key to the reMarkable with `ssh-copy-id root@10.11.99.1`. -> **Note:** the reMarkable 2 doesn't support `ed25519` keys. If it's your case, try generating `ecdsa` key. Try out `ssh root@10.11.99.1`, it should **not** prompt for root@10.11.99.1's password. +> **Note:** the reMarkable 2 doesn't support `ed25519` keys. If it's your case, try generating an `ecdsa` key. Try out `ssh root@10.11.99.1`, it should **not** prompt for root@10.11.99.1's password. #### Windows From 236c3732f18626c0af59b9d96bd8fed6945abf6b Mon Sep 17 00:00:00 2001 From: Rien Maertens <rien.maertens@posteo.be> Date: Wed, 30 Jun 2021 10:54:56 +0200 Subject: [PATCH 20/30] Suggest ecdsa or rsa key --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index abe8496..83a69fd 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ On your **host** machine 1. Install `lz4` on your host with your usual package manager. On Ubuntu, `apt install liblz4-tool` will do the trick. 2. [Set up an SSH key and add it to the ssh-agent](https://help.github.com/en/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent), then add your key to the reMarkable with `ssh-copy-id root@10.11.99.1`. -> **Note:** the reMarkable 2 doesn't support `ed25519` keys. If it's your case, try generating an `ecdsa` key. Try out `ssh root@10.11.99.1`, it should **not** prompt for root@10.11.99.1's password. +> **Note:** the reMarkable 2 doesn't support `ed25519` keys. If it's your case, try generating an `ecdsa` or `rsa` key. Try out `ssh root@10.11.99.1`, it should **not** prompt for root@10.11.99.1's password. #### Windows From c57fdde1adfb6ef038992b11f2347ac429a5344d Mon Sep 17 00:00:00 2001 From: Rien Maertens <rien.maertens@posteo.be> Date: Wed, 30 Jun 2021 11:08:05 +0200 Subject: [PATCH 21/30] Fix formatting with shfmt --- reStream.sh | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/reStream.sh b/reStream.sh index 8eb6e7d..08c41b7 100755 --- a/reStream.sh +++ b/reStream.sh @@ -230,14 +230,16 @@ fi $receive_cmd \ | $decompress \ | $host_passthrough \ - | ("$output_cmd" \ - -vcodec rawvideo \ - -loglevel "$loglevel" \ - -f rawvideo \ - -pixel_format "$pixel_format" \ - -video_size "$width,$height" \ - $window_title_option \ - -i - \ - "$@" \ - ; kill $$ + | ( + "$output_cmd" \ + -vcodec rawvideo \ + -loglevel "$loglevel" \ + -f rawvideo \ + -pixel_format "$pixel_format" \ + -video_size "$width,$height" \ + $window_title_option \ + -i - \ + "$@" \ + ; + kill $$ ) From aa0aa7c6add9eecd27e72cf7dd92af3f85fe87be Mon Sep 17 00:00:00 2001 From: f3fora <33097027+f3fora@users.noreply.github.com> Date: Wed, 30 Jun 2021 22:42:51 +0200 Subject: [PATCH 22/30] Kill the process on remarkable at the end close #66 --- reStream.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/reStream.sh b/reStream.sh index 08c41b7..6285cd6 100755 --- a/reStream.sh +++ b/reStream.sh @@ -93,6 +93,13 @@ ssh_cmd() { ssh -o ConnectTimeout=1 -o PasswordAuthentication=no "root@$remarkable" "$@" } +# kill reStream on remarkable at the end. +# shellcheck disable=SC2016 +exit_rm() { + ssh_cmd 'kill $(pidof restream)' +} +trap exit_rm EXIT INT HUP + # SSH_CONNECTION is a variable on reMarkable => ssh '' instead of ssh "" # shellcheck disable=SC2016 remarkable_ip() { From 9427d184b8e70c266289cea0115dd03506c873f6 Mon Sep 17 00:00:00 2001 From: Rien Maertens <rien.maertens@posteo.be> Date: Fri, 20 Aug 2021 15:37:14 +0200 Subject: [PATCH 23/30] Update README --- README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/README.md b/README.md index 83a69fd..5b3c181 100644 --- a/README.md +++ b/README.md @@ -180,3 +180,14 @@ There are two ways of building the required restream binary for streaming the re - **Using the reMarkable toolchain:** [Setup the reMarkable toolchain](https://github.com/canselcik/libremarkable#setting-up-the-toolchain) to do cross-platform development. + +## Like using reStream? + +I made this project in my spare time and received help from a handful of +wonderful contributors. If you want to say thanks, please +[send me an email](mailto:thanks@rxn.be) and be sure to mention how you are +using this project. + +I do not accept donations. There are charities that need more financial support +than I do, so please consider supporting a local charity instead. Preferably one +that promotes diversity in technology like girlswhocode, coderdojo, etc. From 1cc004ed52851e1e18d9f1909d523fb87b3eb7c8 Mon Sep 17 00:00:00 2001 From: Rien Maertens <rien.maertens@posteo.be> Date: Fri, 20 Aug 2021 15:59:56 +0200 Subject: [PATCH 24/30] Add links to charities in README --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5b3c181..39fd3d6 100644 --- a/README.md +++ b/README.md @@ -190,4 +190,6 @@ using this project. I do not accept donations. There are charities that need more financial support than I do, so please consider supporting a local charity instead. Preferably one -that promotes diversity in technology like girlswhocode, coderdojo, etc. +that promotes diversity in technology like +[GirlsWhoCode](https://girlswhocode.com/), [CoderDojo](https://coderdojo.com/), +etc. From 156e2e37cd6a63e603ad34506d044fa495feb490 Mon Sep 17 00:00:00 2001 From: Rien Maertens <rien.maertens@posteo.be> Date: Thu, 4 Nov 2021 09:21:14 +0100 Subject: [PATCH 25/30] Allow sha1 to ensure support for openssh 8.8 --- reStream.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/reStream.sh b/reStream.sh index 6285cd6..1973c88 100755 --- a/reStream.sh +++ b/reStream.sh @@ -90,7 +90,11 @@ done ssh_cmd() { echo "[SSH]" "$@" >&2 - ssh -o ConnectTimeout=1 -o PasswordAuthentication=no "root@$remarkable" "$@" + ssh -o ConnectTimeout=1 \ + -o PasswordAuthentication=no \ + -o PubkeyAcceptedKeyTypes=+ssh-rsa \ + -o HostKeyAlgorithms=+ssh-rsa \ + "root@$remarkable" "$@" } # kill reStream on remarkable at the end. From 58a28c2715be6b641c1644b6d169c77709612841 Mon Sep 17 00:00:00 2001 From: Rien Maertens <rien.maertens@posteo.be> Date: Thu, 4 Nov 2021 16:31:37 +0100 Subject: [PATCH 26/30] Add Nix flake with devShell --- .cargo/config | 14 ----------- Cargo.lock | 2 ++ README.md | 12 ++++++++- flake.lock | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 49 +++++++++++++++++++++++++++++++++++++ 5 files changed, 129 insertions(+), 15 deletions(-) delete mode 100644 .cargo/config create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/.cargo/config b/.cargo/config deleted file mode 100644 index 2b2e52a..0000000 --- a/.cargo/config +++ /dev/null @@ -1,14 +0,0 @@ -[target.armv7-unknown-linux-gnueabihf] -linker = "/usr/local/oecore-x86_64/sysroots/x86_64-oesdk-linux/usr/bin/arm-oe-linux-gnueabi/arm-oe-linux-gnueabi-gcc" -rustflags = [ - "-C", "link-arg=-march=armv7-a", - "-C", "link-arg=-marm", - "-C", "link-arg=-mfpu=neon", - "-C", "link-arg=-mfloat-abi=hard", - "-C", "link-arg=-mcpu=cortex-a9", - "-C", "link-arg=--sysroot=/usr/local/oecore-x86_64/sysroots/cortexa9hf-neon-oe-linux-gnueabi", -] - -[build] -# Set the default --target flag -target = "armv7-unknown-linux-gnueabihf" diff --git a/Cargo.lock b/Cargo.lock index e9e700a..6609f49 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,5 +1,7 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +version = 3 + [[package]] name = "anyhow" version = "1.0.37" diff --git a/README.md b/README.md index 39fd3d6..d08df2d 100644 --- a/README.md +++ b/README.md @@ -169,7 +169,17 @@ Steps you can try if the script isn't working: If you want to play with the `restream` code, you will have to [install Rust](https://www.rust-lang.org/learn/get-started). -There are two ways of building the required restream binary for streaming the reMarkable framebuffer. For both approaches, the generated restream binary will be located under `target/armv7-unknown-linux-gnueabihf/release/restream`. +There are three ways of building the required restream binary for streaming the reMarkable framebuffer. For these approaches, the generated restream binary will be located under `target/armv7-unknown-linux-gnueabihf/release/restream`. + +- **Using nix flakes** + With [Nix](https://nixos.org/guides/install-nix.html) installed and + [Nix flakes](https://nixos.wiki/wiki/Flakes#Installing_flakes) enabled, you + can easily setup the devlopment environment with: + ``` + nix develop + ``` + After which you can simply run `cargo build --release` to build the restream + binary. - **Using docker and the toltec toolchain:** You can use the [toltec toolchain docker images](https://github.com/toltec-dev/toolchain) to build a restream binary compatible with the reMarkable. diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..a66f1b6 --- /dev/null +++ b/flake.lock @@ -0,0 +1,67 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1634851050, + "narHash": "sha256-N83GlSGPJJdcqhUxSCS/WwW5pksYf3VP1M13cDRTSVA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "c91f3de5adaf1de973b797ef7485e441a65b8935", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1635844945, + "narHash": "sha256-tZcL307dj28jgEU1Wdn+zwG9neyW0H2+ZjdVhvJxh9g=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "b67e752c29f18a0ca5534a07661366d6a2c2e649", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs", + "rust-overlay": "rust-overlay" + } + }, + "rust-overlay": { + "inputs": { + "flake-utils": [ + "flake-utils" + ], + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1635992196, + "narHash": "sha256-+Duob7Ashxc/2pyhzZI3peZRLUlbzcmy2ZLzZN0Oups=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "a7d961b654c38b85877db7af4fac57ba3eaede16", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..8f90aa5 --- /dev/null +++ b/flake.nix @@ -0,0 +1,49 @@ +{ + description = "Stream the reMarkable screen to your computer"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + rust-overlay = { + url = "github:oxalica/rust-overlay"; + inputs.nixpkgs.follows = "nixpkgs"; + inputs.flake-utils.follows = "flake-utils"; + }; + }; + outputs = {self, nixpkgs, flake-utils, rust-overlay, ... }: + flake-utils.lib.eachDefaultSystem (system: + let + overlays = [ (import rust-overlay) ]; + pkgs = import nixpkgs { + inherit system overlays; + }; + in + with pkgs; + { + devShell = mkShell { + buildInputs = [ + remarkable-toolchain + (rust-bin.stable.latest.default.override { + targets = [ "armv7-unknown-linux-gnueabihf" ]; + extensions = [ "rust-src" ]; + }) + openssl.dev + pkg-config + cargo-watch + cargo-limit + shellcheck + lz4 + ]; + CARGO_BUILD_TARGET="armv7-unknown-linux-gnueabihf"; + CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER="${pkgs.remarkable-toolchain}/sysroots/x86_64-codexsdk-linux/usr/bin/arm-remarkable-linux-gnueabi/arm-remarkable-linux-gnueabi-gcc"; + CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_RUSTFLAGS=[ + "-C link-arg=-march=armv7-a" + "-C link-arg=-marm" + "-C link-arg=-mfpu=neon" + "-C link-arg=-mfloat-abi=hard" + "-C link-arg=-mcpu=cortex-a9" + "-C link-arg=--sysroot=${pkgs.remarkable-toolchain}/sysroots/cortexa9hf-neon-remarkable-linux-gnueabi" + ]; + }; + }); +} From 85f4104796feccec710c6a94e828a53d5dae3fa2 Mon Sep 17 00:00:00 2001 From: Rien Maertens <rien.maertens@posteo.be> Date: Thu, 4 Nov 2021 16:58:13 +0100 Subject: [PATCH 27/30] Also add a shell.nix --- README.md | 13 +++++-------- default.nix | 27 +++++++++++++++++++++++++++ flake.nix | 26 +------------------------- shell.nix | 8 ++++++++ 4 files changed, 41 insertions(+), 33 deletions(-) create mode 100644 default.nix create mode 100644 shell.nix diff --git a/README.md b/README.md index d08df2d..9874719 100644 --- a/README.md +++ b/README.md @@ -172,14 +172,11 @@ If you want to play with the `restream` code, you will have to [install Rust](ht There are three ways of building the required restream binary for streaming the reMarkable framebuffer. For these approaches, the generated restream binary will be located under `target/armv7-unknown-linux-gnueabihf/release/restream`. - **Using nix flakes** - With [Nix](https://nixos.org/guides/install-nix.html) installed and - [Nix flakes](https://nixos.wiki/wiki/Flakes#Installing_flakes) enabled, you - can easily setup the devlopment environment with: - ``` - nix develop - ``` - After which you can simply run `cargo build --release` to build the restream - binary. + With [Nix](https://nixos.org/guides/install-nix.html) installed you can + create the development environment with `nix-shell` or (when using + [Nix flakes](https://nixos.wiki/wiki/Flakes#Installing_flakes) `nix-develop`. + After which you can simply run `cargo build --release` to build the restream + binary on your machine. - **Using docker and the toltec toolchain:** You can use the [toltec toolchain docker images](https://github.com/toltec-dev/toolchain) to build a restream binary compatible with the reMarkable. diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..42d06de --- /dev/null +++ b/default.nix @@ -0,0 +1,27 @@ +{ + devShell = pkgs: with pkgs; mkShell { + buildInputs = [ + remarkable-toolchain + (rust-bin.stable.latest.default.override { + targets = [ "armv7-unknown-linux-gnueabihf" ]; + extensions = [ "rust-src" ]; + }) + openssl.dev + pkg-config + cargo-watch + cargo-limit + shellcheck + lz4 + ]; + CARGO_BUILD_TARGET="armv7-unknown-linux-gnueabihf"; + CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER="${pkgs.remarkable-toolchain}/sysroots/x86_64-codexsdk-linux/usr/bin/arm-remarkable-linux-gnueabi/arm-remarkable-linux-gnueabi-gcc"; + CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_RUSTFLAGS=[ + "-C link-arg=-march=armv7-a" + "-C link-arg=-marm" + "-C link-arg=-mfpu=neon" + "-C link-arg=-mfloat-abi=hard" + "-C link-arg=-mcpu=cortex-a9" + "-C link-arg=--sysroot=${pkgs.remarkable-toolchain}/sysroots/cortexa9hf-neon-remarkable-linux-gnueabi" + ]; + }; +} diff --git a/flake.nix b/flake.nix index 8f90aa5..23ee015 100644 --- a/flake.nix +++ b/flake.nix @@ -20,30 +20,6 @@ in with pkgs; { - devShell = mkShell { - buildInputs = [ - remarkable-toolchain - (rust-bin.stable.latest.default.override { - targets = [ "armv7-unknown-linux-gnueabihf" ]; - extensions = [ "rust-src" ]; - }) - openssl.dev - pkg-config - cargo-watch - cargo-limit - shellcheck - lz4 - ]; - CARGO_BUILD_TARGET="armv7-unknown-linux-gnueabihf"; - CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER="${pkgs.remarkable-toolchain}/sysroots/x86_64-codexsdk-linux/usr/bin/arm-remarkable-linux-gnueabi/arm-remarkable-linux-gnueabi-gcc"; - CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_RUSTFLAGS=[ - "-C link-arg=-march=armv7-a" - "-C link-arg=-marm" - "-C link-arg=-mfpu=neon" - "-C link-arg=-mfloat-abi=hard" - "-C link-arg=-mcpu=cortex-a9" - "-C link-arg=--sysroot=${pkgs.remarkable-toolchain}/sysroots/cortexa9hf-neon-remarkable-linux-gnueabi" - ]; - }; + devShell = (import ./default.nix).devShell pkgs; }); } diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..d69c239 --- /dev/null +++ b/shell.nix @@ -0,0 +1,8 @@ +let + pkgs = import <nixpkgs> { + overlays = [ + (import (builtins.fetchTarball "https://github.com/oxalica/rust-overlay/archive/master.tar.gz")) + ]; + }; + reStreamDev = import ./default.nix; +in reStreamDev.devShell pkgs From d3422b14439c615058ea4eb7636ba432a2a5c023 Mon Sep 17 00:00:00 2001 From: Rien Maertens <rien.maertens@posteo.be> Date: Thu, 4 Nov 2021 19:52:59 +0100 Subject: [PATCH 28/30] Add workflow to build rust binary --- .github/workflows/check.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index a468cde..a4bf63c 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -33,3 +33,19 @@ jobs: - name: Shell Formatter run: docker run -v $GITHUB_WORKSPACE:/mnt -w /mnt mvdan/shfmt -d reStream.sh + + build: + # The type of runner that the job will run on + runs-on: ubuntu-latest + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v2 + + - uses: cachix/install-nix-action@v14.1 + with: + nix_path: nixpkgs=channel:nixos-unstable + + - run: nix-shell + - run: cargo build From 9deee838c9d3d7c1bd1270f3083260106c9c4e80 Mon Sep 17 00:00:00 2001 From: Rien Maertens <rien.maertens@posteo.be> Date: Thu, 4 Nov 2021 20:07:43 +0100 Subject: [PATCH 29/30] v1.2.0 --- Cargo.lock | 2 +- Cargo.toml | 2 +- reStream.sh | 7 +++++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6609f49..3aa3f32 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -204,7 +204,7 @@ dependencies = [ [[package]] name = "restream" -version = "1.1.0" +version = "1.2.0" dependencies = [ "anyhow", "clap", diff --git a/Cargo.toml b/Cargo.toml index 49bb155..5131f6d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "restream" -version = "1.1.0" +version = "1.2.0" authors = ["Rien Maertens <rien.maertens@posteo.be>"] edition = "2018" diff --git a/reStream.sh b/reStream.sh index 1973c88..f750914 100755 --- a/reStream.sh +++ b/reStream.sh @@ -1,5 +1,8 @@ #!/bin/sh +# Current reStream.sh version +version="1.2.0" + # default values for arguments remarkable="10.11.99.1" # remarkable connected through USB landscape=true # rotate 90 degrees to the right @@ -15,6 +18,10 @@ unsecure_connection=false # Establish a unsecure connection that is faster # loop through arguments and process them while [ $# -gt 0 ]; do case "$1" in + -v | --version) + echo "reStream version: v$version" + exit + ;; -p | --portrait) landscape=false shift From 3862d9c5c85d09c58e985f01049989f15a3d2830 Mon Sep 17 00:00:00 2001 From: Rien Maertens <rien.maertens@posteo.be> Date: Sun, 13 Feb 2022 13:26:34 +0100 Subject: [PATCH 30/30] Allow setting remarkable with environment variable --- default.nix | 1 + reStream.sh | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/default.nix b/default.nix index 42d06de..59c78bf 100644 --- a/default.nix +++ b/default.nix @@ -11,6 +11,7 @@ cargo-watch cargo-limit shellcheck + shfmt lz4 ]; CARGO_BUILD_TARGET="armv7-unknown-linux-gnueabihf"; diff --git a/reStream.sh b/reStream.sh index f750914..6da63f4 100755 --- a/reStream.sh +++ b/reStream.sh @@ -4,16 +4,16 @@ version="1.2.0" # default values for arguments -remarkable="10.11.99.1" # remarkable connected through USB -landscape=true # rotate 90 degrees to the right -output_path=- # display output through ffplay -format=- # automatic output format -webcam=false # not to a webcam -hflip=false # horizontal flip webcam -measure_throughput=false # measure how fast data is being transferred -window_title=reStream # stream window title is reStream -video_filters="" # list of ffmpeg filters to apply -unsecure_connection=false # Establish a unsecure connection that is faster +remarkable="${REMARKABLE_IP:-10.11.99.1}" # remarkable IP address +landscape=true # rotate 90 degrees to the right +output_path=- # display output through ffplay +format=- # automatic output format +webcam=false # not to a webcam +hflip=false # horizontal flip webcam +measure_throughput=false # measure how fast data is being transferred +window_title=reStream # stream window title is reStream +video_filters="" # list of ffmpeg filters to apply +unsecure_connection=false # Establish a unsecure connection that is faster # loop through arguments and process them while [ $# -gt 0 ]; do