build: fix typo in configure.ac regarding cdev-sessions

A missing "test" keyword causes bash to fail executing this statement. Fix
this.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
shl: ring: add shl_ring_flush() helper

This helper flushes all messages from the ring buffer and releases the
memory.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
cdev: implement basic ioctl() stubs

This commit adds stubs for every ioctl() that we need to support so an
xserver can run on this fake VT.
There are a lot more ioctl()s that can be invoked on TTYs and VTs, but we
currently do not intend to support these. If there is an application that
uses these and it makes sense to run it under kmscon, we will add the
needed ioctls.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
cdev: implement KDSETMODE/KDGETMODE ioctl stubs

These ioctls are used to change from TEXT to GRAPHICS mode. We currently
do not support GRAPHICS mode correctly, but this will be added later.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
cdev: implement KDSKBMODE/KDGKBMODE ioctls

These ioctls change/retrieve the keyboard mode. We only support K_UNICODE,
K_RAW and K_OFF. Even K_RAW isn't supported fully as it is unclear what it
is supposed to do.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
seat: clean up session-callback function type

We use structures to pass information in all callbacks so we always get 3
arguments: parent, parameters, data
Also change the return type to int so we can catch errors when changing
session stati.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
uterm: vt: allow VT-deactivation to fail

If we dispatch VT-deactivation to child-processes, we might allow them to
abort the VT-switch, so the upper layer (uterm_vt) must also allow us to
abort the VT-switch.
During shutdown, we need to force the deactivation to guarantee that a VT
is inactive during shutdown.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
uterm: vt: add fake_open/close() helpers

Instead of doing the backend initialization directly in uterm_vt code, we
now use fake_* helpers similar to real_* helpers.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
uterm: vt: keep graphics mode during VT switch

If we open a VT, we assume that we are the only user on it. Therefore, we
put it into graphics mode _once_ and keep it this way. Resetting it to
text mode is useless, as there is no other user and every VT has its own
modes.

This also fixes page-flip issues during VT-switches which caused the
text-mode fbdev layer to claim one vertical-sync for their own page-flip
only for us to override it immediately after it is done.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
uterm: vt: avoid blocking SIGUSR1/2 twice

eloop does already block signals that we register callbacks for so we do
not have to block it manually here.
Note that the signal-handlers are registered _before_ doing the backend
initialization so we also avoid the previously fixed race-condition.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
uterm: input: don't test device capability in wakeup_dev

The current code ignores non-keyboard devices, and various places
implicitly assume that it does. If we ever need finer granularity, we
should review (and probably restructure) the code for that; but for now
this test seems out of place.

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
uterm: input: uxkb: properly handle changed keyboard state on wake up

Fix the problems caused by the keyboard state getting out-of-sync with
the xkb_state while the device is asleep (instead of the current hack).
The problem is described in a comment and in the removed FIXME.

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Add kmscon@.service

This almost certainly can be optimized, but we should be able to mask
getty@.service with kmscon@.service.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>