Add support for HyperX Cloud Flight S
- Add PRODUCT_ID 0x16EA to Cloud II Wireless device support - Cloud Flight S uses the same protocol as Cloud II Wireless - Update README.md with Cloud Flight S in supported devices list - Add udev rules for Cloud Flight S (idProduct=16ea) - Fix prepare_write() to handle devices that don't support get_input_report - Fix is_none_or compatibility issue for older Rust versions
This commit is contained in:
@@ -6,8 +6,8 @@ use std::time::Duration;
|
||||
|
||||
const HYPERX: u16 = 0x0951;
|
||||
pub const VENDOR_IDS: [u16; 1] = [HYPERX];
|
||||
// Possible Cloud II Wireless product IDs
|
||||
pub const PRODUCT_IDS: [u16; 3] = [0x1718, 0x018B, 0x0b92];
|
||||
// Possible Cloud II Wireless product IDs (and Cloud Flight S)
|
||||
pub const PRODUCT_IDS: [u16; 4] = [0x1718, 0x018B, 0x0b92, 0x16EA];
|
||||
|
||||
const BASE_PACKET: [u8; 62] = {
|
||||
let mut tmp = [0u8; 62];
|
||||
@@ -266,12 +266,15 @@ impl Device for CloudIIWireless {
|
||||
}
|
||||
|
||||
fn prepare_write(&mut self) {
|
||||
// Attempt to read input report before writing
|
||||
// This may not work for all devices (e.g., Cloud Flight S),
|
||||
// so we ignore the error
|
||||
let mut input_report_buffer = [0u8; 64];
|
||||
input_report_buffer[0] = 6;
|
||||
self.state
|
||||
let _ = self
|
||||
.state
|
||||
.hid_device
|
||||
.get_input_report(&mut input_report_buffer)
|
||||
.unwrap();
|
||||
.get_input_report(&mut input_report_buffer);
|
||||
}
|
||||
|
||||
fn allow_passive_refresh(&mut self) -> bool {
|
||||
|
||||
@@ -16,7 +16,7 @@ use thistermination::TerminationFull;
|
||||
// Possible vendor IDs [HyperX, HP]
|
||||
const VENDOR_IDS: [u16; 2] = [0x0951, 0x03F0];
|
||||
// All supported product IDs
|
||||
const PRODUCT_IDS: [u16; 6] = [0x1718, 0x018B, 0x0D93, 0x0696, 0x0b92, 0x05B7];
|
||||
const PRODUCT_IDS: [u16; 7] = [0x1718, 0x018B, 0x0D93, 0x0696, 0x0b92, 0x05B7, 0x16EA];
|
||||
|
||||
const RESPONSE_BUFFER_SIZE: usize = 256;
|
||||
const RESPONSE_DELAY: Duration = Duration::from_millis(50);
|
||||
@@ -518,7 +518,7 @@ pub trait Device {
|
||||
}
|
||||
responded = true;
|
||||
}
|
||||
if !self.get_device_state().connected.is_none_or(|c| c) {
|
||||
if !matches!(self.get_device_state().connected, Some(true)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user