-
Notifications
You must be signed in to change notification settings - Fork 111
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
Commits df549f and c8c036 may not be correct for all Libra 2 #241
Comments
Fascinating! I'll get you details from mine. Mine is brand new as of last week, direct from the Canadian Kobo store, so I wouldn't be surprised if it's the latest revision if any. |
For what it's worth, with my patches I checked the front light worked, with colour temperature control.
Merging #185 and possibly adopting a similar solution for the front-light might be worth the trouble, given these differences are within a single model. I notice you have a newer firmware revision, but mine is reporting that I'm up to date. I would be surprised if that revision update had major changes to the device tree, but I suppose it's possible! Full output of
|
The @thataboy Can you also post the output of |
per req
|
Straightforward patch: diff --git a/src/battery/kobo.rs b/src/battery/kobo.rs
index 24388e7..31d302a 100644
--- a/src/battery/kobo.rs
+++ b/src/battery/kobo.rs
@@ -31,10 +31,10 @@ pub struct KoboBattery {
impl KoboBattery {
pub fn new() -> Result<KoboBattery, Error> {
- let base = if CURRENT_DEVICE.mark() < 8 {
- Path::new(BATTERY_INTERFACE_A)
- } else {
+ let base = if Path::new(BATTERY_INTERFACE_B).exists() {
Path::new(BATTERY_INTERFACE_B)
+ } else {
+ Path::new(BATTERY_INTERFACE_A)
};
let capacity = File::open(base.join(BATTERY_CAPACITY))?;
let status = File::open(base.join(BATTERY_STATUS))?;
diff --git a/src/frontlight/premixed.rs b/src/frontlight/premixed.rs
index bb73ff4..f186d39 100644
--- a/src/frontlight/premixed.rs
+++ b/src/frontlight/premixed.rs
@@ -1,15 +1,16 @@
+use std::path::Path;
use std::io::Write;
use std::fs::File;
use std::fs::OpenOptions;
use anyhow::Error;
-use crate::device::{CURRENT_DEVICE, Model};
+use crate::device::CURRENT_DEVICE;
use super::{Frontlight, LightLevels};
const FRONTLIGHT_WHITE: &str = "/sys/class/backlight/mxc_msp430.0/brightness";
// Forma
const FRONTLIGHT_ORANGE_A: &str = "/sys/class/backlight/tlc5947_bl/color";
-// Libra H₂O, Clara HD
+// Libra H₂O, Clara HD, Libra 2
const FRONTLIGHT_ORANGE_B: &str = "/sys/class/backlight/lm3630a_led/color";
// Sage, Libra 2
const FRONTLIGHT_ORANGE_C: &str = "/sys/class/leds/aw99703-bl_FL1/color";
@@ -24,12 +25,12 @@ pub struct PremixedFrontlight {
impl PremixedFrontlight {
pub fn new(intensity: f32, warmth: f32) -> Result<PremixedFrontlight, Error> {
let white = OpenOptions::new().write(true).open(FRONTLIGHT_WHITE)?;
- let model = CURRENT_DEVICE.model;
- let orange_path = match model {
- Model::Forma | Model::Forma32GB => FRONTLIGHT_ORANGE_A,
- Model::LibraH2O | Model::ClaraHD => FRONTLIGHT_ORANGE_B,
- Model::Sage | Model::Libra2 => FRONTLIGHT_ORANGE_C,
- _ => FRONTLIGHT_ORANGE_A,
+ let orange_path = if Path::new(FRONTLIGHT_ORANGE_C).exists() {
+ FRONTLIGHT_ORANGE_C
+ } else if Path::new(FRONTLIGHT_ORANGE_B).exists() {
+ FRONTLIGHT_ORANGE_B
+ } else {
+ FRONTLIGHT_ORANGE_A
};
let orange = OpenOptions::new().write(true).open(orange_path)?;
Ok(PremixedFrontlight { intensity, warmth, white, orange }) |
Looks reasonable! I'll build with this patch and test on my Libra 2. |
yes, tested fine. I think @baskerville can push it to master |
After merging these commits (Correct battery code path for Kobo Libra 2, Correct frontlight system path for Kobo Libra 2, resp.) Plato panics on start up for me with
unable to create battery; no such file or directory
.So
mc13892_bat
(BATTERY_INTERFACE_A
) was the correct valuelm3630a_led
(FRONTLIGHT_ORANGE_B
) was the correct value./sys/class/leds/aw99703-bl_FL1/
does not existsPerhaps @ticky has a different version or revision of Libra 2? I have the USA / Walmart affiliate version. Here's my sysinfo
The text was updated successfully, but these errors were encountered: