aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2019-01-31 10:49:31 +0100
committerGerd Hoffmann <kraxel@redhat.com>2019-01-31 10:49:31 +0100
commit620c38f6f45a8708d9dd82f638beb06789b6c7d1 (patch)
tree79629772daacf0be6a40fd562d564bde8231ae7b
parent7fcf29ed3f77f60873bad160d5afac498746d6d8 (diff)
downloadfbida-620c38f6f45a8708d9dd82f638beb06789b6c7d1.tar.gz
drop -vt option
-rw-r--r--fbi.c4
-rw-r--r--fbiconfig.c6
-rw-r--r--fbiconfig.h2
-rw-r--r--fbpdf.c4
-rw-r--r--fbtools.c6
-rw-r--r--fbtools.h2
-rw-r--r--vt.c44
-rw-r--r--vt.h2
8 files changed, 16 insertions, 54 deletions
diff --git a/fbi.c b/fbi.c
index 9dab5b6..02b8c61 100644
--- a/fbi.c
+++ b/fbi.c
@@ -1420,14 +1420,14 @@ int main(int argc, char *argv[])
gfx = drm_init(device, output, mode, false);
} else {
framebuffer = true;
- gfx = fb_init(device, mode, GET_VT());
+ gfx = fb_init(device, mode);
}
} else {
/* try drm first, failing that fb */
gfx = drm_init(NULL, output, mode, false);
if (!gfx) {
framebuffer = true;
- gfx = fb_init(NULL, mode, GET_VT());
+ gfx = fb_init(NULL, mode);
}
}
if (!gfx) {
diff --git a/fbiconfig.c b/fbiconfig.c
index 48c0fca..a986c3b 100644
--- a/fbiconfig.c
+++ b/fbiconfig.c
@@ -130,12 +130,6 @@ struct cfg_cmdline fbi_cfg[] = {
.needsarg = 1,
.desc = "image blend time in miliseconds",
},{
- .letter = 'T',
- .cmdline = "vt",
- .option = { O_VT },
- .needsarg = 1,
- .desc = "start on virtual console <arg>",
- },{
.letter = 's',
.cmdline = "scroll",
.option = { O_SCROLL },
diff --git a/fbiconfig.h b/fbiconfig.h
index 3fdc2f0..67003b2 100644
--- a/fbiconfig.h
+++ b/fbiconfig.h
@@ -26,7 +26,6 @@
#define O_CACHE_MEM O_OPTIONS, "cache-mem"
#define O_BLEND_MSECS O_OPTIONS, "blend-msecs"
-#define O_VT O_OPTIONS, "vt"
#define O_SCROLL O_OPTIONS, "scroll"
#define O_TIMEOUT O_OPTIONS, "timeout"
#define O_PCD_RES O_OPTIONS, "photocd-res"
@@ -61,7 +60,6 @@
#define GET_CACHE_MEM() cfg_get_int(O_CACHE_MEM, 256)
#define GET_BLEND_MSECS() cfg_get_int(O_BLEND_MSECS, 0)
-#define GET_VT() cfg_get_int(O_VT, 0)
#define GET_SCROLL() cfg_get_int(O_SCROLL, 50)
#define GET_TIMEOUT() cfg_get_int(O_TIMEOUT, 0)
#define GET_PCD_RES() cfg_get_int(O_PCD_RES, 3)
diff --git a/fbpdf.c b/fbpdf.c
index 91ccecd..4f6562e 100644
--- a/fbpdf.c
+++ b/fbpdf.c
@@ -303,14 +303,14 @@ int main(int argc, char *argv[])
gfx = drm_init(device, output, mode, pageflip);
} else {
framebuffer = true;
- gfx = fb_init(device, mode, GET_VT());
+ gfx = fb_init(device, mode);
}
} else {
/* try drm first, failing that fb */
gfx = drm_init(NULL, output, mode, pageflip);
if (!gfx) {
framebuffer = true;
- gfx = fb_init(NULL, mode, GET_VT());
+ gfx = fb_init(NULL, mode);
}
}
if (!gfx) {
diff --git a/fbtools.c b/fbtools.c
index 5c644ff..ec66b67 100644
--- a/fbtools.c
+++ b/fbtools.c
@@ -215,21 +215,17 @@ static void fb_cleanup_display(void)
}
close(fb);
- console_restore_vt();
tcsetattr(STDIN_FILENO, TCSANOW, &term);
}
/* -------------------------------------------------------------------- */
-gfxstate* fb_init(const char *device, char *mode, int vt)
+gfxstate* fb_init(const char *device, char *mode)
{
unsigned long page_mask;
struct stat st;
gfxstate *gfx;
- if (vt != 0)
- console_set_vt(vt);
-
if (NULL == device) {
device = getenv("FRAMEBUFFER");
if (NULL == device) {
diff --git a/fbtools.h b/fbtools.h
index 4adb452..edd5048 100644
--- a/fbtools.h
+++ b/fbtools.h
@@ -1,3 +1,3 @@
#include "gfx.h"
-gfxstate *fb_init(const char *device, char *mode, int vt);
+gfxstate *fb_init(const char *device, char *mode);
diff --git a/vt.c b/vt.c
index 55ef71f..4a9c3e1 100644
--- a/vt.c
+++ b/vt.c
@@ -31,7 +31,7 @@ static bool console_switching_active;
static int kd_mode;
static struct vt_mode vt_mode;
static struct vt_mode vt_omode;
-static int orig_vt_no = 0;
+static int orig_vt_no = -1;
static void (*console_redraw)(void);
static void console_switch_signal(int signal)
@@ -148,43 +148,16 @@ int check_console_switch(void)
return 1;
}
-void console_set_vt(int vtno)
+int console_aquire_vt(void)
{
struct vt_stat vts;
- char vtname[12];
+ int vtno = -1;
- if (vtno < 0) {
- if (-1 == ioctl(STDIN_FILENO, VT_OPENQRY, &vtno) || vtno == -1) {
- perror("ioctl VT_OPENQRY");
- exit(1);
- }
- }
-
- vtno &= 0xff;
- sprintf(vtname, "/dev/tty%d", vtno);
- chown(vtname, getuid(), getgid());
- if (-1 == access(vtname, R_OK | W_OK)) {
- fprintf(stderr,"access %s: %s\n",vtname,strerror(errno));
- exit(1);
- }
-
- /* switch controlling tty */
- switch (fork()) {
- case 0:
- break;
- case -1:
- perror("fork");
- exit(1);
- default:
- exit(0);
+ if (-1 == ioctl(STDIN_FILENO, VT_OPENQRY, &vtno) || vtno == -1) {
+ perror("ioctl VT_OPENQRY");
+ return -1;
}
- close(0);
- close(1);
- close(2);
- setsid();
- open(vtname,O_RDWR);
- dup(0);
- dup(0);
+ fprintf(stderr, "using vt %d\n", vtno);
if (-1 == ioctl(STDIN_FILENO,VT_GETSTATE, &vts)) {
perror("ioctl VT_GETSTATE");
@@ -199,11 +172,12 @@ void console_set_vt(int vtno)
perror("ioctl VT_WAITACTIVE");
exit(1);
}
+ return 0;
}
void console_restore_vt(void)
{
- if (!orig_vt_no)
+ if (orig_vt_no < 0)
return;
if (ioctl(STDIN_FILENO, VT_ACTIVATE, orig_vt_no) < 0)
diff --git a/vt.h b/vt.h
index f9beec7..637b60d 100644
--- a/vt.h
+++ b/vt.h
@@ -4,6 +4,6 @@ int console_switch_init(void (*redraw)(void));
void console_switch_cleanup(void);
int check_console_switch(void);
-void console_set_vt(int vtno);
+int console_aquire_vt(void);
void console_restore_vt(void);
int console_activate_current(void);