From c7df7b45af9a5510c5f63319cc5acaec8792e97f Mon Sep 17 00:00:00 2001 From: enricobuehler Date: Sun, 9 Aug 2026 23:46:43 +0200 Subject: [PATCH] =?UTF-8?q?fix(drivers/pf-gamepad):=20the=20three=20Xbox?= =?UTF-8?q?=20identities=20as=20a=20range=20=E2=80=94=20the=20driver=20cli?= =?UTF-8?q?ppy=20gate=20is=20red=20on=20main?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `cargo clippy --all-targets -- -D warnings` over the shipped drivers (the step that enforces the unsafe-audit gates) fails on main since #149 landed: clippy 1.96's `manual_range_patterns` fires on all five `4 | 5 | 6` device-type arms, and `-D warnings` turns each into an error, so `pf-gamepad` fails to compile as both lib and lib-test and the whole step never reaches the other five crates. Device types 4/5/6 are the Xbox Wireless / One S / Elite Series 2 identities added by #149 — contiguous by construction, so `4..=6` is the same set. Purely a lint fix: no arm gains or loses a device type, and the comments that already record *why* the three share one report shape, one descriptor and one vendor string are untouched. --- packaging/windows/drivers/pf-gamepad/src/lib.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packaging/windows/drivers/pf-gamepad/src/lib.rs b/packaging/windows/drivers/pf-gamepad/src/lib.rs index 86a06166..cd60fb3a 100644 --- a/packaging/windows/drivers/pf-gamepad/src/lib.rs +++ b/packaging/windows/drivers/pf-gamepad/src/lib.rs @@ -580,7 +580,7 @@ fn hid_attrs(devtype: u8) -> [u8; 32] { /// Xbox identities share one descriptor, hence one report length. fn input_report_len(devtype: u8) -> usize { match devtype { - 4 | 5 | 6 => XBOX_INPUT_REPORT_LEN, + 4..=6 => XBOX_INPUT_REPORT_LEN, _ => 64, } } @@ -638,7 +638,7 @@ fn neutral_report(devtype: u8) -> [u8; 64] { 1 => DS4_NEUTRAL_REPORT, 3 => DECK_NEUTRAL_REPORT, // Wireless / One S / Elite Series 2 — one report shape, three identities. - 4 | 5 | 6 => XBOX_NEUTRAL_REPORT, + 4..=6 => XBOX_NEUTRAL_REPORT, _ => NEUTRAL_REPORT, // DualSense and Edge share the report 0x01 shape } } @@ -1104,7 +1104,7 @@ extern "C" fn evt_io_device_control( 1 => &DS4_HID_DESC, 2 => &EDGE_HID_DESC, 3 => &DECK_HID_DESC, - 4 | 5 | 6 => &XBOX_HID_DESC, + 4..=6 => &XBOX_HID_DESC, _ => &HID_DESC, }), IOCTL_HID_GET_DEVICE_ATTRIBUTES => request.copy_to_output(&hid_attrs(device_type())), @@ -1114,7 +1114,7 @@ extern "C" fn evt_io_device_control( 1 => &DS4_RDESC[..], 2 => &DS_EDGE_RDESC[..], 3 => &DECK_RDESC[..], - 4 | 5 | 6 => &XBOX_RDESC[..], + 4..=6 => &XBOX_RDESC[..], _ => &DUALSENSE_RDESC[..], }), IOCTL_HID_WRITE_REPORT | IOCTL_UMDF_HID_SET_OUTPUT_REPORT => { @@ -1376,7 +1376,7 @@ fn on_get_string(request: &Request) -> NTSTATUS { 0 | 0x000e => match devtype { 1 => "Sony Computer Entertainment".into(), 3 => "Valve Software".into(), - 4 | 5 | 6 => "Microsoft".into(), + 4..=6 => "Microsoft".into(), _ => "Sony Interactive Entertainment".into(), }, // Per-pad serials (see `pad_index`): SDL reads this via HidD_GetSerialNumberString and