Struct fwupd_dbus::Device
source · pub struct Device {Show 25 fields
pub checksum: Option<Box<str>>,
pub created: u64,
pub description: Option<Box<str>>,
pub device_id: DeviceId,
pub flags: DeviceFlags,
pub flashes_left: Option<u32>,
pub guid: Box<[Box<str>]>,
pub icon: Box<[Box<str>]>,
pub install_duration: Option<u32>,
pub instance_ids: Box<[Box<str>]>,
pub modified: Option<u64>,
pub name: Box<str>,
pub parent_device_id: Option<DeviceId>,
pub plugin: Box<str>,
pub serial: Option<Box<str>>,
pub summary: Option<Box<str>>,
pub update_error: Option<Box<str>>,
pub update_message: Option<Box<str>>,
pub update_state: Option<UpdateState>,
pub vendor_id: Box<str>,
pub vendor: Box<str>,
pub version_bootloader: Option<Box<str>>,
pub version_format: Option<VersionFormat>,
pub version_lowest: Option<Box<str>>,
pub version: Box<str>,
}
Expand description
A device that is potentially-supported by fwupd.
Fields§
§checksum: Option<Box<str>>
§created: u64
§description: Option<Box<str>>
§device_id: DeviceId
§flags: DeviceFlags
§flashes_left: Option<u32>
§guid: Box<[Box<str>]>
§icon: Box<[Box<str>]>
§install_duration: Option<u32>
§instance_ids: Box<[Box<str>]>
§modified: Option<u64>
§name: Box<str>
§parent_device_id: Option<DeviceId>
§plugin: Box<str>
§serial: Option<Box<str>>
§summary: Option<Box<str>>
§update_error: Option<Box<str>>
§update_message: Option<Box<str>>
§update_state: Option<UpdateState>
§vendor_id: Box<str>
§vendor: Box<str>
§version_bootloader: Option<Box<str>>
§version_format: Option<VersionFormat>
§version_lowest: Option<Box<str>>
§version: Box<str>
Implementations§
source§impl Device
impl Device
sourcepub fn has_flag(&self, flags: DeviceFlags) -> bool
pub fn has_flag(&self, flags: DeviceFlags) -> bool
Check if the given DeviceFlag
is set.
sourcepub fn is_supported(&self) -> bool
pub fn is_supported(&self) -> bool
Checks if the device is supported by fwupd.
sourcepub fn is_updateable(&self) -> bool
pub fn is_updateable(&self) -> bool
Determins if the device is updateable or not.
Examples found in repository?
examples/example.rs (line 48)
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
fn main_() -> Result<(), Box<dyn Error>> {
// Atomic value used to stop the background thread.
let cancellable = Arc::new(AtomicBool::new(true));
// Begin listening to signals in the background
listen_in_background(cancellable.clone());
// Create a new dbus client connection.
let fwupd = &Client::new()?;
println!("Version: {}", fwupd.daemon_version()?);
println!("Status: {:?}", fwupd.status()?);
println!("Tainted: {}", fwupd.tainted()?);
if let Ok(percent) = fwupd.percentage() {
println!("Percentage; {}", percent);
}
// Fetch a list of supported devices.
for device in fwupd.devices()? {
println!("Device: {:#?}", device);
if device.is_updateable() {
if let Ok(upgrades) = fwupd.upgrades(&device) {
println!(" upgrades found");
for upgrade in upgrades {
println!("{:#?}", upgrade);
}
} else {
println!(" no updates available");
}
if let Ok(downgrades) = fwupd.downgrades(&device) {
println!(" downgrades found");
for downgrade in downgrades {
println!("{:#?}", downgrade);
}
}
if let Ok(releases) = fwupd.releases(&device) {
println!(" releases found");
for release in releases {
println!("{:#?}", release);
}
}
} else {
println!(" device not updateable");
}
}
// Fetch a list of remotes, and update them.
for remote in fwupd.remotes()? {
println!("{:#?}", remote);
remote.update_metadata(fwupd)?;
}
loop {
std::thread::sleep(Duration::from_secs(1));
}
// Stop listening to signals in the background.
cancellable.store(true, Ordering::SeqCst);
Ok(())
}
sourcepub fn needs_reboot(&self) -> bool
pub fn needs_reboot(&self) -> bool
Checks if the device requires a reboot.
sourcepub fn only_offline(&self) -> bool
pub fn only_offline(&self) -> bool
Check if the device must be updated offline.
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for Device
impl Send for Device
impl Sync for Device
impl Unpin for Device
impl UnwindSafe for Device
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> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> NoneValue for Twhere
T: Default,
impl<T> NoneValue for Twhere T: Default,
type NoneType = T
§fn null_value() -> T
fn null_value() -> T
The none-equivalent value.