Skip to content

graphics/input: Add scroll command with Android-style syntax. - #4098

Merged
xiaoxiang781216 merged 1 commit into
apache:masterfrom
xiaoliud:input_scroll
Nov 23, 2026
Merged

xiaoxiang781216 merged 1 commit into
apache:masterfrom
xiaoliud:input_scroll

Conversation

@xiaoliud

Copy link
Copy Markdown
Contributor

Summary

Add input scroll and input scroll --axis SCROLL,. The
command sends one activation report of threshold + 1, then splits the
requested value into reports of max(1, |value| / 10), with the last
report carrying any remainder, 30 ms apart. This drives applications
that only start scrolling after a threshold. The existing wheel
command is unchanged.

Add input_gen_scroll() and GRAPHICS_INPUT_TOOL_SCROLL_THRESHOLD (default
10, range 0..32766).

Impact

  • New command, API and Kconfig option; existing commands unchanged.
  • The activation report is sent in addition to the requested value.
  • The axis name in --axis is not checked; only the number is used.
  • input_gen_scroll() converts interval_ms to microseconds, so callers
    must keep it below UINT32_MAX / 1000. The command always passes 30.

Testing

  • Host: Ubuntu 22.04 x86_64, gcc 13.1.0; sim:nsh with CONFIG_GRAPHICS_INPUT_TOOL=y
    and CONFIG_INPUT_MOUSE_WHEEL=y. Wheel reports were read from /dev/umouse
    with examples/touchscreen (tc, CONFIG_EXAMPLES_TOUCHSCREEN_MOUSE=y).
  • scroll 100 -> 11, then 10 x 10. scroll --axis SCROLL,-50 -> -11,
    then 10 x -5. scroll 0 sends nothing;scroll abc and scroll 40000
    (outside int16_t) send no report and print the usage text.
  • Kconfig: 0 and 32766 are kept; 32767 and -1 fall back to 10.
  • checkpatch.sh -c -u -m -g: pass.
  • No hardware testing performed.

Comment thread graphics/input/generator/input.c Resolved
Comment thread graphics/input/generator/input.c Resolved
@cederom

cederom commented Nov 20, 2026

Copy link
Copy Markdown
Contributor
  • Thank you @xiaoliud very nice and useful feature! :-)
  • Only minor remarks on my side.
  • CI failure seems to come outside, we need to wait for the fix before build restart and merge.

@cederom

cederom commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

CI fix in place retarting the CI :-)

Add input scroll <value> and input scroll --axis SCROLL,<value> to
inject a sequence of mouse wheel reports. Send an initial activation
report followed by paced reports that split the requested value into
smaller steps.

Provide input_gen_scroll() for chunked writes with a configurable
interval and GRAPHICS_INPUT_TOOL_SCROLL_THRESHOLD for applications
that require a scroll activation threshold. Keep the existing wheel
command for a single report.

Assisted-by: OpenCode:claude-opus-5-5
Signed-off-by: liuchan3 <liuchan3@xiaomi.com>
@xiaoliud

Copy link
Copy Markdown
Contributor Author

Thanks for the review! Addressed all three comments in the updated commit.

@xiaoxiang781216
xiaoxiang781216 merged commit 10ce31d into apache:master Nov 23, 2026
41 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants