X-Git-Url: http://git.euphorik.ch/?a=blobdiff_plain;f=src%2Fmachine.rs;h=ac60e7208f9ef5f083acd66b1942fc8d82ec2c00;hb=0c50e4418792d9f5b78ef1c96d66514058beec26;hp=9d150dbecf58719396036f8d07fabf6315af18d9;hpb=bfb3de4d11feee1307654936452e3776ccb3a056;p=temp2RGB.git diff --git a/src/machine.rs b/src/machine.rs index 9d150db..ac60e72 100644 --- a/src/machine.rs +++ b/src/machine.rs @@ -2,7 +2,8 @@ use log::error; use nvapi::sys::i2c; use crate::{ - a770, asus_aura_usb, corsair_lighting_pro, corsair_vengeance, cpu_temperature, intel_arc, rgb, + /*a770,*/ asus_aura_usb, corsair_lighting_pro, corsair_vengeance, cpu_temperature, + intel_arc, rgb, }; const RGB_FUSION2_GPU_REG_COLOR: u8 = 0x40; @@ -19,8 +20,9 @@ pub trait Machine { pub struct MachineJiji { ram: Vec, b650e_device: asus_aura_usb::Device, - a770: a770::A770, - gpu_devices: intel_arc::Devices, + // a770: a770::A770, + // gpu_devices: intel_arc::Devices, + gpus: Vec, } impl MachineJiji { @@ -32,8 +34,9 @@ impl MachineJiji { corsair_vengeance::Controller::new(0x1B), ], b650e_device: asus_aura_usb::Device::new(&api, asus_aura_usb::Motherboard::Asus650e)?, - a770: a770::A770::new()?, - gpu_devices: unsafe { intel_arc::GetDevices() }, + // a770: a770::A770::new()?, + // gpu_devices: unsafe { intel_arc::GetDevices() }, + gpus: nvapi::PhysicalGpu::enumerate()?, }) } } @@ -44,13 +47,16 @@ impl Machine for MachineJiji { controller.set_color(&color); } self.b650e_device.set_color(&color); - if let Err(error) = self.a770.set_color(color.red, color.green, color.blue) { - error!("Unable to set color: {:?}", error); - } + // if let Err(error) = self.a770.set_color(color.red, color.green, color.blue) { + // error!("Unable to set color: {:?}", error); + // } } fn get_gpu_tmp(&self) -> f32 { - unsafe { intel_arc::GetTemperature(self.gpu_devices, 0) as f32 } + // unsafe { intel_arc::GetTemperature(self.gpu_devices, 0) as f32 } + self.gpus[0].thermal_settings(None).unwrap()[0] + .current_temperature + .0 as f32 } fn get_cpu_tmp(&self) -> f32 { @@ -58,13 +64,13 @@ impl Machine for MachineJiji { } } -impl Drop for MachineJiji { - fn drop(&mut self) { - unsafe { - intel_arc::FreeDevices(self.gpu_devices); - } - } -} +// impl Drop for MachineJiji { +// fn drop(&mut self) { +// unsafe { +// intel_arc::FreeDevices(self.gpu_devices); +// } +// } +// } pub struct MachineLyssMetal { crosshair_device: asus_aura_usb::Device,