Skip to content

graphics/input: Add getevent input event monitor tool#3434

Open
HongChao6 wants to merge 4 commits intoapache:masterfrom
HongChao6:getevent
Open

graphics/input: Add getevent input event monitor tool#3434
HongChao6 wants to merge 4 commits intoapache:masterfrom
HongChao6:getevent

Conversation

@HongChao6
Copy link

Add getevent, a command-line utility for monitoring NuttX input devices
including mouse, touch, and keyboard events.

Features:

  • Automatic input device detection in /dev
  • Support for mouse (clicks/movement/wheel), multi-touch (coordinates/pressure),
    and keyboard (key codes/event types) monitoring
  • Command-line device path specification (-m, -t, -k flags)
  • Non-blocking I/O with 500ms timeout
  • Optional detailed debug output via CONFIG_GRAPHICS_INPUT_GETEVENT_DETAIL_INFO

Usage example:
getevent # auto-detect all input devices
getevent -m /dev/mouse0 # monitor specific mouse
getevent -t /dev/input0 # monitor specific touch device
getevent -k /dev/kbd0 # monitor specific keyboard

Copy link
Contributor

@cederom cederom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @HongChao6 very useful utility :-)

Please read https://github.com/apache/nuttx/blob/master/CONTRIBUTING.md and update git commit descriptions :-)

I am wondering if nuttx-apps/testing/input would not be a better fit for this tool? The main purpose is testing / input not really graphics right? Also exiting code in graphics/input? What do you think folks? :-)

HongChao6 and others added 3 commits March 25, 2026 14:07
Add getevent utility for monitoring input events including
mouse clicks/movement, multi-touch coordinates/pressure,
and keyboard key presses. Supports automatic device detection
in /dev and command-line device path specification with
non-blocking I/O.

Signed-off-by: liuhongchao <liuhongchao@xiaomi.com>
Fix format specifier mismatch where '%d' was used for int32_t
type argument. Use PRId32 macro instead to ensure portable
formatting across architectures.

Signed-off-by: tengshuangshuang <tengshuangshuang@xiaomi.com>
Fix volatile qualifier warning in pointer assignment.
Add errno logging for better error diagnostics.
Replace malloc with calloc for zero-initialized allocation.

Signed-off-by: liuhongchao <liuhongchao@xiaomi.com>
Remove README.md from apps repository. Documentation will be
added to the nuttx main repository under
Documentation/applications/testing/getevent/ in rst format.

Signed-off-by: liuhongchao <liuhongchao@xiaomi.com>
@HongChao6
Copy link
Author

Thank you @HongChao6 very useful utility :-)

Please read https://github.com/apache/nuttx/blob/master/CONTRIBUTING.md and update git commit descriptions :-)

I am wondering if nuttx-apps/testing/input would not be a better fit for this tool? The main purpose is testing / input not really graphics right? Also exiting code in graphics/input? What do you think folks? :-)

Thanks for the suggestion. The getevent tool shares the same input subsystem infrastructure with monkey and generator under graphics/input/. Moving getevent alone would split the input toolset.

If the community agrees that graphics/input is not the right place, I'd prefer to create a separate PR to move the entire graphics/input/ directory to testing/input/ together, rather than splitting them up in this PR.

What do you think?

@HongChao6 HongChao6 requested a review from cederom March 25, 2026 06:34
tristate "Enable getevent tool"
default n
---help---
Enable support for a command line getevent tool.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please include an explanation about what is the getevent, when and why the user will use it?

acassis

This comment was marked as outdated.

Copy link
Contributor

@acassis acassis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@HongChao6 please create a Documentation about this Graphics Input Getevent, I think we also need some basic Documentation about Graphics Input in general

@cederom
Copy link
Contributor

cederom commented Mar 25, 2026

@acassis is this input tightly coupled with graphics? if not and can be used as general input then maybe we should create a separate and dedicated nuttx-apps/input ? :-)

@acassis
Copy link
Contributor

acassis commented Mar 25, 2026

@acassis is this input tightly coupled with graphics? if not and can be used as general input then maybe we should create a separate and dedicated nuttx-apps/input ? :-)

AFAIK Graphics Input is mostly used to create Monkey testing events, but a generic Input device tester

@cederom
Copy link
Contributor

cederom commented Mar 25, 2026

Okay not to delay here we can put where existing input resides :-) Just an idea to uncover this functionality into its own space :-)

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