diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2016-03-24 09:20:31 +0100 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2016-03-24 09:20:31 +0100 |
commit | 3655da117134ca0cce8dc58bc08ec23c5ebb4ec7 (patch) | |
tree | 696644c1653fd6494fc8fd93e87403f96588aa20 | |
parent | 519d0b165c38854e9ece43907e1dffc1c659dbb4 (diff) | |
download | fbida-3655da117134ca0cce8dc58bc08ec23c5ebb4ec7.tar.gz |
move console_activate_current
-rw-r--r-- | fbtools.c | 22 | ||||
-rw-r--r-- | vt.c | 25 | ||||
-rw-r--r-- | vt.h | 1 |
3 files changed, 25 insertions, 23 deletions
@@ -203,26 +203,6 @@ fb_setmode(char *name) return -1; } -/* Hmm. radeonfb needs this. matroxfb doesn't. */ -static int fb_activate_current(int tty) -{ - struct vt_stat vts; - - if (-1 == ioctl(tty,VT_GETSTATE, &vts)) { - perror("ioctl VT_GETSTATE"); - return -1; - } - if (-1 == ioctl(tty,VT_ACTIVATE, vts.v_active)) { - perror("ioctl VT_ACTIVATE"); - return -1; - } - if (-1 == ioctl(tty,VT_WAITACTIVE, vts.v_active)) { - perror("ioctl VT_WAITACTIVE"); - return -1; - } - return 0; -} - static void fb_restore_display(void) { ioctl(fb,FBIOPAN_DISPLAY,&fb_var); @@ -356,7 +336,7 @@ gfxstate* fb_init(char *device, char *mode, int vt) perror("ioctl KDSETMODE"); goto err; } - fb_activate_current(tty); + console_activate_current(tty); /* cls */ fb_memset(fb_mem+fb_mem_offset, 0, fb_fix.line_length * fb_var.yres); @@ -120,7 +120,7 @@ void console_set_vt(int vtno) char vtname[12]; if (vtno < 0) { - if (-1 == ioctl(tty,VT_OPENQRY, &vtno) || vtno == -1) { + if (-1 == ioctl(tty, VT_OPENQRY, &vtno) || vtno == -1) { perror("ioctl VT_OPENQRY"); exit(1); } @@ -133,6 +133,8 @@ void console_set_vt(int vtno) fprintf(stderr,"access %s: %s\n",vtname,strerror(errno)); exit(1); } + + /* switch controlling tty */ switch (fork()) { case 0: break; @@ -142,7 +144,6 @@ void console_set_vt(int vtno) default: exit(0); } - close(tty); close(0); close(1); close(2); @@ -176,3 +177,23 @@ void console_restore_vt(void) if (ioctl(tty, VT_WAITACTIVE, orig_vt_no) < 0) perror("ioctl VT_WAITACTIVE"); } + +/* Hmm. radeonfb needs this. matroxfb doesn't. */ +int console_activate_current(int tty) +{ + struct vt_stat vts; + + if (-1 == ioctl(tty,VT_GETSTATE, &vts)) { + perror("ioctl VT_GETSTATE"); + return -1; + } + if (-1 == ioctl(tty,VT_ACTIVATE, vts.v_active)) { + perror("ioctl VT_ACTIVATE"); + return -1; + } + if (-1 == ioctl(tty,VT_WAITACTIVE, vts.v_active)) { + perror("ioctl VT_WAITACTIVE"); + return -1; + } + return 0; +} @@ -5,3 +5,4 @@ int check_console_switch(void); void console_set_vt(int vtno); void console_restore_vt(void); +int console_activate_current(int tty); |