impl Device {
pub fn new(api: &hidapi::HidApi, motherboard: Motherboard) -> Self {
- Device {
- device: api
- .open(
- VID,
- match motherboard {
- Motherboard::Asus650e => PID_650_E,
- Motherboard::AsusCrosshairVIIIHero => PID_CROSSHAIR,
- },
- )
- .unwrap(),
- motherboard,
- }
+ let device =
+ Device {
+ device: api
+ .open(
+ VID,
+ match motherboard {
+ Motherboard::Asus650e => PID_650_E,
+ Motherboard::AsusCrosshairVIIIHero => PID_CROSSHAIR,
+ },
+ )
+ .unwrap(),
+ motherboard,
+ };
+
+ device.set_fixed_mode();
+ device
}
pub fn get_firmware_string(&self) -> String {
.expect("slice with incorrect length")
}
- pub fn set_fixed_mode(&self) {
+ fn set_fixed_mode(&self) {
let mut buffer = [0u8; 65];
buffer[0] = 0xEC;
buffer[1] = 0x35; // Control mode.