This source file includes following definitions.
- i2c_hid_get_dmi_i2c_hid_desc_override
- i2c_hid_get_dmi_hid_report_desc_override
1
2
3
4
5
6
7
8
9
10 #include <linux/types.h>
11 #include <linux/dmi.h>
12 #include <linux/mod_devicetable.h>
13
14 #include "i2c-hid.h"
15
16
17 struct i2c_hid_desc_override {
18 union {
19 struct i2c_hid_desc *i2c_hid_desc;
20 uint8_t *i2c_hid_desc_buffer;
21 };
22 uint8_t *hid_report_desc;
23 unsigned int hid_report_desc_size;
24 uint8_t *i2c_name;
25 };
26
27
28
29
30
31
32
33
34
35
36
37
38 static const struct i2c_hid_desc_override sipodev_desc = {
39 .i2c_hid_desc_buffer = (uint8_t [])
40 {0x1e, 0x00,
41 0x00, 0x01,
42 0xdb, 0x01,
43 0x21, 0x00,
44 0x24, 0x00,
45 0x1b, 0x00,
46 0x25, 0x00,
47 0x11, 0x00,
48 0x22, 0x00,
49 0x23, 0x00,
50 0x11, 0x09,
51 0x88, 0x52,
52 0x06, 0x00,
53 0x00, 0x00, 0x00, 0x00
54 },
55
56 .hid_report_desc = (uint8_t [])
57 {0x05, 0x01,
58 0x09, 0x02,
59 0xA1, 0x01,
60 0x85, 0x01,
61 0x09, 0x01,
62 0xA1, 0x00,
63 0x05, 0x09,
64 0x19, 0x01,
65 0x29, 0x02,
66 0x25, 0x01,
67 0x75, 0x01,
68 0x95, 0x02,
69 0x81, 0x02,
70 0x95, 0x06,
71 0x81, 0x01,
72 0x05, 0x01,
73 0x09, 0x30,
74 0x09, 0x31,
75 0x15, 0x81,
76 0x25, 0x7F,
77 0x75, 0x08,
78 0x95, 0x02,
79 0x81, 0x06,
80 0xC0,
81 0xC0,
82 0x05, 0x0D,
83 0x09, 0x05,
84 0xA1, 0x01,
85 0x85, 0x04,
86 0x05, 0x0D,
87 0x09, 0x22,
88 0xA1, 0x02,
89 0x15, 0x00,
90 0x25, 0x01,
91 0x09, 0x47,
92 0x09, 0x42,
93 0x95, 0x02,
94 0x75, 0x01,
95 0x81, 0x02,
96 0x95, 0x01,
97 0x75, 0x03,
98 0x25, 0x05,
99 0x09, 0x51,
100 0x81, 0x02,
101 0x75, 0x01,
102 0x95, 0x03,
103 0x81, 0x03,
104 0x05, 0x01,
105 0x26, 0x44, 0x0A,
106 0x75, 0x10,
107 0x55, 0x0E,
108 0x65, 0x11,
109 0x09, 0x30,
110 0x46, 0x1A, 0x04,
111 0x95, 0x01,
112 0x81, 0x02,
113 0x46, 0xBC, 0x02,
114 0x26, 0x34, 0x05,
115 0x09, 0x31,
116 0x81, 0x02,
117 0xC0,
118 0x05, 0x0D,
119 0x09, 0x22,
120 0xA1, 0x02,
121 0x25, 0x01,
122 0x09, 0x47,
123 0x09, 0x42,
124 0x95, 0x02,
125 0x75, 0x01,
126 0x81, 0x02,
127 0x95, 0x01,
128 0x75, 0x03,
129 0x25, 0x05,
130 0x09, 0x51,
131 0x81, 0x02,
132 0x75, 0x01,
133 0x95, 0x03,
134 0x81, 0x03,
135 0x05, 0x01,
136 0x26, 0x44, 0x0A,
137 0x75, 0x10,
138 0x09, 0x30,
139 0x46, 0x1A, 0x04,
140 0x95, 0x01,
141 0x81, 0x02,
142 0x46, 0xBC, 0x02,
143 0x26, 0x34, 0x05,
144 0x09, 0x31,
145 0x81, 0x02,
146 0xC0,
147 0x05, 0x0D,
148 0x09, 0x22,
149 0xA1, 0x02,
150 0x25, 0x01,
151 0x09, 0x47,
152 0x09, 0x42,
153 0x95, 0x02,
154 0x75, 0x01,
155 0x81, 0x02,
156 0x95, 0x01,
157 0x75, 0x03,
158 0x25, 0x05,
159 0x09, 0x51,
160 0x81, 0x02,
161 0x75, 0x01,
162 0x95, 0x03,
163 0x81, 0x03,
164 0x05, 0x01,
165 0x26, 0x44, 0x0A,
166 0x75, 0x10,
167 0x09, 0x30,
168 0x46, 0x1A, 0x04,
169 0x95, 0x01,
170 0x81, 0x02,
171 0x46, 0xBC, 0x02,
172 0x26, 0x34, 0x05,
173 0x09, 0x31,
174 0x81, 0x02,
175 0xC0,
176 0x05, 0x0D,
177 0x09, 0x22,
178 0xA1, 0x02,
179 0x25, 0x01,
180 0x09, 0x47,
181 0x09, 0x42,
182 0x95, 0x02,
183 0x75, 0x01,
184 0x81, 0x02,
185 0x95, 0x01,
186 0x75, 0x03,
187 0x25, 0x05,
188 0x09, 0x51,
189 0x81, 0x02,
190 0x75, 0x01,
191 0x95, 0x03,
192 0x81, 0x03,
193 0x05, 0x01,
194 0x26, 0x44, 0x0A,
195 0x75, 0x10,
196 0x09, 0x30,
197 0x46, 0x1A, 0x04,
198 0x95, 0x01,
199 0x81, 0x02,
200 0x46, 0xBC, 0x02,
201 0x26, 0x34, 0x05,
202 0x09, 0x31,
203 0x81, 0x02,
204 0xC0,
205 0x05, 0x0D,
206 0x55, 0x0C,
207 0x66, 0x01, 0x10,
208 0x47, 0xFF, 0xFF, 0x00, 0x00,
209 0x27, 0xFF, 0xFF, 0x00, 0x00,
210 0x75, 0x10,
211 0x95, 0x01,
212 0x09, 0x56,
213 0x81, 0x02,
214 0x09, 0x54,
215 0x25, 0x7F,
216 0x75, 0x08,
217 0x81, 0x02,
218 0x05, 0x09,
219 0x09, 0x01,
220 0x25, 0x01,
221 0x75, 0x01,
222 0x95, 0x01,
223 0x81, 0x02,
224 0x95, 0x07,
225 0x81, 0x03,
226 0x05, 0x0D,
227 0x85, 0x02,
228 0x09, 0x55,
229 0x09, 0x59,
230 0x75, 0x04,
231 0x95, 0x02,
232 0x25, 0x0F,
233 0xB1, 0x02,
234 0x05, 0x0D,
235 0x85, 0x07,
236 0x09, 0x60,
237 0x75, 0x01,
238 0x95, 0x01,
239 0x25, 0x01,
240 0xB1, 0x02,
241 0x95, 0x07,
242 0xB1, 0x03,
243 0x85, 0x06,
244 0x06, 0x00, 0xFF,
245 0x09, 0xC5,
246 0x26, 0xFF, 0x00,
247 0x75, 0x08,
248 0x96, 0x00, 0x01,
249 0xB1, 0x02,
250 0xC0,
251 0x06, 0x00, 0xFF,
252 0x09, 0x01,
253 0xA1, 0x01,
254 0x85, 0x0D,
255 0x26, 0xFF, 0x00,
256 0x19, 0x01,
257 0x29, 0x02,
258 0x75, 0x08,
259 0x95, 0x02,
260 0xB1, 0x02,
261 0xC0,
262 0x05, 0x0D,
263 0x09, 0x0E,
264 0xA1, 0x01,
265 0x85, 0x03,
266 0x09, 0x22,
267 0xA1, 0x02,
268 0x09, 0x52,
269 0x25, 0x0A,
270 0x95, 0x01,
271 0xB1, 0x02,
272 0xC0,
273 0x09, 0x22,
274 0xA1, 0x00,
275 0x85, 0x05,
276 0x09, 0x57,
277 0x09, 0x58,
278 0x75, 0x01,
279 0x95, 0x02,
280 0x25, 0x01,
281 0xB1, 0x02,
282 0x95, 0x06,
283 0xB1, 0x03,
284 0xC0,
285 0xC0
286 },
287 .hid_report_desc_size = 475,
288 .i2c_name = "SYNA3602:00"
289 };
290
291
292 static const struct dmi_system_id i2c_hid_dmi_desc_override_table[] = {
293 {
294 .ident = "Teclast F6 Pro",
295 .matches = {
296 DMI_EXACT_MATCH(DMI_SYS_VENDOR, "TECLAST"),
297 DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "F6 Pro"),
298 },
299 .driver_data = (void *)&sipodev_desc
300 },
301 {
302 .ident = "Teclast F7",
303 .matches = {
304 DMI_EXACT_MATCH(DMI_SYS_VENDOR, "TECLAST"),
305 DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "F7"),
306 },
307 .driver_data = (void *)&sipodev_desc
308 },
309 {
310 .ident = "Trekstor Primebook C13",
311 .matches = {
312 DMI_EXACT_MATCH(DMI_SYS_VENDOR, "TREKSTOR"),
313 DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Primebook C13"),
314 },
315 .driver_data = (void *)&sipodev_desc
316 },
317 {
318 .ident = "Trekstor Primebook C11",
319 .matches = {
320 DMI_EXACT_MATCH(DMI_SYS_VENDOR, "TREKSTOR"),
321 DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Primebook C11"),
322 },
323 .driver_data = (void *)&sipodev_desc
324 },
325 {
326
327
328
329
330
331
332
333
334
335
336
337 .ident = "Trekstor Primebook C11B",
338 .matches = {
339 DMI_EXACT_MATCH(DMI_SYS_VENDOR, "TREKSTOR"),
340 DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Primebook C11B"),
341 },
342 .driver_data = (void *)&sipodev_desc
343 },
344 {
345 .ident = "Trekstor SURFBOOK E11B",
346 .matches = {
347 DMI_EXACT_MATCH(DMI_SYS_VENDOR, "TREKSTOR"),
348 DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "SURFBOOK E11B"),
349 },
350 .driver_data = (void *)&sipodev_desc
351 },
352 {
353 .ident = "Direkt-Tek DTLAPY116-2",
354 .matches = {
355 DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Direkt-Tek"),
356 DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "DTLAPY116-2"),
357 },
358 .driver_data = (void *)&sipodev_desc
359 },
360 {
361 .ident = "Direkt-Tek DTLAPY133-1",
362 .matches = {
363 DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Direkt-Tek"),
364 DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "DTLAPY133-1"),
365 },
366 .driver_data = (void *)&sipodev_desc
367 },
368 {
369 .ident = "Mediacom Flexbook Edge 11",
370 .matches = {
371 DMI_EXACT_MATCH(DMI_SYS_VENDOR, "MEDIACOM"),
372 DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "FlexBook edge11 - M-FBE11"),
373 },
374 .driver_data = (void *)&sipodev_desc
375 },
376 {
377 .ident = "Odys Winbook 13",
378 .matches = {
379 DMI_EXACT_MATCH(DMI_SYS_VENDOR, "AXDIA International GmbH"),
380 DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "WINBOOK 13"),
381 },
382 .driver_data = (void *)&sipodev_desc
383 },
384 {
385 .ident = "iBall Aer3",
386 .matches = {
387 DMI_EXACT_MATCH(DMI_SYS_VENDOR, "iBall"),
388 DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Aer3"),
389 },
390 .driver_data = (void *)&sipodev_desc
391 },
392 {
393 .ident = "Schneider SCL142ALM",
394 .matches = {
395 DMI_EXACT_MATCH(DMI_SYS_VENDOR, "SCHNEIDER"),
396 DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "SCL142ALM"),
397 },
398 .driver_data = (void *)&sipodev_desc
399 },
400 { }
401 };
402
403
404 struct i2c_hid_desc *i2c_hid_get_dmi_i2c_hid_desc_override(uint8_t *i2c_name)
405 {
406 struct i2c_hid_desc_override *override;
407 const struct dmi_system_id *system_id;
408
409 system_id = dmi_first_match(i2c_hid_dmi_desc_override_table);
410 if (!system_id)
411 return NULL;
412
413 override = system_id->driver_data;
414 if (strcmp(override->i2c_name, i2c_name))
415 return NULL;
416
417 return override->i2c_hid_desc;
418 }
419
420 char *i2c_hid_get_dmi_hid_report_desc_override(uint8_t *i2c_name,
421 unsigned int *size)
422 {
423 struct i2c_hid_desc_override *override;
424 const struct dmi_system_id *system_id;
425
426 system_id = dmi_first_match(i2c_hid_dmi_desc_override_table);
427 if (!system_id)
428 return NULL;
429
430 override = system_id->driver_data;
431 if (strcmp(override->i2c_name, i2c_name))
432 return NULL;
433
434 *size = override->hid_report_desc_size;
435 return override->hid_report_desc;
436 }