aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/mouse/trackpoint.c
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@pobox.com>2006-02-17 16:20:30 -0500
committerJeff Garzik <jgarzik@pobox.com>2006-02-17 16:20:30 -0500
commitb04a92e1601eb6df3a3b6599e7fb7ee021eef2cb (patch)
treef190980d5bffae81a67c0cea0d913ed2444ceb0c /drivers/input/mouse/trackpoint.c
parent70c07e02625ec46d0ffbfce1acef42d660803528 (diff)
parentf5e2a7b22e7d7dfda8794906d0fddeaaa09bb944 (diff)
Merge branch 'upstream-fixes'
Diffstat (limited to 'drivers/input/mouse/trackpoint.c')
-rw-r--r--drivers/input/mouse/trackpoint.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/drivers/input/mouse/trackpoint.c b/drivers/input/mouse/trackpoint.c
index b4898d8a68e2..6d9ec9ab1b90 100644
--- a/drivers/input/mouse/trackpoint.c
+++ b/drivers/input/mouse/trackpoint.c
@@ -68,15 +68,19 @@ struct trackpoint_attr_data {
68 size_t field_offset; 68 size_t field_offset;
69 unsigned char command; 69 unsigned char command;
70 unsigned char mask; 70 unsigned char mask;
71 unsigned char inverted;
71}; 72};
72 73
73static ssize_t trackpoint_show_int_attr(struct psmouse *psmouse, void *data, char *buf) 74static ssize_t trackpoint_show_int_attr(struct psmouse *psmouse, void *data, char *buf)
74{ 75{
75 struct trackpoint_data *tp = psmouse->private; 76 struct trackpoint_data *tp = psmouse->private;
76 struct trackpoint_attr_data *attr = data; 77 struct trackpoint_attr_data *attr = data;
77 unsigned char *field = (unsigned char *)((char *)tp + attr->field_offset); 78 unsigned char value = *(unsigned char *)((char *)tp + attr->field_offset);
79
80 if (attr->inverted)
81 value = !value;
78 82
79 return sprintf(buf, "%u\n", *field); 83 return sprintf(buf, "%u\n", value);
80} 84}
81 85
82static ssize_t trackpoint_set_int_attr(struct psmouse *psmouse, void *data, 86static ssize_t trackpoint_set_int_attr(struct psmouse *psmouse, void *data,
@@ -120,6 +124,9 @@ static ssize_t trackpoint_set_bit_attr(struct psmouse *psmouse, void *data,
120 if (*rest || value > 1) 124 if (*rest || value > 1)
121 return -EINVAL; 125 return -EINVAL;
122 126
127 if (attr->inverted)
128 value = !value;
129
123 if (*field != value) { 130 if (*field != value) {
124 *field = value; 131 *field = value;
125 trackpoint_toggle_bit(&psmouse->ps2dev, attr->command, attr->mask); 132 trackpoint_toggle_bit(&psmouse->ps2dev, attr->command, attr->mask);
@@ -129,11 +136,12 @@ static ssize_t trackpoint_set_bit_attr(struct psmouse *psmouse, void *data,
129} 136}
130 137
131 138
132#define TRACKPOINT_BIT_ATTR(_name, _command, _mask) \ 139#define TRACKPOINT_BIT_ATTR(_name, _command, _mask, _inv) \
133 static struct trackpoint_attr_data trackpoint_attr_##_name = { \ 140 static struct trackpoint_attr_data trackpoint_attr_##_name = { \
134 .field_offset = offsetof(struct trackpoint_data, _name), \ 141 .field_offset = offsetof(struct trackpoint_data, _name), \
135 .command = _command, \ 142 .command = _command, \
136 .mask = _mask, \ 143 .mask = _mask, \
144 .inverted = _inv, \
137 }; \ 145 }; \
138 PSMOUSE_DEFINE_ATTR(_name, S_IWUSR | S_IRUGO, \ 146 PSMOUSE_DEFINE_ATTR(_name, S_IWUSR | S_IRUGO, \
139 &trackpoint_attr_##_name, \ 147 &trackpoint_attr_##_name, \
@@ -150,9 +158,9 @@ TRACKPOINT_INT_ATTR(upthresh, TP_UP_THRESH);
150TRACKPOINT_INT_ATTR(ztime, TP_Z_TIME); 158TRACKPOINT_INT_ATTR(ztime, TP_Z_TIME);
151TRACKPOINT_INT_ATTR(jenks, TP_JENKS_CURV); 159TRACKPOINT_INT_ATTR(jenks, TP_JENKS_CURV);
152 160
153TRACKPOINT_BIT_ATTR(press_to_select, TP_TOGGLE_PTSON, TP_MASK_PTSON); 161TRACKPOINT_BIT_ATTR(press_to_select, TP_TOGGLE_PTSON, TP_MASK_PTSON, 0);
154TRACKPOINT_BIT_ATTR(skipback, TP_TOGGLE_SKIPBACK, TP_MASK_SKIPBACK); 162TRACKPOINT_BIT_ATTR(skipback, TP_TOGGLE_SKIPBACK, TP_MASK_SKIPBACK, 0);
155TRACKPOINT_BIT_ATTR(ext_dev, TP_TOGGLE_EXT_DEV, TP_MASK_EXT_DEV); 163TRACKPOINT_BIT_ATTR(ext_dev, TP_TOGGLE_EXT_DEV, TP_MASK_EXT_DEV, 1);
156 164
157static struct attribute *trackpoint_attrs[] = { 165static struct attribute *trackpoint_attrs[] = {
158 &psmouse_attr_sensitivity.dattr.attr, 166 &psmouse_attr_sensitivity.dattr.attr,