Add parameters to README, ssh timeout to 1s

Changed the README to reflect the command line options added with
bcf62e3. Also incorporates the SSH timeout of 1 second added by the
initial PR (#10).

Co-authored-by: Aaron David Schneider <aaron.david.schneider@gmail.com>
This commit is contained in:
Rien Maertens 2020-04-02 14:14:36 +02:00
parent bcf62e3ae7
commit 382944058e
No known key found for this signature in database
GPG Key ID: AE66CE42F1AF9DEF
2 changed files with 24 additions and 16 deletions

View File

@ -14,9 +14,14 @@ reMarkable screen sharing over SSH.
1. Connect your reMarkable with the USB cable.
2. Make sure you can [open an SSH connection](https://remarkablewiki.com/tech/ssh).
3. Run `./reStream.sh` for landscape mode, or `./reStram.sh -p` for portrait mode.
3. Run `./reStream.sh`
4. A screen will pop-up on your local machine, with a live view of your reMarkable!
### Options
- `-p --portrait`: shows the reMarkable screen in portrait mode (the default is landscape mode, 90 degrees rotated tot the right)
- `-d --destination`: the ssh destination of the reMarkable (default: `root@10.11.99.1`)
If you have problems, don't hesitate to [open an issue](https://github.com/rien/reStream/issues/new) or [send me an email](mailto:rien.maertens@posteo.be).
## Requirements

View File

@ -1,23 +1,25 @@
#!/bin/sh
# these are probably the only two parameters you need to change
ssh_host="root@10.11.99.1" # location of the remarkable
landscape=true # default vertical
# default values for arguments
ssh_host="root@10.11.99.1" # remarkable connected trough USB
landscape=true # rotate 90 degrees to the right
# Loop through arguments and process them
# loop through arguments and process them
for arg in "$@"
do
case $arg in
-p|--portrait)
landscape=false
shift
;;
landscape=false
shift
;;
-d|--destination)
ssh_host="$2"
shift
shift
;;
ssh_host="$2"
shift
shift
;;
*)
echo "Usage: $0 [-p] [-d <destination>]"
exit 1
esac
done
@ -27,9 +29,10 @@ height=1872
bytes_per_pixel=2
loop_wait="true"
loglevel="info"
ssh_cmd="ssh -o ConnectTimeout=1 "$ssh_host""
# check if we are able to reach the remarkable
if ! ssh "$ssh_host" true; then
if ! $ssh_cmd true; then
echo "$ssh_host unreachable"
exit 1
fi
@ -44,9 +47,9 @@ fallback_to_gzip() {
# check if lz4 is present on remarkable
if ssh "$ssh_host" "[ -f /opt/bin/lz4 ]"; then
if $ssh_cmd "[ -f /opt/bin/lz4 ]"; then
compress="/opt/bin/lz4"
elif ssh "$ssh_host" "[ -f ~/lz4 ]"; then
elif $ssh_cmd "[ -f ~/lz4 ]"; then
compress="~/lz4"
fi
@ -78,7 +81,7 @@ read_loop="while $head_fb0; do $loop_wait; done | $compress"
set -e # stop if an error occurs
ssh "$ssh_host" "$read_loop" \
$ssh_cmd "$read_loop" \
| $decompress \
| ffplay -vcodec rawvideo \
-loglevel "$loglevel" \