5 /*a770,*/ asus_aura_usb
, corsair_lighting_pro
, corsair_vengeance
, cpu_temperature
,
6 intel_arc
, lian_li_sl_infinity
, rgb
,
9 const RGB_FUSION2_GPU_REG_COLOR
: u8 = 0x40;
10 const RGB_FUSION2_GPU_REG_MODE
: u8 = 0x88;
12 const GIGABYTE_RTX3080TI_VISION_OC_ADDR
: u8 = 0x63;
15 fn set_color(&mut self, color
: &rgb
::RGB
);
16 fn get_gpu_tmp(&self) -> f32;
17 fn get_cpu_tmp(&self) -> f32;
20 pub struct MachineJiji
{
21 ram
: Vec
<corsair_vengeance
::Controller
>,
22 b650e_device
: asus_aura_usb
::Device
,
24 // gpu_devices: intel_arc::Devices,
25 gpus
: Vec
<nvapi
::PhysicalGpu
>,
29 pub fn new() -> anyhow
::Result
<Self> {
30 let api
= hidapi
::HidApi
::new().unwrap();
33 corsair_vengeance
::Controller
::new(0x19),
34 corsair_vengeance
::Controller
::new(0x1B),
36 b650e_device
: asus_aura_usb
::Device
::new(&api
, asus_aura_usb
::Motherboard
::Asus650e
)?
,
37 // a770: a770::A770::new()?,
38 // gpu_devices: unsafe { intel_arc::GetDevices() },
39 gpus
: nvapi
::PhysicalGpu
::enumerate()?
,
44 impl Machine
for MachineJiji
{
45 fn set_color(&mut self, color
: &rgb
::RGB
) {
46 for controller
in &self.ram
{
47 controller
.set_color(&color
);
49 self.b650e_device
.set_color(&color
);
50 // if let Err(error) = self.a770.set_color(color.red, color.green, color.blue) {
51 // error!("Unable to set color: {:?}", error);
55 fn get_gpu_tmp(&self) -> f32 {
56 // unsafe { intel_arc::GetTemperature(self.gpu_devices, 0) as f32 }
57 self.gpus
[0].thermal_settings(None
).unwrap()[0]
62 fn get_cpu_tmp(&self) -> f32 {
63 cpu_temperature
::read()
67 // impl Drop for MachineJiji {
68 // fn drop(&mut self) {
70 // intel_arc::FreeDevices(self.gpu_devices);
75 pub struct MachineLyssMetal
{
76 crosshair_device
: asus_aura_usb
::Device
,
77 corsair_lignting_pro
: corsair_lighting_pro
::Device
,
78 lian_li_sl_infinity
: lian_li_sl_infinity
::Device
,
79 gpus
: Vec
<nvapi
::PhysicalGpu
>,
82 impl MachineLyssMetal
{
83 pub fn new() -> anyhow
::Result
<Self> {
84 let api
= hidapi
::HidApi
::new()?
;
86 nvapi
::initialize().expect("Unable to initialize nvapi (Nvidia API)");
88 let machine
= MachineLyssMetal
{
89 crosshair_device
: asus_aura_usb
::Device
::new(
91 asus_aura_usb
::Motherboard
::AsusCrosshairVIIIHero
,
93 corsair_lignting_pro
: corsair_lighting_pro
::Device
::new(
101 lian_li_sl_infinity
: lian_li_sl_infinity
::Device
::new(&api
),
102 gpus
: nvapi
::PhysicalGpu
::enumerate()?
,
105 // machine.set_mode_3080ti();
109 // Doesn't work: "Error: NotSupported".
110 // From OpenRGB, see the following files:
111 // * Controllers\GigabyteRGBFusion2GPUController\GigabyteRGBFusion2GPUControllerDetect.cpp
112 // * Controllers\GigabyteRGBFusion2GPUController\RGBController_GigabyteRGBFusion2GPU.cpp
113 // * Controllers\GigabyteRGBFusion2GPUController\GigabyteRGBFusion2GPUController.cpp
114 // * i2c_smbus\i2c_smbus_nvapi.cpp
115 // Implementation of nvapi-rs: https://github.com/arcnmx/nvapi-rs/blob/master/src/gpu.rs#L645
116 pub fn test_i2c(&self) {
117 // Test from 'GigabyteRGBFusion2GPUControllerDetect.cpp'
118 let data
= [0xAB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00];
124 GIGABYTE_RTX3080TI_VISION_OC_ADDR
,
127 i2c
::I2cSpeed
::Default
,
132 fn set_mode_3080ti(&self) {
134 RGB_FUSION2_GPU_REG_MODE
,
135 0x01, // Mode (1: static).
137 0x63, // Brightness max.
138 0x00, // Mistery flag.
148 GIGABYTE_RTX3080TI_VISION_OC_ADDR
,
151 i2c
::I2cSpeed
::Default
,
156 fn set_color_3080ti(&self, color
: &rgb
::RGB
) {
162 impl Machine
for MachineLyssMetal
{
163 fn set_color(&mut self, color
: &rgb
::RGB
) {
164 self.crosshair_device
.set_color(&color
).unwrap();
165 self.corsair_lignting_pro
.set_color(&color
);
166 self.lian_li_sl_infinity
.set_color(&color
);
167 // self.set_color_3080ti(&color); // TODO.
170 fn get_gpu_tmp(&self) -> f32 {
171 self.gpus
[0].thermal_settings(None
).unwrap()[0]
176 fn get_cpu_tmp(&self) -> f32 {
177 cpu_temperature
::read()