kmscon: run only on VT-less seats in listen-mode
If we run in listen mode, we are supposed to take over a seat. If a seat supports VTs (like kernel VTs or kmscon cdev fake VTs) we assume that there is some manager for these VTs (the one who created them). Therefore, there is no need to run kmscon in listen mode on these seats. Instead, you should run kmscon in default mode on these seats. We enforce this limitation because if the VT-master on those seats dies and causes a HUP, they have no way to notify us when they startup again. Therefore, this kind of setup is broken. Furthermore, no-one would every want such setups. Instead use the startup mechanism of the VT/seat-manager to start kmscon in default mode on those seats. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This commit is contained in:
parent
3cebf533fc
commit
4ceb557ecb
@ -189,8 +189,12 @@ static int app_seat_new(struct kmscon_app *app, struct app_seat **out,
|
||||
ret = kmscon_seat_new(&seat->seat, app->conf_ctx, app->eloop, app->vtm,
|
||||
sname, app_seat_event, seat);
|
||||
if (ret) {
|
||||
log_error("cannot create seat object on seat %s: %d",
|
||||
sname, ret);
|
||||
if (ret == -ERANGE)
|
||||
log_debug("ignoring seat %s as it already has a seat manager",
|
||||
sname);
|
||||
else
|
||||
log_error("cannot create seat object on seat %s: %d",
|
||||
sname, ret);
|
||||
goto err_name;
|
||||
}
|
||||
seat->conf_ctx = kmscon_seat_get_conf(seat->seat);
|
||||
|
@ -638,6 +638,7 @@ int kmscon_seat_new(struct kmscon_seat **out,
|
||||
struct kmscon_seat *seat;
|
||||
int ret;
|
||||
struct kmscon_session *s;
|
||||
unsigned int allowed_types;
|
||||
|
||||
if (!out || !eloop || !vtm || !seatname)
|
||||
return -EINVAL;
|
||||
@ -688,7 +689,12 @@ int kmscon_seat_new(struct kmscon_seat **out,
|
||||
if (ret)
|
||||
goto err_input;
|
||||
|
||||
ret = uterm_vt_allocate(seat->vtm, &seat->vt, seat->name,
|
||||
allowed_types = UTERM_VT_FAKE;
|
||||
if (!seat->conf->listen)
|
||||
allowed_types |= UTERM_VT_REAL;
|
||||
|
||||
ret = uterm_vt_allocate(seat->vtm, &seat->vt,
|
||||
allowed_types, seat->name,
|
||||
seat->input, seat->conf->vt, seat_vt_event,
|
||||
seat);
|
||||
if (ret)
|
||||
|
@ -337,8 +337,8 @@ struct uterm_vt_event {
|
||||
};
|
||||
|
||||
enum uterm_vt_type {
|
||||
UTERM_VT_REAL,
|
||||
UTERM_VT_FAKE,
|
||||
UTERM_VT_REAL = 0x01,
|
||||
UTERM_VT_FAKE = 0x02,
|
||||
};
|
||||
|
||||
typedef int (*uterm_vt_cb) (struct uterm_vt *vt, struct uterm_vt_event *ev,
|
||||
@ -353,6 +353,7 @@ int uterm_vt_master_activate_all(struct uterm_vt_master *vtm);
|
||||
int uterm_vt_master_deactivate_all(struct uterm_vt_master *vtm);
|
||||
|
||||
int uterm_vt_allocate(struct uterm_vt_master *vt, struct uterm_vt **out,
|
||||
unsigned int allowed_types,
|
||||
const char *seat, struct uterm_input *input,
|
||||
const char *vt_name, uterm_vt_cb cb, void *data);
|
||||
void uterm_vt_deallocate(struct uterm_vt *vt);
|
||||
|
@ -790,6 +790,7 @@ static int seat_find_vt(const char *seat, char **out)
|
||||
|
||||
int uterm_vt_allocate(struct uterm_vt_master *vtm,
|
||||
struct uterm_vt **out,
|
||||
unsigned int allowed_types,
|
||||
const char *seat,
|
||||
struct uterm_input *input,
|
||||
const char *vt_name,
|
||||
@ -840,9 +841,19 @@ int uterm_vt_allocate(struct uterm_vt_master *vtm,
|
||||
}
|
||||
|
||||
if (vt_name || path) {
|
||||
if (!(allowed_types & UTERM_VT_REAL)) {
|
||||
ret = -ERANGE;
|
||||
free(path);
|
||||
goto err_input;
|
||||
}
|
||||
vt->mode = UTERM_VT_REAL;
|
||||
ret = real_open(vt, vt_name ? vt_name : path);
|
||||
} else {
|
||||
if (!(allowed_types & UTERM_VT_FAKE)) {
|
||||
ret = -ERANGE;
|
||||
free(path);
|
||||
goto err_input;
|
||||
}
|
||||
vt->mode = UTERM_VT_FAKE;
|
||||
ret = fake_open(vt);
|
||||
}
|
||||
|
@ -116,7 +116,8 @@ int main(int argc, char **argv)
|
||||
if (ret)
|
||||
goto err_vtm;
|
||||
|
||||
ret = uterm_vt_allocate(vtm, &vt, "seat0", input, vtpath, NULL, NULL);
|
||||
ret = uterm_vt_allocate(vtm, &vt, UTERM_VT_FAKE | UTERM_VT_REAL,
|
||||
"seat0", input, vtpath, NULL, NULL);
|
||||
if (ret)
|
||||
goto err_input;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user