From 7715ca9926b03e48bf0c4edc312d94ba5640817f Mon Sep 17 00:00:00 2001 From: isit-LoVe <20051956+isitLoVe@users.noreply.github.com> Date: Fri, 1 Sep 2023 10:13:14 +0200 Subject: [PATCH 1/2] Added support for Xbox Elite Wireless Controller Series 2 Added support for Xbox Elite Wireless Controller Series 2 --- backend/src/api/xbox.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/backend/src/api/xbox.rs b/backend/src/api/xbox.rs index f4c9ab3..7e0ffa5 100644 --- a/backend/src/api/xbox.rs +++ b/backend/src/api/xbox.rs @@ -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 { @@ -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", } } From bc73feaf4b6eb532682072b6e08ccbc61bd70609 Mon Sep 17 00:00:00 2001 From: isit-LoVe <20051956+isitLoVe@users.noreply.github.com> Date: Fri, 1 Sep 2023 14:12:54 +0200 Subject: [PATCH 2/2] Added support for Xbox Elite Wireless Controller Series 2 Added support for Xbox Elite Wireless Controller Series 2 --- backend/src/api.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/backend/src/api.rs b/backend/src/api.rs index dc330d7..feef05d 100644 --- a/backend/src/api.rs +++ b/backend/src/api.rs @@ -74,7 +74,10 @@ pub fn controllers() -> Result> { && (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()); @@ -96,6 +99,16 @@ pub fn controllers() -> Result> { 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); + } _ => {} } }