Remove input_merger component

Fixes #3736
This commit is contained in:
Norman Feske 2020-04-22 16:15:56 +02:00
parent 1459085a4d
commit 840f383e46
8 changed files with 54 additions and 193 deletions

View File

@ -463,9 +463,9 @@ Separate components:
by providing an encrypted connection to a remote host. It is plugged between
NIC server (such as a network driver) and NIC client.
:'os/src/server/input_merger':
A component that merges input events from multiple sources into a single
stream.
:'os/src/server/input_filter':
A component that transforms and merges input events from multiple sources
into a single stream.
:'libports/src/server/acpi_input':
A component that transforms ACPI events into Genode input events.

View File

@ -14,7 +14,7 @@ set build_components {
drivers/input
server/acpi_input
server/dynamic_rom
server/input_merger
server/input_filter
server/report_rom
app/acpica
test/input
@ -130,12 +130,18 @@ append config {
</start>}
append config {
<start name="input_merger">
<start name="input_filter">
<resource name="RAM" quantum="1M" />
<provides> <service name="Input" /> </provides>
<config>
<input label="ps2" />
<input label="acpi" />
<output>
<merge>
<input name="ps2"/>
<input name="acpi"/>
</merge>
</output>
</config>
<route>
<service name="Input" label="ps2"> <child name="ps2_drv" /> </service>
@ -159,7 +165,7 @@ append config {
<start name="test-input">
<resource name="RAM" quantum="1M"/>
<route>
<service name="Input"> <child name="input_merger"/> </service>
<service name="Input"> <child name="input_filter"/> </service>
<service name="Timer"> <child name="timer"/> </service>
<any-service> <parent/> </any-service>
</route>
@ -205,7 +211,7 @@ set boot_modules {
ld.lib.so
timer
ps2_drv
input_merger
input_filter
report_rom
dynamic_rom
acpica

View File

@ -1,25 +0,0 @@
This component merges the input events of multiple sources.
Example configuration:
<start name="input_merger">
<resource name="RAM" quantum="1M" />
<provides>
<service name="Input" />
</provides>
<config>
<input label="ps2" />
<input label="usb_hid" />
</config>
<route>
<service name="Input" label="ps2">
<child name="ps2_drv"/> </service>
<service name="Input" label="usb_hid">
<child name="usb_drv" /> </service>
<any-service> <parent /> <any-child /> </any-service>
</route>
</start>
For each 'input' config node, the component opens an 'Input' session with the
configured label. This label is then evaluated by 'init' to route the session
request to a specific input source component.

View File

@ -1,141 +0,0 @@
/*
* \brief Input event merger
* \author Christian Prochaska
* \date 2014-09-29
*/
/*
* Copyright (C) 2014-2017 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU Affero General Public License version 3.
*/
/* Genode includes */
#include <input/component.h>
#include <input_session/connection.h>
#include <os/static_root.h>
#include <base/component.h>
#include <base/attached_rom_dataspace.h>
#include <base/attached_dataspace.h>
#include <base/heap.h>
#include <base/session_label.h>
#include <util/list.h>
namespace Input_merger
{
using namespace Genode;
struct Input_source;
struct Main;
typedef List<Input_source> Input_sources;
typedef String<Session_label::capacity()> Label;
}
struct Input_merger::Input_source : Input_sources::Element
{
Input::Connection conn;
Input::Session_component &sink;
Genode::Signal_handler<Input_source> event_handler;
void handle_events()
{
conn.for_each_event([&] (Input::Event const &e) { sink.submit(e); });
}
Input_source(Genode::Env &env, Label const &label, Input::Session_component &sink)
:
conn(env, label.string()), sink(sink),
event_handler(env.ep(), *this, &Input_source::handle_events)
{
conn.sigh(event_handler);
}
};
/******************
** Main program **
******************/
struct Input_merger::Main
{
Env &env;
Attached_rom_dataspace config_rom { env, "config" };
Heap heap { env.ram(), env.rm() };
Input_sources input_source_list { };
/*
* Input session provided to our client
*/
Input::Session_component input_session_component { env, env.ram() };
/*
* Attach root interface to the entry point
*/
Static_root<Input::Session> input_root { env.ep().manage(input_session_component) };
void handle_config_update()
{
config_rom.update();
while (Input_source *input_source = input_source_list.first()) {
input_source_list.remove(input_source);
destroy(heap, input_source);
}
config_rom.xml().for_each_sub_node("input", [&] (Xml_node input_node) {
try {
Label label = input_node.attribute_value("label", Label());
try {
Input_source *input_source = new (heap)
Input_source(env, label.string(), input_session_component);
input_source_list.insert(input_source);
} catch (Genode::Service_denied) {
error("parent denied input source '", label, "'");
}
} catch (Xml_node::Nonexistent_attribute) {
error("ignoring invalid input node '", input_node);
}
});
}
Signal_handler<Main> config_update_handler
{ env.ep(), *this, &Main::handle_config_update };
/**
* Constructor
*/
Main(Genode::Env &env) : env(env)
{
input_session_component.event_queue().enabled(true);
/*
* Apply initial configuration
*/
handle_config_update();
/*
* Register signal handler
*/
config_rom.sigh(config_update_handler);
/*
* Announce service
*/
env.parent().announce(env.ep().manage(input_root));
}
};
void Component::construct(Genode::Env &env) { static Input_merger::Main inst(env); }

View File

@ -1,3 +0,0 @@
TARGET = input_merger
SRC_CC = main.cc
LIBS = base

View File

@ -102,7 +102,7 @@ catch { exec dd if=/dev/urandom of=bin/test.bin bs=4096 count=8160 }
# Step 1: prepare and start the actual VM
#
set build_components {
server/input_merger
server/input_filter
server/report_rom server/fs_rom server/vfs
server/tcp_terminal drivers/nic
lib/vfs/lwip lib/vfs/pipe lib/vfs/import
@ -118,7 +118,7 @@ set boot_modules {
vfs fs_rom
posix.lib.so bash.tar coreutils.tar
tcp_terminal vfs_lwip.lib.so vfs_pipe.lib.so vfs_import.lib.so
ipxe_nic_drv report_rom input_merger
ipxe_nic_drv report_rom input_filter
test.bin template.bat
}
@ -245,17 +245,26 @@ set config_of_app {
</config>
</start>
<start name="input_merger" priority="-1">
<start name="input_filter" priority="-1">
<resource name="RAM" quantum="1M" />
<provides>
<service name="Input" />
</provides>
<config>}
append_if [expr $use_ps2] config_of_app {
<input label="ps2" /> }
<input label="ps2"/> }
append_if [expr $use_usb] config_of_app {
<input label="usb_hid" />}
<input label="usb_hid"/>}
append config_of_app {
<output>
<merge>}
append_if [expr $use_ps2] config_of_app {
<input name="ps2"/>}
append_if [expr $use_usb] config_of_app {
<input name="usb_hid"/>}
append config_of_app {
</merge>
</output>
</config>
<route> }
append_if [expr $use_ps2] config_of_app {
@ -272,7 +281,7 @@ append config_of_app {
<provides><service name="Nitpicker"/></provides>
<route>
<service name="Framebuffer"> <child name="fb_drv" /> </service>
<service name="Input"> <child name="input_merger" /> </service>
<service name="Input"> <child name="input_filter" /> </service>
<service name="Report"> <child name="report_rom" /> </service>
<any-service> <parent/> <any-child /> </any-service>
</route>
@ -337,7 +346,7 @@ append config_of_app {
<child name="ram_fs_to"/>
</service>
<service name="File_system"> <child name="rump_fs"/> </service>
<service name="Input"> <child name="input_merger"/> </service>
<service name="Input"> <child name="input_filter"/> </service>
<any-service> <parent/> <any-child/> </any-service>
</route>
</start>

View File

@ -25,7 +25,7 @@ if {[info exists flavor_extension]} {
}
set build_components {
server/input_merger
server/input_filter
drivers/nic
drivers/audio
server/report_rom
@ -33,7 +33,7 @@ set build_components {
}
set boot_modules {
input_merger
input_filter
ipxe_nic_drv
audio_drv
report_rom
@ -45,17 +45,26 @@ if {$use_vbox5_nova} { set virtualbox5_binary "virtualbox5-nova" }
set config_of_app {
<start name="input_merger">
<start name="input_filter">
<resource name="RAM" quantum="1M" />
<provides>
<service name="Input" />
</provides>
<config>}
append_if [expr $use_ps2] config_of_app {
<input label="ps2" /> }
<input label="ps2"/> }
append_if [expr $use_usb] config_of_app {
<input label="usb_hid" />}
<input label="usb_hid"/>}
append config_of_app {
<output>
<merge>}
append_if [expr $use_ps2] config_of_app {
<input name="ps2"/>}
append_if [expr $use_usb] config_of_app {
<input name="usb_hid"/>}
append config_of_app {
</merge>
</output>
</config>
<route> }
append_if [expr $use_ps2] config_of_app {
@ -120,7 +129,7 @@ append config_of_app {
<configfile name="nitpicker.config"/>
<route>
<service name="Framebuffer"> <child name="fb_drv" /> </service>
<service name="Input"> <child name="input_merger" /> </service>
<service name="Input"> <child name="input_filter" /> </service>
<service name="Report"> <child name="report_rom" /> </service>
<service name="ROM" label="nitpicker.config"> <child name="dynamic-config"/> </service>
<any-service> <parent/> <any-child /> </any-service>

View File

@ -25,7 +25,7 @@ append build_components { drivers/input }
append build_components { drivers/rtc }
append build_components { drivers/usb }
append build_components { drivers/nic }
append build_components { server/input_merger }
append build_components { server/input_filter }
append_platform_drv_build_components
@ -110,7 +110,7 @@ append config {
</route>
</start>
<start name="input_merger" priority="-2">
<start name="input_filter" priority="-2">
<resource name="RAM" quantum="1M" />
<provides>
<service name="Input" />
@ -118,6 +118,12 @@ append config {
<config>
<input label="ps2" />
<input label="usb_hid" />
<output>
<merge>
<input name="ps2"/>
<input name="usb_hid"/>
</merge>
</output>
</config>
<route>
<service name="Input" label="ps2"> <child name="ps2_drv" /> </service>
@ -339,7 +345,7 @@ append config {
</vfs>
</config>
<route>
<service name="Input"><child name="input_merger" /></service>
<service name="Input"><child name="input_filter" /></service>
<service name="Nic"> <child name="router2"/> </service>
<service name="Report"> <child name="report_rom"/> </service>
<any-service> <parent /> <any-child /> </any-service>
@ -389,7 +395,7 @@ append boot_modules { rtc_drv }
append boot_modules { usb_drv }
append boot_modules { vfs.lib.so }
append boot_modules { ipxe_nic_drv }
append boot_modules { input_merger }
append boot_modules { input_filter }
append boot_modules { log_terminal }
append_platform_drv_boot_modules