diff --git a/repos/dde_linux/recipes/pkg/drivers_interactive-imx8q_evk/archives b/repos/dde_linux/recipes/pkg/drivers_interactive-imx8q_evk/archives index 1f79737b50..0a883e4379 100644 --- a/repos/dde_linux/recipes/pkg/drivers_interactive-imx8q_evk/archives +++ b/repos/dde_linux/recipes/pkg/drivers_interactive-imx8q_evk/archives @@ -1,4 +1,5 @@ _/src/imx8_fb_drv _/src/usb_host_drv _/src/usb_hid_drv +_/src/input_event_client _/raw/drivers_interactive-imx8q_evk diff --git a/repos/dde_linux/recipes/pkg/drivers_interactive-rpi/archives b/repos/dde_linux/recipes/pkg/drivers_interactive-rpi/archives index 9416721fac..80e7db6c73 100644 --- a/repos/dde_linux/recipes/pkg/drivers_interactive-rpi/archives +++ b/repos/dde_linux/recipes/pkg/drivers_interactive-rpi/archives @@ -1,4 +1,5 @@ _/src/platform_drv _/src/usb_drv _/src/rpi_fb_drv +_/src/input_event_client _/raw/drivers_interactive-rpi diff --git a/repos/dde_linux/recipes/raw/drivers_interactive-imx8q_evk/drivers.config b/repos/dde_linux/recipes/raw/drivers_interactive-imx8q_evk/drivers.config index 91f5a12e41..5ec272bb69 100644 --- a/repos/dde_linux/recipes/raw/drivers_interactive-imx8q_evk/drivers.config +++ b/repos/dde_linux/recipes/raw/drivers_interactive-imx8q_evk/drivers.config @@ -10,13 +10,11 @@ + - - - @@ -68,4 +66,14 @@ + + + + + + + + + + diff --git a/repos/dde_linux/recipes/raw/drivers_interactive-rpi/drivers.config b/repos/dde_linux/recipes/raw/drivers_interactive-rpi/drivers.config index 3496801946..9ca74a2dbe 100644 --- a/repos/dde_linux/recipes/raw/drivers_interactive-rpi/drivers.config +++ b/repos/dde_linux/recipes/raw/drivers_interactive-rpi/drivers.config @@ -10,13 +10,11 @@ + - - - @@ -67,4 +65,14 @@ + + + + + + + + + + diff --git a/repos/gems/recipes/pkg/drivers_managed-pc/archives b/repos/gems/recipes/pkg/drivers_managed-pc/archives index 1fcae1974c..75016727d9 100644 --- a/repos/gems/recipes/pkg/drivers_managed-pc/archives +++ b/repos/gems/recipes/pkg/drivers_managed-pc/archives @@ -8,9 +8,10 @@ _/src/intel_fb_drv _/src/boot_fb_drv _/src/ahci_drv _/src/report_rom -_/src/input_filter +_/src/event_filter _/src/init _/src/driver_manager _/src/rom_filter _/src/rom_reporter +_/src/input_event_client _/raw/drivers_managed-pc diff --git a/repos/gems/recipes/raw/drivers_managed-pc/content.mk b/repos/gems/recipes/raw/drivers_managed-pc/content.mk index 5ffca7ced4..e570c1cae7 100644 --- a/repos/gems/recipes/raw/drivers_managed-pc/content.mk +++ b/repos/gems/recipes/raw/drivers_managed-pc/content.mk @@ -1,11 +1,11 @@ -content: drivers.config fb_drv.config input_filter.config en_us.chargen \ +content: drivers.config fb_drv.config event_filter.config en_us.chargen \ special.chargen numlock_remap.config drivers.config numlock_remap.config: cp $(REP_DIR)/recipes/raw/drivers_managed-pc/$@ $@ -fb_drv.config input_filter.config: +fb_drv.config event_filter.config: cp $(GENODE_DIR)/repos/os/recipes/raw/drivers_interactive-pc/$@ $@ en_us.chargen special.chargen: - cp $(GENODE_DIR)/repos/os/src/server/input_filter/$@ $@ + cp $(GENODE_DIR)/repos/os/src/server/event_filter/$@ $@ diff --git a/repos/gems/recipes/raw/drivers_managed-pc/drivers.config b/repos/gems/recipes/raw/drivers_managed-pc/drivers.config index b1583d20f0..938af629ed 100644 --- a/repos/gems/recipes/raw/drivers_managed-pc/drivers.config +++ b/repos/gems/recipes/raw/drivers_managed-pc/drivers.config @@ -12,6 +12,7 @@ + @@ -29,9 +30,6 @@ - - - @@ -170,20 +168,41 @@ - + - + - + - - + + + + + + + + + + + + + + + + + + + + + + + diff --git a/repos/gems/recipes/raw/drivers_managed-pc/input_filter.config b/repos/gems/recipes/raw/drivers_managed-pc/event_filter.config similarity index 93% rename from repos/gems/recipes/raw/drivers_managed-pc/input_filter.config rename to repos/gems/recipes/raw/drivers_managed-pc/event_filter.config index 0ebf6b5fea..c18bae22a8 100644 --- a/repos/gems/recipes/raw/drivers_managed-pc/input_filter.config +++ b/repos/gems/recipes/raw/drivers_managed-pc/event_filter.config @@ -1,6 +1,4 @@ - - @@ -37,4 +35,6 @@ + + diff --git a/repos/gems/run/cpu_load_display.run b/repos/gems/run/cpu_load_display.run index 08c9640abd..17362cd35e 100644 --- a/repos/gems/run/cpu_load_display.run +++ b/repos/gems/run/cpu_load_display.run @@ -39,16 +39,18 @@ install_config { + - - - - + + + + + diff --git a/repos/gems/run/decorator.run b/repos/gems/run/decorator.run index ac17cfcf08..4ab19c571f 100644 --- a/repos/gems/run/decorator.run +++ b/repos/gems/run/decorator.run @@ -41,9 +41,9 @@ install_config { + - @@ -57,9 +57,11 @@ install_config { - - - + + + + + diff --git a/repos/gems/run/decorator_stress.run b/repos/gems/run/decorator_stress.run index b10ba7a333..5b9d0cb7f6 100644 --- a/repos/gems/run/decorator_stress.run +++ b/repos/gems/run/decorator_stress.run @@ -43,16 +43,18 @@ install_config { + - - - - + + + + + diff --git a/repos/gems/run/depot_deploy.run b/repos/gems/run/depot_deploy.run index d51a24b19f..ce80017048 100644 --- a/repos/gems/run/depot_deploy.run +++ b/repos/gems/run/depot_deploy.run @@ -52,16 +52,18 @@ install_config { + - - - - + + + + + diff --git a/repos/gems/run/driver_manager.run b/repos/gems/run/driver_manager.run index e50c5ac062..905a245340 100644 --- a/repos/gems/run/driver_manager.run +++ b/repos/gems/run/driver_manager.run @@ -50,8 +50,8 @@ install_config { - - + + @@ -61,13 +61,11 @@ install_config { + - - - - + @@ -99,9 +97,11 @@ install_config { - + + + - + @@ -115,7 +115,6 @@ install_config { - diff --git a/repos/gems/run/gui_fader.run b/repos/gems/run/gui_fader.run index 915e8bc2ad..aaa9576918 100644 --- a/repos/gems/run/gui_fader.run +++ b/repos/gems/run/gui_fader.run @@ -38,16 +38,18 @@ install_config { + - - - - + + + + + diff --git a/repos/gems/run/leitzentrale.run b/repos/gems/run/leitzentrale.run index bba1ae0360..0e42b02833 100644 --- a/repos/gems/run/leitzentrale.run +++ b/repos/gems/run/leitzentrale.run @@ -72,9 +72,9 @@ install_config { + - @@ -92,9 +92,11 @@ install_config { - - - + + + + + diff --git a/repos/gems/run/menu_view.run b/repos/gems/run/menu_view.run index b8afc0cd3d..932ec843e0 100644 --- a/repos/gems/run/menu_view.run +++ b/repos/gems/run/menu_view.run @@ -42,16 +42,18 @@ install_config { + - - - - + + + + + diff --git a/repos/gems/run/nano3d.run b/repos/gems/run/nano3d.run index 4433122293..498458416c 100644 --- a/repos/gems/run/nano3d.run +++ b/repos/gems/run/nano3d.run @@ -33,9 +33,9 @@ append config { + - @@ -45,9 +45,11 @@ append config { - - - + + + + + diff --git a/repos/gems/run/sculpt.run b/repos/gems/run/sculpt.run index ede18bb306..ddbe5e97a8 100644 --- a/repos/gems/run/sculpt.run +++ b/repos/gems/run/sculpt.run @@ -99,10 +99,10 @@ install_config { - + - + @@ -243,9 +243,9 @@ install_config { - - - + + + @@ -256,11 +256,11 @@ install_config { + - @@ -269,7 +269,9 @@ install_config { - + + + @@ -278,7 +280,6 @@ install_config { - @@ -516,11 +517,11 @@ file copy -force [genode_dir]/repos/gems/recipes/raw/drivers_managed-pc/drivers. [run_dir]/genode/drivers.config foreach file { en_us.chargen de_ch.chargen de_de.chargen fr_ch.chargen fr_fr.chargen special.chargen } { - file copy -force [genode_dir]/repos/os/src/server/input_filter/$file \ + file copy -force [genode_dir]/repos/os/src/server/event_filter/$file \ [run_dir]/genode/$file } -file copy -force [genode_dir]/repos/gems/recipes/raw/drivers_managed-pc/input_filter.config \ - [run_dir]/genode/input_filter.config +file copy -force [genode_dir]/repos/gems/recipes/raw/drivers_managed-pc/event_filter.config \ + [run_dir]/genode/event_filter.config file copy -force [genode_dir]/repos/gems/recipes/raw/depot_download/depot_download.config \ [run_dir]/genode/depot_download.config diff --git a/repos/gems/run/sculpt/leitzentrale.config b/repos/gems/run/sculpt/leitzentrale.config index d0fb426c7d..f3936b7e43 100644 --- a/repos/gems/run/sculpt/leitzentrale.config +++ b/repos/gems/run/sculpt/leitzentrale.config @@ -221,8 +221,8 @@ - - + + diff --git a/repos/gems/run/sculpt/nitpicker.config b/repos/gems/run/sculpt/nitpicker.config index c043f2d17f..6730f17ffd 100644 --- a/repos/gems/run/sculpt/nitpicker.config +++ b/repos/gems/run/sculpt/nitpicker.config @@ -1,5 +1,5 @@ - - + + diff --git a/repos/gems/run/terminal_echo.run b/repos/gems/run/terminal_echo.run index 8774aa64dd..03e59fd8e1 100644 --- a/repos/gems/run/terminal_echo.run +++ b/repos/gems/run/terminal_echo.run @@ -3,6 +3,8 @@ create_boot_directory import_from_depot [depot_user]/src/[base_src] \ [depot_user]/pkg/[drivers_interactive_pkg] \ [depot_user]/pkg/terminal \ + [depot_user]/src/nitpicker \ + [depot_user]/src/gui_fb \ [depot_user]/src/init install_config { @@ -35,11 +37,32 @@ install_config { + + + + + + - + + + + + + + + + + + + + + + + @@ -57,6 +80,10 @@ install_config { } +set fd [open [run_dir]/genode/focus w] +puts $fd "" +close $fd + build { server/terminal test/terminal_echo } build_boot_image { terminal test-terminal_echo } diff --git a/repos/gems/run/terminal_log.run b/repos/gems/run/terminal_log.run index 522229835e..f3841b7385 100644 --- a/repos/gems/run/terminal_log.run +++ b/repos/gems/run/terminal_log.run @@ -42,25 +42,24 @@ install_config { + - - - - + + + + + - - - - + diff --git a/repos/gems/run/text_area.run b/repos/gems/run/text_area.run index 29dc3d9ae8..5da2ee3baa 100644 --- a/repos/gems/run/text_area.run +++ b/repos/gems/run/text_area.run @@ -42,9 +42,9 @@ install_config { + - @@ -58,9 +58,11 @@ install_config { - - - + + + + + diff --git a/repos/gems/run/text_painter.run b/repos/gems/run/text_painter.run index f751616ab6..06cdb96c6f 100644 --- a/repos/gems/run/text_painter.run +++ b/repos/gems/run/text_painter.run @@ -40,24 +40,23 @@ install_config { + - - - - + + + + + - - - - + diff --git a/repos/gems/run/wm.run b/repos/gems/run/wm.run index 8183a24ac3..cd7099ed00 100644 --- a/repos/gems/run/wm.run +++ b/repos/gems/run/wm.run @@ -45,16 +45,18 @@ install_config { + - - - - + + + + + diff --git a/repos/gems/src/app/sculpt_manager/main.cc b/repos/gems/src/app/sculpt_manager/main.cc index 99eef462ea..071c2b7094 100644 --- a/repos/gems/src/app/sculpt_manager/main.cc +++ b/repos/gems/src/app/sculpt_manager/main.cc @@ -106,12 +106,12 @@ struct Sculpt::Main : Input_event_handler, _handle_gui_mode(); } - Managed_config
_input_filter_config { - _env, "config", "input_filter", *this, &Main::_handle_input_filter_config }; + Managed_config
_event_filter_config { + _env, "config", "event_filter", *this, &Main::_handle_event_filter_config }; - void _handle_input_filter_config(Xml_node) + void _handle_event_filter_config(Xml_node) { - _input_filter_config.try_generate_manually_managed(); + _event_filter_config.try_generate_manually_managed(); } Attached_rom_dataspace _gui_hover { _env, "nitpicker_hover" }; diff --git a/repos/gems/src/test/driver_manager/main.cc b/repos/gems/src/test/driver_manager/main.cc index 6479b217b5..95f3baa992 100644 --- a/repos/gems/src/test/driver_manager/main.cc +++ b/repos/gems/src/test/driver_manager/main.cc @@ -129,11 +129,6 @@ struct Test::Main Main(Env &env) : _env(env) { - if (_config.xml().has_sub_node("check_input")) { - log("connect to input driver"); - Input::Connection input(_env); - } - _block_devices.sigh(_block_devices_update_handler); _check_conditions(); } diff --git a/repos/libports/run/acpica.run b/repos/libports/run/acpica.run index dc0c9d0b6f..4b36c090da 100644 --- a/repos/libports/run/acpica.run +++ b/repos/libports/run/acpica.run @@ -14,10 +14,11 @@ set build_components { drivers/input server/acpi_input server/dynamic_rom - server/input_filter + server/event_filter server/report_rom + server/event_dump app/acpica - test/input + app/input_event_client } set use_acpica_as_acpi_drv 0 @@ -130,22 +131,21 @@ append config { } append config { - + - + - - + + - - + } @@ -162,16 +162,38 @@ append config { - + + + + + + + + + + + + + - } append config { + + + + + + + + + + + @@ -211,12 +233,13 @@ set boot_modules { ld.lib.so timer ps2_drv - input_filter + event_filter report_rom dynamic_rom acpica acpi_input - test-input + event_dump + input_event_client } append_platform_drv_boot_modules diff --git a/repos/libports/run/mesa.inc b/repos/libports/run/mesa.inc index f4d4fb31c4..29ec6e712b 100644 --- a/repos/libports/run/mesa.inc +++ b/repos/libports/run/mesa.inc @@ -55,16 +55,18 @@ set config { + - - - - + + + + + diff --git a/repos/libports/run/mupdf.run b/repos/libports/run/mupdf.run index 02a9e39af4..7078205a76 100644 --- a/repos/libports/run/mupdf.run +++ b/repos/libports/run/mupdf.run @@ -41,16 +41,18 @@ set config { + - - - - + + + + + diff --git a/repos/libports/run/qt5_common.inc b/repos/libports/run/qt5_common.inc index 24e1005f2e..ef7dff10f7 100644 --- a/repos/libports/run/qt5_common.inc +++ b/repos/libports/run/qt5_common.inc @@ -70,30 +70,23 @@ proc qt5_parent_provides { } { # proc language_chargen { } { return "en_us" } -exec cp -f [genode_dir]/repos/os/src/server/input_filter/[language_chargen].chargen bin/ -exec cp -f [genode_dir]/repos/os/src/server/input_filter/special.chargen bin/ +exec cp -f [genode_dir]/repos/os/src/server/event_filter/[language_chargen].chargen bin/ +exec cp -f [genode_dir]/repos/os/src/server/event_filter/special.chargen bin/ -set qt5_input_filter_config { - } -append_if [have_spec ps2] qt5_input_filter_config { - } -append_if [have_spec usb] qt5_input_filter_config { - } -append_if [have_spec linux] qt5_input_filter_config { - } -append qt5_input_filter_config { +set qt5_event_filter_config { + } -append_if [have_spec ps2] qt5_input_filter_config { +append_if [have_spec ps2] qt5_event_filter_config { } -append_if [have_spec usb] qt5_input_filter_config { +append_if [have_spec usb] qt5_event_filter_config { } -append_if [have_spec linux] qt5_input_filter_config { +append_if [have_spec linux] qt5_event_filter_config { } -append qt5_input_filter_config { +append qt5_event_filter_config { @@ -109,17 +102,23 @@ append qt5_input_filter_config { } -append qt5_input_filter_config " +append qt5_event_filter_config " " -append qt5_input_filter_config { +append qt5_event_filter_config { - - -} + } +append_if [have_spec ps2] qt5_event_filter_config { + } +append_if [have_spec usb] qt5_event_filter_config { + } +append_if [have_spec linux] qt5_event_filter_config { + } +append qt5_event_filter_config { + } -set fd [open bin/qt5_input_filter.config w] -puts $fd $qt5_input_filter_config +set fd [open bin/qt5_event_filter.config w] +puts $fd $qt5_event_filter_config close $fd @@ -169,30 +168,32 @@ proc qt5_start_nodes { } { - + - - - + + + + - - + + + - - + + @@ -240,7 +241,7 @@ proc qt5_start_nodes { } { - + @@ -331,5 +332,5 @@ proc qt5_boot_modules { } { lappend boot_modules [language_chargen].chargen lappend boot_modules special.chargen - lappend boot_modules qt5_input_filter.config + lappend boot_modules qt5_event_filter.config } diff --git a/repos/os/recipes/pkg/drivers_interactive-linux/archives b/repos/os/recipes/pkg/drivers_interactive-linux/archives index 11d4a2de0a..75435a211d 100644 --- a/repos/os/recipes/pkg/drivers_interactive-linux/archives +++ b/repos/os/recipes/pkg/drivers_interactive-linux/archives @@ -1,4 +1,3 @@ _/src/fb_sdl -_/src/input_filter -_/src/input_event_bridge +_/src/event_filter _/raw/drivers_interactive-linux diff --git a/repos/os/recipes/pkg/drivers_interactive-muen/archives b/repos/os/recipes/pkg/drivers_interactive-muen/archives index 7d44b2f81a..9d3ee359b0 100644 --- a/repos/os/recipes/pkg/drivers_interactive-muen/archives +++ b/repos/os/recipes/pkg/drivers_interactive-muen/archives @@ -2,5 +2,6 @@ _/src/platform_drv _/src/ps2_drv _/src/usb_drv _/src/vesa_drv -_/src/input_filter +_/src/event_filter +_/src/input_event_client _/raw/drivers_interactive-muen diff --git a/repos/os/recipes/pkg/drivers_interactive-pbxa9/archives b/repos/os/recipes/pkg/drivers_interactive-pbxa9/archives index cacf1cff69..5a1b05cdcb 100644 --- a/repos/os/recipes/pkg/drivers_interactive-pbxa9/archives +++ b/repos/os/recipes/pkg/drivers_interactive-pbxa9/archives @@ -1,4 +1,5 @@ _/src/pbxa9_drivers _/src/platform_drv -_/src/input_filter +_/src/event_filter +_/src/input_event_client _/raw/drivers_interactive-pbxa9 diff --git a/repos/os/recipes/pkg/drivers_interactive-pc/archives b/repos/os/recipes/pkg/drivers_interactive-pc/archives index 8e6555982d..14e05d9899 100644 --- a/repos/os/recipes/pkg/drivers_interactive-pc/archives +++ b/repos/os/recipes/pkg/drivers_interactive-pc/archives @@ -4,5 +4,6 @@ _/src/ps2_drv _/src/usb_drv _/src/vesa_drv _/src/report_rom -_/src/input_filter +_/src/event_filter +_/src/input_event_client _/raw/drivers_interactive-pc diff --git a/repos/os/recipes/raw/drivers_interactive-imx53_qsb/drivers.config b/repos/os/recipes/raw/drivers_interactive-imx53_qsb/drivers.config index f9b7f49345..c6a3c7d43f 100644 --- a/repos/os/recipes/raw/drivers_interactive-imx53_qsb/drivers.config +++ b/repos/os/recipes/raw/drivers_interactive-imx53_qsb/drivers.config @@ -15,9 +15,6 @@ - - - @@ -71,14 +68,4 @@ - - - - - - - - - - diff --git a/repos/os/recipes/raw/drivers_interactive-linux/content.mk b/repos/os/recipes/raw/drivers_interactive-linux/content.mk index a6ef537fce..1d893aa1dd 100644 --- a/repos/os/recipes/raw/drivers_interactive-linux/content.mk +++ b/repos/os/recipes/raw/drivers_interactive-linux/content.mk @@ -1,7 +1,7 @@ -content: drivers.config input_filter.config en_us.chargen special.chargen +content: drivers.config event_filter.config en_us.chargen special.chargen -drivers.config input_filter.config: +drivers.config event_filter.config: cp $(REP_DIR)/recipes/raw/drivers_interactive-linux/$@ $@ en_us.chargen special.chargen: - cp $(REP_DIR)/src/server/input_filter/$@ $@ + cp $(REP_DIR)/src/server/event_filter/$@ $@ diff --git a/repos/os/recipes/raw/drivers_interactive-linux/drivers.config b/repos/os/recipes/raw/drivers_interactive-linux/drivers.config index caafabec9f..45c80b50b2 100644 --- a/repos/os/recipes/raw/drivers_interactive-linux/drivers.config +++ b/repos/os/recipes/raw/drivers_interactive-linux/drivers.config @@ -6,37 +6,28 @@ + - - - - - - - - - - - + - + - + - - + + diff --git a/repos/os/recipes/raw/drivers_interactive-linux/input_filter.config b/repos/os/recipes/raw/drivers_interactive-linux/event_filter.config similarity index 95% rename from repos/os/recipes/raw/drivers_interactive-linux/input_filter.config rename to repos/os/recipes/raw/drivers_interactive-linux/event_filter.config index 7c5380c69c..2926b86e6e 100644 --- a/repos/os/recipes/raw/drivers_interactive-linux/input_filter.config +++ b/repos/os/recipes/raw/drivers_interactive-linux/event_filter.config @@ -1,5 +1,4 @@ - @@ -23,4 +22,5 @@ + diff --git a/repos/os/recipes/raw/drivers_interactive-muen/content.mk b/repos/os/recipes/raw/drivers_interactive-muen/content.mk index b9d8888867..38b5b0334f 100644 --- a/repos/os/recipes/raw/drivers_interactive-muen/content.mk +++ b/repos/os/recipes/raw/drivers_interactive-muen/content.mk @@ -1,7 +1,7 @@ -content: drivers.config fb_drv.config input_filter.config en_us.chargen special.chargen +content: drivers.config fb_drv.config event_filter.config en_us.chargen special.chargen -drivers.config fb_drv.config input_filter.config: +drivers.config fb_drv.config event_filter.config: cp $(REP_DIR)/recipes/raw/drivers_interactive-muen/$@ $@ en_us.chargen special.chargen: - cp $(REP_DIR)/src/server/input_filter/$@ $@ + cp $(REP_DIR)/src/server/event_filter/$@ $@ diff --git a/repos/os/recipes/raw/drivers_interactive-muen/drivers.config b/repos/os/recipes/raw/drivers_interactive-muen/drivers.config index e869ebe6c5..1951a5ed35 100644 --- a/repos/os/recipes/raw/drivers_interactive-muen/drivers.config +++ b/repos/os/recipes/raw/drivers_interactive-muen/drivers.config @@ -11,13 +11,11 @@ + - - - @@ -85,13 +83,12 @@ - + - + - - - + + @@ -100,4 +97,26 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/repos/os/recipes/raw/drivers_interactive-muen/input_filter.config b/repos/os/recipes/raw/drivers_interactive-muen/event_filter.config similarity index 88% rename from repos/os/recipes/raw/drivers_interactive-muen/input_filter.config rename to repos/os/recipes/raw/drivers_interactive-muen/event_filter.config index ca04c44bef..7df670248e 100644 --- a/repos/os/recipes/raw/drivers_interactive-muen/input_filter.config +++ b/repos/os/recipes/raw/drivers_interactive-muen/event_filter.config @@ -1,6 +1,4 @@ - - @@ -27,4 +25,6 @@ + + diff --git a/repos/os/recipes/raw/drivers_interactive-pbxa9/content.mk b/repos/os/recipes/raw/drivers_interactive-pbxa9/content.mk index adddfc4e2f..a7d24fc7c8 100644 --- a/repos/os/recipes/raw/drivers_interactive-pbxa9/content.mk +++ b/repos/os/recipes/raw/drivers_interactive-pbxa9/content.mk @@ -1,7 +1,7 @@ -content: drivers.config input_filter.config en_us.chargen special.chargen +content: drivers.config event_filter.config en_us.chargen special.chargen -drivers.config input_filter.config: +drivers.config event_filter.config: cp $(REP_DIR)/recipes/raw/drivers_interactive-pbxa9/$@ $@ en_us.chargen special.chargen: - cp $(REP_DIR)/src/server/input_filter/$@ $@ + cp $(REP_DIR)/src/server/event_filter/$@ $@ diff --git a/repos/os/recipes/raw/drivers_interactive-pbxa9/drivers.config b/repos/os/recipes/raw/drivers_interactive-pbxa9/drivers.config index 8913739bef..0a64cca71d 100644 --- a/repos/os/recipes/raw/drivers_interactive-pbxa9/drivers.config +++ b/repos/os/recipes/raw/drivers_interactive-pbxa9/drivers.config @@ -8,13 +8,11 @@ + - - - @@ -91,21 +89,30 @@ - + - + - - - - + + + + + + + + + + + + + diff --git a/repos/os/recipes/raw/drivers_interactive-pbxa9/input_filter.config b/repos/os/recipes/raw/drivers_interactive-pbxa9/event_filter.config similarity index 95% rename from repos/os/recipes/raw/drivers_interactive-pbxa9/input_filter.config rename to repos/os/recipes/raw/drivers_interactive-pbxa9/event_filter.config index 056d9fa47b..55cdbc6167 100644 --- a/repos/os/recipes/raw/drivers_interactive-pbxa9/input_filter.config +++ b/repos/os/recipes/raw/drivers_interactive-pbxa9/event_filter.config @@ -1,5 +1,4 @@ - @@ -23,4 +22,5 @@ + diff --git a/repos/os/recipes/raw/drivers_interactive-pc/content.mk b/repos/os/recipes/raw/drivers_interactive-pc/content.mk index 6050a65b23..6a6fac4af4 100644 --- a/repos/os/recipes/raw/drivers_interactive-pc/content.mk +++ b/repos/os/recipes/raw/drivers_interactive-pc/content.mk @@ -1,7 +1,7 @@ -content: drivers.config fb_drv.config input_filter.config en_us.chargen special.chargen +content: drivers.config fb_drv.config event_filter.config en_us.chargen special.chargen -drivers.config fb_drv.config input_filter.config: +drivers.config fb_drv.config event_filter.config: cp $(REP_DIR)/recipes/raw/drivers_interactive-pc/$@ $@ en_us.chargen special.chargen: - cp $(REP_DIR)/src/server/input_filter/$@ $@ + cp $(REP_DIR)/src/server/event_filter/$@ $@ diff --git a/repos/os/recipes/raw/drivers_interactive-pc/drivers.config b/repos/os/recipes/raw/drivers_interactive-pc/drivers.config index d873d9f766..cfaa79269a 100644 --- a/repos/os/recipes/raw/drivers_interactive-pc/drivers.config +++ b/repos/os/recipes/raw/drivers_interactive-pc/drivers.config @@ -11,13 +11,11 @@ + - - - @@ -118,13 +116,12 @@ - + - + - - - + + @@ -133,4 +130,26 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/repos/os/recipes/raw/drivers_interactive-pc/input_filter.config b/repos/os/recipes/raw/drivers_interactive-pc/event_filter.config similarity index 91% rename from repos/os/recipes/raw/drivers_interactive-pc/input_filter.config rename to repos/os/recipes/raw/drivers_interactive-pc/event_filter.config index ca04c44bef..0f78370f9a 100644 --- a/repos/os/recipes/raw/drivers_interactive-pc/input_filter.config +++ b/repos/os/recipes/raw/drivers_interactive-pc/event_filter.config @@ -1,6 +1,4 @@ - - @@ -27,4 +25,6 @@ + + diff --git a/repos/os/recipes/src/input_filter/content.mk b/repos/os/recipes/src/event_filter/content.mk similarity index 62% rename from repos/os/recipes/src/input_filter/content.mk rename to repos/os/recipes/src/event_filter/content.mk index 0bdae927f7..10ffb6a10c 100644 --- a/repos/os/recipes/src/input_filter/content.mk +++ b/repos/os/recipes/src/event_filter/content.mk @@ -1,2 +1,2 @@ -SRC_DIR = src/server/input_filter +SRC_DIR = src/server/event_filter include $(GENODE_DIR)/repos/base/recipes/src/content.inc diff --git a/repos/os/recipes/src/event_filter/hash b/repos/os/recipes/src/event_filter/hash new file mode 100644 index 0000000000..e8bd69e0a3 --- /dev/null +++ b/repos/os/recipes/src/event_filter/hash @@ -0,0 +1 @@ +2020-07-16 b70ed9b9578b7d5713d61bbe4fff8d418d7f9304 diff --git a/repos/os/recipes/src/input_filter/used_apis b/repos/os/recipes/src/event_filter/used_apis similarity index 61% rename from repos/os/recipes/src/input_filter/used_apis rename to repos/os/recipes/src/event_filter/used_apis index ab9bfd369a..d31fcefc0c 100644 --- a/repos/os/recipes/src/input_filter/used_apis +++ b/repos/os/recipes/src/event_filter/used_apis @@ -1,4 +1,4 @@ base os -input_session +event_session timer_session diff --git a/repos/os/recipes/src/imx53_qsb_drivers/content.mk b/repos/os/recipes/src/imx53_qsb_drivers/content.mk index 4dcae22fae..97899c910f 100644 --- a/repos/os/recipes/src/imx53_qsb_drivers/content.mk +++ b/repos/os/recipes/src/imx53_qsb_drivers/content.mk @@ -7,9 +7,8 @@ include/gpio: cp -r $(REP_DIR)/include/gpio $@ src/drivers: - mkdir -p $@/framebuffer/spec $@/input $@/gpio/spec + mkdir -p $@/framebuffer/spec $@/gpio/spec cp -r $(REP_DIR)/src/drivers/gpio/spec/imx $@/gpio/spec/ cp -r $(REP_DIR)/src/drivers/gpio/spec/imx53 $@/gpio/spec/ cp -r $(REP_DIR)/src/drivers/framebuffer/spec/imx53 $@/framebuffer/spec/ cp -r $(REP_DIR)/include/spec/imx53/imx_framebuffer_session $@/framebuffer/spec/imx53/ - cp -r $(REP_DIR)/src/drivers/input/dummy $@/input/ diff --git a/repos/os/recipes/src/input_filter/hash b/repos/os/recipes/src/input_filter/hash deleted file mode 100644 index df22b8209b..0000000000 --- a/repos/os/recipes/src/input_filter/hash +++ /dev/null @@ -1 +0,0 @@ -2020-07-12 a498492b515f8bb5ebf76b61de13b8aeea6bf012 diff --git a/repos/os/run/demo.run b/repos/os/run/demo.run index ade5358b1d..086587e19a 100644 --- a/repos/os/run/demo.run +++ b/repos/os/run/demo.run @@ -48,9 +48,9 @@ install_config { + - @@ -75,11 +75,12 @@ install_config { + - + - + + + diff --git a/repos/os/run/input_filter.run b/repos/os/run/event_filter.run similarity index 87% rename from repos/os/run/input_filter.run rename to repos/os/run/event_filter.run index 8202fe76c7..05fed67533 100644 --- a/repos/os/run/input_filter.run +++ b/repos/os/run/event_filter.run @@ -17,7 +17,7 @@ proc test_char_repeat { } { set build_components { core init timer - server/report_rom server/input_filter test/input_filter + server/report_rom server/event_filter test/event_filter } build $build_components @@ -55,47 +55,50 @@ append config { - - - - + + + + - + - + - + - + - + + + + - - + + @@ -111,8 +114,6 @@ append config { - - @@ -125,6 +126,8 @@ append config { + + @@ -144,8 +147,8 @@ append config { - + @@ -153,7 +156,6 @@ append config { - @@ -161,11 +163,12 @@ append config { + + - @@ -176,6 +179,7 @@ append config { + @@ -203,7 +207,6 @@ append_if [test_char_repeat] config { - @@ -211,6 +214,7 @@ append_if [test_char_repeat] config { + @@ -234,7 +238,6 @@ append config { - @@ -245,12 +248,13 @@ append config { + @@ -270,7 +274,6 @@ append config { - @@ -286,6 +289,7 @@ append config { + @@ -320,7 +324,6 @@ append config { - @@ -328,6 +331,7 @@ append config { + @@ -359,12 +363,12 @@ append config { - + @@ -380,12 +384,12 @@ append config { - + @@ -411,13 +415,13 @@ append config { - + @@ -425,13 +429,13 @@ append config { - + @@ -440,13 +444,13 @@ append config { - + @@ -457,13 +461,13 @@ append config { - + @@ -481,7 +485,7 @@ append config { - + @@ -497,11 +501,11 @@ install_config $config # set boot_modules { core ld.lib.so init timer report_rom - input_filter test-input_filter } + event_filter test-event_filter } build_boot_image $boot_modules append qemu_args " -nographic " -run_genode_until {.*child "test-input_filter" exited with exit value 0.*} 60 +run_genode_until {.*child "test-event_filter" exited with exit value 0.*} 60 diff --git a/repos/os/run/fb_bench.run b/repos/os/run/fb_bench.run index 9f6031142a..dbbe574185 100644 --- a/repos/os/run/fb_bench.run +++ b/repos/os/run/fb_bench.run @@ -49,23 +49,22 @@ install_config { + - - - - + + + + + - - - - + diff --git a/repos/os/run/framebuffer.run b/repos/os/run/framebuffer.run index af4b9418bb..31a03b4e6b 100644 --- a/repos/os/run/framebuffer.run +++ b/repos/os/run/framebuffer.run @@ -3,7 +3,7 @@ import_from_depot [depot_user]/src/[base_src] \ [depot_user]/pkg/[drivers_interactive_pkg] \ [depot_user]/src/init -build { test/framebuffer } +build { server/event_dump test/framebuffer } install_config { @@ -34,9 +34,15 @@ install_config { + - + + + + + + @@ -44,7 +50,9 @@ install_config { + } -build_boot_image { test-framebuffer } +build_boot_image { event_dump test-framebuffer } + run_genode_until forever diff --git a/repos/os/run/loader.run b/repos/os/run/loader.run index 2e8ed9f9b7..e80f0eb006 100644 --- a/repos/os/run/loader.run +++ b/repos/os/run/loader.run @@ -38,16 +38,18 @@ install_config { + - - - - + + + + + diff --git a/repos/os/run/pointer.run b/repos/os/run/pointer.run index f99eae560e..4b51fdafbf 100644 --- a/repos/os/run/pointer.run +++ b/repos/os/run/pointer.run @@ -12,7 +12,6 @@ set build_components { server/report_rom server/dynamic_rom server/nitpicker - server/input_event_bridge app/pointer test/pointer test/nitpicker @@ -50,17 +49,7 @@ set config { - - - - - - - - - - - + @@ -71,11 +60,9 @@ set config { - + - - @@ -93,28 +80,30 @@ set config { + - - - + + + + + - - + + - - - - - - - + + + + + + @@ -132,6 +121,7 @@ set config { + @@ -146,6 +136,7 @@ set config { + @@ -160,6 +151,7 @@ set config { + @@ -184,6 +176,7 @@ set config { + @@ -227,6 +220,7 @@ set config { + @@ -239,6 +233,7 @@ set config { + @@ -251,6 +246,7 @@ set config { + @@ -263,6 +259,7 @@ set config { + @@ -292,7 +289,6 @@ set boot_modules { pointer test-pointer testnit - input_event_bridge } # "lsort -unique" removes duplicates but core must be first diff --git a/repos/os/src/server/input_filter/README b/repos/os/src/server/event_filter/README similarity index 94% rename from repos/os/src/server/input_filter/README rename to repos/os/src/server/event_filter/README index 32707b3914..87aa2992bc 100644 --- a/repos/os/src/server/input_filter/README +++ b/repos/os/src/server/event_filter/README @@ -4,7 +4,7 @@ This component transforms input events originating from multiple sources. Configuration ------------- -An input-filter configuration consists of two parts, a declaration of +An event-filter configuration consists of two parts, a declaration of input sources ("Input" connections) that the component should request, and the definition of a filter chain. Each input source is defined via an '' node with the name of the input source as 'name' attribute and @@ -120,7 +120,7 @@ sub nodes: generated instantly on key press but only after the sequence is completed. If an unfinished sequence can't be completed due to an unmatched character, the sequence is aborted and no character is - generated. input_filter supports sequences of up to four characters. + generated. Sequences of up to four characters are supported. For example, the French AZERTY keyboard layout [1] has a dead key for Circumflex Accent "^" right of the P key (which is bracket left @@ -165,11 +165,11 @@ sub nodes: Additional features ------------------- -The input filter is able to respond to configuration updates as well as updates +The event filter is able to respond to configuration updates as well as updates of included ROM modules. However, a new configuration is applied only if the input sources are in their idle state - that is, no key is pressed. This ensures the consistency of the generated key events (for each press event there -must be a corresponding release event), on which clients of the input filter +must be a corresponding release event), on which clients of the event filter may depend. However, this deferred reconfiguration can be overridden by setting the 'force' attribute of the '' node to 'yes'. If forced, the new configuration is applied immediately. @@ -178,7 +178,7 @@ configuration is applied immediately. Examples -------- -An automated test that exercises various corner cases of the input filter -can be found at _os/run/input_filter.run_. For a practical example of how -to use the input filter with the terminal, please refer to the +An automated test that exercises various corner cases of the event filter +can be found at _os/run/event_filter.run_. For a practical example of how +to use the event filter with the terminal, please refer to the _gems/run/terminal_echo.run_ script. diff --git a/repos/os/src/server/input_filter/accelerate_source.h b/repos/os/src/server/event_filter/accelerate_source.h similarity index 84% rename from repos/os/src/server/input_filter/accelerate_source.h rename to repos/os/src/server/event_filter/accelerate_source.h index 6226193539..2ad11941f7 100644 --- a/repos/os/src/server/input_filter/accelerate_source.h +++ b/repos/os/src/server/event_filter/accelerate_source.h @@ -11,8 +11,8 @@ * under the terms of the GNU Affero General Public License version 3. */ -#ifndef _INPUT_FILTER__ACCELERATE_SOURCE_H_ -#define _INPUT_FILTER__ACCELERATE_SOURCE_H_ +#ifndef _EVENT_FILTER__ACCELERATE_SOURCE_H_ +#define _EVENT_FILTER__ACCELERATE_SOURCE_H_ /* Genode includes */ #include @@ -22,10 +22,10 @@ #include #include -namespace Input_filter { class Accelerate_source; } +namespace Event_filter { class Accelerate_source; } -class Input_filter::Accelerate_source : public Source, Source::Filter +class Event_filter::Accelerate_source : public Source, Source::Filter { private: @@ -86,14 +86,12 @@ class Input_filter::Accelerate_source : public Source, Source::Filter */ void filter_event(Sink &destination, Input::Event const &event) override { - using namespace Input; - - Event ev = event; + Input::Event ev = event; ev.handle_relative_motion([&] (int x, int y) { - ev = Relative_motion{_apply_acceleration(x), - _apply_acceleration(y)}; }); - destination.submit_event(ev); + ev = Input::Relative_motion{_apply_acceleration(x), + _apply_acceleration(y)}; }); + destination.submit(ev); } public: @@ -116,4 +114,4 @@ class Input_filter::Accelerate_source : public Source, Source::Filter } }; -#endif /* _INPUT_FILTER__ACCELERATE_SOURCE_H_ */ +#endif /* _EVENT_FILTER__ACCELERATE_SOURCE_H_ */ diff --git a/repos/os/src/server/input_filter/button_scroll_source.h b/repos/os/src/server/event_filter/button_scroll_source.h similarity index 91% rename from repos/os/src/server/input_filter/button_scroll_source.h rename to repos/os/src/server/event_filter/button_scroll_source.h index afd30d7130..1d75b9770f 100644 --- a/repos/os/src/server/input_filter/button_scroll_source.h +++ b/repos/os/src/server/event_filter/button_scroll_source.h @@ -11,8 +11,8 @@ * under the terms of the GNU Affero General Public License version 3. */ -#ifndef _INPUT_FILTER__BUTTON_SCROLL_SOURCE_H_ -#define _INPUT_FILTER__BUTTON_SCROLL_SOURCE_H_ +#ifndef _EVENT_FILTER__BUTTON_SCROLL_SOURCE_H_ +#define _EVENT_FILTER__BUTTON_SCROLL_SOURCE_H_ /* Genode includes */ #include @@ -21,10 +21,10 @@ #include #include -namespace Input_filter { class Button_scroll_source; } +namespace Event_filter { class Button_scroll_source; } -class Input_filter::Button_scroll_source : public Source, Source::Filter +class Event_filter::Button_scroll_source : public Source, Source::Filter { private: @@ -167,7 +167,7 @@ class Input_filter::Button_scroll_source : public Source, Source::Filter wheel_y = _vertical_wheel .pending_motion(); if (wheel_x || wheel_y) - destination.submit_event(Input::Wheel{wheel_x, wheel_y}); + destination.submit(Input::Wheel{wheel_x, wheel_y}); /* * Submit both press event and release event of magic button at @@ -185,8 +185,8 @@ class Input_filter::Button_scroll_source : public Source, Source::Filter if (_vertical_wheel .handle_deactivation(event) | _horizontal_wheel.handle_deactivation(event)) { - destination.submit_event(Input::Press{key}); - destination.submit_event(Input::Release{key}); + destination.submit(Input::Press{key}); + destination.submit(Input::Release{key}); } }); return; @@ -196,7 +196,7 @@ class Input_filter::Button_scroll_source : public Source, Source::Filter if (_vertical_wheel .suppressed(event)) return; if (_horizontal_wheel.suppressed(event)) return; - destination.submit_event(event); + destination.submit(event); } static Xml_node _sub_node(Xml_node node, char const *type) @@ -224,4 +224,4 @@ class Input_filter::Button_scroll_source : public Source, Source::Filter } }; -#endif /* _INPUT_FILTER__BUTTON_SCROLL_SOURCE_H_ */ +#endif /* _EVENT_FILTER__BUTTON_SCROLL_SOURCE_H_ */ diff --git a/repos/os/src/server/input_filter/chargen_source.h b/repos/os/src/server/event_filter/chargen_source.h similarity index 97% rename from repos/os/src/server/input_filter/chargen_source.h rename to repos/os/src/server/event_filter/chargen_source.h index 5bc665555b..2f09c43138 100644 --- a/repos/os/src/server/input_filter/chargen_source.h +++ b/repos/os/src/server/event_filter/chargen_source.h @@ -11,8 +11,8 @@ * under the terms of the GNU Affero General Public License version 3. */ -#ifndef _INPUT_FILTER__CHARGEN_SOURCE_H_ -#define _INPUT_FILTER__CHARGEN_SOURCE_H_ +#ifndef _EVENT_FILTER__CHARGEN_SOURCE_H_ +#define _EVENT_FILTER__CHARGEN_SOURCE_H_ /* Genode includes */ #include @@ -22,10 +22,10 @@ #include #include -namespace Input_filter { class Chargen_source; } +namespace Event_filter { class Chargen_source; } -class Input_filter::Chargen_source : public Source, Source::Filter +class Event_filter::Chargen_source : public Source, Source::Filter { private: @@ -544,9 +544,9 @@ class Input_filter::Chargen_source : public Source, Source::Filter void emit_events(Source::Sink &destination) { for (unsigned i = 0; i < _pending_event_count; i++) { - destination.submit_event(Input::Press_char{Input::KEY_UNKNOWN, - _curr_character}); - destination.submit_event(Input::Release{Input::KEY_UNKNOWN}); + destination.submit(Input::Press_char{Input::KEY_UNKNOWN, + _curr_character}); + destination.submit(Input::Release{Input::KEY_UNKNOWN}); } _pending_event_count = 0; @@ -619,7 +619,7 @@ class Input_filter::Chargen_source : public Source, Source::Filter }); /* forward filtered event */ - destination.submit_event(ev); + destination.submit(ev); } Source &_source; @@ -761,4 +761,4 @@ class Input_filter::Chargen_source : public Source, Source::Filter } }; -#endif /* _INPUT_FILTER__CHARGEN_SOURCE_H_ */ +#endif /* _EVENT_FILTER__CHARGEN_SOURCE_H_ */ diff --git a/repos/os/src/server/input_filter/de_ch.chargen b/repos/os/src/server/event_filter/de_ch.chargen similarity index 100% rename from repos/os/src/server/input_filter/de_ch.chargen rename to repos/os/src/server/event_filter/de_ch.chargen diff --git a/repos/os/src/server/input_filter/de_de.chargen b/repos/os/src/server/event_filter/de_de.chargen similarity index 100% rename from repos/os/src/server/input_filter/de_de.chargen rename to repos/os/src/server/event_filter/de_de.chargen diff --git a/repos/os/src/server/input_filter/en_us.chargen b/repos/os/src/server/event_filter/en_us.chargen similarity index 100% rename from repos/os/src/server/input_filter/en_us.chargen rename to repos/os/src/server/event_filter/en_us.chargen diff --git a/repos/os/src/server/input_filter/en_workman.chargen b/repos/os/src/server/event_filter/en_workman.chargen similarity index 100% rename from repos/os/src/server/input_filter/en_workman.chargen rename to repos/os/src/server/event_filter/en_workman.chargen diff --git a/repos/os/src/server/event_filter/event_session.h b/repos/os/src/server/event_filter/event_session.h new file mode 100644 index 0000000000..554c20bfe6 --- /dev/null +++ b/repos/os/src/server/event_filter/event_session.h @@ -0,0 +1,218 @@ +/* + * \brief Event service + * \author Norman Feske + * \date 2020-07-16 + */ + +/* + * Copyright (C) 2020 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 _EVENT_FILTER__EVENT_SESSION_H_ +#define _EVENT_FILTER__EVENT_SESSION_H_ + +/* Genode includes */ +#include +#include +#include +#include +#include +#include + +/* local includes */ +#include + +namespace Event_filter { + + typedef String Input_name; + + class Event_session; + class Event_root; +} + + +class Event_filter::Event_session : public Session_object +{ + private: + + Input_name _input_name { }; /* may change on reconfiguration */ + + Source::Trigger &_trigger; + + Constrained_ram_allocator _ram; + + Attached_ram_dataspace _ds; + + unsigned _pending_count = 0; + + unsigned _key_cnt = 0; + + template + void _for_each_pending_event(FN const &fn) const + { + Input::Event const * const events = _ds.local_addr(); + + for (unsigned i = 0; i < _pending_count; i++) + fn(events[i]); + } + + public: + + Event_session(Env &env, + Resources const &resources, + Label const &label, + Diag const &diag, + Source::Trigger &trigger) + : + Session_object(env.ep(), resources, label, diag), + _trigger(trigger), + _ram(env.ram(), _ram_quota_guard(), _cap_quota_guard()), + _ds(_ram, env.rm(), 4096) + { } + + /** + * Collect pending input from event client + * + * \param input_name name of queried input + * + * This method is called during processing of 'Main::trigger_generate'. + */ + template + void for_each_pending_event(Input_name const &input_name, FN const &fn) const + { + if (input_name == _input_name) + _for_each_pending_event(fn); + } + + bool idle() const { return (_key_cnt == 0); } + + /** + * (Re-)assign input name to session according to session policy + */ + void assign_input_name(Xml_node config) + { + _input_name = Input_name(); + + try { + Session_policy policy(_label, config); + + _input_name = policy.attribute_value("input", Input_name()); + + } catch (Service_denied) { } + } + + + /***************************** + ** Event session interface ** + *****************************/ + + Dataspace_capability dataspace() { return _ds.cap(); } + + void submit_batch(unsigned const count) + { + size_t const max_events = _ds.size() / sizeof(Input::Event); + + if (count > max_events) + warning("number of events exceeds dataspace capacity"); + + _pending_count = min(count, max_events); + + auto update_key_cnt = [&] (Input::Event const &event) + { + if (event.press()) _key_cnt++; + if (event.release()) _key_cnt--; + }; + + _for_each_pending_event(update_key_cnt); + + _trigger.trigger_generate(); + + _pending_count = 0; + } +}; + + +class Event_filter::Event_root : public Root_component +{ + private: + + Env &_env; + + Source::Trigger &_trigger; + + Attached_rom_dataspace const &_config; + + Registry> _sessions { }; + + protected: + + Event_session *_create_session(const char *args) override + { + Event_session &session = *new (md_alloc()) + Registered(_sessions, + _env, + session_resources_from_args(args), + session_label_from_args(args), + session_diag_from_args(args), + _trigger); + + session.assign_input_name(_config.xml()); + + return &session; + } + + void _upgrade_session(Event_session *s, const char *args) override + { + s->upgrade(ram_quota_from_args(args)); + s->upgrade(cap_quota_from_args(args)); + } + + void _destroy_session(Event_session *session) override + { + Genode::destroy(md_alloc(), session); + } + + public: + + /** + * Constructor + */ + Event_root(Env &env, Allocator &md_alloc, Source::Trigger &trigger, + Attached_rom_dataspace const &config) + : + Root_component(&env.ep().rpc_ep(), &md_alloc), + _env(env), _trigger(trigger), _config(config) + { } + + template + void for_each_pending_event(Input_name const &input_name, FN const &fn) const + { + _sessions.for_each([&] (Event_session const &session) { + session.for_each_pending_event(input_name, fn); }); + } + + /** + * Return true if no client holds any keys pressed + */ + bool all_sessions_idle() const + { + bool idle = true; + + _sessions.for_each([&] (Event_session const &session) { + if (!session.idle()) + idle = false; }); + + return idle; + } + + void apply_config(Xml_node const &config) + { + _sessions.for_each([&] (Event_session &session) { + session.assign_input_name(config); }); + } +}; + +#endif /* _EVENT_FILTER__EVENT_SESSION_H_ */ diff --git a/repos/os/src/server/input_filter/fr_ch.chargen b/repos/os/src/server/event_filter/fr_ch.chargen similarity index 100% rename from repos/os/src/server/input_filter/fr_ch.chargen rename to repos/os/src/server/event_filter/fr_ch.chargen diff --git a/repos/os/src/server/input_filter/fr_fr.chargen b/repos/os/src/server/event_filter/fr_fr.chargen similarity index 100% rename from repos/os/src/server/input_filter/fr_fr.chargen rename to repos/os/src/server/event_filter/fr_fr.chargen diff --git a/repos/os/src/server/input_filter/include_accessor.h b/repos/os/src/server/event_filter/include_accessor.h similarity index 83% rename from repos/os/src/server/input_filter/include_accessor.h rename to repos/os/src/server/event_filter/include_accessor.h index 4df98095d4..eb44f6567e 100644 --- a/repos/os/src/server/input_filter/include_accessor.h +++ b/repos/os/src/server/event_filter/include_accessor.h @@ -11,8 +11,8 @@ * under the terms of the GNU Affero General Public License version 3. */ -#ifndef _INPUT_FILTER__INCLUDE_ACCESSOR_H_ -#define _INPUT_FILTER__INCLUDE_ACCESSOR_H_ +#ifndef _EVENT_FILTER__INCLUDE_ACCESSOR_H_ +#define _EVENT_FILTER__INCLUDE_ACCESSOR_H_ /* Genode includes */ #include @@ -20,10 +20,10 @@ /* local includes */ #include -namespace Input_filter { struct Include_accessor; } +namespace Event_filter { struct Include_accessor; } -class Input_filter::Include_accessor : Interface +class Event_filter::Include_accessor : Interface { public: @@ -64,4 +64,4 @@ class Input_filter::Include_accessor : Interface } }; -#endif /* _INPUT_FILTER__INCLUDE_ACCESSOR_H_ */ +#endif /* _EVENT_FILTER__INCLUDE_ACCESSOR_H_ */ diff --git a/repos/os/src/server/event_filter/input_source.h b/repos/os/src/server/event_filter/input_source.h new file mode 100644 index 0000000000..350a102414 --- /dev/null +++ b/repos/os/src/server/event_filter/input_source.h @@ -0,0 +1,51 @@ +/* + * \brief Input-event source that obtains events from input connection + * \author Norman Feske + * \date 2017-02-01 + */ + +/* + * Copyright (C) 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 _EVENT_FILTER__INPUT_SOURCE_H_ +#define _EVENT_FILTER__INPUT_SOURCE_H_ + +/* local includes */ +#include +#include + +namespace Event_filter { class Input_source; } + + +class Event_filter::Input_source : public Source +{ + private: + + Input_name const _input_name; + + Event_root const &_event_root; + + public: + + static char const *name() { return "input"; } + + Input_source(Owner &owner, Input_name const &input_name, + Event_root const &event_root) + : + Source(owner), _input_name(input_name), _event_root(event_root) + { } + + void generate(Sink &sink) override + { + _event_root.for_each_pending_event(_input_name, + [&] (Input::Event const &event) { + sink.submit(event); + }); + } +}; + +#endif /* _EVENT_FILTER__INPUT_SOURCE_H_ */ diff --git a/repos/os/src/server/input_filter/key_code_by_name.h b/repos/os/src/server/event_filter/key_code_by_name.h similarity index 82% rename from repos/os/src/server/input_filter/key_code_by_name.h rename to repos/os/src/server/event_filter/key_code_by_name.h index 400db90def..881f9f11a1 100644 --- a/repos/os/src/server/input_filter/key_code_by_name.h +++ b/repos/os/src/server/event_filter/key_code_by_name.h @@ -11,14 +11,14 @@ * under the terms of the GNU Affero General Public License version 3. */ -#ifndef _INPUT_FILTER__KEY_CODE_BY_NAME_H_ -#define _INPUT_FILTER__KEY_CODE_BY_NAME_H_ +#ifndef _EVENT_FILTER__KEY_CODE_BY_NAME_H_ +#define _EVENT_FILTER__KEY_CODE_BY_NAME_H_ /* Genode includes */ #include #include -namespace Input_filter { +namespace Event_filter { struct Unknown_key : Genode::Exception { }; @@ -38,4 +38,4 @@ namespace Input_filter { } } -#endif /* _INPUT_FILTER__KEY_CODE_BY_NAME_H_ */ +#endif /* _EVENT_FILTER__KEY_CODE_BY_NAME_H_ */ diff --git a/repos/os/src/server/input_filter/main.cc b/repos/os/src/server/event_filter/main.cc similarity index 65% rename from repos/os/src/server/input_filter/main.cc rename to repos/os/src/server/event_filter/main.cc index 349301f791..7cb90dc98f 100644 --- a/repos/os/src/server/input_filter/main.cc +++ b/repos/os/src/server/event_filter/main.cc @@ -12,12 +12,10 @@ */ /* Genode includes */ -#include -#include #include -#include #include #include +#include /* local includes */ #include @@ -26,12 +24,12 @@ #include #include #include +#include -namespace Input_filter { struct Main; } +namespace Event_filter { struct Main; } -struct Input_filter::Main : Input_connection::Avail_handler, - Source::Factory, Source::Trigger +struct Event_filter::Main : Source::Factory, Source::Trigger { Env &_env; @@ -39,18 +37,16 @@ struct Input_filter::Main : Input_connection::Avail_handler, Heap _heap { _env.ram(), _env.rm() }; - Registry > _input_connections { }; - - typedef String Label; + Event_root _event_root { _env, _heap, *this, _config }; /* * Mechanism to construct a 'Timer' on demand * - * By lazily constructing the timer, the input-filter does not depend + * By lazily constructing the timer, the event-filter does not depend * on a timer service unless its configuration defines time-related * filtering operations like key repeat. */ - struct Timer_accessor : Input_filter::Timer_accessor + struct Timer_accessor : Event_filter::Timer_accessor { struct Lazy { @@ -80,7 +76,7 @@ struct Input_filter::Main : Input_connection::Avail_handler, /** * Pool of configuration include snippets, obtained as ROM modules */ - struct Include_accessor : Input_filter::Include_accessor + struct Include_accessor : Event_filter::Include_accessor { struct Rom { @@ -225,20 +221,11 @@ struct Input_filter::Main : Input_connection::Avail_handler, } nesting_level_guard { _create_source_max_nesting_level }; /* return input source with the matching name */ - if (node.type() == Input_source::name()) { - Label const label = node.attribute_value("name", Label()); - Input_connection *match = nullptr; - - _input_connections.for_each([&] (Input_connection &connection) { - if (connection.label() == label) - match = &connection; }); - - if (match) - return *new (_heap) Input_source(owner, *match); - - warning("input named '", label, "' does not exist"); - throw Source::Invalid_config(); - } + if (node.type() == Input_source::name()) + return *new (_heap) + Input_source(owner, + node.attribute_value("name", Input_name()), + _event_root); /* create regular filter */ if (node.type() == Remap_source::name()) @@ -274,20 +261,6 @@ struct Input_filter::Main : Input_connection::Avail_handler, */ bool _config_update_pending = false; - /** - * Return true if all input sources are in their default state - */ - bool _input_connections_idle() const - { - bool idle = true; - - _input_connections.for_each([&] (Input_connection const &connection) { - if (!connection.idle()) - idle = false; }); - - return idle; - } - struct Output { Source::Owner _owner; @@ -310,60 +283,15 @@ struct Input_filter::Main : Input_connection::Avail_handler, Constructible _output { }; - /* - * Input session provided to our client - */ - Input::Session_component _input_session { _env, _env.ram() }; - - /* process events */ - struct Final_sink : Source::Sink - { - Input::Session_component &_input_session; - - Final_sink(Input::Session_component &input_session) - : _input_session(input_session) { } - - void submit_event(Input::Event const &event) override { - _input_session.submit(event); } - - } _final_sink { _input_session }; - - /* - * Input_connection::Avail_handler - */ - void handle_input_avail() override - { - for (;;) { - - /* fetch events in input sources */ - _input_connections.for_each([&] (Input_connection &connection) { - connection.flush(); }); - - bool pending = false; - - _input_connections.for_each([&] (Input_connection &connection) { - pending |= connection.pending(); }); - - if (pending && _output.constructed()) - _output->generate(_final_sink); - - if (_config_update_pending && _input_connections_idle()) - Signal_transmitter(_config_handler).submit(); - - /* stop if no events are pending */ - if (!pending) - break; - } - } - - Static_root _input_root { _env.ep().manage(_input_session) }; + /* destination for filter results */ + Event::Connection _event_connection { _env }; void _handle_config() { _config.update(); bool const force = _config.xml().attribute_value("force", false); - bool const idle = _input_connections_idle(); + bool const idle = _event_root.all_sessions_idle(); /* defer reconfiguration until all sources are idle */ if (!idle && !force) { @@ -381,48 +309,11 @@ struct Input_filter::Main : Input_connection::Avail_handler, { Xml_node const config = _config.xml(); - /* close input sessions that are no longer needed */ - _input_connections.for_each([&] (Registered &conn) { - - bool obsolete = true; - config.for_each_sub_node("input", [&] (Xml_node input_node) { - if (conn.label() == input_node.attribute_value("label", Label())) - obsolete = false; }); - - if (obsolete) - destroy(_heap, &conn); - }); - - /* open new input sessions */ - config.for_each_sub_node("input", [&] (Xml_node input_node) { - - try { - Label const label = - input_node.attribute_value("label", Label()); - - bool already_exists = false; - _input_connections.for_each([&] (Input_connection const &conn) { - if (conn.label() == label) - already_exists = true; }); - - if (already_exists) - return; - - try { - new (_heap) - Registered(_input_connections, _env, - label, *this, _heap); - } - catch (Genode::Service_denied) { - warning("parent denied input source '", label, "'"); } - } - catch (Xml_node::Nonexistent_attribute) { - warning("ignoring invalid input node '", input_node); } - }); + _event_root.apply_config(config); try { - if (_config.xml().has_sub_node("output")) - _output.construct(_config.xml().sub_node("output"), *this); + if (config.has_sub_node("output")) + _output.construct(config.sub_node("output"), *this); } catch (Source::Invalid_config) { warning("invalid configuration"); } @@ -441,12 +332,19 @@ struct Input_filter::Main : Input_connection::Avail_handler, /** * Source::Trigger interface * - * Trigger emission of character-repeat events. + * Process pending events, which may originate from an event client or + * artificially emitted by a filter (character-repeat events). */ void trigger_generate() override { - if (_output.constructed()) - _output->generate(_final_sink); + if (!_output.constructed()) + return; + + _event_connection.with_batch([&] (Event::Session_client::Batch &batch) { + _output->generate(batch); }); + + if (_config_update_pending && _event_root.all_sessions_idle()) + Signal_transmitter(_config_handler).submit(); } /** @@ -454,7 +352,6 @@ struct Input_filter::Main : Input_connection::Avail_handler, */ Main(Genode::Env &env) : _env(env) { - _input_session.event_queue().enabled(true); _config.sigh(_config_handler); /* @@ -465,9 +362,9 @@ struct Input_filter::Main : Input_connection::Avail_handler, /* * Announce service */ - _env.parent().announce(_env.ep().manage(_input_root)); + _env.parent().announce(_env.ep().manage(_event_root)); } }; -void Component::construct(Genode::Env &env) { static Input_filter::Main inst(env); } +void Component::construct(Genode::Env &env) { static Event_filter::Main inst(env); } diff --git a/repos/os/src/server/input_filter/merge_source.h b/repos/os/src/server/event_filter/merge_source.h similarity index 78% rename from repos/os/src/server/input_filter/merge_source.h rename to repos/os/src/server/event_filter/merge_source.h index c39e2a5d5c..3f7979c86c 100644 --- a/repos/os/src/server/input_filter/merge_source.h +++ b/repos/os/src/server/event_filter/merge_source.h @@ -11,16 +11,16 @@ * under the terms of the GNU Affero General Public License version 3. */ -#ifndef _INPUT_FILTER__MERGE_SOURCE_H_ -#define _INPUT_FILTER__MERGE_SOURCE_H_ +#ifndef _EVENT_FILTER__MERGE_SOURCE_H_ +#define _EVENT_FILTER__MERGE_SOURCE_H_ /* local includes */ #include -namespace Input_filter { class Merge_source; } +namespace Event_filter { class Merge_source; } -class Input_filter::Merge_source : public Source +class Event_filter::Merge_source : public Source { private: @@ -46,4 +46,4 @@ class Input_filter::Merge_source : public Source } }; -#endif /* _INPUT_FILTER__REMAP_SOURCE_H_ */ +#endif /* _EVENT_FILTER__REMAP_SOURCE_H_ */ diff --git a/repos/os/src/server/input_filter/remap_source.h b/repos/os/src/server/event_filter/remap_source.h similarity index 88% rename from repos/os/src/server/input_filter/remap_source.h rename to repos/os/src/server/event_filter/remap_source.h index 35701e9cf6..2283e974bf 100644 --- a/repos/os/src/server/input_filter/remap_source.h +++ b/repos/os/src/server/event_filter/remap_source.h @@ -11,8 +11,8 @@ * under the terms of the GNU Affero General Public License version 3. */ -#ifndef _INPUT_FILTER__REMAP_SOURCE_H_ -#define _INPUT_FILTER__REMAP_SOURCE_H_ +#ifndef _EVENT_FILTER__REMAP_SOURCE_H_ +#define _EVENT_FILTER__REMAP_SOURCE_H_ /* Genode includes */ #include @@ -22,10 +22,10 @@ #include #include -namespace Input_filter { class Remap_source; } +namespace Event_filter { class Remap_source; } -class Input_filter::Remap_source : public Source, Source::Filter +class Event_filter::Remap_source : public Source, Source::Filter { private: @@ -51,7 +51,7 @@ class Input_filter::Remap_source : public Source, Source::Filter /* forward events that are unrelated to the remapper */ if (!event.press() && !event.release()) { - destination.submit_event(event); + destination.submit(event); return; } @@ -64,10 +64,10 @@ class Input_filter::Remap_source : public Source, Source::Filter auto remap = [&] (Input::Keycode key) { return _keys[key].code; }; event.handle_press([&] (Input::Keycode key, Codepoint codepoint) { - destination.submit_event(Input::Press_char{remap(key), codepoint}); }); + destination.submit(Input::Press_char{remap(key), codepoint}); }); event.handle_release([&] (Input::Keycode key) { - destination.submit_event(Input::Release{remap(key)}); }); + destination.submit(Input::Release{remap(key)}); }); } void _apply_config(Xml_node const config, unsigned const max_recursion = 4) @@ -143,4 +143,4 @@ class Input_filter::Remap_source : public Source, Source::Filter } }; -#endif /* _INPUT_FILTER__REMAP_SOURCE_H_ */ +#endif /* _EVENT_FILTER__REMAP_SOURCE_H_ */ diff --git a/repos/os/src/server/input_filter/source.h b/repos/os/src/server/event_filter/source.h similarity index 88% rename from repos/os/src/server/input_filter/source.h rename to repos/os/src/server/event_filter/source.h index 828810315f..84a38b333b 100644 --- a/repos/os/src/server/input_filter/source.h +++ b/repos/os/src/server/event_filter/source.h @@ -11,20 +11,21 @@ * under the terms of the GNU Affero General Public License version 3. */ -#ifndef _INPUT_FILTER__SOURCE_H_ -#define _INPUT_FILTER__SOURCE_H_ +#ifndef _EVENT_FILTER__SOURCE_H_ +#define _EVENT_FILTER__SOURCE_H_ /* Genode includes */ #include +#include #include /* local includes */ #include -namespace Input_filter { struct Source; } +namespace Event_filter { struct Source; } -class Input_filter::Source +class Event_filter::Source { private: @@ -67,10 +68,7 @@ class Input_filter::Source struct Owner; - struct Sink : Interface - { - virtual void submit_event(Input::Event const &) = 0; - }; + using Sink = Event::Session_client::Batch; virtual void generate(Sink &) = 0; @@ -94,7 +92,7 @@ class Input_filter::Source Sink &_destination; Filter &_filter; - void submit_event(Input::Event const &event) override + void submit(Input::Event const &event) override { _filter.filter_event(_destination, event); } @@ -131,4 +129,4 @@ class Input_filter::Source }; }; -#endif /* _INPUT_FILTER__SOURCE_H_ */ +#endif /* _EVENT_FILTER__SOURCE_H_ */ diff --git a/repos/os/src/server/input_filter/special.chargen b/repos/os/src/server/event_filter/special.chargen similarity index 100% rename from repos/os/src/server/input_filter/special.chargen rename to repos/os/src/server/event_filter/special.chargen diff --git a/repos/os/src/server/input_filter/target.mk b/repos/os/src/server/event_filter/target.mk similarity index 70% rename from repos/os/src/server/input_filter/target.mk rename to repos/os/src/server/event_filter/target.mk index dc5b5350dc..e595cde1d5 100644 --- a/repos/os/src/server/input_filter/target.mk +++ b/repos/os/src/server/event_filter/target.mk @@ -1,4 +1,4 @@ -TARGET = input_filter +TARGET = event_filter SRC_CC = main.cc LIBS = base INC_DIR += $(PRG_DIR) diff --git a/repos/os/src/server/input_filter/timer_accessor.h b/repos/os/src/server/event_filter/timer_accessor.h similarity index 61% rename from repos/os/src/server/input_filter/timer_accessor.h rename to repos/os/src/server/event_filter/timer_accessor.h index d2a26a5ac5..559e49b273 100644 --- a/repos/os/src/server/input_filter/timer_accessor.h +++ b/repos/os/src/server/event_filter/timer_accessor.h @@ -11,14 +11,14 @@ * under the terms of the GNU Affero General Public License version 3. */ -#ifndef _INPUT_FILTER__TIMER_ACCESSOR_H_ -#define _INPUT_FILTER__TIMER_ACCESSOR_H_ +#ifndef _EVENT_FILTER__TIMER_ACCESSOR_H_ +#define _EVENT_FILTER__TIMER_ACCESSOR_H_ /* Genode includes */ #include -namespace Input_filter { struct Timer_accessor; } +namespace Event_filter { struct Timer_accessor; } -struct Input_filter::Timer_accessor : Interface { virtual Timer::Connection &timer() = 0; }; +struct Event_filter::Timer_accessor : Interface { virtual Timer::Connection &timer() = 0; }; -#endif /* _INPUT_FILTER__TIMER_ACCESSOR_H_ */ +#endif /* _EVENT_FILTER__TIMER_ACCESSOR_H_ */ diff --git a/repos/os/src/server/input_filter/types.h b/repos/os/src/server/event_filter/types.h similarity index 62% rename from repos/os/src/server/input_filter/types.h rename to repos/os/src/server/event_filter/types.h index e31e7cd298..b9dec5a225 100644 --- a/repos/os/src/server/input_filter/types.h +++ b/repos/os/src/server/event_filter/types.h @@ -1,5 +1,5 @@ /* - * \brief Types used by the input filter + * \brief Types used by the event filter * \author Norman Feske * \date 2017-02-01 */ @@ -11,13 +11,13 @@ * under the terms of the GNU Affero General Public License version 3. */ -#ifndef _INPUT_FILTER__TYPES_H_ -#define _INPUT_FILTER__TYPES_H_ +#ifndef _EVENT_FILTER__TYPES_H_ +#define _EVENT_FILTER__TYPES_H_ /* Genode includes */ #include #include -namespace Input_filter { using namespace Genode; } +namespace Event_filter { using namespace Genode; } -#endif /* _INPUT_FILTER__TYPES_H_ */ +#endif /* _EVENT_FILTER__TYPES_H_ */ diff --git a/repos/os/src/server/input_filter/connection.h b/repos/os/src/server/input_filter/connection.h deleted file mode 100644 index a8611d6e0a..0000000000 --- a/repos/os/src/server/input_filter/connection.h +++ /dev/null @@ -1,97 +0,0 @@ -/* - * \brief Connection for incoming input events - * \author Norman Feske - * \date 2017-02-01 - */ - -/* - * Copyright (C) 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 _INPUT_FILTER__CONNECTION_H_ -#define _INPUT_FILTER__CONNECTION_H_ - -/* Genode includes */ -#include -#include - -/* local includes */ -#include - -namespace Input_filter { struct Input_connection; } - - -class Input_filter::Input_connection -{ - public: - - struct Avail_handler : Interface { virtual void handle_input_avail() = 0; }; - - private: - - Session_label const _label; - Input::Connection _connection; - Attached_dataspace _events_ds; - Avail_handler &_avail_handler; - - unsigned _key_cnt = 0; - - Signal_handler _input_handler; - - void _handle_input() { _avail_handler.handle_input_avail(); } - - size_t _num_ev = 0; - - size_t const _max_events = _events_ds.size() / sizeof(Input::Event); - - public: - - static char const *name() { return "input"; } - - Input_connection(Env &env, Session_label const &label, - Avail_handler &avail_handler, Allocator &) - : - _label(label), - _connection(env, label.string()), - _events_ds(env.rm(), _connection.dataspace()), - _avail_handler(avail_handler), - _input_handler(env.ep(), *this, &Input_connection::_handle_input) - { - _connection.sigh(_input_handler); - } - - virtual ~Input_connection() { } - - Session_label label() const { return _label; } - - template - void for_each_event(FUNC const &func) const - { - Input::Event const *event_ptr = _events_ds.local_addr(); - - for (size_t i = 0; i < _num_ev; i++) - func(*event_ptr++); - } - - void flush() - { - _num_ev = min(_max_events, (size_t)_connection.flush()); - - auto update_key_cnt = [&] (Input::Event const &event) - { - if (event.press()) _key_cnt++; - if (event.release()) _key_cnt--; - }; - - for_each_event(update_key_cnt); - } - - bool idle() const { return _key_cnt == 0; } - - bool pending() const { return _num_ev > 0; } -}; - -#endif /* _INPUT_FILTER__CONNECTION_H_ */ diff --git a/repos/os/src/server/input_filter/input_source.h b/repos/os/src/server/input_filter/input_source.h deleted file mode 100644 index 0c0f1818cc..0000000000 --- a/repos/os/src/server/input_filter/input_source.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * \brief Input-event source that obtains events from input connection - * \author Norman Feske - * \date 2017-02-01 - */ - -/* - * Copyright (C) 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 _INPUT_FILTER__INPUT_SOURCE_H_ -#define _INPUT_FILTER__INPUT_SOURCE_H_ - -/* local includes */ -#include -#include - -namespace Input_filter { class Input_source; } - - -class Input_filter::Input_source : public Source -{ - private: - - Input_connection &_connection; - - public: - - static char const *name() { return "input"; } - - Input_source(Owner &owner, Input_connection &connection) - : - Source(owner), _connection(connection) - { } - - void generate(Sink &sink) override - { - _connection.for_each_event([&] (Input::Event const &event) { - sink.submit_event(event); }); - } -}; - -#endif /* _INPUT_FILTER__INPUT_SOURCE_H_ */ diff --git a/repos/os/src/test/input_filter/main.cc b/repos/os/src/test/event_filter/main.cc similarity index 66% rename from repos/os/src/test/input_filter/main.cc rename to repos/os/src/test/event_filter/main.cc index 284a5cfa96..279367b70d 100644 --- a/repos/os/src/test/input_filter/main.cc +++ b/repos/os/src/test/event_filter/main.cc @@ -1,5 +1,5 @@ /* - * \brief Test for input filter + * \brief Test for event filter * \author Norman Feske * \date 2017-02-01 */ @@ -15,33 +15,113 @@ #include #include #include -#include -#include +#include +#include +#include #include -#include #include #include #include #include +#include #include namespace Test { class Input_from_filter; class Input_to_filter; class Input_root; + class Event_session; + class Event_root; class Main; using namespace Genode; - using Input::Event; } +struct Test::Event_session : Rpc_object +{ + Attached_ram_dataspace _ds; + + Signal_context_capability _handle_input_sigh; + + Ring_buffer _events { }; + + Event_session(Env &env, Signal_context_capability handle_input_sigh) + : + _ds(env.ram(), env.rm(), 4096), _handle_input_sigh(handle_input_sigh) + { } + + template + void for_each_pending_event(FN const &fn) + { + while (!_events.empty()) + fn(_events.get()); + } + + + /***************************** + ** Event session interface ** + *****************************/ + + Dataspace_capability dataspace() { return _ds.cap(); } + + void submit_batch(unsigned count) + { + size_t const max_events = _ds.size() / sizeof(Input::Event); + + if (count > max_events) + warning("number of events exceeds dataspace capacity"); + + count = min(count, max_events); + + Input::Event const * const events = _ds.local_addr(); + + for (unsigned i = 0; i < count; i++) { + + if (_events.avail_capacity() < 1) + error("ring-buffer overflow"); + + _events.add(events[i]); + } + + /* execute '_handle_input' in the context of the main entrypoint */ + Signal_transmitter(_handle_input_sigh).submit(); + } +}; + + +struct Test::Event_root : Root_component +{ + Event_session &_session; + + bool _filter_connected = false; + + Event_root(Entrypoint &ep, Allocator &md_alloc, Event_session &session) + : + Root_component(ep, md_alloc), _session(session) + { } + + Event_session *_create_session(const char *, Affinity const &) override + { + _filter_connected = true; + + return &_session; + } + + /* + * Prevent the default 'Root_component' implementation from attempting + * to free the session objects. + */ + void _destroy_session(Event_session *) override { } +}; + + class Test::Input_from_filter { public: struct Event_handler : Interface { - virtual void handle_event_from_filter(Event const &) = 0; + virtual void handle_event_from_filter(Input::Event const &) = 0; }; private: @@ -50,33 +130,46 @@ class Test::Input_from_filter Event_handler &_event_handler; - Input::Connection _connection; - bool _input_expected = false; bool _handle_input_in_progress = false; + Signal_handler _input_handler { + _env.ep(), *this, &Input_from_filter::_handle_input }; + + Sliced_heap _sliced_heap { _env.ram(), _env.rm() }; + + /* + * Provide the event service via an independent entrypoint to avoid a + * possible deadlock between the event_filter and the test when + * both try to invoke 'Event::Session::submit' from each other. + */ + enum { STACK_SIZE = 4*1024*sizeof(long) }; + + Entrypoint _ep { _env, STACK_SIZE, "server_ep", Affinity::Location() }; + + Event_session _session { _env, _input_handler }; + + Event_root _root { _ep, _sliced_heap, _session }; + void _handle_input() { _handle_input_in_progress = true; if (_input_expected) - _connection.for_each_event([&] (Event const &event) { + _session.for_each_pending_event([&] (Input::Event const &event) { _event_handler.handle_event_from_filter(event); }); _handle_input_in_progress = false; } - Signal_handler _input_handler { - _env.ep(), *this, &Input_from_filter::_handle_input }; - public: Input_from_filter(Env &env, Event_handler &event_handler) : - _env(env), _event_handler(event_handler), _connection(env) + _env(env), _event_handler(event_handler) { - _connection.sigh(_input_handler); + _env.parent().announce(_ep.manage(_root)); } void input_expected(bool expected) @@ -93,68 +186,14 @@ class Test::Input_from_filter }; -class Test::Input_root : public Root_component -{ - private: - - Input::Session_component &_usb_input; - Input::Session_component &_ps2_input; - - public: - - Input_root(Entrypoint &ep, Allocator &md_alloc, - Input::Session_component &usb_input, - Input::Session_component &ps2_input) - : - Root_component(ep, md_alloc), - _usb_input(usb_input), _ps2_input(ps2_input) - { } - - Input::Session_component *_create_session(const char *args, - Affinity const &) override - { - Session_label const label = label_from_args(args); - - if (label.last_element() == "usb") return &_usb_input; - if (label.last_element() == "ps2") return &_ps2_input; - - error("no matching policy for session label ", label); - throw Service_denied(); - } - - /* - * Prevent the default 'Root_component' implementation from attempting - * to free the session objects. - */ - void _destroy_session(Input::Session_component *) override { } -}; - - class Test::Input_to_filter { private: Env &_env; - Sliced_heap _sliced_heap { _env.ram(), _env.rm() }; - - /* - * Provide the input service via an independent entrypoint to avoid a - * possible deadlock between the input_filter and the test when - * both try to invoke 'Input::Session::flush' from each other. - */ - enum { STACK_SIZE = 4*1024*sizeof(long) }; - - Entrypoint _ep { _env, STACK_SIZE, "input_server_ep", - Affinity::Location() }; - - /* - * Input supplied to the input_filter - */ - Input::Session_component _usb { _env, _env.ram() }; - Input::Session_component _ps2 { _env, _env.ram() }; - - Input_root _root { _ep, _sliced_heap, _usb, _ps2}; + Constructible _ps2 { }; + Constructible _usb { }; typedef String<20> Key_name; @@ -172,12 +211,17 @@ class Test::Input_to_filter public: - Input_to_filter(Env &env) : _env(env) - { - _env.parent().announce(_ep.manage(_root)); + Input_to_filter(Env &env) : _env(env) { } - _usb.event_queue().enabled(true); - _ps2.event_queue().enabled(true); + void apply_driver(Xml_node driver) + { + using Name = String<100>; + Name const name = driver.attribute_value("name", Name()); + + bool const connected = driver.attribute_value("connected", true); + + if (name == "ps2") _ps2.conditional(connected, _env, "ps2"); + if (name == "usb") _usb.conditional(connected, _env, "usb"); } void submit_events(Xml_node step) @@ -187,32 +231,35 @@ class Test::Input_to_filter throw Exception(); } - Input::Session_component &dst = step.type() == "usb" ? _usb : _ps2; + Event::Connection &dst = step.type() == "usb" ? *_usb : *_ps2; - step.for_each_sub_node([&] (Xml_node node) { + dst.with_batch([&] (Event::Session_client::Batch &batch) { - bool const press = node.has_type("press"), - release = node.has_type("release"); + step.for_each_sub_node([&] (Xml_node node) { - if (press || release) { + bool const press = node.has_type("press"), + release = node.has_type("release"); - Key_name const key_name = node.attribute_value("code", Key_name()); + if (press || release) { - if (press) dst.submit(Input::Press {_code(key_name)}); - if (release) dst.submit(Input::Release{_code(key_name)}); - } + Key_name const key_name = node.attribute_value("code", Key_name()); - bool const motion = node.has_type("motion"); - bool const rel = node.has_attribute("rx") || node.has_attribute("ry"); - bool const abs = node.has_attribute("ax") || node.has_attribute("ay"); + if (press) batch.submit(Input::Press {_code(key_name)}); + if (release) batch.submit(Input::Release{_code(key_name)}); + } - if (motion && abs) - dst.submit(Input::Absolute_motion{(int)node.attribute_value("ax", 0L), - (int)node.attribute_value("ay", 0L)}); + bool const motion = node.has_type("motion"); + bool const rel = node.has_attribute("rx") || node.has_attribute("ry"); + bool const abs = node.has_attribute("ax") || node.has_attribute("ay"); - if (motion && rel) - dst.submit(Input::Relative_motion{(int)node.attribute_value("rx", 0L), - (int)node.attribute_value("ry", 0L)}); + if (motion && abs) + batch.submit(Input::Absolute_motion{(int)node.attribute_value("ax", 0L), + (int)node.attribute_value("ay", 0L)}); + + if (motion && rel) + batch.submit(Input::Relative_motion{(int)node.attribute_value("rx", 0L), + (int)node.attribute_value("ry", 0L)}); + }); }); } }; @@ -228,7 +275,7 @@ struct Test::Main : Input_from_filter::Event_handler Input_to_filter _input_to_filter { _env }; - Reporter _input_filter_config_reporter { _env, "config", "input_filter.config" }; + Reporter _event_filter_config_reporter { _env, "config", "event_filter.config" }; Reporter _chargen_include_reporter { _env, "chargen", "chargen_include" }; Reporter _remap_include_reporter { _env, "remap", "remap_include" }; Reporter _capslock_reporter { _env, "capslock", "capslock" }; @@ -292,14 +339,20 @@ struct Test::Main : Input_from_filter::Event_handler step.type() == "expect_motion" || step.type() == "expect_wheel"); + if (step.type() == "driver") { + _input_to_filter.apply_driver(step); + _advance_step(); + continue; + } + if (step.type() == "filter_config") { - _publish_report(_input_filter_config_reporter, step); + _publish_report(_event_filter_config_reporter, step); _advance_step(); continue; } if (step.type() == "deep_filter_config") { - _deep_filter_config(_input_filter_config_reporter, step); + _deep_filter_config(_event_filter_config_reporter, step); _advance_step(); continue; } @@ -364,7 +417,7 @@ struct Test::Main : Input_from_filter::Event_handler /** * Input_to_filter::Event_handler interface */ - void handle_event_from_filter(Event const &ev) override + void handle_event_from_filter(Input::Event const &ev) override { typedef Genode::String<20> Value; @@ -446,7 +499,7 @@ struct Test::Main : Input_from_filter::Event_handler Main(Env &env) : _env(env) { _timer.sigh(_timer_handler); - _input_filter_config_reporter.enabled(true); + _event_filter_config_reporter.enabled(true); _chargen_include_reporter.enabled(true); _remap_include_reporter.enabled(true); _capslock_reporter.enabled(true); diff --git a/repos/os/src/test/input_filter/target.mk b/repos/os/src/test/event_filter/target.mk similarity index 53% rename from repos/os/src/test/input_filter/target.mk rename to repos/os/src/test/event_filter/target.mk index f0ef5cd514..52d8aaeea2 100644 --- a/repos/os/src/test/input_filter/target.mk +++ b/repos/os/src/test/event_filter/target.mk @@ -1,3 +1,3 @@ -TARGET = test-input_filter +TARGET = test-event_filter SRC_CC = main.cc LIBS += base diff --git a/repos/ports/run/bash.run b/repos/ports/run/bash.run index 841038a157..c6639d3062 100644 --- a/repos/ports/run/bash.run +++ b/repos/ports/run/bash.run @@ -57,21 +57,22 @@ install_config { + - - - - + + + + + - diff --git a/repos/ports/run/debug_nitpicker.run b/repos/ports/run/debug_nitpicker.run index 6a4dcca64c..ee409aabe9 100644 --- a/repos/ports/run/debug_nitpicker.run +++ b/repos/ports/run/debug_nitpicker.run @@ -73,18 +73,20 @@ install_config { + - - + + + - - + + - + - + - } -append_if [expr $use_ps2] config_of_app { - } -append_if [expr $use_usb] config_of_app { - } -append config_of_app { + } append_if [expr $use_ps2] config_of_app { @@ -265,28 +260,30 @@ append_if [expr $use_usb] config_of_app { } append config_of_app { - - - } + } append_if [expr $use_ps2] config_of_app { - } + } append_if [expr $use_usb] config_of_app { - } + } append config_of_app { + + + - + + + - - - + + @@ -350,7 +347,6 @@ append config_of_app { - diff --git a/repos/ports/run/vbox_win.inc b/repos/ports/run/vbox_win.inc index 2a16154fdd..adb5227cb8 100644 --- a/repos/ports/run/vbox_win.inc +++ b/repos/ports/run/vbox_win.inc @@ -25,7 +25,7 @@ if {[info exists flavor_extension]} { } set build_components { - server/input_filter + server/event_filter drivers/nic drivers/audio server/report_rom @@ -33,7 +33,7 @@ set build_components { } set boot_modules { - input_filter + event_filter ipxe_nic_drv audio_drv report_rom @@ -45,16 +45,12 @@ if {$use_vbox5_nova} { set virtualbox5_binary "virtualbox5-nova" } set config_of_app { - + - + } -append_if [expr $use_ps2] config_of_app { - } -append_if [expr $use_usb] config_of_app { - } append config_of_app { } @@ -64,14 +60,15 @@ append_if [expr $use_usb] config_of_app { } append config_of_app { - - - } + } append_if [expr $use_ps2] config_of_app { - } + } append_if [expr $use_usb] config_of_app { - } + } append config_of_app { + + + @@ -125,9 +122,10 @@ append config_of_app { - + + + - @@ -181,8 +179,8 @@ append config_of_app { - - + + @@ -198,8 +196,8 @@ append config_of_app { append_if [expr !$use_rumpfs] config_of_app { - - + + diff --git a/repos/ports/run/vim.run b/repos/ports/run/vim.run index eeef24f0d4..c410d31f0a 100644 --- a/repos/ports/run/vim.run +++ b/repos/ports/run/vim.run @@ -48,9 +48,9 @@ install_config { + - @@ -65,9 +65,11 @@ install_config { - - - + + + + + @@ -78,7 +80,6 @@ install_config { - diff --git a/repos/ports/run/virtualbox_auto.inc b/repos/ports/run/virtualbox_auto.inc index 7923027004..3ffc9e05da 100644 --- a/repos/ports/run/virtualbox_auto.inc +++ b/repos/ports/run/virtualbox_auto.inc @@ -35,6 +35,7 @@ append build_components { server/fs_rom drivers/ahci drivers/framebuffer + app/input_event_client } lappend_if [expr $use_serial] build_components server/log_terminal @@ -212,8 +213,19 @@ append_platform_drv_config append_if [expr $use_ps2] config { - + + + + + + + + + + + + } append_if [expr $use_cpu_load] config { @@ -347,12 +359,23 @@ append_if [expr $use_usb] config { + + + + + + + + + + + } append_if [have_spec framebuffer] config { - + } @@ -385,6 +408,7 @@ append boot_modules { libc.lib.so vfs.lib.so libm.lib.so libiconv.lib.so stdcxx.lib.so qemu-usb.lib.so + input_event_client } lappend_if [expr $use_rumpfs] boot_modules rump.lib.so diff --git a/tool/autopilot.list b/tool/autopilot.list index a4db8f207f..83d782dc20 100644 --- a/tool/autopilot.list +++ b/tool/autopilot.list @@ -14,7 +14,7 @@ fs_query gdb_monitor ieee754 init_smp -input_filter +event_filter libc_vfs_fs_ext2 log_core lwip