New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow disabling the automatic use of our internal swtfb client by setting an env #118
base: master
Are you sure you want to change the base?
Conversation
…ct old way This should ensure that binaries built using this version are fixable without recompiling should issues with our current rm2fb client arise.
Sorry, but my pc has a billion toolchains and I'm not sure which one right now compiles correctly
@@ -50,7 +50,19 @@ impl Framebuffer { | |||
let device = &*device::CURRENT_DEVICE; | |||
match device.model { | |||
Model::Gen1 => Framebuffer::device(device.get_framebuffer_path()), | |||
Model::Gen2 => Framebuffer::rm2fb(device.get_framebuffer_path()), | |||
Model::Gen2 => { | |||
// Auto-select old method still if env LIBREMARKABLE_FB_DISFAVOR_INTERNAL_RM2FB is set affirmatively |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a mention in the README about this behavior plz?
if let Ok(env_answer) = std::env::var("LIBREMARKABLE_FB_DISFAVOR_INTERNAL_RM2FB") { | ||
let env_answer = env_answer.to_lowercase(); | ||
if env_answer == "1" || env_answer == "true" || env_answer == "yes" { | ||
Framebuffer::device(device.get_framebuffer_path()) | ||
} else { | ||
Framebuffer::rm2fb(device.get_framebuffer_path()) | ||
} | ||
} else { | ||
Framebuffer::rm2fb(device.get_framebuffer_path()) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about this? (untested)
if let Ok(env_answer) = std::env::var("LIBREMARKABLE_FB_DISFAVOR_INTERNAL_RM2FB") { | |
let env_answer = env_answer.to_lowercase(); | |
if env_answer == "1" || env_answer == "true" || env_answer == "yes" { | |
Framebuffer::device(device.get_framebuffer_path()) | |
} else { | |
Framebuffer::rm2fb(device.get_framebuffer_path()) | |
} | |
} else { | |
Framebuffer::rm2fb(device.get_framebuffer_path()) | |
} | |
match std::env::var("LIBREMARKABLE_FB_DISFAVOR_INTERNAL_RM2FB").ok() { | |
Some("1") => Framebuffer::device(device.get_framebuffer_path()), | |
_ => Framebuffer::rm2fb(device.get_framebuffer_path()), | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(I'm more inclined to be restrictive in the possible values, but feel free to revert that)
There was an issue raised at #117 where presumably a new library is used as a shim for rM 2 Framebuffer support, but it doesn't seem to use the offical server, which our client relies on.
In general there had been issues raised that issues could arise even with the official shim if it gets updated but our implementation still does the old behaviour. Such applications would require to be recompiled to use
Framebuffer::device
instead ofFramebuffer::new
or otherwise not work.This PR allows people to make libremarkable choose the old implementation in case the developer didn't care about it anyway / left the choice up to libremarkable.
It is done by setting the lengthy env
LIBREMARKABLE_FB_DISFAVOR_INTERNAL_RM2FB
to1
,yes
ortrue
(case-insensitive). Feel free to suggest a better name, I couldn't think of any.Package maintainers could also fix arising issues by setting that env in some wrapper script for that binary without the need of any source code change or even re-complication if the binary is recent enough.
Basically this should future proof applications built using libremarkable better.