From 2e280f889dbf1e4405ab6b51078ce9b9c1e996c5 Mon Sep 17 00:00:00 2001 From: Rien Maertens Date: Sun, 1 Nov 2020 20:28:51 +0100 Subject: [PATCH] Use head and tail instead of dd --- reStream.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/reStream.sh b/reStream.sh index e11cd01..cc5e57f 100755 --- a/reStream.sh +++ b/reStream.sh @@ -116,7 +116,7 @@ case "$rm_version" in # it is actually the map allocated _after_ the fb0 mmap read_address="grep -C1 '/dev/fb0' /proc/$pid/maps | tail -n1 | sed 's/-.*$//'" skip_bytes_hex="$(ssh_cmd "$read_address")" - skip_bytes="$((0x$skip_bytes_hex))" + skip_bytes="$((0x$skip_bytes_hex + 8))" echo "framebuffer is at 0x$skip_bytes_hex" # carve the framebuffer out of the process memory @@ -127,7 +127,7 @@ case "$rm_version" in # Using dd with bs=1 is too slow, so we first carve out the pages our desired # bytes are located in, and then we trim the resulting data with what we need. - head_fb0="dd if=/proc/$pid/mem bs=$page_size skip=$window_start_blocks count=$window_length_blocks 2>/dev/null | dd if=/dev/stdin skip=$window_offset bs=1 count=$window_bytes 2>/dev/null" + head_fb0="dd if=/proc/$pid/mem bs=$page_size skip=$window_start_blocks count=$window_length_blocks 2>/dev/null | tail -c+$window_offset | head -c $window_bytes" ;; *) echo "Unsupported reMarkable version: $rm_version."