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 'hid-for-linus-2026010801' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid

Pull HID fixes from Jiri Kosina:

- build fix for HID-BPF (Benjamin Tissoires)

- fix for potential buffer overflow in i2c-hid (Kwok Kin Ming)

- a couple of selftests/hid fixes (Peter Hutterer)

- fix for handling pressure pads in hid-multitouch (Peter Hutterer)

- fix for potential NULL pointer dereference in intel-thc-hid (Even Xu)

- fix for interrupt delay control in intel-thc-hid (Even Xu)

- fix finger release detection on some VTL-class touchpads (DaytonCL)

- fix for correct enumeration on intel-ish-hid systems with no sensors
(Zhang Lixu)

- assorted device ID additions and device-specific quirks

* tag 'hid-for-linus-2026010801' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid: (21 commits)
HID: logitech: add HID++ support for Logitech MX Anywhere 3S
HID: Elecom: Add support for ELECOM M-XT3DRBK (018C)
HID: quirks: work around VID/PID conflict for appledisplay
HID: Apply quirk HID_QUIRK_ALWAYS_POLL to Edifier QR30 (2d99:a101)
HID: i2c-hid: fix potential buffer overflow in i2c_hid_get_report()
selftests/hid: add a test for the Digitizer/Button Type pressurepad
selftests/hid: use a enum class for the different button types
selftests/hid: require hidtools 0.12
HID: multitouch: set INPUT_PROP_PRESSUREPAD based on Digitizer/Button Type
HID: quirks: Add another Chicony HP 5MP Cameras to hid_ignore_list
HID: Intel-thc-hid: Intel-thc: Add safety check for reading DMA buffer
hid: intel-thc-hid: Select SGL_ALLOC
selftests/hid: fix bpf compilations due to -fms-extensions
HID: bpf: fix bpf compilation with -fms-extensions
HID: Intel-thc-hid: Intel-thc: Fix wrong register reading
HID: multitouch: add MT_QUIRK_STICKY_FINGERS to MT_CLS_VTL
HID: intel-ish-hid: Reset enum_devices_done before enumeration
HID: intel-ish-hid: Update ishtp bus match to support device ID table
HID: Intel-thc-hid: Intel-thc: fix dma_unmap_sg() nents value
HID: playstation: Center initial joystick axes to prevent spurious events
...

+160 -26
+4 -2
drivers/hid/bpf/progs/Makefile
··· 56 56 57 57 %.bpf.o: %.bpf.c vmlinux.h $(BPFOBJ) | $(OUTPUT) 58 58 $(call msg,BPF,$@) 59 - $(Q)$(CLANG) -g -O2 --target=bpf -Wall -Werror $(INCLUDES) \ 60 - -c $(filter %.c,$^) -o $@ && \ 59 + $(Q)$(CLANG) -g -O2 --target=bpf -Wall -Werror $(INCLUDES) \ 60 + -Wno-microsoft-anon-tag \ 61 + -fms-extensions \ 62 + -c $(filter %.c,$^) -o $@ && \ 61 63 $(LLVM_STRIP) -g $@ 62 64 63 65 vmlinux.h: $(VMLINUX_BTF) $(BPFTOOL) | $(INCLUDE_DIR)
+13 -2
drivers/hid/hid-elecom.c
··· 77 77 break; 78 78 case USB_DEVICE_ID_ELECOM_M_XT3URBK_00FB: 79 79 case USB_DEVICE_ID_ELECOM_M_XT3URBK_018F: 80 - case USB_DEVICE_ID_ELECOM_M_XT3DRBK: 80 + case USB_DEVICE_ID_ELECOM_M_XT3DRBK_00FC: 81 81 case USB_DEVICE_ID_ELECOM_M_XT4DRBK: 82 82 /* 83 83 * Report descriptor format: ··· 102 102 */ 103 103 mouse_button_fixup(hdev, rdesc, *rsize, 12, 30, 14, 20, 8); 104 104 break; 105 + case USB_DEVICE_ID_ELECOM_M_XT3DRBK_018C: 106 + /* 107 + * Report descriptor format: 108 + * 22: button bit count 109 + * 30: padding bit count 110 + * 24: button report size 111 + * 16: button usage maximum 112 + */ 113 + mouse_button_fixup(hdev, rdesc, *rsize, 22, 30, 24, 16, 6); 114 + break; 105 115 case USB_DEVICE_ID_ELECOM_M_DT2DRBK: 106 116 case USB_DEVICE_ID_ELECOM_M_HT1DRBK_011C: 107 117 /* ··· 132 122 { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_XGL20DLBK) }, 133 123 { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_XT3URBK_00FB) }, 134 124 { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_XT3URBK_018F) }, 135 - { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_XT3DRBK) }, 125 + { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_XT3DRBK_00FC) }, 126 + { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_XT3DRBK_018C) }, 136 127 { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_XT4DRBK) }, 137 128 { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_DT1URBK) }, 138 129 { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_DT1DRBK) },
+6 -1
drivers/hid/hid-ids.h
··· 317 317 #define USB_DEVICE_ID_CHICONY_ACER_SWITCH12 0x1421 318 318 #define USB_DEVICE_ID_CHICONY_HP_5MP_CAMERA 0xb824 319 319 #define USB_DEVICE_ID_CHICONY_HP_5MP_CAMERA2 0xb82c 320 + #define USB_DEVICE_ID_CHICONY_HP_5MP_CAMERA3 0xb882 320 321 321 322 #define USB_VENDOR_ID_CHUNGHWAT 0x2247 322 323 #define USB_DEVICE_ID_CHUNGHWAT_MULTITOUCH 0x0001 ··· 439 438 #define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_A001 0xa001 440 439 #define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_C002 0xc002 441 440 441 + #define USB_VENDOR_ID_EDIFIER 0x2d99 442 + #define USB_DEVICE_ID_EDIFIER_QR30 0xa101 /* EDIFIER Hal0 2.0 SE */ 443 + 442 444 #define USB_VENDOR_ID_ELAN 0x04f3 443 445 #define USB_DEVICE_ID_TOSHIBA_CLICK_L9W 0x0401 444 446 #define USB_DEVICE_ID_HP_X2 0x074d ··· 455 451 #define USB_DEVICE_ID_ELECOM_M_XGL20DLBK 0x00e6 456 452 #define USB_DEVICE_ID_ELECOM_M_XT3URBK_00FB 0x00fb 457 453 #define USB_DEVICE_ID_ELECOM_M_XT3URBK_018F 0x018f 458 - #define USB_DEVICE_ID_ELECOM_M_XT3DRBK 0x00fc 454 + #define USB_DEVICE_ID_ELECOM_M_XT3DRBK_00FC 0x00fc 455 + #define USB_DEVICE_ID_ELECOM_M_XT3DRBK_018C 0x018c 459 456 #define USB_DEVICE_ID_ELECOM_M_XT4DRBK 0x00fd 460 457 #define USB_DEVICE_ID_ELECOM_M_DT1URBK 0x00fe 461 458 #define USB_DEVICE_ID_ELECOM_M_DT1DRBK 0x00ff
+2
drivers/hid/hid-logitech-hidpp.c
··· 4662 4662 HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb025) }, 4663 4663 { /* MX Master 3S mouse over Bluetooth */ 4664 4664 HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb034) }, 4665 + { /* MX Anywhere 3S mouse over Bluetooth */ 4666 + HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb037) }, 4665 4667 { /* MX Anywhere 3SB mouse over Bluetooth */ 4666 4668 HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb038) }, 4667 4669 {}
+12 -1
drivers/hid/hid-multitouch.c
··· 81 81 #define MT_INPUTMODE_TOUCHPAD 0x03 82 82 83 83 #define MT_BUTTONTYPE_CLICKPAD 0 84 + #define MT_BUTTONTYPE_PRESSUREPAD 1 84 85 85 86 enum latency_mode { 86 87 HID_LATENCY_NORMAL = 0, ··· 180 179 __u8 inputmode_value; /* InputMode HID feature value */ 181 180 __u8 maxcontacts; 182 181 bool is_buttonpad; /* is this device a button pad? */ 182 + bool is_pressurepad; /* is this device a pressurepad? */ 183 183 bool is_haptic_touchpad; /* is this device a haptic touchpad? */ 184 184 bool serial_maybe; /* need to check for serial protocol */ 185 185 ··· 395 393 { .name = MT_CLS_VTL, 396 394 .quirks = MT_QUIRK_ALWAYS_VALID | 397 395 MT_QUIRK_CONTACT_CNT_ACCURATE | 396 + MT_QUIRK_STICKY_FINGERS | 398 397 MT_QUIRK_FORCE_GET_FEATURE, 399 398 }, 400 399 { .name = MT_CLS_GOOGLE, ··· 533 530 } 534 531 535 532 mt_get_feature(hdev, field->report); 536 - if (field->value[usage->usage_index] == MT_BUTTONTYPE_CLICKPAD) 533 + switch (field->value[usage->usage_index]) { 534 + case MT_BUTTONTYPE_CLICKPAD: 537 535 td->is_buttonpad = true; 536 + break; 537 + case MT_BUTTONTYPE_PRESSUREPAD: 538 + td->is_pressurepad = true; 539 + break; 540 + } 538 541 539 542 break; 540 543 case 0xff0000c5: ··· 1402 1393 1403 1394 if (td->is_buttonpad) 1404 1395 __set_bit(INPUT_PROP_BUTTONPAD, input->propbit); 1396 + if (td->is_pressurepad) 1397 + __set_bit(INPUT_PROP_PRESSUREPAD, input->propbit); 1405 1398 1406 1399 app->pending_palm_slots = devm_kcalloc(&hi->input->dev, 1407 1400 BITS_TO_LONGS(td->maxcontacts),
+5
drivers/hid/hid-playstation.c
··· 753 753 if (IS_ERR(gamepad)) 754 754 return ERR_CAST(gamepad); 755 755 756 + /* Set initial resting state for joysticks to 128 (center) */ 756 757 input_set_abs_params(gamepad, ABS_X, 0, 255, 0, 0); 758 + gamepad->absinfo[ABS_X].value = 128; 757 759 input_set_abs_params(gamepad, ABS_Y, 0, 255, 0, 0); 760 + gamepad->absinfo[ABS_Y].value = 128; 758 761 input_set_abs_params(gamepad, ABS_Z, 0, 255, 0, 0); 759 762 input_set_abs_params(gamepad, ABS_RX, 0, 255, 0, 0); 763 + gamepad->absinfo[ABS_RX].value = 128; 760 764 input_set_abs_params(gamepad, ABS_RY, 0, 255, 0, 0); 765 + gamepad->absinfo[ABS_RY].value = 128; 761 766 input_set_abs_params(gamepad, ABS_RZ, 0, 255, 0, 0); 762 767 763 768 input_set_abs_params(gamepad, ABS_HAT0X, -1, 1, 0, 0);
+13 -1
drivers/hid/hid-quirks.c
··· 81 81 { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_PS3), HID_QUIRK_MULTI_INPUT }, 82 82 { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_WIIU), HID_QUIRK_MULTI_INPUT }, 83 83 { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_EGALAX_TOUCHCONTROLLER), HID_QUIRK_MULTI_INPUT | HID_QUIRK_NOGET }, 84 + { HID_USB_DEVICE(USB_VENDOR_ID_EDIFIER, USB_DEVICE_ID_EDIFIER_QR30), HID_QUIRK_ALWAYS_POLL }, 84 85 { HID_USB_DEVICE(USB_VENDOR_ID_ELAN, HID_ANY_ID), HID_QUIRK_ALWAYS_POLL }, 85 86 { HID_USB_DEVICE(USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_TS2700), HID_QUIRK_NOGET }, 86 87 { HID_USB_DEVICE(USB_VENDOR_ID_EMS, USB_DEVICE_ID_EMS_TRIO_LINKER_PLUS_II), HID_QUIRK_MULTI_INPUT }, ··· 233 232 * used as a driver. See hid_scan_report(). 234 233 */ 235 234 static const struct hid_device_id hid_have_special_driver[] = { 235 + #if IS_ENABLED(CONFIG_APPLEDISPLAY) 236 + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, 0x9218) }, 237 + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, 0x9219) }, 238 + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, 0x921c) }, 239 + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, 0x921d) }, 240 + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, 0x9222) }, 241 + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, 0x9226) }, 242 + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, 0x9236) }, 243 + #endif 236 244 #if IS_ENABLED(CONFIG_HID_A4TECH) 237 245 { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_WCP32PU) }, 238 246 { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_X5_005D) }, ··· 422 412 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_XGL20DLBK) }, 423 413 { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_XT3URBK_00FB) }, 424 414 { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_XT3URBK_018F) }, 425 - { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_XT3DRBK) }, 415 + { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_XT3DRBK_00FC) }, 416 + { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_XT3DRBK_018C) }, 426 417 { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_XT4DRBK) }, 427 418 { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_DT1URBK) }, 428 419 { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_DT1DRBK) }, ··· 780 769 { HID_USB_DEVICE(USB_VENDOR_ID_BERKSHIRE, USB_DEVICE_ID_BERKSHIRE_PCWD) }, 781 770 { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_HP_5MP_CAMERA) }, 782 771 { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_HP_5MP_CAMERA2) }, 772 + { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_HP_5MP_CAMERA3) }, 783 773 { HID_USB_DEVICE(USB_VENDOR_ID_CIDC, 0x0103) }, 784 774 { HID_USB_DEVICE(USB_VENDOR_ID_CYGNAL, USB_DEVICE_ID_CYGNAL_RADIO_SI470X) }, 785 775 { HID_USB_DEVICE(USB_VENDOR_ID_CYGNAL, USB_DEVICE_ID_CYGNAL_RADIO_SI4713) },
+1
drivers/hid/i2c-hid/i2c-hid-core.c
··· 286 286 * In addition to report data device will supply data length 287 287 * in the first 2 bytes of the response, so adjust . 288 288 */ 289 + recv_len = min(recv_len, ihid->bufsize - sizeof(__le16)); 289 290 error = i2c_hid_xfer(ihid, ihid->cmdbuf, length, 290 291 ihid->rawbuf, recv_len + sizeof(__le16)); 291 292 if (error) {
+1
drivers/hid/intel-ish-hid/ishtp-hid-client.c
··· 495 495 int rv; 496 496 497 497 /* Send HOSTIF_DM_ENUM_DEVICES */ 498 + client_data->enum_devices_done = false; 498 499 memset(&msg, 0, sizeof(struct hostif_msg)); 499 500 msg.hdr.command = HOSTIF_DM_ENUM_DEVICES; 500 501 rv = ishtp_cl_send(hid_ishtp_cl, (unsigned char *)&msg,
+10 -2
drivers/hid/intel-ish-hid/ishtp/bus.c
··· 240 240 { 241 241 struct ishtp_cl_device *device = to_ishtp_cl_device(dev); 242 242 struct ishtp_cl_driver *driver = to_ishtp_cl_driver(drv); 243 + struct ishtp_fw_client *client = device->fw_client; 244 + const struct ishtp_device_id *id; 243 245 244 - return(device->fw_client ? guid_equal(&driver->id[0].guid, 245 - &device->fw_client->props.protocol_name) : 0); 246 + if (client) { 247 + for (id = driver->id; !guid_is_null(&id->guid); id++) { 248 + if (guid_equal(&id->guid, &client->props.protocol_name)) 249 + return 1; 250 + } 251 + } 252 + 253 + return 0; 246 254 } 247 255 248 256 /**
+1
drivers/hid/intel-thc-hid/Kconfig
··· 7 7 config INTEL_THC_HID 8 8 tristate "Intel Touch Host Controller" 9 9 depends on ACPI 10 + select SGL_ALLOC 10 11 help 11 12 THC (Touch Host Controller) is the name of the IP block in PCH that 12 13 interfaces with Touch Devices (ex: touchscreen, touchpad etc.). It
+2 -2
drivers/hid/intel-thc-hid/intel-thc/intel-thc-dev.c
··· 1593 1593 if (!max_rx_size) 1594 1594 return -EOPNOTSUPP; 1595 1595 1596 - ret = regmap_read(dev->thc_regmap, THC_M_PRT_SW_SEQ_STS_OFFSET, &val); 1596 + ret = regmap_read(dev->thc_regmap, THC_M_PRT_SPI_ICRRD_OPCODE_OFFSET, &val); 1597 1597 if (ret) 1598 1598 return ret; 1599 1599 ··· 1662 1662 if (!delay_us) 1663 1663 return -EOPNOTSUPP; 1664 1664 1665 - ret = regmap_read(dev->thc_regmap, THC_M_PRT_SW_SEQ_STS_OFFSET, &val); 1665 + ret = regmap_read(dev->thc_regmap, THC_M_PRT_SPI_ICRRD_OPCODE_OFFSET, &val); 1666 1666 if (ret) 1667 1667 return ret; 1668 1668
+8 -1
drivers/hid/intel-thc-hid/intel-thc/intel-thc-dma.c
··· 232 232 return 0; 233 233 234 234 memset(config->sgls, 0, sizeof(config->sgls)); 235 + memset(config->sgls_nent_pages, 0, sizeof(config->sgls_nent_pages)); 235 236 memset(config->sgls_nent, 0, sizeof(config->sgls_nent)); 236 237 237 238 cpu_addr = dma_alloc_coherent(dev->dev, prd_tbls_size, ··· 255 254 } 256 255 count = dma_map_sg(dev->dev, config->sgls[i], nent, dir); 257 256 257 + config->sgls_nent_pages[i] = nent; 258 258 config->sgls_nent[i] = count; 259 259 } 260 260 ··· 301 299 continue; 302 300 303 301 dma_unmap_sg(dev->dev, config->sgls[i], 304 - config->sgls_nent[i], 302 + config->sgls_nent_pages[i], 305 303 config->dir); 306 304 307 305 sgl_free(config->sgls[i]); ··· 572 570 573 571 if (prd_table_index >= read_config->prd_tbl_num) { 574 572 dev_err_once(dev->dev, "PRD table index %d too big\n", prd_table_index); 573 + return -EINVAL; 574 + } 575 + 576 + if (!read_config->prd_tbls || !read_config->sgls[prd_table_index]) { 577 + dev_err_once(dev->dev, "PRD tables are not ready yet\n"); 575 578 return -EINVAL; 576 579 } 577 580
+2
drivers/hid/intel-thc-hid/intel-thc/intel-thc-dma.h
··· 91 91 * @dir: Direction of DMA for this config 92 92 * @prd_tbls: PRD tables for current DMA 93 93 * @sgls: Array of pointers to scatter-gather lists 94 + * @sgls_nent_pages: Number of pages per scatter-gather list 94 95 * @sgls_nent: Actual number of entries per scatter-gather list 95 96 * @prd_tbl_num: Actual number of PRD tables 96 97 * @max_packet_size: Size of the buffer needed for 1 DMA message (1 PRD table) ··· 108 107 109 108 struct thc_prd_table *prd_tbls; 110 109 struct scatterlist *sgls[PRD_TABLES_NUM]; 110 + u8 sgls_nent_pages[PRD_TABLES_NUM]; 111 111 u8 sgls_nent[PRD_TABLES_NUM]; 112 112 u8 prd_tbl_num; 113 113
+16 -1
drivers/hid/usbhid/hid-core.c
··· 985 985 struct usb_device *dev = interface_to_usbdev (intf); 986 986 struct hid_descriptor *hdesc; 987 987 struct hid_class_descriptor *hcdesc; 988 + __u8 fixed_opt_descriptors_size; 988 989 u32 quirks = 0; 989 990 unsigned int rsize = 0; 990 991 char *rdesc; ··· 1016 1015 (hdesc->bNumDescriptors - 1) * sizeof(*hcdesc)) { 1017 1016 dbg_hid("hid descriptor invalid, bLen=%hhu bNum=%hhu\n", 1018 1017 hdesc->bLength, hdesc->bNumDescriptors); 1019 - return -EINVAL; 1018 + 1019 + /* 1020 + * Some devices may expose a wrong number of descriptors compared 1021 + * to the provided length. 1022 + * However, we ignore the optional hid class descriptors entirely 1023 + * so we can safely recompute the proper field. 1024 + */ 1025 + if (hdesc->bLength >= sizeof(*hdesc)) { 1026 + fixed_opt_descriptors_size = hdesc->bLength - sizeof(*hdesc); 1027 + 1028 + hid_warn(intf, "fixing wrong optional hid class descriptors count\n"); 1029 + hdesc->bNumDescriptors = fixed_opt_descriptors_size / sizeof(*hcdesc) + 1; 1030 + } else { 1031 + return -EINVAL; 1032 + } 1020 1033 } 1021 1034 1022 1035 hid->version = le16_to_cpu(hdesc->bcdHID);
+2
tools/testing/selftests/hid/Makefile
··· 184 184 185 185 CLANG_SYS_INCLUDES = $(call get_sys_includes,$(CLANG)) 186 186 BPF_CFLAGS = -g -Werror -D__TARGET_ARCH_$(SRCARCH) $(MENDIAN) \ 187 + -Wno-microsoft-anon-tag \ 188 + -fms-extensions \ 187 189 -I$(INCLUDE_DIR) 188 190 189 191 CLANG_CFLAGS = $(CLANG_SYS_INCLUDES) \
+14
tools/testing/selftests/hid/tests/conftest.py
··· 5 5 # Copyright (c) 2017 Benjamin Tissoires <benjamin.tissoires@gmail.com> 6 6 # Copyright (c) 2017 Red Hat, Inc. 7 7 8 + from packaging.version import Version 8 9 import platform 9 10 import pytest 10 11 import re ··· 13 12 import subprocess 14 13 from .base import HIDTestUdevRule 15 14 from pathlib import Path 15 + 16 + 17 + @pytest.fixture(autouse=True) 18 + def hidtools_version_check(): 19 + HIDTOOLS_VERSION = "0.12" 20 + try: 21 + import hidtools 22 + 23 + version = hidtools.__version__ # type: ignore 24 + if Version(version) < Version(HIDTOOLS_VERSION): 25 + pytest.skip(reason=f"have hidtools {version}, require >={HIDTOOLS_VERSION}") 26 + except Exception: 27 + pytest.skip(reason=f"hidtools >={HIDTOOLS_VERSION} required") 16 28 17 29 18 30 # See the comment in HIDTestUdevRule, this doesn't set up but it will clean
+48 -13
tools/testing/selftests/hid/tests/test_multitouch.py
··· 9 9 from . import base 10 10 from hidtools.hut import HUT 11 11 from hidtools.util import BusType 12 + import enum 12 13 import libevdev 13 14 import logging 14 15 import pytest ··· 233 232 return 0 234 233 235 234 235 + class HIDButtonType(enum.IntEnum): 236 + CLICKPAD = 0 237 + PRESSUREPAD = 1 238 + DISCRETE_BUTTONS = 2 239 + 240 + 236 241 class PTP(Digitizer): 237 242 def __init__( 238 243 self, 239 244 name, 240 - type="Click Pad", 245 + buttontype=HIDButtonType.CLICKPAD, 241 246 rdesc_str=None, 242 247 rdesc=None, 243 248 application="Touch Pad", ··· 251 244 max_contacts=None, 252 245 input_info=None, 253 246 ): 254 - self.type = type.lower().replace(" ", "") 255 - if self.type == "clickpad": 256 - self.buttontype = 0 257 - else: # pressurepad 258 - self.buttontype = 1 247 + self.buttontype = buttontype 248 + 259 249 self.clickpad_state = False 260 250 self.left_state = False 261 251 self.right_state = False ··· 979 975 assert libevdev.InputEvent(libevdev.EV_ABS.ABS_MT_ORIENTATION, 90) in events 980 976 981 977 class TestPTP(TestWin8Multitouch): 978 + def test_buttontype(self): 979 + """Check for the right ButtonType.""" 980 + uhdev = self.uhdev 981 + assert uhdev is not None 982 + evdev = uhdev.get_evdev() 983 + 984 + # If libevdev.so is not yet compiled with INPUT_PROP_PRESSUREPAD 985 + # python-libevdev won't have it either, let's fake it 986 + if not getattr(libevdev, "INPUT_PROP_PRESSUREPAD", None): 987 + prop = libevdev.InputProperty(name="INPUT_PROP_PRESSUREPAD", value=0x7) 988 + libevdev.INPUT_PROP_PRESSUREPAD = prop 989 + libevdev.props.append(prop) 990 + 991 + if uhdev.buttontype == HIDButtonType.CLICKPAD: 992 + assert libevdev.INPUT_PROP_BUTTONPAD in evdev.properties 993 + elif uhdev.buttontype == HIDButtonType.PRESSUREPAD: 994 + assert libevdev.INPUT_PROP_PRESSUREPAD in evdev.properties 995 + else: 996 + assert libevdev.INPUT_PROP_PRESSUREPAD not in evdev.properties 997 + assert libevdev.INPUT_PROP_BUTTONPAD not in evdev.properties 998 + 982 999 def test_ptp_buttons(self): 983 1000 """check for button reliability. 984 - There are 2 types of touchpads: the click pads and the pressure pads. 985 - Each should reliably report the BTN_LEFT events. 1001 + There are 3 types of touchpads: click pads + pressure pads and 1002 + those with discrete buttons. Each should reliably report the BTN_LEFT events. 986 1003 """ 987 1004 uhdev = self.uhdev 988 1005 evdev = uhdev.get_evdev() 989 1006 990 - if uhdev.type == "clickpad": 1007 + if uhdev.buttontype in [HIDButtonType.CLICKPAD, HIDButtonType.PRESSUREPAD]: 991 1008 r = uhdev.event(click=True) 992 1009 events = uhdev.next_sync_events() 993 1010 self.debug_reports(r, uhdev, events) ··· 1020 995 self.debug_reports(r, uhdev, events) 1021 996 assert libevdev.InputEvent(libevdev.EV_KEY.BTN_LEFT, 0) in events 1022 997 assert evdev.value[libevdev.EV_KEY.BTN_LEFT] == 0 1023 - else: 998 + elif uhdev.buttontype == HIDButtonType.DISCRETE_BUTTONS: 1024 999 r = uhdev.event(left=True) 1025 1000 events = uhdev.next_sync_events() 1026 1001 self.debug_reports(r, uhdev, events) ··· 1943 1918 def create_device(self): 1944 1919 return PTP( 1945 1920 "uhid test dell_044e_1220", 1946 - type="pressurepad", 1921 + buttontype=HIDButtonType.DISCRETE_BUTTONS, 1947 1922 rdesc="05 01 09 02 a1 01 85 01 09 01 a1 00 05 09 19 01 29 03 15 00 25 01 75 01 95 03 81 02 95 05 81 01 05 01 09 30 09 31 15 81 25 7f 75 08 95 02 81 06 09 38 95 01 81 06 05 0c 0a 38 02 81 06 c0 c0 05 0d 09 05 a1 01 85 08 09 22 a1 02 15 00 25 01 09 47 09 42 95 02 75 01 81 02 95 01 75 03 25 05 09 51 81 02 75 01 95 03 81 03 05 01 15 00 26 af 04 75 10 55 0e 65 11 09 30 35 00 46 e8 03 95 01 81 02 26 7b 02 46 12 02 09 31 81 02 c0 55 0c 66 01 10 47 ff ff 00 00 27 ff ff 00 00 75 10 95 01 05 0d 09 56 81 02 09 54 25 05 95 01 75 08 81 02 05 09 19 01 29 03 25 01 75 01 95 03 81 02 95 05 81 03 05 0d 85 09 09 55 75 08 95 01 25 05 b1 02 06 00 ff 85 0a 09 c5 15 00 26 ff 00 75 08 96 00 01 b1 02 c0 06 01 ff 09 01 a1 01 85 03 09 01 15 00 26 ff 00 95 1b 81 02 85 04 09 02 95 50 81 02 85 05 09 03 95 07 b1 02 85 06 09 04 81 02 c0 06 02 ff 09 01 a1 01 85 07 09 02 95 86 75 08 b1 02 c0 05 0d 09 0e a1 01 85 0b 09 22 a1 02 09 52 15 00 25 0a 75 08 95 01 b1 02 c0 09 22 a1 00 85 0c 09 57 09 58 75 01 95 02 25 01 b1 02 95 06 b1 03 c0 c0", 1948 1923 ) 1949 1924 ··· 2043 2018 def create_device(self): 2044 2019 return PTP( 2045 2020 "uhid test elan_04f3_313a", 2046 - type="touchpad", 2021 + buttontype=HIDButtonType.DISCRETE_BUTTONS, 2047 2022 input_info=(BusType.I2C, 0x04F3, 0x313A), 2048 2023 rdesc="05 01 09 02 a1 01 85 01 09 01 a1 00 05 09 19 01 29 03 15 00 25 01 75 01 95 03 81 02 95 05 81 03 05 01 09 30 09 31 15 81 25 7f 75 08 95 02 81 06 75 08 95 05 81 03 c0 06 00 ff 09 01 85 0e 09 c5 15 00 26 ff 00 75 08 95 04 b1 02 85 0a 09 c6 15 00 26 ff 00 75 08 95 04 b1 02 c0 06 00 ff 09 01 a1 01 85 5c 09 01 95 0b 75 08 81 06 85 0d 09 c5 15 00 26 ff 00 75 08 95 04 b1 02 85 0c 09 c6 96 80 03 75 08 b1 02 85 0b 09 c7 95 82 75 08 b1 02 c0 05 0d 09 05 a1 01 85 04 09 22 a1 02 15 00 25 01 09 47 09 42 95 02 75 01 81 02 05 09 09 02 09 03 15 00 25 01 75 01 95 02 81 02 05 0d 95 01 75 04 25 0f 09 51 81 02 05 01 15 00 26 d7 0e 75 10 55 0d 65 11 09 30 35 00 46 44 2f 95 01 81 02 46 12 16 26 eb 06 26 eb 06 09 31 81 02 05 0d 15 00 25 64 95 03 c0 55 0c 66 01 10 47 ff ff 00 00 27 ff ff 00 00 75 10 95 01 09 56 81 02 09 54 25 7f 95 01 75 08 81 02 25 01 75 01 95 08 81 03 09 c5 75 08 95 02 81 03 05 0d 85 02 09 55 09 59 75 04 95 02 25 0f b1 02 85 07 09 60 75 01 95 01 15 00 25 01 b1 02 95 0f b1 03 06 00 ff 06 00 ff 85 06 09 c5 15 00 26 ff 00 75 08 96 00 01 b1 02 c0 05 0d 09 0e a1 01 85 03 09 22 a1 00 09 52 15 00 25 0a 75 10 95 01 b1 02 c0 09 22 a1 00 85 05 09 57 09 58 75 01 95 02 25 01 b1 02 95 0e b1 03 c0 c0 05 01 09 02 a1 01 85 2a 09 01 a1 00 05 09 19 01 29 03 15 00 25 01 75 01 95 03 81 02 95 05 81 03 05 01 09 30 09 31 15 81 25 7f 35 81 45 7f 55 00 65 13 75 08 95 02 81 06 75 08 95 05 81 03 c0 c0", 2049 2024 ) ··· 2080 2055 rdesc="05 01 09 02 a1 01 85 02 09 01 a1 00 05 09 19 01 29 02 15 00 25 01 75 01 95 02 81 02 95 06 81 01 05 01 09 30 09 31 15 81 25 7f 75 08 95 02 81 06 c0 c0 05 0d 09 05 a1 01 85 03 09 22 a1 02 15 00 25 01 09 47 09 42 95 02 75 01 81 02 95 01 75 03 25 05 09 51 81 02 75 01 95 03 81 03 05 01 15 00 26 1b 04 75 10 55 0e 65 11 09 30 35 00 46 6c 03 95 01 81 02 46 db 01 26 3b 02 09 31 81 02 05 0d c0 55 0c 66 01 10 47 ff ff 00 00 27 ff ff 00 00 75 10 95 01 09 56 81 02 09 54 25 7f 95 01 75 08 81 02 05 09 09 01 25 01 75 01 95 01 81 02 95 07 81 03 05 0d 85 08 09 55 09 59 75 04 95 02 25 0f b1 02 85 0d 09 60 75 01 95 01 15 00 25 01 b1 02 95 07 b1 03 85 07 06 00 ff 09 c5 15 00 26 ff 00 75 08 96 00 01 b1 02 c0 05 0d 09 0e a1 01 85 04 09 22 a1 02 09 52 15 00 25 0a 75 08 95 01 b1 02 c0 09 22 a1 00 85 06 09 57 09 58 75 01 95 02 25 01 b1 02 95 06 b1 03 c0 c0 06 00 ff 09 01 a1 01 85 09 09 02 15 00 26 ff 00 75 08 95 14 91 02 85 0a 09 03 15 00 26 ff 00 75 08 95 14 91 02 85 0b 09 04 15 00 26 ff 00 75 08 95 1a 81 02 85 0c 09 05 15 00 26 ff 00 75 08 95 1a 81 02 85 0f 09 06 15 00 26 ff 00 75 08 95 01 b1 02 85 0e 09 07 15 00 26 ff 00 75 08 95 01 b1 02 c0", 2081 2056 max_contacts=5, 2082 2057 input_info=(0x3, 0x06CB, 0x2968), 2058 + ) 2059 + 2060 + 2061 + class Testven_0488_108c(BaseTest.TestPTP): 2062 + def create_device(self): 2063 + return PTP( 2064 + "uhid test ven_0488_108c", 2065 + rdesc="05 01 09 02 a1 01 85 06 09 01 a1 00 05 09 19 01 29 03 15 00 25 01 95 03 75 01 81 02 95 01 75 05 81 03 05 01 09 30 09 31 09 38 15 81 25 7f 75 08 95 03 81 06 c0 c0 05 0d 09 05 a1 01 85 01 05 0d 09 22 a1 02 15 00 25 01 09 47 09 42 95 02 75 01 81 02 95 01 75 03 25 05 09 51 81 02 81 03 05 01 15 00 26 ba 0d 75 10 55 0e 65 11 09 30 35 00 46 d0 05 95 01 81 02 26 d0 06 46 bb 02 09 31 81 02 05 0d 95 01 75 10 26 ff 7f 46 ff 7f 09 30 81 02 c0 05 0d 09 22 a1 02 15 00 25 01 09 47 09 42 95 02 75 01 81 02 95 01 75 03 25 05 09 51 81 02 81 03 05 01 15 00 26 ba 0d 75 10 55 0e 65 11 09 30 35 00 46 d0 05 95 01 81 02 26 d0 06 46 bb 02 09 31 81 02 05 0d 95 01 75 10 26 ff 7f 46 ff 7f 09 30 81 02 c0 05 0d 09 22 a1 02 15 00 25 01 09 47 09 42 95 02 75 01 81 02 95 01 75 03 25 05 09 51 81 02 81 03 05 01 15 00 26 ba 0d 75 10 55 0e 65 11 09 30 35 00 46 d0 05 95 01 81 02 26 d0 06 46 bb 02 09 31 81 02 05 0d 95 01 75 10 26 ff 7f 46 ff 7f 09 30 81 02 c0 55 0c 66 01 10 47 ff ff 00 00 27 ff ff 00 00 75 10 95 01 05 0d 09 56 81 02 09 54 25 05 95 01 75 08 81 02 05 09 09 01 25 01 75 01 95 01 81 02 95 07 81 03 05 0d 85 02 09 55 75 08 95 01 25 05 b1 02 09 59 b1 02 06 00 ff 85 03 09 c5 15 00 26 ff 00 75 08 96 00 01 b1 02 05 0e 09 01 a1 02 85 13 09 23 15 00 25 64 75 08 95 01 b1 02 c0 c0 05 0d 09 0e a1 01 85 04 09 22 a1 02 09 52 15 00 25 0a 75 08 95 01 b1 02 c0 09 22 a1 00 85 05 09 57 09 58 75 01 95 02 25 01 b1 02 95 06 b1 03 c0 c0 06 01 ff 09 02 a1 01 09 00 85 07 15 00 26 ff 00 75 08 96 12 02 b1 02 c0 06 00 ff 09 01 a1 01 85 0d 15 00 26 ff 00 75 08 95 11 09 01 81 02 09 01 91 02 c0 05 0e 09 01 a1 01 85 11 09 35 15 00 26 ff 00 75 08 95 17 b1 02 c0 06 81 ff 09 01 a1 01 09 20 85 17 15 00 26 ff 00 75 08 95 3f 09 01 81 02 09 01 91 02 c0", 2066 + input_info=(0x18, 0x0488, 0x108C), 2067 + buttontype=HIDButtonType.PRESSUREPAD, 2083 2068 ) 2084 2069 2085 2070 ··· 2145 2110 def create_device(self): 2146 2111 return PTP( 2147 2112 "uhid test sipodev_0603_0002", 2148 - type="clickpad", 2113 + buttontype=HIDButtonType.CLICKPAD, 2149 2114 rdesc="05 01 09 02 a1 01 85 03 09 01 a1 00 05 09 19 01 29 02 25 01 75 01 95 02 81 02 95 06 81 03 05 01 09 30 09 31 15 80 25 7f 75 08 95 02 81 06 c0 c0 05 0d 09 05 a1 01 85 04 09 22 a1 02 15 00 25 01 09 47 09 42 95 02 75 01 81 02 75 01 95 02 81 03 95 01 75 04 25 05 09 51 81 02 05 01 15 00 26 44 0a 75 0c 55 0e 65 11 09 30 35 00 46 ac 03 95 01 81 02 46 fe 01 26 34 05 75 0c 09 31 81 02 05 0d c0 55 0c 66 01 10 47 ff ff 00 00 27 ff ff 00 00 75 10 95 01 09 56 81 02 09 54 25 0a 95 01 75 04 81 02 75 01 95 03 81 03 05 09 09 01 25 01 75 01 95 01 81 02 05 0d 85 0a 09 55 09 59 75 04 95 02 25 0f b1 02 85 0b 09 60 75 01 95 01 15 00 25 01 b1 02 95 07 b1 03 85 09 06 00 ff 09 c5 15 00 26 ff 00 75 08 96 00 01 b1 02 c0 05 0d 09 0e a1 01 85 06 09 22 a1 02 09 52 15 00 25 0a 75 08 95 01 b1 02 c0 09 22 a1 00 85 07 09 57 09 58 75 01 95 02 25 01 b1 02 95 06 b1 03 c0 c0 05 01 09 0c a1 01 85 08 15 00 25 01 09 c6 75 01 95 01 81 06 75 07 81 03 c0 05 01 09 80 a1 01 85 01 15 00 25 01 75 01 0a 81 00 0a 82 00 0a 83 00 95 03 81 06 95 05 81 01 c0 06 0c 00 09 01 a1 01 85 02 25 01 15 00 75 01 0a b5 00 0a b6 00 0a b7 00 0a cd 00 0a e2 00 0a a2 00 0a e9 00 0a ea 00 95 08 81 02 0a 83 01 0a 6f 00 0a 70 00 0a 88 01 0a 8a 01 0a 92 01 0a a8 02 0a 24 02 95 08 81 02 0a 21 02 0a 23 02 0a 96 01 0a 25 02 0a 26 02 0a 27 02 0a 23 02 0a b1 02 95 08 81 02 c0 06 00 ff 09 01 a1 01 85 05 15 00 26 ff 00 19 01 29 02 75 08 95 05 b1 02 c0", 2150 2115 ) 2151 2116