diff options
Diffstat (limited to 'drivers/input/tsdev.c')
| -rw-r--r-- | drivers/input/tsdev.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/drivers/input/tsdev.c b/drivers/input/tsdev.c index d678d144bbf..00e3929c628 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 |
| @@ -48,7 +48,6 @@ | |||
| 48 | #include <linux/init.h> | 48 | #include <linux/init.h> |
| 49 | #include <linux/input.h> | 49 | #include <linux/input.h> |
| 50 | #include <linux/major.h> | 50 | #include <linux/major.h> |
| 51 | #include <linux/config.h> | ||
| 52 | #include <linux/smp_lock.h> | 51 | #include <linux/smp_lock.h> |
| 53 | #include <linux/random.h> | 52 | #include <linux/random.h> |
| 54 | #include <linux/time.h> | 53 | #include <linux/time.h> |
| @@ -230,6 +229,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) | 229 | static unsigned int tsdev_poll(struct file *file, poll_table * wait) |
| 231 | { | 230 | { |
| 232 | struct tsdev_list *list = file->private_data; | 231 | struct tsdev_list *list = file->private_data; |
| 232 | |||
| 233 | poll_wait(file, &list->tsdev->wait, wait); | 233 | poll_wait(file, &list->tsdev->wait, wait); |
| 234 | return ((list->head == list->tail) ? 0 : (POLLIN | POLLRDNORM)) | | 234 | return ((list->head == list->tail) ? 0 : (POLLIN | POLLRDNORM)) | |
| 235 | (list->tsdev->exist ? 0 : (POLLHUP | POLLERR)); | 235 | (list->tsdev->exist ? 0 : (POLLHUP | POLLERR)); |
| @@ -248,11 +248,13 @@ static int tsdev_ioctl(struct inode *inode, struct file *file, | |||
| 248 | sizeof (struct ts_calibration))) | 248 | sizeof (struct ts_calibration))) |
| 249 | retval = -EFAULT; | 249 | retval = -EFAULT; |
| 250 | break; | 250 | break; |
| 251 | |||
| 251 | case TS_SET_CAL: | 252 | case TS_SET_CAL: |
| 252 | if (copy_from_user (&tsdev->cal, (void __user *)arg, | 253 | if (copy_from_user (&tsdev->cal, (void __user *)arg, |
| 253 | sizeof (struct ts_calibration))) | 254 | sizeof (struct ts_calibration))) |
| 254 | retval = -EFAULT; | 255 | retval = -EFAULT; |
| 255 | break; | 256 | break; |
| 257 | |||
| 256 | default: | 258 | default: |
| 257 | retval = -EINVAL; | 259 | retval = -EINVAL; |
| 258 | break; | 260 | break; |
| @@ -284,9 +286,11 @@ static void tsdev_event(struct input_handle *handle, unsigned int type, | |||
| 284 | case ABS_X: | 286 | case ABS_X: |
| 285 | tsdev->x = value; | 287 | tsdev->x = value; |
| 286 | break; | 288 | break; |
| 289 | |||
| 287 | case ABS_Y: | 290 | case ABS_Y: |
| 288 | tsdev->y = value; | 291 | tsdev->y = value; |
| 289 | break; | 292 | break; |
| 293 | |||
| 290 | case ABS_PRESSURE: | 294 | case ABS_PRESSURE: |
| 291 | if (value > handle->dev->absmax[ABS_PRESSURE]) | 295 | if (value > handle->dev->absmax[ABS_PRESSURE]) |
| 292 | value = handle->dev->absmax[ABS_PRESSURE]; | 296 | value = handle->dev->absmax[ABS_PRESSURE]; |
| @@ -307,6 +311,7 @@ static void tsdev_event(struct input_handle *handle, unsigned int type, | |||
| 307 | else if (tsdev->x > xres) | 311 | else if (tsdev->x > xres) |
| 308 | tsdev->x = xres; | 312 | tsdev->x = xres; |
| 309 | break; | 313 | break; |
| 314 | |||
| 310 | case REL_Y: | 315 | case REL_Y: |
| 311 | tsdev->y += value; | 316 | tsdev->y += value; |
| 312 | if (tsdev->y < 0) | 317 | if (tsdev->y < 0) |
| @@ -323,6 +328,7 @@ static void tsdev_event(struct input_handle *handle, unsigned int type, | |||
| 323 | case 0: | 328 | case 0: |
| 324 | tsdev->pressure = 0; | 329 | tsdev->pressure = 0; |
| 325 | break; | 330 | break; |
| 331 | |||
| 326 | case 1: | 332 | case 1: |
| 327 | if (!tsdev->pressure) | 333 | if (!tsdev->pressure) |
| 328 | tsdev->pressure = 1; | 334 | tsdev->pressure = 1; |
| @@ -370,9 +376,8 @@ static struct input_handle *tsdev_connect(struct input_handler *handler, | |||
| 370 | struct class_device *cdev; | 376 | struct class_device *cdev; |
| 371 | int minor, delta; | 377 | int minor, delta; |
| 372 | 378 | ||
| 373 | for (minor = 0; minor < TSDEV_MINORS/2 && tsdev_table[minor]; | 379 | for (minor = 0; minor < TSDEV_MINORS / 2 && tsdev_table[minor]; minor++); |
| 374 | minor++); | 380 | if (minor >= TSDEV_MINORS / 2) { |
| 375 | if (minor >= TSDEV_MINORS/2) { | ||
| 376 | printk(KERN_ERR | 381 | printk(KERN_ERR |
| 377 | "tsdev: You have way too many touchscreens\n"); | 382 | "tsdev: You have way too many touchscreens\n"); |
| 378 | return NULL; | 383 | return NULL; |
| @@ -444,22 +449,22 @@ static struct input_device_id tsdev_ids[] = { | |||
| 444 | .evbit = { BIT(EV_KEY) | BIT(EV_REL) }, | 449 | .evbit = { BIT(EV_KEY) | BIT(EV_REL) }, |
| 445 | .keybit = { [LONG(BTN_LEFT)] = BIT(BTN_LEFT) }, | 450 | .keybit = { [LONG(BTN_LEFT)] = BIT(BTN_LEFT) }, |
| 446 | .relbit = { BIT(REL_X) | BIT(REL_Y) }, | 451 | .relbit = { BIT(REL_X) | BIT(REL_Y) }, |
| 447 | },/* A mouse like device, at least one button, two relative axes */ | 452 | }, /* A mouse like device, at least one button, two relative axes */ |
| 448 | 453 | ||
| 449 | { | 454 | { |
| 450 | .flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_KEYBIT | INPUT_DEVICE_ID_MATCH_ABSBIT, | 455 | .flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_KEYBIT | INPUT_DEVICE_ID_MATCH_ABSBIT, |
| 451 | .evbit = { BIT(EV_KEY) | BIT(EV_ABS) }, | 456 | .evbit = { BIT(EV_KEY) | BIT(EV_ABS) }, |
| 452 | .keybit = { [LONG(BTN_TOUCH)] = BIT(BTN_TOUCH) }, | 457 | .keybit = { [LONG(BTN_TOUCH)] = BIT(BTN_TOUCH) }, |
| 453 | .absbit = { BIT(ABS_X) | BIT(ABS_Y) }, | 458 | .absbit = { BIT(ABS_X) | BIT(ABS_Y) }, |
| 454 | },/* A tablet like device, at least touch detection, two absolute axes */ | 459 | }, /* A tablet like device, at least touch detection, two absolute axes */ |
| 455 | 460 | ||
| 456 | { | 461 | { |
| 457 | .flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_ABSBIT, | 462 | .flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_ABSBIT, |
| 458 | .evbit = { BIT(EV_ABS) }, | 463 | .evbit = { BIT(EV_ABS) }, |
| 459 | .absbit = { BIT(ABS_X) | BIT(ABS_Y) | BIT(ABS_PRESSURE) }, | 464 | .absbit = { BIT(ABS_X) | BIT(ABS_Y) | BIT(ABS_PRESSURE) }, |
| 460 | },/* A tablet like device with several gradations of pressure */ | 465 | }, /* A tablet like device with several gradations of pressure */ |
| 461 | 466 | ||
| 462 | {},/* Terminating entry */ | 467 | {} /* Terminating entry */ |
| 463 | }; | 468 | }; |
| 464 | 469 | ||
| 465 | MODULE_DEVICE_TABLE(input, tsdev_ids); | 470 | MODULE_DEVICE_TABLE(input, tsdev_ids); |
