aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/mouse/psmouse.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /drivers/input/mouse/psmouse.h
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'drivers/input/mouse/psmouse.h')
-rw-r--r--drivers/input/mouse/psmouse.h106
1 files changed, 106 insertions, 0 deletions
diff --git a/drivers/input/mouse/psmouse.h b/drivers/input/mouse/psmouse.h
new file mode 100644
index 000000000000..bda5b065d03c
--- /dev/null
+++ b/drivers/input/mouse/psmouse.h
@@ -0,0 +1,106 @@
1#ifndef _PSMOUSE_H
2#define _PSMOUSE_H
3
4#define PSMOUSE_CMD_SETSCALE11 0x00e6
5#define PSMOUSE_CMD_SETSCALE21 0x00e7
6#define PSMOUSE_CMD_SETRES 0x10e8
7#define PSMOUSE_CMD_GETINFO 0x03e9
8#define PSMOUSE_CMD_SETSTREAM 0x00ea
9#define PSMOUSE_CMD_SETPOLL 0x00f0
10#define PSMOUSE_CMD_POLL 0x03eb
11#define PSMOUSE_CMD_GETID 0x02f2
12#define PSMOUSE_CMD_SETRATE 0x10f3
13#define PSMOUSE_CMD_ENABLE 0x00f4
14#define PSMOUSE_CMD_DISABLE 0x00f5
15#define PSMOUSE_CMD_RESET_DIS 0x00f6
16#define PSMOUSE_CMD_RESET_BAT 0x02ff
17
18#define PSMOUSE_RET_BAT 0xaa
19#define PSMOUSE_RET_ID 0x00
20#define PSMOUSE_RET_ACK 0xfa
21#define PSMOUSE_RET_NAK 0xfe
22
23enum psmouse_state {
24 PSMOUSE_IGNORE,
25 PSMOUSE_INITIALIZING,
26 PSMOUSE_CMD_MODE,
27 PSMOUSE_ACTIVATED,
28};
29
30/* psmouse protocol handler return codes */
31typedef enum {
32 PSMOUSE_BAD_DATA,
33 PSMOUSE_GOOD_DATA,
34 PSMOUSE_FULL_PACKET
35} psmouse_ret_t;
36
37struct psmouse {
38 void *private;
39 struct input_dev dev;
40 struct ps2dev ps2dev;
41 char *vendor;
42 char *name;
43 unsigned char packet[8];
44 unsigned char pktcnt;
45 unsigned char pktsize;
46 unsigned char type;
47 unsigned int model;
48 unsigned long last;
49 unsigned long out_of_sync;
50 enum psmouse_state state;
51 char devname[64];
52 char phys[32];
53
54 unsigned int rate;
55 unsigned int resolution;
56 unsigned int resetafter;
57 unsigned int smartscroll; /* Logitech only */
58
59 psmouse_ret_t (*protocol_handler)(struct psmouse *psmouse, struct pt_regs *regs);
60 void (*set_rate)(struct psmouse *psmouse, unsigned int rate);
61 void (*set_resolution)(struct psmouse *psmouse, unsigned int resolution);
62
63 int (*reconnect)(struct psmouse *psmouse);
64 void (*disconnect)(struct psmouse *psmouse);
65
66 void (*pt_activate)(struct psmouse *psmouse);
67 void (*pt_deactivate)(struct psmouse *psmouse);
68};
69
70enum psmouse_type {
71 PSMOUSE_NONE,
72 PSMOUSE_PS2,
73 PSMOUSE_PS2PP,
74 PSMOUSE_THINKPS,
75 PSMOUSE_GENPS,
76 PSMOUSE_IMPS,
77 PSMOUSE_IMEX,
78 PSMOUSE_SYNAPTICS,
79 PSMOUSE_ALPS,
80};
81
82int psmouse_sliced_command(struct psmouse *psmouse, unsigned char command);
83int psmouse_reset(struct psmouse *psmouse);
84void psmouse_set_resolution(struct psmouse *psmouse, unsigned int resolution);
85
86ssize_t psmouse_attr_show_helper(struct device *dev, char *buf,
87 ssize_t (*handler)(struct psmouse *, char *));
88ssize_t psmouse_attr_set_helper(struct device *dev, const char *buf, size_t count,
89 ssize_t (*handler)(struct psmouse *, const char *, size_t));
90
91#define PSMOUSE_DEFINE_ATTR(_name) \
92static ssize_t psmouse_attr_show_##_name(struct psmouse *, char *); \
93static ssize_t psmouse_attr_set_##_name(struct psmouse *, const char *, size_t);\
94static ssize_t psmouse_do_show_##_name(struct device *d, char *b) \
95{ \
96 return psmouse_attr_show_helper(d, b, psmouse_attr_show_##_name); \
97} \
98static ssize_t psmouse_do_set_##_name(struct device *d, const char *b, size_t s)\
99{ \
100 return psmouse_attr_set_helper(d, b, s, psmouse_attr_set_##_name); \
101} \
102static struct device_attribute psmouse_attr_##_name = \
103 __ATTR(_name, S_IWUSR | S_IRUGO, \
104 psmouse_do_show_##_name, psmouse_do_set_##_name);
105
106#endif /* _PSMOUSE_H */