eloop.c and log.c use struct timeval to calculate time-diffs but
incorrectly use "-" instead of "+" as the value is already negative.
They also use unsigned integers so fix both occurences.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
When exiting a child eloop we should forward the exit to the parent. Also,
we should reset ->exit on ev_eloop_run() otherwise we cannot run multiple
times.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
--switchvt enables kmscon to automatically switch to the new VT that was
opened by kmscon. If this is the current VT, then this has obviously no
effect.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
ev_eloop_run() runs the eloop for a given fixed time. If the dispatcher
returns and the timeout isn't reached, then the dispatcher is called
again.
This also adds the *_exit() function which allows to exit the main-loop
and can be called from anywhere (including the callbacks).
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
If a handler does not correctly remove itself on HUP, the epoll-loop will
never sleep again because the fd will always be notified as HUP.
Therefore, remove the fd from the epoll-set directly on HUP. This doesn't
change application behavior so it is safe here.
This also allows other subsystems to ignore HUP/ERR events if they are not
fatal. The FD won't be readded but that may not bother.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
The conf-subsystem is used throughout the whole source and provides a
global static read-only configuration. The configuration is read on
startup from the command-line and filesystem and then provided to the
other subsystems.
This is no database, that is, the data is not written to a file on
shutdown!
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This allows to add one eloop object into another eloop. This is useful if
we want to run a single event source isolated (for instance VT on exit).
The internal epoll-descriptor allows polling so this is a fairly
straightforward implementation.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We currently have too much layers in the console subsystem. This reduces
performance and produces ugly hacks like our "*_clear_region" function. We
now merge both files so we can directly access the buffer-structure.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Define LOG_ENABLE_DEBUG if we enabled debugging. The log subsystem uses
this to enable the log_debug() statements.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Inside a screen object we are independent of the lifetime of the displays
so we need to correctly keep references to them.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
The GL subsystem is copied from the old output_context subsystem and now
provides shader and GL-math. It will replace the old output_context subs
soon.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We use GLES2 for drawing. There is currently no reason to provide full GL
inside kmscon as we use the basic operations only.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
The fbdev backend is non-functional, but we add it for documentational
purposes. It is not built as part of kmscon.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
uterm_video can work with any backend so we need a DRM backend to get the
same functionality as our previous compositor/output API.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Our old backend was hacked together and hadn't have any structure. This is
a new approach to create the uterm-library inside kmscon. The
uterm-library will contain everything that is needed to run an application
on Linux DRM devices without X11 or Wayland support.
The idea is to move the input subsystem to uterm, too. No other stuff is
currently planned to be included in uterm.
Although uterm is supposed to be a separate library, we do not build it as
such library. We currently include the log-subsystem and the
eloop-handlers in the library so we cannot build it as stand-alone
library. However, we try to keep it separate so if we ever need to export
it, then it should be a one-hour job to do it so.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
The new logger is much more powerful, allows online log-filter
modifications and precise debugging. We still avoid heavy file-operations
as we rely on the caller to forward stderr to a log-file and perform
log-rotations. However, we now provide a simple way to perform this
forward inside the application.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Add probing for LEDs in the input devices, and move the ioctl for the
LEDs state from the keyboard backends to the input subsystem itself
(thus not exposing the device's file descriptor unnecessarily).
Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This commit discards the simplistic udev check for the ID_KEYBOARD
property in favor of a more direct "feature" probing. This is done for
the following reasons:
- We will need to use input devices which are not necessarily keyboards,
for example the PC speaker to sound the bell.
- To differentiate between keyboard with certain capabilities, such as
LEDs (indicators). We can then perform actions on devices according to
their feature bits.
- We check directly for what we need, i.e. the ability to send/receive
certain evdev events, without relying on logic in udev. This also
reduces our dependency on udev if we ever want to make it optional.
Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
config.h is meant to be around in all files, as it contains stuff like
_GNU_SOURCE, NDEBUG and HAVE_*.
Make these definitions available without needing to #include config.h
every single time.
Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Add 2012 to copyright and remove University of Tuebingen from new files as
copyright holder. It will still remain in the old files, though.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Many 8bit C1 codes have 7bit escape sequences as equivalents. This adds handlers
for all of them with comments what they are supposed to do. They are dummies for
now but they will be implemented later.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Add handlers for C1 codes with a description what they are supposed to do. They
are not yet implemented and are no-ops.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This is now a fully vt500-series compliant state machine that parses escape
sequences. See vt100.net/emu for information on this state-machine. This is
written from scratch, though.
It now handles all kind of escape sequences that we every want to support. It
correctly ignores all unsupported ones right now.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
The xserver currently crashes if we switch to its VT and it cannot claim
drm-master. This normally does not happen as we drop drm-master on
VT-leave. However, after calling open() on the drm char-dev we are
automatically drm-master so we should drop it right away as our VT is
not guaranteed to be opened at this time.
There is currently no way to call open() on the drm char-dev without
getting drm-master so there is still a short time-period when we have no
active VT but are drm-master. Switching to X in this short time-period
will still kill the X-server but we are not responsible for horrible
X-server bugs so we ignore this 10ms time-span.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Print the CSI command in debug messages so we can better understand what
escape commands were sent.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Add new helper to console subsystem which performs a backspace
operation. We must take care of auto-wrap mode so we cannot simply use
the *_move_left() function.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
The A, B, C and D CSIs are used to move the cursor in the scroll-region
without scrolling the buffer when reaching the margins.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This adds support for line-feed and carriage-return controls. The two
special line-feed controls which are not \n do not take care NL-mode so
they must be handled separately.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>