1 #ifndef __LUNAIX_INPUT_H
2 #define __LUNAIX_INPUT_H
4 #include <lunaix/clock.h>
5 #include <lunaix/device.h>
6 #include <lunaix/ds/ldga.h>
7 #include <lunaix/ds/llist.h>
8 #include <lunaix/ds/waitq.h>
9 #include <lunaix/types.h>
11 // event should propagate further
12 #define INPUT_EVT_NEXT 0
13 // event should be captured here
14 #define INPUT_EVT_CATCH 1
16 // key pressed (key-type device)
18 // key released (key-type device)
19 #define PKT_RELEASE 0x2
20 // vector (e.g. mice wheel scroll, mice maneuver)
21 #define PKT_VECTOR 0x3
23 #define EXPORT_INPUT_DEV(id, init_fn) \
24 export_ldga_el(inputdev, id, ptr_t, init_fn)
28 u32_t pkt_type; // packet type
29 u32_t scan_code; // hardware raw code
30 u32_t sys_code; // driver translated code
31 time_t timestamp; // event timestamp
36 struct device* dev_if; // device interface
37 struct input_evt_pkt current_pkt; // recieved event packet
38 waitq_t readers; // reader wait queue
41 typedef int (*input_evt_cb)(struct input_device* dev);
43 struct input_evt_chain
45 struct llist_header chain;
53 input_fire_event(struct input_device* idev, struct input_evt_pkt* pkt);
56 input_add_listener(input_evt_cb listener);
59 input_add_device(struct devclass* class, char* name_fmt, ...);
61 #endif /* __LUNAIX_INPUT_H */