arch/sim: Add Mouse emulation - #19812
Merged
Merged
Conversation
acassis
requested review from
GUIDINGLI,
jerpelea,
raiden00pl and
xiaoxiang781216
as code owners
August 12, 2026 13:54
This commit adds basic information about SIM Input support. Signed-off-by: Alan C. Assis <acassis@gmail.com>
This commit adds support for three buttons Mouse emulation on SIM. Signed-off-by: Alan C. Assis <acassis@gmail.com> Assisted-by: Claude Code
As suggested by Xiang Xiao, let's fix the identation Signed-off-by: Alan C. Assis <acassis@gmail.com>
Contributor
Author
|
@ppisa I think this PR will be useful to test Microwindo/Nano-X on NuttX SIM |
xiaoxiang781216
approved these changes
Aug 12, 2026
simbit18
approved these changes
Aug 12, 2026
linguini1
requested changes
Aug 12, 2026
|
|
||
| The Sim can emulate buttons, keyboard, touchscreen-mouse based, mouse with 3 buttons and analog-mouse based joystick. | ||
|
|
||
| These drivers are particularly useful for graphical applications emulared over X11. |
| Keyboard | ||
| ======== | ||
|
|
||
| There are two types of keyboards: is native one used by default on NuttX SIM, since it is used to access the NuttShell interface and the ``CONFIG_SIM_KEYBOARD`` used with graphical applications. |
| ===== | ||
|
|
||
| The driver emulates a Mouse with 3 buttons support. It can be enabled using the | ||
| symbol: ``CONFIG_SIM_MOUSE``. This driver is useful with used with more advanced interfaces like Microwindow/Nano-X that require at least left and right click buttons events. |
Contributor
There was a problem hiding this comment.
Is there a doc page to link to for nano x yet or no? If there is it would be good to backlink
| Touchscreen | ||
| =========== | ||
|
|
||
| The difference between this driver and the Mouse is because this only generates a pen-down event when the user click in the interface. It is useful to use with LVGL graphic interface. |
Contributor
There was a problem hiding this comment.
*is that this only generates
*when the user clicks
*with the LVGL
Comment on lines
+101
to
+106
| * undifferentiated "pen down" bit -- the whole point of | ||
| * CONFIG_SIM_MOUSE over CONFIG_SIM_TOUCHSCREEN is to keep which | ||
| * physical button was pressed. Not including that header here since | ||
| * it's the only thing that would pull NuttX input headers into this | ||
| * host-compiled (HOSTSRCS) file; the three bit values are hand-rolled | ||
| * instead, matching MOUSE_BUTTON_1=1, MOUSE_BUTTON_2=2, MOUSE_BUTTON_3=4. |
Contributor
There was a problem hiding this comment.
I think everything after "pen down bit" is extra info that doesn't really describe the function. It's quite "AI sounding".
|
|
||
| priv->eventloop = 1; | ||
|
|
||
| /* And return success */ |
| struct sim_dev_s *priv = (struct sim_dev_s *)&g_simmouse; | ||
| char devname[DEV_NAMELEN]; | ||
|
|
||
| /* Stop the event loop (Hmm.. the caller must be sure that there are no |
Contributor
There was a problem hiding this comment.
Maybe we can state this assumption in the function comment? I've seen other NuttX functions use the "Assumptions" field.
Contributor
|
@acassis Nice work. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds Mouse emulation with 3 buttons support to NuttX SIM
Impact
NuttX users could use more advanced features with using mouse with Microwindow/Nano-X
Testing
SIM: