-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support Linux framebuffer and input system #15
Conversation
I believe we need to modify the |
Simply use environment variable such as "FRAMEBUFFER". |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Always use "fbdev" instead of ambiguous “fb" in all occurrences.
f76271e
to
c8bb608
Compare
We can now run sample program with Linux framebuffer using: sudo FRAMEBUFFER=/dev/fb0 ./demo-fbdev |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refine the callback functions passing to twin_screen_create
.
1cfa91e
to
888355f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rebase the latest main
branch, which contains a preliminary mouse manipulation feature, meaning that the cursor can be rendered along with input events supported via the Linux input subsystem.
It is quite interesting that seems Ubuntu allocates VT2 for Wayland or X11 server (Not sure about other distributions):
This implies that Also, Reference: What is the purpose of /usr/lib/xorg/Xorg vt2 -displayfd 3? |
The composite key to trigger VT switching is not fixed, meaning the behavior can vary significantly between Linux distributions. Mado is not necessarily designed to co-exist with the X server or Wayland display server. Instead, it is intended to operate with the Linux framebuffer, similar to FBUI. You can include a note about VT switching without specifying the exact keystrokes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rebase the latest main
branch and utilize the logging functions.
This comment was marked as outdated.
This comment was marked as outdated.
return NULL; | ||
} | ||
|
||
static bool dummy(int file, twin_file_op_t ops, void *closure) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The dummy
is a hack though.
#endif | ||
|
||
/* Start event handling thread */ | ||
if (pthread_create(&tm->evdev_thread, NULL, twin_linux_evdev_thread, tm)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TWIN (and by extension, Mado) was designed to operate in single-threaded environments, and it is not reasonable to assume POSIX threads are available everywhere. Be sure to note the use of POSIX threads in the git commit messages for the Linux framebuffer backend. Coroutines could potentially be used as an alternative.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reference on Coroutine in C:
#4 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Append Close #3
at the end of the git commit messages. You should refine the commit message to clearly state what has been accomplished and outline any remaining tasks for further improvements.
This commit adds a Linux framebuffer backend to Mado, utilizing framebuffer and event devices for basic input and display. Note that though TWIN (and by extension, Mado) was designed to operate in single-threaded environments, the Linux framebuffer backend in Mado currently uses POSIX thread to manage input system events. Coroutines could potentially be used as an alternative. Follow-up tasks: 1. Protect mouse event update with mutex (see linux_input.c) 2. Fix an existing unexpected termination bug (see linux_input.c) 3. Support DRM/KMS backend 4. Support hot-pluging and removal of input devices via udev 5. Refine event handling (i.e., remove POSIX thread if possible) Close sysprog21#3
Thank @shengwen-tw for contributing! |
This pull request introduces Linux framebuffer backend and mouse event handling for
Mado
.To test the introduced feature:
Ctrl+Alt+F3
to switch to new virtual terminal.The user should see the following result on the screen:
After finished testing, the user can switch back to the desktop with
Ctrl+Alt+F1
.