1 /* 2 * Common input event server functionality. 3 * 4 * Copyright (C) 2018 Paul Boddie <paul@boddie.org.uk> 5 * 6 * This program is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU General Public License as 8 * published by the Free Software Foundation; either version 2 of 9 * the License, or (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, 19 * Boston, MA 02110-1301, USA 20 */ 21 22 #pragma once 23 24 #ifdef __cplusplus 25 26 #include "input-event-client.h" 27 28 #include <l4/cxx/ipc_server> 29 #include <l4/re/dataspace> 30 #include <l4/re/env> 31 #include <l4/re/event> 32 #include <l4/sys/icu> 33 #include <l4/sys/types.h> 34 35 /* Server object to provide input event source access. */ 36 37 class Input_event_server : public L4::Server_object_t<Input_event_interface> 38 { 39 private: 40 L4::Cap<L4Re::Dataspace> _mem; 41 L4::Cap<L4::Irq> _irq; 42 L4Re::Event_buffer _events; 43 44 public: 45 /* Initialise the server with a capability referencing the exported memory 46 and an event buffer through which events will be communicated. */ 47 48 explicit Input_event_server(L4::Cap<L4Re::Dataspace> mem, 49 L4Re::Event_buffer events) 50 : _mem(mem), _events(events) 51 { 52 } 53 54 int dispatch(l4_umword_t obj, L4::Ipc::Iostream &ios); 55 56 /* Event sending methods. */ 57 58 void send_event(int type, int code, int value); 59 }; 60 61 #endif