graphics/input: Add getevent input event monitor tool#3434
graphics/input: Add getevent input event monitor tool#3434HongChao6 wants to merge 1 commit intoapache:masterfrom
Conversation
There was a problem hiding this comment.
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? :-)
4b49bd9 to
9413590
Compare
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? |
acassis
left a comment
There was a problem hiding this comment.
@HongChao6 please create a Documentation about this Graphics Input Getevent, I think we also need some basic Documentation about Graphics Input in general
|
@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 |
|
Okay not to delay here we can put where existing input resides :-) Just an idea to uncover this functionality into its own space :-) |
cederom
left a comment
There was a problem hiding this comment.
TODO :-)
- PR description.
- Documentation.
- Kconfig description.
|
I have created a dedicated issue for discussion of input location #3436 :-) |
3796c6e
|
Hi @HongChao6, this error is not related to this PR You will need to wait for this PR #3440 to be merged, after which you will need to rebase |
Thanks for the heads up! I'll rebase once #3440 is merged. |
|
@HongChao6 please rebase |
be70cf1 to
d7ce4f6
Compare
|
@simbit18 The xtensa-03 failure is unrelated to this PR. It's caused by the Xtensa common-source integration update (nuttx#18614) which requires new Kconfig options for ESP32-S3 defconfigs. See esp_irq.c:125 compile error. |
|
Hi @JianyuWang0623, could you please check? |
@simbit18 The fix commit is currently undergoing CI checks: apache/nuttx#18650 |
|
@JianyuWang0623 Thank you very much |
|
Hi @HongChao6 , can you please include the impact and test sections in your PR from the contribution guide? |
|
Hi @HongChao6 please rebase PR apache/nuttx#18650 has been merged |
|
Looks good besides a few small comments! |
|
Thanks for the review @linguini1! I agree with the GETEVENT_ERR macro and printf for show_usage — those changes make sense and I'll apply them. Regarding GETEVENT_INFO and LOG_INFO: since getevent is an interactive command-line tool where the event data output is directly requested by the user, I'm wondering if printf (stdout) would be a better fit here as well, rather than syslog at any level. My reasoning: Event data is user-facing output, not system log messages |
|
Go with printf! |
|
I suppose similarly, wouldn't you want to use fprintf to stderr instead of syslog errors? You can also remove the macros entirely and directly write printf since they're just wrappers. |
Good point, I'll switch GETEVENT_ERR to use fprintf(stderr, ...) instead of syslog. I'd prefer to keep the macros though — they provide a consistent [getevent]: prefix across all output, so if the format ever needs to change, it's a single-line edit. Without them, the prefix string would be duplicated in every call site. I'll update and push shortly. |
|
Forgot about the prefix, makes sense! |
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>
Summary
Add
getevent, a command-line input event monitor that captures and displays real-time events from input devices.What
geteventcaptures and displays real-time input events from mouse, touchscreen, and keyboard devices. It reads from input device nodes (/dev/mouse*,/dev/input*,/dev/kbd*) using non-blocking I/O withpoll(), and prints structured event data viasyslog.Supported event types:
When / Why
This tool is useful during:
Without
getevent, developers must write ad-hoc test programs or read device nodes manually to verify input behavior. This tool provides a ready-made, consistent way to do so.Usage
Press
Ctrl+Cto stop.Configuration
Impact
geteventcommand-line tool added undergraphics/input/.CONFIG_GRAPHICS_INPUT_GETEVENTis explicitly enabled.Testing
I confirm that changes are verified on local setup and works as intended:
Testing logs (runtime):
PR verification Self-Check