seat: register cdev session only when --cdev is given

We cannot have multiple instances of kmscon running with cdev emulation,
so disable it by default. A kmscon-system-daemon now needs --cdev if you
want fake VTs to work.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This commit is contained in:
David Herrmann 2012-12-01 15:05:07 +01:00
parent 0da912fbbd
commit 1796e33441
3 changed files with 11 additions and 5 deletions

View File

@ -71,6 +71,7 @@ static void print_help()
"\t-s, --switchvt [on] Automatically switch to VT\n" "\t-s, --switchvt [on] Automatically switch to VT\n"
"\t --seats <list,of,seats> [seat0] Select seats or pass 'all' to make\n" "\t --seats <list,of,seats> [seat0] Select seats or pass 'all' to make\n"
"\t kmscon run on all seats\n" "\t kmscon run on all seats\n"
"\t --cdev [off] Emulate kernel VTs\n"
"\n" "\n"
"Session Options:\n" "Session Options:\n"
"\t --session-max <max> [50] Maximum number of sessions\n" "\t --session-max <max> [50] Maximum number of sessions\n"
@ -458,6 +459,7 @@ int kmscon_conf_new(struct conf_ctx **out)
CONF_OPTION(0, 0, "vt", &conf_vt, NULL, NULL, NULL, &conf->vt, NULL), CONF_OPTION(0, 0, "vt", &conf_vt, NULL, NULL, NULL, &conf->vt, NULL),
CONF_OPTION_BOOL('s', "switchvt", &conf->switchvt, true), CONF_OPTION_BOOL('s', "switchvt", &conf->switchvt, true),
CONF_OPTION_STRING_LIST(0, "seats", &conf->seats, def_seats), CONF_OPTION_STRING_LIST(0, "seats", &conf->seats, def_seats),
CONF_OPTION_BOOL(0, "cdev", &conf->cdev, false),
/* Session Options */ /* Session Options */
CONF_OPTION_UINT(0, "session-max", &conf->session_max, 50), CONF_OPTION_UINT(0, "session-max", &conf->session_max, 50),

View File

@ -57,6 +57,8 @@ struct kmscon_conf_t {
bool switchvt; bool switchvt;
/* seats */ /* seats */
char **seats; char **seats;
/* cdev */
bool cdev;
/* Session Options */ /* Session Options */
/* sessions */ /* sessions */

View File

@ -690,11 +690,13 @@ int kmscon_seat_new(struct kmscon_seat **out,
else else
kmscon_session_enable(s); kmscon_session_enable(s);
if (seat->conf->cdev) {
ret = kmscon_cdev_register(&s, seat); ret = kmscon_cdev_register(&s, seat);
if (ret == -EOPNOTSUPP) if (ret == -EOPNOTSUPP)
log_notice("cdev sessions not compiled in"); log_notice("cdev sessions not compiled in");
else if (ret) else if (ret)
log_error("cannot register cdev session: %d", ret); log_error("cannot register cdev session: %d", ret);
}
ret = kmscon_compositor_register(&s, seat); ret = kmscon_compositor_register(&s, seat);
if (ret == -EOPNOTSUPP) if (ret == -EOPNOTSUPP)