kmscon: add --vt=<num> option to select VT for seat0

VTs are only available on seat0 so this option does not affect other
seats. On seat0 it selects the VT that we run on. We do _not_ fall back to
another seat if it fails but disable this seat instead.

Reported-by: Matthew Monaco
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This commit is contained in:
David Herrmann committed 2012-09-29 11:49:54 +02:00
1 parent a6165a03c7
commit bf18799015
4 files changed
+12 -5

No files matched your search

+3 -1
View File
@@ -157,7 +157,7 @@ static void seat_new(struct kmscon_app *app,
goto err_name;
ret = uterm_vt_allocate(app->vtm, &seat->vt, seat->sname,
seat->input, vt_event, seat);
seat->input, kmscon_conf.vt, vt_event, seat);
if (ret)
goto err_input;
@@ -426,6 +426,7 @@ static void print_help()
"\t --debug [off] Enable debug mode\n"
"\t --silent [off] Suppress notices and warnings\n"
"\t-s, --switchvt [off] Automatically switch to VT\n"
"\t --vt <vt-number> [auto] Select which VT to run on on seat0\n"
"\t --seats <list,of,seats> [seat0] Select seats or pass 'all' to make\n"
"\t kmscon run on all seats\n"
"\n"
@@ -678,6 +679,7 @@ struct conf_option options[] = {
CONF_OPTION_UINT(0, "fps", NULL, &kmscon_conf.fps, 50),
CONF_OPTION_STRING(0, "render-engine", NULL, &kmscon_conf.render_engine, NULL),
CONF_OPTION_BOOL(0, "render-timing", NULL, &kmscon_conf.render_timing, false),
CONF_OPTION_INT(0, "vt", NULL, &kmscon_conf.vt, UTERM_VT_DEFAULT),
CONF_OPTION_BOOL('s', "switchvt", NULL, &kmscon_conf.switchvt, false),
CONF_OPTION_BOOL('l', "login", aftercheck_login, &kmscon_conf.login, false),
CONF_OPTION_STRING('t', "term", NULL, &kmscon_conf.term, "xterm-256color"),
+2
View File
@@ -46,6 +46,8 @@ struct kmscon_conf_t {
bool verbose;
/* disable notices and warnings */
bool silent;
/* VT number to run on on seat0 */
int vt;
/* enter new VT directly */
bool switchvt;
/* use framebuffers instead of DRM */
+3 -1
View File
@@ -334,6 +334,8 @@ enum uterm_vt_mode {
UTERM_VT_DEAD,
};
#define UTERM_VT_DEFAULT (-1)
typedef int (*uterm_vt_cb) (struct uterm_vt *vt, unsigned int action,
void *data);
@@ -344,7 +346,7 @@ void uterm_vt_master_unref(struct uterm_vt_master *vtm);
int uterm_vt_allocate(struct uterm_vt_master *vt, struct uterm_vt **out,
const char *seat, struct uterm_input *input,
uterm_vt_cb cb, void *data);
int vt_for_seat0, uterm_vt_cb cb, void *data);
void uterm_vt_deallocate(struct uterm_vt *vt);
void uterm_vt_ref(struct uterm_vt *vt);
void uterm_vt_unref(struct uterm_vt *vt);
+4 -3
View File
@@ -203,7 +203,7 @@ static int open_tty(int id, int *tty_fd, int *tty_num)
return 0;
}
static int real_open(struct uterm_vt *vt)
static int real_open(struct uterm_vt *vt, int vt_for_seat0)
{
struct termios raw_attribs;
struct vt_mode mode;
@@ -213,7 +213,7 @@ static int real_open(struct uterm_vt *vt)
log_debug("open vt %p", vt);
ret = open_tty(-1, &vt->real_fd, &vt->real_num);
ret = open_tty(vt_for_seat0, &vt->real_fd, &vt->real_num);
if (ret)
return ret;
@@ -455,6 +455,7 @@ int uterm_vt_allocate(struct uterm_vt_master *vtm,
struct uterm_vt **out,
const char *seat,
struct uterm_input *input,
int vt_for_seat0,
uterm_vt_cb cb,
void *data)
{
@@ -489,7 +490,7 @@ int uterm_vt_allocate(struct uterm_vt_master *vtm,
if (!strcmp(seat, "seat0") && vtm->vt_support) {
vt->mode = UTERM_VT_REAL;
ret = real_open(vt);
ret = real_open(vt, vt_for_seat0);
if (ret)
goto err_sig2;
} else {