7 * - https://blog.inlart.com/post/openrgb-asus-x570/
8 * - https://openrgb-wiki.readthedocs.io/en/latest/asus/ASUS-Aura-USB/
11 const AURA_REQUEST_FIRMWARE_VERSION
: u8 = 0x82;
12 const AURA_REQUEST_CONFIG_TABLE
: u8 = 0xB0;
14 const VID
: u16 = 0x0B05; // Vendor ID: ASUS.
15 const PID
: u16 = 0x19AF; // Product ID: AURA LED Controller.
17 pub fn get_device(api
: &hidapi
::HidApi
) -> hidapi
::HidDevice
{
18 api
.open(VID
, PID
).unwrap()
21 pub fn get_firmware_string(device
: &hidapi
::HidDevice
) -> String
{
22 let mut buffer
= [0u8; 65];
24 buffer
[1] = AURA_REQUEST_FIRMWARE_VERSION
;
25 let n_write
= device
.write(&buffer
).unwrap();
26 assert_eq!(n_write
, 65);
29 let n_read
= device
.read(&mut buffer
).unwrap();
30 assert_eq!(n_read
, 65);
31 assert_eq!(buffer
[0], 0xEC);
32 assert_eq!(buffer
[1], 0x02);
34 String
::from(str::from_utf8(&buffer
[2..17]).unwrap())
37 pub fn get_configuration_table(device
: &hidapi
::HidDevice
) -> [u8; 60] {
38 let mut buffer
= [0u8; 65];
40 buffer
[1] = AURA_REQUEST_CONFIG_TABLE
;
41 let n_write
= device
.write(&buffer
).unwrap();
42 assert_eq!(n_write
, 65);
45 let n_read
= device
.read(&mut buffer
).unwrap();
46 assert_eq!(n_read
, 65);
47 assert_eq!(buffer
[0], 0xEC);
48 assert_eq!(buffer
[1], 0x30);
52 .expect("slice with incorrect length")
55 // TODO: it seems this doesn't work.
56 // The mode is set by OpenRGB prior launching temp2RGB for the moment.
57 pub fn set_fixed_mode(device
: &hidapi
::HidDevice
) {
58 let mut buffer
= [0u8; 65];
61 buffer
[2] = 0x00; // Channel effect id = Fixed.
62 buffer
[5] = 0x01; // Mode id = static.
64 let n_write
= device
.write(&buffer
).unwrap();
65 assert_eq!(n_write
, 65);
68 pub fn set_color(device
: &hidapi
::HidDevice
, color
: &RGB
) {
69 let mut buffer
= [0u8; 65];
72 buffer
[2] = 0x00; // 16 bits LED mask: first part.
73 buffer
[3] = 0x02; // 16 bits LED mask: second part.
75 // Don't know why the first LED isn't used.
76 // buffer[5] = color.red;
77 // buffer[6] = color.green;
78 // buffer[7] = color.blue;
81 buffer
[8] = color
.red
;
82 buffer
[9] = color
.green
;
83 buffer
[10] = color
.blue
;
85 let n_write
= device
.write(&buffer
).unwrap();
86 assert_eq!(n_write
, 65);
89 pub fn save_current_color(device
: &hidapi
::HidDevice
) {
90 let mut buffer
= [0u8; 65];
95 let n_write
= device
.write(&buffer
).unwrap();
96 assert_eq!(n_write
, 65);