vt: add kmscon_vt_supported() function

If the kernel has CONFIG_VT disabled we should avoid opening VTs and
instead rely on other mechanisms for virtual terminals.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This commit is contained in:
David Herrmann 2012-05-24 19:14:51 +02:00
parent d3257fca31
commit 68c6f68993
2 changed files with 10 additions and 0 deletions

View File

@ -89,6 +89,14 @@ struct kmscon_vt {
struct ev_fd *efd;
};
bool kmscon_vt_supported(void)
{
if (access("/dev/tty", F_OK))
return false;
else
return true;
}
int kmscon_vt_new(struct kmscon_vt **out, kmscon_vt_cb cb, void *data)
{
struct kmscon_vt *vt;

View File

@ -56,6 +56,8 @@ typedef bool (*kmscon_vt_cb) (struct kmscon_vt *vt,
enum kmscon_vt_action action,
void *data);
bool kmscon_vt_supported(void);
int kmscon_vt_new(struct kmscon_vt **out, kmscon_vt_cb cb, void *data);
void kmscon_vt_ref(struct kmscon_vt *vt);
void kmscon_vt_unref(struct kmscon_vt *vt);