pub struct KoboPowerManager {
model: Model,
initial_cpu_states: Mutex<Vec<PathBuf>>,
}Expand description
Kobo-specific power manager.
Manages the low-level hardware sleep/wake cycle on Kobo e-reader devices. It interacts directly with the Linux sysfs interface to manage screen power and RAM suspension.
§Example
ⓘ
use cadmus_core::device::Model;
use cadmus_core::device::power::PowerManager;
// Access via the global device singleton
if let Ok(power) = CURRENT_DEVICE.power_manager() {
power.suspend().ok();
}Fields§
§model: Model§initial_cpu_states: Mutex<Vec<PathBuf>>Implementations§
Trait Implementations§
Source§impl PowerManager for KoboPowerManager
impl PowerManager for KoboPowerManager
Source§fn suspend(&self) -> Result<(), PowerError>
fn suspend(&self) -> Result<(), PowerError>
Suspends the Kobo device.
This method performs a sequenced hardware shutdown:
- Deactivates the touch screen to prevent phantom touches on wake up.
- Sleeps for 2 seconds to allow pending sysfs writes to finalize safely.
- Synchronizes filesystem buffers (
sync()). - Writes
"mem"to/sys/power/stateto trigger low-power RAM suspension.
§Errors
Returns PowerError::Io if writing to any of the sysfs control nodes fails.
Source§fn resume(&self) -> Result<(), PowerError>
fn resume(&self) -> Result<(), PowerError>
Resumes the Kobo device.
This method performs the following wakeup tasks:
- Reactivates the touch screen by writing
"0"to the state-extended node. - If the model is a
GloHDorAuraH2O, writes"a"to theneocmdnode to re-initialize the touch controller.
§Errors
Returns PowerError::Io if writing to any of the sysfs wake up nodes fails.
Source§fn init_cores(&self) -> Result<(), PowerError>
fn init_cores(&self) -> Result<(), PowerError>
Initializes and enables all available CPU cores on startup. Read more
Source§fn restore_cores(&self) -> Result<(), PowerError>
fn restore_cores(&self) -> Result<(), PowerError>
Restores CPU cores to their initial state on shutdown. Read more
Auto Trait Implementations§
impl !Freeze for KoboPowerManager
impl RefUnwindSafe for KoboPowerManager
impl Send for KoboPowerManager
impl Sync for KoboPowerManager
impl Unpin for KoboPowerManager
impl UnsafeUnpin for KoboPowerManager
impl UnwindSafe for KoboPowerManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Converts
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Converts
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Converts
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Converts
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more