diff options
author | Dmitry Torokhov <dtor_core@ameritech.net> | 2006-02-15 00:49:09 -0500 |
---|---|---|
committer | Dmitry Torokhov <dtor_core@ameritech.net> | 2006-02-15 00:49:09 -0500 |
commit | b8044c74bcd64bd1a9d2e8cec58fdcd40f16f5a4 (patch) | |
tree | e43dd609208393e6cac2e5b9a450daee7dbf37f8 /drivers/input/mouse/trackpoint.c | |
parent | 50f6dde0ad05ee4ee8450feb731b15b716115c4d (diff) |
Input: trackpoint - enable devices connected to external port
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/mouse/trackpoint.c')
-rw-r--r-- | drivers/input/mouse/trackpoint.c | 20 |
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 | ||
73 | static ssize_t trackpoint_show_int_attr(struct psmouse *psmouse, void *data, char *buf) | 74 | static 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 | ||
82 | static ssize_t trackpoint_set_int_attr(struct psmouse *psmouse, void *data, | 86 | static 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); | |||
150 | TRACKPOINT_INT_ATTR(ztime, TP_Z_TIME); | 158 | TRACKPOINT_INT_ATTR(ztime, TP_Z_TIME); |
151 | TRACKPOINT_INT_ATTR(jenks, TP_JENKS_CURV); | 159 | TRACKPOINT_INT_ATTR(jenks, TP_JENKS_CURV); |
152 | 160 | ||
153 | TRACKPOINT_BIT_ATTR(press_to_select, TP_TOGGLE_PTSON, TP_MASK_PTSON); | 161 | TRACKPOINT_BIT_ATTR(press_to_select, TP_TOGGLE_PTSON, TP_MASK_PTSON, 0); |
154 | TRACKPOINT_BIT_ATTR(skipback, TP_TOGGLE_SKIPBACK, TP_MASK_SKIPBACK); | 162 | TRACKPOINT_BIT_ATTR(skipback, TP_TOGGLE_SKIPBACK, TP_MASK_SKIPBACK, 0); |
155 | TRACKPOINT_BIT_ATTR(ext_dev, TP_TOGGLE_EXT_DEV, TP_MASK_EXT_DEV); | 163 | TRACKPOINT_BIT_ATTR(ext_dev, TP_TOGGLE_EXT_DEV, TP_MASK_EXT_DEV, 1); |
156 | 164 | ||
157 | static struct attribute *trackpoint_attrs[] = { | 165 | static struct attribute *trackpoint_attrs[] = { |
158 | &psmouse_attr_sensitivity.dattr.attr, | 166 | &psmouse_attr_sensitivity.dattr.attr, |