2011-12-22 16:19:25 +01:00
|
|
|
/*
|
|
|
|
* \brief Terminal service
|
|
|
|
* \author Norman Feske
|
|
|
|
* \date 2011-08-11
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2017-01-17 15:45:54 +01:00
|
|
|
* Copyright (C) 2011-2017 Genode Labs GmbH
|
2011-12-22 16:19:25 +01:00
|
|
|
*
|
|
|
|
* This file is part of the Genode OS framework, which is distributed
|
2017-02-20 13:23:52 +01:00
|
|
|
* under the terms of the GNU Affero General Public License version 3.
|
2011-12-22 16:19:25 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
/* Genode includes */
|
2017-01-02 16:39:55 +01:00
|
|
|
#include <base/component.h>
|
base: avoid use of deprecated base/printf.h
Besides adapting the components to the use of base/log.h, the patch
cleans up a few base headers, i.e., it removes unused includes from
root/component.h, specifically base/heap.h and
ram_session/ram_session.h. Hence, components that relied on the implicit
inclusion of those headers have to manually include those headers now.
While adjusting the log messages, I repeatedly stumbled over the problem
that printing char * arguments is ambiguous. It is unclear whether to
print the argument as pointer or null-terminated string. To overcome
this problem, the patch introduces a new type 'Cstring' that allows the
caller to express that the argument should be handled as null-terminated
string. As a nice side effect, with this type in place, the optional len
argument of the 'String' class could be removed. Instead of supplying a
pair of (char const *, size_t), the constructor accepts a 'Cstring'.
This, in turn, clears the way let the 'String' constructor use the new
output mechanism to assemble a string from multiple arguments (and
thereby getting rid of snprintf within Genode in the near future).
To enforce the explicit resolution of the char * ambiguity, the 'char *'
overload of the 'print' function is marked as deleted.
Issue #1987
2016-07-13 19:07:09 +02:00
|
|
|
#include <base/log.h>
|
2011-12-22 16:19:25 +01:00
|
|
|
#include <base/heap.h>
|
|
|
|
#include <framebuffer_session/connection.h>
|
|
|
|
#include <input_session/connection.h>
|
|
|
|
#include <timer_session/connection.h>
|
2017-01-02 16:39:55 +01:00
|
|
|
#include <base/attached_rom_dataspace.h>
|
|
|
|
#include <base/attached_ram_dataspace.h>
|
2011-12-22 16:19:25 +01:00
|
|
|
#include <input/event.h>
|
2018-03-08 18:27:42 +01:00
|
|
|
#include <nitpicker_gfx/tff_font.h>
|
2011-12-22 16:19:25 +01:00
|
|
|
|
2012-10-09 17:28:44 +02:00
|
|
|
/* terminal includes */
|
2011-12-22 16:19:25 +01:00
|
|
|
#include <terminal/decoder.h>
|
|
|
|
#include <terminal/types.h>
|
2012-10-09 17:28:44 +02:00
|
|
|
#include <terminal/scancode_tracker.h>
|
|
|
|
#include <terminal/keymaps.h>
|
2011-12-22 16:19:25 +01:00
|
|
|
|
2018-02-06 21:32:02 +01:00
|
|
|
/* local includes */
|
|
|
|
#include "text_screen_surface.h"
|
|
|
|
#include "session.h"
|
2013-12-28 22:29:30 +01:00
|
|
|
|
2018-02-06 21:32:02 +01:00
|
|
|
namespace Terminal { struct Main; }
|
2011-12-22 16:19:25 +01:00
|
|
|
|
|
|
|
|
2018-02-06 21:32:02 +01:00
|
|
|
struct Terminal::Main : Character_consumer
|
2011-12-22 16:19:25 +01:00
|
|
|
{
|
|
|
|
/*
|
2018-02-06 21:32:02 +01:00
|
|
|
* Noncopyable
|
2011-12-22 16:19:25 +01:00
|
|
|
*/
|
2018-02-06 21:32:02 +01:00
|
|
|
Main(Main const &);
|
|
|
|
Main &operator = (Main const &);
|
2011-12-22 16:19:25 +01:00
|
|
|
|
2018-02-06 21:32:02 +01:00
|
|
|
Env &_env;
|
2012-10-09 17:28:44 +02:00
|
|
|
|
2018-02-06 21:32:02 +01:00
|
|
|
Attached_rom_dataspace _config { _env, "config" };
|
2013-02-20 22:51:34 +01:00
|
|
|
|
2018-02-06 21:32:02 +01:00
|
|
|
/**
|
|
|
|
* Return font data according to config
|
|
|
|
*/
|
|
|
|
static char const *_font_data(Xml_node config);
|
2013-02-20 22:51:34 +01:00
|
|
|
|
2018-03-08 18:27:42 +01:00
|
|
|
Tff_font::Static_glyph_buffer<4096> _glyph_buffer { };
|
|
|
|
|
|
|
|
Reconstructible<Tff_font> _font { _font_data(_config.xml()), _glyph_buffer };
|
|
|
|
|
2018-02-06 21:32:02 +01:00
|
|
|
Reconstructible<Font_family> _font_family { *_font };
|
2013-02-20 22:51:34 +01:00
|
|
|
|
2018-02-06 21:32:02 +01:00
|
|
|
unsigned char *_keymap = Terminal::usenglish_keymap;
|
|
|
|
unsigned char *_shift = Terminal::usenglish_shift;
|
|
|
|
unsigned char *_altgr = nullptr;
|
2013-02-20 22:51:34 +01:00
|
|
|
|
2018-02-06 21:32:02 +01:00
|
|
|
Color_palette _color_palette { };
|
2011-12-22 16:19:25 +01:00
|
|
|
|
2018-02-06 21:32:02 +01:00
|
|
|
void _handle_config();
|
2011-12-22 16:19:25 +01:00
|
|
|
|
2018-02-06 21:32:02 +01:00
|
|
|
Signal_handler<Main> _config_handler {
|
|
|
|
_env.ep(), *this, &Main::_handle_config };
|
2011-12-22 16:19:25 +01:00
|
|
|
|
2018-02-06 21:32:02 +01:00
|
|
|
Input::Connection _input { _env };
|
|
|
|
Timer::Connection _timer { _env };
|
2012-10-09 15:02:20 +02:00
|
|
|
|
2018-02-06 21:32:02 +01:00
|
|
|
Heap _heap { _env.ram(), _env.rm() };
|
2012-10-09 15:02:20 +02:00
|
|
|
|
2018-02-06 21:32:02 +01:00
|
|
|
Framebuffer _framebuffer { _env, _config_handler };
|
2011-12-22 16:19:25 +01:00
|
|
|
|
2018-02-06 21:32:02 +01:00
|
|
|
typedef Pixel_rgb565 PT;
|
2011-12-22 16:19:25 +01:00
|
|
|
|
2018-02-06 21:32:02 +01:00
|
|
|
Constructible<Text_screen_surface<PT>> _text_screen_surface { };
|
2011-12-22 16:19:25 +01:00
|
|
|
|
2018-02-06 21:32:02 +01:00
|
|
|
Session::Size _terminal_size { };
|
2011-12-22 16:19:25 +01:00
|
|
|
|
|
|
|
/*
|
2018-02-06 21:32:02 +01:00
|
|
|
* Time in milliseconds between a change of the terminal content and the
|
|
|
|
* update of the pixels. By delaying the update, multiple intermediate
|
|
|
|
* changes result in only one rendering step.
|
2011-12-22 16:19:25 +01:00
|
|
|
*/
|
2018-02-06 21:32:02 +01:00
|
|
|
unsigned const _flush_delay = 5;
|
2011-12-22 16:19:25 +01:00
|
|
|
|
2018-02-06 21:32:02 +01:00
|
|
|
bool _flush_scheduled = false;
|
2011-12-22 16:19:25 +01:00
|
|
|
|
2018-02-06 21:32:02 +01:00
|
|
|
void _handle_flush(Duration)
|
|
|
|
{
|
|
|
|
_flush_scheduled = false;
|
2011-12-22 16:19:25 +01:00
|
|
|
|
2018-02-06 21:32:02 +01:00
|
|
|
// XXX distinguish between normal and alternate display
|
|
|
|
if (_text_screen_surface.constructed())
|
|
|
|
_text_screen_surface->redraw();
|
2011-12-22 16:19:25 +01:00
|
|
|
}
|
|
|
|
|
2018-02-06 21:32:02 +01:00
|
|
|
Timer::One_shot_timeout<Main> _flush_timeout {
|
|
|
|
_timer, *this, &Main::_handle_flush };
|
2011-12-22 16:19:25 +01:00
|
|
|
|
2018-02-06 21:32:02 +01:00
|
|
|
void _schedule_flush()
|
|
|
|
{
|
|
|
|
if (!_flush_scheduled) {
|
|
|
|
_flush_timeout.schedule(Microseconds{1000*_flush_delay});
|
|
|
|
_flush_scheduled = true;
|
2011-12-22 16:19:25 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-02-06 21:32:02 +01:00
|
|
|
/**
|
|
|
|
* Character_consumer interface, called from 'Terminal::Session_component'
|
|
|
|
*/
|
|
|
|
void consume_character(Character c) override
|
2011-12-23 19:50:28 +01:00
|
|
|
{
|
2018-02-06 21:32:02 +01:00
|
|
|
// XXX distinguish between normal and alternative display mode (smcup)
|
|
|
|
if (_text_screen_surface.constructed())
|
|
|
|
_text_screen_surface->apply_character(c);
|
2011-12-23 19:50:28 +01:00
|
|
|
|
2018-02-06 21:32:02 +01:00
|
|
|
_schedule_flush();
|
|
|
|
}
|
2012-01-28 00:02:01 +01:00
|
|
|
|
2018-02-06 21:32:02 +01:00
|
|
|
/* input read buffer */
|
|
|
|
Read_buffer _read_buffer { };
|
2012-01-28 00:02:01 +01:00
|
|
|
|
2018-02-06 21:32:02 +01:00
|
|
|
/* create root interface for service */
|
2018-02-07 17:03:19 +01:00
|
|
|
Root_component _root { _env, _heap, _read_buffer, *this };
|
2012-01-28 00:02:01 +01:00
|
|
|
|
2018-02-06 21:32:02 +01:00
|
|
|
/*
|
|
|
|
* builtin keyboard-layout handling
|
|
|
|
*
|
|
|
|
* \deprecated The keyboard layout should be handled by the input-filter
|
|
|
|
* component.
|
|
|
|
*/
|
|
|
|
Constructible<Scancode_tracker> _scancode_tracker { };
|
2012-01-28 00:02:01 +01:00
|
|
|
|
2018-02-06 21:32:02 +01:00
|
|
|
/* state needed for key-repeat handling */
|
|
|
|
unsigned const _repeat_delay = 250;
|
|
|
|
unsigned const _repeat_rate = 25;
|
|
|
|
unsigned _repeat_next = 0;
|
2012-01-28 00:02:01 +01:00
|
|
|
|
2018-02-06 21:32:02 +01:00
|
|
|
void _handle_input();
|
2012-01-28 00:02:01 +01:00
|
|
|
|
2018-02-06 21:32:02 +01:00
|
|
|
Signal_handler<Main> _input_handler {
|
|
|
|
_env.ep(), *this, &Main::_handle_input };
|
2017-01-02 16:39:55 +01:00
|
|
|
|
2018-02-06 21:32:02 +01:00
|
|
|
void _handle_key_repeat(Duration);
|
2017-01-02 16:39:55 +01:00
|
|
|
|
2018-02-06 21:32:02 +01:00
|
|
|
Timer::One_shot_timeout<Main> _key_repeat_timeout {
|
|
|
|
_timer, *this, &Main::_handle_key_repeat };
|
2011-12-22 16:19:25 +01:00
|
|
|
|
2018-02-06 21:32:02 +01:00
|
|
|
Main(Env &env) : _env(env)
|
|
|
|
{
|
|
|
|
_handle_config();
|
2018-02-07 17:03:19 +01:00
|
|
|
_config.sigh(_config_handler);
|
2017-01-17 15:45:54 +01:00
|
|
|
|
2018-02-06 21:32:02 +01:00
|
|
|
_input.sigh(_input_handler);
|
2011-12-22 16:19:25 +01:00
|
|
|
|
2018-02-06 21:32:02 +01:00
|
|
|
/* announce service at our parent */
|
|
|
|
_env.parent().announce(_env.ep().manage(_root));
|
|
|
|
}
|
|
|
|
};
|
2011-12-22 16:19:25 +01:00
|
|
|
|
|
|
|
|
2018-02-06 21:32:02 +01:00
|
|
|
/* built-in fonts */
|
|
|
|
extern char const _binary_notix_8_tff_start;
|
|
|
|
extern char const _binary_terminus_12_tff_start;
|
|
|
|
extern char const _binary_terminus_16_tff_start;
|
2011-12-22 16:19:25 +01:00
|
|
|
|
|
|
|
|
2018-02-06 21:32:02 +01:00
|
|
|
char const *Terminal::Main::_font_data(Xml_node config)
|
|
|
|
{
|
|
|
|
if (config.has_sub_node("font")) {
|
|
|
|
size_t const size = config.sub_node("font").attribute_value("size", 16U);
|
2011-12-22 16:19:25 +01:00
|
|
|
|
2018-02-06 21:32:02 +01:00
|
|
|
switch (size) {
|
|
|
|
case 8: return &_binary_notix_8_tff_start; break;
|
|
|
|
case 12: return &_binary_terminus_12_tff_start; break;
|
|
|
|
case 16: return &_binary_terminus_16_tff_start; break;
|
|
|
|
default: break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return &_binary_terminus_16_tff_start;
|
2011-12-22 16:19:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-02-06 21:32:02 +01:00
|
|
|
void Terminal::Main::_handle_config()
|
2011-12-22 16:19:25 +01:00
|
|
|
{
|
2018-02-06 21:32:02 +01:00
|
|
|
_config.update();
|
2011-12-22 16:19:25 +01:00
|
|
|
|
2018-02-06 21:32:02 +01:00
|
|
|
_font_family.destruct();
|
|
|
|
_font.destruct();
|
2011-12-22 16:19:25 +01:00
|
|
|
|
2018-02-06 21:32:02 +01:00
|
|
|
Xml_node const config = _config.xml();
|
2011-12-22 16:19:25 +01:00
|
|
|
|
2018-03-08 18:27:42 +01:00
|
|
|
_font.construct(_font_data(config), _glyph_buffer);
|
2018-02-06 21:32:02 +01:00
|
|
|
_font_family.construct(*_font);
|
2017-01-02 16:39:55 +01:00
|
|
|
|
|
|
|
/*
|
2018-02-06 21:32:02 +01:00
|
|
|
* Adapt terminal to framebuffer mode changes
|
2017-01-02 16:39:55 +01:00
|
|
|
*/
|
2018-02-07 17:03:19 +01:00
|
|
|
_framebuffer.switch_to_new_mode();
|
|
|
|
_text_screen_surface.construct(_heap, *_font_family,
|
|
|
|
_color_palette, _framebuffer);
|
|
|
|
_terminal_size = _text_screen_surface->size();
|
|
|
|
_root.notify_resized(_terminal_size);
|
|
|
|
_schedule_flush();
|
2017-01-02 16:39:55 +01:00
|
|
|
|
|
|
|
/*
|
2018-02-06 21:32:02 +01:00
|
|
|
* Read keyboard layout from config file
|
2017-01-02 16:39:55 +01:00
|
|
|
*/
|
|
|
|
|
2018-02-06 21:32:02 +01:00
|
|
|
_keymap = Terminal::usenglish_keymap;
|
|
|
|
_shift = Terminal::usenglish_shift;
|
|
|
|
_altgr = nullptr;
|
2017-01-02 16:39:55 +01:00
|
|
|
|
2018-02-06 21:32:02 +01:00
|
|
|
if (config.has_sub_node("keyboard")) {
|
2017-01-02 16:39:55 +01:00
|
|
|
|
2018-02-06 21:32:02 +01:00
|
|
|
if (config.sub_node("keyboard").attribute("layout").has_value("de")) {
|
|
|
|
_keymap = Terminal::german_keymap;
|
|
|
|
_shift = Terminal::german_shift;
|
|
|
|
_altgr = Terminal::german_altgr;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (config.sub_node("keyboard").attribute("layout").has_value("none")) {
|
|
|
|
_keymap = nullptr;
|
|
|
|
_shift = nullptr;
|
|
|
|
_altgr = nullptr;
|
|
|
|
}
|
2017-01-02 16:39:55 +01:00
|
|
|
}
|
2018-02-06 21:32:02 +01:00
|
|
|
|
|
|
|
if (!_scancode_tracker.constructed())
|
|
|
|
_scancode_tracker.construct(_keymap, _shift, _altgr, Terminal::control);
|
|
|
|
}
|
2017-01-02 16:39:55 +01:00
|
|
|
|
|
|
|
|
|
|
|
void Terminal::Main::_handle_input()
|
|
|
|
{
|
|
|
|
_input.for_each_event([&] (Input::Event const &event) {
|
2017-02-13 13:11:12 +01:00
|
|
|
|
|
|
|
if (event.type() == Input::Event::CHARACTER) {
|
|
|
|
Input::Event::Utf8 const utf8 = event.utf8();
|
|
|
|
_read_buffer.add(utf8.b0);
|
|
|
|
if (utf8.b1) _read_buffer.add(utf8.b1);
|
|
|
|
if (utf8.b2) _read_buffer.add(utf8.b2);
|
|
|
|
if (utf8.b3) _read_buffer.add(utf8.b3);
|
|
|
|
}
|
|
|
|
|
2018-02-06 21:32:02 +01:00
|
|
|
/* apply the terminal's built-in character map if configured */
|
|
|
|
if (!_scancode_tracker.constructed())
|
|
|
|
return;
|
|
|
|
|
2017-01-02 16:39:55 +01:00
|
|
|
bool press = (event.type() == Input::Event::PRESS ? true : false);
|
|
|
|
bool release = (event.type() == Input::Event::RELEASE ? true : false);
|
|
|
|
int keycode = event.code();
|
|
|
|
|
|
|
|
if (press || release)
|
2018-02-06 21:32:02 +01:00
|
|
|
_scancode_tracker->submit(keycode, press);
|
2017-01-02 16:39:55 +01:00
|
|
|
|
|
|
|
if (press) {
|
2018-02-06 21:32:02 +01:00
|
|
|
_scancode_tracker->emit_current_character(_read_buffer);
|
2017-01-02 16:39:55 +01:00
|
|
|
|
|
|
|
/* setup first key repeat */
|
|
|
|
_repeat_next = _repeat_delay;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (release)
|
|
|
|
_repeat_next = 0;
|
|
|
|
});
|
|
|
|
|
|
|
|
if (_repeat_next)
|
os/timer: interpolate time via timestamps
Previously, the Genode::Timer::curr_time always used the
Timer_session::elapsed_ms RPC as back end. Now, Genode::Timer reads
this remote time only in a periodic fashion independently from the calls
to Genode::Timer::curr_time. If now one calls Genode::Timer::curr_time,
the function takes the last read remote time value and adapts it using
the timestamp difference since the remote-time read. The conversion
factor from timestamps to time is estimated on every remote-time read
using the last read remote-time value and the timestamp difference since
the last remote time read.
This commit also re-works the timeout test. The test now has two stages.
In the first stage, it tests fast polling of the
Genode::Timer::curr_time. This stage checks the error between locally
interpolated and timer-driver time as well as wether the locally
interpolated time is monotone and sufficiently homogeneous. In the
second stage several periodic and one-shot timeouts are scheduled at
once. This stage checks if the timeouts trigger sufficiently precise.
This commit adds the new Kernel::time syscall to base-hw. The syscall is
solely used by the Genode::Timer on base-hw as substitute for the
timestamp. This is because on ARM, the timestamp function uses the ARM
performance counter that stops counting when the WFI (wait for
interrupt) instruction is active. This instruction, however is used by
the base-hw idle contexts that get active when no user thread needs to
be scheduled. Thus, the ARM performance counter is not a good choice for
time interpolation and we use the kernel internal time instead.
With this commit, the timeout library becomes a basic library. That means
that it is linked against the LDSO which then provides it to the program it
serves. Furthermore, you can't use the timeout library anymore without the
LDSO because through the kernel-dependent LDSO make-files we can achieve a
kernel-dependent timeout implementation.
This commit introduces a structured Duration type that shall successively
replace the use of Microseconds, Milliseconds, and integer types for duration
values.
Open issues:
* The timeout test fails on Raspberry PI because of precision errors in the
first stage. However, this does not render the framework unusable in general
on the RPI but merely is an issue when speaking of microseconds precision.
* If we run on ARM with another Kernel than HW the timestamp speed may
continuously vary from almost 0 up to CPU speed. The Timer, however,
only uses interpolation if the timestamp speed remained stable (12.5%
tolerance) for at least 3 observation periods. Currently, one period is
100ms, so its 300ms. As long as this is not the case,
Timer_session::elapsed_ms is called instead.
Anyway, it might happen that the CPU load was stable for some time so
interpolation becomes active and now the timestamp speed drops. In the
worst case, we would now have 100ms of slowed down time. The bad thing
about it would be, that this also affects the timeout of the period.
Thus, it might "freeze" the local time for more than 100ms.
On the other hand, if the timestamp speed suddenly raises after some
stable time, interpolated time can get too fast. This would shorten the
period but nonetheless may result in drifting away into the far future.
Now we would have the problem that we can't deliver the real time
anymore until it has caught up because the output of Timer::curr_time
shall be monotone. So, effectively local time might "freeze" again for
more than 100ms.
It would be a solution to not use the Trace::timestamp on ARM w/o HW but
a function whose return value causes the Timer to never use
interpolation because of its stability policy.
Fixes #2400
2017-04-22 00:52:23 +02:00
|
|
|
_key_repeat_timeout.schedule(Microseconds{1000*_repeat_next});
|
2017-01-02 16:39:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
os/timer: interpolate time via timestamps
Previously, the Genode::Timer::curr_time always used the
Timer_session::elapsed_ms RPC as back end. Now, Genode::Timer reads
this remote time only in a periodic fashion independently from the calls
to Genode::Timer::curr_time. If now one calls Genode::Timer::curr_time,
the function takes the last read remote time value and adapts it using
the timestamp difference since the remote-time read. The conversion
factor from timestamps to time is estimated on every remote-time read
using the last read remote-time value and the timestamp difference since
the last remote time read.
This commit also re-works the timeout test. The test now has two stages.
In the first stage, it tests fast polling of the
Genode::Timer::curr_time. This stage checks the error between locally
interpolated and timer-driver time as well as wether the locally
interpolated time is monotone and sufficiently homogeneous. In the
second stage several periodic and one-shot timeouts are scheduled at
once. This stage checks if the timeouts trigger sufficiently precise.
This commit adds the new Kernel::time syscall to base-hw. The syscall is
solely used by the Genode::Timer on base-hw as substitute for the
timestamp. This is because on ARM, the timestamp function uses the ARM
performance counter that stops counting when the WFI (wait for
interrupt) instruction is active. This instruction, however is used by
the base-hw idle contexts that get active when no user thread needs to
be scheduled. Thus, the ARM performance counter is not a good choice for
time interpolation and we use the kernel internal time instead.
With this commit, the timeout library becomes a basic library. That means
that it is linked against the LDSO which then provides it to the program it
serves. Furthermore, you can't use the timeout library anymore without the
LDSO because through the kernel-dependent LDSO make-files we can achieve a
kernel-dependent timeout implementation.
This commit introduces a structured Duration type that shall successively
replace the use of Microseconds, Milliseconds, and integer types for duration
values.
Open issues:
* The timeout test fails on Raspberry PI because of precision errors in the
first stage. However, this does not render the framework unusable in general
on the RPI but merely is an issue when speaking of microseconds precision.
* If we run on ARM with another Kernel than HW the timestamp speed may
continuously vary from almost 0 up to CPU speed. The Timer, however,
only uses interpolation if the timestamp speed remained stable (12.5%
tolerance) for at least 3 observation periods. Currently, one period is
100ms, so its 300ms. As long as this is not the case,
Timer_session::elapsed_ms is called instead.
Anyway, it might happen that the CPU load was stable for some time so
interpolation becomes active and now the timestamp speed drops. In the
worst case, we would now have 100ms of slowed down time. The bad thing
about it would be, that this also affects the timeout of the period.
Thus, it might "freeze" the local time for more than 100ms.
On the other hand, if the timestamp speed suddenly raises after some
stable time, interpolated time can get too fast. This would shorten the
period but nonetheless may result in drifting away into the far future.
Now we would have the problem that we can't deliver the real time
anymore until it has caught up because the output of Timer::curr_time
shall be monotone. So, effectively local time might "freeze" again for
more than 100ms.
It would be a solution to not use the Trace::timestamp on ARM w/o HW but
a function whose return value causes the Timer to never use
interpolation because of its stability policy.
Fixes #2400
2017-04-22 00:52:23 +02:00
|
|
|
void Terminal::Main::_handle_key_repeat(Duration)
|
2017-01-02 16:39:55 +01:00
|
|
|
{
|
|
|
|
if (_repeat_next) {
|
|
|
|
|
|
|
|
/* repeat current character or sequence */
|
2018-02-06 21:32:02 +01:00
|
|
|
if (_scancode_tracker.constructed())
|
|
|
|
_scancode_tracker->emit_current_character(_read_buffer);
|
2017-01-02 16:39:55 +01:00
|
|
|
|
|
|
|
_repeat_next = _repeat_rate;
|
|
|
|
}
|
|
|
|
|
|
|
|
_handle_input();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-02-06 21:32:02 +01:00
|
|
|
void Component::construct(Genode::Env &env) { static Terminal::Main main(env); }
|