#[no_mangle]
pub unsafe extern "C" fn crosvm_client_fake_power(
    socket_path: *const c_char,
    battery_type: *const c_char,
    max_battery_capacity: u32
) -> bool
Expand description

Fakes the battery status of crosvm instance. The power status will always be on battery, and the maximum battery capacity could be read by guest is set to the max_battery_capacity.

The function returns true on success or false if an error occurred.

§Arguments

  • socket_path - Path to the crosvm control socket
  • battery_type - Type of battery emulation corresponding to vm_tools::BatteryType
  • max_battery_capacity - maximum battery capacity could be read by guest

§Safety

The caller will ensure the raw pointers in arguments passed in can be safely used by CStr::from_ptr()