Skip to content

Commit 452f6a6

Browse files
committed
fix(Deck UHID): Provide specific fake chip ID upon request.
1 parent fc68087 commit 452f6a6

File tree

2 files changed

+2
-42
lines changed

2 files changed

+2
-42
lines changed

src/input/target/steam_deck.rs

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ use packed_struct::{
22
types::{Integer, SizedInteger},
33
PackedStruct,
44
};
5-
use rand::Rng;
65
use std::{
76
cmp::Ordering,
87
collections::HashMap,
@@ -137,7 +136,7 @@ impl SteamDeckDevice {
137136
}
138137

139138
Ok(Self {
140-
chip_id: Default::default(),
139+
chip_id: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4],
141140
config,
142141
config_rx: None,
143142
current_report: ReportType::InputData,
@@ -1019,25 +1018,6 @@ impl TargetOutputDevice for SteamDeckDevice {
10191018
VID,
10201019
self.config.product_id.to_u32()
10211020
);
1022-
let mut rng = rand::rng();
1023-
let chip_id: [u8; 15] = [
1024-
rng.random(),
1025-
rng.random(),
1026-
rng.random(),
1027-
rng.random(),
1028-
rng.random(),
1029-
rng.random(),
1030-
rng.random(),
1031-
rng.random(),
1032-
rng.random(),
1033-
rng.random(),
1034-
rng.random(),
1035-
rng.random(),
1036-
rng.random(),
1037-
rng.random(),
1038-
rng.random(),
1039-
];
1040-
self.chip_id = chip_id;
10411021
}
10421022

10431023
// Increment the frame

src/input/target/steam_deck_uhid.rs

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ use packed_struct::{
1111
types::{Integer, SizedInteger},
1212
PackedStruct,
1313
};
14-
use rand::Rng;
1514
use tokio::sync::mpsc::{channel, Receiver};
1615
use uhid_virt::{Bus, CreateParams, StreamError, UHIDDevice};
1716

@@ -77,7 +76,7 @@ impl SteamDeckUhidDevice {
7776
/// Create a new emulated Steam Deck device with the given configuration.
7877
pub fn new_with_config(config: SteamDeckConfig) -> Result<Self, Box<dyn Error>> {
7978
Ok(Self {
80-
chip_id: Default::default(),
79+
chip_id: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4],
8180
config,
8281
config_rx: None,
8382
current_report: ReportType::InputData,
@@ -777,25 +776,6 @@ impl TargetOutputDevice for SteamDeckUhidDevice {
777776
VID,
778777
self.config.product_id.to_u32()
779778
);
780-
let mut rng = rand::rng();
781-
let chip_id: [u8; 15] = [
782-
rng.random(),
783-
rng.random(),
784-
rng.random(),
785-
rng.random(),
786-
rng.random(),
787-
rng.random(),
788-
rng.random(),
789-
rng.random(),
790-
rng.random(),
791-
rng.random(),
792-
rng.random(),
793-
rng.random(),
794-
rng.random(),
795-
rng.random(),
796-
rng.random(),
797-
];
798-
self.chip_id = chip_id;
799779
}
800780

801781
let Some(device) = self.device.as_mut() else {

0 commit comments

Comments
 (0)