Landfall

pkg/devices/input/src/server/input-event-server.cc

154:f1ed3ebe0ddd
16 months ago Paul Boddie Fixed parameter type. Without this fix, C++ treats the method as being distinct from the base class method of the same name, and thus the operation cannot be invoked via IPC. idl4re-libipc-libsystypes
     1 /*     2  * Provide access to keypad events on the configured device.     3  *     4  * Copyright (C) 2018, 2023 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 "input-event-server.h"    23     24 #include <l4/re/event>    25 #include <l4/sys/irq.h>    26 #include <l4/sys/kip.h>    27     28     29     30 /* Reset the buffer state and return the buffer memory capability. */    31     32 long Input_event_server::get_buffer(l4re_ds_t *mem)    33 {    34   _events.reset();    35   *mem = _mem;    36   return L4_EOK;    37 }    38     39 /* Obtain the interrupt capability. */    40     41 long Input_event_server::bind(int irqnum, l4_cap_idx_t irq)    42 {    43   (void) irqnum;    44     45   _irq = irq;    46   return L4_EOK;    47 }    48     49     50     51 /* Event sending methods. */    52     53 void Input_event_server::send_event(int type, int code, int value)    54 {    55   L4Re::Event_buffer::Event event;    56     57   event.time = l4_kip_clock(l4re_kip());    58   event.payload.stream_id = 0;    59   event.payload.type = type;    60   event.payload.code = code;    61   event.payload.value = value;    62     63   /* Queue the event and trigger the interrupt. */    64     65   _events.put(event);    66   l4_irq_trigger(_irq);    67 }