use wmi::{COMLibrary, Variant, WMIConnection};
-use crate::{a770, corsair_vengeance, rgb::RGB, sensors_jiji, AsusAuraUSB};
+use crate::{
+ a770, asus_aura_usb, corsair_lighting_pro, corsair_vengeance, cpu_temperature, machine,
+ rgb::RGB, winring0, wrapper_winring0,
+};
pub fn tests() {
println!("Running some tests...");
- test_asus_aura_usb(AsusAuraUSB::Motherboard::AsusCrosshairVIIIHero);
+ winring0::init();
+
+ test_asus_aura_usb(asus_aura_usb::Motherboard::AsusCrosshairVIIIHero);
+ // test_corsair_lighting_pro();
// list_usb_devices();
// test_roccat();
// test_wmi();
// test_corsair();
// test_a770();
- // test_read_temp();
+ // test_read_temperature_cpu();
+ // test_read_temperature_a770()
+ // test_read_temperature_3080();
+
+ winring0::deinit();
println!("Press any key to continue...");
std::io::stdin().read_line(&mut String::new()).unwrap();
// );
// }
-fn test_asus_aura_usb(motherboard: AsusAuraUSB::Motherboard) {
+fn test_asus_aura_usb(motherboard: asus_aura_usb::Motherboard) {
let api = hidapi::HidApi::new().unwrap();
- let device = AsusAuraUSB::Device::new(&api, motherboard);
+ let device = asus_aura_usb::Device::new(&api, motherboard);
println!("Firmware: {}", device.get_firmware_string());
println!("Number of leds: {}", configuration[0x1B]);
println!("Number of RGB headers: {}", configuration[0x1D]);
- // Only once, at start.
- device.set_fixed_mode();
-
device.set_color(&RGB {
red: 0,
green: 0,
device.save_current_color();
}
+fn test_corsair_lighting_pro() {
+ let api = hidapi::HidApi::new().unwrap();
+ let device = corsair_lighting_pro::Device::new(
+ &api,
+ &RGB {
+ red: 0,
+ green: 255,
+ blue: 0,
+ },
+ );
+
+ for i in 0..=255 {
+ if i % 10 == 0 || i == 255 || i == 0 {
+ device.set_color(&RGB {
+ red: i as u8,
+ green: 255u8 - i as u8,
+ blue: 0,
+ });
+ std::thread::sleep(std::time::Duration::from_millis(200));
+ }
+ }
+}
+
fn test_corsair() {
let corsair_controllers = [
corsair_vengeance::Controller::new(0x19),
corsair_vengeance::Controller::new(0x1B),
];
+
for controller in corsair_controllers {
controller.set_color(&RGB {
red: 0,
a770.set_color(255, 0, 0);
}
-fn test_read_temp() {
- let sensors = sensors_jiji::Sensors::new();
- println!("temp cpu: {}", sensors.read_cpu_temp());
- println!("temp gpu: {}", sensors.read_gpu_temp());
+const F17H_M01H_THM_TCON_CUR_TMP: u32 = 0x00059800;
+const F17H_TEMP_OFFSET_FLAG: u32 = 0x80000;
+const FAMILY_17H_PCI_CONTROL_REGISTER: u32 = 0x60;
+
+fn test_read_temperature_cpu() {
+ println!("temp cpu: {}", cpu_temperature::read())
+}
+
+fn test_read_temperature_a770() {
+ let jiji: &dyn machine::Machine = &machine::MachineJiji::new();
+ println!("temp gpu: {}", jiji.get_gpu_tmp());
+}
+
+fn test_read_temperature_3080() {
+ nvapi::initialize().expect("Unable to initialize nvapi (Nvidia API)");
+ // if let Ok(gpus) = {
+ // for gpu in gpus {
+ // let thermal = gpu.thermal_settings(None).unwrap()[0];
+ // println!("{:?}", thermal.current_temperature.0)
+ // }
+ // }
+ let gpus = nvapi::PhysicalGpu::enumerate().unwrap();
+ let gpu = &gpus[0];
+ let sensor = gpu.thermal_settings(None).unwrap()[0];
+ println!("{:?}", sensor.current_temperature.0);
+ nvapi::unload().unwrap();
}