pub struct DeviceMetadata {
pub vendor_id: u16,
pub product_id: u16,
pub serial_number: String,
pub firmware_version: String,
pub partition: String,
pub manufacturer: String,
pub product: String,
}Expand description
Device metadata read from Kobo version file.
Fields§
§vendor_id: u16§product_id: u16§serial_number: String§firmware_version: String§partition: String§manufacturer: String§product: StringImplementations§
Source§impl DeviceMetadata
impl DeviceMetadata
Sourcepub fn read() -> Result<Self, DeviceError>
pub fn read() -> Result<Self, DeviceError>
Reads device metadata from /mnt/onboard/.kobo/version.
The version file is a single comma-separated line with the following fields:
| Index | Field | Example |
|---|---|---|
| 0 | Serial number | NXXXXXXXXXXXXX |
| 1 | Kernel Version | 4.9.77 |
| 2 | Firmware version | 4.45.23640 |
| 3 | Kernel Version | 4.9.77 |
| 4 | Kernel Version | 4.9.77 |
| 5 | Model number | 390 or 00000000-0000-0000-0000-000000000390 |
Example file contents (Libra Colour):
NXXXXXXXXXXXXX,4.9.77,4.45.23640,4.9.77,4.9.77,00000000-0000-0000-0000-000000000390§Errors
Returns DeviceError if:
- the version file cannot be read or has fewer than 6 fields, or
- the
PLATFORMenvironment variable is not set.
fn parse(content: &str, platform: &Platform) -> Result<Self, DeviceError>
Trait Implementations§
Source§impl Clone for DeviceMetadata
impl Clone for DeviceMetadata
Source§fn clone(&self) -> DeviceMetadata
fn clone(&self) -> DeviceMetadata
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for DeviceMetadata
impl RefUnwindSafe for DeviceMetadata
impl Send for DeviceMetadata
impl Sync for DeviceMetadata
impl Unpin for DeviceMetadata
impl UnwindSafe for DeviceMetadata
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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