Skip to content
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

40 yaft locks console #58

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions fb/linux.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ bool set_fbinfo(int fd, struct fb_info_t *info)
if (ioctl(fd, FBIOPUT_VSCREENINFO, &vinfo))
logging(WARN, "couldn't reset offset (x:%d y:%d)\n", vinfo.xoffset, vinfo.yoffset);
}
vinfo.activate = FB_ACTIVATE_NOW | FB_ACTIVATE_FORCE;
ioctl(fd, FBIOPUT_VSCREENINFO, &vinfo);

return true;
}
16 changes: 8 additions & 8 deletions yaft.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ void sig_handler(int signo)

if (BACKGROUND_DRAW) { /* update passive cursor */
need_redraw = true;
} else { /* sleep until next vt switching */
} else { /* sleep until next vt switching */
sigfillset(&sigset);
sigdelset(&sigset, SIGUSR1);
sigsuspend(&sigset);
Expand Down Expand Up @@ -62,7 +62,7 @@ bool tty_init(struct termios *termios_orig)

memset(&sigact, 0, sizeof(struct sigaction));
sigact.sa_handler = sig_handler;
sigact.sa_flags = SA_RESTART;
sigact.sa_flags = SA_RESTART;
esigaction(SIGCHLD, &sigact, NULL);

if (VT_CONTROL) {
Expand Down Expand Up @@ -94,7 +94,7 @@ bool tty_init(struct termios *termios_orig)

void tty_die(struct termios *termios_orig)
{
/* no error handling */
/* no error handling */
struct sigaction sigact;
struct vt_mode vtm;

Expand Down Expand Up @@ -170,6 +170,11 @@ int main(int argc, char *const argv[])
if (setlocale(LC_ALL, "") == NULL) /* for wcwidth() */
logging(WARN, "setlocale falied\n");

if (!tty_init(&termios_orig)) {
logging(FATAL, "tty initialize failed\n");
goto tty_init_failed;
}

if (!fb_init(&fb)) {
logging(FATAL, "framebuffer initialize failed\n");
goto fb_init_failed;
Expand All @@ -180,11 +185,6 @@ int main(int argc, char *const argv[])
goto term_init_failed;
}

if (!tty_init(&termios_orig)) {
logging(FATAL, "tty initialize failed\n");
goto tty_init_failed;
}

/* fork and exec shell */
cmd = (argc < 2) ? shell_cmd: argv[1];
if (!fork_and_exec(&term.fd, cmd, argv + 1, term.lines, term.cols)) {
Expand Down