diff --git a/repos/gems/recipes/raw/drivers_managed-pc/drivers.config b/repos/gems/recipes/raw/drivers_managed-pc/drivers.config index 938af629ed..fa98ef8e9b 100644 --- a/repos/gems/recipes/raw/drivers_managed-pc/drivers.config +++ b/repos/gems/recipes/raw/drivers_managed-pc/drivers.config @@ -142,10 +142,10 @@ - + @@ -184,17 +184,6 @@ - - - - - - - - - - - diff --git a/repos/libports/run/acpica.run b/repos/libports/run/acpica.run index 8e1a4a8a11..9f2b2458ed 100644 --- a/repos/libports/run/acpica.run +++ b/repos/libports/run/acpica.run @@ -18,7 +18,6 @@ set build_components { server/event_dump app/acpica app/acpi_event - app/input_event_client } set use_acpica_as_acpi_drv 0 @@ -153,22 +152,11 @@ append config { append config { - - - - - - - - - - - @@ -228,7 +216,6 @@ set boot_modules { acpica acpi_event event_dump - input_event_client } append_platform_drv_boot_modules diff --git a/repos/os/recipes/pkg/drivers_interactive-pbxa9/archives b/repos/os/recipes/pkg/drivers_interactive-pbxa9/archives index 5a1b05cdcb..e676445e82 100644 --- a/repos/os/recipes/pkg/drivers_interactive-pbxa9/archives +++ b/repos/os/recipes/pkg/drivers_interactive-pbxa9/archives @@ -1,5 +1,4 @@ _/src/pbxa9_drivers _/src/platform_drv _/src/event_filter -_/src/input_event_client _/raw/drivers_interactive-pbxa9 diff --git a/repos/os/recipes/raw/drivers_interactive-muen/drivers.config b/repos/os/recipes/raw/drivers_interactive-muen/drivers.config index 1951a5ed35..0ea3a14b5d 100644 --- a/repos/os/recipes/raw/drivers_interactive-muen/drivers.config +++ b/repos/os/recipes/raw/drivers_interactive-muen/drivers.config @@ -57,9 +57,10 @@ - + + @@ -97,17 +98,6 @@ - - - - - - - - - - - diff --git a/repos/os/recipes/raw/drivers_interactive-pbxa9/drivers.config b/repos/os/recipes/raw/drivers_interactive-pbxa9/drivers.config index 0a64cca71d..1f1fc80ea2 100644 --- a/repos/os/recipes/raw/drivers_interactive-pbxa9/drivers.config +++ b/repos/os/recipes/raw/drivers_interactive-pbxa9/drivers.config @@ -78,9 +78,8 @@ - - - + + @@ -105,14 +104,4 @@ - - - - - - - - - - diff --git a/repos/os/recipes/raw/drivers_interactive-pc/drivers.config b/repos/os/recipes/raw/drivers_interactive-pc/drivers.config index cfaa79269a..59a605c918 100644 --- a/repos/os/recipes/raw/drivers_interactive-pc/drivers.config +++ b/repos/os/recipes/raw/drivers_interactive-pc/drivers.config @@ -90,9 +90,10 @@ - + + @@ -130,17 +131,6 @@ - - - - - - - - - - - diff --git a/repos/os/recipes/src/pbxa9_drivers/used_apis b/repos/os/recipes/src/pbxa9_drivers/used_apis index 72c4685a6d..2d46ac2a1b 100644 --- a/repos/os/recipes/src/pbxa9_drivers/used_apis +++ b/repos/os/recipes/src/pbxa9_drivers/used_apis @@ -1,7 +1,7 @@ base os capture_session -input_session +event_session platform_session timer_session blit diff --git a/repos/os/recipes/src/ps2_drv/used_apis b/repos/os/recipes/src/ps2_drv/used_apis index cb7d5b02c8..4c82261f54 100644 --- a/repos/os/recipes/src/ps2_drv/used_apis +++ b/repos/os/recipes/src/ps2_drv/used_apis @@ -1,5 +1,5 @@ base os platform_session -input_session +event_session timer_session diff --git a/repos/os/run/input.run b/repos/os/run/input.run index 0943ce29a6..f46a14fe76 100644 --- a/repos/os/run/input.run +++ b/repos/os/run/input.run @@ -4,17 +4,14 @@ assert_spec x86 -set build_components { - core init timer - server/dynamic_rom - test/input -} +set build_components { core init timer server/dynamic_rom server/event_dump } source ${genode_dir}/repos/base/run/platform_drv.inc append_platform_drv_build_components lappend_if [have_spec ps2] build_components drivers/input/spec/ps2 lappend_if [have_spec sdl] build_components drivers/framebuffer/spec/sdl +lappend_if [have_spec sdl] build_components server/nitpicker build $build_components @@ -58,7 +55,6 @@ append_platform_drv_config append_if [have_spec ps2] config { - @@ -72,23 +68,31 @@ append_if [have_spec ps2] config { + - - } + } append_if [have_spec sdl] config { - - - - - + + + + + + + - } + + + + + + + } append config { @@ -124,15 +128,16 @@ append config { - + + + - - - - - - + + + + + } @@ -146,19 +151,15 @@ install_config $config # # generic modules -set boot_modules { - core ld.lib.so init - timer dynamic_rom - test-input -} +set boot_modules { core ld.lib.so init timer dynamic_rom event_dump } # platform-specific modules append_platform_drv_boot_modules lappend_if [have_spec ps2] boot_modules ps2_drv lappend_if [have_spec sdl] boot_modules fb_sdl +lappend_if [have_spec sdl] boot_modules nitpicker build_boot_image $boot_modules - run_genode_until forever diff --git a/repos/os/src/drivers/input/spec/ps2/input_driver.h b/repos/os/src/drivers/input/spec/ps2/input_driver.h index 737c4be7c5..87fab3cec4 100644 --- a/repos/os/src/drivers/input/spec/ps2/input_driver.h +++ b/repos/os/src/drivers/input/spec/ps2/input_driver.h @@ -14,15 +14,13 @@ #ifndef _DRIVERS__INPUT__SPEC__PS2__INPUT_DRIVER_H_ #define _DRIVERS__INPUT__SPEC__PS2__INPUT_DRIVER_H_ -class Input_driver +#include + +struct Input_driver : Genode::Interface { - public: + virtual void handle_event(Event::Session_client::Batch &) = 0; - virtual void handle_event() = 0; - - virtual bool event_pending() const = 0; - - virtual ~Input_driver() { } + virtual bool event_pending() const = 0; }; #endif /* _DRIVERS__INPUT__SPEC__PS2__INPUT_DRIVER_H_ */ diff --git a/repos/os/src/drivers/input/spec/ps2/irq_handler.h b/repos/os/src/drivers/input/spec/ps2/irq_handler.h index ee413e1614..b1634bb2e5 100644 --- a/repos/os/src/drivers/input/spec/ps2/irq_handler.h +++ b/repos/os/src/drivers/input/spec/ps2/irq_handler.h @@ -28,23 +28,29 @@ class Irq_handler Genode::Irq_session_client _irq; Genode::Signal_handler _handler; Input_driver &_input_driver; + Event::Session_client &_event_session; void _handle() { _irq.ack_irq(); - while (_input_driver.event_pending()) - _input_driver.handle_event(); + _event_session.with_batch([&] (Event::Session_client::Batch &batch) { + while (_input_driver.event_pending()) + _input_driver.handle_event(batch); + }); } public: - Irq_handler(Genode::Entrypoint &ep, Input_driver &input_driver, + Irq_handler(Genode::Entrypoint &ep, + Input_driver &input_driver, + Event::Session_client &event_session, Genode::Irq_session_capability irq_cap) : _irq(irq_cap), _handler(ep, *this, &Irq_handler::_handle), - _input_driver(input_driver) + _input_driver(input_driver), + _event_session(event_session) { _irq.sigh(_handler); _irq.ack_irq(); diff --git a/repos/os/src/drivers/input/spec/ps2/pl050/irq_handler.h b/repos/os/src/drivers/input/spec/ps2/pl050/irq_handler.h deleted file mode 100644 index 4355ddec92..0000000000 --- a/repos/os/src/drivers/input/spec/ps2/pl050/irq_handler.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * \brief Input-interrupt handler - * \author Norman Feske - * \date 2007-10-08 - */ - -/* - * Copyright (C) 2007-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. - */ - -#ifndef _IRQ_HANDLER_H_ -#define _IRQ_HANDLER_H_ - -/* Genode includes */ -#include -#include -#include - -/* local includes */ -#include "input_driver.h" -#include "serial_interface.h" - -class Irq_handler -{ - private: - - Genode::Irq_session_client _irq; - Genode::Signal_handler _dispatcher; - Input_driver &_input_driver; - - void _handle() - { - _irq.ack_irq(); - - /* check for pending PS/2 input */ - while (_input_driver.event_pending()) - _input_driver.handle_event(); - } - - public: - - Irq_handler(Genode::Env &env, Genode::Irq_session_capability irq_cap, - Serial_interface &, Input_driver &input_driver) - : - _irq(irq_cap), - _dispatcher(env.ep(), *this, &Irq_handler::_handle), - _input_driver(input_driver) - { - _irq.sigh(_dispatcher); - _irq.ack_irq(); - } -}; - -#endif /* _IRQ_HANDLER_H_ */ diff --git a/repos/os/src/drivers/input/spec/ps2/pl050/main.cc b/repos/os/src/drivers/input/spec/ps2/pl050/main.cc index d42c1f8a1a..058c804be7 100644 --- a/repos/os/src/drivers/input/spec/ps2/pl050/main.cc +++ b/repos/os/src/drivers/input/spec/ps2/pl050/main.cc @@ -14,10 +14,9 @@ /* Genode includes */ #include #include -#include -#include #include #include +#include /* local includes */ #include "ps2_keyboard.h" @@ -41,20 +40,16 @@ struct Ps2::Main Pl050 _pl050 { _env, _device_0.io_mem_dataspace(), _device_1.io_mem_dataspace() }; - Input::Session_component _session { _env, _env.ram() }; - Input::Root_component _root { _env.ep().rpc_ep(), _session }; - - Timer::Connection _timer { _env }; + Event::Connection _event { _env }; + Timer::Connection _timer { _env }; Genode::Attached_rom_dataspace _config { _env, "config" }; Genode::Reconstructible _verbose { _config.xml() }; - Mouse _mouse { _pl050.aux_interface(), _session.event_queue(), _timer, *_verbose }; - Keyboard _keyboard { _pl050.kbd_interface(), _session.event_queue(), false, *_verbose }; + Mouse _mouse { _pl050.aux_interface(), _timer, *_verbose }; + Keyboard _keyboard { _pl050.kbd_interface(), false, *_verbose }; - Irq_handler _mouse_irq { _env, _device_1.irq(), - _pl050.aux_interface(), _mouse }; - Irq_handler _keyboard_irq { _env, _device_0.irq(), - _pl050.kbd_interface(), _keyboard }; + Irq_handler _mouse_irq { _env.ep(), _mouse, _event, _device_1.irq() }; + Irq_handler _keyboard_irq { _env.ep(), _keyboard, _event, _device_0.irq() }; Led_state _capslock { _env, "capslock" }, _numlock { _env, "numlock" }, @@ -84,8 +79,6 @@ struct Ps2::Main { _config.sigh(_config_handler); _handle_config(); - - env.parent().announce(env.ep().manage(_root)); } }; diff --git a/repos/os/src/drivers/input/spec/ps2/ps2_keyboard.h b/repos/os/src/drivers/input/spec/ps2/ps2_keyboard.h index 08ef773a5e..9db67ec999 100644 --- a/repos/os/src/drivers/input/spec/ps2/ps2_keyboard.h +++ b/repos/os/src/drivers/input/spec/ps2/ps2_keyboard.h @@ -37,7 +37,6 @@ class Ps2::Keyboard : public Input_driver Keyboard &operator = (Keyboard const &); Serial_interface &_kbd; - Input::Event_queue &_ev_queue; bool const _xlate_mode; Verbose const &_verbose; @@ -420,11 +419,9 @@ class Ps2::Keyboard : public Input_driver * If 'xlate_mode' is true, we do not attempt to manually switch the * keyboard to scan code set 2 but just decode the scan-code set 1. */ - Keyboard(Serial_interface &kbd, Input::Event_queue &ev_queue, - bool xlate_mode, Verbose const &verbose) + Keyboard(Serial_interface &kbd, bool xlate_mode, Verbose const &verbose) : - _kbd(kbd), _ev_queue(ev_queue), _xlate_mode(xlate_mode), - _verbose(verbose) + _kbd(kbd), _xlate_mode(xlate_mode), _verbose(verbose) { for (int i = 0; i <= Input::KEY_MAX; i++) _key_state[i] = false; @@ -496,7 +493,7 @@ class Ps2::Keyboard : public Input_driver ** Input driver interface ** ****************************/ - void handle_event() override + void handle_event(Event::Session_client::Batch &batch) override { _state_machine->process(_kbd.read(), _verbose.scancodes); @@ -523,16 +520,11 @@ class Ps2::Keyboard : public Input_driver Genode::log("post ", press ? "PRESS" : "RELEASE", ", " "key_code = ", Input::key_name(key_code)); - if (_ev_queue.avail_capacity() == 0) { - Genode::warning("event queue overflow - dropping events"); - _ev_queue.reset(); - } - /* post event to event queue */ if (press) - _ev_queue.add(Input::Press{key_code}); + batch.submit(Input::Press{key_code}); else - _ev_queue.add(Input::Release{key_code}); + batch.submit(Input::Release{key_code}); /* start with new packet */ _state_machine->reset(); diff --git a/repos/os/src/drivers/input/spec/ps2/ps2_mouse.h b/repos/os/src/drivers/input/spec/ps2/ps2_mouse.h index 9392b83925..9c75cfa7bc 100644 --- a/repos/os/src/drivers/input/spec/ps2/ps2_mouse.h +++ b/repos/os/src/drivers/input/spec/ps2/ps2_mouse.h @@ -74,10 +74,7 @@ class Ps2::Mouse : public Input_driver private: Serial_interface &_aux; - Input::Event_queue &_ev_queue; - Type _type { PS2 }; - Timer::Connection &_timer; Verbose const &_verbose; bool _button_state[NUM_BUTTONS]; @@ -86,41 +83,6 @@ class Ps2::Mouse : public Input_driver int _packet_len { PS2_PACKET_LEN }; int _packet_idx = 0; - void _check_for_event_queue_overflow() - { - if (_ev_queue.avail_capacity()) - return; - - Genode::warning("event queue overflow - dropping events"); - _ev_queue.reset(); - } - - /** - * Generate mouse button event on state changes - * - * Depending on the old and new state, this function - * posts press or release events for the mouse buttons - * to the event queue. Note that the old state value - * gets set to the new state. - */ - void _button_event(bool *old_state, bool new_state, int key_code) - { - if (*old_state == new_state) return; - - if (_verbose.mouse) - Genode::log("post ", new_state ? "PRESS" : "RELEASE", ", " - "key_code=", key_code); - - _check_for_event_queue_overflow(); - - if (new_state) - _ev_queue.add(Input::Press{Input::Keycode(key_code)}); - else - _ev_queue.add(Input::Release{Input::Keycode(key_code)}); - - *old_state = new_state; - } - /** * Probe for extended ImPS/2 mouse (IntelliMouse) */ @@ -180,10 +142,9 @@ class Ps2::Mouse : public Input_driver public: - Mouse(Serial_interface &aux, Input::Event_queue &ev_queue, - Timer::Connection &timer, Verbose const &verbose) + Mouse(Serial_interface &aux, Timer::Connection &timer, Verbose const &verbose) : - _aux(aux), _ev_queue(ev_queue), _timer(timer), _verbose(verbose) + _aux(aux), _timer(timer), _verbose(verbose) { for (unsigned i = 0; i < NUM_BUTTONS; ++i) _button_state[i] = false; @@ -249,7 +210,7 @@ class Ps2::Mouse : public Input_driver ** Input driver interface ** ****************************/ - void handle_event() override + void handle_event(Event::Session_client::Batch &batch) override { _packet[_packet_idx++] = _aux.read(); if (_packet_idx < _packet_len) @@ -278,9 +239,7 @@ class Ps2::Mouse : public Input_driver if (_verbose.mouse) Genode::log("post MOTION, rel_x=", rel_x, ", rel_y=", rel_y); - _check_for_event_queue_overflow(); - - _ev_queue.add(Input::Relative_motion{rel_x, rel_y}); + batch.submit(Input::Relative_motion{rel_x, rel_y}); } /* generate wheel event */ @@ -299,20 +258,42 @@ class Ps2::Mouse : public Input_driver if (_verbose.mouse) Genode::log("post WHEEL, rel_z=", rel_z); - _check_for_event_queue_overflow(); - - _ev_queue.add(Input::Wheel{0, rel_z}); + batch.submit(Input::Wheel{0, rel_z}); } + /** + * Generate mouse button event on state changes + * + * Depending on the old and new state, this function + * posts press or release events for the mouse buttons + * to the event queue. Note that the old state value + * gets set to the new state. + */ + auto button_event = [&] (bool *old_state, bool new_state, int key_code) + { + if (*old_state == new_state) return; + + if (_verbose.mouse) + Genode::log("post ", new_state ? "PRESS" : "RELEASE", ", " + "key_code=", key_code); + + if (new_state) + batch.submit(Input::Press{Input::Keycode(key_code)}); + else + batch.submit(Input::Release{Input::Keycode(key_code)}); + + *old_state = new_state; + }; + /* detect changes of mouse-button state and post corresponding events */ - _button_event(&_button_state[LEFT], ph & FLAG_BTN_LEFT, Input::BTN_LEFT); - _button_event(&_button_state[RIGHT], ph & FLAG_BTN_RIGHT, Input::BTN_RIGHT); - _button_event(&_button_state[MIDDLE], ph & FLAG_BTN_MIDDLE, Input::BTN_MIDDLE); + button_event(&_button_state[LEFT], ph & FLAG_BTN_LEFT, Input::BTN_LEFT); + button_event(&_button_state[RIGHT], ph & FLAG_BTN_RIGHT, Input::BTN_RIGHT); + button_event(&_button_state[MIDDLE], ph & FLAG_BTN_MIDDLE, Input::BTN_MIDDLE); /* post extra button events */ if (_type == EXPS2) { - _button_event(&_button_state[SIDE], _packet[3] & 0x10, Input::BTN_SIDE); - _button_event(&_button_state[EXTRA], _packet[3] & 0x20, Input::BTN_EXTRA); + button_event(&_button_state[SIDE], _packet[3] & 0x10, Input::BTN_SIDE); + button_event(&_button_state[EXTRA], _packet[3] & 0x20, Input::BTN_EXTRA); } /* start new packet */ diff --git a/repos/os/src/drivers/input/spec/ps2/x86/main.cc b/repos/os/src/drivers/input/spec/ps2/x86/main.cc index a2c8f13f3c..9109529508 100644 --- a/repos/os/src/drivers/input/spec/ps2/x86/main.cc +++ b/repos/os/src/drivers/input/spec/ps2/x86/main.cc @@ -17,8 +17,7 @@ #include /* os includes */ -#include -#include +#include #include #include @@ -37,8 +36,7 @@ struct Ps2::Main { Genode::Env &_env; - Input::Session_component _session { _env, _env.ram() }; - Input::Root_component _root { _env.ep().rpc_ep(), _session }; + Event::Connection _event { _env }; Platform::Connection _platform { _env }; @@ -61,13 +59,12 @@ struct Ps2::Main Genode::Reconstructible _verbose { _config.xml() }; - Keyboard _keyboard { _i8042.kbd_interface(), _session.event_queue(), - _i8042.kbd_xlate(), *_verbose }; + Keyboard _keyboard { _i8042.kbd_interface(), _i8042.kbd_xlate(), *_verbose }; - Mouse _mouse { _i8042.aux_interface(), _session.event_queue(), _timer, *_verbose }; + Mouse _mouse { _i8042.aux_interface(), _timer, *_verbose }; - Irq_handler _keyboard_irq { _env.ep(), _keyboard, _device_ps2.irq(0) }; - Irq_handler _mouse_irq { _env.ep(), _mouse, _device_ps2.irq(1) }; + Irq_handler _keyboard_irq { _env.ep(), _keyboard, _event, _device_ps2.irq(0) }; + Irq_handler _mouse_irq { _env.ep(), _mouse, _event, _device_ps2.irq(1) }; Led_state _capslock { _env, "capslock" }, _numlock { _env, "numlock" }, @@ -97,8 +94,6 @@ struct Ps2::Main { _config.sigh(_config_handler); _handle_config(); - - env.parent().announce(env.ep().manage(_root)); } }; diff --git a/repos/ports/run/seoul.inc b/repos/ports/run/seoul.inc index 519e1cea95..65151229f9 100644 --- a/repos/ports/run/seoul.inc +++ b/repos/ports/run/seoul.inc @@ -212,7 +212,7 @@ append config { append_if [expr !$use_usb] config { - + } @@ -408,8 +408,11 @@ append_if $use_usb config { append config { - - + + + + + @@ -435,7 +438,6 @@ append config { - diff --git a/repos/ports/run/vbox5_genode_usb_hid.run b/repos/ports/run/vbox5_genode_usb_hid.run index 51e277d125..53105359d1 100644 --- a/repos/ports/run/vbox5_genode_usb_hid.run +++ b/repos/ports/run/vbox5_genode_usb_hid.run @@ -70,7 +70,7 @@ append config { - + @@ -152,13 +152,15 @@ append config { - + + + - - + + diff --git a/repos/ports/run/virtualbox.run b/repos/ports/run/virtualbox.run index 986cc47c2d..ecfbaa20ca 100644 --- a/repos/ports/run/virtualbox.run +++ b/repos/ports/run/virtualbox.run @@ -86,7 +86,7 @@ append_platform_drv_config append_if [expr $use_ps2] config { - + } append_if [expr $use_usb] config { @@ -166,20 +166,20 @@ append config { - + + + } -append_if [expr $use_ps2] config { - } append_if [expr $use_usb] config { } append config { - - + + diff --git a/repos/ports/run/virtualbox_auto.inc b/repos/ports/run/virtualbox_auto.inc index 3ffc9e05da..d5005488e5 100644 --- a/repos/ports/run/virtualbox_auto.inc +++ b/repos/ports/run/virtualbox_auto.inc @@ -204,7 +204,7 @@ append_if [expr $use_ram_fs && $use_overlay_from_disk] config { append_if [expr $use_rumpfs && $use_ram_fs && $use_overlay_from_disk] config { } append_if [expr $use_ram_fs && $use_overlay_from_disk] config { - + } @@ -213,18 +213,10 @@ append_platform_drv_config append_if [expr $use_ps2] config { - - - - - - - - - + }