]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/input/include/libinput.h
Update
[l4.git] / l4 / pkg / input / include / libinput.h
1 /*****************************************************************************/
2 /**
3  * \file   input/include/libinput.h
4  * \brief  Input event library (L4INPUT) API
5  *
6  * \date   11/20/2003
7  * \author Christian Helmuth <ch12@os.inf.tu-dresden.de>
8  * \author Frank Mehnert <fm3@os.inf.tu-dresden.de>
9  *
10  */
11 /* (c) 2003 Technische Universitaet Dresden
12  * This file is part of DROPS, which is distributed under the terms of the
13  * GNU General Public License 2.
14  * Please see the COPYING-GPL-2 file for details.
15  *
16  * Original copyright notice from include/linux/input.h follows...
17  */
18 /*
19  * Copyright (c) 1999-2002 Vojtech Pavlik
20  *
21  * This program is free software; you can redistribute it and/or modify it
22  * under the terms of the GNU General Public License version 2 as published by
23  * the Free Software Foundation.
24  */
25
26 #ifndef __INPUT_INCLUDE_LIBINPUT_H_
27 #define __INPUT_INCLUDE_LIBINPUT_H_
28
29 #include <l4/sys/compiler.h>
30 #include <l4/input/macros.h>
31 #include <l4/re/event.h>
32
33 EXTERN_C_BEGIN
34
35 struct l4input {
36         long long time; ///< unused on bare hardware, used in Fiasco-UX
37         unsigned short type;
38         unsigned short code;
39         int value;
40         unsigned long stream_id;
41 };
42
43 /** Initialize input driver library.
44  *
45  * \param prio      if != L4THREAD_DEFAULT_PRIO use as prio for irq threads
46  * \param handler   if !NULL use this function on event occurence as
47  *                  callback
48  *
49  * libinput works in 2 different modes:
50  *
51  * -# input events are stored in library local ring buffers until
52  * l4input_flush() is called.
53  *
54  * -# on each event occurrence \a handler is called and no local event
55  * buffering is done.
56  */
57 L4_CV int l4input_init(int prio, L4_CV void (*handler)(struct l4input *));
58
59 /** Query event status.
60  *
61  * \return 0 if there are no pending events; !0 otherwise
62  */
63 L4_CV int l4input_ispending(void);
64
65 /** Get events.
66  *
67  * \param buffer    event return buffer
68  * \param count     max number of events to return
69  *
70  * \return number of flushed events
71  *
72  * Returns up to \a count events into buffer.
73  */
74 L4_CV int l4input_flush(void *buffer, int count);
75
76 /** Program PC speaker
77  *
78  * \param tone      tone value (0 switches off)
79  */
80 L4_CV int l4input_pcspkr(int tone);
81
82 L4_CV int l4evdev_stream_info_for_id(l4_umword_t id, l4re_event_stream_info_t *si);
83 L4_CV int l4evdev_absinfo(l4_umword_t id, unsigned naxes, const unsigned *axes, l4re_event_absinfo_t *infos);
84
85 EXTERN_C_END
86
87 #endif
88