dropped in the dos stuff
[smouse] / src / device.h
1 #ifndef DEVICE_H_
2 #define DEVICE_H_
3
4 enum {
5         DEV_EV_NONE,
6         DEV_EV_MOTION,
7         DEV_EV_BUTTON
8 };
9
10 struct device_event_motion {
11         int type;
12         int motion[6];
13 };
14
15 struct device_event_button {
16         int type;
17         int id;
18         int pressed;
19         unsigned int state;
20 };
21
22 typedef union device_event {
23         int type;
24         struct device_event_motion motion;
25         struct device_event_button button;
26 } device_event;
27
28 struct device {
29         char *name;
30         struct device *next;
31
32         int (*init)(void);
33         void (*destroy)(void);
34
35         int (*detect)(void);
36
37         int (*start)(void);
38         void (*stop)(void);
39
40         int (*pending)(void);
41         int (*getevent)(device_event*);
42 };
43
44 void register_all(void);
45
46 /* name 0 to auto-detect */
47 struct device *dev_init(const char *name);
48 void dev_destroy(void);
49
50 void set_port(const char *s);
51 const char *get_port(void);
52
53 #endif  /* DEVICE_H_ */