pub struct PowerSupply { /* private fields */ }
Expand description

Power supply.

Implementations

Open the power supply by file path.

Example
use corsairmi::PowerSupply;

let psu: PowerSupply = PowerSupply::open("/dev/hidraw5")?;
// call psu methods here

Get the power supply model.

Example
use corsairmi::PowerSupply;

let psu: PowerSupply = PowerSupply::open("/dev/hidraw5")?;
// e.g. "PSU model: HX580i"
println!("PSU model: {:?}", psu.model());

PC uptime.

This is the duration that the PSU has been powering your PC.

Example
use corsairmi::PowerSupply;

let mut psu: PowerSupply = PowerSupply::open("/dev/hidraw5")?;
// e.g. "PC uptime: 6935s"
println!("PC uptime: {:?}", psu.pc_uptime()?);

Power supply uptime.

This is the duration that the PSU has been connected to AC power, regardless of whether or not your PC has been powered on.

Example
use corsairmi::PowerSupply;

let mut psu: PowerSupply = PowerSupply::open("/dev/hidraw5")?;
// e.g. "PSU uptime: 10535s"
println!("PSU uptime: {:?}", psu.uptime()?);

Model name.

This often contains the same information as PowerSupply::model, but this method is more expensive to call.

Example
use corsairmi::PowerSupply;

let mut psu: PowerSupply = PowerSupply::open("/dev/hidraw5")?;
// e.g. "PSU name: HX850i"
println!("PSU name: {:?}", psu.name()?);

Vendor name.

Example
use corsairmi::PowerSupply;

let mut psu: PowerSupply = PowerSupply::open("/dev/hidraw5")?;
// e.g. "PSU name: CORSAIR"
println!("PSU name: {:?}", psu.vendor()?);

Product name.

This often contains the same information as PowerSupply::model, but this method is more expensive to call.

Example
use corsairmi::PowerSupply;

let mut psu: PowerSupply = PowerSupply::open("/dev/hidraw5")?;
// e.g. "PSU product: HX850i"
println!("PSU product: {:?}", psu.product()?);

Temperature reading in Celsius.

I do not know what this is a temperature reading of.

Example
use corsairmi::PowerSupply;

let mut psu: PowerSupply = PowerSupply::open("/dev/hidraw5")?;
// e.g. "Temperature: 42.25"
println!("Temperature: {:.2}", psu.temp1()?);

Temperature reading in Celsius.

I do not know what this is a temperature reading of.

Example
use corsairmi::PowerSupply;

let mut psu: PowerSupply = PowerSupply::open("/dev/hidraw5")?;
// e.g. "Temperature: 34.25"
println!("Temperature: {:.2}", psu.temp2()?);

Fan rotations per minute.

Example
use corsairmi::PowerSupply;

let mut psu: PowerSupply = PowerSupply::open("/dev/hidraw5")?;
// e.g. "RPM: 0.0"
println!("RPM: {:.1}", psu.rpm()?);

Input voltage in volts.

Example
use corsairmi::PowerSupply;

let mut psu: PowerSupply = PowerSupply::open("/dev/hidraw5")?;
// e.g. "Input voltage: 115.0"
println!("Input voltage: {:.1}", psu.input_voltage()?);

Input power in watts.

Example
use corsairmi::PowerSupply;

let mut psu: PowerSupply = PowerSupply::open("/dev/hidraw5")?;
// e.g. "Input power: 18.0"
println!("Input power: {:.1}", psu.input_power()?);

Input current in amps.

This is derived from the input power and input voltage.

Example
use corsairmi::PowerSupply;

let mut psu: PowerSupply = PowerSupply::open("/dev/hidraw5")?;
// e.g. "Input current: 0.16"
println!("Input current: {:.2}", psu.input_current()?);

Select the output rail to read from.

This should be called before calling PowerSupply::output_voltage, PowerSupply::output_current, or PowerSupply::output_power.

Example
use corsairmi::{PowerSupply, Rail, RAILS};

let mut psu: PowerSupply = PowerSupply::open("/dev/hidraw5")?;
for rail in RAILS.iter() {
    psu.output_select(*rail)?;
    println!("{} output voltage: {}V", rail, psu.output_voltage()?);
    println!("{} output current: {}A", rail, psu.output_current()?);
    println!("{} output power: {}W", rail, psu.output_power()?);
}

Get the output voltage in volts.

Call PowerSupply::output_select to select the rail to read from.

Example
use corsairmi::{PowerSupply, Rail};

let mut psu: PowerSupply = PowerSupply::open("/dev/hidraw5")?;
psu.output_select(Rail::Rail12v)?;
println!("12V rail output voltage: {}V", psu.output_voltage()?);

Get the output current in amps.

Call PowerSupply::output_select to select the rail to read from.

Example
use corsairmi::{PowerSupply, Rail};

let mut psu: PowerSupply = PowerSupply::open("/dev/hidraw5")?;
psu.output_select(Rail::Rail12v)?;
println!("12V rail output current: {}A", psu.output_current()?);

Get the output power in watts.

Call PowerSupply::output_select to select the rail to read from.

Example
use corsairmi::{PowerSupply, Rail};

let mut psu: PowerSupply = PowerSupply::open("/dev/hidraw5")?;
psu.output_select(Rail::Rail12v)?;
println!("12V rail output power: {}W", psu.output_power()?);

Trait Implementations

Formats the value using the given formatter. Read more
Converts to this type from the input type.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.