Hide active tty cursor on POSIX fbdev

This commit is contained in:
Kuba Szczodrzyński 2024-02-09 23:47:18 +01:00
parent 6bfe89cac0
commit de0aeab435
No known key found for this signature in database
GPG Key ID: 43037AC62A600562

View File

@ -29,6 +29,7 @@
#include <dirent.h>
#include <fcntl.h>
#include <algorithm>
#include <fstream>
#if USE_BSD_EVDEV
#include <dev/evdev/input.h>
@ -82,6 +83,23 @@ static void* gui_entrypoint(void* arg)
void TftFbdevDrv::init(int32_t w, int h)
{
// check active tty
std::ifstream f;
f.open("/sys/class/tty/tty0/active");
std::string tty;
f >> tty;
tty = "/dev/" + tty;
f.close();
// try to hide the cursor
int tty_fd = open(tty.c_str(), O_WRONLY);
if(tty_fd == -1) {
perror("Couldn't open tty");
} else {
write(tty_fd, "\033[?25l", 6);
}
close(tty_fd);
/* Add a display
* Use the 'fbdev' driver which uses POSIX framebuffer device as a display
* The following input devices are handled: mouse, keyboard, mousewheel */