70 Commits

Author SHA1 Message Date
David Herrmann
5dfc12ee6a uterm: vt: fix resetting access control on VT-close
This is a weird fix. One would think that this is automatically reset when
calling close() on the fd but, suprise, it's not. So lets reset this
manually, otherwise when we close the VT but our application is still
active, the user will never be able to leave the VT again.

Again a hilarious example why the VT API sucks. Really... Get rid of it.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-20 14:57:39 +02:00
David Herrmann
06d33f6636 uterm: vt: add fake VT via user-input
This actually incorporates the fakevt tool into kmscon. That is, if the
user presses ctrl+mod4+F12, we activate or deactivate the fake VT.

This is for debugging only and needs to be made more configurable. Use it
on your own risk.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-15 09:27:11 +02:00
David Herrmann
9bce87d564 uterm: vt: fix checking for /dev/tty0 instead of /dev/tty
/dev/tty may be available even though CONFIG_VT is not set. Therefore,
check for /dev/tty0 instead which is guaranteed to be not available with
CONFIG_VT=n.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-12 13:31:19 +02:00
David Herrmann
f084da1852 uterm: vt: add fake-vt logic for debugging
This adds a very limited non-multi-seat-capable fake-VT logic. If you use
this in production it will break your multi-seat systems so do not use it
except for debugging.

On SIGUSR1 we activate fake VTs and on SIGUSR2 we deactivate them. The
signals must be sent from a priviledged process. Kernel signals are
ignored.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-12 11:18:48 +02:00
David Herrmann
4f3cd2eecd uterm: vt: ignore non-kernel signals in real-mode
If using real linux VTs, we must ignore all signals that are not sent from
the kernel. Otherwise, we might get problems if we reuse SIGUSR for other
functionality.
Note that we already check that we are the active VT before handling
SIGUSR. However, this hardens this check to be more sure that this is
really the signal we want.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-12 10:21:11 +02:00
David Herrmann
4c1da1069d uterm: vt: mark vts as dead during deallocation
To avoid useless checks wether a vt is valid we simply mark it as dead and
centralize the checks in the API entry point.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-12 10:16:55 +02:00
David Herrmann
4029539cd1 uterm: vt: always register signal handlers
This register the SIGUSR1/2 signal handlers even though we are no real VT.
This is needed to implement other fake-VT helpers for systems were real
VTs are not available.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-12 10:11:50 +02:00
David Herrmann
58eb1e85b9 uterm: vt: rename real VTs internally to real_*
Instead of using the old kmscon_vt_* names we now prefix everything that
implements real linux VTs with real_*. An internal flag specifies which
mode the VT is in so we can check whether we are a real VT or a fake one.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-12 10:03:01 +02:00
David Herrmann
1f9867e786 uterm: vt: remove connect_eloop/disconnect_eloop functions
This removes both functions and merges them into the callers. They're
small enough to be directly included.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-12 09:40:49 +02:00
David Herrmann
8752fe33af uterm: vt: merge uterm_vt and kmscon_vt
There is no need to use separate structures so merge both into a unified
uterm_vt.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-12 09:37:58 +02:00
David Herrmann
358b6a4ed1 uterm: vt: remove obsolete kmscon_vt_id
We always open a new VT as there is no need for us to open an existing VT.
Hard-code this behavior but keep the open_tty() backend accepting
VT-numbers just in case we want this some time in the future.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-12 09:23:23 +02:00
David Herrmann
edae24f501 uterm: vt: remove duplicate kmscon_vt_action
This enum is not needed as the uterm-vt code already has enums for
vt-actions. Replace it with UTERM_VT_ACTIVATE/DEACTIVATE.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-12 09:19:36 +02:00
David Herrmann
1101a6b5c3 uterm: vt: move all vt.h/c code into uterm_vt.c
This merges both files so we can reduce the code overhead here. This is
still some very old code that was never correctly merged into new
uterm_vt.c subsystem. This should help doing it now.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-12 09:11:35 +02:00
David Herrmann
891400ad91 uterm: vt: move kmscon_vt_supported() to uterm-vt
Instead of having a global symbol, we simply move the check to uterm-vt
and can remove it from global namespace. Furthermore, we cache the result
so we can reuse it on the VT-master if required.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-12 09:04:54 +02:00
David Herrmann
4d803f54ab vt: fix dropping reference on deallocation
The vt allocation returns a referenced object so deallocation should
correctly drop it again. We already depend on this behavior so fix it.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-21 20:45:30 +02:00
David Herrmann
0467a8fce5 uterm: vt: correctly initialize ret to 0
We need to return "true", not "false" if a mode is unknown. Otherwise, we
will block the VT subsystem.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-01 16:11:10 +02:00
David Herrmann
9e5013f51b uterm: vt: silence gcc warning
We initialize the variable to "true" to silence gcc warnings that we might
get an uninitialized variable (which we really cannot get here).

Anyway, in the future, if the number of types may increase, the correct
way to deal with unknown types is returning "true" so do this by default
now.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-01 15:45:54 +02:00
David Herrmann
f1326b2728 static: move statically linked subsystems to static_*
Small stuff that is not worth putting into a separate library is no moved
into the "static" library which is statically linked into all our
subsystems.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-06-24 20:35:22 +02:00
David Herrmann
c8ab4a2c49 uterm_vt: fix correctly passing vt data to callbacks
When emulating the VT layer we need to pass our own data to the internal
callbacks. We currently pass the user data which is really useless here.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-26 07:33:34 +02:00
David Herrmann
233eb5c510 uterm: add VT API
The uterm VT API is designed to support new user-space implementations of
vt-master APIs. If we are on seat0 and CONFIG_VT is enabled, we use the
kernel VT API. In all other cases we currently simply fall back to a
non-op but will implement in the future dbus based APIs or similar to
support VT switching, that is multi-session, on all seats.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-25 09:45:20 +02:00