diff options
Diffstat (limited to 'drivers/input/tsdev.c')
-rw-r--r-- | drivers/input/tsdev.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/drivers/input/tsdev.c b/drivers/input/tsdev.c index d678d144bbf8..5f9ecad2ca75 100644 --- a/drivers/input/tsdev.c +++ b/drivers/input/tsdev.c | |||
@@ -35,7 +35,7 @@ | |||
35 | * e-mail - mail your message to <jsimmons@infradead.org>. | 35 | * e-mail - mail your message to <jsimmons@infradead.org>. |
36 | */ | 36 | */ |
37 | 37 | ||
38 | #define TSDEV_MINOR_BASE 128 | 38 | #define TSDEV_MINOR_BASE 128 |
39 | #define TSDEV_MINORS 32 | 39 | #define TSDEV_MINORS 32 |
40 | /* First 16 devices are h3600_ts compatible; second 16 are h3600_tsraw */ | 40 | /* First 16 devices are h3600_ts compatible; second 16 are h3600_tsraw */ |
41 | #define TSDEV_MINOR_MASK 15 | 41 | #define TSDEV_MINOR_MASK 15 |
@@ -230,6 +230,7 @@ static ssize_t tsdev_read(struct file *file, char __user *buffer, size_t count, | |||
230 | static unsigned int tsdev_poll(struct file *file, poll_table * wait) | 230 | static unsigned int tsdev_poll(struct file *file, poll_table * wait) |
231 | { | 231 | { |
232 | struct tsdev_list *list = file->private_data; | 232 | struct tsdev_list *list = file->private_data; |
233 | |||
233 | poll_wait(file, &list->tsdev->wait, wait); | 234 | poll_wait(file, &list->tsdev->wait, wait); |
234 | return ((list->head == list->tail) ? 0 : (POLLIN | POLLRDNORM)) | | 235 | return ((list->head == list->tail) ? 0 : (POLLIN | POLLRDNORM)) | |
235 | (list->tsdev->exist ? 0 : (POLLHUP | POLLERR)); | 236 | (list->tsdev->exist ? 0 : (POLLHUP | POLLERR)); |
@@ -248,11 +249,13 @@ static int tsdev_ioctl(struct inode *inode, struct file *file, | |||
248 | sizeof (struct ts_calibration))) | 249 | sizeof (struct ts_calibration))) |
249 | retval = -EFAULT; | 250 | retval = -EFAULT; |
250 | break; | 251 | break; |
252 | |||
251 | case TS_SET_CAL: | 253 | case TS_SET_CAL: |
252 | if (copy_from_user (&tsdev->cal, (void __user *)arg, | 254 | if (copy_from_user (&tsdev->cal, (void __user *)arg, |
253 | sizeof (struct ts_calibration))) | 255 | sizeof (struct ts_calibration))) |
254 | retval = -EFAULT; | 256 | retval = -EFAULT; |
255 | break; | 257 | break; |
258 | |||
256 | default: | 259 | default: |
257 | retval = -EINVAL; | 260 | retval = -EINVAL; |
258 | break; | 261 | break; |
@@ -284,9 +287,11 @@ static void tsdev_event(struct input_handle *handle, unsigned int type, | |||
284 | case ABS_X: | 287 | case ABS_X: |
285 | tsdev->x = value; | 288 | tsdev->x = value; |
286 | break; | 289 | break; |
290 | |||
287 | case ABS_Y: | 291 | case ABS_Y: |
288 | tsdev->y = value; | 292 | tsdev->y = value; |
289 | break; | 293 | break; |
294 | |||
290 | case ABS_PRESSURE: | 295 | case ABS_PRESSURE: |
291 | if (value > handle->dev->absmax[ABS_PRESSURE]) | 296 | if (value > handle->dev->absmax[ABS_PRESSURE]) |
292 | value = handle->dev->absmax[ABS_PRESSURE]; | 297 | value = handle->dev->absmax[ABS_PRESSURE]; |
@@ -307,6 +312,7 @@ static void tsdev_event(struct input_handle *handle, unsigned int type, | |||
307 | else if (tsdev->x > xres) | 312 | else if (tsdev->x > xres) |
308 | tsdev->x = xres; | 313 | tsdev->x = xres; |
309 | break; | 314 | break; |
315 | |||
310 | case REL_Y: | 316 | case REL_Y: |
311 | tsdev->y += value; | 317 | tsdev->y += value; |
312 | if (tsdev->y < 0) | 318 | if (tsdev->y < 0) |
@@ -323,6 +329,7 @@ static void tsdev_event(struct input_handle *handle, unsigned int type, | |||
323 | case 0: | 329 | case 0: |
324 | tsdev->pressure = 0; | 330 | tsdev->pressure = 0; |
325 | break; | 331 | break; |
332 | |||
326 | case 1: | 333 | case 1: |
327 | if (!tsdev->pressure) | 334 | if (!tsdev->pressure) |
328 | tsdev->pressure = 1; | 335 | tsdev->pressure = 1; |
@@ -370,9 +377,8 @@ static struct input_handle *tsdev_connect(struct input_handler *handler, | |||
370 | struct class_device *cdev; | 377 | struct class_device *cdev; |
371 | int minor, delta; | 378 | int minor, delta; |
372 | 379 | ||
373 | for (minor = 0; minor < TSDEV_MINORS/2 && tsdev_table[minor]; | 380 | for (minor = 0; minor < TSDEV_MINORS / 2 && tsdev_table[minor]; minor++); |
374 | minor++); | 381 | if (minor >= TSDEV_MINORS / 2) { |
375 | if (minor >= TSDEV_MINORS/2) { | ||
376 | printk(KERN_ERR | 382 | printk(KERN_ERR |
377 | "tsdev: You have way too many touchscreens\n"); | 383 | "tsdev: You have way too many touchscreens\n"); |
378 | return NULL; | 384 | return NULL; |
@@ -444,22 +450,22 @@ static struct input_device_id tsdev_ids[] = { | |||
444 | .evbit = { BIT(EV_KEY) | BIT(EV_REL) }, | 450 | .evbit = { BIT(EV_KEY) | BIT(EV_REL) }, |
445 | .keybit = { [LONG(BTN_LEFT)] = BIT(BTN_LEFT) }, | 451 | .keybit = { [LONG(BTN_LEFT)] = BIT(BTN_LEFT) }, |
446 | .relbit = { BIT(REL_X) | BIT(REL_Y) }, | 452 | .relbit = { BIT(REL_X) | BIT(REL_Y) }, |
447 | },/* A mouse like device, at least one button, two relative axes */ | 453 | }, /* A mouse like device, at least one button, two relative axes */ |
448 | 454 | ||
449 | { | 455 | { |
450 | .flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_KEYBIT | INPUT_DEVICE_ID_MATCH_ABSBIT, | 456 | .flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_KEYBIT | INPUT_DEVICE_ID_MATCH_ABSBIT, |
451 | .evbit = { BIT(EV_KEY) | BIT(EV_ABS) }, | 457 | .evbit = { BIT(EV_KEY) | BIT(EV_ABS) }, |
452 | .keybit = { [LONG(BTN_TOUCH)] = BIT(BTN_TOUCH) }, | 458 | .keybit = { [LONG(BTN_TOUCH)] = BIT(BTN_TOUCH) }, |
453 | .absbit = { BIT(ABS_X) | BIT(ABS_Y) }, | 459 | .absbit = { BIT(ABS_X) | BIT(ABS_Y) }, |
454 | },/* A tablet like device, at least touch detection, two absolute axes */ | 460 | }, /* A tablet like device, at least touch detection, two absolute axes */ |
455 | 461 | ||
456 | { | 462 | { |
457 | .flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_ABSBIT, | 463 | .flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_ABSBIT, |
458 | .evbit = { BIT(EV_ABS) }, | 464 | .evbit = { BIT(EV_ABS) }, |
459 | .absbit = { BIT(ABS_X) | BIT(ABS_Y) | BIT(ABS_PRESSURE) }, | 465 | .absbit = { BIT(ABS_X) | BIT(ABS_Y) | BIT(ABS_PRESSURE) }, |
460 | },/* A tablet like device with several gradations of pressure */ | 466 | }, /* A tablet like device with several gradations of pressure */ |
461 | 467 | ||
462 | {},/* Terminating entry */ | 468 | {} /* Terminating entry */ |
463 | }; | 469 | }; |
464 | 470 | ||
465 | MODULE_DEVICE_TABLE(input, tsdev_ids); | 471 | MODULE_DEVICE_TABLE(input, tsdev_ids); |