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 self.set_color_1(&color
);
17 self.set_color_2(&color
);
19 fn set_color_1(&mut self, color
: &rgb
::RGB
);
20 fn set_color_2(&mut self, color
: &rgb
::RGB
);
21 fn get_gpu_tmp(&self) -> f32;
22 fn get_cpu_tmp(&self) -> f32;
25 pub struct MachineJiji
{
26 ram
: Vec
<corsair_vengeance
::Controller
>,
27 b650e_device
: asus_aura_usb
::Device
,
29 // gpu_devices: intel_arc::Devices,
30 gpus
: Vec
<nvapi
::PhysicalGpu
>,
34 pub fn new() -> anyhow
::Result
<Self> {
35 let api
= hidapi
::HidApi
::new().unwrap();
38 corsair_vengeance
::Controller
::new(0x19),
39 corsair_vengeance
::Controller
::new(0x1B),
41 b650e_device
: asus_aura_usb
::Device
::new(&api
, asus_aura_usb
::Motherboard
::Asus650e
)?
,
42 // a770: a770::A770::new()?,
43 // gpu_devices: unsafe { intel_arc::GetDevices() },
44 gpus
: nvapi
::PhysicalGpu
::enumerate()?
,
49 impl Machine
for MachineJiji
{
50 fn set_color_1(&mut self, color
: &rgb
::RGB
) {
51 for controller
in &self.ram
{
52 controller
.set_color(&color
);
54 self.b650e_device
.set_color(&color
).unwrap();
57 fn set_color_2(&mut self, color
: &rgb
::RGB
) {}
// No color 2.
59 fn get_gpu_tmp(&self) -> f32 {
60 // unsafe { intel_arc::GetTemperature(self.gpu_devices, 0) as f32 }
61 self.gpus
[0].thermal_settings(None
).unwrap()[0]
66 fn get_cpu_tmp(&self) -> f32 {
67 cpu_temperature
::read()
71 // impl Drop for MachineJiji {
72 // fn drop(&mut self) {
74 // intel_arc::FreeDevices(self.gpu_devices);
79 pub struct MachineLyssMetal
{
80 crosshair_device
: asus_aura_usb
::Device
,
81 corsair_lignting_pro
: corsair_lighting_pro
::Device
,
82 lian_li_sl_infinity
: lian_li_sl_infinity
::Device
,
83 gpus
: Vec
<nvapi
::PhysicalGpu
>,
86 impl MachineLyssMetal
{
87 pub fn new() -> anyhow
::Result
<Self> {
88 let api
= hidapi
::HidApi
::new()?
;
90 nvapi
::initialize().expect("Unable to initialize nvapi (Nvidia API)");
92 let machine
= MachineLyssMetal
{
93 crosshair_device
: asus_aura_usb
::Device
::new(
95 asus_aura_usb
::Motherboard
::AsusCrosshairVIIIHero
,
97 corsair_lignting_pro
: corsair_lighting_pro
::Device
::new(
105 lian_li_sl_infinity
: lian_li_sl_infinity
::Device
::new(&api
),
106 gpus
: nvapi
::PhysicalGpu
::enumerate()?
,
109 // machine.set_mode_3080ti();
113 // Doesn't work: "Error: NotSupported".
114 // From OpenRGB, see the following files:
115 // * Controllers\GigabyteRGBFusion2GPUController\GigabyteRGBFusion2GPUControllerDetect.cpp
116 // * Controllers\GigabyteRGBFusion2GPUController\RGBController_GigabyteRGBFusion2GPU.cpp
117 // * Controllers\GigabyteRGBFusion2GPUController\GigabyteRGBFusion2GPUController.cpp
118 // * i2c_smbus\i2c_smbus_nvapi.cpp
119 // Implementation of nvapi-rs: https://github.com/arcnmx/nvapi-rs/blob/master/src/gpu.rs#L645
120 pub fn test_i2c(&self) {
121 // Test from 'GigabyteRGBFusion2GPUControllerDetect.cpp'
122 let data
= [0xAB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00];
128 GIGABYTE_RTX3080TI_VISION_OC_ADDR
,
131 i2c
::I2cSpeed
::Default
,
136 fn set_mode_3080ti(&self) {
138 RGB_FUSION2_GPU_REG_MODE
,
139 0x01, // Mode (1: static).
141 0x63, // Brightness max.
142 0x00, // Mistery flag.
152 GIGABYTE_RTX3080TI_VISION_OC_ADDR
,
155 i2c
::I2cSpeed
::Default
,
160 fn set_color_3080ti(&self, color
: &rgb
::RGB
) {
166 impl Machine
for MachineLyssMetal
{
167 fn set_color_1(&mut self, color
: &rgb
::RGB
) {
168 self.crosshair_device
.set_color(&color
).unwrap();
169 self.corsair_lignting_pro
.set_color(&color
);
170 // self.set_color_3080ti(&color); // TODO.
173 fn set_color_2(&mut self, color
: &rgb
::RGB
) {
174 self.lian_li_sl_infinity
.set_color(&color
);
177 fn get_gpu_tmp(&self) -> f32 {
178 self.gpus
[0].thermal_settings(None
).unwrap()[0]
183 fn get_cpu_tmp(&self) -> f32 {
184 cpu_temperature
::read()