Skip to content

Commit a127ab9

Browse files
authored
Merge pull request #40 from isitLoVe/patch-1
Added support for Xbox Elite Wireless Controller Series 2
2 parents 526f8a4 + bc73fea commit a127ab9

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

backend/src/api.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,10 @@ pub fn controllers() -> Result<Vec<Controller>> {
7474
&& (device_info.product_id() == xbox::XBOX_ONE_S_CONTROLLER_BT_PRODUCT_ID
7575
|| device_info.product_id() == xbox::XBOX_ONE_S_LATEST_FW_PRODUCT_ID
7676
|| device_info.product_id() == xbox::XBOX_WIRELESS_CONTROLLER_USB_PRODUCT_ID
77-
|| device_info.product_id() == xbox::XBOX_WIRELESS_CONTROLLER_BT_PRODUCT_ID)
77+
|| device_info.product_id() == xbox::XBOX_WIRELESS_CONTROLLER_BT_PRODUCT_ID
78+
|| device_info.product_id() == xbox::XBOX_WIRELESS_ELITE_CONTROLLER_USB_PRODUCT_ID
79+
|| device_info.product_id() == xbox::XBOX_WIRELESS_ELITE_CONTROLLER_BT_PRODUCT_ID
80+
|| device_info.product_id() == xbox::XBOX_WIRELESS_ELITE_CONTROLLER_BTLE_PRODUCT_ID)
7881
})
7982
.collect();
8083
xbox_controllers.dedup_by(|a, b| a.serial_number() == b.serial_number());
@@ -96,6 +99,16 @@ pub fn controllers() -> Result<Vec<Controller>> {
9699
let controller = xbox::parse_xbox_controller_data(device_info, &hidapi)?;
97100
controllers.push(controller);
98101
}
102+
(xbox::MS_VENDOR_ID, xbox::XBOX_WIRELESS_ELITE_CONTROLLER_BT_PRODUCT_ID) => {
103+
debug!("Found Xbox Elite 2 controller: {:?}", device_info);
104+
let controller = xbox::parse_xbox_controller_data(device_info, &hidapi)?;
105+
controllers.push(controller);
106+
}
107+
(xbox::MS_VENDOR_ID, xbox::XBOX_WIRELESS_ELITE_CONTROLLER_BTLE_PRODUCT_ID) => {
108+
debug!("Found Xbox Elite 2 controller: {:?}", device_info);
109+
let controller = xbox::parse_xbox_controller_data(device_info, &hidapi)?;
110+
controllers.push(controller);
111+
}
99112
_ => {}
100113
}
101114
}

backend/src/api/xbox.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ pub const XBOX_ONE_S_LATEST_FW_PRODUCT_ID: u16 = 0x0b20; // 2848
2121
pub const XBOX_WIRELESS_CONTROLLER_USB_PRODUCT_ID: u16 = 0x0b12; // 2834
2222
pub const XBOX_WIRELESS_CONTROLLER_BT_PRODUCT_ID: u16 = 0x0b13; // 2835
2323

24+
// Xbox Elite Wireless Controller Series 2
25+
pub const XBOX_WIRELESS_ELITE_CONTROLLER_USB_PRODUCT_ID: u16 = 0x0b00;
26+
pub const XBOX_WIRELESS_ELITE_CONTROLLER_BT_PRODUCT_ID: u16 = 0x0b05;
27+
pub const XBOX_WIRELESS_ELITE_CONTROLLER_BTLE_PRODUCT_ID: u16 = 0x0b22;
28+
2429
// pub const XBOX_ONE_REPORT_BT_SIZE: usize = 64;
2530

2631
fn get_xbox_controller_name(product_id: u16) -> &'static str {
@@ -30,6 +35,9 @@ fn get_xbox_controller_name(product_id: u16) -> &'static str {
3035
XBOX_ONE_S_LATEST_FW_PRODUCT_ID => "Xbox One S",
3136
XBOX_WIRELESS_CONTROLLER_USB_PRODUCT_ID => "Xbox Series X/S",
3237
XBOX_WIRELESS_CONTROLLER_BT_PRODUCT_ID => "Xbox Series X/S",
38+
XBOX_WIRELESS_ELITE_CONTROLLER_USB_PRODUCT_ID => "Xbox Elite 2",
39+
XBOX_WIRELESS_ELITE_CONTROLLER_BT_PRODUCT_ID => "Xbox Elite 2",
40+
XBOX_WIRELESS_ELITE_CONTROLLER_BTLE_PRODUCT_ID => "Xbox Elite 2",
3341
_ => "Xbox Unknown",
3442
}
3543
}

0 commit comments

Comments
 (0)