From f1614c8e290e7106fb62ff36c316b1b3787e1e21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matt=C3=A9o=20Delabre?= Date: Thu, 8 Apr 2021 17:13:40 +0200 Subject: [PATCH] server: Change instructions to use xochitl & set process name to rm2fb-server See #56 and toltec-dev/toltec#325 for context. --- README.md | 2 +- scripts/run.sh | 2 +- src/server/main.cpp | 4 ++++ src/server/test.sh | 2 +- src/shared/swtfb.cpp | 2 +- 5 files changed, 8 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 081cad1..5cb66d8 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ build `src/server/librm2fb_server.so.1.0.1`. Copy it to your remarkable and run: ``` -LD_PRELOAD=/path/to/librm2fb_server.so.1.0.1 /usr/bin/remarkable-shutdown +LD_PRELOAD=/path/to/librm2fb_server.so.1.0.1 /usr/bin/xochitl ``` ### Framebuffer Client Shim diff --git a/scripts/run.sh b/scripts/run.sh index 497a346..48c8216 100755 --- a/scripts/run.sh +++ b/scripts/run.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" systemctl stop xochitl -LD_PRELOAD=${DIR}/librm2fb_server.so.1.0.0 `which remarkable-shutdown` & +LD_PRELOAD=${DIR}/librm2fb_server.so.1.0.0 `which xochitl` & pid=$! sleep 2 LD_PRELOAD=${DIR}/librm2fb_client.so.1.0.0 $* diff --git a/src/server/main.cpp b/src/server/main.cpp index 755be17..4186060 100755 --- a/src/server/main.cpp +++ b/src/server/main.cpp @@ -173,6 +173,10 @@ int __libc_start_main(int (*_main)(int, char **, char **), int argc, swtfb::SDK_BIN = argv[0]; fprintf(stderr, "BIN FILE: %s\n", argv[0]); + size_t argv0_len = strlen(argv[0]); + strncpy(argv[0], "rm2fb-server", argv0_len); + argv[0][argv0_len] = 0; + return func_main(server_main, argc, argv, init, fini, rtld_fini, stack_end); }; }; diff --git a/src/server/test.sh b/src/server/test.sh index 8ac9dbd..ae2922c 100755 --- a/src/server/test.sh +++ b/src/server/test.sh @@ -1 +1 @@ -make && scp librm2fb.so.1.0.0 rm: && ssh -tt rm "LD_PRELOAD=/home/root/librm2fb.so.1.0.0 ./remarkable-shutdown" +make && scp librm2fb.so.1.0.0 rm: && ssh -tt rm "LD_PRELOAD=/home/root/librm2fb.so.1.0.0 /usr/bin/xochitl" diff --git a/src/shared/swtfb.cpp b/src/shared/swtfb.cpp index 153405d..29a5424 100644 --- a/src/shared/swtfb.cpp +++ b/src/shared/swtfb.cpp @@ -17,7 +17,7 @@ using namespace std; namespace swtfb { -string SDK_BIN = "/usr/bin/remarkable-shutdown"; +string SDK_BIN = "/usr/bin/xochitl"; // todo: make it singleton class SwtFB { const int maxWidth = 1404;