diff --git a/src/kmscon_conf.c b/src/kmscon_conf.c index 65b7c53..f9016a5 100644 --- a/src/kmscon_conf.c +++ b/src/kmscon_conf.c @@ -120,6 +120,9 @@ static void print_help() "\t Create new terminal session\n" "\n" "Video Options:\n" + "\t --video-devices [all] List of video devices to be used\n" + "\t by kmscon. This can be a list of\n" + "\t paths to /dev/* or \"all\"\n" "\t --drm [on] Use DRM if available\n" "\t --hwaccel [off] Use 3D hardware-acceleration if\n" "\t available\n" @@ -400,6 +403,8 @@ static int aftercheck_drm(struct conf_option *opt, int argc, char **argv, static char *def_seats[] = { "seat0", NULL }; +static char *def_video_devices[] = { "all", NULL }; + static struct conf_grab def_grab_scroll_up = CONF_SINGLE_GRAB(SHL_SHIFT_MASK, XKB_KEY_Up); @@ -478,6 +483,7 @@ int kmscon_conf_new(struct conf_ctx **out) CONF_OPTION_GRAB(0, "grab-terminal-new", &conf->grab_terminal_new, &def_grab_terminal_new), /* Video Options */ + CONF_OPTION_STRING_LIST(0, "video-devices", &conf->video_devices, def_video_devices), CONF_OPTION_BOOL_FULL(0, "drm", aftercheck_drm, NULL, NULL, &conf->drm, true), CONF_OPTION_BOOL(0, "hwaccel", &conf->hwaccel, false), CONF_OPTION_BOOL(0, "primary-gpu-only", &conf->primary_gpu_only, false), diff --git a/src/kmscon_conf.h b/src/kmscon_conf.h index cbb2b6e..975b1f8 100644 --- a/src/kmscon_conf.h +++ b/src/kmscon_conf.h @@ -107,6 +107,8 @@ struct kmscon_conf_t { struct conf_grab *grab_terminal_new; /* Video Options */ + /* whitelist of usable video devices or "all" */ + char **video_devices; /* use DRM if available */ bool drm; /* use 3D hardware-acceleration if available */ diff --git a/src/kmscon_main.c b/src/kmscon_main.c index 12d59e5..dbd9c71 100644 --- a/src/kmscon_main.c +++ b/src/kmscon_main.c @@ -207,6 +207,19 @@ static bool app_seat_is_ignored(struct app_seat *seat, bool aux, const char *node) { + unsigned int i; + + if (!shl_string_list_is(seat->conf->video_devices, "all")) { + for (i = 0; seat->conf->video_devices[i]; ++i) { + if (!strcmp(seat->conf->video_devices[i], node)) + return false; + } + + log_info("ignoring video device %s on seat %s as it is not in the whitelist", + node, seat->name); + return true; + } + switch (type) { case UTERM_MONITOR_FBDEV: if (seat->conf->drm) {