Skip to content

Input: ilitek_ts: add stylus support for 0x0c reports

Kristian Mide linux-input lkml 3 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest3 patches 0 repliesNew
  2. v23 patches 0 repliesSuperseded
  3. v12 patches 0 repliesSuperseded

Changes in v3 from the cover letter

- return success after ratelimited unexpected-report logging so the IRQ handler does not emit a second unratelimited error
- use input_set_capability() for pen key capabilities

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3Input: ilitek_ts: add stylus input supportdrivers/input/touchscreen/ilitek_ts_i2c.c+134 -30 replies
2/3Input: ilitek_ts: handle short I2C transfersdrivers/input/touchscreen/ilitek_ts_i2c.c+6 -00 replies
3/3Input: ilitek_ts: ratelimit unexpected report loggingdrivers/input/touchscreen/ilitek_ts_i2c.c+4 -20 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v3 yet.

Read the v3 thread

Cover letter [PATCH v3 0/3] Input: ilitek_ts: add stylus support for 0x0c reports

Hi,

I bought a CHUWI Hi10 Max and was annoyed to find that the built-in stylus was not usable with the upstream ilitek_ts driver.

This series adds support for the pen report format emitted by the device, exposing the stylus as a separate input device with hover, pressure, and side-button support. The pen device is created lazily on first pen report so touchscreen-only hardware does not advertise stylus capabilities up front.

The packet format was reverse engineered on this device. In particular, report ID 0x0c appears to carry pen events, pressure comes from buf[6..7] shifted right by one, and the side buttons map to two bits in buf[1].

Changes in v3:
- return success after ratelimited unexpected-report logging so the IRQ handler does not emit a second unratelimited error
- use input_set_capability() for pen key capabilities

Changes in v2:
- manage the lazy pen device lifetime explicitly and tear down the IRQ before unregistering the pen device
- sync pen axis limits with the DT-adjusted touch axis limits
- reject short I2C transfers in ilitek_i2c_write_and_read()
- split the short-transfer fix from the ratelimited logging change

On the tested CHUWI Hi10 Max this makes the pen usable in GNOME/Krita, including pressure and side buttons.

Thanks,
Kristian

Kristian Mide (3):
Input: ilitek_ts: add stylus input support
Input: ilitek_ts: handle short I2C transfers
Input: ilitek_ts: ratelimit unexpected report logging

 drivers/input/touchscreen/ilitek_ts_i2c.c | 149 +++++++++++++++++++++-
 1 file changed, 144 insertions(+), 5 deletions(-)
Signature · 1 line
2.54.0