mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
Cause great pain to self with cargo-deny + cargo-cranky
This commit is contained in:
@@ -23,7 +23,7 @@ pub enum PlatformError {
|
||||
|
||||
impl fmt::Display for PlatformError {
|
||||
// This trait requires `fmt` with this exact signature.
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
PlatformError::ParseVendor => write!(f, "Parse gfx vendor error"),
|
||||
PlatformError::ParseNum => write!(f, "Parse number error"),
|
||||
|
||||
@@ -19,7 +19,7 @@ pub const VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||
|
||||
pub(crate) fn to_device(sys_path: &Path) -> Result<Device> {
|
||||
Device::from_syspath(sys_path)
|
||||
.map_err(|e| PlatformError::Udev("Couldn't transform syspath to device".to_string(), e))
|
||||
.map_err(|e| PlatformError::Udev("Couldn't transform syspath to device".to_owned(), e))
|
||||
}
|
||||
|
||||
pub fn has_attr(device: &Device, attr_name: &str) -> bool {
|
||||
@@ -39,7 +39,7 @@ pub fn read_attr_bool(device: &Device, attr_name: &str) -> Result<bool> {
|
||||
}
|
||||
return Ok(true);
|
||||
}
|
||||
Err(PlatformError::AttrNotFound(attr_name.to_string()))
|
||||
Err(PlatformError::AttrNotFound(attr_name.to_owned()))
|
||||
}
|
||||
|
||||
pub fn write_attr_bool(device: &mut Device, attr: &str, value: bool) -> Result<()> {
|
||||
@@ -53,7 +53,7 @@ pub fn read_attr_u8(device: &Device, attr_name: &str) -> Result<u8> {
|
||||
let tmp = value.to_string_lossy();
|
||||
return tmp.parse::<u8>().map_err(|_| PlatformError::ParseNum);
|
||||
}
|
||||
Err(PlatformError::AttrNotFound(attr_name.to_string()))
|
||||
Err(PlatformError::AttrNotFound(attr_name.to_owned()))
|
||||
}
|
||||
|
||||
pub fn write_attr_u8(device: &mut Device, attr: &str, value: u8) -> Result<()> {
|
||||
@@ -71,7 +71,7 @@ pub fn read_attr_u8_array(device: &Device, attr_name: &str) -> Result<Vec<u8>> {
|
||||
.collect();
|
||||
return Ok(tmp);
|
||||
}
|
||||
Err(PlatformError::AttrNotFound(attr_name.to_string()))
|
||||
Err(PlatformError::AttrNotFound(attr_name.to_owned()))
|
||||
}
|
||||
|
||||
pub fn write_attr_u8_array(device: &mut Device, attr: &str, values: &[u8]) -> Result<()> {
|
||||
|
||||
@@ -11,12 +11,12 @@ use crate::{
|
||||
};
|
||||
|
||||
/// The "platform" device provides access to things like:
|
||||
/// - dgpu_disable
|
||||
/// - egpu_enable
|
||||
/// - panel_od
|
||||
/// - gpu_mux
|
||||
/// - keyboard_mode, set keyboard RGB mode and speed
|
||||
/// - keyboard_state, set keyboard power states
|
||||
/// - `dgpu_disable`
|
||||
/// - `egpu_enable`
|
||||
/// - `panel_od`
|
||||
/// - `gpu_mux`
|
||||
/// - `keyboard_mode`, set keyboard RGB mode and speed
|
||||
/// - `keyboard_state`, set keyboard power states
|
||||
#[derive(Debug, PartialEq, Eq, PartialOrd, Clone)]
|
||||
pub struct AsusPlatform {
|
||||
path: PathBuf,
|
||||
|
||||
@@ -9,12 +9,12 @@ use crate::{
|
||||
};
|
||||
|
||||
/// The "platform" device provides access to things like:
|
||||
/// - dgpu_disable
|
||||
/// - egpu_enable
|
||||
/// - panel_od
|
||||
/// - gpu_mux
|
||||
/// - keyboard_mode, set keyboard RGB mode and speed
|
||||
/// - keyboard_state, set keyboard power states
|
||||
/// - `dgpu_disable`
|
||||
/// - `egpu_enable`
|
||||
/// - `panel_od`
|
||||
/// - `gpu_mux`
|
||||
/// - `keyboard_mode`, set keyboard RGB mode and speed
|
||||
/// - `keyboard_state`, set keyboard power states
|
||||
#[derive(Debug, PartialEq, Eq, PartialOrd, Clone)]
|
||||
pub struct AsusPower {
|
||||
mains: PathBuf,
|
||||
|
||||
@@ -11,7 +11,7 @@ impl USBRaw {
|
||||
for device in rusb::devices()?.iter() {
|
||||
let device_desc = device.device_descriptor()?;
|
||||
if device_desc.vendor_id() == 0x0b05 && device_desc.product_id() == id_product {
|
||||
let handle = Self::get_dev_handle(device)?;
|
||||
let handle = Self::get_dev_handle(&device)?;
|
||||
return Ok(Self(handle));
|
||||
}
|
||||
}
|
||||
@@ -23,7 +23,7 @@ impl USBRaw {
|
||||
}
|
||||
|
||||
fn get_dev_handle(
|
||||
device: Device<rusb::GlobalContext>,
|
||||
device: &Device<rusb::GlobalContext>,
|
||||
) -> Result<DeviceHandle<rusb::GlobalContext>> {
|
||||
// We don't expect this ID to ever change
|
||||
let mut device = device.open()?;
|
||||
|
||||
Reference in New Issue
Block a user