linux-stable/drivers/hid
Hamish Martin 77a24b8f3c HID: mcp2221: Handle reads greater than 60 bytes
commit 2682468671 upstream.

When a user requests more than 60 bytes of data the MCP2221 must chunk
the data in chunks up to 60 bytes long (see command/response code 0x40
in the datasheet).
In order to signal that the device has more data the (undocumented) byte
at byte index 2 of the Get I2C Data response uses the value 0x54. This
contrasts with the case for the final data chunk where the value
returned is 0x55 (MCP2221_I2C_READ_COMPL). The fact that 0x55 was not
returned in the response was interpreted by the driver as a failure
meaning that all reads of more than 60 bytes would fail.

Add support for reads that are split over multiple chunks by looking for
the response code indicating that more data is expected and continuing
the read as the code intended. Some timing delays are required to ensure
the chip has time to refill its FIFO as data is read in from the I2C
bus. This timing has been tested in my system when configured for bus
speeds of 50KHz, 100KHz, and 400KHz and operates well.

Signed-off-by: Hamish Martin <hamish.martin@alliedtelesis.co.nz>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Fixes: 67a95c2146 ("HID: mcp2221: add usb to i2c-smbus host bridge")
[romain.sioen@microchip.com: backport to stable, up to 6.8. Add "Fixes" tag]
Signed-off-by: Romain Sioen <romain.sioen@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-09-04 15:26:31 +02:00
..
amd-sfh-hid
i2c-hid HID: i2c-hid: improve i2c_hid_get_report error message 2025-04-10 14:33:39 +02:00
intel-ish-hid HID: intel-ish-hid: Send clock sync message immediately after reset 2025-03-28 21:58:51 +01:00
surface-hid
usbhid HID: usbhid: Eliminate recurrent out-of-bounds bug in usbhid_parse() 2025-06-27 11:07:24 +01:00
.kunitconfig
hid-a4tech.c
hid-accutouch.c
hid-alps.c
hid-apple.c HID: apple: avoid setting up battery timer for devices without battery 2025-08-28 16:26:05 +02:00
hid-appleir.c HID: appleir: Fix potential NULL dereference at raw event handle 2025-03-13 12:53:12 +01:00
hid-asus.c HID: asus: fix UAF via HID_CLAIMED_INPUT validation 2025-09-04 15:26:29 +02:00
hid-aureal.c
hid-axff.c
hid-belkin.c
hid-betopff.c
hid-bigbenff.c
hid-cherry.c
hid-chicony.c
hid-cmedia.c
hid-core.c HID: core: do not bypass hid_hw_raw_request 2025-07-24 08:51:48 +02:00
hid-corsair.c
hid-cougar.c
hid-cp2112.c
hid-creative-sb0540.c
hid-cypress.c
hid-debug.c
hid-dr.c
hid-elan.c
hid-elecom.c
hid-elo.c
hid-emsff.c
hid-ezkey.c
hid-ft260.c
hid-gaff.c
hid-gembird.c
hid-generic.c
hid-gfrm.c
hid-glorious.c
hid-google-hammer.c HID: google: fix unused variable warning under !CONFIG_ACPI 2025-03-13 12:53:16 +01:00
hid-gt683r.c
hid-gyration.c
hid-holtek-kbd.c
hid-holtek-mouse.c
hid-holtekff.c
hid-hyperv.c HID: usbhid: Eliminate recurrent out-of-bounds bug in usbhid_parse() 2025-06-27 11:07:24 +01:00
hid-icade.c
hid-ids.h HID: quirks: Add quirk for 2 Chicony Electronics HP 5MP Cameras 2025-07-17 18:32:14 +02:00
hid-input-test.c HID: input: rename hidinput_set_battery_charge_status() 2025-09-04 15:26:26 +02:00
hid-input.c HID: input: report battery status changes immediately 2025-09-04 15:26:26 +02:00
hid-ite.c
hid-jabra.c
hid-kensington.c
hid-keytouch.c
hid-kye.c
hid-lcpower.c
hid-led.c
hid-lenovo.c HID: lenovo: Add support for ThinkPad X1 Tablet Thin Keyboard Gen2 2025-07-17 18:32:14 +02:00
hid-letsketch.c
hid-lg2ff.c
hid-lg3ff.c
hid-lg4ff.c
hid-lg4ff.h
hid-lg-g15.c
hid-lg.c
hid-lg.h
hid-lgff.c
hid-logitech-dj.c
hid-logitech-hidpp.c
hid-macally.c
hid-magicmouse.c HID: magicmouse: avoid setting up battery timer when not needed 2025-08-28 16:26:05 +02:00
hid-maltron.c
hid-mcp2221.c HID: mcp2221: Handle reads greater than 60 bytes 2025-09-04 15:26:31 +02:00
hid-megaworld.c
hid-mf.c
hid-microsoft.c
hid-monterey.c
hid-multitouch.c HID: multitouch: fix slab out-of-bounds access in mt_report_fixup() 2025-09-04 15:26:29 +02:00
hid-nintendo.c
hid-nti.c
hid-ntrig.c HID: hid-ntrig: fix unable to handle page fault in ntrig_report_version() 2025-09-04 15:26:29 +02:00
hid-ortek.c
hid-penmount.c
hid-petalynx.c
hid-picolcd_backlight.c
hid-picolcd_cir.c
hid-picolcd_core.c
hid-picolcd_debugfs.c
hid-picolcd_fb.c
hid-picolcd_lcd.c
hid-picolcd_leds.c
hid-picolcd.h
hid-pl.c
hid-plantronics.c HID: hid-plantronics: Add mic mute mapping and generalize quirks 2025-04-07 10:05:44 +02:00
hid-playstation.c
hid-primax.c
hid-prodikeys.c
hid-pxrc.c
hid-quirks.c HID: quirks: Add quirk for 2 Chicony Electronics HP 5MP Cameras 2025-07-17 18:32:14 +02:00
hid-razer.c
hid-redragon.c
hid-retrode.c
hid-rmi.c
hid-roccat-arvo.c
hid-roccat-arvo.h
hid-roccat-common.c
hid-roccat-common.h
hid-roccat-isku.c
hid-roccat-isku.h
hid-roccat-kone.c
hid-roccat-kone.h
hid-roccat-koneplus.c
hid-roccat-koneplus.h
hid-roccat-konepure.c
hid-roccat-kovaplus.c
hid-roccat-kovaplus.h
hid-roccat-lua.c
hid-roccat-lua.h
hid-roccat-pyra.c
hid-roccat-pyra.h
hid-roccat-ryos.c
hid-roccat-savu.c
hid-roccat-savu.h
hid-roccat.c
hid-saitek.c
hid-samsung.c
hid-semitek.c
hid-sensor-custom.c
hid-sensor-hub.c HID: hid-sensor-hub: don't use stale platform-data on remove 2025-02-21 13:49:42 +01:00
hid-sigmamicro.c
hid-sjoy.c
hid-sony.c
hid-speedlink.c
hid-steam.c
hid-steelseries.c
hid-sunplus.c
hid-thrustmaster.c HID: thrustmaster: fix memory leak in thrustmaster_interrupts() 2025-05-22 14:10:01 +02:00
hid-tivo.c
hid-tmff.c
hid-topre.c
hid-topseed.c
hid-twinhan.c
hid-u2fzero.c
hid-uclogic-core.c HID: uclogic: Add NULL check in uclogic_input_configured() 2025-05-22 14:10:01 +02:00
hid-uclogic-params-test.c
hid-uclogic-params.c
hid-uclogic-params.h
hid-uclogic-rdesc-test.c
hid-uclogic-rdesc.c
hid-uclogic-rdesc.h
hid-udraw-ps3.c
hid-viewsonic.c
hid-vivaldi-common.c
hid-vivaldi-common.h
hid-vivaldi.c
hid-vrc2.c
hid-waltop.c
hid-wiimote-core.c
hid-wiimote-debug.c
hid-wiimote-modules.c
hid-wiimote.h
hid-xiaomi.c
hid-xinmo.c
hid-zpff.c
hid-zydacron.c
hidraw.c
Kconfig
Makefile HID: remove superfluous (and wrong) Makefile entry for CONFIG_INTEL_ISH_FIRMWARE_DOWNLOADER 2025-04-10 14:33:31 +02:00
uhid.c
wacom_sys.c HID: wacom: fix kobject reference count leak 2025-07-06 10:58:01 +02:00
wacom_wac.c HID: wacom: Add a new Art Pen 2 2025-09-04 15:26:29 +02:00
wacom_wac.h
wacom.h