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>
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>
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>
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>
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>
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>
Users with multiple GPUs that cannot be used simultaneously should pass
--no-all-gpus if they encounter problems or use --video-devices
explicitly. However, we cannot rely on PRIMARY flags being set for all
kinds of setups. Instead, default behavior should be using all available
GPUs unconditionally (except the safe DRM_BACKED and fbdev PRIMARY logic).
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This moves all systemd code into uterm_systemd.[ch]. This removes all the
ugly #ifdef's.
Furthermore, this fixes some hidden bugs in the previous implementation
and makes use of sd_booted() to see whether runtime systemd is really
available.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We always assumed that the currently active VT is never the VT we open.
However, this is not true so schedule a VT-activation if this happens.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
If we try to detect a device name if no master is active, the
drmGetBusid() call will always return an empty string. Therefore, try to
become drm-master and set the correct interface version before doing this.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We must block the signals before setting the signal handlers to avoid
retrieving them asynchronously.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Framebuffers are not guaranteed to be cleared after we allocate them.
Therefore, clear them as all the other uterm-video backends do.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Session management should be done with global keys. This allows us to use
the known "w", "t", "n" keys for "close", "new tab", "new window" etc.
functionality later.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
If all the auto-detection logic of kmscon still does something you don't
want, you can now use this list to override all this logic with a
statically configured white-list.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This helper tests whether a string-list has only a single entry and
compares this with the given entry.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This was supported for backwards-compatibility, but is no longer
supported. Use the new /etc/kmscon/kmscon.conf files.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
The old options were quite stupid and low-level. It doesn't make sense to
require users to understand "--dumb" (besides, it sounds wrong).
Therefore, two new options replace the old options:
--drm: Enabled by default. If true, kmscon uses primary DRM devices and
avoids primary fbdev devices. If false, kmscon uses no DRM devices
at all but uses primary fbdev devices now.
--hwaccel: Disabled by default. If true, kmscon tries to
hardware-accelerate any rendering if available. This can also
affect fbdev or other devices in the future.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This helper provides information whether a given backend is available and
even whether kernel-runtime support is available for this backend.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We currently have no code that sets PRIMARY flags for fbdev devices so
this logic does not make sense with --fbdev. Hence, imply --all-gpus when
--fbdev is set.
Reported-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This option now allows the user to change the XkbModel from the command
line or configuration file.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We set the model to a system-default, which means, we are hosed if the
system-default is not what the user expects. Therefore, allow setting the
model via internal APIs.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We really _want_ this so turn it on by default. Especially for fake-VTs,
this really should be turned on all the time.
Use --no-switchvt to disable it.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We need to cast the boolean to void* to avoid warnings when using "true"
as default value instead of "false" (which evaluates to 0 => NULL).
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
I forgot again to keep these up to date. The conf-layer updates broke them
horribly. However, we now build them correctly without kmscon-core by
including all required layers directly.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Pressing the 'Pause/Break' key causes the VTE to hang with no apparent
way to recover (from within kmscon). It must turn on some software flow
control, XON/XOFF or whatever.
We might want to do something with this key, but certainly not *that*.
Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This value should not be sent to the application; currently pressing
Scroll Lock does some weird character transposing, which I believe to be
completely accidental.
Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Upon device wakeup or led state changes, we update the keyboard LEDs to
match the new xkb state.
This means that every kmscon instance retains its own LED state, in the
users eyes. In other words, if you had Num Lock set on one kmscon, switched
to an X VT where it's off, and come back, then Num Lock will be set as
when you left. This is what X server, linux VT, etc. do.
Note that since we need to write the LED events to the evdev devices, we
need to open them RDWR. But since we don't really care what happens to
that write(), that's fine.
Also note that this means NumLock is off by default, which might be
annoying. We need to think how to get some 'setleds' or 'numlockx'
equivalent functionality.
Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
'capability' seems to be the common terminology for this, and it sounds
better - so use it.
We also move the enum definition to the header, because otherwise the
'capabilities' field there doesn't make sense.
Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Before we transitioned to xkbcommon, we had some code that, upon
returning from a VT-switch, looked at the evdev led state and updated
the keyboard modifier state accordingly. So if we returned and NumLock
was on, we adjusted ourselves to that. That was pretty cute.
xkbcommon however doesn't support updating the state by LEDs like that.
Normally, the state of the LEDs is derived from the modifiers; going the
other way is tricky, error-prone and not used much. What we should be
doing is updating the LEDs according to *our* state.
This commit does the part of removing the unused dead code.
Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
libxkbcommon has a configure option to set the default values for the
RMLVO's (if they are passed as NULL or "" - we use "" so it'd be safe to
print). If they are not specified there, it's just "us" like we currently
do have. But if they are specified, we should most likely defer to it.
We do the same for the model field, instead of hardcoding "evdev". The
rules field remains hardcoded to "evdev", because we rely on it when
doing the evdev scancode-to-keycode +8 mapping.
Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Now that libxkbcommon had a release, that has some API breakage (in
particular to xkb_keysym_from_name), we should update our code against
it and advise users to just use the xkbcommon release.
This should not happen anymore, for the foreseeable future at least.
Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
By default, kmscon now only uses primary und auxiliary displays. All
uncategorized displays are ignored. This fixes problems with dual-GPU
systems.
--primary-gpu-only makes kmscon not use any auxiliary displays. --all-gpus
makes kmscon also use uncategorized displays.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We now mark auxiliary displays specially so applications know which
devices can be used independently. We currently only mark USB devices as
such but this can be extended in the future for more devices.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We check every DRM GPU now whether it matches the primary PCI GPU. If it
does, we set a new UTERM_MONITOR_PRIMARY flag for the device.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Instead of using different types we now use flags. This is more
appropriate and will allow us more easily to add new flags.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We used to simply probe every GPU that is reported by the kernel. However,
if a system has multiple GPUs that share display controllers, we cannot
use both simultaneously. Unfortunately, the kernel currently does not
notify us about this. Hence, we use some heuristics to determine which GPU
is the boot-gpu/primary-gpu.
This only adds the detection logic, it does not modify any code to use
this detection at all.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
If libfuse is available then kmscon is built with a new session type: cdev
This session creates a fake TTY char-dev via CUSE (which itself uses FUSE)
which then can be used by user-space as if it were a real VT.
This is still incomplete and does only support basic I/O, yet. But it
shows in what direction this is going.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
If we want to fill a whole buffer, we actually might have to read more
data than just the data from the beginning. Therefore, provide an offset
so we can read from multiple pages.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We must provide safe fallbacks if the register-functions are not provided
as they are not compiled into kmscon.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
The wayland-0.99 API changed some bits. This updates wlt-toolkit to work
with the new API.
There are still some bugs that need to be fixed, however, it builds fine
and runs perfectly well on weston. The last flickering/tearing bugs have a
low priority, currently. They can be fixed when kmscon-6 is done.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
If the new mask is equal to the old mask, we shouldn't change anything.
This improves performance and avoids syscalls when they aren't needed.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We can now check keysym names on case-insensitive basis. We can use this
to try to give hints to the user what they probably meant when mistyping a
keysym name.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>