Skip to content

Commit

Permalink
Check env when using Framebuffer::new() or Default trait to auto-sele…
Browse files Browse the repository at this point in the history
…ct old way

This should ensure that binaries built using this version are fixable without
recompiling should issues with our current rm2fb client arise.
  • Loading branch information
LinusCDE committed Jan 26, 2024
1 parent f00fc82 commit 53605b2
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/framebuffer/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,16 @@ 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
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())

Check failure on line 58 in src/framebuffer/core.rs

View workflow job for this annotation

GitHub Actions / Test Suite

mismatched types

Check failure on line 58 in src/framebuffer/core.rs

View workflow job for this annotation

GitHub Actions / Test Suite on gnueabihf

mismatched types

Check failure on line 58 in src/framebuffer/core.rs

View workflow job for this annotation

GitHub Actions / Check

mismatched types

Check failure on line 58 in src/framebuffer/core.rs

View workflow job for this annotation

GitHub Actions / Clippy

mismatched types

Check failure on line 58 in src/framebuffer/core.rs

View workflow job for this annotation

GitHub Actions / Demo with gnueabihf

mismatched types

Check failure on line 58 in src/framebuffer/core.rs

View workflow job for this annotation

GitHub Actions / Demo with musl

mismatched types
}
}
Framebuffer::rm2fb(device.get_framebuffer_path())
}
}
}

Expand Down

0 comments on commit 53605b2

Please sign in to comment.