mirror of
https://github.com/genodelabs/genode.git
synced 2025-04-09 04:15:52 +00:00
parent
08ef528577
commit
974118acec
@ -142,10 +142,10 @@
|
||||
|
||||
<start name="ps2_drv" priority="0">
|
||||
<resource name="RAM" quantum="1M"/>
|
||||
<provides> <service name="Input"/> </provides>
|
||||
<config capslock_led="rom" numlock_led="rom"/>
|
||||
<route>
|
||||
<service name="Platform"> <child name="platform_drv"/> </service>
|
||||
<service name="Event"> <child name="event_filter" label="ps2"/> </service>
|
||||
<service name="ROM" label="capslock"> <parent label="capslock"/> </service>
|
||||
<service name="ROM" label="numlock"> <parent label="numlock"/> </service>
|
||||
<service name="ROM"> <parent/> </service>
|
||||
@ -184,17 +184,6 @@
|
||||
</route>
|
||||
</start>
|
||||
|
||||
<start name="ps2" caps="90">
|
||||
<resource name="RAM" quantum="1M"/>
|
||||
<binary name="input_event_client"/>
|
||||
<config/>
|
||||
<route>
|
||||
<service name="Event"> <child name="event_filter" label="ps2"/> </service>
|
||||
<service name="Input"> <child name="ps2_drv"/> </service>
|
||||
<any-service> <parent/> </any-service>
|
||||
</route>
|
||||
</start>
|
||||
|
||||
<start name="usb" caps="90">
|
||||
<resource name="RAM" quantum="1M"/>
|
||||
<binary name="input_event_client"/>
|
||||
|
@ -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 {
|
||||
<start name="ps2_drv">
|
||||
<resource name="RAM" quantum="2M"/>
|
||||
<provides><service name="Input"/></provides>
|
||||
<config verbose_keyboard="no" verbose_mouse="no" verbose_scancodes="no"/>
|
||||
<route>
|
||||
<service name="Platform"> <child name="platform_drv"/> </service>
|
||||
<service name="Timer"> <child name="timer"/> </service>
|
||||
<any-service> <parent/> </any-service>
|
||||
</route>
|
||||
</start>
|
||||
|
||||
<start name="ps2" caps="90">
|
||||
<resource name="RAM" quantum="1M"/>
|
||||
<binary name="input_event_client"/>
|
||||
<config/>
|
||||
<route>
|
||||
<service name="Event"> <child name="event_filter" label="ps2"/> </service>
|
||||
<service name="Input"> <child name="ps2_drv"/> </service>
|
||||
<any-service> <parent/> </any-service>
|
||||
</route>
|
||||
</start>
|
||||
@ -228,7 +216,6 @@ set boot_modules {
|
||||
acpica
|
||||
acpi_event
|
||||
event_dump
|
||||
input_event_client
|
||||
}
|
||||
|
||||
append_platform_drv_boot_modules
|
||||
|
@ -1,5 +1,4 @@
|
||||
_/src/pbxa9_drivers
|
||||
_/src/platform_drv
|
||||
_/src/event_filter
|
||||
_/src/input_event_client
|
||||
_/raw/drivers_interactive-pbxa9
|
||||
|
@ -57,9 +57,10 @@
|
||||
|
||||
<start name="ps2_drv" caps="80">
|
||||
<resource name="RAM" quantum="1280K"/>
|
||||
<provides> <service name="Input"/> </provides>
|
||||
<config/>
|
||||
<route>
|
||||
<service name="Platform"> <child name="platform_drv"/> </service>
|
||||
<service name="Event"> <child name="event_filter" label="ps2"/> </service>
|
||||
<service name="ROM"> <parent/> </service>
|
||||
<service name="PD"> <parent/> </service>
|
||||
<service name="CPU"> <parent/> </service>
|
||||
@ -97,17 +98,6 @@
|
||||
</route>
|
||||
</start>
|
||||
|
||||
<start name="ps2" caps="90">
|
||||
<resource name="RAM" quantum="1M"/>
|
||||
<binary name="input_event_client"/>
|
||||
<config/>
|
||||
<route>
|
||||
<service name="Event"> <child name="event_filter" label="ps2"/> </service>
|
||||
<service name="Input"> <child name="ps2_drv"/> </service>
|
||||
<any-service> <parent/> </any-service>
|
||||
</route>
|
||||
</start>
|
||||
|
||||
<start name="usb" caps="90">
|
||||
<resource name="RAM" quantum="1M"/>
|
||||
<binary name="input_event_client"/>
|
||||
|
@ -78,9 +78,8 @@
|
||||
<resource name="RAM" quantum="1M"/>
|
||||
<provides> <service name="Input"/> </provides>
|
||||
<route>
|
||||
<service name="Platform">
|
||||
<child name="platform_drv"/>
|
||||
</service>
|
||||
<service name="Platform"> <child name="platform_drv"/> </service>
|
||||
<service name="Event"> <child name="event_filter" label="ps2"/> </service>
|
||||
<service name="ROM"> <parent/> </service>
|
||||
<service name="PD"> <parent/> </service>
|
||||
<service name="CPU"> <parent/> </service>
|
||||
@ -105,14 +104,4 @@
|
||||
</route>
|
||||
</start>
|
||||
|
||||
<start name="ps2" caps="90">
|
||||
<resource name="RAM" quantum="1M"/>
|
||||
<binary name="input_event_client"/>
|
||||
<config/>
|
||||
<route>
|
||||
<service name="Event"> <child name="event_filter" label="ps2"/> </service>
|
||||
<service name="Input"> <child name="ps2_drv"/> </service>
|
||||
<any-service> <parent/> </any-service>
|
||||
</route>
|
||||
</start>
|
||||
</config>
|
||||
|
@ -90,9 +90,10 @@
|
||||
|
||||
<start name="ps2_drv" caps="80">
|
||||
<resource name="RAM" quantum="1280K"/>
|
||||
<provides> <service name="Input"/> </provides>
|
||||
<config/>
|
||||
<route>
|
||||
<service name="Platform"> <child name="platform_drv"/> </service>
|
||||
<service name="Event"> <child name="event_filter" label="ps2"/> </service>
|
||||
<service name="ROM"> <parent/> </service>
|
||||
<service name="PD"> <parent/> </service>
|
||||
<service name="CPU"> <parent/> </service>
|
||||
@ -130,17 +131,6 @@
|
||||
</route>
|
||||
</start>
|
||||
|
||||
<start name="ps2" caps="90">
|
||||
<resource name="RAM" quantum="1M"/>
|
||||
<binary name="input_event_client"/>
|
||||
<config/>
|
||||
<route>
|
||||
<service name="Event"> <child name="event_filter" label="ps2"/> </service>
|
||||
<service name="Input"> <child name="ps2_drv"/> </service>
|
||||
<any-service> <parent/> </any-service>
|
||||
</route>
|
||||
</start>
|
||||
|
||||
<start name="usb" caps="90">
|
||||
<resource name="RAM" quantum="1M"/>
|
||||
<binary name="input_event_client"/>
|
||||
|
@ -1,7 +1,7 @@
|
||||
base
|
||||
os
|
||||
capture_session
|
||||
input_session
|
||||
event_session
|
||||
platform_session
|
||||
timer_session
|
||||
blit
|
||||
|
@ -1,5 +1,5 @@
|
||||
base
|
||||
os
|
||||
platform_session
|
||||
input_session
|
||||
event_session
|
||||
timer_session
|
||||
|
@ -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 {
|
||||
<start name="ps2_drv">
|
||||
<resource name="RAM" quantum="2M"/>
|
||||
<provides><service name="Input"/></provides>
|
||||
<config verbose_keyboard="no" verbose_mouse="no" verbose_scancodes="no"
|
||||
capslock_led="rom" numlock_led="rom" scrlock_led="rom"/>
|
||||
<route>
|
||||
@ -72,23 +68,31 @@ append_if [have_spec ps2] config {
|
||||
<service name="LOG"> <parent/> </service>
|
||||
<service name="Platform"> <any-child/> </service>
|
||||
<service name="Timer"> <child name="timer"/> </service>
|
||||
<service name="Event"> <child name="event_dump"/> </service>
|
||||
</route>
|
||||
</start>
|
||||
<alias name="input_drv" child="ps2_drv"/>}
|
||||
</start>}
|
||||
|
||||
append_if [have_spec sdl] config {
|
||||
<start name="fb_sdl" ld="no">
|
||||
<resource name="RAM" quantum="4M"/>
|
||||
<provides> <service name="Input"/> <service name="Framebuffer"/> </provides>
|
||||
<route>
|
||||
<service name="ROM"> <parent/> </service>
|
||||
<service name="CPU"> <parent/> </service>
|
||||
<service name="PD"> <parent/> </service>
|
||||
<service name="LOG"> <parent/> </service>
|
||||
<service name="Timer"> <child name="timer"/> </service>
|
||||
<service name="ROM"> <parent/> </service>
|
||||
<service name="CPU"> <parent/> </service>
|
||||
<service name="PD"> <parent/> </service>
|
||||
<service name="LOG"> <parent/> </service>
|
||||
<service name="Timer"> <child name="timer"/> </service>
|
||||
<service name="Event"> <child name="event_dump"/> </service>
|
||||
<service name="Capture"> <child name="nitpicker"/> </service>
|
||||
</route>
|
||||
</start>
|
||||
<alias name="input_drv" child="fb_sdl"/>}
|
||||
|
||||
<start name="nitpicker">
|
||||
<resource name="RAM" quantum="1M"/>
|
||||
<provides> <service name="Gui"/> <service name="Capture"/> </provides>
|
||||
<route> <any-service> <parent/> <any-child/> </any-service> </route>
|
||||
<config request_input="no" request_framebuffer="no"> <capture/> </config>
|
||||
</start>}
|
||||
|
||||
append config {
|
||||
|
||||
@ -124,15 +128,16 @@ append config {
|
||||
</route>
|
||||
</start>
|
||||
|
||||
<start name="test-input">
|
||||
<start name="event_dump">
|
||||
<resource name="RAM" quantum="1M"/>
|
||||
<provides> <service name="Event"/> </provides>
|
||||
<config/>
|
||||
<route>
|
||||
<service name="ROM"> <parent/> </service>
|
||||
<service name="CPU"> <parent/> </service>
|
||||
<service name="PD"> <parent/> </service>
|
||||
<service name="LOG"> <parent/> </service>
|
||||
<service name="Timer"> <child name="timer"/> </service>
|
||||
<service name="Input"> <child name="input_drv"/> </service>
|
||||
<service name="ROM"> <parent/> </service>
|
||||
<service name="CPU"> <parent/> </service>
|
||||
<service name="PD"> <parent/> </service>
|
||||
<service name="LOG"> <parent/> </service>
|
||||
<service name="Timer"> <child name="timer"/> </service>
|
||||
</route>
|
||||
</start>}
|
||||
|
||||
@ -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
|
||||
|
@ -14,15 +14,13 @@
|
||||
#ifndef _DRIVERS__INPUT__SPEC__PS2__INPUT_DRIVER_H_
|
||||
#define _DRIVERS__INPUT__SPEC__PS2__INPUT_DRIVER_H_
|
||||
|
||||
class Input_driver
|
||||
#include <event_session/client.h>
|
||||
|
||||
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_ */
|
||||
|
@ -28,23 +28,29 @@ class Irq_handler
|
||||
Genode::Irq_session_client _irq;
|
||||
Genode::Signal_handler<Irq_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();
|
||||
|
@ -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 <base/env.h>
|
||||
#include <base/signal.h>
|
||||
#include <irq_session/client.h>
|
||||
|
||||
/* local includes */
|
||||
#include "input_driver.h"
|
||||
#include "serial_interface.h"
|
||||
|
||||
class Irq_handler
|
||||
{
|
||||
private:
|
||||
|
||||
Genode::Irq_session_client _irq;
|
||||
Genode::Signal_handler<Irq_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_ */
|
@ -14,10 +14,9 @@
|
||||
/* Genode includes */
|
||||
#include <base/component.h>
|
||||
#include <base/attached_rom_dataspace.h>
|
||||
#include <input/component.h>
|
||||
#include <input/root.h>
|
||||
#include <platform_session/connection.h>
|
||||
#include <timer_session/connection.h>
|
||||
#include <event_session/connection.h>
|
||||
|
||||
/* 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> _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));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -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();
|
||||
|
@ -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 */
|
||||
|
@ -17,8 +17,7 @@
|
||||
#include <util/retry.h>
|
||||
|
||||
/* os includes */
|
||||
#include <input/component.h>
|
||||
#include <input/root.h>
|
||||
#include <event_session/connection.h>
|
||||
#include <platform_session/connection.h>
|
||||
#include <timer_session/connection.h>
|
||||
|
||||
@ -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> _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));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -212,7 +212,7 @@ append config {
|
||||
append_if [expr !$use_usb] config {
|
||||
<start name="ps2_drv" priority="-1">
|
||||
<resource name="RAM" quantum="3M"/>
|
||||
<provides><service name="Input"/></provides>
|
||||
<config/>
|
||||
<route> <any-service><parent/> <any-child/> </any-service> </route>
|
||||
</start> }
|
||||
|
||||
@ -408,8 +408,11 @@ append_if $use_usb config {
|
||||
append config {
|
||||
<start name="nitpicker" priority="-1" caps="120">
|
||||
<resource name="RAM" quantum="8M"/>
|
||||
<config request_framebuffer="no">
|
||||
<capture/>
|
||||
<provides>
|
||||
<service name="Gui"/> <service name="Capture"/> <service name="Event"/>
|
||||
</provides>
|
||||
<config request_framebuffer="no" request_input="no">
|
||||
<capture/> <event/>
|
||||
<report focus="yes" />
|
||||
<domain name="pointer" layer="1" content="client" label="no" origin="pointer" />
|
||||
<domain name="panel" layer="2" content="client" label="no" focus="none" />
|
||||
@ -435,7 +438,6 @@ append config {
|
||||
<service name="Report"> <child name="report_rom"/></service>
|
||||
<any-service><parent/><any-child/></any-service>
|
||||
</route>
|
||||
<provides> <service name="Gui"/> <service name="Capture"/> </provides>
|
||||
</start>
|
||||
|
||||
<start name="pointer">
|
||||
|
@ -70,7 +70,7 @@ append config {
|
||||
|
||||
<start name="ps2_drv" priority="-1">
|
||||
<resource name="RAM" quantum="1M"/>
|
||||
<provides><service name="Input"/></provides>
|
||||
<config/>
|
||||
</start>
|
||||
|
||||
<start name="usb_config_fs" priority="-1">
|
||||
@ -152,13 +152,15 @@ append config {
|
||||
|
||||
<start name="nitpicker" priority="-1">
|
||||
<resource name="RAM" quantum="12M"/>
|
||||
<provides> <service name="Gui"/> <service name="Capture"/> </provides>
|
||||
<provides>
|
||||
<service name="Gui"/> <service name="Capture"/> <service name="Event"/>
|
||||
</provides>
|
||||
<route>
|
||||
<service name="Report"> <child name="report_rom" /> </service>
|
||||
<any-service> <parent/> <any-child /> </any-service>
|
||||
</route>
|
||||
<config request_framebuffer="no">
|
||||
<capture/>
|
||||
<config request_framebuffer="no" request_input="no">
|
||||
<capture/> <event/>
|
||||
<report focus="yes" hover="yes" />
|
||||
|
||||
<domain name="pointer" layer="1" content="client" label="no" origin="pointer" />
|
||||
|
@ -86,7 +86,7 @@ append_platform_drv_config
|
||||
append_if [expr $use_ps2] config {
|
||||
<start name="ps2_drv" priority="-1">
|
||||
<resource name="RAM" quantum="2M"/>
|
||||
<provides><service name="Input"/></provides>
|
||||
<config/>
|
||||
</start>}
|
||||
|
||||
append_if [expr $use_usb] config {
|
||||
@ -166,20 +166,20 @@ append config {
|
||||
|
||||
<start name="nitpicker" priority="-1">
|
||||
<resource name="RAM" quantum="4M"/>
|
||||
<provides> <service name="Gui"/> <service name="Capture"/> </provides>
|
||||
<provides>
|
||||
<service name="Gui"/> <service name="Capture"/> <service name="Event"/>
|
||||
</provides>
|
||||
<route>
|
||||
<service name="Report"> <child name="report_rom" /> </service>}
|
||||
|
||||
append_if [expr $use_ps2] config {
|
||||
<service name="Input"> <child name="ps2_drv"/> </service>}
|
||||
append_if [expr $use_usb] config {
|
||||
<service name="Input"> <child name="usb_drv"/> </service>}
|
||||
|
||||
append config {
|
||||
<any-service> <parent/> <any-child /> </any-service>
|
||||
</route>
|
||||
<config request_framebuffer="no">
|
||||
<capture/>
|
||||
<config request_framebuffer="no" request_input="no">
|
||||
<capture/> <event/>
|
||||
|
||||
<report focus="yes" hover="yes" xray="yes" />
|
||||
|
||||
|
@ -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 {
|
||||
<service name="File_system"><child name="rump_fs"/></service>}
|
||||
append_if [expr $use_ram_fs && $use_overlay_from_disk] config {
|
||||
<any-service><parent/><any-child/></any-service>
|
||||
<any-service> <parent/> <any-child/> </any-service>
|
||||
</route>
|
||||
</start>}
|
||||
|
||||
@ -213,18 +213,10 @@ append_platform_drv_config
|
||||
append_if [expr $use_ps2] config {
|
||||
<start name="ps2_drv" priority="-1">
|
||||
<resource name="RAM" quantum="1M"/>
|
||||
<provides> <service name="Input"/> </provides>
|
||||
<config/>
|
||||
</start>
|
||||
|
||||
<start name="ps2" caps="90">
|
||||
<resource name="RAM" quantum="1M"/>
|
||||
<binary name="input_event_client"/>
|
||||
<config/>
|
||||
<route>
|
||||
<service name="Event"> <child name="event_filter" label="ps2"/> </service>
|
||||
<service name="Input"> <child name="ps2_drv"/> </service>
|
||||
<any-service> <parent/> </any-service>
|
||||
<any-service> <parent/> <any-child/> </any-service>
|
||||
</route>
|
||||
</start>}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user