1262 Commits

Author SHA1 Message Date
David Herrmann
eba5178643 build: check for udev >=172
We need udev_device_has_tag() which was introduced in version 172.
Document that in README file.

Reported-by: Manuel Rüger <mrueg@rueg.eu>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-12-10 16:21:32 +01:00
David Herrmann
03aab2b54b tsm: screen: add support for multi-cell characters
The wcwidth() POSIX helper returns the number of cells that a character
occupies. This is normally 1, however, if it is 0 we simply discard this
input (this should never happen as all characters that wcwidth() returns 0
for should already be handled by the VTE layer).
But if it is >1, we write the character in the first cell, set the width
correctly and mark all following characters as width=0.

Everything else is left unchanged, that means, the running application has
to be aware of wcwidth() and correctly send two backspaces to clear a
width=2 character and so on.

This behavior almost exactly matches the xterm behavior. There are some
corner cases like erasing only one part of a multi-cell character etc.
that might differ. However, these are non-standard cases that no
application should never rely on.
Anyway, if we spot any of these differences between xterm and kmscon, we
should fix kmscon to behave like xterm does.

Thanks to Shixin for looking this up in other emulators.

Reported-by: Shixin Zeng
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-12-10 16:09:28 +01:00
David Herrmann
1657bb9a3a text: add render-support for multi-cell glyphs
Multi-cell glyphs are glyphs that span across multiple horizontal cells.
The font renderers already support this. This patch fixes the console
renderers to take advantage of this.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-12-10 16:00:08 +01:00
David Herrmann
0de1de25fd text: font: draw multi-cell characters correctly
Instead of clipping every character to a one-cell boundary, we now render
multi-cell characters correctly into multiple cells.

This does not adjust the console-renderers but only the font renderers to
provide the correct glyphs.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-12-10 15:55:12 +01:00
David Herrmann
f52baf9896 docs: fix typos in unicode-test.txt
Two simple obvious typos.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-12-10 15:36:28 +01:00
David Herrmann
bc40e1ae53 tsm: unicode: add wcwidth() implementation
wcwidth() is a POSIX function that returns the number of cells that a
wide-character occupies. The glibc function cannot be used as it depends
on the locale and we need _always_ UTF8 no matter what the locale is.

This implementation is provided by Markus Kuhn and is equivalent to
xterm's behavior.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-12-10 15:36:04 +01:00
David Herrmann
e3c9bcfb15 tsm: unicode: fix header-protection namespace
TSM is no longer part of main-kmscon libraries so move macro-names to
TSM_* prefix.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-12-10 15:23:10 +01:00
David Herrmann
98970835d9 uxkb: print warning if LED update fails
If we cannot write LED states to an input device, we should print proper
warnings instead of ignoring it.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-12-09 22:06:51 +01:00
David Herrmann
f951f6b705 Release kmscon-6
This release contains a lot of fixes all over the place and introduces
many new features. See ./NEWS for a list of new features.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
kmscon-6
2012-12-09 21:55:32 +01:00
David Herrmann
0a743ec670 README: update readme-file
We updated configure.ac several times and need to update the README with
the newest command-line options.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-12-09 20:49:28 +01:00
David Herrmann
afb15bfee0 NEWS: add further kmscon-6 news entries
We added some more features in the recent weeks so add them. Most of it
were bugfixes, though.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-12-09 20:11:14 +01:00
David Herrmann
559823b50a COPYING: add all contributors
Add name of all contributors to COPYING.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-12-09 19:53:27 +01:00
David Herrmann
4e06dc3543 build: add systemd service files to EXTRA_DIST
These service files aren't installed, yet but they work so distribute
them.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-12-09 19:52:35 +01:00
David Herrmann
146431c834 build: add manpage-XML files to EXTRA_DIST
We need these XML files to build the man-pages so add them to EXTRA_DIST.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-12-09 19:51:51 +01:00
David Herrmann
c74658f368 build: add kmscon_cdev.h to source files
This is needed to get "make distcheck" working again.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-12-09 19:51:22 +01:00
David Herrmann
929ba2b091 Add getty@.service replacement
This unit file is a new replacement for standard systemd-getty files.
Installed into /etc/systemd/system it replaces the standard systemd unit
and spawns kmscon instead of agetty on virtual terminals.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-12-09 18:40:26 +01:00
David Herrmann
6e8fb5aa0d kmscon: add --seats=current option
This option uses XDG_SEAT to determine the current seat. If this is NULL,
we fall back to "seat0".

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-12-09 18:34:26 +01:00
David Herrmann
b78244e1ab pty: use /bin/login by default
kmscon does always pass a proper argv array so the default is never used.
However, for security reasons we shouldn't hardcode /bin/login. If some
other program uses the pty layer and forgets to pass in a suitable argv
all the time, they mind end up with opening a root shell.

Hence, use /bin/login as default.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-12-09 18:33:03 +01:00
David Herrmann
978b869e8b build: add more verbose recursive error-messages to configure.ac
Our dependency checker should recursively report missing dependencies.
Otherwise, the user doesn't really know what is missing.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-12-09 17:45:50 +01:00
David Herrmann
7c503b203e build: add AC_PROG_SED to configure.ac
We need SED for man-page generation so explicitly look for it.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-12-09 17:45:20 +01:00
David Herrmann
3d28387fb2 kmscon: remove compositor support
The wayland compositor support was some research project that turned out
to not work that well. The main problem is that the DRM planes support
cannot be easily forwarded to a child. Sub-surface support might change
that but until then we remove compositor support.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-12-09 15:55:26 +01:00
David Herrmann
89b6ff63fc seat: always activate fake-VTs during startup
Instead of relying on --switchvt, we should always activate fake-VTs
during startup. Otherwise, we might end up with dead seats as there is no
way to wake up kmscon later.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-12-09 14:19:17 +01:00
David Herrmann
5e8ce520c2 kmscon: remove broken vt_eloop concept
We tried to avoid running unused code during shutdown by moving VT
handling into a separate eloop and run it exclusively. However, with
delayed VT switching, we need to run other event-handlers to make the VT
switch work. Therefore, run all of this during shutdown and remove the
vt_eloop event-loop.

This means that we might create new seats, displays, etc. during shutdown.
This is valid and doesn't harm kmscon, but we want to avoid doing stuff
that is undone few miliseconds later. Therefore, we set a "exiting" flag
and check that before initiating most of the big handlers.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-12-09 14:14:41 +01:00
David Herrmann
29625b186d seat: start hotplugged seats if --switchvt is given
We currently only start seats (switch to their VT) during startup but we
should also do that for hotplugged seats. Therefore, move that logic into
kmscon_seat and perform the startup after the seat is fully set up.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-12-09 13:50:38 +01:00
David Herrmann
06a50ce58c kmscon: remove unused 'out' arguments
We don't use the newly created objects so no need to return them.
Furthermore, we want the functions to already perform actions on the
objects so there is no guarantee the objects are still alive after
function return. Thus, simply return nothing.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-12-09 13:44:52 +01:00
David Herrmann
cec87f029c kmscon: move video-device uterm-monitor handling
Same as previous commit: Move uterm-monitor device-data handling into the
real device create/destroy functions to allow dynamic device removal.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-12-09 13:41:28 +01:00
David Herrmann
c4a1a33597 kmscon: set uterm-seat data in seat-creation
If we want to be able to destroy seats from anywhere, not just
uterm-monitor callbacks, we need to be able to reset the monitor-event
seat-data so we no longer access the seat memory.
Hence, move the seat-data set/reset logic into the actual seat
creation/destroy functions.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-12-09 13:37:39 +01:00
David Herrmann
add239ee2c seat: pass allowed VTs from caller
We should handle everything --listen related in kmscon_main so pass in the
allowed-VTs mask from the caller.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-12-09 13:26:45 +01:00
David Herrmann
b985e55d3a Add manpage infrastructure and kmscon.1 manpage
Add a very basic man-page infrastructure so we can easily add new
docbook-style manpages.

Also add kmscon.1 man-page with a basic overview.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-12-09 13:18:56 +01:00
James Buren
b4fe3f7460 uterm: fix compilation of builds where fbdev is the only output
Declare helpers as "static inline" as they might get included but not
used.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-12-09 12:26:33 +01:00
David Herrmann
56894fb10a cdev: change TODO item to check for CAP_KILL
CAP_KILL will be documented in kmscon manuals, but we should actually
check for the capability during startup.

However, this requires linking with libcap or libcap-ng and we currently
want to avoid that for such a simple task.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-12-06 15:21:23 +01:00
David Herrmann
fd098b828c kmscon: ignore SIGPIPE
Ignore SIGPIPE globally. We handle HUP correctly everywhere and this
signal is just annoying.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-12-06 14:49:56 +01:00
David Herrmann
4258eb1a6b cdev: do not hardcode TTY major
Use TTY_MAJOR instead of hardcoding the literal 4.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-12-06 14:45:52 +01:00
David Herrmann
0b893bb2aa uterm: vt: use current VT if it is unused
If we autoselect a VT and the current VT is unused, use it. This is
similar to the behavior of Weston and X-Server.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-12-06 14:44:14 +01:00
David Herrmann
4ceb557ecb kmscon: run only on VT-less seats in listen-mode
If we run in listen mode, we are supposed to take over a seat. If a seat
supports VTs (like kernel VTs or kmscon cdev fake VTs) we assume that
there is some manager for these VTs (the one who created them). Therefore,
there is no need to run kmscon in listen mode on these seats. Instead, you
should run kmscon in default mode on these seats.

We enforce this limitation because if the VT-master on those seats dies
and causes a HUP, they have no way to notify us when they startup again.
Therefore, this kind of setup is broken. Furthermore, no-one would every
want such setups.

Instead use the startup mechanism of the VT/seat-manager to start kmscon
in default mode on those seats.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-12-06 14:18:57 +01:00
David Herrmann
3cebf533fc kmscon: prevent --no-listen in combination with --cdev-session
cdev sessions should only be used in listen-mode to avoid stacking cdev
sessions.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-12-06 14:03:54 +01:00
David Herrmann
2ac9421377 kmscon: introduce new --listen mode
Instead of configuring everything for every kind of situation, we now
split kmscon into two modes: default-mode and listen-mode

In default-mode we run on the given seats once until we encounter a HUP or
until we are closed. It's a perfect replacement for agetty.

In listen-mode, we run only on non-VT seats and provide the full kmscon
functionality. We run as system daemon and wait for new seats and close
seats if they are destroyed. We simply provide a full system-console on
all seats.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-12-06 13:55:00 +01:00
David Herrmann
b972ebb102 kmscon: replace gpu selection modes with new --gpu option
Instead of using one option for each selection mode, we now provide a new
option --gpus. It takes as argument the selection mode to use.

We also remove the --video-devices option as it doesn't fit into the big
picture. Instead, we should provide a blacklist and users would then use
--gpu=all --blacklist-video=<blacklist> instead.

However, blacklisting is also required for input devices and until we
figure it out, we will provide no blacklisting at all.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-12-06 11:36:46 +01:00
David Herrmann
b18cf69663 Move .pc files to ./docs/pc/
We want only C-source files in ./src and the documents ./docs directory is
meant to contain any other sources.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-12-05 18:25:05 +01:00
David Herrmann
66fad90384 uterm: vt: fix opening new VTs
If no VT name is explicitly given, we need to use VT_OPENQRY to find one.
This used to work until we switched to supporting fake-VTs. Fix this again
to work like it used to.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-12-02 23:27:00 +01:00
David Herrmann
ec9e1bf9a3 seat: fix rescheduling sessions if none is active
If no session is active, we must not choose the scheduled session as
start-place. Otherwise, we will not schedule any session because the
start-session isn't used in the iteration.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-12-02 15:24:13 +01:00
David Herrmann
e74f0de0b6 pty: use the new child-reaper sources
Instead of registering for SIGCHLD we should use the child-reaper sources
to avoid nasty race-conditions.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-12-02 15:08:07 +01:00
David Herrmann
5e509aad41 eloop: add child-reaper event sources
If multiple childs die simultaneously, only a single SIGCHLD is queued.
Only after our process got scheduled and we unqueued the SIGCHLD, a next
signal can be queued. Therefore, using SIGCHLD as indicator that a
specific child died does not work reliably.

Instead, we must use waitpid() to wait for childs. Hence, we introduce a
new event-source which does that. It reports the PID/status combination
for each child to the registered callbacks.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-12-02 15:06:00 +01:00
David Herrmann
4e6badc3e3 terminal: use "opened" logic
We already keep the open state as "opened" so we should use it instead of
always pushing the work down to the pty layer.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-12-02 14:59:12 +01:00
David Herrmann
57f85f91ce eloop: fix memory loop when signal registration fails
If the signal-registration fails, we need to destroy it again. Otherwise,
it will keep a reference to the current eloop-object and hence it will
never get freed.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-12-02 14:57:43 +01:00
David Herrmann
46898b1090 shl: hook: allow callbacks to destroy the hook
If we currently dispatch a callback and they unregister themself and then
destroy the hook, we currently do not free the hook as we would free
memory that is used in the callstack.
However, it is a valid use-case for hook-callbacks to destroy the hook.
Therefore, we set a "dead" flag and destroy the hook after all callbacks
are done.

This fixes some memory-leaks inside the shared-signal callbacks of eloop.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-12-02 13:56:31 +01:00
David Herrmann
715287427d pty: simplify pty_close()
The old logic is no longer needed as we use edge-triggered fd notification
now. Therefore, simplify the helpers to make them more readable.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-12-02 13:42:15 +01:00
David Herrmann
636c383c68 text: gltex: free atlas during destruction
If we remove an atlas, we have to correctly free its memory. Otherwise, we
will loose the memory.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-12-02 13:40:53 +01:00
David Herrmann
4199d3331e pty: free seat argument on destruction
We didn't correctly free this parameter even though we dup'ed it earlier.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-12-02 13:40:16 +01:00
David Herrmann
24d320b86a seat: unref session after unregistration
Session registration does not provide a reference to the caller. Instead,
the seat itself owns the reference. Hence, we must clear this reference
during unregistration, otherwise we will never free the session structure.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-12-02 13:39:00 +01:00