1.1 --- a/pkg/devices/input/include/input-event-ops.h Sun May 20 16:54:53 2018 +0200
1.2 +++ b/pkg/devices/input/include/input-event-ops.h Mon May 21 00:52:45 2018 +0200
1.3 @@ -21,4 +21,29 @@
1.4
1.5 #pragma once
1.6
1.7 -enum { Input_event_op_get_buffer, Input_event_op_bind };
1.8 +#include <l4/re/protocols.h>
1.9 +#include <l4/sys/types.h>
1.10 +
1.11 +enum Input_event_protocols
1.12 +{
1.13 + Input_event_proto_event = L4RE_PROTO_EVENT,
1.14 + Input_event_proto_icu = L4_PROTO_IRQ,
1.15 +};
1.16 +
1.17 +enum Input_event_operations
1.18 +{
1.19 + /* Event protocol operations.
1.20 + NOTE: These definitions should employ the values defined elsewhere. */
1.21 +
1.22 + Input_event_op_get_buffer = 0,
1.23 + Input_event_op_get_num_streams = 1,
1.24 + Input_event_op_get_stream_info = 2,
1.25 + Input_event_op_get_stream_info_for_id = 3,
1.26 + Input_event_op_get_axis_info = 4,
1.27 + Input_event_op_get_stream_state_for_id = 5,
1.28 +
1.29 + /* IRQ protocol operations.
1.30 + See: pkg/l4re-core/l4sys/include/icu.h */
1.31 +
1.32 + Input_event_op_bind = L4_ICU_OP_BIND,
1.33 +};
2.1 --- a/pkg/devices/input/src/client/input-event-client.cc Sun May 20 16:54:53 2018 +0200
2.2 +++ b/pkg/devices/input/src/client/input-event-client.cc Mon May 21 00:52:45 2018 +0200
2.3 @@ -30,11 +30,13 @@
2.4 {
2.5 L4::Ipc::Iostream s(l4_utcb());
2.6
2.7 + s << Input_event_op_get_buffer;
2.8 +
2.9 /* Send a "receive item" for requesting a capability. */
2.10
2.11 s << L4::Ipc::Small_buf(mem);
2.12
2.13 - return l4_error(s.call(cap(), Input_event_op_get_buffer));
2.14 + return l4_error(s.call(cap(), Input_event_proto_event));
2.15 }
2.16
2.17 int
2.18 @@ -42,11 +44,12 @@
2.19 {
2.20 L4::Ipc::Iostream s(l4_utcb());
2.21
2.22 + s << Input_event_op_bind;
2.23 s << irqnum;
2.24
2.25 /* Send a "receive item" for requesting a capability. */
2.26
2.27 s << L4::Ipc::Small_buf(irq);
2.28
2.29 - return l4_error(s.call(cap(), Input_event_op_bind));
2.30 + return l4_error(s.call(cap(), Input_event_proto_icu));
2.31 }
3.1 --- a/pkg/devices/input/src/server/input-keypad-server.cc Sun May 20 16:54:53 2018 +0200
3.2 +++ b/pkg/devices/input/src/server/input-keypad-server.cc Mon May 21 00:52:45 2018 +0200
3.3 @@ -43,6 +43,7 @@
3.4 Input_event_server::dispatch(l4_umword_t obj, L4::Ipc::Iostream &ios)
3.5 {
3.6 l4_msgtag_t tag;
3.7 + l4_umword_t op;
3.8
3.9 (void) obj;
3.10 ios >> tag;
3.11 @@ -52,18 +53,34 @@
3.12 case L4::Meta::Protocol:
3.13 return L4::Util::handle_meta_request<Input_event_interface>(ios);
3.14
3.15 - /* Reset the buffer state and return the buffer memory capability. */
3.16 + case L4RE_PROTO_EVENT:
3.17 + ios >> op;
3.18 + switch (op)
3.19 + {
3.20 + /* Reset the buffer state and return the buffer memory capability. */
3.21 +
3.22 + case Input_event_op_get_buffer:
3.23 + _events.reset();
3.24 + ios << _mem;
3.25 + return L4_EOK;
3.26
3.27 - case Input_event_op_get_buffer:
3.28 - _events.reset();
3.29 - ios << _mem;
3.30 - return L4_EOK;
3.31 + default:
3.32 + return -L4_ENOSYS;
3.33 + }
3.34
3.35 - /* Just return the interrupt capability. */
3.36 + case L4_PROTO_IRQ:
3.37 + ios >> op;
3.38 + switch (op)
3.39 + {
3.40 + /* Just return the interrupt capability. */
3.41
3.42 - case Input_event_op_bind:
3.43 - ios << _irq;
3.44 - return L4_EOK;
3.45 + case Input_event_op_bind:
3.46 + ios << _irq;
3.47 + return L4_EOK;
3.48 +
3.49 + default:
3.50 + return -L4_ENOSYS;
3.51 + }
3.52
3.53 default:
3.54 return -L4_EBADPROTO;