RECOMPILE einkvnc TO RUN IN LANDSCAPE MODE:
** tested only on my Clara HD, try at your own risk! **
***SECURITY REMINDER***
Telnet sessions are in cleartext INCLUDING LOGIN SESSIONS, so only use on a private network, if at all!
If you always have DEVMODE set to ON for
whatever reasons , that means Telnet is on by default, unless you toggle it off , e.g. using NickelMenu.
You can install KOReader to get the more secure SSH option, and NiLuJe's
kobostuff provides a package that includes an SSH binary.
You can
start the KOReader SSH server via NickelMenu.
**********************************
NOTE: YOU MUST ALSO ROTATE THE VNC SERVER DEVICE TO LANDSCAPE ORIENTATION.
(Put the ClaraHD in landscape mode using the SECOND nickel menu entry):
# Nickel_Orientation Actions
menu_item : main : Orientation - LANDSCAPE - handle above : nickel_orientation: landscape
menu_item : main : Orientation - LANDSCAPE - handle below : nickel_orientation: inverted_landscape
menu_item : main : Orientation - PORTRAIT - handle on left : nickel_orientation: inverted_portrait
menu_item : main : Orientation - PORTRAIT - handle on right : nickel_orientation: portrait
#
IF YOU RUN THE ORIGINAL BINARY (FROM A TELNET CLIENT):
(droidVNC-NG vnc server scaling @ 70%, LANDSCAPE ORIENTATION)
# RUST_LOG=debug ./einkvnc 192.168.43.235 5900 --password mypw --contrast 2
Spoiler:
[2023-04-11T20:15:58Z INFO einkvnc] connecting to 192.168.43.235:5900
[2023-04-11T20:15:58Z DEBUG einkvnc::vnc::client] <- Version::Rfb38
[2023-04-11T20:15:58Z DEBUG einkvnc::vnc::client] -> Version::Rfb38
[2023-04-11T20:15:59Z DEBUG einkvnc::vnc::client] <- SecurityTypes([VncAuthentication, Unknown(16)])
[2023-04-11T20:15:59Z DEBUG einkvnc] available authentication methods: [Password]
[2023-04-11T20:15:59Z DEBUG einkvnc::vnc::client] -> SecurityType::VncAuthentication
[2023-04-11T20:15:59Z DEBUG einkvnc::vnc::client] -> ClientInit { shared: true }
[2023-04-11T20:15:59Z DEBUG einkvnc::vnc::client] <- ServerInit { framebuffer_width: 1408, framebuffer_height: 840, pixel_format: PixelFormat { bits_per_pixel: 32, depth: 32, big_endian: false, true_colour: true, red_max: 255, green_max: 255, blue_max: 255, red_shift: 0, green_shift: 8, blue_shift: 16 }, name: "Nexus 7" }
[2023-04-11T20:15:59Z INFO einkvnc] connected to "Nexus 7", 1408x840 framebuffer
[2023-04-11T20:15:59Z INFO einkvnc] received PixelFormat { bits_per_pixel: 32, depth: 32, big_endian: false, true_colour: true, red_max: 255, green_max: 255, blue_max: 255, red_shift: 0, green_shift: 8, blue_shift: 16 }
[2023-04-11T20:15:59Z DEBUG einkvnc::vnc::client] 0
[2023-04-11T20:15:59Z DEBUG einkvnc::vnc::client] 01
[2023-04-11T20:15:59Z DEBUG einkvnc::vnc::client] 02
[2023-04-11T20:15:59Z DEBUG einkvnc::vnc::client] <- FramebufferUpdate { count: 1 }
[2023-04-11T20:15:59Z DEBUG einkvnc::vnc::client] <- Rectangle { x_position: 0, y_position: 0, width: 1408, height: 840, encoding: Raw }
[2023-04-11T20:16:00Z DEBUG einkvnc::vnc::client] <- ...pixels
[2023-04-11T20:16:00Z DEBUG einkvnc::vnc::client] 1
[2023-04-11T20:16:00Z DEBUG einkvnc::vnc::client] -> SetPixelFormat(PixelFormat { bits_per_pixel: 8, depth: 16, big_endian: false, true_colour: true, red_max: 255, green_max: 255, blue_max: 255, red_shift: 16, green_shift: 8, blue_shift: 0 })
[2023-04-11T20:16:00Z DEBUG einkvnc::vnc::client] 2
[2023-04-11T20:16:00Z DEBUG einkvnc::vnc::client] 3
[2023-04-11T20:16:00Z INFO einkvnc] enforced PixelFormat { bits_per_pixel: 8, depth: 16, big_endian: false, true_colour: true, red_max: 255, green_max: 255, blue_max: 255, red_shift: 16, green_shift: 8, blue_shift: 0 }
[2023-04-11T20:16:00Z DEBUG einkvnc::vnc::client] -> SetEncodings([CopyRect, Zrle])
Framebuffer rotation: 1 -> 1.
[2023-04-11T20:16:00Z DEBUG einkvnc] End of frame!
[2023-04-11T20:16:00Z DEBUG einkvnc::vnc::client] <- FramebufferUpdate { count: 1 }
[2023-04-11T20:16:00Z DEBUG einkvnc::vnc::client] <- Rectangle { x_position: 0, y_position: 0, width: 1408, height: 840, encoding: Zrle }
[2023-04-11T20:16:00Z DEBUG einkvnc::vnc::client] <- ...compressed pixels
[2023-04-11T20:16:00Z DEBUG einkvnc] Put pixels
[2023-04-11T20:16:00Z DEBUG einkvnc] network Δt: 0
[2023-04-11T20:16:00Z DEBUG einkvnc] postproc Δt: 0
[2023-04-11T20:16:00Z DEBUG einkvnc] draw Δt: 2
[2023-04-11T20:16:00Z DEBUG einkvnc] rects Δt: 2
LANDSCAPE MODE DIDN'T WORK.
NOW RECOMPILE THE einkvnc SOURCE:
$ cd Downloads/eink-vnc-main/
$ grep -n -r -C2 'Framebuffer rotation:' client/
client/src/framebuffer/kobo1.rs-321- self.frame_size = (self.var_info.yres * self.fix_info.line_length) as libc::size_t;
client/src/framebuffer/kobo1.rs-322-
client/src/framebuffer/kobo1.rs:323: println!("Framebuffer rotation: {} -> {}.", n, self.rotation());
client/src/framebuffer/kobo1.rs-324-
client/src/framebuffer/kobo1.rs-325- Ok((self.var_info.xres, self.var_info.yres))
$ grep -n -r -C2 'set_rotation(' client/
client/src/main.rs-206- {
client/src/main.rs-207- let startup_rotation = 1;
client/src/main.rs:208: fb.set_rotation(startup_rotation).ok();
client/src/main.rs-209- }
client/src/main.rs-210-
--
client/src/framebuffer/mod.rs-45- fn wait(&self, token: u32) -> Result<i32, Error>;
client/src/framebuffer/mod.rs-46- fn save(&self, path: &str) -> Result<(), Error>;
client/src/framebuffer/mod.rs:47: fn set_rotation(&mut self, n: i8) -> Result<(u32, u32), Error>;
client/src/framebuffer/mod.rs-48- fn set_monochrome(&mut self, enable: bool);
client/src/framebuffer/mod.rs-49- fn set_dithered(&mut self, enable: bool);
--
MODIFY LINE 207 in main.rs TO:
{
let startup_rotation = rotarg;
fb.set_rotation(startup_rotation).ok();
}
ADD AN ADDITIONAL ARGUMENT TO main.rs AT LINE 102:
.arg(
Arg::with_name("ROTARG")
.help("rotation (1-4), tested on a Clara HD, try at own risk")
.long("rotarg")
.takes_value(true),
)
.get_matches();
let rotarg = value_t!(matches.value_of("ROTARG"), i8).unwrap_or(1);
if (rotarg < 1) || (rotarg > 4) {
rotarg = 1;
}
let host = matches.value_of("HOST").unwrap();
$ cd client/
$ ./build.sh
$ cp target/arm-unknown-linux-gnueabihf/release/einkvnc ../einkvncROTARG
COPY THE einkvncROTARG BINARY TO YOUR KOBO AND TRY AGAIN:
(droidVNC-NG vnc server scaling @ 70%, LANDSCAPE ORIENTATION)
# RUST_LOG=debug ./einkvncROTARG 192.168.43.235 5900 --password mypw --contrast 2 --rotarg 2
Spoiler:
[2023-04-11T21:31:12Z INFO einkvnc] connecting to 192.168.43.235:5900
[2023-04-11T21:31:12Z DEBUG einkvnc::vnc::client] <- Version::Rfb38
[2023-04-11T21:31:12Z DEBUG einkvnc::vnc::client] -> Version::Rfb38
[2023-04-11T21:31:12Z DEBUG einkvnc::vnc::client] <- SecurityTypes([VncAuthentication, Unknown(16)])
[2023-04-11T21:31:12Z DEBUG einkvnc] available authentication methods: [Password]
[2023-04-11T21:31:12Z DEBUG einkvnc::vnc::client] -> SecurityType::VncAuthentication
[2023-04-11T21:31:12Z DEBUG einkvnc::vnc::client] -> ClientInit { shared: true }
[2023-04-11T21:31:12Z DEBUG einkvnc::vnc::client] <- ServerInit { framebuffer_width: 1408, framebuffer_height: 840, pixel_format: PixelFormat { bits_per_pixel: 32, depth: 32, big_endian: false, true_colour: true, red_max: 255, green_max: 255, blue_max: 255, red_shift: 0, green_shift: 8, blue_shift: 16 }, name: "Nexus 7" }
[2023-04-11T21:31:12Z INFO einkvnc] connected to "Nexus 7", 1408x840 framebuffer
[2023-04-11T21:31:12Z INFO einkvnc] received PixelFormat { bits_per_pixel: 32, depth: 32, big_endian: false, true_colour: true, red_max: 255, green_max: 255, blue_max: 255, red_shift: 0, green_shift: 8, blue_shift: 16 }
[2023-04-11T21:31:12Z DEBUG einkvnc::vnc::client] 0
[2023-04-11T21:31:12Z DEBUG einkvnc::vnc::client] 01
[2023-04-11T21:31:12Z DEBUG einkvnc::vnc::client] 02
[2023-04-11T21:31:12Z DEBUG einkvnc::vnc::client] <- FramebufferUpdate { count: 1 }
[2023-04-11T21:31:12Z DEBUG einkvnc::vnc::client] <- Rectangle { x_position: 0, y_position: 0, width: 1408, height: 840, encoding: Raw }
[2023-04-11T21:31:13Z DEBUG einkvnc::vnc::client] <- ...pixels
[2023-04-11T21:31:13Z DEBUG einkvnc::vnc::client] 1
[2023-04-11T21:31:13Z DEBUG einkvnc::vnc::client] -> SetPixelFormat(PixelFormat { bits_per_pixel: 8, depth: 16, big_endian: false, true_colour: true, red_max: 255, green_max: 255, blue_max: 255, red_shift: 16, green_shift: 8, blue_shift: 0 })
[2023-04-11T21:31:13Z DEBUG einkvnc::vnc::client] 2
[2023-04-11T21:31:13Z DEBUG einkvnc::vnc::client] 3
[2023-04-11T21:31:13Z INFO einkvnc] enforced PixelFormat { bits_per_pixel: 8, depth: 16, big_endian: false, true_colour: true, red_max: 255, green_max: 255, blue_max: 255, red_shift: 16, green_shift: 8, blue_shift: 0 }
[2023-04-11T21:31:13Z DEBUG einkvnc::vnc::client] -> SetEncodings([CopyRect, Zrle])
Framebuffer rotation: 2 -> 2.
[2023-04-11T21:31:13Z DEBUG einkvnc] End of frame!
[2023-04-11T21:31:13Z DEBUG einkvnc::vnc::client] <- FramebufferUpdate { count: 1 }
[2023-04-11T21:31:13Z DEBUG einkvnc::vnc::client] <- Rectangle { x_position: 0, y_position: 0, width: 1408, height: 840, encoding: Zrle }
[2023-04-11T21:31:13Z DEBUG einkvnc::vnc::client] <- ...compressed pixels
[2023-04-11T21:31:13Z DEBUG einkvnc] Put pixels
[2023-04-11T21:31:13Z DEBUG einkvnc] network Δt: 0
[2023-04-11T21:31:13Z DEBUG einkvnc] postproc Δt: 0
[2023-04-11T21:31:13Z DEBUG einkvnc] draw Δt: 0
[2023-04-11T21:31:13Z DEBUG einkvnc] rects Δt: 0
***LANDSCAPE MODE IS WORKING WITH RECOMPILED SOURCE!***
Try running it from your android phone running telnet app ConnectBot:
# ./einkvncROTARG 192.168.43.235 5900 --password mypw --contrast 2 --rotarg 2 &
# vi hellovnc.txt
(:wq to quit)
# pkill ./einkvncROTARG
These are the rotarg values for each orientation on the Clara HD:
# Nickel_Orientation Actions
menu_item : main : Orientation - LANDSCAPE - handle above : nickel_orientation: landscape -> --rotarg 4
menu_item : main : Orientation - LANDSCAPE - handle below : nickel_orientation: inverted_landscape -> --rotarg 2
menu_item : main : Orientation - PORTRAIT - handle on left : nickel_orientation: inverted_portrait -> --rotarg 1
menu_item : main : Orientation - PORTRAIT - handle on right : nickel_orientation: portrait -> --rotarg 3
#
Pssst...
***
For those who don't have time or resources for a recompile, it is theoretically possible to just modify the einkvnc binary in a hex editor to run in landscape mode.
Don't ask me who is making this claim - let's just say you got it from "Diff" and "Hexdump" - Try at your own risk!
***
First download the official binary:
wget
https://github.com/everydayanchovies.../0.1.0/einkvnc
Remember line 207 in src/main.rs that shows startup_rotation being hardcoded equal to 1?
Well it shows up in address 00023578:01 20 A0 E3 in einkvnc1 that we compiled ourself:
$ hexedit einkvnc1
00023564 FC 13 8D E5 F8 53 8D E5 80 10 8D E5 2C 30 91 E5 05 10 A0 E1 .....S......,0......
00023578 01 20 A0 E3 84 50 8D E5 33 FF 2F E1 70 06 9D E5 00 00 50 E3 . ...P..3./.p.....P.
0002358C 03 00 00 0A 74 06 9D E5 00 04 8D E5 01 0B 8D E2 B6 BA 03 EB ....t...............
So copy the official binary to einkvnc2 and try to find the equivalent address (which will show a slightly different surrounding data due to differing build environments used):
$ cp einkvnc einkvnc2
$ hexedit einkvnc2
00048AA8 96 0F 8E E2 F8 43 8D E5 2C 30 91 E5 04 10 A0 E1 01 20 A0 E3 .....C..,0....... ..
00048ABC 33 FF 2F E1 58 06 9D E5 00 00 50 E3 03 00 00 0A 5C 06 9D E5 3./.X.....P.....\...
See the "01 20 A0 E3" after the "F8 43 8D E5 2C 30 91 E5 04 10 A0 E1"?
Edit the "01 20 A0 E3" at address 00048AB8 to "02 20 A0 E3"
(Ctrl-x to save and exit)
COPY THE MODDED einkvnc2 BINARY TO YOUR KOBO AND TRY AGAIN:
NOTE: YOU MUST ALSO ROTATE THE VNC SERVER DEVICE TO LANDSCAPE ORIENTATION.
Put the ClaraHD in landscape mode using the SECOND nickel menu entry):
# Nickel_Orientation Actions
menu_item : main : Orientation - LANDSCAPE - handle above : nickel_orientation: landscape
menu_item : main : Orientation - LANDSCAPE - handle below : nickel_orientation: inverted_landscape
menu_item : main : Orientation - PORTRAIT - handle on left : nickel_orientation: inverted_portrait
menu_item : main : Orientation - PORTRAIT - handle on right : nickel_orientation: portrait
#
Run your modded binary from a telnet client (like ConnectBot from F-Droid.org) e.g. from your vnc server device :
(droidVNC-NG vnc server scaling @ 70%, LANDSCAPE ORIENTATION)
# RUST_LOG=debug ./einkvnc2 192.168.43.235 5900 --password mypw --contrast 2
***Try at your own risk! Yes it's just software, but if your device gets locked in an unknown state, you are 100% responsible!***