-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathheadphone_models.rs
224 lines (218 loc) · 6.25 KB
/
headphone_models.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
use crate::hid::HeadphoneModel;
// found in https://github.com/richrace/arctis-usb-finder/blob/745a4f68b8394487ae549ef0eebf637ef6e26dd3/src/models/known_headphone.ts
// & https://github.com/Sapd/HeadsetControl/blob/master/src/devices
pub const KNOWN_HEADPHONES: &[HeadphoneModel] = &[
HeadphoneModel {
name: "Arctis Pro Wireless",
product_id: 0x1290,
write_bytes: [0x40, 0xaa],
interface_num: 0,
battery_percent_idx: 0,
charging_status_idx: None,
usage_page_id: None,
read_buf_size: 2,
},
HeadphoneModel {
name: "Arctis 7 2017",
product_id: 0x1260,
write_bytes: [0x06, 0x18],
interface_num: 5,
battery_percent_idx: 2,
charging_status_idx: None,
usage_page_id: None,
read_buf_size: 8,
},
HeadphoneModel {
name: "Arctis 7 2019",
product_id: 0x12ad,
write_bytes: [0x06, 0x18],
interface_num: 5,
battery_percent_idx: 2,
charging_status_idx: None,
usage_page_id: None,
read_buf_size: 8,
},
HeadphoneModel {
name: "Arctis Pro 2019",
product_id: 0x1252,
write_bytes: [0x06, 0x18],
interface_num: 5,
battery_percent_idx: 2,
charging_status_idx: None,
usage_page_id: None,
read_buf_size: 8,
},
HeadphoneModel {
name: "Arctis Pro GameDac",
product_id: 0x1280,
write_bytes: [0x06, 0x18],
interface_num: 5,
battery_percent_idx: 2,
charging_status_idx: None,
usage_page_id: None,
read_buf_size: 8,
},
HeadphoneModel {
name: "Arctis 9",
product_id: 0x12c2,
write_bytes: [0x06, 0x12],
interface_num: 3,
battery_percent_idx: 3,
charging_status_idx: Some(4),
usage_page_id: None,
read_buf_size: 12,
},
HeadphoneModel {
name: "Arctis 1 Wireless",
product_id: 0x12b3,
write_bytes: [0x06, 0x12],
interface_num: 3,
battery_percent_idx: 3,
charging_status_idx: Some(4),
usage_page_id: Some((0xff43, 0x202)),
read_buf_size: 8,
},
HeadphoneModel {
name: "Arctis 1 Xbox",
product_id: 0x12b6,
write_bytes: [0x06, 0x12],
interface_num: 3,
battery_percent_idx: 3,
charging_status_idx: Some(4),
usage_page_id: Some((0xff43, 0x202)),
read_buf_size: 8,
},
HeadphoneModel {
name: "Arctis 7X",
product_id: 0x12d7,
write_bytes: [0x06, 0x12],
interface_num: 3,
battery_percent_idx: 3,
charging_status_idx: Some(4),
usage_page_id: Some((0xff43, 0x202)),
read_buf_size: 8,
},
HeadphoneModel {
name: "Arctis 7 Plus",
product_id: 0x220e,
write_bytes: [0x00, 0xb0],
interface_num: 3,
battery_percent_idx: 2,
charging_status_idx: Some(3),
usage_page_id: Some((0xffc0, 0x1)),
read_buf_size: 8,
},
HeadphoneModel {
name: "Arctis 7P Plus",
product_id: 0x2212,
write_bytes: [0x00, 0xb0],
interface_num: 3,
battery_percent_idx: 2,
charging_status_idx: Some(3),
usage_page_id: Some((0xffc0, 0x1)),
read_buf_size: 6,
},
HeadphoneModel {
name: "Arctis 7X Plus",
product_id: 0x2216,
write_bytes: [0x00, 0xb0],
interface_num: 3,
battery_percent_idx: 2,
charging_status_idx: Some(3),
usage_page_id: Some((0xffc0, 0x1)),
read_buf_size: 6,
},
HeadphoneModel {
name: "Arctis 7 Destiny Plus",
product_id: 0x2236,
write_bytes: [0x00, 0xb0],
interface_num: 3,
battery_percent_idx: 2,
charging_status_idx: Some(3),
usage_page_id: Some((0xffc0, 0x1)),
read_buf_size: 6,
},
// Nova
HeadphoneModel {
name: "Arctis Nova 7",
product_id: 0x2202,
write_bytes: [0x00, 0xb0],
interface_num: 3,
battery_percent_idx: 2,
charging_status_idx: Some(3),
usage_page_id: Some((0xffc0, 0x1)),
read_buf_size: 8,
},
HeadphoneModel {
name: "Arctis Nova 7X",
product_id: 0x2206,
write_bytes: [0x00, 0xb0],
interface_num: 3,
battery_percent_idx: 2,
charging_status_idx: Some(3),
usage_page_id: Some((0xffc0, 0x1)),
read_buf_size: 8,
},
HeadphoneModel {
name: "Arctis Nova 7X v2",
product_id: 0x2258,
write_bytes: [0x00, 0xb0],
interface_num: 3,
battery_percent_idx: 2,
charging_status_idx: Some(3),
usage_page_id: Some((0xffc0, 0x1)),
read_buf_size: 8,
},
HeadphoneModel {
name: "Arctis Nova 7P",
product_id: 0x220a,
write_bytes: [0x00, 0xb0],
interface_num: 3,
battery_percent_idx: 2,
charging_status_idx: Some(3),
usage_page_id: Some((0xffc0, 0x1)),
read_buf_size: 8,
},
HeadphoneModel {
name: "Arctis Nova 7 Diablo IV",
product_id: 0x223a,
write_bytes: [0x00, 0xb0],
interface_num: 3,
battery_percent_idx: 2,
charging_status_idx: Some(3),
usage_page_id: Some((0xffc0, 0x1)),
read_buf_size: 8,
},
HeadphoneModel {
name: "Arctis Nova 5",
product_id: 0x2230,
write_bytes: [0x00, 0x10],
interface_num: 3,
battery_percent_idx: 2,
charging_status_idx: Some(3),
usage_page_id: Some((0xffc0, 0x1)),
read_buf_size: 128,
},
];
#[cfg(test)]
mod test {
use std::collections::HashMap;
use super::KNOWN_HEADPHONES;
#[test]
fn unique_product_ids() {
let mut seen_product_ids: HashMap<u16, bool> = HashMap::new();
let mut seen_names: HashMap<&str, bool> = HashMap::new();
KNOWN_HEADPHONES.iter().for_each(|h| {
assert!(
seen_product_ids.insert(h.product_id, true).is_none(),
"duplicate entries for {:#x}",
&h.product_id
);
assert!(
seen_names.insert(h.name, true).is_none(),
"duplicate entries for {}",
&h.name
);
});
}
}