Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion backend/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,10 @@ pub fn controllers() -> Result<Vec<Controller>> {
&& (device_info.product_id() == xbox::XBOX_ONE_S_CONTROLLER_BT_PRODUCT_ID
|| device_info.product_id() == xbox::XBOX_ONE_S_LATEST_FW_PRODUCT_ID
|| device_info.product_id() == xbox::XBOX_WIRELESS_CONTROLLER_USB_PRODUCT_ID
|| device_info.product_id() == xbox::XBOX_WIRELESS_CONTROLLER_BT_PRODUCT_ID)
|| device_info.product_id() == xbox::XBOX_WIRELESS_CONTROLLER_BT_PRODUCT_ID
|| device_info.product_id() == xbox::XBOX_WIRELESS_ELITE_CONTROLLER_USB_PRODUCT_ID
|| device_info.product_id() == xbox::XBOX_WIRELESS_ELITE_CONTROLLER_BT_PRODUCT_ID
|| device_info.product_id() == xbox::XBOX_WIRELESS_ELITE_CONTROLLER_BTLE_PRODUCT_ID)
})
.collect();
xbox_controllers.dedup_by(|a, b| a.serial_number() == b.serial_number());
Expand All @@ -96,6 +99,16 @@ pub fn controllers() -> Result<Vec<Controller>> {
let controller = xbox::parse_xbox_controller_data(device_info, &hidapi)?;
controllers.push(controller);
}
(xbox::MS_VENDOR_ID, xbox::XBOX_WIRELESS_ELITE_CONTROLLER_BT_PRODUCT_ID) => {
debug!("Found Xbox Elite 2 controller: {:?}", device_info);
let controller = xbox::parse_xbox_controller_data(device_info, &hidapi)?;
controllers.push(controller);
}
(xbox::MS_VENDOR_ID, xbox::XBOX_WIRELESS_ELITE_CONTROLLER_BTLE_PRODUCT_ID) => {
debug!("Found Xbox Elite 2 controller: {:?}", device_info);
let controller = xbox::parse_xbox_controller_data(device_info, &hidapi)?;
controllers.push(controller);
}
_ => {}
}
}
Expand Down
8 changes: 8 additions & 0 deletions backend/src/api/xbox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ pub const XBOX_ONE_S_LATEST_FW_PRODUCT_ID: u16 = 0x0b20; // 2848
pub const XBOX_WIRELESS_CONTROLLER_USB_PRODUCT_ID: u16 = 0x0b12; // 2834
pub const XBOX_WIRELESS_CONTROLLER_BT_PRODUCT_ID: u16 = 0x0b13; // 2835

// Xbox Elite Wireless Controller Series 2
pub const XBOX_WIRELESS_ELITE_CONTROLLER_USB_PRODUCT_ID: u16 = 0x0b00;
pub const XBOX_WIRELESS_ELITE_CONTROLLER_BT_PRODUCT_ID: u16 = 0x0b05;
pub const XBOX_WIRELESS_ELITE_CONTROLLER_BTLE_PRODUCT_ID: u16 = 0x0b22;

// pub const XBOX_ONE_REPORT_BT_SIZE: usize = 64;

fn get_xbox_controller_name(product_id: u16) -> &'static str {
Expand All @@ -30,6 +35,9 @@ fn get_xbox_controller_name(product_id: u16) -> &'static str {
XBOX_ONE_S_LATEST_FW_PRODUCT_ID => "Xbox One S",
XBOX_WIRELESS_CONTROLLER_USB_PRODUCT_ID => "Xbox Series X/S",
XBOX_WIRELESS_CONTROLLER_BT_PRODUCT_ID => "Xbox Series X/S",
XBOX_WIRELESS_ELITE_CONTROLLER_USB_PRODUCT_ID => "Xbox Elite 2",
XBOX_WIRELESS_ELITE_CONTROLLER_BT_PRODUCT_ID => "Xbox Elite 2",
XBOX_WIRELESS_ELITE_CONTROLLER_BTLE_PRODUCT_ID => "Xbox Elite 2",
_ => "Xbox Unknown",
}
}
Expand Down