Stephen Evanchik | 541e316 | 2005-08-08 01:26:18 -0500 | [diff] [blame] | 1 | /* |
| 2 | * Stephen Evanchik <evanchsa@gmail.com> |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify it |
| 5 | * under the terms of the GNU General Public License version 2 as published by |
| 6 | * the Free Software Foundation. |
| 7 | * |
| 8 | * Trademarks are the property of their respective owners. |
| 9 | */ |
| 10 | |
Tejun Heo | 5a0e3ad | 2010-03-24 17:04:11 +0900 | [diff] [blame^] | 11 | #include <linux/slab.h> |
Stephen Evanchik | 541e316 | 2005-08-08 01:26:18 -0500 | [diff] [blame] | 12 | #include <linux/delay.h> |
| 13 | #include <linux/serio.h> |
| 14 | #include <linux/module.h> |
Stephen Evanchik | 541e316 | 2005-08-08 01:26:18 -0500 | [diff] [blame] | 15 | #include <linux/input.h> |
| 16 | #include <linux/libps2.h> |
| 17 | #include <linux/proc_fs.h> |
| 18 | #include <asm/uaccess.h> |
| 19 | #include "psmouse.h" |
| 20 | #include "trackpoint.h" |
| 21 | |
Stephen Evanchik | 541e316 | 2005-08-08 01:26:18 -0500 | [diff] [blame] | 22 | /* |
| 23 | * Device IO: read, write and toggle bit |
| 24 | */ |
| 25 | static int trackpoint_read(struct ps2dev *ps2dev, unsigned char loc, unsigned char *results) |
| 26 | { |
| 27 | if (ps2_command(ps2dev, NULL, MAKE_PS2_CMD(0, 0, TP_COMMAND)) || |
| 28 | ps2_command(ps2dev, results, MAKE_PS2_CMD(0, 1, loc))) { |
| 29 | return -1; |
| 30 | } |
| 31 | |
| 32 | return 0; |
| 33 | } |
| 34 | |
| 35 | static int trackpoint_write(struct ps2dev *ps2dev, unsigned char loc, unsigned char val) |
| 36 | { |
| 37 | if (ps2_command(ps2dev, NULL, MAKE_PS2_CMD(0, 0, TP_COMMAND)) || |
| 38 | ps2_command(ps2dev, NULL, MAKE_PS2_CMD(0, 0, TP_WRITE_MEM)) || |
| 39 | ps2_command(ps2dev, NULL, MAKE_PS2_CMD(0, 0, loc)) || |
| 40 | ps2_command(ps2dev, NULL, MAKE_PS2_CMD(0, 0, val))) { |
| 41 | return -1; |
| 42 | } |
| 43 | |
| 44 | return 0; |
| 45 | } |
| 46 | |
| 47 | static int trackpoint_toggle_bit(struct ps2dev *ps2dev, unsigned char loc, unsigned char mask) |
| 48 | { |
| 49 | /* Bad things will happen if the loc param isn't in this range */ |
| 50 | if (loc < 0x20 || loc >= 0x2F) |
| 51 | return -1; |
| 52 | |
| 53 | if (ps2_command(ps2dev, NULL, MAKE_PS2_CMD(0, 0, TP_COMMAND)) || |
| 54 | ps2_command(ps2dev, NULL, MAKE_PS2_CMD(0, 0, TP_TOGGLE)) || |
| 55 | ps2_command(ps2dev, NULL, MAKE_PS2_CMD(0, 0, loc)) || |
| 56 | ps2_command(ps2dev, NULL, MAKE_PS2_CMD(0, 0, mask))) { |
| 57 | return -1; |
| 58 | } |
| 59 | |
| 60 | return 0; |
| 61 | } |
| 62 | |
Stephen Evanchik | 541e316 | 2005-08-08 01:26:18 -0500 | [diff] [blame] | 63 | |
Dmitry Torokhov | cfe9e88 | 2005-09-04 01:40:20 -0500 | [diff] [blame] | 64 | /* |
| 65 | * Trackpoint-specific attributes |
| 66 | */ |
| 67 | struct trackpoint_attr_data { |
| 68 | size_t field_offset; |
| 69 | unsigned char command; |
| 70 | unsigned char mask; |
Dmitry Torokhov | b8044c7 | 2006-02-15 00:49:09 -0500 | [diff] [blame] | 71 | unsigned char inverted; |
Dmitry Torokhov | cfe9e88 | 2005-09-04 01:40:20 -0500 | [diff] [blame] | 72 | }; |
Stephen Evanchik | 541e316 | 2005-08-08 01:26:18 -0500 | [diff] [blame] | 73 | |
Dmitry Torokhov | cfe9e88 | 2005-09-04 01:40:20 -0500 | [diff] [blame] | 74 | static ssize_t trackpoint_show_int_attr(struct psmouse *psmouse, void *data, char *buf) |
| 75 | { |
| 76 | struct trackpoint_data *tp = psmouse->private; |
| 77 | struct trackpoint_attr_data *attr = data; |
Dmitry Torokhov | b8044c7 | 2006-02-15 00:49:09 -0500 | [diff] [blame] | 78 | unsigned char value = *(unsigned char *)((char *)tp + attr->field_offset); |
Stephen Evanchik | 541e316 | 2005-08-08 01:26:18 -0500 | [diff] [blame] | 79 | |
Dmitry Torokhov | b8044c7 | 2006-02-15 00:49:09 -0500 | [diff] [blame] | 80 | if (attr->inverted) |
| 81 | value = !value; |
| 82 | |
| 83 | return sprintf(buf, "%u\n", value); |
Dmitry Torokhov | cfe9e88 | 2005-09-04 01:40:20 -0500 | [diff] [blame] | 84 | } |
Stephen Evanchik | 541e316 | 2005-08-08 01:26:18 -0500 | [diff] [blame] | 85 | |
Dmitry Torokhov | cfe9e88 | 2005-09-04 01:40:20 -0500 | [diff] [blame] | 86 | static ssize_t trackpoint_set_int_attr(struct psmouse *psmouse, void *data, |
| 87 | const char *buf, size_t count) |
| 88 | { |
| 89 | struct trackpoint_data *tp = psmouse->private; |
| 90 | struct trackpoint_attr_data *attr = data; |
| 91 | unsigned char *field = (unsigned char *)((char *)tp + attr->field_offset); |
| 92 | unsigned long value; |
Stephen Evanchik | 541e316 | 2005-08-08 01:26:18 -0500 | [diff] [blame] | 93 | |
Joe Rouvier | 160f1fe | 2008-08-10 00:29:25 -0400 | [diff] [blame] | 94 | if (strict_strtoul(buf, 10, &value) || value > 255) |
Dmitry Torokhov | cfe9e88 | 2005-09-04 01:40:20 -0500 | [diff] [blame] | 95 | return -EINVAL; |
Stephen Evanchik | 541e316 | 2005-08-08 01:26:18 -0500 | [diff] [blame] | 96 | |
Dmitry Torokhov | cfe9e88 | 2005-09-04 01:40:20 -0500 | [diff] [blame] | 97 | *field = value; |
| 98 | trackpoint_write(&psmouse->ps2dev, attr->command, value); |
Stephen Evanchik | 541e316 | 2005-08-08 01:26:18 -0500 | [diff] [blame] | 99 | |
Dmitry Torokhov | cfe9e88 | 2005-09-04 01:40:20 -0500 | [diff] [blame] | 100 | return count; |
| 101 | } |
Stephen Evanchik | 541e316 | 2005-08-08 01:26:18 -0500 | [diff] [blame] | 102 | |
Dmitry Torokhov | cfe9e88 | 2005-09-04 01:40:20 -0500 | [diff] [blame] | 103 | #define TRACKPOINT_INT_ATTR(_name, _command) \ |
| 104 | static struct trackpoint_attr_data trackpoint_attr_##_name = { \ |
| 105 | .field_offset = offsetof(struct trackpoint_data, _name), \ |
| 106 | .command = _command, \ |
| 107 | }; \ |
| 108 | PSMOUSE_DEFINE_ATTR(_name, S_IWUSR | S_IRUGO, \ |
| 109 | &trackpoint_attr_##_name, \ |
| 110 | trackpoint_show_int_attr, trackpoint_set_int_attr) |
Stephen Evanchik | 541e316 | 2005-08-08 01:26:18 -0500 | [diff] [blame] | 111 | |
Dmitry Torokhov | cfe9e88 | 2005-09-04 01:40:20 -0500 | [diff] [blame] | 112 | static ssize_t trackpoint_set_bit_attr(struct psmouse *psmouse, void *data, |
| 113 | const char *buf, size_t count) |
| 114 | { |
| 115 | struct trackpoint_data *tp = psmouse->private; |
| 116 | struct trackpoint_attr_data *attr = data; |
| 117 | unsigned char *field = (unsigned char *)((char *)tp + attr->field_offset); |
| 118 | unsigned long value; |
Stephen Evanchik | 541e316 | 2005-08-08 01:26:18 -0500 | [diff] [blame] | 119 | |
Joe Rouvier | 160f1fe | 2008-08-10 00:29:25 -0400 | [diff] [blame] | 120 | if (strict_strtoul(buf, 10, &value) || value > 1) |
Dmitry Torokhov | cfe9e88 | 2005-09-04 01:40:20 -0500 | [diff] [blame] | 121 | return -EINVAL; |
Stephen Evanchik | 541e316 | 2005-08-08 01:26:18 -0500 | [diff] [blame] | 122 | |
Dmitry Torokhov | b8044c7 | 2006-02-15 00:49:09 -0500 | [diff] [blame] | 123 | if (attr->inverted) |
| 124 | value = !value; |
| 125 | |
Dmitry Torokhov | cfe9e88 | 2005-09-04 01:40:20 -0500 | [diff] [blame] | 126 | if (*field != value) { |
| 127 | *field = value; |
| 128 | trackpoint_toggle_bit(&psmouse->ps2dev, attr->command, attr->mask); |
| 129 | } |
Stephen Evanchik | 541e316 | 2005-08-08 01:26:18 -0500 | [diff] [blame] | 130 | |
Dmitry Torokhov | cfe9e88 | 2005-09-04 01:40:20 -0500 | [diff] [blame] | 131 | return count; |
| 132 | } |
| 133 | |
| 134 | |
Dmitry Torokhov | b8044c7 | 2006-02-15 00:49:09 -0500 | [diff] [blame] | 135 | #define TRACKPOINT_BIT_ATTR(_name, _command, _mask, _inv) \ |
Dmitry Torokhov | cfe9e88 | 2005-09-04 01:40:20 -0500 | [diff] [blame] | 136 | static struct trackpoint_attr_data trackpoint_attr_##_name = { \ |
| 137 | .field_offset = offsetof(struct trackpoint_data, _name), \ |
| 138 | .command = _command, \ |
| 139 | .mask = _mask, \ |
Dmitry Torokhov | b8044c7 | 2006-02-15 00:49:09 -0500 | [diff] [blame] | 140 | .inverted = _inv, \ |
Dmitry Torokhov | cfe9e88 | 2005-09-04 01:40:20 -0500 | [diff] [blame] | 141 | }; \ |
| 142 | PSMOUSE_DEFINE_ATTR(_name, S_IWUSR | S_IRUGO, \ |
| 143 | &trackpoint_attr_##_name, \ |
| 144 | trackpoint_show_int_attr, trackpoint_set_bit_attr) |
| 145 | |
| 146 | TRACKPOINT_INT_ATTR(sensitivity, TP_SENS); |
| 147 | TRACKPOINT_INT_ATTR(speed, TP_SPEED); |
| 148 | TRACKPOINT_INT_ATTR(inertia, TP_INERTIA); |
| 149 | TRACKPOINT_INT_ATTR(reach, TP_REACH); |
| 150 | TRACKPOINT_INT_ATTR(draghys, TP_DRAGHYS); |
| 151 | TRACKPOINT_INT_ATTR(mindrag, TP_MINDRAG); |
| 152 | TRACKPOINT_INT_ATTR(thresh, TP_THRESH); |
| 153 | TRACKPOINT_INT_ATTR(upthresh, TP_UP_THRESH); |
| 154 | TRACKPOINT_INT_ATTR(ztime, TP_Z_TIME); |
| 155 | TRACKPOINT_INT_ATTR(jenks, TP_JENKS_CURV); |
| 156 | |
Dmitry Torokhov | b8044c7 | 2006-02-15 00:49:09 -0500 | [diff] [blame] | 157 | TRACKPOINT_BIT_ATTR(press_to_select, TP_TOGGLE_PTSON, TP_MASK_PTSON, 0); |
| 158 | TRACKPOINT_BIT_ATTR(skipback, TP_TOGGLE_SKIPBACK, TP_MASK_SKIPBACK, 0); |
| 159 | TRACKPOINT_BIT_ATTR(ext_dev, TP_TOGGLE_EXT_DEV, TP_MASK_EXT_DEV, 1); |
Stephen Evanchik | 541e316 | 2005-08-08 01:26:18 -0500 | [diff] [blame] | 160 | |
| 161 | static struct attribute *trackpoint_attrs[] = { |
Dmitry Torokhov | cfe9e88 | 2005-09-04 01:40:20 -0500 | [diff] [blame] | 162 | &psmouse_attr_sensitivity.dattr.attr, |
| 163 | &psmouse_attr_speed.dattr.attr, |
| 164 | &psmouse_attr_inertia.dattr.attr, |
| 165 | &psmouse_attr_reach.dattr.attr, |
| 166 | &psmouse_attr_draghys.dattr.attr, |
| 167 | &psmouse_attr_mindrag.dattr.attr, |
| 168 | &psmouse_attr_thresh.dattr.attr, |
| 169 | &psmouse_attr_upthresh.dattr.attr, |
| 170 | &psmouse_attr_ztime.dattr.attr, |
| 171 | &psmouse_attr_jenks.dattr.attr, |
| 172 | &psmouse_attr_press_to_select.dattr.attr, |
| 173 | &psmouse_attr_skipback.dattr.attr, |
| 174 | &psmouse_attr_ext_dev.dattr.attr, |
Stephen Evanchik | 541e316 | 2005-08-08 01:26:18 -0500 | [diff] [blame] | 175 | NULL |
| 176 | }; |
| 177 | |
| 178 | static struct attribute_group trackpoint_attr_group = { |
| 179 | .attrs = trackpoint_attrs, |
| 180 | }; |
| 181 | |
Dmitry Torokhov | 184dd27 | 2006-08-04 22:52:26 -0400 | [diff] [blame] | 182 | static int trackpoint_start_protocol(struct psmouse *psmouse, unsigned char *firmware_id) |
Stephen Evanchik | 541e316 | 2005-08-08 01:26:18 -0500 | [diff] [blame] | 183 | { |
Dmitry Torokhov | 184dd27 | 2006-08-04 22:52:26 -0400 | [diff] [blame] | 184 | unsigned char param[2] = { 0 }; |
Stephen Evanchik | 541e316 | 2005-08-08 01:26:18 -0500 | [diff] [blame] | 185 | |
Dmitry Torokhov | 184dd27 | 2006-08-04 22:52:26 -0400 | [diff] [blame] | 186 | if (ps2_command(&psmouse->ps2dev, param, MAKE_PS2_CMD(0, 2, TP_READ_ID))) |
| 187 | return -1; |
| 188 | |
| 189 | if (param[0] != TP_MAGIC_IDENT) |
| 190 | return -1; |
| 191 | |
| 192 | if (firmware_id) |
| 193 | *firmware_id = param[1]; |
| 194 | |
| 195 | return 0; |
Stephen Evanchik | 541e316 | 2005-08-08 01:26:18 -0500 | [diff] [blame] | 196 | } |
| 197 | |
| 198 | static int trackpoint_sync(struct psmouse *psmouse) |
| 199 | { |
Stephen Evanchik | 541e316 | 2005-08-08 01:26:18 -0500 | [diff] [blame] | 200 | struct trackpoint_data *tp = psmouse->private; |
Dmitry Torokhov | 184dd27 | 2006-08-04 22:52:26 -0400 | [diff] [blame] | 201 | unsigned char toggle; |
Stephen Evanchik | 541e316 | 2005-08-08 01:26:18 -0500 | [diff] [blame] | 202 | |
| 203 | /* Disable features that may make device unusable with this driver */ |
| 204 | trackpoint_read(&psmouse->ps2dev, TP_TOGGLE_TWOHAND, &toggle); |
| 205 | if (toggle & TP_MASK_TWOHAND) |
| 206 | trackpoint_toggle_bit(&psmouse->ps2dev, TP_TOGGLE_TWOHAND, TP_MASK_TWOHAND); |
| 207 | |
| 208 | trackpoint_read(&psmouse->ps2dev, TP_TOGGLE_SOURCE_TAG, &toggle); |
| 209 | if (toggle & TP_MASK_SOURCE_TAG) |
| 210 | trackpoint_toggle_bit(&psmouse->ps2dev, TP_TOGGLE_SOURCE_TAG, TP_MASK_SOURCE_TAG); |
| 211 | |
| 212 | trackpoint_read(&psmouse->ps2dev, TP_TOGGLE_MB, &toggle); |
| 213 | if (toggle & TP_MASK_MB) |
| 214 | trackpoint_toggle_bit(&psmouse->ps2dev, TP_TOGGLE_MB, TP_MASK_MB); |
| 215 | |
| 216 | /* Push the config to the device */ |
| 217 | trackpoint_write(&psmouse->ps2dev, TP_SENS, tp->sensitivity); |
| 218 | trackpoint_write(&psmouse->ps2dev, TP_INERTIA, tp->inertia); |
| 219 | trackpoint_write(&psmouse->ps2dev, TP_SPEED, tp->speed); |
| 220 | |
| 221 | trackpoint_write(&psmouse->ps2dev, TP_REACH, tp->reach); |
| 222 | trackpoint_write(&psmouse->ps2dev, TP_DRAGHYS, tp->draghys); |
| 223 | trackpoint_write(&psmouse->ps2dev, TP_MINDRAG, tp->mindrag); |
| 224 | |
| 225 | trackpoint_write(&psmouse->ps2dev, TP_THRESH, tp->thresh); |
| 226 | trackpoint_write(&psmouse->ps2dev, TP_UP_THRESH, tp->upthresh); |
| 227 | |
| 228 | trackpoint_write(&psmouse->ps2dev, TP_Z_TIME, tp->ztime); |
| 229 | trackpoint_write(&psmouse->ps2dev, TP_JENKS_CURV, tp->jenks); |
| 230 | |
| 231 | trackpoint_read(&psmouse->ps2dev, TP_TOGGLE_PTSON, &toggle); |
| 232 | if (((toggle & TP_MASK_PTSON) == TP_MASK_PTSON) != tp->press_to_select) |
| 233 | trackpoint_toggle_bit(&psmouse->ps2dev, TP_TOGGLE_PTSON, TP_MASK_PTSON); |
| 234 | |
| 235 | trackpoint_read(&psmouse->ps2dev, TP_TOGGLE_SKIPBACK, &toggle); |
| 236 | if (((toggle & TP_MASK_SKIPBACK) == TP_MASK_SKIPBACK) != tp->skipback) |
| 237 | trackpoint_toggle_bit(&psmouse->ps2dev, TP_TOGGLE_SKIPBACK, TP_MASK_SKIPBACK); |
| 238 | |
| 239 | trackpoint_read(&psmouse->ps2dev, TP_TOGGLE_EXT_DEV, &toggle); |
| 240 | if (((toggle & TP_MASK_EXT_DEV) == TP_MASK_EXT_DEV) != tp->ext_dev) |
| 241 | trackpoint_toggle_bit(&psmouse->ps2dev, TP_TOGGLE_EXT_DEV, TP_MASK_EXT_DEV); |
| 242 | |
| 243 | return 0; |
| 244 | } |
| 245 | |
| 246 | static void trackpoint_defaults(struct trackpoint_data *tp) |
| 247 | { |
| 248 | tp->press_to_select = TP_DEF_PTSON; |
| 249 | tp->sensitivity = TP_DEF_SENS; |
| 250 | tp->speed = TP_DEF_SPEED; |
| 251 | tp->reach = TP_DEF_REACH; |
| 252 | |
| 253 | tp->draghys = TP_DEF_DRAGHYS; |
| 254 | tp->mindrag = TP_DEF_MINDRAG; |
| 255 | |
| 256 | tp->thresh = TP_DEF_THRESH; |
| 257 | tp->upthresh = TP_DEF_UP_THRESH; |
| 258 | |
| 259 | tp->ztime = TP_DEF_Z_TIME; |
| 260 | tp->jenks = TP_DEF_JENKS_CURV; |
| 261 | |
| 262 | tp->inertia = TP_DEF_INERTIA; |
| 263 | tp->skipback = TP_DEF_SKIPBACK; |
| 264 | tp->ext_dev = TP_DEF_EXT_DEV; |
| 265 | } |
| 266 | |
Dmitry Torokhov | 184dd27 | 2006-08-04 22:52:26 -0400 | [diff] [blame] | 267 | static void trackpoint_disconnect(struct psmouse *psmouse) |
| 268 | { |
| 269 | sysfs_remove_group(&psmouse->ps2dev.serio->dev.kobj, &trackpoint_attr_group); |
| 270 | |
| 271 | kfree(psmouse->private); |
| 272 | psmouse->private = NULL; |
| 273 | } |
| 274 | |
| 275 | static int trackpoint_reconnect(struct psmouse *psmouse) |
| 276 | { |
| 277 | if (trackpoint_start_protocol(psmouse, NULL)) |
| 278 | return -1; |
| 279 | |
| 280 | if (trackpoint_sync(psmouse)) |
| 281 | return -1; |
| 282 | |
| 283 | return 0; |
| 284 | } |
| 285 | |
Dmitry Torokhov | b7802c5 | 2009-09-09 19:13:20 -0700 | [diff] [blame] | 286 | int trackpoint_detect(struct psmouse *psmouse, bool set_properties) |
Stephen Evanchik | 541e316 | 2005-08-08 01:26:18 -0500 | [diff] [blame] | 287 | { |
Stephen Evanchik | 541e316 | 2005-08-08 01:26:18 -0500 | [diff] [blame] | 288 | struct ps2dev *ps2dev = &psmouse->ps2dev; |
| 289 | unsigned char firmware_id; |
| 290 | unsigned char button_info; |
Jeff Garzik | 8ff22ea | 2006-11-02 23:59:30 -0500 | [diff] [blame] | 291 | int error; |
Stephen Evanchik | 541e316 | 2005-08-08 01:26:18 -0500 | [diff] [blame] | 292 | |
Dmitry Torokhov | 184dd27 | 2006-08-04 22:52:26 -0400 | [diff] [blame] | 293 | if (trackpoint_start_protocol(psmouse, &firmware_id)) |
Stephen Evanchik | 541e316 | 2005-08-08 01:26:18 -0500 | [diff] [blame] | 294 | return -1; |
| 295 | |
| 296 | if (!set_properties) |
| 297 | return 0; |
| 298 | |
Stephen Evanchik | 541e316 | 2005-08-08 01:26:18 -0500 | [diff] [blame] | 299 | if (trackpoint_read(&psmouse->ps2dev, TP_EXT_BTN, &button_info)) { |
| 300 | printk(KERN_WARNING "trackpoint.c: failed to get extended button data\n"); |
| 301 | button_info = 0; |
| 302 | } |
| 303 | |
Dmitry Torokhov | 315eb99 | 2009-11-16 22:12:21 -0800 | [diff] [blame] | 304 | psmouse->private = kzalloc(sizeof(struct trackpoint_data), GFP_KERNEL); |
| 305 | if (!psmouse->private) |
Stephen Evanchik | 541e316 | 2005-08-08 01:26:18 -0500 | [diff] [blame] | 306 | return -1; |
| 307 | |
| 308 | psmouse->vendor = "IBM"; |
| 309 | psmouse->name = "TrackPoint"; |
| 310 | |
Dmitry Torokhov | 184dd27 | 2006-08-04 22:52:26 -0400 | [diff] [blame] | 311 | psmouse->reconnect = trackpoint_reconnect; |
Stephen Evanchik | 541e316 | 2005-08-08 01:26:18 -0500 | [diff] [blame] | 312 | psmouse->disconnect = trackpoint_disconnect; |
| 313 | |
Dmitry Torokhov | 315eb99 | 2009-11-16 22:12:21 -0800 | [diff] [blame] | 314 | if ((button_info & 0x0f) >= 3) |
| 315 | __set_bit(BTN_MIDDLE, psmouse->dev->keybit); |
| 316 | |
| 317 | trackpoint_defaults(psmouse->private); |
Stephen Evanchik | 541e316 | 2005-08-08 01:26:18 -0500 | [diff] [blame] | 318 | trackpoint_sync(psmouse); |
| 319 | |
Jeff Garzik | 8ff22ea | 2006-11-02 23:59:30 -0500 | [diff] [blame] | 320 | error = sysfs_create_group(&ps2dev->serio->dev.kobj, &trackpoint_attr_group); |
| 321 | if (error) { |
| 322 | printk(KERN_ERR |
| 323 | "trackpoint.c: failed to create sysfs attributes, error: %d\n", |
| 324 | error); |
Dmitry Torokhov | 315eb99 | 2009-11-16 22:12:21 -0800 | [diff] [blame] | 325 | kfree(psmouse->private); |
| 326 | psmouse->private = NULL; |
Jeff Garzik | 8ff22ea | 2006-11-02 23:59:30 -0500 | [diff] [blame] | 327 | return -1; |
| 328 | } |
Stephen Evanchik | 541e316 | 2005-08-08 01:26:18 -0500 | [diff] [blame] | 329 | |
| 330 | printk(KERN_INFO "IBM TrackPoint firmware: 0x%02x, buttons: %d/%d\n", |
| 331 | firmware_id, (button_info & 0xf0) >> 4, button_info & 0x0f); |
| 332 | |
| 333 | return 0; |
| 334 | } |
| 335 | |