1 /* 2 * Common keypad server functionality. 3 * 4 * (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 #include "keypad-client.h" 23 #include "keypad-server.h" 24 25 #include <l4/cxx/ipc_server> 26 #include <l4/re/env> 27 #include <l4/sys/typeinfo_svr> 28 #include <l4/util/util.h> 29 30 /* Handle invocations. */ 31 32 int 33 Keypad_server::dispatch(l4_umword_t obj, L4::Ipc::Iostream &ios) 34 { 35 l4_msgtag_t tag; 36 37 (void) obj; 38 ios >> tag; 39 40 switch (tag.label()) 41 { 42 case L4::Meta::Protocol: 43 return L4::Util::handle_meta_request<Keypad_device_interface>(ios); 44 45 case Keypad_op_get_keypad_data: 46 ios << _mem; 47 return L4_EOK; 48 49 default: 50 return -L4_EBADPROTO; 51 } 52 }