Add support for rm2fb
This commit is contained in:
parent
3187c03e88
commit
42f0dd116d
12
reStream.sh
12
reStream.sh
@ -98,10 +98,16 @@ case "$rm_version" in
|
||||
pixel_format="rgb565le"
|
||||
;;
|
||||
"reMarkable 2.0")
|
||||
pixel_format="gray8"
|
||||
if ssh_cmd "[ -f /dev/shm/swtfb.01 ]"; then
|
||||
width=1404
|
||||
height=1872
|
||||
pixel_format="rgb565le"
|
||||
else
|
||||
width=1872
|
||||
height=1404
|
||||
pixel_format="gray8"
|
||||
video_filters="$video_filters,transpose=2"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported reMarkable version: $rm_version."
|
||||
@ -123,7 +129,7 @@ if ! lz4 -V >/dev/null; then
|
||||
fi
|
||||
|
||||
# check if restream binay is present on remarkable
|
||||
if ssh_cmd "[ ! -f ~/restream ]"; then
|
||||
if ssh_cmd "[ ! -f ~/restream ] && [ ! -f /opt/bin/restream ]"; then
|
||||
echo "The restream binary is not installed on your reMarkable."
|
||||
echo "Please install it using the instruction in the README:"
|
||||
echo "https://github.com/rien/reStream/#installation"
|
||||
@ -180,7 +186,7 @@ fi
|
||||
set -e # stop if an error occurs
|
||||
|
||||
# shellcheck disable=SC2086
|
||||
ssh_cmd "./restream" \
|
||||
ssh_cmd 'PATH="$PATH:/opt/bin/:." restream' \
|
||||
| $decompress \
|
||||
| $host_passthrough \
|
||||
| "$output_cmd" \
|
||||
|
10
src/main.rs
10
src/main.rs
@ -7,25 +7,29 @@ use lz_fear::CompressionSettings;
|
||||
|
||||
use std::default::Default;
|
||||
use std::fs::File;
|
||||
use std::path::Path;
|
||||
use std::io::{BufRead, BufReader, Read, Seek, SeekFrom};
|
||||
use std::process::Command;
|
||||
|
||||
fn main() -> Result<()> {
|
||||
let version = remarkable_version()?;
|
||||
let height = 1872;
|
||||
let streamer = if version == "reMarkable 1.0\n" {
|
||||
let width = 1408;
|
||||
let height = 1872;
|
||||
let bytes_per_pixel = 2;
|
||||
ReStreamer::init("/dev/fb0", 0, width, height, bytes_per_pixel)?
|
||||
} else if version == "reMarkable 2.0\n" {
|
||||
let width = 1404;
|
||||
let height = 1872;
|
||||
if Path::new("/dev/shm/swtfb.01").exists() {
|
||||
let bytes_per_pixel = 2;
|
||||
ReStreamer::init("/dev/shm/swtfb.01", 0, width, height, bytes_per_pixel)?
|
||||
} else {
|
||||
let bytes_per_pixel = 1;
|
||||
|
||||
let pid = xochitl_pid()?;
|
||||
let offset = rm2_fb_offset(pid)?;
|
||||
let mem = format!("/proc/{}/mem", pid);
|
||||
ReStreamer::init(&mem, offset, width, height, bytes_per_pixel)?
|
||||
}
|
||||
} else {
|
||||
Err(anyhow!(
|
||||
"Unknown reMarkable version: {}\nPlease open a feature request to support your device.",
|
||||
|
Loading…
x
Reference in New Issue
Block a user