diff options
-rw-r--r-- | drivers/input/mouse/trackpoint.c | 20 | ||||
-rw-r--r-- | drivers/input/mouse/trackpoint.h | 4 |
2 files changed, 16 insertions, 8 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, |
diff --git a/drivers/input/mouse/trackpoint.h b/drivers/input/mouse/trackpoint.h index 9857d8b6ad66..050298b1a09d 100644 --- a/drivers/input/mouse/trackpoint.h +++ b/drivers/input/mouse/trackpoint.h | |||
@@ -78,7 +78,7 @@ | |||
78 | 78 | ||
79 | #define TP_TOGGLE_MB 0x23 /* Disable/Enable Middle Button */ | 79 | #define TP_TOGGLE_MB 0x23 /* Disable/Enable Middle Button */ |
80 | #define TP_MASK_MB 0x01 | 80 | #define TP_MASK_MB 0x01 |
81 | #define TP_TOGGLE_EXT_DEV 0x23 /* Toggle external device */ | 81 | #define TP_TOGGLE_EXT_DEV 0x23 /* Disable external device */ |
82 | #define TP_MASK_EXT_DEV 0x02 | 82 | #define TP_MASK_EXT_DEV 0x02 |
83 | #define TP_TOGGLE_DRIFT 0x23 /* Drift Correction */ | 83 | #define TP_TOGGLE_DRIFT 0x23 /* Drift Correction */ |
84 | #define TP_MASK_DRIFT 0x80 | 84 | #define TP_MASK_DRIFT 0x80 |
@@ -125,7 +125,7 @@ | |||
125 | #define TP_DEF_MB 0x00 | 125 | #define TP_DEF_MB 0x00 |
126 | #define TP_DEF_PTSON 0x00 | 126 | #define TP_DEF_PTSON 0x00 |
127 | #define TP_DEF_SKIPBACK 0x00 | 127 | #define TP_DEF_SKIPBACK 0x00 |
128 | #define TP_DEF_EXT_DEV 0x01 | 128 | #define TP_DEF_EXT_DEV 0x00 /* 0 means enabled */ |
129 | 129 | ||
130 | #define MAKE_PS2_CMD(params, results, cmd) ((params<<12) | (results<<8) | (cmd)) | 130 | #define MAKE_PS2_CMD(params, results, cmd) ((params<<12) | (results<<8) | (cmd)) |
131 | 131 | ||