i2c-hid-dmi-quirks.c 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * Quirks for I2C-HID devices that do not supply proper descriptors
  4. *
  5. * Copyright (c) 2018 Julian Sax <[email protected]>
  6. *
  7. */
  8. #include <linux/types.h>
  9. #include <linux/dmi.h>
  10. #include <linux/mod_devicetable.h>
  11. #include <linux/hid.h>
  12. #include "i2c-hid.h"
  13. #include "../hid-ids.h"
  14. struct i2c_hid_desc_override {
  15. union {
  16. struct i2c_hid_desc *i2c_hid_desc;
  17. uint8_t *i2c_hid_desc_buffer;
  18. };
  19. uint8_t *hid_report_desc;
  20. unsigned int hid_report_desc_size;
  21. uint8_t *i2c_name;
  22. };
  23. /*
  24. * descriptors for the SIPODEV SP1064 touchpad
  25. *
  26. * This device does not supply any descriptors and on windows a filter
  27. * driver operates between the i2c-hid layer and the device and injects
  28. * these descriptors when the device is prompted. The descriptors were
  29. * extracted by listening to the i2c-hid traffic that occurs between the
  30. * windows filter driver and the windows i2c-hid driver.
  31. */
  32. static const struct i2c_hid_desc_override sipodev_desc = {
  33. .i2c_hid_desc_buffer = (uint8_t [])
  34. {0x1e, 0x00, /* Length of descriptor */
  35. 0x00, 0x01, /* Version of descriptor */
  36. 0xdb, 0x01, /* Length of report descriptor */
  37. 0x21, 0x00, /* Location of report descriptor */
  38. 0x24, 0x00, /* Location of input report */
  39. 0x1b, 0x00, /* Max input report length */
  40. 0x25, 0x00, /* Location of output report */
  41. 0x11, 0x00, /* Max output report length */
  42. 0x22, 0x00, /* Location of command register */
  43. 0x23, 0x00, /* Location of data register */
  44. 0x11, 0x09, /* Vendor ID */
  45. 0x88, 0x52, /* Product ID */
  46. 0x06, 0x00, /* Version ID */
  47. 0x00, 0x00, 0x00, 0x00 /* Reserved */
  48. },
  49. .hid_report_desc = (uint8_t [])
  50. {0x05, 0x01, /* Usage Page (Desktop), */
  51. 0x09, 0x02, /* Usage (Mouse), */
  52. 0xA1, 0x01, /* Collection (Application), */
  53. 0x85, 0x01, /* Report ID (1), */
  54. 0x09, 0x01, /* Usage (Pointer), */
  55. 0xA1, 0x00, /* Collection (Physical), */
  56. 0x05, 0x09, /* Usage Page (Button), */
  57. 0x19, 0x01, /* Usage Minimum (01h), */
  58. 0x29, 0x02, /* Usage Maximum (02h), */
  59. 0x25, 0x01, /* Logical Maximum (1), */
  60. 0x75, 0x01, /* Report Size (1), */
  61. 0x95, 0x02, /* Report Count (2), */
  62. 0x81, 0x02, /* Input (Variable), */
  63. 0x95, 0x06, /* Report Count (6), */
  64. 0x81, 0x01, /* Input (Constant), */
  65. 0x05, 0x01, /* Usage Page (Desktop), */
  66. 0x09, 0x30, /* Usage (X), */
  67. 0x09, 0x31, /* Usage (Y), */
  68. 0x15, 0x81, /* Logical Minimum (-127), */
  69. 0x25, 0x7F, /* Logical Maximum (127), */
  70. 0x75, 0x08, /* Report Size (8), */
  71. 0x95, 0x02, /* Report Count (2), */
  72. 0x81, 0x06, /* Input (Variable, Relative), */
  73. 0xC0, /* End Collection, */
  74. 0xC0, /* End Collection, */
  75. 0x05, 0x0D, /* Usage Page (Digitizer), */
  76. 0x09, 0x05, /* Usage (Touchpad), */
  77. 0xA1, 0x01, /* Collection (Application), */
  78. 0x85, 0x04, /* Report ID (4), */
  79. 0x05, 0x0D, /* Usage Page (Digitizer), */
  80. 0x09, 0x22, /* Usage (Finger), */
  81. 0xA1, 0x02, /* Collection (Logical), */
  82. 0x15, 0x00, /* Logical Minimum (0), */
  83. 0x25, 0x01, /* Logical Maximum (1), */
  84. 0x09, 0x47, /* Usage (Touch Valid), */
  85. 0x09, 0x42, /* Usage (Tip Switch), */
  86. 0x95, 0x02, /* Report Count (2), */
  87. 0x75, 0x01, /* Report Size (1), */
  88. 0x81, 0x02, /* Input (Variable), */
  89. 0x95, 0x01, /* Report Count (1), */
  90. 0x75, 0x03, /* Report Size (3), */
  91. 0x25, 0x05, /* Logical Maximum (5), */
  92. 0x09, 0x51, /* Usage (Contact Identifier), */
  93. 0x81, 0x02, /* Input (Variable), */
  94. 0x75, 0x01, /* Report Size (1), */
  95. 0x95, 0x03, /* Report Count (3), */
  96. 0x81, 0x03, /* Input (Constant, Variable), */
  97. 0x05, 0x01, /* Usage Page (Desktop), */
  98. 0x26, 0x44, 0x0A, /* Logical Maximum (2628), */
  99. 0x75, 0x10, /* Report Size (16), */
  100. 0x55, 0x0E, /* Unit Exponent (14), */
  101. 0x65, 0x11, /* Unit (Centimeter), */
  102. 0x09, 0x30, /* Usage (X), */
  103. 0x46, 0x1A, 0x04, /* Physical Maximum (1050), */
  104. 0x95, 0x01, /* Report Count (1), */
  105. 0x81, 0x02, /* Input (Variable), */
  106. 0x46, 0xBC, 0x02, /* Physical Maximum (700), */
  107. 0x26, 0x34, 0x05, /* Logical Maximum (1332), */
  108. 0x09, 0x31, /* Usage (Y), */
  109. 0x81, 0x02, /* Input (Variable), */
  110. 0xC0, /* End Collection, */
  111. 0x05, 0x0D, /* Usage Page (Digitizer), */
  112. 0x09, 0x22, /* Usage (Finger), */
  113. 0xA1, 0x02, /* Collection (Logical), */
  114. 0x25, 0x01, /* Logical Maximum (1), */
  115. 0x09, 0x47, /* Usage (Touch Valid), */
  116. 0x09, 0x42, /* Usage (Tip Switch), */
  117. 0x95, 0x02, /* Report Count (2), */
  118. 0x75, 0x01, /* Report Size (1), */
  119. 0x81, 0x02, /* Input (Variable), */
  120. 0x95, 0x01, /* Report Count (1), */
  121. 0x75, 0x03, /* Report Size (3), */
  122. 0x25, 0x05, /* Logical Maximum (5), */
  123. 0x09, 0x51, /* Usage (Contact Identifier), */
  124. 0x81, 0x02, /* Input (Variable), */
  125. 0x75, 0x01, /* Report Size (1), */
  126. 0x95, 0x03, /* Report Count (3), */
  127. 0x81, 0x03, /* Input (Constant, Variable), */
  128. 0x05, 0x01, /* Usage Page (Desktop), */
  129. 0x26, 0x44, 0x0A, /* Logical Maximum (2628), */
  130. 0x75, 0x10, /* Report Size (16), */
  131. 0x09, 0x30, /* Usage (X), */
  132. 0x46, 0x1A, 0x04, /* Physical Maximum (1050), */
  133. 0x95, 0x01, /* Report Count (1), */
  134. 0x81, 0x02, /* Input (Variable), */
  135. 0x46, 0xBC, 0x02, /* Physical Maximum (700), */
  136. 0x26, 0x34, 0x05, /* Logical Maximum (1332), */
  137. 0x09, 0x31, /* Usage (Y), */
  138. 0x81, 0x02, /* Input (Variable), */
  139. 0xC0, /* End Collection, */
  140. 0x05, 0x0D, /* Usage Page (Digitizer), */
  141. 0x09, 0x22, /* Usage (Finger), */
  142. 0xA1, 0x02, /* Collection (Logical), */
  143. 0x25, 0x01, /* Logical Maximum (1), */
  144. 0x09, 0x47, /* Usage (Touch Valid), */
  145. 0x09, 0x42, /* Usage (Tip Switch), */
  146. 0x95, 0x02, /* Report Count (2), */
  147. 0x75, 0x01, /* Report Size (1), */
  148. 0x81, 0x02, /* Input (Variable), */
  149. 0x95, 0x01, /* Report Count (1), */
  150. 0x75, 0x03, /* Report Size (3), */
  151. 0x25, 0x05, /* Logical Maximum (5), */
  152. 0x09, 0x51, /* Usage (Contact Identifier), */
  153. 0x81, 0x02, /* Input (Variable), */
  154. 0x75, 0x01, /* Report Size (1), */
  155. 0x95, 0x03, /* Report Count (3), */
  156. 0x81, 0x03, /* Input (Constant, Variable), */
  157. 0x05, 0x01, /* Usage Page (Desktop), */
  158. 0x26, 0x44, 0x0A, /* Logical Maximum (2628), */
  159. 0x75, 0x10, /* Report Size (16), */
  160. 0x09, 0x30, /* Usage (X), */
  161. 0x46, 0x1A, 0x04, /* Physical Maximum (1050), */
  162. 0x95, 0x01, /* Report Count (1), */
  163. 0x81, 0x02, /* Input (Variable), */
  164. 0x46, 0xBC, 0x02, /* Physical Maximum (700), */
  165. 0x26, 0x34, 0x05, /* Logical Maximum (1332), */
  166. 0x09, 0x31, /* Usage (Y), */
  167. 0x81, 0x02, /* Input (Variable), */
  168. 0xC0, /* End Collection, */
  169. 0x05, 0x0D, /* Usage Page (Digitizer), */
  170. 0x09, 0x22, /* Usage (Finger), */
  171. 0xA1, 0x02, /* Collection (Logical), */
  172. 0x25, 0x01, /* Logical Maximum (1), */
  173. 0x09, 0x47, /* Usage (Touch Valid), */
  174. 0x09, 0x42, /* Usage (Tip Switch), */
  175. 0x95, 0x02, /* Report Count (2), */
  176. 0x75, 0x01, /* Report Size (1), */
  177. 0x81, 0x02, /* Input (Variable), */
  178. 0x95, 0x01, /* Report Count (1), */
  179. 0x75, 0x03, /* Report Size (3), */
  180. 0x25, 0x05, /* Logical Maximum (5), */
  181. 0x09, 0x51, /* Usage (Contact Identifier), */
  182. 0x81, 0x02, /* Input (Variable), */
  183. 0x75, 0x01, /* Report Size (1), */
  184. 0x95, 0x03, /* Report Count (3), */
  185. 0x81, 0x03, /* Input (Constant, Variable), */
  186. 0x05, 0x01, /* Usage Page (Desktop), */
  187. 0x26, 0x44, 0x0A, /* Logical Maximum (2628), */
  188. 0x75, 0x10, /* Report Size (16), */
  189. 0x09, 0x30, /* Usage (X), */
  190. 0x46, 0x1A, 0x04, /* Physical Maximum (1050), */
  191. 0x95, 0x01, /* Report Count (1), */
  192. 0x81, 0x02, /* Input (Variable), */
  193. 0x46, 0xBC, 0x02, /* Physical Maximum (700), */
  194. 0x26, 0x34, 0x05, /* Logical Maximum (1332), */
  195. 0x09, 0x31, /* Usage (Y), */
  196. 0x81, 0x02, /* Input (Variable), */
  197. 0xC0, /* End Collection, */
  198. 0x05, 0x0D, /* Usage Page (Digitizer), */
  199. 0x55, 0x0C, /* Unit Exponent (12), */
  200. 0x66, 0x01, 0x10, /* Unit (Seconds), */
  201. 0x47, 0xFF, 0xFF, 0x00, 0x00,/* Physical Maximum (65535), */
  202. 0x27, 0xFF, 0xFF, 0x00, 0x00,/* Logical Maximum (65535), */
  203. 0x75, 0x10, /* Report Size (16), */
  204. 0x95, 0x01, /* Report Count (1), */
  205. 0x09, 0x56, /* Usage (Scan Time), */
  206. 0x81, 0x02, /* Input (Variable), */
  207. 0x09, 0x54, /* Usage (Contact Count), */
  208. 0x25, 0x7F, /* Logical Maximum (127), */
  209. 0x75, 0x08, /* Report Size (8), */
  210. 0x81, 0x02, /* Input (Variable), */
  211. 0x05, 0x09, /* Usage Page (Button), */
  212. 0x09, 0x01, /* Usage (01h), */
  213. 0x25, 0x01, /* Logical Maximum (1), */
  214. 0x75, 0x01, /* Report Size (1), */
  215. 0x95, 0x01, /* Report Count (1), */
  216. 0x81, 0x02, /* Input (Variable), */
  217. 0x95, 0x07, /* Report Count (7), */
  218. 0x81, 0x03, /* Input (Constant, Variable), */
  219. 0x05, 0x0D, /* Usage Page (Digitizer), */
  220. 0x85, 0x02, /* Report ID (2), */
  221. 0x09, 0x55, /* Usage (Contact Count Maximum), */
  222. 0x09, 0x59, /* Usage (59h), */
  223. 0x75, 0x04, /* Report Size (4), */
  224. 0x95, 0x02, /* Report Count (2), */
  225. 0x25, 0x0F, /* Logical Maximum (15), */
  226. 0xB1, 0x02, /* Feature (Variable), */
  227. 0x05, 0x0D, /* Usage Page (Digitizer), */
  228. 0x85, 0x07, /* Report ID (7), */
  229. 0x09, 0x60, /* Usage (60h), */
  230. 0x75, 0x01, /* Report Size (1), */
  231. 0x95, 0x01, /* Report Count (1), */
  232. 0x25, 0x01, /* Logical Maximum (1), */
  233. 0xB1, 0x02, /* Feature (Variable), */
  234. 0x95, 0x07, /* Report Count (7), */
  235. 0xB1, 0x03, /* Feature (Constant, Variable), */
  236. 0x85, 0x06, /* Report ID (6), */
  237. 0x06, 0x00, 0xFF, /* Usage Page (FF00h), */
  238. 0x09, 0xC5, /* Usage (C5h), */
  239. 0x26, 0xFF, 0x00, /* Logical Maximum (255), */
  240. 0x75, 0x08, /* Report Size (8), */
  241. 0x96, 0x00, 0x01, /* Report Count (256), */
  242. 0xB1, 0x02, /* Feature (Variable), */
  243. 0xC0, /* End Collection, */
  244. 0x06, 0x00, 0xFF, /* Usage Page (FF00h), */
  245. 0x09, 0x01, /* Usage (01h), */
  246. 0xA1, 0x01, /* Collection (Application), */
  247. 0x85, 0x0D, /* Report ID (13), */
  248. 0x26, 0xFF, 0x00, /* Logical Maximum (255), */
  249. 0x19, 0x01, /* Usage Minimum (01h), */
  250. 0x29, 0x02, /* Usage Maximum (02h), */
  251. 0x75, 0x08, /* Report Size (8), */
  252. 0x95, 0x02, /* Report Count (2), */
  253. 0xB1, 0x02, /* Feature (Variable), */
  254. 0xC0, /* End Collection, */
  255. 0x05, 0x0D, /* Usage Page (Digitizer), */
  256. 0x09, 0x0E, /* Usage (Configuration), */
  257. 0xA1, 0x01, /* Collection (Application), */
  258. 0x85, 0x03, /* Report ID (3), */
  259. 0x09, 0x22, /* Usage (Finger), */
  260. 0xA1, 0x02, /* Collection (Logical), */
  261. 0x09, 0x52, /* Usage (Device Mode), */
  262. 0x25, 0x0A, /* Logical Maximum (10), */
  263. 0x95, 0x01, /* Report Count (1), */
  264. 0xB1, 0x02, /* Feature (Variable), */
  265. 0xC0, /* End Collection, */
  266. 0x09, 0x22, /* Usage (Finger), */
  267. 0xA1, 0x00, /* Collection (Physical), */
  268. 0x85, 0x05, /* Report ID (5), */
  269. 0x09, 0x57, /* Usage (57h), */
  270. 0x09, 0x58, /* Usage (58h), */
  271. 0x75, 0x01, /* Report Size (1), */
  272. 0x95, 0x02, /* Report Count (2), */
  273. 0x25, 0x01, /* Logical Maximum (1), */
  274. 0xB1, 0x02, /* Feature (Variable), */
  275. 0x95, 0x06, /* Report Count (6), */
  276. 0xB1, 0x03, /* Feature (Constant, Variable),*/
  277. 0xC0, /* End Collection, */
  278. 0xC0 /* End Collection */
  279. },
  280. .hid_report_desc_size = 475,
  281. .i2c_name = "SYNA3602:00"
  282. };
  283. static const struct dmi_system_id i2c_hid_dmi_desc_override_table[] = {
  284. {
  285. .ident = "Teclast F6 Pro",
  286. .matches = {
  287. DMI_EXACT_MATCH(DMI_SYS_VENDOR, "TECLAST"),
  288. DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "F6 Pro"),
  289. },
  290. .driver_data = (void *)&sipodev_desc
  291. },
  292. {
  293. .ident = "Teclast F7",
  294. .matches = {
  295. DMI_EXACT_MATCH(DMI_SYS_VENDOR, "TECLAST"),
  296. DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "F7"),
  297. },
  298. .driver_data = (void *)&sipodev_desc
  299. },
  300. {
  301. .ident = "Trekstor Primebook C13",
  302. .matches = {
  303. DMI_EXACT_MATCH(DMI_SYS_VENDOR, "TREKSTOR"),
  304. DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Primebook C13"),
  305. },
  306. .driver_data = (void *)&sipodev_desc
  307. },
  308. {
  309. .ident = "Trekstor Primebook C11",
  310. .matches = {
  311. DMI_EXACT_MATCH(DMI_SYS_VENDOR, "TREKSTOR"),
  312. DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Primebook C11"),
  313. },
  314. .driver_data = (void *)&sipodev_desc
  315. },
  316. {
  317. /*
  318. * There are at least 2 Primebook C11B versions, the older
  319. * version has a product-name of "Primebook C11B", and a
  320. * bios version / release / firmware revision of:
  321. * V2.1.2 / 05/03/2018 / 18.2
  322. * The new version has "PRIMEBOOK C11B" as product-name and a
  323. * bios version / release / firmware revision of:
  324. * CFALKSW05_BIOS_V1.1.2 / 11/19/2018 / 19.2
  325. * Only the older version needs this quirk, note the newer
  326. * version will not match as it has a different product-name.
  327. */
  328. .ident = "Trekstor Primebook C11B",
  329. .matches = {
  330. DMI_EXACT_MATCH(DMI_SYS_VENDOR, "TREKSTOR"),
  331. DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Primebook C11B"),
  332. },
  333. .driver_data = (void *)&sipodev_desc
  334. },
  335. {
  336. .ident = "Trekstor SURFBOOK E11B",
  337. .matches = {
  338. DMI_EXACT_MATCH(DMI_SYS_VENDOR, "TREKSTOR"),
  339. DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "SURFBOOK E11B"),
  340. },
  341. .driver_data = (void *)&sipodev_desc
  342. },
  343. {
  344. .ident = "Direkt-Tek DTLAPY116-2",
  345. .matches = {
  346. DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Direkt-Tek"),
  347. DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "DTLAPY116-2"),
  348. },
  349. .driver_data = (void *)&sipodev_desc
  350. },
  351. {
  352. .ident = "Direkt-Tek DTLAPY133-1",
  353. .matches = {
  354. DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Direkt-Tek"),
  355. DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "DTLAPY133-1"),
  356. },
  357. .driver_data = (void *)&sipodev_desc
  358. },
  359. {
  360. .ident = "Mediacom Flexbook Edge 11",
  361. .matches = {
  362. DMI_EXACT_MATCH(DMI_SYS_VENDOR, "MEDIACOM"),
  363. DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "FlexBook edge11 - M-FBE11"),
  364. },
  365. .driver_data = (void *)&sipodev_desc
  366. },
  367. {
  368. .ident = "Mediacom FlexBook edge 13",
  369. .matches = {
  370. DMI_EXACT_MATCH(DMI_SYS_VENDOR, "MEDIACOM"),
  371. DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "FlexBook_edge13-M-FBE13"),
  372. },
  373. .driver_data = (void *)&sipodev_desc
  374. },
  375. {
  376. .ident = "Odys Winbook 13",
  377. .matches = {
  378. DMI_EXACT_MATCH(DMI_SYS_VENDOR, "AXDIA International GmbH"),
  379. DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "WINBOOK 13"),
  380. },
  381. .driver_data = (void *)&sipodev_desc
  382. },
  383. {
  384. .ident = "iBall Aer3",
  385. .matches = {
  386. DMI_EXACT_MATCH(DMI_SYS_VENDOR, "iBall"),
  387. DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Aer3"),
  388. },
  389. .driver_data = (void *)&sipodev_desc
  390. },
  391. {
  392. .ident = "Schneider SCL142ALM",
  393. .matches = {
  394. DMI_EXACT_MATCH(DMI_SYS_VENDOR, "SCHNEIDER"),
  395. DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "SCL142ALM"),
  396. },
  397. .driver_data = (void *)&sipodev_desc
  398. },
  399. {
  400. .ident = "Vero K147",
  401. .matches = {
  402. DMI_EXACT_MATCH(DMI_SYS_VENDOR, "VERO"),
  403. DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "K147"),
  404. },
  405. .driver_data = (void *)&sipodev_desc
  406. },
  407. { } /* Terminate list */
  408. };
  409. static const struct hid_device_id i2c_hid_elan_flipped_quirks = {
  410. HID_DEVICE(BUS_I2C, HID_GROUP_MULTITOUCH_WIN_8, USB_VENDOR_ID_ELAN, 0x2dcd),
  411. HID_QUIRK_X_INVERT | HID_QUIRK_Y_INVERT
  412. };
  413. /*
  414. * This list contains devices which have specific issues based on the system
  415. * they're on and not just the device itself. The driver_data will have a
  416. * specific hid device to match against.
  417. */
  418. static const struct dmi_system_id i2c_hid_dmi_quirk_table[] = {
  419. {
  420. .ident = "DynaBook K50/FR",
  421. .matches = {
  422. DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Dynabook Inc."),
  423. DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "dynabook K50/FR"),
  424. },
  425. .driver_data = (void *)&i2c_hid_elan_flipped_quirks,
  426. },
  427. { } /* Terminate list */
  428. };
  429. struct i2c_hid_desc *i2c_hid_get_dmi_i2c_hid_desc_override(uint8_t *i2c_name)
  430. {
  431. struct i2c_hid_desc_override *override;
  432. const struct dmi_system_id *system_id;
  433. system_id = dmi_first_match(i2c_hid_dmi_desc_override_table);
  434. if (!system_id)
  435. return NULL;
  436. override = system_id->driver_data;
  437. if (strcmp(override->i2c_name, i2c_name))
  438. return NULL;
  439. return override->i2c_hid_desc;
  440. }
  441. char *i2c_hid_get_dmi_hid_report_desc_override(uint8_t *i2c_name,
  442. unsigned int *size)
  443. {
  444. struct i2c_hid_desc_override *override;
  445. const struct dmi_system_id *system_id;
  446. system_id = dmi_first_match(i2c_hid_dmi_desc_override_table);
  447. if (!system_id)
  448. return NULL;
  449. override = system_id->driver_data;
  450. if (strcmp(override->i2c_name, i2c_name))
  451. return NULL;
  452. *size = override->hid_report_desc_size;
  453. return override->hid_report_desc;
  454. }
  455. u32 i2c_hid_get_dmi_quirks(const u16 vendor, const u16 product)
  456. {
  457. u32 quirks = 0;
  458. const struct dmi_system_id *system_id =
  459. dmi_first_match(i2c_hid_dmi_quirk_table);
  460. if (system_id) {
  461. const struct hid_device_id *device_id =
  462. (struct hid_device_id *)(system_id->driver_data);
  463. if (device_id && device_id->vendor == vendor &&
  464. device_id->product == product)
  465. quirks = device_id->driver_data;
  466. }
  467. return quirks;
  468. }