Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'for-linus-2022100501' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid

Pull HID updates from Benjamin Tissoires:

- handle of all Logitech Bluetooth HID++ devices in the Logitech HID++
drivers (Bastien Nocera)

- fix broken atomic checks in hid-multitouch by adding memory barriers
(Andri Yngvason)

- better handling of devices with AMD SFH1.1 (Basavaraj Natikar)

- better support of Nintendo clone controllers (Icenowy Zheng and
Johnothan King)

- Support for various RC controllers (Marcus Folkesson)

- Add UGEEv2 support in hid-uclogic (XP-PEN Deco Pro S and Parblo A610
PRO) (José Expósito)

- some conversions to use dev_groups (Greg Kroah-Hartman)

- HID-BPF preparatory patches, mostly to convert blank defines as enums
(Benjamin Tissoires)

* tag 'for-linus-2022100501' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid: (38 commits)
HID: wacom: add three styli to wacom_intuos_get_tool_type
HID: amd_sfh: Handle condition of "no sensors" for SFH1.1
HID: amd_sfh: Change dev_err to dev_dbg for additional debug info
HID: nintendo: check analog user calibration for plausibility
HID: nintendo: deregister home LED when it fails
HID: roccat: Fix use-after-free in roccat_read()
hid: topre: Add driver fixing report descriptor
HID: multitouch: Add memory barriers
HID: convert defines of HID class requests into a proper enum
HID: export hid_report_type to uapi
HID: core: store the unique system identifier in hid_device
HID: Add driver for PhoenixRC Flight Controller
HID: Add driver for VRC-2 Car Controller
HID: sony: Fix double word in comments
hid: hid-logitech-hidpp: avoid unnecessary assignments in hidpp_connect_event
HID: logitech-hidpp: Detect hi-res scrolling support
HID: logitech-hidpp: Remove hard-coded "Sw. Id." for HID++ 2.0 commands
HID: logitech-hidpp: Fix "Sw. Id." for HID++ 2.0 commands
HID: logitech-hidpp: Remove special-casing of Bluetooth devices
HID: logitech-hidpp: Enable HID++ for all the Logitech Bluetooth devices
...

+1034 -325
+12
MAINTAINERS
··· 9082 9082 S: Supported 9083 9083 F: drivers/hid/hid-playstation.c 9084 9084 9085 + HID PHOENIX RC FLIGHT CONTROLLER 9086 + M: Marcus Folkesson <marcus.folkesson@gmail.com> 9087 + L: linux-input@vger.kernel.org 9088 + S: Maintained 9089 + F: drivers/hid/hid-pxrc.c 9090 + 9085 9091 HID SENSOR HUB DRIVERS 9086 9092 M: Jiri Kosina <jikos@kernel.org> 9087 9093 M: Jonathan Cameron <jic23@kernel.org> ··· 9099 9093 F: drivers/hid/hid-sensor-* 9100 9094 F: drivers/iio/*/hid-* 9101 9095 F: include/linux/hid-sensor-* 9096 + 9097 + HID VRC-2 CAR CONTROLLER DRIVER 9098 + M: Marcus Folkesson <marcus.folkesson@gmail.com> 9099 + L: linux-input@vger.kernel.org 9100 + S: Maintained 9101 + F: drivers/hid/hid-vrc2.c 9102 9102 9103 9103 HID WACOM DRIVER 9104 9104 M: Ping Cheng <ping.cheng@wacom.com>
+27 -73
drivers/hid/Kconfig
··· 28 28 29 29 config HID_BATTERY_STRENGTH 30 30 bool "Battery level reporting for HID devices" 31 - depends on HID 32 31 select POWER_SUPPLY 33 32 default n 34 33 help ··· 37 38 38 39 config HIDRAW 39 40 bool "/dev/hidraw raw HID device support" 40 - depends on HID 41 41 help 42 42 Say Y here if you want to support HID devices (from the USB 43 43 specification standpoint) that aren't strictly user interface ··· 55 57 56 58 config UHID 57 59 tristate "User-space I/O driver support for HID subsystem" 58 - depends on HID 59 60 default n 60 61 help 61 62 Say Y here if you want to provide HID I/O Drivers from user-space. ··· 75 78 76 79 config HID_GENERIC 77 80 tristate "Generic HID driver" 78 - depends on HID 79 81 default HID 80 82 help 81 83 Support for generic devices on the HID bus. This includes most ··· 86 90 If unsure, say Y. 87 91 88 92 menu "Special HID drivers" 89 - depends on HID 90 93 91 94 config HID_A4TECH 92 95 tristate "A4TECH mice" 93 - depends on HID 94 96 default !EXPERT 95 97 help 96 98 Support for some A4TECH mice with two scroll wheels. ··· 107 113 108 114 config HID_ACRUX 109 115 tristate "ACRUX game controller support" 110 - depends on HID 111 116 help 112 117 Say Y here if you want to enable support for ACRUX game controllers. 113 118 ··· 120 127 121 128 config HID_APPLE 122 129 tristate "Apple {i,Power,Mac}Books" 123 - depends on HID 124 130 depends on LEDS_CLASS 125 131 depends on NEW_LEDS 126 132 default !EXPERT ··· 159 167 160 168 config HID_AUREAL 161 169 tristate "Aureal" 162 - depends on HID 163 170 help 164 171 Support for Aureal Cy se W-01RN Remote Controller and other Aureal derived remotes. 165 172 166 173 config HID_BELKIN 167 174 tristate "Belkin Flip KVM and Wireless keyboard" 168 - depends on HID 169 175 default !EXPERT 170 176 help 171 177 Support for Belkin Flip KVM and Wireless keyboard. ··· 192 202 193 203 config HID_CHERRY 194 204 tristate "Cherry Cymotion keyboard" 195 - depends on HID 196 205 default !EXPERT 197 206 help 198 207 Support for Cherry Cymotion keyboard. ··· 216 227 217 228 config HID_COUGAR 218 229 tristate "Cougar devices" 219 - depends on HID 220 230 help 221 231 Support for Cougar devices that are not fully compliant with the 222 232 HID standard. ··· 225 237 226 238 config HID_MACALLY 227 239 tristate "Macally devices" 228 - depends on HID 229 240 help 230 241 Support for Macally devices that are not fully compliant with the 231 242 HID standard. ··· 249 262 250 263 config HID_CMEDIA 251 264 tristate "CMedia audio chips" 252 - depends on HID 253 265 help 254 266 Support for CMedia CM6533 HID audio jack controls 255 267 and HS100B mute buttons. ··· 274 288 275 289 config HID_CYPRESS 276 290 tristate "Cypress mouse and barcode readers" 277 - depends on HID 278 291 default !EXPERT 279 292 help 280 293 Support for cypress mouse and barcode readers. 281 294 282 295 config HID_DRAGONRISE 283 296 tristate "DragonRise Inc. game controller" 284 - depends on HID 285 297 help 286 298 Say Y here if you have DragonRise Inc. game controllers. 287 299 These might be branded as: ··· 298 314 299 315 config HID_EMS_FF 300 316 tristate "EMS Production Inc. force feedback support" 301 - depends on HID 302 317 select INPUT_FF_MEMLESS 303 318 help 304 319 Say Y here if you want to enable force feedback support for devices by ··· 315 332 316 333 config HID_ELECOM 317 334 tristate "ELECOM HID devices" 318 - depends on HID 319 335 help 320 336 Support for ELECOM devices: 321 337 - BM084 Bluetooth Mouse ··· 331 349 332 350 config HID_EZKEY 333 351 tristate "Ezkey BTC 8193 keyboard" 334 - depends on HID 335 352 default !EXPERT 336 353 help 337 354 Support for Ezkey BTC 8193 keyboard. ··· 348 367 349 368 config HID_GEMBIRD 350 369 tristate "Gembird Joypad" 351 - depends on HID 352 370 help 353 371 Support for Gembird JPD-DualForce 2. 354 372 355 373 config HID_GFRM 356 374 tristate "Google Fiber TV Box remote control support" 357 - depends on HID 358 375 help 359 376 Support for Google Fiber TV Box remote controls 360 377 361 378 config HID_GLORIOUS 362 379 tristate "Glorious PC Gaming Race mice" 363 - depends on HID 364 380 help 365 381 Support for Glorious PC Gaming Race mice such as 366 382 the Glorious Model O, O- and D. ··· 402 424 tristate "Vivaldi Keyboard" 403 425 select HID_VIVALDI_COMMON 404 426 select INPUT_VIVALDIFMAP 405 - depends on HID 406 427 help 407 428 Say Y here if you want to enable support for Vivaldi keyboards. 408 429 ··· 424 447 425 448 config HID_KEYTOUCH 426 449 tristate "Keytouch HID devices" 427 - depends on HID 428 450 help 429 451 Support for Keytouch HID devices not fully compliant with 430 452 the specification. Currently supported: ··· 431 455 432 456 config HID_KYE 433 457 tristate "KYE/Genius devices" 434 - depends on HID 435 458 help 436 459 Support for KYE/Genius devices not fully compliant with HID standard: 437 460 - Ergo Mouse ··· 446 471 447 472 config HID_WALTOP 448 473 tristate "Waltop" 449 - depends on HID 450 474 help 451 475 Support for Waltop tablets. 452 476 453 477 config HID_VIEWSONIC 454 478 tristate "ViewSonic/Signotec" 455 - depends on HID 456 479 help 457 480 Support for ViewSonic/Signotec PD1011 signature pad. 458 481 482 + config HID_VRC2 483 + tristate "VRC-2 Car Controller" 484 + depends on HID 485 + help 486 + Support for VRC-2 which is a 2-axis controller often used in 487 + car simulators. 488 + 489 + To compile this driver as a module, choose M here: the 490 + module will be called hid-vrc2. 491 + 459 492 config HID_XIAOMI 460 493 tristate "Xiaomi" 461 - depends on HID 462 494 help 463 495 Adds support for side buttons of Xiaomi Mi Dual Mode Wireless 464 496 Mouse Silent Edition. 465 497 466 498 config HID_GYRATION 467 499 tristate "Gyration remote control" 468 - depends on HID 469 500 help 470 501 Support for Gyration remote control. 471 502 472 503 config HID_ICADE 473 504 tristate "ION iCade arcade controller" 474 - depends on HID 475 505 help 476 506 Support for the ION iCade arcade controller to work as a joystick. 477 507 ··· 485 505 486 506 config HID_ITE 487 507 tristate "ITE devices" 488 - depends on HID 489 508 default !EXPERT 490 509 help 491 510 Support for ITE devices not fully compliant with HID standard. 492 511 493 512 config HID_JABRA 494 513 tristate "Jabra USB HID Driver" 495 - depends on HID 496 514 help 497 515 Support for Jabra USB HID devices. 498 516 ··· 501 523 502 524 config HID_TWINHAN 503 525 tristate "Twinhan IR remote control" 504 - depends on HID 505 526 help 506 527 Support for Twinhan IR remote control. 507 528 508 529 config HID_KENSINGTON 509 530 tristate "Kensington Slimblade Trackball" 510 - depends on HID 511 531 default !EXPERT 512 532 help 513 533 Support for Kensington Slimblade Trackball. 514 534 515 535 config HID_LCPOWER 516 536 tristate "LC-Power" 517 - depends on HID 518 537 help 519 538 Support for LC-Power RC1000MCE RF remote control. 520 539 521 540 config HID_LED 522 541 tristate "Simple RGB LED support" 523 - depends on HID 524 542 depends on LEDS_CLASS 525 543 help 526 544 Support for simple RGB LED devices. Currently supported are: ··· 531 557 532 558 config HID_LENOVO 533 559 tristate "Lenovo / Thinkpad devices" 534 - depends on HID 535 560 select NEW_LEDS 536 561 select LEDS_CLASS 537 562 help ··· 648 675 649 676 config HID_MAGICMOUSE 650 677 tristate "Apple Magic Mouse/Trackpad multi-touch support" 651 - depends on HID 652 678 help 653 679 Support for the Apple Magic Mouse/Trackpad multi-touch. 654 680 ··· 656 684 657 685 config HID_MALTRON 658 686 tristate "Maltron L90 keyboard" 659 - depends on HID 660 687 help 661 688 Adds support for the volume up, volume down, mute, and play/pause buttons 662 689 of the Maltron L90 keyboard. 663 690 664 691 config HID_MAYFLASH 665 692 tristate "Mayflash game controller adapter force feedback" 666 - depends on HID 667 693 select INPUT_FF_MEMLESS 668 694 help 669 695 Say Y here if you have HJZ Mayflash PS3 game controller adapters ··· 677 707 678 708 config HID_REDRAGON 679 709 tristate "Redragon keyboards" 680 - depends on HID 681 710 default !EXPERT 682 711 help 683 712 Support for Redragon keyboards that need fix-ups to work properly. 684 713 685 714 config HID_MICROSOFT 686 715 tristate "Microsoft non-fully HID-compliant devices" 687 - depends on HID 688 716 default !EXPERT 689 717 select INPUT_FF_MEMLESS 690 718 help ··· 690 722 691 723 config HID_MONTEREY 692 724 tristate "Monterey Genius KB29E keyboard" 693 - depends on HID 694 725 default !EXPERT 695 726 help 696 727 Support for Monterey Genius KB29E. 697 728 698 729 config HID_MULTITOUCH 699 730 tristate "HID Multitouch panels" 700 - depends on HID 701 731 help 702 732 Generic support for HID multitouch panels. 703 733 ··· 741 775 742 776 config HID_NINTENDO 743 777 tristate "Nintendo Joy-Con and Pro Controller support" 744 - depends on HID 745 778 depends on NEW_LEDS 746 779 depends on LEDS_CLASS 747 780 select POWER_SUPPLY ··· 776 811 777 812 config HID_ORTEK 778 813 tristate "Ortek PKB-1700/WKB-2000/Skycable wireless keyboard and mouse trackpad" 779 - depends on HID 780 814 help 781 815 There are certain devices which have LogicalMaximum wrong in the keyboard 782 816 usage page of their report descriptor. The most prevailing ones so far ··· 788 824 789 825 config HID_PANTHERLORD 790 826 tristate "Pantherlord/GreenAsia game controller" 791 - depends on HID 792 827 help 793 828 Say Y here if you have a PantherLord/GreenAsia based game controller 794 829 or adapter. ··· 813 850 814 851 config HID_PETALYNX 815 852 tristate "Petalynx Maxter remote control" 816 - depends on HID 817 853 help 818 854 Support for Petalynx Maxter remote control. 819 855 820 856 config HID_PICOLCD 821 857 tristate "PicoLCD (graphic version)" 822 - depends on HID 823 858 help 824 859 This provides support for Minibox PicoLCD devices, currently 825 860 only the graphical ones are supported. ··· 883 922 884 923 config HID_PLANTRONICS 885 924 tristate "Plantronics USB HID Driver" 886 - depends on HID 887 925 help 888 926 Provides HID support for Plantronics USB audio devices. 889 927 Correctly maps vendor unique volume up/down HID usages to ··· 893 933 894 934 config HID_PLAYSTATION 895 935 tristate "PlayStation HID Driver" 896 - depends on HID 897 936 depends on LEDS_CLASS_MULTICOLOR 898 937 select CRC32 899 938 select POWER_SUPPLY ··· 909 950 Say Y here if you would like to enable force feedback support for 910 951 PlayStation game controllers. 911 952 953 + config HID_PXRC 954 + tristate "PhoenixRC HID Flight Controller" 955 + depends on HID 956 + help 957 + Support for PhoenixRC HID Flight Controller, a 8-axis flight controller. 958 + 959 + To compile this driver as a module, choose M here: the 960 + module will be called hid-pxrc. 961 + 912 962 config HID_RAZER 913 963 tristate "Razer non-fully HID-compliant devices" 914 - depends on HID 915 964 help 916 965 Support for Razer devices that are not fully compliant with the 917 966 HID standard. 918 967 919 968 config HID_PRIMAX 920 969 tristate "Primax non-fully HID-compliant devices" 921 - depends on HID 922 970 help 923 971 Support for Primax devices that are not fully compliant with the 924 972 HID standard. ··· 947 981 948 982 config HID_SAITEK 949 983 tristate "Saitek (Mad Catz) non-fully HID-compliant devices" 950 - depends on HID 951 984 help 952 985 Support for Saitek devices that are not fully compliant with the 953 986 HID standard. ··· 964 999 965 1000 config HID_SEMITEK 966 1001 tristate "Semitek USB keyboards" 967 - depends on HID 968 1002 help 969 1003 Support for Semitek USB keyboards that are not fully compliant 970 1004 with the HID standard. ··· 1014 1050 1015 1051 config HID_SPEEDLINK 1016 1052 tristate "Speedlink VAD Cezanne mouse support" 1017 - depends on HID 1018 1053 help 1019 1054 Support for Speedlink Vicious and Divine Cezanne mouse. 1020 1055 1021 1056 config HID_STEAM 1022 1057 tristate "Steam Controller support" 1023 - depends on HID 1024 1058 select POWER_SUPPLY 1025 1059 help 1026 1060 Say Y here if you have a Steam Controller if you want to use it ··· 1027 1065 1028 1066 config HID_STEELSERIES 1029 1067 tristate "Steelseries SRW-S1 steering wheel support" 1030 - depends on HID 1031 1068 help 1032 1069 Support for Steelseries SRW-S1 steering wheel 1033 1070 1034 1071 config HID_SUNPLUS 1035 1072 tristate "Sunplus wireless desktop" 1036 - depends on HID 1037 1073 help 1038 1074 Support for Sunplus wireless desktop. 1039 1075 1040 1076 config HID_RMI 1041 1077 tristate "Synaptics RMI4 device support" 1042 - depends on HID 1043 1078 select RMI4_CORE 1044 1079 select RMI4_F03 1045 1080 select RMI4_F11 ··· 1049 1090 1050 1091 config HID_GREENASIA 1051 1092 tristate "GreenAsia (Product ID 0x12) game controller support" 1052 - depends on HID 1053 1093 help 1054 1094 Say Y here if you have a GreenAsia (Product ID 0x12) based game 1055 1095 controller or adapter. ··· 1070 1112 1071 1113 config HID_SMARTJOYPLUS 1072 1114 tristate "SmartJoy PLUS PS2/USB adapter support" 1073 - depends on HID 1074 1115 help 1075 1116 Support for SmartJoy PLUS PS2/USB adapter, Super Dual Box, 1076 1117 Super Joy Box 3 Pro, Super Dual Box Pro, and Super Joy Box 5 Pro. ··· 1087 1130 1088 1131 config HID_TIVO 1089 1132 tristate "TiVo Slide Bluetooth remote control support" 1090 - depends on HID 1091 1133 help 1092 1134 Say Y if you have a TiVo Slide Bluetooth remote control. 1093 1135 1094 1136 config HID_TOPSEED 1095 1137 tristate "TopSeed Cyberlink, BTC Emprex, Conceptronic remote control support" 1096 - depends on HID 1097 1138 help 1098 1139 Say Y if you have a TopSeed Cyberlink or BTC Emprex or Conceptronic 1099 1140 CLLRCMCE remote control. 1100 1141 1142 + config HID_TOPRE 1143 + tristate "Topre REALFORCE keyboards" 1144 + depends on HID 1145 + help 1146 + Say Y for N-key rollover support on Topre REALFORCE R2 108 key keyboards. 1147 + 1101 1148 config HID_THINGM 1102 1149 tristate "ThingM blink(1) USB RGB LED" 1103 - depends on HID 1104 1150 depends on LEDS_CLASS 1105 1151 select HID_LED 1106 1152 help ··· 1130 1170 1131 1171 config HID_UDRAW_PS3 1132 1172 tristate "THQ PS3 uDraw tablet" 1133 - depends on HID 1134 1173 help 1135 1174 Say Y here if you want to use the THQ uDraw gaming tablet for 1136 1175 the PS3. ··· 1166 1207 1167 1208 config HID_WIIMOTE 1168 1209 tristate "Nintendo Wii / Wii U peripherals" 1169 - depends on HID 1170 1210 depends on LEDS_CLASS 1171 1211 select POWER_SUPPLY 1172 1212 select INPUT_FF_MEMLESS ··· 1190 1232 1191 1233 config HID_XINMO 1192 1234 tristate "Xin-Mo non-fully compliant devices" 1193 - depends on HID 1194 1235 help 1195 1236 Support for Xin-Mo devices that are not fully compliant with the HID 1196 1237 standard. Currently only supports the Xin-Mo Dual Arcade. Say Y here ··· 1197 1240 1198 1241 config HID_ZEROPLUS 1199 1242 tristate "Zeroplus based game controller support" 1200 - depends on HID 1201 1243 help 1202 1244 Say Y here if you have a Zeroplus based game controller. 1203 1245 ··· 1210 1254 1211 1255 config HID_ZYDACRON 1212 1256 tristate "Zydacron remote control support" 1213 - depends on HID 1214 1257 help 1215 1258 Support for Zydacron remote control. 1216 1259 1217 1260 config HID_SENSOR_HUB 1218 1261 tristate "HID Sensors framework support" 1219 - depends on HID && HAS_IOMEM 1262 + depends on HAS_IOMEM 1220 1263 select MFD_CORE 1221 1264 default n 1222 1265 help ··· 1244 1289 1245 1290 config HID_ALPS 1246 1291 tristate "Alps HID device support" 1247 - depends on HID 1248 1292 help 1249 1293 Support for Alps I2C HID touchpads and StickPointer. 1250 1294 Say Y here if you have a Alps touchpads over i2c-hid or usbhid ··· 1261 1307 will be called hid-mcp2221.ko. 1262 1308 1263 1309 config HID_KUNIT_TEST 1264 - bool "KUnit tests for HID" if !KUNIT_ALL_TESTS 1310 + tristate "KUnit tests for HID" if !KUNIT_ALL_TESTS 1265 1311 depends on KUNIT=y 1266 1312 depends on HID_UCLOGIC 1267 1313 default KUNIT_ALL_TESTS
+6 -1
drivers/hid/Makefile
··· 101 101 obj-$(CONFIG_HID_PLANTRONICS) += hid-plantronics.o 102 102 obj-$(CONFIG_HID_PLAYSTATION) += hid-playstation.o 103 103 obj-$(CONFIG_HID_PRIMAX) += hid-primax.o 104 + obj-$(CONFIG_HID_PXRC) += hid-pxrc.o 104 105 obj-$(CONFIG_HID_RAZER) += hid-razer.o 105 106 obj-$(CONFIG_HID_REDRAGON) += hid-redragon.o 106 107 obj-$(CONFIG_HID_RETRODE) += hid-retrode.o ··· 124 123 obj-$(CONFIG_HID_THRUSTMASTER) += hid-tmff.o hid-thrustmaster.o 125 124 obj-$(CONFIG_HID_TIVO) += hid-tivo.o 126 125 obj-$(CONFIG_HID_TOPSEED) += hid-topseed.o 126 + obj-$(CONFIG_HID_TOPRE) += hid-topre.o 127 127 obj-$(CONFIG_HID_TWINHAN) += hid-twinhan.o 128 128 obj-$(CONFIG_HID_U2FZERO) += hid-u2fzero.o 129 129 hid-uclogic-objs := hid-uclogic-core.o \ ··· 138 136 obj-$(CONFIG_HID_ZEROPLUS) += hid-zpff.o 139 137 obj-$(CONFIG_HID_ZYDACRON) += hid-zydacron.o 140 138 obj-$(CONFIG_HID_VIEWSONIC) += hid-viewsonic.o 139 + obj-$(CONFIG_HID_VRC2) += hid-vrc2.o 141 140 142 141 wacom-objs := wacom_wac.o wacom_sys.o 143 142 obj-$(CONFIG_HID_WACOM) += wacom.o ··· 147 144 obj-$(CONFIG_HID_SENSOR_HUB) += hid-sensor-hub.o 148 145 obj-$(CONFIG_HID_SENSOR_CUSTOM_SENSOR) += hid-sensor-custom.o 149 146 150 - obj-$(CONFIG_HID_KUNIT_TEST) += hid-uclogic-rdesc.o \ 147 + hid-uclogic-test-objs := hid-uclogic-rdesc.o \ 148 + hid-uclogic-params.o \ 151 149 hid-uclogic-rdesc-test.o 150 + obj-$(CONFIG_HID_KUNIT_TEST) += hid-uclogic-test.o 152 151 153 152 obj-$(CONFIG_USB_HID) += usbhid/ 154 153 obj-$(CONFIG_USB_MOUSE) += usbhid/
+5 -3
drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.c
··· 110 110 amd_sfh1_1_set_desc_ops(mp2_ops); 111 111 112 112 cl_data->num_hid_devices = amd_sfh_get_sensor_num(privdata, &cl_data->sensor_idx[0]); 113 + if (cl_data->num_hid_devices == 0) 114 + return -ENODEV; 113 115 114 116 INIT_DELAYED_WORK(&cl_data->work, amd_sfh_work); 115 117 INIT_DELAYED_WORK(&cl_data->work_buffer, amd_sfh_work_buffer); ··· 288 286 289 287 phy_base <<= 21; 290 288 if (!devm_request_mem_region(dev, phy_base, 128 * 1024, "amd_sfh")) { 291 - dev_err(dev, "can't reserve mmio registers\n"); 289 + dev_dbg(dev, "can't reserve mmio registers\n"); 292 290 return -ENOMEM; 293 291 } 294 292 295 293 mp2->vsbase = devm_ioremap(dev, phy_base, 128 * 1024); 296 294 if (!mp2->vsbase) { 297 - dev_err(dev, "failed to remap vsbase\n"); 295 + dev_dbg(dev, "failed to remap vsbase\n"); 298 296 return -ENOMEM; 299 297 } 300 298 ··· 303 301 304 302 memcpy_fromio(&binfo, mp2->vsbase, sizeof(struct sfh_base_info)); 305 303 if (binfo.sbase.fw_info.fw_ver == 0 || binfo.sbase.s_list.sl.sensors == 0) { 306 - dev_err(dev, "failed to get sensors\n"); 304 + dev_dbg(dev, "failed to get sensors\n"); 307 305 return -EOPNOTSUPP; 308 306 } 309 307 dev_dbg(dev, "firmware version 0x%x\n", binfo.sbase.fw_info.fw_ver);
+13 -9
drivers/hid/hid-core.c
··· 55 55 */ 56 56 57 57 struct hid_report *hid_register_report(struct hid_device *device, 58 - unsigned int type, unsigned int id, 58 + enum hid_report_type type, unsigned int id, 59 59 unsigned int application) 60 60 { 61 61 struct hid_report_enum *report_enum = device->report_enum + type; ··· 967 967 * parsing. 968 968 */ 969 969 struct hid_report *hid_validate_values(struct hid_device *hid, 970 - unsigned int type, unsigned int id, 970 + enum hid_report_type type, unsigned int id, 971 971 unsigned int field_index, 972 972 unsigned int report_counts) 973 973 { ··· 1921 1921 * DO NOT USE in hid drivers directly, but through hid_hw_request instead. 1922 1922 */ 1923 1923 int __hid_request(struct hid_device *hid, struct hid_report *report, 1924 - int reqtype) 1924 + enum hid_class_request reqtype) 1925 1925 { 1926 1926 char *buf; 1927 1927 int ret; ··· 1954 1954 } 1955 1955 EXPORT_SYMBOL_GPL(__hid_request); 1956 1956 1957 - int hid_report_raw_event(struct hid_device *hid, int type, u8 *data, u32 size, 1958 - int interrupt) 1957 + int hid_report_raw_event(struct hid_device *hid, enum hid_report_type type, u8 *data, u32 size, 1958 + int interrupt) 1959 1959 { 1960 1960 struct hid_report_enum *report_enum = hid->report_enum + type; 1961 1961 struct hid_report *report; ··· 2019 2019 * 2020 2020 * This is data entry for lower layers. 2021 2021 */ 2022 - int hid_input_report(struct hid_device *hid, int type, u8 *data, u32 size, int interrupt) 2022 + int hid_input_report(struct hid_device *hid, enum hid_report_type type, u8 *data, u32 size, 2023 + int interrupt) 2023 2024 { 2024 2025 struct hid_report_enum *report_enum; 2025 2026 struct hid_driver *hdrv; ··· 2089 2088 2090 2089 return NULL; 2091 2090 } 2091 + EXPORT_SYMBOL_GPL(hid_match_id); 2092 2092 2093 2093 static const struct hid_device_id hid_hiddev_list[] = { 2094 2094 { HID_USB_DEVICE(USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS) }, ··· 2354 2352 * @reqtype: hid request type 2355 2353 */ 2356 2354 void hid_hw_request(struct hid_device *hdev, 2357 - struct hid_report *report, int reqtype) 2355 + struct hid_report *report, enum hid_class_request reqtype) 2358 2356 { 2359 2357 if (hdev->ll_driver->request) 2360 2358 return hdev->ll_driver->request(hdev, report, reqtype); ··· 2379 2377 */ 2380 2378 int hid_hw_raw_request(struct hid_device *hdev, 2381 2379 unsigned char reportnum, __u8 *buf, 2382 - size_t len, unsigned char rtype, int reqtype) 2380 + size_t len, enum hid_report_type rtype, enum hid_class_request reqtype) 2383 2381 { 2384 2382 if (len < 1 || len > HID_MAX_BUFFER_SIZE || !buf) 2385 2383 return -EINVAL; ··· 2741 2739 hid_warn(hdev, "bad device descriptor (%d)\n", ret); 2742 2740 } 2743 2741 2742 + hdev->id = atomic_inc_return(&id); 2743 + 2744 2744 /* XXX hack, any other cleaner solution after the driver core 2745 2745 * is converted to allow more than 20 bytes as the device name? */ 2746 2746 dev_set_name(&hdev->dev, "%04X:%04X:%04X.%04X", hdev->bus, 2747 - hdev->vendor, hdev->product, atomic_inc_return(&id)); 2747 + hdev->vendor, hdev->product, hdev->id); 2748 2748 2749 2749 hid_debug_register(hdev, dev_name(&hdev->dev)); 2750 2750 ret = device_add(&hdev->dev);
+3 -1
drivers/hid/hid-google-hammer.c
··· 608 608 .probe = hammer_probe, 609 609 .remove = hammer_remove, 610 610 .feature_mapping = vivaldi_feature_mapping, 611 - .input_configured = vivaldi_input_configured, 612 611 .input_mapping = hammer_input_mapping, 613 612 .event = hammer_event, 613 + .driver = { 614 + .dev_groups = vivaldi_attribute_groups, 615 + }, 614 616 }; 615 617 616 618 static int __init hammer_init(void)
+6
drivers/hid/hid-ids.h
··· 1231 1231 #define USB_DEVICE_ID_TIVO_SLIDE 0x1201 1232 1232 #define USB_DEVICE_ID_TIVO_SLIDE_PRO 0x1203 1233 1233 1234 + #define USB_VENDOR_ID_TOPRE 0x0853 1235 + #define USB_DEVICE_ID_TOPRE_REALFORCE_R2_108 0x0148 1236 + 1234 1237 #define USB_VENDOR_ID_TOPSEED 0x0766 1235 1238 #define USB_DEVICE_ID_TOPSEED_CYBERLINK 0x0204 1236 1239 ··· 1282 1279 #define USB_DEVICE_ID_YIYNOVA_TABLET 0x004d 1283 1280 1284 1281 #define USB_VENDOR_ID_UGEE 0x28bd 1282 + #define USB_DEVICE_ID_UGEE_PARBLO_A610_PRO 0x1903 1285 1283 #define USB_DEVICE_ID_UGEE_XPPEN_TABLET_G540 0x0075 1286 1284 #define USB_DEVICE_ID_UGEE_XPPEN_TABLET_G640 0x0094 1287 1285 #define USB_DEVICE_ID_UGEE_XPPEN_TABLET_DECO01 0x0042 1288 1286 #define USB_DEVICE_ID_UGEE_XPPEN_TABLET_DECO_L 0x0935 1287 + #define USB_DEVICE_ID_UGEE_XPPEN_TABLET_DECO_PRO_S 0x0909 1289 1288 #define USB_DEVICE_ID_UGEE_XPPEN_TABLET_STAR06 0x0078 1290 1289 #define USB_DEVICE_ID_UGEE_TABLET_G5 0x0074 1291 1290 #define USB_DEVICE_ID_UGEE_TABLET_EX07S 0x0071 ··· 1391 1386 1392 1387 #define USB_VENDOR_ID_MULTIPLE_1781 0x1781 1393 1388 #define USB_DEVICE_ID_RAPHNET_4NES4SNES_OLD 0x0a9d 1389 + #define USB_DEVICE_ID_PHOENIXRC 0x0898 1394 1390 1395 1391 #define USB_VENDOR_ID_DRACAL_RAPHNET 0x289b 1396 1392 #define USB_DEVICE_ID_RAPHNET_2NES2SNES 0x0002
+94 -70
drivers/hid/hid-logitech-hidpp.c
··· 41 41 MODULE_PARM_DESC(disable_tap_to_click, 42 42 "Disable Tap-To-Click mode reporting for touchpads (only on the K400 currently)."); 43 43 44 + /* Define a non-zero software ID to identify our own requests */ 45 + #define LINUX_KERNEL_SW_ID 0x01 46 + 44 47 #define REPORT_ID_HIDPP_SHORT 0x10 45 48 #define REPORT_ID_HIDPP_LONG 0x11 46 49 #define REPORT_ID_HIDPP_VERY_LONG 0x12 ··· 74 71 #define HIDPP_QUIRK_NO_HIDINPUT BIT(23) 75 72 #define HIDPP_QUIRK_FORCE_OUTPUT_REPORTS BIT(24) 76 73 #define HIDPP_QUIRK_UNIFYING BIT(25) 77 - #define HIDPP_QUIRK_HI_RES_SCROLL_1P0 BIT(26) 78 - #define HIDPP_QUIRK_HI_RES_SCROLL_X2120 BIT(27) 79 - #define HIDPP_QUIRK_HI_RES_SCROLL_X2121 BIT(28) 80 - #define HIDPP_QUIRK_HIDPP_WHEELS BIT(29) 81 - #define HIDPP_QUIRK_HIDPP_EXTRA_MOUSE_BTNS BIT(30) 82 - #define HIDPP_QUIRK_HIDPP_CONSUMER_VENDOR_KEYS BIT(31) 74 + #define HIDPP_QUIRK_HIDPP_WHEELS BIT(26) 75 + #define HIDPP_QUIRK_HIDPP_EXTRA_MOUSE_BTNS BIT(27) 76 + #define HIDPP_QUIRK_HIDPP_CONSUMER_VENDOR_KEYS BIT(28) 83 77 84 78 /* These are just aliases for now */ 85 79 #define HIDPP_QUIRK_KBD_SCROLL_WHEEL HIDPP_QUIRK_HIDPP_WHEELS 86 80 #define HIDPP_QUIRK_KBD_ZOOM_WHEEL HIDPP_QUIRK_HIDPP_WHEELS 87 81 88 82 /* Convenience constant to check for any high-res support. */ 89 - #define HIDPP_QUIRK_HI_RES_SCROLL (HIDPP_QUIRK_HI_RES_SCROLL_1P0 | \ 90 - HIDPP_QUIRK_HI_RES_SCROLL_X2120 | \ 91 - HIDPP_QUIRK_HI_RES_SCROLL_X2121) 83 + #define HIDPP_CAPABILITY_HI_RES_SCROLL (HIDPP_CAPABILITY_HIDPP10_FAST_SCROLL | \ 84 + HIDPP_CAPABILITY_HIDPP20_HI_RES_SCROLL | \ 85 + HIDPP_CAPABILITY_HIDPP20_HI_RES_WHEEL) 92 86 93 87 #define HIDPP_QUIRK_DELAYED_INIT HIDPP_QUIRK_NO_HIDINPUT 94 88 ··· 96 96 #define HIDPP_CAPABILITY_BATTERY_VOLTAGE BIT(4) 97 97 #define HIDPP_CAPABILITY_BATTERY_PERCENTAGE BIT(5) 98 98 #define HIDPP_CAPABILITY_UNIFIED_BATTERY BIT(6) 99 + #define HIDPP_CAPABILITY_HIDPP20_HI_RES_WHEEL BIT(7) 100 + #define HIDPP_CAPABILITY_HIDPP20_HI_RES_SCROLL BIT(8) 101 + #define HIDPP_CAPABILITY_HIDPP10_FAST_SCROLL BIT(9) 99 102 100 103 #define lg_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, max, EV_KEY, (c)) 101 104 ··· 346 343 else 347 344 message->report_id = REPORT_ID_HIDPP_LONG; 348 345 message->fap.feature_index = feat_index; 349 - message->fap.funcindex_clientid = funcindex_clientid; 346 + message->fap.funcindex_clientid = funcindex_clientid | LINUX_KERNEL_SW_ID; 350 347 memcpy(&message->fap.params, params, param_count); 351 348 352 349 ret = hidpp_send_message_sync(hidpp, message, response); ··· 859 856 #define HIDPP_PAGE_ROOT 0x0000 860 857 #define HIDPP_PAGE_ROOT_IDX 0x00 861 858 862 - #define CMD_ROOT_GET_FEATURE 0x01 863 - #define CMD_ROOT_GET_PROTOCOL_VERSION 0x11 859 + #define CMD_ROOT_GET_FEATURE 0x00 860 + #define CMD_ROOT_GET_PROTOCOL_VERSION 0x10 864 861 865 862 static int hidpp_root_get_feature(struct hidpp_device *hidpp, u16 feature, 866 863 u8 *feature_index, u8 *feature_type) ··· 937 934 938 935 #define HIDPP_PAGE_GET_DEVICE_NAME_TYPE 0x0005 939 936 940 - #define CMD_GET_DEVICE_NAME_TYPE_GET_COUNT 0x01 941 - #define CMD_GET_DEVICE_NAME_TYPE_GET_DEVICE_NAME 0x11 942 - #define CMD_GET_DEVICE_NAME_TYPE_GET_TYPE 0x21 937 + #define CMD_GET_DEVICE_NAME_TYPE_GET_COUNT 0x00 938 + #define CMD_GET_DEVICE_NAME_TYPE_GET_DEVICE_NAME 0x10 939 + #define CMD_GET_DEVICE_NAME_TYPE_GET_TYPE 0x20 943 940 944 941 static int hidpp_devicenametype_get_count(struct hidpp_device *hidpp, 945 942 u8 feature_index, u8 *nameLength) ··· 1969 1966 1970 1967 #define HIDPP_PAGE_TOUCHPAD_RAW_XY 0x6100 1971 1968 1972 - #define CMD_TOUCHPAD_GET_RAW_INFO 0x01 1973 - #define CMD_TOUCHPAD_SET_RAW_REPORT_STATE 0x21 1969 + #define CMD_TOUCHPAD_GET_RAW_INFO 0x00 1970 + #define CMD_TOUCHPAD_SET_RAW_REPORT_STATE 0x20 1974 1971 1975 1972 #define EVENT_TOUCHPAD_RAW_XY 0x00 1976 1973 ··· 3418 3415 int ret; 3419 3416 u8 multiplier = 1; 3420 3417 3421 - if (hidpp->quirks & HIDPP_QUIRK_HI_RES_SCROLL_X2121) { 3418 + if (hidpp->capabilities & HIDPP_CAPABILITY_HIDPP20_HI_RES_WHEEL) { 3422 3419 ret = hidpp_hrw_set_wheel_mode(hidpp, false, true, false); 3423 3420 if (ret == 0) 3424 3421 ret = hidpp_hrw_get_wheel_capability(hidpp, &multiplier); 3425 - } else if (hidpp->quirks & HIDPP_QUIRK_HI_RES_SCROLL_X2120) { 3422 + } else if (hidpp->capabilities & HIDPP_CAPABILITY_HIDPP20_HI_RES_SCROLL) { 3426 3423 ret = hidpp_hrs_set_highres_scrolling_mode(hidpp, true, 3427 3424 &multiplier); 3428 - } else /* if (hidpp->quirks & HIDPP_QUIRK_HI_RES_SCROLL_1P0) */ { 3425 + } else /* if (hidpp->capabilities & HIDPP_CAPABILITY_HIDPP10_FAST_SCROLL) */ { 3429 3426 ret = hidpp10_enable_scrolling_acceleration(hidpp); 3430 3427 multiplier = 8; 3431 3428 } ··· 3437 3434 3438 3435 hidpp->vertical_wheel_counter.wheel_multiplier = multiplier; 3439 3436 hid_dbg(hidpp->hid_dev, "wheel multiplier = %d\n", multiplier); 3437 + return 0; 3438 + } 3439 + 3440 + static int hidpp_initialize_hires_scroll(struct hidpp_device *hidpp) 3441 + { 3442 + int ret; 3443 + unsigned long capabilities; 3444 + 3445 + capabilities = hidpp->capabilities; 3446 + 3447 + if (hidpp->protocol_major >= 2) { 3448 + u8 feature_index; 3449 + u8 feature_type; 3450 + 3451 + ret = hidpp_root_get_feature(hidpp, HIDPP_PAGE_HIRES_WHEEL, 3452 + &feature_index, &feature_type); 3453 + if (!ret) { 3454 + hidpp->capabilities |= HIDPP_CAPABILITY_HIDPP20_HI_RES_WHEEL; 3455 + hid_dbg(hidpp->hid_dev, "Detected HID++ 2.0 hi-res scroll wheel\n"); 3456 + return 0; 3457 + } 3458 + ret = hidpp_root_get_feature(hidpp, HIDPP_PAGE_HI_RESOLUTION_SCROLLING, 3459 + &feature_index, &feature_type); 3460 + if (!ret) { 3461 + hidpp->capabilities |= HIDPP_CAPABILITY_HIDPP20_HI_RES_SCROLL; 3462 + hid_dbg(hidpp->hid_dev, "Detected HID++ 2.0 hi-res scrolling\n"); 3463 + } 3464 + } else { 3465 + struct hidpp_report response; 3466 + 3467 + ret = hidpp_send_rap_command_sync(hidpp, 3468 + REPORT_ID_HIDPP_SHORT, 3469 + HIDPP_GET_REGISTER, 3470 + HIDPP_ENABLE_FAST_SCROLL, 3471 + NULL, 0, &response); 3472 + if (!ret) { 3473 + hidpp->capabilities |= HIDPP_CAPABILITY_HIDPP10_FAST_SCROLL; 3474 + hid_dbg(hidpp->hid_dev, "Detected HID++ 1.0 fast scroll\n"); 3475 + } 3476 + } 3477 + 3478 + if (hidpp->capabilities == capabilities) 3479 + hid_dbg(hidpp->hid_dev, "Did not detect HID++ hi-res scrolling hardware support\n"); 3440 3480 return 0; 3441 3481 } 3442 3482 ··· 3737 3691 * cases we must return early (falling back to default behaviour) to 3738 3692 * avoid a crash in hidpp_scroll_counter_handle_scroll. 3739 3693 */ 3740 - if (!(hidpp->quirks & HIDPP_QUIRK_HI_RES_SCROLL) || value == 0 3741 - || hidpp->input == NULL || counter->wheel_multiplier == 0) 3694 + if (!(hidpp->capabilities & HIDPP_CAPABILITY_HI_RES_SCROLL) 3695 + || value == 0 || hidpp->input == NULL 3696 + || counter->wheel_multiplier == 0) 3742 3697 return 0; 3743 3698 3744 3699 hidpp_scroll_counter_handle_scroll(hidpp->input, counter, value); ··· 3971 3924 } 3972 3925 3973 3926 hidpp_initialize_battery(hidpp); 3927 + hidpp_initialize_hires_scroll(hidpp); 3974 3928 3975 3929 /* forward current battery state */ 3976 3930 if (hidpp->capabilities & HIDPP_CAPABILITY_HIDPP10_BATTERY) { ··· 3991 3943 if (hidpp->battery.ps) 3992 3944 power_supply_changed(hidpp->battery.ps); 3993 3945 3994 - if (hidpp->quirks & HIDPP_QUIRK_HI_RES_SCROLL) 3946 + if (hidpp->capabilities & HIDPP_CAPABILITY_HI_RES_SCROLL) 3995 3947 hi_res_scroll_enable(hidpp); 3996 3948 3997 3949 if (!(hidpp->quirks & HIDPP_QUIRK_NO_HIDINPUT) || hidpp->delayed_input) ··· 4007 3959 hidpp_populate_input(hidpp, input); 4008 3960 4009 3961 ret = input_register_device(input); 4010 - if (ret) 3962 + if (ret) { 4011 3963 input_free_device(input); 3964 + return; 3965 + } 4012 3966 4013 3967 hidpp->delayed_input = input; 4014 3968 } ··· 4269 4219 mutex_destroy(&hidpp->send_mutex); 4270 4220 } 4271 4221 4222 + static const struct hid_device_id unhandled_hidpp_devices[] = { 4223 + /* Logitech Harmony Adapter for PS3, handled in hid-sony */ 4224 + { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_PS3) }, 4225 + /* Handled in hid-generic */ 4226 + { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_DINOVO_EDGE_KBD) }, 4227 + {} 4228 + }; 4229 + 4230 + static bool hidpp_match(struct hid_device *hdev, 4231 + bool ignore_special_driver) 4232 + { 4233 + /* Refuse to handle devices handled by other HID drivers */ 4234 + return !hid_match_id(hdev, unhandled_hidpp_devices); 4235 + } 4236 + 4272 4237 #define LDJ_DEVICE(product) \ 4273 4238 HID_DEVICE(BUS_USB, HID_GROUP_LOGITECH_DJ_DEVICE, \ 4274 4239 USB_VENDOR_ID_LOGITECH, (product)) ··· 4304 4239 HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 4305 4240 USB_DEVICE_ID_LOGITECH_T651), 4306 4241 .driver_data = HIDPP_QUIRK_CLASS_WTP }, 4307 - { /* Mouse Logitech Anywhere MX */ 4308 - LDJ_DEVICE(0x1017), .driver_data = HIDPP_QUIRK_HI_RES_SCROLL_1P0 }, 4309 - { /* Mouse Logitech Cube */ 4310 - LDJ_DEVICE(0x4010), .driver_data = HIDPP_QUIRK_HI_RES_SCROLL_X2120 }, 4311 - { /* Mouse Logitech M335 */ 4312 - LDJ_DEVICE(0x4050), .driver_data = HIDPP_QUIRK_HI_RES_SCROLL_X2121 }, 4313 - { /* Mouse Logitech M515 */ 4314 - LDJ_DEVICE(0x4007), .driver_data = HIDPP_QUIRK_HI_RES_SCROLL_X2120 }, 4315 4242 { /* Mouse logitech M560 */ 4316 4243 LDJ_DEVICE(0x402d), 4317 - .driver_data = HIDPP_QUIRK_DELAYED_INIT | HIDPP_QUIRK_CLASS_M560 4318 - | HIDPP_QUIRK_HI_RES_SCROLL_X2120 }, 4319 - { /* Mouse Logitech M705 (firmware RQM17) */ 4320 - LDJ_DEVICE(0x101b), .driver_data = HIDPP_QUIRK_HI_RES_SCROLL_1P0 }, 4321 - { /* Mouse Logitech M705 (firmware RQM67) */ 4322 - LDJ_DEVICE(0x406d), .driver_data = HIDPP_QUIRK_HI_RES_SCROLL_X2121 }, 4323 - { /* Mouse Logitech M720 */ 4324 - LDJ_DEVICE(0x405e), .driver_data = HIDPP_QUIRK_HI_RES_SCROLL_X2121 }, 4325 - { /* Mouse Logitech MX Anywhere 2 */ 4326 - LDJ_DEVICE(0x404a), .driver_data = HIDPP_QUIRK_HI_RES_SCROLL_X2121 }, 4327 - { LDJ_DEVICE(0x4072), .driver_data = HIDPP_QUIRK_HI_RES_SCROLL_X2121 }, 4328 - { LDJ_DEVICE(0xb013), .driver_data = HIDPP_QUIRK_HI_RES_SCROLL_X2121 }, 4329 - { LDJ_DEVICE(0xb018), .driver_data = HIDPP_QUIRK_HI_RES_SCROLL_X2121 }, 4330 - { LDJ_DEVICE(0xb01f), .driver_data = HIDPP_QUIRK_HI_RES_SCROLL_X2121 }, 4331 - { /* Mouse Logitech MX Anywhere 2S */ 4332 - LDJ_DEVICE(0x406a), .driver_data = HIDPP_QUIRK_HI_RES_SCROLL_X2121 }, 4333 - { /* Mouse Logitech MX Master */ 4334 - LDJ_DEVICE(0x4041), .driver_data = HIDPP_QUIRK_HI_RES_SCROLL_X2121 }, 4335 - { LDJ_DEVICE(0x4060), .driver_data = HIDPP_QUIRK_HI_RES_SCROLL_X2121 }, 4336 - { LDJ_DEVICE(0x4071), .driver_data = HIDPP_QUIRK_HI_RES_SCROLL_X2121 }, 4337 - { /* Mouse Logitech MX Master 2S */ 4338 - LDJ_DEVICE(0x4069), .driver_data = HIDPP_QUIRK_HI_RES_SCROLL_X2121 }, 4339 - { /* Mouse Logitech MX Master 3 */ 4340 - LDJ_DEVICE(0x4082), .driver_data = HIDPP_QUIRK_HI_RES_SCROLL_X2121 }, 4341 - { /* Mouse Logitech Performance MX */ 4342 - LDJ_DEVICE(0x101a), .driver_data = HIDPP_QUIRK_HI_RES_SCROLL_1P0 }, 4244 + .driver_data = HIDPP_QUIRK_DELAYED_INIT | HIDPP_QUIRK_CLASS_M560 }, 4343 4245 { /* Keyboard logitech K400 */ 4344 4246 LDJ_DEVICE(0x4024), 4345 4247 .driver_data = HIDPP_QUIRK_CLASS_K400 }, ··· 4367 4335 { /* MX5500 keyboard over Bluetooth */ 4368 4336 HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb30b), 4369 4337 .driver_data = HIDPP_QUIRK_HIDPP_CONSUMER_VENDOR_KEYS }, 4370 - { /* M-RCQ142 V470 Cordless Laser Mouse over Bluetooth */ 4371 - HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb008) }, 4372 - { /* MX Master mouse over Bluetooth */ 4373 - HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb012), 4374 - .driver_data = HIDPP_QUIRK_HI_RES_SCROLL_X2121 }, 4375 - { /* MX Ergo trackball over Bluetooth */ 4376 - HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb01d) }, 4377 - { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb01e), 4378 - .driver_data = HIDPP_QUIRK_HI_RES_SCROLL_X2121 }, 4379 - { /* MX Master 3 mouse over Bluetooth */ 4380 - HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb023), 4381 - .driver_data = HIDPP_QUIRK_HI_RES_SCROLL_X2121 }, 4338 + 4339 + { /* And try to enable HID++ for all the Logitech Bluetooth devices */ 4340 + HID_DEVICE(BUS_BLUETOOTH, HID_GROUP_ANY, USB_VENDOR_ID_LOGITECH, HID_ANY_ID) }, 4382 4341 {} 4383 4342 }; 4384 4343 ··· 4383 4360 static struct hid_driver hidpp_driver = { 4384 4361 .name = "logitech-hidpp-device", 4385 4362 .id_table = hidpp_devices, 4363 + .match = hidpp_match, 4386 4364 .report_fixup = hidpp_report_fixup, 4387 4365 .probe = hidpp_probe, 4388 4366 .remove = hidpp_remove,
+4 -4
drivers/hid/hid-multitouch.c
··· 1186 1186 int contact_count = -1; 1187 1187 1188 1188 /* sticky fingers release in progress, abort */ 1189 - if (test_and_set_bit(MT_IO_FLAGS_RUNNING, &td->mt_io_flags)) 1189 + if (test_and_set_bit_lock(MT_IO_FLAGS_RUNNING, &td->mt_io_flags)) 1190 1190 return; 1191 1191 1192 1192 scantime = *app->scantime; ··· 1267 1267 del_timer(&td->release_timer); 1268 1268 } 1269 1269 1270 - clear_bit(MT_IO_FLAGS_RUNNING, &td->mt_io_flags); 1270 + clear_bit_unlock(MT_IO_FLAGS_RUNNING, &td->mt_io_flags); 1271 1271 } 1272 1272 1273 1273 static int mt_touch_input_configured(struct hid_device *hdev, ··· 1699 1699 * An input report came in just before we release the sticky fingers, 1700 1700 * it will take care of the sticky fingers. 1701 1701 */ 1702 - if (test_and_set_bit(MT_IO_FLAGS_RUNNING, &td->mt_io_flags)) 1702 + if (test_and_set_bit_lock(MT_IO_FLAGS_RUNNING, &td->mt_io_flags)) 1703 1703 return; 1704 1704 if (test_bit(MT_IO_FLAGS_PENDING_SLOTS, &td->mt_io_flags)) 1705 1705 mt_release_contacts(hdev); 1706 - clear_bit(MT_IO_FLAGS_RUNNING, &td->mt_io_flags); 1706 + clear_bit_unlock(MT_IO_FLAGS_RUNNING, &td->mt_io_flags); 1707 1707 } 1708 1708 1709 1709 static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id)
+32 -28
drivers/hid/hid-nintendo.c
··· 760 760 cal_y->max = cal_y->center + y_max_above; 761 761 cal_y->min = cal_y->center - y_min_below; 762 762 763 - return 0; 763 + /* check if calibration values are plausible */ 764 + if (cal_x->min >= cal_x->center || cal_x->center >= cal_x->max || 765 + cal_y->min >= cal_y->center || cal_y->center >= cal_y->max) 766 + ret = -EINVAL; 767 + 768 + return ret; 764 769 } 765 770 766 771 static const u16 DFLT_STICK_CAL_CEN = 2000; 767 772 static const u16 DFLT_STICK_CAL_MAX = 3500; 768 773 static const u16 DFLT_STICK_CAL_MIN = 500; 774 + static void joycon_use_default_calibration(struct hid_device *hdev, 775 + struct joycon_stick_cal *cal_x, 776 + struct joycon_stick_cal *cal_y, 777 + const char *stick, int ret) 778 + { 779 + hid_warn(hdev, 780 + "Failed to read %s stick cal, using defaults; e=%d\n", 781 + stick, ret); 782 + 783 + cal_x->center = cal_y->center = DFLT_STICK_CAL_CEN; 784 + cal_x->max = cal_y->max = DFLT_STICK_CAL_MAX; 785 + cal_x->min = cal_y->min = DFLT_STICK_CAL_MIN; 786 + } 787 + 769 788 static int joycon_request_calibration(struct joycon_ctlr *ctlr) 770 789 { 771 790 u16 left_stick_addr = JC_CAL_FCT_DATA_LEFT_ADDR; ··· 812 793 &ctlr->left_stick_cal_x, 813 794 &ctlr->left_stick_cal_y, 814 795 true); 815 - if (ret) { 816 - hid_warn(ctlr->hdev, 817 - "Failed to read left stick cal, using dflts; e=%d\n", 818 - ret); 819 796 820 - ctlr->left_stick_cal_x.center = DFLT_STICK_CAL_CEN; 821 - ctlr->left_stick_cal_x.max = DFLT_STICK_CAL_MAX; 822 - ctlr->left_stick_cal_x.min = DFLT_STICK_CAL_MIN; 823 - 824 - ctlr->left_stick_cal_y.center = DFLT_STICK_CAL_CEN; 825 - ctlr->left_stick_cal_y.max = DFLT_STICK_CAL_MAX; 826 - ctlr->left_stick_cal_y.min = DFLT_STICK_CAL_MIN; 827 - } 797 + if (ret) 798 + joycon_use_default_calibration(ctlr->hdev, 799 + &ctlr->left_stick_cal_x, 800 + &ctlr->left_stick_cal_y, 801 + "left", ret); 828 802 829 803 /* read the right stick calibration data */ 830 804 ret = joycon_read_stick_calibration(ctlr, right_stick_addr, 831 805 &ctlr->right_stick_cal_x, 832 806 &ctlr->right_stick_cal_y, 833 807 false); 834 - if (ret) { 835 - hid_warn(ctlr->hdev, 836 - "Failed to read right stick cal, using dflts; e=%d\n", 837 - ret); 838 808 839 - ctlr->right_stick_cal_x.center = DFLT_STICK_CAL_CEN; 840 - ctlr->right_stick_cal_x.max = DFLT_STICK_CAL_MAX; 841 - ctlr->right_stick_cal_x.min = DFLT_STICK_CAL_MIN; 842 - 843 - ctlr->right_stick_cal_y.center = DFLT_STICK_CAL_CEN; 844 - ctlr->right_stick_cal_y.max = DFLT_STICK_CAL_MAX; 845 - ctlr->right_stick_cal_y.min = DFLT_STICK_CAL_MIN; 846 - } 809 + if (ret) 810 + joycon_use_default_calibration(ctlr->hdev, 811 + &ctlr->right_stick_cal_x, 812 + &ctlr->right_stick_cal_y, 813 + "right", ret); 847 814 848 815 hid_dbg(ctlr->hdev, "calibration:\n" 849 816 "l_x_c=%d l_x_max=%d l_x_min=%d\n" ··· 1909 1904 /* Set the home LED to 0 as default state */ 1910 1905 ret = joycon_home_led_brightness_set(led, 0); 1911 1906 if (ret) { 1912 - hid_err(hdev, "Failed to set home LED dflt; ret=%d\n", 1913 - ret); 1914 - return ret; 1907 + hid_warn(hdev, "Failed to set home LED default, unregistering home LED"); 1908 + devm_led_classdev_unregister(&hdev->dev, led); 1915 1909 } 1916 1910 } 1917 1911
+5 -11
drivers/hid/hid-playstation.c
··· 692 692 693 693 static DEVICE_ATTR_RO(hardware_version); 694 694 695 - static struct attribute *ps_device_attributes[] = { 695 + static struct attribute *ps_device_attrs[] = { 696 696 &dev_attr_firmware_version.attr, 697 697 &dev_attr_hardware_version.attr, 698 698 NULL 699 699 }; 700 - 701 - static const struct attribute_group ps_device_attribute_group = { 702 - .attrs = ps_device_attributes, 703 - }; 700 + ATTRIBUTE_GROUPS(ps_device); 704 701 705 702 static int dualsense_get_calibration_data(struct dualsense *ds) 706 703 { ··· 1445 1448 } 1446 1449 } 1447 1450 1448 - ret = devm_device_add_group(&hdev->dev, &ps_device_attribute_group); 1449 - if (ret) { 1450 - hid_err(hdev, "Failed to register sysfs nodes.\n"); 1451 - goto err_close; 1452 - } 1453 - 1454 1451 return ret; 1455 1452 1456 1453 err_close: ··· 1478 1487 .probe = ps_probe, 1479 1488 .remove = ps_remove, 1480 1489 .raw_event = ps_raw_event, 1490 + .driver = { 1491 + .dev_groups = ps_device_groups, 1492 + }, 1481 1493 }; 1482 1494 1483 1495 static int __init ps_init(void)
+112
drivers/hid/hid-pxrc.c
··· 1 + // SPDX-License-Identifier: GPL-2.0-or-later 2 + /* 3 + * HID driver for PhoenixRC 8-axis flight controller 4 + * 5 + * Copyright (C) 2022 Marcus Folkesson <marcus.folkesson@gmail.com> 6 + */ 7 + 8 + #include <linux/device.h> 9 + #include <linux/hid.h> 10 + #include <linux/module.h> 11 + 12 + #include "hid-ids.h" 13 + 14 + struct pxrc_priv { 15 + u8 slider; 16 + u8 dial; 17 + bool alternate; 18 + }; 19 + 20 + static __u8 pxrc_rdesc_fixed[] = { 21 + 0x05, 0x01, // Usage Page (Generic Desktop Ctrls) 22 + 0x09, 0x04, // Usage (Joystick) 23 + 0xA1, 0x01, // Collection (Application) 24 + 0x09, 0x01, // Usage (Pointer) 25 + 0xA1, 0x00, // Collection (Physical) 26 + 0x09, 0x30, // Usage (X) 27 + 0x09, 0x36, // Usage (Slider) 28 + 0x09, 0x31, // Usage (Y) 29 + 0x09, 0x32, // Usage (Z) 30 + 0x09, 0x33, // Usage (Rx) 31 + 0x09, 0x34, // Usage (Ry) 32 + 0x09, 0x35, // Usage (Rz) 33 + 0x09, 0x37, // Usage (Dial) 34 + 0x15, 0x00, // Logical Minimum (0) 35 + 0x26, 0xFF, 0x00, // Logical Maximum (255) 36 + 0x35, 0x00, // Physical Minimum (0) 37 + 0x46, 0xFF, 0x00, // Physical Maximum (255) 38 + 0x75, 0x08, // Report Size (8) 39 + 0x95, 0x08, // Report Count (8) 40 + 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 41 + 0xC0, // End Collection 42 + 0xC0, // End Collection 43 + }; 44 + 45 + static __u8 *pxrc_report_fixup(struct hid_device *hdev, __u8 *rdesc, 46 + unsigned int *rsize) 47 + { 48 + hid_info(hdev, "fixing up PXRC report descriptor\n"); 49 + *rsize = sizeof(pxrc_rdesc_fixed); 50 + return pxrc_rdesc_fixed; 51 + } 52 + 53 + static int pxrc_raw_event(struct hid_device *hdev, struct hid_report *report, 54 + u8 *data, int size) 55 + { 56 + struct pxrc_priv *priv = hid_get_drvdata(hdev); 57 + 58 + if (priv->alternate) 59 + priv->slider = data[7]; 60 + else 61 + priv->dial = data[7]; 62 + 63 + data[1] = priv->slider; 64 + data[7] = priv->dial; 65 + 66 + priv->alternate = !priv->alternate; 67 + return 0; 68 + } 69 + 70 + static int pxrc_probe(struct hid_device *hdev, const struct hid_device_id *id) 71 + { 72 + int ret; 73 + struct pxrc_priv *priv; 74 + 75 + priv = devm_kzalloc(&hdev->dev, sizeof(*priv), GFP_KERNEL); 76 + if (!priv) 77 + return -ENOMEM; 78 + hid_set_drvdata(hdev, priv); 79 + 80 + ret = hid_parse(hdev); 81 + if (ret) { 82 + hid_err(hdev, "parse failed\n"); 83 + return ret; 84 + } 85 + 86 + ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); 87 + if (ret) { 88 + hid_err(hdev, "hw start failed\n"); 89 + return ret; 90 + } 91 + 92 + return 0; 93 + } 94 + 95 + static const struct hid_device_id pxrc_devices[] = { 96 + { HID_USB_DEVICE(USB_VENDOR_ID_MULTIPLE_1781, USB_DEVICE_ID_PHOENIXRC) }, 97 + { /* sentinel */ } 98 + }; 99 + MODULE_DEVICE_TABLE(hid, pxrc_devices); 100 + 101 + static struct hid_driver pxrc_driver = { 102 + .name = "hid-pxrc", 103 + .id_table = pxrc_devices, 104 + .report_fixup = pxrc_report_fixup, 105 + .probe = pxrc_probe, 106 + .raw_event = pxrc_raw_event, 107 + }; 108 + module_hid_driver(pxrc_driver); 109 + 110 + MODULE_AUTHOR("Marcus Folkesson <marcus.folkesson@gmail.com>"); 111 + MODULE_DESCRIPTION("HID driver for PXRC 8-axis flight controller"); 112 + MODULE_LICENSE("GPL");
+2 -4
drivers/hid/hid-rmi.c
··· 237 237 238 238 read_input_count = data->readReport[1]; 239 239 memcpy(buf + bytes_read, &data->readReport[2], 240 - read_input_count < bytes_needed ? 241 - read_input_count : bytes_needed); 240 + min(read_input_count, bytes_needed)); 242 241 243 242 bytes_read += read_input_count; 244 243 bytes_needed -= read_input_count; ··· 346 347 return 0; 347 348 } 348 349 349 - memcpy(hdata->readReport, data, size < hdata->input_report_size ? 350 - size : hdata->input_report_size); 350 + memcpy(hdata->readReport, data, min((u32)size, hdata->input_report_size)); 351 351 set_bit(RMI_READ_DATA_PENDING, &hdata->flags); 352 352 wake_up(&hdata->wait); 353 353
+4
drivers/hid/hid-roccat.c
··· 257 257 if (!new_value) 258 258 return -ENOMEM; 259 259 260 + mutex_lock(&device->cbuf_lock); 261 + 260 262 report = &device->cbuf[device->cbuf_end]; 261 263 262 264 /* passing NULL is safe */ ··· 277 275 if (reader->cbuf_start == device->cbuf_end) 278 276 reader->cbuf_start = (reader->cbuf_start + 1) % ROCCAT_CBUF_SIZE; 279 277 } 278 + 279 + mutex_unlock(&device->cbuf_lock); 280 280 281 281 wake_up_interruptible(&device->wait); 282 282 return 0;
+1 -1
drivers/hid/hid-sony.c
··· 368 368 }; 369 369 370 370 /* The Navigation controller is a partial DS3 and uses the same HID report 371 - * and hence the same keymap indices, however not not all axes/buttons 371 + * and hence the same keymap indices, however not all axes/buttons 372 372 * are physically present. We use the same axis and button mapping as 373 373 * the DS3, which uses the Linux gamepad spec. 374 374 */
+4 -4
drivers/hid/hid-steam.c
··· 256 256 if (reply[0] != 0xae || reply[1] != 0x15 || reply[2] != 0x01) 257 257 return -EIO; 258 258 reply[3 + STEAM_SERIAL_LEN] = 0; 259 - strlcpy(steam->serial_no, reply + 3, sizeof(steam->serial_no)); 259 + strscpy(steam->serial_no, reply + 3, sizeof(steam->serial_no)); 260 260 return 0; 261 261 } 262 262 ··· 524 524 */ 525 525 mutex_lock(&steam->mutex); 526 526 if (steam_get_serial(steam) < 0) 527 - strlcpy(steam->serial_no, "XXXXXXXXXX", 527 + strscpy(steam->serial_no, "XXXXXXXXXX", 528 528 sizeof(steam->serial_no)); 529 529 mutex_unlock(&steam->mutex); 530 530 ··· 699 699 client_hdev->version = hdev->version; 700 700 client_hdev->type = hdev->type; 701 701 client_hdev->country = hdev->country; 702 - strlcpy(client_hdev->name, hdev->name, 702 + strscpy(client_hdev->name, hdev->name, 703 703 sizeof(client_hdev->name)); 704 - strlcpy(client_hdev->phys, hdev->phys, 704 + strscpy(client_hdev->phys, hdev->phys, 705 705 sizeof(client_hdev->phys)); 706 706 /* 707 707 * Since we use the same device info than the real interface to
+49
drivers/hid/hid-topre.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 2 + /* 3 + * HID driver for Topre REALFORCE Keyboards 4 + * 5 + * Copyright (c) 2022 Harry Stern <harry@harrystern.net> 6 + * 7 + * Based on the hid-macally driver 8 + */ 9 + 10 + #include <linux/hid.h> 11 + #include <linux/module.h> 12 + 13 + #include "hid-ids.h" 14 + 15 + MODULE_AUTHOR("Harry Stern <harry@harrystern.net>"); 16 + MODULE_DESCRIPTION("REALFORCE R2 Keyboard driver"); 17 + MODULE_LICENSE("GPL"); 18 + 19 + /* 20 + * Fix the REALFORCE R2's non-boot interface's report descriptor to match the 21 + * events it's actually sending. It claims to send array events but is instead 22 + * sending variable events. 23 + */ 24 + static __u8 *topre_report_fixup(struct hid_device *hdev, __u8 *rdesc, 25 + unsigned int *rsize) 26 + { 27 + if (*rsize >= 119 && rdesc[69] == 0x29 && rdesc[70] == 0xe7 && 28 + rdesc[71] == 0x81 && rdesc[72] == 0x00) { 29 + hid_info(hdev, 30 + "fixing up Topre REALFORCE keyboard report descriptor\n"); 31 + rdesc[72] = 0x02; 32 + } 33 + return rdesc; 34 + } 35 + 36 + static const struct hid_device_id topre_id_table[] = { 37 + { HID_USB_DEVICE(USB_VENDOR_ID_TOPRE, 38 + USB_DEVICE_ID_TOPRE_REALFORCE_R2_108) }, 39 + { } 40 + }; 41 + MODULE_DEVICE_TABLE(hid, topre_id_table); 42 + 43 + static struct hid_driver topre_driver = { 44 + .name = "topre", 45 + .id_table = topre_id_table, 46 + .report_fixup = topre_report_fixup, 47 + }; 48 + 49 + module_hid_driver(topre_driver);
+5
drivers/hid/hid-uclogic-core.c
··· 153 153 suffix = "Pad"; 154 154 break; 155 155 case HID_DG_PEN: 156 + case HID_DG_DIGITIZER: 156 157 suffix = "Pen"; 157 158 break; 158 159 case HID_CP_CONSUMER_CONTROL: ··· 511 510 { HID_USB_DEVICE(USB_VENDOR_ID_UGTIZER, 512 511 USB_DEVICE_ID_UGTIZER_TABLET_GT5040) }, 513 512 { HID_USB_DEVICE(USB_VENDOR_ID_UGEE, 513 + USB_DEVICE_ID_UGEE_PARBLO_A610_PRO) }, 514 + { HID_USB_DEVICE(USB_VENDOR_ID_UGEE, 514 515 USB_DEVICE_ID_UGEE_TABLET_G5) }, 515 516 { HID_USB_DEVICE(USB_VENDOR_ID_UGEE, 516 517 USB_DEVICE_ID_UGEE_TABLET_EX07S) }, ··· 526 523 USB_DEVICE_ID_UGEE_XPPEN_TABLET_DECO01) }, 527 524 { HID_USB_DEVICE(USB_VENDOR_ID_UGEE, 528 525 USB_DEVICE_ID_UGEE_XPPEN_TABLET_DECO_L) }, 526 + { HID_USB_DEVICE(USB_VENDOR_ID_UGEE, 527 + USB_DEVICE_ID_UGEE_XPPEN_TABLET_DECO_PRO_S) }, 529 528 { HID_USB_DEVICE(USB_VENDOR_ID_UGEE, 530 529 USB_DEVICE_ID_UGEE_XPPEN_TABLET_STAR06) }, 531 530 { }
+192
drivers/hid/hid-uclogic-params-test.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 2 + 3 + /* 4 + * HID driver for UC-Logic devices not fully compliant with HID standard 5 + * 6 + * Copyright (c) 2022 José Expósito <jose.exposito89@gmail.com> 7 + */ 8 + 9 + #include <kunit/test.h> 10 + #include "./hid-uclogic-params.h" 11 + #include "./hid-uclogic-rdesc.h" 12 + 13 + #define MAX_STR_DESC_SIZE 14 14 + 15 + struct uclogic_parse_ugee_v2_desc_case { 16 + const char *name; 17 + int res; 18 + const __u8 str_desc[MAX_STR_DESC_SIZE]; 19 + size_t str_desc_size; 20 + const s32 desc_params[UCLOGIC_RDESC_PH_ID_NUM]; 21 + enum uclogic_params_frame_type frame_type; 22 + }; 23 + 24 + static struct uclogic_parse_ugee_v2_desc_case uclogic_parse_ugee_v2_desc_cases[] = { 25 + { 26 + .name = "invalid_str_desc", 27 + .res = -EINVAL, 28 + .str_desc = {}, 29 + .str_desc_size = 0, 30 + .desc_params = {}, 31 + .frame_type = UCLOGIC_PARAMS_FRAME_BUTTONS, 32 + }, 33 + { 34 + .name = "resolution_with_value_0", 35 + .res = 0, 36 + .str_desc = { 37 + 0x0E, 0x03, 38 + 0x70, 0xB2, 39 + 0x10, 0x77, 40 + 0x08, 41 + 0x00, 42 + 0xFF, 0x1F, 43 + 0x00, 0x00, 44 + }, 45 + .str_desc_size = 12, 46 + .desc_params = { 47 + [UCLOGIC_RDESC_PEN_PH_ID_X_LM] = 0xB270, 48 + [UCLOGIC_RDESC_PEN_PH_ID_X_PM] = 0, 49 + [UCLOGIC_RDESC_PEN_PH_ID_Y_LM] = 0x7710, 50 + [UCLOGIC_RDESC_PEN_PH_ID_Y_PM] = 0, 51 + [UCLOGIC_RDESC_PEN_PH_ID_PRESSURE_LM] = 0x1FFF, 52 + [UCLOGIC_RDESC_FRAME_PH_ID_UM] = 0x08, 53 + }, 54 + .frame_type = UCLOGIC_PARAMS_FRAME_BUTTONS, 55 + }, 56 + /* XP-PEN Deco L str_desc: Frame with 8 buttons */ 57 + { 58 + .name = "frame_type_buttons", 59 + .res = 0, 60 + .str_desc = { 61 + 0x0E, 0x03, 62 + 0x70, 0xB2, 63 + 0x10, 0x77, 64 + 0x08, 65 + 0x00, 66 + 0xFF, 0x1F, 67 + 0xD8, 0x13, 68 + }, 69 + .str_desc_size = 12, 70 + .desc_params = { 71 + [UCLOGIC_RDESC_PEN_PH_ID_X_LM] = 0xB270, 72 + [UCLOGIC_RDESC_PEN_PH_ID_X_PM] = 0x2320, 73 + [UCLOGIC_RDESC_PEN_PH_ID_Y_LM] = 0x7710, 74 + [UCLOGIC_RDESC_PEN_PH_ID_Y_PM] = 0x1770, 75 + [UCLOGIC_RDESC_PEN_PH_ID_PRESSURE_LM] = 0x1FFF, 76 + [UCLOGIC_RDESC_FRAME_PH_ID_UM] = 0x08, 77 + }, 78 + .frame_type = UCLOGIC_PARAMS_FRAME_BUTTONS, 79 + }, 80 + /* PARBLO A610 PRO str_desc: Frame with 9 buttons and dial */ 81 + { 82 + .name = "frame_type_dial", 83 + .res = 0, 84 + .str_desc = { 85 + 0x0E, 0x03, 86 + 0x96, 0xC7, 87 + 0xF9, 0x7C, 88 + 0x09, 89 + 0x01, 90 + 0xFF, 0x1F, 91 + 0xD8, 0x13, 92 + }, 93 + .str_desc_size = 12, 94 + .desc_params = { 95 + [UCLOGIC_RDESC_PEN_PH_ID_X_LM] = 0xC796, 96 + [UCLOGIC_RDESC_PEN_PH_ID_X_PM] = 0x2749, 97 + [UCLOGIC_RDESC_PEN_PH_ID_Y_LM] = 0x7CF9, 98 + [UCLOGIC_RDESC_PEN_PH_ID_Y_PM] = 0x1899, 99 + [UCLOGIC_RDESC_PEN_PH_ID_PRESSURE_LM] = 0x1FFF, 100 + [UCLOGIC_RDESC_FRAME_PH_ID_UM] = 0x09, 101 + }, 102 + .frame_type = UCLOGIC_PARAMS_FRAME_DIAL, 103 + }, 104 + /* XP-PEN Deco Pro S str_desc: Frame with 8 buttons and mouse */ 105 + { 106 + .name = "frame_type_mouse", 107 + .res = 0, 108 + .str_desc = { 109 + 0x0E, 0x03, 110 + 0xC8, 0xB3, 111 + 0x34, 0x65, 112 + 0x08, 113 + 0x02, 114 + 0xFF, 0x1F, 115 + 0xD8, 0x13, 116 + }, 117 + .str_desc_size = 12, 118 + .desc_params = { 119 + [UCLOGIC_RDESC_PEN_PH_ID_X_LM] = 0xB3C8, 120 + [UCLOGIC_RDESC_PEN_PH_ID_X_PM] = 0x2363, 121 + [UCLOGIC_RDESC_PEN_PH_ID_Y_LM] = 0x6534, 122 + [UCLOGIC_RDESC_PEN_PH_ID_Y_PM] = 0x13EC, 123 + [UCLOGIC_RDESC_PEN_PH_ID_PRESSURE_LM] = 0x1FFF, 124 + [UCLOGIC_RDESC_FRAME_PH_ID_UM] = 0x08, 125 + }, 126 + .frame_type = UCLOGIC_PARAMS_FRAME_MOUSE, 127 + }, 128 + }; 129 + 130 + static void uclogic_parse_ugee_v2_desc_case_desc(struct uclogic_parse_ugee_v2_desc_case *t, 131 + char *desc) 132 + { 133 + strscpy(desc, t->name, KUNIT_PARAM_DESC_SIZE); 134 + } 135 + 136 + KUNIT_ARRAY_PARAM(uclogic_parse_ugee_v2_desc, uclogic_parse_ugee_v2_desc_cases, 137 + uclogic_parse_ugee_v2_desc_case_desc); 138 + 139 + static void uclogic_parse_ugee_v2_desc_test(struct kunit *test) 140 + { 141 + int res; 142 + s32 desc_params[UCLOGIC_RDESC_PH_ID_NUM]; 143 + enum uclogic_params_frame_type frame_type; 144 + const struct uclogic_parse_ugee_v2_desc_case *params = test->param_value; 145 + 146 + res = uclogic_params_parse_ugee_v2_desc(params->str_desc, 147 + params->str_desc_size, 148 + desc_params, 149 + ARRAY_SIZE(desc_params), 150 + &frame_type); 151 + KUNIT_ASSERT_EQ(test, res, params->res); 152 + 153 + if (res) 154 + return; 155 + 156 + KUNIT_EXPECT_EQ(test, 157 + params->desc_params[UCLOGIC_RDESC_PEN_PH_ID_X_LM], 158 + desc_params[UCLOGIC_RDESC_PEN_PH_ID_X_LM]); 159 + KUNIT_EXPECT_EQ(test, 160 + params->desc_params[UCLOGIC_RDESC_PEN_PH_ID_X_PM], 161 + desc_params[UCLOGIC_RDESC_PEN_PH_ID_X_PM]); 162 + KUNIT_EXPECT_EQ(test, 163 + params->desc_params[UCLOGIC_RDESC_PEN_PH_ID_Y_LM], 164 + desc_params[UCLOGIC_RDESC_PEN_PH_ID_Y_LM]); 165 + KUNIT_EXPECT_EQ(test, 166 + params->desc_params[UCLOGIC_RDESC_PEN_PH_ID_Y_PM], 167 + desc_params[UCLOGIC_RDESC_PEN_PH_ID_Y_PM]); 168 + KUNIT_EXPECT_EQ(test, 169 + params->desc_params[UCLOGIC_RDESC_PEN_PH_ID_PRESSURE_LM], 170 + desc_params[UCLOGIC_RDESC_PEN_PH_ID_PRESSURE_LM]); 171 + KUNIT_EXPECT_EQ(test, 172 + params->desc_params[UCLOGIC_RDESC_FRAME_PH_ID_UM], 173 + desc_params[UCLOGIC_RDESC_FRAME_PH_ID_UM]); 174 + KUNIT_EXPECT_EQ(test, params->frame_type, frame_type); 175 + } 176 + 177 + static struct kunit_case hid_uclogic_params_test_cases[] = { 178 + KUNIT_CASE_PARAM(uclogic_parse_ugee_v2_desc_test, 179 + uclogic_parse_ugee_v2_desc_gen_params), 180 + {} 181 + }; 182 + 183 + static struct kunit_suite hid_uclogic_params_test_suite = { 184 + .name = "hid_uclogic_params_test", 185 + .test_cases = hid_uclogic_params_test_cases, 186 + }; 187 + 188 + kunit_test_suite(hid_uclogic_params_test_suite); 189 + 190 + MODULE_DESCRIPTION("KUnit tests for the UC-Logic driver"); 191 + MODULE_LICENSE("GPL"); 192 + MODULE_AUTHOR("José Expósito <jose.exposito89@gmail.com>");
+193 -37
drivers/hid/hid-uclogic-params.c
··· 1057 1057 } 1058 1058 1059 1059 /** 1060 + * uclogic_params_parse_ugee_v2_desc - parse the string descriptor containing 1061 + * pen and frame parameters returned by UGEE v2 devices. 1062 + * 1063 + * @str_desc: String descriptor, cannot be NULL. 1064 + * @str_desc_size: Size of the string descriptor. 1065 + * @desc_params: Output description params list. 1066 + * @desc_params_size: Size of the output description params list. 1067 + * @frame_type: Output frame type. 1068 + * 1069 + * Returns: 1070 + * Zero, if successful. A negative errno code on error. 1071 + */ 1072 + static int uclogic_params_parse_ugee_v2_desc(const __u8 *str_desc, 1073 + size_t str_desc_size, 1074 + s32 *desc_params, 1075 + size_t desc_params_size, 1076 + enum uclogic_params_frame_type *frame_type) 1077 + { 1078 + s32 pen_x_lm, pen_y_lm; 1079 + s32 pen_x_pm, pen_y_pm; 1080 + s32 pen_pressure_lm; 1081 + s32 frame_num_buttons; 1082 + s32 resolution; 1083 + 1084 + /* Minimum descriptor length required, maximum seen so far is 14 */ 1085 + const int min_str_desc_size = 12; 1086 + 1087 + if (!str_desc || str_desc_size < min_str_desc_size) 1088 + return -EINVAL; 1089 + 1090 + if (desc_params_size != UCLOGIC_RDESC_PH_ID_NUM) 1091 + return -EINVAL; 1092 + 1093 + pen_x_lm = get_unaligned_le16(str_desc + 2); 1094 + pen_y_lm = get_unaligned_le16(str_desc + 4); 1095 + frame_num_buttons = str_desc[6]; 1096 + *frame_type = str_desc[7]; 1097 + pen_pressure_lm = get_unaligned_le16(str_desc + 8); 1098 + 1099 + resolution = get_unaligned_le16(str_desc + 10); 1100 + if (resolution == 0) { 1101 + pen_x_pm = 0; 1102 + pen_y_pm = 0; 1103 + } else { 1104 + pen_x_pm = pen_x_lm * 1000 / resolution; 1105 + pen_y_pm = pen_y_lm * 1000 / resolution; 1106 + } 1107 + 1108 + desc_params[UCLOGIC_RDESC_PEN_PH_ID_X_LM] = pen_x_lm; 1109 + desc_params[UCLOGIC_RDESC_PEN_PH_ID_X_PM] = pen_x_pm; 1110 + desc_params[UCLOGIC_RDESC_PEN_PH_ID_Y_LM] = pen_y_lm; 1111 + desc_params[UCLOGIC_RDESC_PEN_PH_ID_Y_PM] = pen_y_pm; 1112 + desc_params[UCLOGIC_RDESC_PEN_PH_ID_PRESSURE_LM] = pen_pressure_lm; 1113 + desc_params[UCLOGIC_RDESC_FRAME_PH_ID_UM] = frame_num_buttons; 1114 + 1115 + return 0; 1116 + } 1117 + 1118 + /** 1119 + * uclogic_params_ugee_v2_init_frame_buttons() - initialize a UGEE v2 frame with 1120 + * buttons. 1121 + * @p: Parameters to fill in, cannot be NULL. 1122 + * @desc_params: Device description params list. 1123 + * @desc_params_size: Size of the description params list. 1124 + * 1125 + * Returns: 1126 + * Zero, if successful. A negative errno code on error. 1127 + */ 1128 + static int uclogic_params_ugee_v2_init_frame_buttons(struct uclogic_params *p, 1129 + const s32 *desc_params, 1130 + size_t desc_params_size) 1131 + { 1132 + __u8 *rdesc_frame = NULL; 1133 + int rc = 0; 1134 + 1135 + if (!p || desc_params_size != UCLOGIC_RDESC_PH_ID_NUM) 1136 + return -EINVAL; 1137 + 1138 + rdesc_frame = uclogic_rdesc_template_apply( 1139 + uclogic_rdesc_ugee_v2_frame_btn_template_arr, 1140 + uclogic_rdesc_ugee_v2_frame_btn_template_size, 1141 + desc_params, UCLOGIC_RDESC_PH_ID_NUM); 1142 + if (!rdesc_frame) 1143 + return -ENOMEM; 1144 + 1145 + rc = uclogic_params_frame_init_with_desc(&p->frame_list[0], 1146 + rdesc_frame, 1147 + uclogic_rdesc_ugee_v2_frame_btn_template_size, 1148 + UCLOGIC_RDESC_V1_FRAME_ID); 1149 + kfree(rdesc_frame); 1150 + return rc; 1151 + } 1152 + 1153 + /** 1154 + * uclogic_params_ugee_v2_init_frame_dial() - initialize a UGEE v2 frame with a 1155 + * bitmap dial. 1156 + * @p: Parameters to fill in, cannot be NULL. 1157 + * @desc_params: Device description params list. 1158 + * @desc_params_size: Size of the description params list. 1159 + * 1160 + * Returns: 1161 + * Zero, if successful. A negative errno code on error. 1162 + */ 1163 + static int uclogic_params_ugee_v2_init_frame_dial(struct uclogic_params *p, 1164 + const s32 *desc_params, 1165 + size_t desc_params_size) 1166 + { 1167 + __u8 *rdesc_frame = NULL; 1168 + int rc = 0; 1169 + 1170 + if (!p || desc_params_size != UCLOGIC_RDESC_PH_ID_NUM) 1171 + return -EINVAL; 1172 + 1173 + rdesc_frame = uclogic_rdesc_template_apply( 1174 + uclogic_rdesc_ugee_v2_frame_dial_template_arr, 1175 + uclogic_rdesc_ugee_v2_frame_dial_template_size, 1176 + desc_params, UCLOGIC_RDESC_PH_ID_NUM); 1177 + if (!rdesc_frame) 1178 + return -ENOMEM; 1179 + 1180 + rc = uclogic_params_frame_init_with_desc(&p->frame_list[0], 1181 + rdesc_frame, 1182 + uclogic_rdesc_ugee_v2_frame_dial_template_size, 1183 + UCLOGIC_RDESC_V1_FRAME_ID); 1184 + kfree(rdesc_frame); 1185 + if (rc) 1186 + return rc; 1187 + 1188 + p->frame_list[0].bitmap_dial_byte = 7; 1189 + return 0; 1190 + } 1191 + 1192 + /** 1193 + * uclogic_params_ugee_v2_init_frame_mouse() - initialize a UGEE v2 frame with a 1194 + * mouse. 1195 + * @p: Parameters to fill in, cannot be NULL. 1196 + * 1197 + * Returns: 1198 + * Zero, if successful. A negative errno code on error. 1199 + */ 1200 + static int uclogic_params_ugee_v2_init_frame_mouse(struct uclogic_params *p) 1201 + { 1202 + int rc = 0; 1203 + 1204 + if (!p) 1205 + return -EINVAL; 1206 + 1207 + rc = uclogic_params_frame_init_with_desc(&p->frame_list[1], 1208 + uclogic_rdesc_ugee_v2_frame_mouse_template_arr, 1209 + uclogic_rdesc_ugee_v2_frame_mouse_template_size, 1210 + UCLOGIC_RDESC_V1_FRAME_ID); 1211 + return rc; 1212 + } 1213 + 1214 + /** 1060 1215 * uclogic_params_ugee_v2_init() - initialize a UGEE graphics tablets by 1061 1216 * discovering their parameters. 1062 1217 * ··· 1239 1084 const int str_desc_len = 12; 1240 1085 __u8 *str_desc = NULL; 1241 1086 __u8 *rdesc_pen = NULL; 1242 - __u8 *rdesc_frame = NULL; 1243 1087 s32 desc_params[UCLOGIC_RDESC_PH_ID_NUM]; 1244 - s32 resolution; 1088 + enum uclogic_params_frame_type frame_type; 1245 1089 __u8 magic_arr[] = { 1246 1090 0x02, 0xb0, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 1247 1091 }; ··· 1254 1100 1255 1101 iface = to_usb_interface(hdev->dev.parent); 1256 1102 bInterfaceNumber = iface->cur_altsetting->desc.bInterfaceNumber; 1103 + 1104 + if (bInterfaceNumber == 0) { 1105 + rc = uclogic_params_ugee_v2_init_frame_mouse(&p); 1106 + if (rc) 1107 + goto cleanup; 1108 + 1109 + goto output; 1110 + } 1111 + 1257 1112 if (bInterfaceNumber != 2) { 1258 1113 uclogic_params_init_invalid(&p); 1259 1114 goto output; ··· 1291 1128 goto output; 1292 1129 } 1293 1130 1294 - desc_params[UCLOGIC_RDESC_PEN_PH_ID_X_LM] = 1295 - get_unaligned_le16(str_desc + 2); 1296 - desc_params[UCLOGIC_RDESC_PEN_PH_ID_Y_LM] = 1297 - get_unaligned_le16(str_desc + 4); 1298 - desc_params[UCLOGIC_RDESC_FRAME_PH_ID_UM] = str_desc[6]; 1299 - desc_params[UCLOGIC_RDESC_PEN_PH_ID_PRESSURE_LM] = 1300 - get_unaligned_le16(str_desc + 8); 1301 - resolution = get_unaligned_le16(str_desc + 10); 1302 - if (resolution == 0) { 1303 - desc_params[UCLOGIC_RDESC_PEN_PH_ID_X_PM] = 0; 1304 - desc_params[UCLOGIC_RDESC_PEN_PH_ID_Y_PM] = 0; 1305 - } else { 1306 - desc_params[UCLOGIC_RDESC_PEN_PH_ID_X_PM] = 1307 - desc_params[UCLOGIC_RDESC_PEN_PH_ID_X_LM] * 1000 / 1308 - resolution; 1309 - desc_params[UCLOGIC_RDESC_PEN_PH_ID_Y_PM] = 1310 - desc_params[UCLOGIC_RDESC_PEN_PH_ID_Y_LM] * 1000 / 1311 - resolution; 1312 - } 1131 + rc = uclogic_params_parse_ugee_v2_desc(str_desc, str_desc_len, 1132 + desc_params, 1133 + ARRAY_SIZE(desc_params), 1134 + &frame_type); 1135 + if (rc) 1136 + goto cleanup; 1137 + 1313 1138 kfree(str_desc); 1314 1139 str_desc = NULL; 1315 1140 ··· 1318 1167 p.pen.subreport_list[0].id = UCLOGIC_RDESC_V1_FRAME_ID; 1319 1168 1320 1169 /* Initialize the frame interface */ 1321 - rdesc_frame = uclogic_rdesc_template_apply( 1322 - uclogic_rdesc_ugee_v2_frame_btn_template_arr, 1323 - uclogic_rdesc_ugee_v2_frame_btn_template_size, 1324 - desc_params, ARRAY_SIZE(desc_params)); 1325 - if (!rdesc_frame) { 1326 - rc = -ENOMEM; 1327 - goto cleanup; 1170 + switch (frame_type) { 1171 + case UCLOGIC_PARAMS_FRAME_DIAL: 1172 + case UCLOGIC_PARAMS_FRAME_MOUSE: 1173 + rc = uclogic_params_ugee_v2_init_frame_dial(&p, desc_params, 1174 + ARRAY_SIZE(desc_params)); 1175 + break; 1176 + case UCLOGIC_PARAMS_FRAME_BUTTONS: 1177 + default: 1178 + rc = uclogic_params_ugee_v2_init_frame_buttons(&p, desc_params, 1179 + ARRAY_SIZE(desc_params)); 1180 + break; 1328 1181 } 1329 1182 1330 - rc = uclogic_params_frame_init_with_desc(&p.frame_list[0], 1331 - rdesc_frame, 1332 - uclogic_rdesc_ugee_v2_frame_btn_template_size, 1333 - UCLOGIC_RDESC_V1_FRAME_ID); 1334 - kfree(rdesc_frame); 1335 - if (rc) { 1336 - uclogic_params_init_invalid(&p); 1337 - goto output; 1338 - } 1183 + if (rc) 1184 + goto cleanup; 1339 1185 1340 1186 output: 1341 1187 /* Output parameters */ ··· 1581 1433 } 1582 1434 break; 1583 1435 case VID_PID(USB_VENDOR_ID_UGEE, 1436 + USB_DEVICE_ID_UGEE_PARBLO_A610_PRO): 1437 + case VID_PID(USB_VENDOR_ID_UGEE, 1584 1438 USB_DEVICE_ID_UGEE_XPPEN_TABLET_DECO_L): 1439 + case VID_PID(USB_VENDOR_ID_UGEE, 1440 + USB_DEVICE_ID_UGEE_XPPEN_TABLET_DECO_PRO_S): 1585 1441 rc = uclogic_params_ugee_v2_init(&p, hdev); 1586 1442 if (rc != 0) 1587 1443 goto cleanup; ··· 1669 1517 uclogic_params_cleanup(&p); 1670 1518 return rc; 1671 1519 } 1520 + 1521 + #ifdef CONFIG_HID_KUNIT_TEST 1522 + #include "hid-uclogic-params-test.c" 1523 + #endif
+10
drivers/hid/hid-uclogic-params.h
··· 29 29 UCLOGIC_PARAMS_PEN_INRANGE_NONE, 30 30 }; 31 31 32 + /* Types of frames */ 33 + enum uclogic_params_frame_type { 34 + /* Frame with buttons */ 35 + UCLOGIC_PARAMS_FRAME_BUTTONS = 0, 36 + /* Frame with buttons and a dial */ 37 + UCLOGIC_PARAMS_FRAME_DIAL, 38 + /* Frame with buttons and a mouse (shaped as a dial + touchpad) */ 39 + UCLOGIC_PARAMS_FRAME_MOUSE, 40 + }; 41 + 32 42 /* 33 43 * Pen report's subreport data. 34 44 */
+11 -11
drivers/hid/hid-uclogic-rdesc-test.c
··· 97 97 98 98 static struct uclogic_template_case uclogic_template_cases[] = { 99 99 { 100 - .name = "Empty template", 100 + .name = "empty_template", 101 101 .template = template_empty, 102 102 .template_size = sizeof(template_empty), 103 103 .param_list = params_pen_all, ··· 105 105 .expected = template_empty, 106 106 }, 107 107 { 108 - .name = "Template smaller than the placeholder", 108 + .name = "template_smaller_than_the_placeholder", 109 109 .template = template_small, 110 110 .template_size = sizeof(template_small), 111 111 .param_list = params_pen_all, ··· 113 113 .expected = template_small, 114 114 }, 115 115 { 116 - .name = "No placeholder", 116 + .name = "no_placeholder", 117 117 .template = template_no_ph, 118 118 .template_size = sizeof(template_no_ph), 119 119 .param_list = params_pen_all, ··· 121 121 .expected = template_no_ph, 122 122 }, 123 123 { 124 - .name = "Pen placeholder at the end, without ID", 124 + .name = "pen_placeholder_at_the_end_without_id", 125 125 .template = template_pen_ph_end, 126 126 .template_size = sizeof(template_pen_ph_end), 127 127 .param_list = params_pen_all, ··· 129 129 .expected = template_pen_ph_end, 130 130 }, 131 131 { 132 - .name = "Frame button placeholder at the end, without ID", 132 + .name = "frame_button_placeholder_at_the_end_without_id", 133 133 .template = template_btn_ph_end, 134 134 .template_size = sizeof(template_btn_ph_end), 135 135 .param_list = params_frame_all, ··· 137 137 .expected = template_btn_ph_end, 138 138 }, 139 139 { 140 - .name = "All params present in the pen template", 140 + .name = "all_params_present_in_the_pen_template", 141 141 .template = template_pen_all_params, 142 142 .template_size = sizeof(template_pen_all_params), 143 143 .param_list = params_pen_all, ··· 145 145 .expected = expected_pen_all_params, 146 146 }, 147 147 { 148 - .name = "All params present in the frame template", 148 + .name = "all_params_present_in_the_frame_template", 149 149 .template = template_frame_all_params, 150 150 .template_size = sizeof(template_frame_all_params), 151 151 .param_list = params_frame_all, ··· 153 153 .expected = expected_frame_all_params, 154 154 }, 155 155 { 156 - .name = "Some params present in the pen template (complete param list)", 156 + .name = "some_params_present_in_the_pen_template_with_complete_param_list", 157 157 .template = template_pen_some_params, 158 158 .template_size = sizeof(template_pen_some_params), 159 159 .param_list = params_pen_all, ··· 161 161 .expected = expected_pen_some_params, 162 162 }, 163 163 { 164 - .name = "Some params present in the pen template (incomplete param list)", 164 + .name = "some_params_present_in_the_pen_template_with_incomplete_param_list", 165 165 .template = template_pen_some_params, 166 166 .template_size = sizeof(template_pen_some_params), 167 167 .param_list = params_pen_some, ··· 169 169 .expected = expected_pen_some_params, 170 170 }, 171 171 { 172 - .name = "No params present in the template", 172 + .name = "no_params_present_in_the_template", 173 173 .template = template_params_none, 174 174 .template_size = sizeof(template_params_none), 175 175 .param_list = params_pen_some, ··· 208 208 }; 209 209 210 210 static struct kunit_suite hid_uclogic_rdesc_test_suite = { 211 - .name = "hid-uclogic-rdesc-test", 211 + .name = "hid_uclogic_rdesc_test", 212 212 .test_cases = hid_uclogic_rdesc_test_cases, 213 213 }; 214 214
+75 -1
drivers/hid/hid-uclogic-rdesc.c
··· 961 961 const size_t uclogic_rdesc_ugee_v2_frame_btn_template_size = 962 962 sizeof(uclogic_rdesc_ugee_v2_frame_btn_template_arr); 963 963 964 + /* Fixed report descriptor template for UGEE v2 frame reports (dial) */ 965 + const __u8 uclogic_rdesc_ugee_v2_frame_dial_template_arr[] = { 966 + 0x05, 0x01, /* Usage Page (Desktop), */ 967 + 0x09, 0x07, /* Usage (Keypad), */ 968 + 0xA1, 0x01, /* Collection (Application), */ 969 + 0x85, UCLOGIC_RDESC_V1_FRAME_ID, 970 + /* Report ID, */ 971 + 0x05, 0x0D, /* Usage Page (Digitizer), */ 972 + 0x09, 0x39, /* Usage (Tablet Function Keys), */ 973 + 0xA0, /* Collection (Physical), */ 974 + 0x75, 0x01, /* Report Size (1), */ 975 + 0x95, 0x08, /* Report Count (8), */ 976 + 0x81, 0x01, /* Input (Constant), */ 977 + 0x05, 0x09, /* Usage Page (Button), */ 978 + 0x19, 0x01, /* Usage Minimum (01h), */ 979 + UCLOGIC_RDESC_FRAME_PH_BTN, 980 + /* Usage Maximum (PLACEHOLDER), */ 981 + 0x95, 0x0A, /* Report Count (10), */ 982 + 0x14, /* Logical Minimum (0), */ 983 + 0x25, 0x01, /* Logical Maximum (1), */ 984 + 0x81, 0x02, /* Input (Variable), */ 985 + 0x95, 0x06, /* Report Count (6), */ 986 + 0x81, 0x01, /* Input (Constant), */ 987 + 0x75, 0x08, /* Report Size (8), */ 988 + 0x95, 0x03, /* Report Count (3), */ 989 + 0x81, 0x01, /* Input (Constant), */ 990 + 0x05, 0x01, /* Usage Page (Desktop), */ 991 + 0x09, 0x38, /* Usage (Wheel), */ 992 + 0x95, 0x01, /* Report Count (1), */ 993 + 0x15, 0xFF, /* Logical Minimum (-1), */ 994 + 0x25, 0x01, /* Logical Maximum (1), */ 995 + 0x81, 0x06, /* Input (Variable, Relative), */ 996 + 0x95, 0x02, /* Report Count (2), */ 997 + 0x81, 0x01, /* Input (Constant), */ 998 + 0xC0, /* End Collection, */ 999 + 0xC0 /* End Collection */ 1000 + }; 1001 + const size_t uclogic_rdesc_ugee_v2_frame_dial_template_size = 1002 + sizeof(uclogic_rdesc_ugee_v2_frame_dial_template_arr); 1003 + 1004 + /* Fixed report descriptor template for UGEE v2 frame reports (mouse) */ 1005 + const __u8 uclogic_rdesc_ugee_v2_frame_mouse_template_arr[] = { 1006 + 0x05, 0x01, /* Usage Page (Desktop), */ 1007 + 0x09, 0x02, /* Usage (Mouse), */ 1008 + 0xA1, 0x01, /* Collection (Application), */ 1009 + 0x85, 0x01, /* Report ID (1), */ 1010 + 0x05, 0x01, /* Usage Page (Pointer), */ 1011 + 0xA0, /* Collection (Physical), */ 1012 + 0x75, 0x01, /* Report Size (1), */ 1013 + 0x95, 0x02, /* Report Count (2), */ 1014 + 0x05, 0x09, /* Usage Page (Button), */ 1015 + 0x19, 0x01, /* Usage Minimum (01h), */ 1016 + 0x29, 0x02, /* Usage Maximum (02h), */ 1017 + 0x14, /* Logical Minimum (0), */ 1018 + 0x25, 0x01, /* Logical Maximum (1), */ 1019 + 0x81, 0x02, /* Input (Variable), */ 1020 + 0x95, 0x06, /* Report Count (6), */ 1021 + 0x81, 0x01, /* Input (Constant), */ 1022 + 0x05, 0x01, /* Usage Page (Generic Desktop), */ 1023 + 0x09, 0x30, /* Usage (X), */ 1024 + 0x09, 0x31, /* Usage (Y), */ 1025 + 0x75, 0x10, /* Report Size (16), */ 1026 + 0x95, 0x02, /* Report Count (2), */ 1027 + 0x16, 0x00, 0x80, /* Logical Minimum (-32768), */ 1028 + 0x26, 0xFF, 0x7F, /* Logical Maximum (32767), */ 1029 + 0x81, 0x06, /* Input (Variable, Relative), */ 1030 + 0x95, 0x01, /* Report Count (1), */ 1031 + 0x81, 0x01, /* Input (Constant), */ 1032 + 0xC0, /* End Collection, */ 1033 + 0xC0 /* End Collection */ 1034 + }; 1035 + const size_t uclogic_rdesc_ugee_v2_frame_mouse_template_size = 1036 + sizeof(uclogic_rdesc_ugee_v2_frame_mouse_template_arr); 1037 + 964 1038 /* Fixed report descriptor for Ugee EX07 frame */ 965 1039 const __u8 uclogic_rdesc_ugee_ex07_frame_arr[] = { 966 1040 0x05, 0x01, /* Usage Page (Desktop), */ ··· 1187 1113 memcmp(p, pen_head, sizeof(pen_head)) == 0 && 1188 1114 p[sizeof(pen_head)] < param_num) { 1189 1115 v = param_list[p[sizeof(pen_head)]]; 1190 - put_unaligned(cpu_to_le32(v), (s32 *)p); 1116 + put_unaligned((__force u32)cpu_to_le32(v), (s32 *)p); 1191 1117 p += sizeof(pen_head) + 1; 1192 1118 } else if (memcmp(p, btn_head, sizeof(btn_head)) == 0 && 1193 1119 p[sizeof(btn_head)] < param_num) {
+8
drivers/hid/hid-uclogic-rdesc.h
··· 169 169 extern const __u8 uclogic_rdesc_ugee_v2_frame_btn_template_arr[]; 170 170 extern const size_t uclogic_rdesc_ugee_v2_frame_btn_template_size; 171 171 172 + /* Fixed report descriptor template for UGEE v2 frame reports (dial) */ 173 + extern const __u8 uclogic_rdesc_ugee_v2_frame_dial_template_arr[]; 174 + extern const size_t uclogic_rdesc_ugee_v2_frame_dial_template_size; 175 + 176 + /* Fixed report descriptor template for UGEE v2 frame reports (mouse) */ 177 + extern const __u8 uclogic_rdesc_ugee_v2_frame_mouse_template_arr[]; 178 + extern const size_t uclogic_rdesc_ugee_v2_frame_mouse_template_size; 179 + 172 180 /* Fixed report descriptor for Ugee EX07 frame */ 173 181 extern const __u8 uclogic_rdesc_ugee_ex07_frame_arr[]; 174 182 extern const size_t uclogic_rdesc_ugee_ex07_frame_size;
+15 -14
drivers/hid/hid-vivaldi-common.c
··· 116 116 NULL 117 117 }; 118 118 119 - static const struct attribute_group vivaldi_attribute_group = { 120 - .attrs = vivaldi_sysfs_attrs, 121 - }; 122 - 123 - /** 124 - * vivaldi_input_configured - Complete initialization of device using vivaldi map 125 - * @hdev: HID device to which vivaldi attributes should be attached 126 - * @hidinput: HID input device (unused) 127 - */ 128 - int vivaldi_input_configured(struct hid_device *hdev, 129 - struct hid_input *hidinput) 119 + static umode_t vivaldi_is_visible(struct kobject *kobj, struct attribute *attr, 120 + int n) 130 121 { 122 + struct hid_device *hdev = to_hid_device(kobj_to_dev(kobj)); 131 123 struct vivaldi_data *data = hid_get_drvdata(hdev); 132 124 133 125 if (!data->num_function_row_keys) 134 126 return 0; 135 - 136 - return devm_device_add_group(&hdev->dev, &vivaldi_attribute_group); 127 + return attr->mode; 137 128 } 138 - EXPORT_SYMBOL_GPL(vivaldi_input_configured); 129 + 130 + static const struct attribute_group vivaldi_attribute_group = { 131 + .attrs = vivaldi_sysfs_attrs, 132 + .is_visible = vivaldi_is_visible, 133 + }; 134 + 135 + const struct attribute_group *vivaldi_attribute_groups[] = { 136 + &vivaldi_attribute_group, 137 + NULL, 138 + }; 139 + EXPORT_SYMBOL_GPL(vivaldi_attribute_groups); 139 140 140 141 MODULE_LICENSE("GPL");
+1 -3
drivers/hid/hid-vivaldi-common.h
··· 4 4 5 5 struct hid_device; 6 6 struct hid_field; 7 - struct hid_input; 8 7 struct hid_usage; 9 8 10 9 void vivaldi_feature_mapping(struct hid_device *hdev, 11 10 struct hid_field *field, struct hid_usage *usage); 12 11 13 - int vivaldi_input_configured(struct hid_device *hdev, 14 - struct hid_input *hidinput); 12 + extern const struct attribute_group *vivaldi_attribute_groups[]; 15 13 16 14 #endif /* _HID_VIVALDI_COMMON_H */
+3 -1
drivers/hid/hid-vivaldi.c
··· 45 45 .id_table = vivaldi_table, 46 46 .probe = vivaldi_probe, 47 47 .feature_mapping = vivaldi_feature_mapping, 48 - .input_configured = vivaldi_input_configured, 48 + .driver = { 49 + .dev_groups = vivaldi_attribute_groups, 50 + }, 49 51 }; 50 52 51 53 module_hid_driver(hid_vivaldi);
+91
drivers/hid/hid-vrc2.c
··· 1 + // SPDX-License-Identifier: GPL-2.0-or-later 2 + /* 3 + * HID driver for VRC-2 2-axis Car controller 4 + * 5 + * Copyright (C) 2022 Marcus Folkesson <marcus.folkesson@gmail.com> 6 + */ 7 + 8 + #include <linux/device.h> 9 + #include <linux/hid.h> 10 + #include <linux/module.h> 11 + 12 + /* 13 + * VID/PID are probably "borrowed", so keep them locally and 14 + * do not populate hid-ids.h with those. 15 + */ 16 + #define USB_VENDOR_ID_VRC2 (0x07c0) 17 + #define USB_DEVICE_ID_VRC2 (0x1125) 18 + 19 + static __u8 vrc2_rdesc_fixed[] = { 20 + 0x05, 0x01, // Usage Page (Generic Desktop Ctrls) 21 + 0x09, 0x04, // Usage (Joystick) 22 + 0xA1, 0x01, // Collection (Application) 23 + 0x09, 0x01, // Usage (Pointer) 24 + 0xA1, 0x00, // Collection (Physical) 25 + 0x09, 0x30, // Usage (X) 26 + 0x09, 0x31, // Usage (Y) 27 + 0x15, 0x00, // Logical Minimum (0) 28 + 0x26, 0xFF, 0x07, // Logical Maximum (2047) 29 + 0x35, 0x00, // Physical Minimum (0) 30 + 0x46, 0xFF, 0x00, // Physical Maximum (255) 31 + 0x75, 0x10, // Report Size (16) 32 + 0x95, 0x02, // Report Count (2) 33 + 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 34 + 0xC0, // End Collection 35 + 0x75, 0x08, // Report Size (8) 36 + 0x95, 0x03, // Report Count (3) 37 + 0x81, 0x03, // Input (Cnst,Var,Abs) 38 + 0xC0, // End Collection 39 + }; 40 + 41 + static __u8 *vrc2_report_fixup(struct hid_device *hdev, __u8 *rdesc, 42 + unsigned int *rsize) 43 + { 44 + hid_info(hdev, "fixing up VRC-2 report descriptor\n"); 45 + *rsize = sizeof(vrc2_rdesc_fixed); 46 + return vrc2_rdesc_fixed; 47 + } 48 + 49 + static int vrc2_probe(struct hid_device *hdev, const struct hid_device_id *id) 50 + { 51 + int ret; 52 + 53 + /* 54 + * The device gives us 2 separate USB endpoints. 55 + * One of those (the one with report descriptor size of 23) is just bogus so ignore it 56 + */ 57 + if (hdev->dev_rsize == 23) 58 + return -ENODEV; 59 + 60 + ret = hid_parse(hdev); 61 + if (ret) { 62 + hid_err(hdev, "parse failed\n"); 63 + return ret; 64 + } 65 + 66 + ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); 67 + if (ret) { 68 + hid_err(hdev, "hw start failed\n"); 69 + return ret; 70 + } 71 + 72 + return 0; 73 + } 74 + 75 + static const struct hid_device_id vrc2_devices[] = { 76 + { HID_USB_DEVICE(USB_VENDOR_ID_VRC2, USB_DEVICE_ID_VRC2) }, 77 + { /* sentinel */ } 78 + }; 79 + MODULE_DEVICE_TABLE(hid, vrc2_devices); 80 + 81 + static struct hid_driver vrc2_driver = { 82 + .name = "vrc2", 83 + .id_table = vrc2_devices, 84 + .report_fixup = vrc2_report_fixup, 85 + .probe = vrc2_probe, 86 + }; 87 + module_hid_driver(vrc2_driver); 88 + 89 + MODULE_AUTHOR("Marcus Folkesson <marcus.folkesson@gmail.com>"); 90 + MODULE_DESCRIPTION("HID driver for VRC-2 2-axis Car controller"); 91 + MODULE_LICENSE("GPL");
+1 -1
drivers/hid/i2c-hid/i2c-hid-core.c
··· 1036 1036 1037 1037 snprintf(hid->name, sizeof(hid->name), "%s %04X:%04X", 1038 1038 client->name, (u16)hid->vendor, (u16)hid->product); 1039 - strlcpy(hid->phys, dev_name(&client->dev), sizeof(hid->phys)); 1039 + strscpy(hid->phys, dev_name(&client->dev), sizeof(hid->phys)); 1040 1040 1041 1041 ihid->quirks = i2c_hid_lookup_quirk(hid->vendor, hid->product); 1042 1042
+1 -1
drivers/hid/usbhid/hid-core.c
··· 1381 1381 hid->type = HID_TYPE_USBNONE; 1382 1382 1383 1383 if (dev->manufacturer) 1384 - strlcpy(hid->name, dev->manufacturer, sizeof(hid->name)); 1384 + strscpy(hid->name, dev->manufacturer, sizeof(hid->name)); 1385 1385 1386 1386 if (dev->product) { 1387 1387 if (dev->manufacturer)
+1 -1
drivers/hid/usbhid/usbkbd.c
··· 294 294 spin_lock_init(&kbd->leds_lock); 295 295 296 296 if (dev->manufacturer) 297 - strlcpy(kbd->name, dev->manufacturer, sizeof(kbd->name)); 297 + strscpy(kbd->name, dev->manufacturer, sizeof(kbd->name)); 298 298 299 299 if (dev->product) { 300 300 if (dev->manufacturer)
+1 -1
drivers/hid/usbhid/usbmouse.c
··· 142 142 mouse->dev = input_dev; 143 143 144 144 if (dev->manufacturer) 145 - strlcpy(mouse->name, dev->manufacturer, sizeof(mouse->name)); 145 + strscpy(mouse->name, dev->manufacturer, sizeof(mouse->name)); 146 146 147 147 if (dev->product) { 148 148 if (dev->manufacturer)
+1 -4
drivers/hid/wacom.h
··· 1 1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 2 2 /* 3 - * drivers/input/tablet/wacom.h 4 - * 5 3 * USB Wacom tablet support 6 4 * 7 5 * Copyright (c) 2000-2004 Vojtech Pavlik <vojtech@ucw.cz> ··· 76 78 * - integration of the Bluetooth devices 77 79 */ 78 80 79 - /* 80 - */ 81 81 #ifndef WACOM_H 82 82 #define WACOM_H 83 + 83 84 #include <linux/kernel.h> 84 85 #include <linux/slab.h> 85 86 #include <linux/module.h>
+3 -8
drivers/hid/wacom_sys.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0-or-later 2 2 /* 3 - * drivers/input/tablet/wacom_sys.c 4 - * 5 3 * USB Wacom tablet support - system specific code 6 - */ 7 - 8 - /* 9 4 */ 10 5 11 6 #include "wacom_wac.h" ··· 2221 2226 } else if (strstr(product_name, "Wacom") || 2222 2227 strstr(product_name, "wacom") || 2223 2228 strstr(product_name, "WACOM")) { 2224 - strlcpy(name, product_name, sizeof(name)); 2229 + strscpy(name, product_name, sizeof(name)); 2225 2230 } else { 2226 2231 snprintf(name, sizeof(name), "Wacom %s", product_name); 2227 2232 } ··· 2239 2244 if (name[strlen(name)-1] == ' ') 2240 2245 name[strlen(name)-1] = '\0'; 2241 2246 } else { 2242 - strlcpy(name, features->name, sizeof(name)); 2247 + strscpy(name, features->name, sizeof(name)); 2243 2248 } 2244 2249 2245 2250 snprintf(wacom_wac->name, sizeof(wacom_wac->name), "%s%s", ··· 2504 2509 goto fail; 2505 2510 } 2506 2511 2507 - strlcpy(wacom_wac->name, wacom_wac1->name, 2512 + strscpy(wacom_wac->name, wacom_wac1->name, 2508 2513 sizeof(wacom_wac->name)); 2509 2514 error = wacom_initialize_battery(wacom); 2510 2515 if (error)
+8 -5
drivers/hid/wacom_wac.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0-or-later 2 2 /* 3 - * drivers/input/tablet/wacom_wac.c 4 - * 5 3 * USB Wacom tablet support - Wacom specific code 6 - */ 7 - 8 - /* 9 4 */ 10 5 11 6 #include "wacom_wac.h" ··· 708 713 case 0x802: /* Intuos4/5 13HD/24HD General Pen */ 709 714 case 0x8e2: /* IntuosHT2 pen */ 710 715 case 0x022: 716 + case 0x200: /* Pro Pen 3 */ 717 + case 0x04200: /* Pro Pen 3 */ 711 718 case 0x10842: /* MobileStudio Pro Pro Pen slim */ 712 719 case 0x14802: /* Intuos4/5 13HD/24HD Classic Pen */ 713 720 case 0x16802: /* Cintiq 13HD Pro Pen */ 714 721 case 0x18802: /* DTH2242 Pen */ 715 722 case 0x10802: /* Intuos4/5 13HD/24HD General Pen */ 723 + case 0x80842: /* Intuos Pro and Cintiq Pro 3D Pen */ 716 724 tool_type = BTN_TOOL_PEN; 717 725 break; 718 726 ··· 4873 4875 static const struct wacom_features wacom_features_0x3c8 = 4874 4876 { "Wacom Intuos BT M", 21600, 13500, 4095, 63, 4875 4877 INTUOSHT3_BT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, 4 }; 4878 + static const struct wacom_features wacom_features_0x3dd = 4879 + { "Wacom Intuos Pro S", 31920, 19950, 8191, 63, 4880 + INTUOSP2S_BT, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 7, 4881 + .touch_max = 10 }; 4876 4882 4877 4883 static const struct wacom_features wacom_features_HID_ANY_ID = 4878 4884 { "Wacom HID", .type = HID_GENERIC, .oVid = HID_ANY_ID, .oPid = HID_ANY_ID }; ··· 5052 5050 { BT_DEVICE_WACOM(0x393) }, 5053 5051 { BT_DEVICE_WACOM(0x3c6) }, 5054 5052 { BT_DEVICE_WACOM(0x3c8) }, 5053 + { BT_DEVICE_WACOM(0x3dd) }, 5055 5054 { USB_DEVICE_WACOM(0x4001) }, 5056 5055 { USB_DEVICE_WACOM(0x4004) }, 5057 5056 { USB_DEVICE_WACOM(0x5000) },
+1 -3
drivers/hid/wacom_wac.h
··· 1 1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 2 - /* 3 - * drivers/input/tablet/wacom_wac.h 4 - */ 2 + 5 3 #ifndef WACOM_WAC_H 6 4 #define WACOM_WAC_H 7 5
+14 -19
include/linux/hid.h
··· 314 314 #define HID_BAT_ABSOLUTESTATEOFCHARGE 0x00850065 315 315 316 316 #define HID_VD_ASUS_CUSTOM_MEDIA_KEYS 0xff310076 317 - /* 318 - * HID report types --- Ouch! HID spec says 1 2 3! 319 - */ 320 - 321 - #define HID_INPUT_REPORT 0 322 - #define HID_OUTPUT_REPORT 1 323 - #define HID_FEATURE_REPORT 2 324 - 325 - #define HID_REPORT_TYPES 3 326 317 327 318 /* 328 319 * HID connect requests ··· 500 509 struct list_head hidinput_list; 501 510 struct list_head field_entry_list; /* ordered list of input fields */ 502 511 unsigned int id; /* id of this report */ 503 - unsigned int type; /* report type */ 512 + enum hid_report_type type; /* report type */ 504 513 unsigned int application; /* application usage for this report */ 505 514 struct hid_field *field[HID_MAX_FIELDS]; /* fields of the report */ 506 515 struct hid_field_entry *field_entries; /* allocated memory of input field_entry */ ··· 649 658 struct list_head debug_list; 650 659 spinlock_t debug_list_lock; 651 660 wait_queue_head_t debug_wait; 661 + 662 + unsigned int id; /* system unique id */ 652 663 }; 653 664 654 665 #define to_hid_device(pdev) \ ··· 917 924 extern void hidinput_disconnect(struct hid_device *); 918 925 919 926 int hid_set_field(struct hid_field *, unsigned, __s32); 920 - int hid_input_report(struct hid_device *, int type, u8 *, u32, int); 927 + int hid_input_report(struct hid_device *hid, enum hid_report_type type, u8 *data, u32 size, 928 + int interrupt); 921 929 struct hid_field *hidinput_get_led_field(struct hid_device *hid); 922 930 unsigned int hidinput_count_leds(struct hid_device *hid); 923 931 __s32 hidinput_calc_abs_res(const struct hid_field *field, __u16 code); 924 932 void hid_output_report(struct hid_report *report, __u8 *data); 925 - int __hid_request(struct hid_device *hid, struct hid_report *rep, int reqtype); 933 + int __hid_request(struct hid_device *hid, struct hid_report *rep, enum hid_class_request reqtype); 926 934 u8 *hid_alloc_report_buf(struct hid_report *report, gfp_t flags); 927 935 struct hid_device *hid_allocate_device(void); 928 936 struct hid_report *hid_register_report(struct hid_device *device, 929 - unsigned int type, unsigned int id, 937 + enum hid_report_type type, unsigned int id, 930 938 unsigned int application); 931 939 int hid_parse_report(struct hid_device *hid, __u8 *start, unsigned size); 932 940 struct hid_report *hid_validate_values(struct hid_device *hid, 933 - unsigned int type, unsigned int id, 941 + enum hid_report_type type, unsigned int id, 934 942 unsigned int field_index, 935 943 unsigned int report_counts); 936 944 ··· 1100 1106 int __must_check hid_hw_open(struct hid_device *hdev); 1101 1107 void hid_hw_close(struct hid_device *hdev); 1102 1108 void hid_hw_request(struct hid_device *hdev, 1103 - struct hid_report *report, int reqtype); 1109 + struct hid_report *report, enum hid_class_request reqtype); 1104 1110 int hid_hw_raw_request(struct hid_device *hdev, 1105 1111 unsigned char reportnum, __u8 *buf, 1106 - size_t len, unsigned char rtype, int reqtype); 1112 + size_t len, enum hid_report_type rtype, 1113 + enum hid_class_request reqtype); 1107 1114 int hid_hw_output_report(struct hid_device *hdev, __u8 *buf, size_t len); 1108 1115 1109 1116 /** ··· 1132 1137 * @reqtype: hid request type 1133 1138 */ 1134 1139 static inline int hid_hw_idle(struct hid_device *hdev, int report, int idle, 1135 - int reqtype) 1140 + enum hid_class_request reqtype) 1136 1141 { 1137 1142 if (hdev->ll_driver->idle) 1138 1143 return hdev->ll_driver->idle(hdev, report, idle, reqtype); ··· 1177 1182 return DIV_ROUND_UP(report->size, 8) + (report->id > 0); 1178 1183 } 1179 1184 1180 - int hid_report_raw_event(struct hid_device *hid, int type, u8 *data, u32 size, 1181 - int interrupt); 1185 + int hid_report_raw_event(struct hid_device *hid, enum hid_report_type type, u8 *data, u32 size, 1186 + int interrupt); 1182 1187 1183 1188 /* HID quirks API */ 1184 1189 unsigned long hid_lookup_quirk(const struct hid_device *hdev);
+20 -6
include/uapi/linux/hid.h
··· 43 43 #define USB_INTERFACE_PROTOCOL_MOUSE 2 44 44 45 45 /* 46 + * HID report types --- Ouch! HID spec says 1 2 3! 47 + */ 48 + 49 + enum hid_report_type { 50 + HID_INPUT_REPORT = 0, 51 + HID_OUTPUT_REPORT = 1, 52 + HID_FEATURE_REPORT = 2, 53 + 54 + HID_REPORT_TYPES, 55 + }; 56 + 57 + /* 46 58 * HID class requests 47 59 */ 48 60 49 - #define HID_REQ_GET_REPORT 0x01 50 - #define HID_REQ_GET_IDLE 0x02 51 - #define HID_REQ_GET_PROTOCOL 0x03 52 - #define HID_REQ_SET_REPORT 0x09 53 - #define HID_REQ_SET_IDLE 0x0A 54 - #define HID_REQ_SET_PROTOCOL 0x0B 61 + enum hid_class_request { 62 + HID_REQ_GET_REPORT = 0x01, 63 + HID_REQ_GET_IDLE = 0x02, 64 + HID_REQ_GET_PROTOCOL = 0x03, 65 + HID_REQ_SET_REPORT = 0x09, 66 + HID_REQ_SET_IDLE = 0x0A, 67 + HID_REQ_SET_PROTOCOL = 0x0B, 68 + }; 55 69 56 70 /* 57 71 * HID class descriptor types