Skip to content

i2c-hid: fixes for unnumbered reports and other improvements

Dmitry Torokhov linux-input lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest12 patches 7 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/12HID: i2c-hid: fix handling numbered reports with IDs of 15 and abovedrivers/hid/i2c-hid/i2c-hid-core.c+10 -140 replies
2/12HID: i2c-hid: fix GET/SET_REPORT for unnumbered reportsdrivers/hid/i2c-hid/i2c-hid-core.c+24 -81 reply
3/12HID: i2c-hid: use "struct i2c_hid" as argument in most callsdrivers/hid/i2c-hid/i2c-hid-core.c+36 -390 replies
4/12HID: i2c-hid: refactor reset commanddrivers/hid/i2c-hid/i2c-hid-core.c+38 -250 replies
5/12HID: i2c-hid: explicitly code setting and sending reportsdrivers/hid/i2c-hid/i2c-hid-core.c+151 -1182 replies
6/12HID: i2c-hid: define i2c_hid_read_register() and use itdrivers/hid/i2c-hid/i2c-hid-core.c+22 -230 replies
7/12HID: i2c-hid: create a helper for SET_POWER commanddrivers/hid/i2c-hid/i2c-hid-core.c+18 -40 replies
8/12HID: i2c-hid: convert i2c_hid_execute_reset() to use i2c_hid_xfer()drivers/hid/i2c-hid/i2c-hid-core.c+9 -100 replies
9/12HID: i2c-hid: rework i2c_hid_get_report() to use i2c_hid_xfer()drivers/hid/i2c-hid/i2c-hid-core.c+59 -910 replies
10/12HID: i2c-hid: use helpers to do endian conversion in i2c_hid_get_input()drivers/hid/i2c-hid/i2c-hid-core.c+15 -150 replies
11/12HID: i2c-hid: no longer need raw access to HID descriptor structuredrivers/hid/i2c-hid/i2c-hid-core.c+2 -50 replies
12/12HID: i2c-hid: note that I2C xfer buffers are DMA-safedrivers/hid/i2c-hid/i2c-hid-core.c+3 -20 replies

Reviews trailers per patch

None of the 12 patches has a Reviewed-by or Acked-by.

PatchBenjamin Tissoires
SeriesT-b
1/12
2/12
3/12
4/12
5/12
6/12
7/12
8/12
9/12
10/12
11/12
12/12

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 00/12] i2c-hid: fixes for unnumbered reports and other improvements

Hi,

This series came about after I reviewed Angela's patch that fixed issues with incorrect handling of high-numbered reports (15 and above) in i2c-hid driver:

- it appears to me that the driver did not handle unnumbered reports correctly as the kernel internally expects unnumbered reports to be still prepended with report number 0, but i2c_hid_get_raw_report() and i2c_hid_output_raw_report() only expected report ID to be present for numbered reports.

- the driver tried to consolidate both command handling and sending output reports in __i2c_hid_command() but the rules for different commands vary significantly and because of that the logic was hard to follow and it bled out from __i2c_hid_command() to callers. I decided to introduce a few simple helpers and have the data encoding for individual commands done at the call site. I believe this made it easier to validate the rules and the logic and allowed to remove special handling for the HID descriptor retrieval, among other things.

- the driver does too many copying of data; encoding the data for commands at the call site allowed to only copy data once into the transfer buffers.

I tested this on a couple of Chromebooks with i2c-hid touchscreens, but it would be great if other folks tried it out as well.

Thanks.

Angela Czubak (1):
HID: i2c-hid: fix handling numbered reports with IDs of 15 and above

Dmitry Torokhov (11):
HID: i2c-hid: fix GET/SET_REPORT for unnumbered reports
HID: i2c-hid: use "struct i2c_hid" as argument in most calls
HID: i2c-hid: refactor reset command
HID: i2c-hid: explicitly code setting and sending reports
HID: i2c-hid: define i2c_hid_read_register() and use it
HID: i2c-hid: create a helper for SET_POWER command
HID: i2c-hid: convert i2c_hid_execute_reset() to use i2c_hid_xfer()
HID: i2c-hid: rework i2c_hid_get_report() to use i2c_hid_xfer()
HID: i2c-hid: use helpers to do endian conversion in i2c_hid_get_input()
HID: i2c-hid: no longer need raw access to HID descriptor structure
HID: i2c-hid: note that I2C xfer buffers are DMA-safe

 drivers/hid/i2c-hid/i2c-hid-core.c | 593 +++++++++++++++--------------
 1 file changed, 313 insertions(+), 280 deletions(-)
Signature · 1 line
Dmitry