08e6bd08f9bf0e3f23d92dd83f97a155c22c8889
1 use std
::collections
::HashMap
;
3 use wmi
::{COMLibrary
, Variant
, WMIConnection
};
5 use crate::{a770
, corsair_vengeance
, rgb
::RGB
, sensors_jiji
, AsusAuraUSB
};
8 println!("Running some tests...");
10 test_asus_aura_usb(AsusAuraUSB
::Motherboard
::AsusCrosshairVIIIHero
);
11 // list_usb_devices();
18 println!("Press any key to continue...");
19 std
::io
::stdin().read_line(&mut String
::new()).unwrap();
23 let com_con
= COMLibrary
::new().unwrap();
24 let wmi_con
= WMIConnection
::new(com_con
.into()).unwrap();
26 //let results: Vec<HashMap<String, Variant>> = wmi_con.raw_query("SELECT * FROM Win32_PnPSignedDriver WHERE Description LIKE '%SMBUS%' OR Description LIKE '%SM BUS%'").unwrap();
27 //let results: Vec<HashMap<String, Variant>> = wmi_con.raw_query("SELECT * FROM Win32_PnPSignedDriver WHERE Description LIKE 'Intel(R) NF I2C Host Controller'").unwrap();
28 let results
: Vec
<HashMap
<String
, Variant
>> = wmi_con
29 .raw_query("SELECT * FROM Win32_PnPSignedDriver")
31 //let results: Vec<HashMap<String, Variant>> = wmi_con.raw_query("SELECT * FROM Win32_PnPAllocatedResource").unwrap();
34 println!("-------------------");
35 println!("{:#?}", os
);
39 fn list_usb_devices() {
40 let api
= hidapi
::HidApi
::new().unwrap();
41 for device
in api
.device_list() {
42 println!("{:?}", device
);
43 println!("name: {}", device
.product_string().unwrap());
44 println!("interface number: {}", device
.interface_number());
45 println!("page: {}", device
.usage_page());
46 println!("usage: {}", device
.usage());
52 // let api = hidapi::HidApi::new().unwrap();
53 // let roccat_device = roccat::get_device(&api);
55 // let manufacturer = roccat_device.get_manufacturer_string().unwrap();
56 // dbg!(manufacturer);
58 // let product = roccat_device.get_product_string().unwrap();
61 // let serial = roccat_device.get_serial_number_string().unwrap();
64 // roccat::init(&roccat_device);
75 fn test_asus_aura_usb(motherboard
: AsusAuraUSB
::Motherboard
) {
76 let api
= hidapi
::HidApi
::new().unwrap();
78 let device
= AsusAuraUSB
::Device
::new(&api
, motherboard
);
80 println!("Firmware: {}", device
.get_firmware_string());
82 let configuration
= device
.get_configuration_table();
83 println!("Configuration:");
85 print!("{:02X} ", configuration
[i
]);
90 println!("Number of addressable header: {}", configuration
[0x02]);
91 println!("Number of leds: {}", configuration
[0x1B]);
92 println!("Number of RGB headers: {}", configuration
[0x1D]);
94 // Only once, at start.
95 device
.set_fixed_mode();
97 device
.set_color(&RGB
{
103 device
.save_current_color();
107 let corsair_controllers
= [
108 corsair_vengeance
::Controller
::new(0x19),
109 corsair_vengeance
::Controller
::new(0x1B),
111 for controller
in corsair_controllers
{
112 controller
.set_color(&RGB
{
121 // a770::set_rgb(255, 0, 0);
122 let mut a770
= a770
::A770
::new();
123 a770
.set_color(255, 0, 0);
126 fn test_read_temp() {
127 let sensors
= sensors_jiji
::Sensors
::new();
128 println!("temp cpu: {}", sensors
.read_cpu_temp());
129 println!("temp gpu: {}", sensors
.read_gpu_temp());