Skip to content
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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 13 additions & 1 deletion src/framebuffer/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Collaborator

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())
}
Comment on lines +55 to +64
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about this? (untested)

Suggested change
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()),
}

Copy link
Collaborator

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)

}
}
}

Expand Down