Loading drivers/input/evdev.c +8 −2 Original line number Diff line number Diff line Loading @@ -78,14 +78,19 @@ static int evdev_fasync(int fd, struct file *file, int on) { int retval; struct evdev_list *list = file->private_data; retval = fasync_helper(fd, file, on, &list->fasync); return retval < 0 ? retval : 0; } static int evdev_flush(struct file *file, fl_owner_t id) { struct evdev_list *list = file->private_data; if (!list->evdev->exist) return -ENODEV; if (!list->evdev->exist) return -ENODEV; return input_flush_device(&list->evdev->handle, file); } Loading Loading @@ -300,6 +305,7 @@ static ssize_t evdev_read(struct file * file, char __user * buffer, size_t count static unsigned int evdev_poll(struct file *file, poll_table *wait) { struct evdev_list *list = file->private_data; poll_wait(file, &list->evdev->wait, wait); return ((list->head == list->tail) ? 0 : (POLLIN | POLLRDNORM)) | (list->evdev->exist ? 0 : (POLLHUP | POLLERR)); Loading drivers/input/input.c +25 −12 Original line number Diff line number Diff line Loading @@ -64,11 +64,13 @@ void input_event(struct input_dev *dev, unsigned int type, unsigned int code, in case EV_SYN: switch (code) { case SYN_CONFIG: if (dev->event) dev->event(dev, type, code, value); if (dev->event) dev->event(dev, type, code, value); break; case SYN_REPORT: if (dev->sync) return; if (dev->sync) return; dev->sync = 1; break; } Loading Loading @@ -137,7 +139,8 @@ void input_event(struct input_dev *dev, unsigned int type, unsigned int code, in if (code > MSC_MAX || !test_bit(code, dev->mscbit)) return; if (dev->event) dev->event(dev, type, code, value); if (dev->event) dev->event(dev, type, code, value); break; Loading @@ -147,7 +150,9 @@ void input_event(struct input_dev *dev, unsigned int type, unsigned int code, in return; change_bit(code, dev->led); if (dev->event) dev->event(dev, type, code, value); if (dev->event) dev->event(dev, type, code, value); break; Loading @@ -159,21 +164,25 @@ void input_event(struct input_dev *dev, unsigned int type, unsigned int code, in if (!!test_bit(code, dev->snd) != !!value) change_bit(code, dev->snd); if (dev->event) dev->event(dev, type, code, value); if (dev->event) dev->event(dev, type, code, value); break; case EV_REP: if (code > REP_MAX || value < 0 || dev->rep[code] == value) return; if (code > REP_MAX || value < 0 || dev->rep[code] == value) return; dev->rep[code] = value; if (dev->event) dev->event(dev, type, code, value); if (dev->event) dev->event(dev, type, code, value); break; case EV_FF: if (dev->event) dev->event(dev, type, code, value); if (dev->event) dev->event(dev, type, code, value); break; } Loading Loading @@ -336,9 +345,11 @@ static inline void input_wakeup_procfs_readers(void) static unsigned int input_proc_devices_poll(struct file *file, poll_table *wait) { int state = input_devices_state; poll_wait(file, &input_devices_poll_wait, wait); if (state != input_devices_state) return POLLIN | POLLRDNORM; return 0; } Loading Loading @@ -974,7 +985,8 @@ void input_unregister_device(struct input_dev *dev) { struct list_head *node, *next; if (!dev) return; if (!dev) return; del_timer_sync(&dev->timer); Loading Loading @@ -1005,7 +1017,8 @@ void input_register_handler(struct input_handler *handler) struct input_handle *handle; struct input_device_id *id; if (!handler) return; if (!handler) return; INIT_LIST_HEAD(&handler->h_list); Loading drivers/input/joydev.c +45 −24 Original line number Diff line number Diff line Loading @@ -81,10 +81,7 @@ static int joydev_correct(int value, struct js_corr *corr) return 0; } if (value < -32767) return -32767; if (value > 32767) return 32767; return value; return value < -32767 ? -32767 : (value > 32767 ? 32767 : value); } static void joydev_event(struct input_handle *handle, unsigned int type, unsigned int code, int value) Loading @@ -96,7 +93,8 @@ static void joydev_event(struct input_handle *handle, unsigned int type, unsigne switch (type) { case EV_KEY: if (code < BTN_MISC || value == 2) return; if (code < BTN_MISC || value == 2) return; event.type = JS_EVENT_BUTTON; event.number = joydev->keymap[code - BTN_MISC]; event.value = value; Loading @@ -106,7 +104,8 @@ static void joydev_event(struct input_handle *handle, unsigned int type, unsigne event.type = JS_EVENT_AXIS; event.number = joydev->absmap[code]; event.value = joydev_correct(value, joydev->corr + event.number); if (event.value == joydev->abs[event.number]) return; if (event.value == joydev->abs[event.number]) return; joydev->abs[event.number] = event.value; break; Loading Loading @@ -134,7 +133,9 @@ static int joydev_fasync(int fd, struct file *file, int on) { int retval; struct joydev_list *list = file->private_data; retval = fasync_helper(fd, file, on, &list->fasync); return retval < 0 ? retval : 0; } Loading Loading @@ -222,8 +223,8 @@ static ssize_t joydev_read(struct file *file, char __user *buf, size_t count, lo return sizeof(struct JS_DATA_TYPE); } if (list->startup == joydev->nabs + joydev->nkey && list->head == list->tail && (file->f_flags & O_NONBLOCK)) if (list->startup == joydev->nabs + joydev->nkey && list->head == list->tail && (file->f_flags & O_NONBLOCK)) return -EAGAIN; retval = wait_event_interruptible(list->joydev->wait, Loading Loading @@ -276,6 +277,7 @@ static ssize_t joydev_read(struct file *file, char __user *buf, size_t count, lo static unsigned int joydev_poll(struct file *file, poll_table *wait) { struct joydev_list *list = file->private_data; poll_wait(file, &list->joydev->wait, wait); return ((list->head != list->tail || list->startup < list->joydev->nabs + list->joydev->nkey) ? (POLLIN | POLLRDNORM) : 0) | (list->joydev->exist ? 0 : (POLLHUP | POLLERR)); Loading @@ -291,20 +293,26 @@ static int joydev_ioctl_common(struct joydev *joydev, unsigned int cmd, void __u case JS_SET_CAL: return copy_from_user(&joydev->glue.JS_CORR, argp, sizeof(joydev->glue.JS_CORR)) ? -EFAULT : 0; case JS_GET_CAL: return copy_to_user(argp, &joydev->glue.JS_CORR, sizeof(joydev->glue.JS_CORR)) ? -EFAULT : 0; case JS_SET_TIMEOUT: return get_user(joydev->glue.JS_TIMEOUT, (s32 __user *) argp); case JS_GET_TIMEOUT: return put_user(joydev->glue.JS_TIMEOUT, (s32 __user *) argp); case JSIOCGVERSION: return put_user(JS_VERSION, (__u32 __user *) argp); case JSIOCGAXES: return put_user(joydev->nabs, (__u8 __user *) argp); case JSIOCGBUTTONS: return put_user(joydev->nkey, (__u8 __user *) argp); case JSIOCSCORR: if (copy_from_user(joydev->corr, argp, sizeof(joydev->corr[0]) * joydev->nabs)) Loading @@ -314,38 +322,49 @@ static int joydev_ioctl_common(struct joydev *joydev, unsigned int cmd, void __u joydev->abs[i] = joydev_correct(dev->abs[j], joydev->corr + i); } return 0; case JSIOCGCORR: return copy_to_user(argp, joydev->corr, sizeof(joydev->corr[0]) * joydev->nabs) ? -EFAULT : 0; case JSIOCSAXMAP: if (copy_from_user(joydev->abspam, argp, sizeof(__u8) * (ABS_MAX + 1))) return -EFAULT; for (i = 0; i < joydev->nabs; i++) { if (joydev->abspam[i] > ABS_MAX) return -EINVAL; if (joydev->abspam[i] > ABS_MAX) return -EINVAL; joydev->absmap[joydev->abspam[i]] = i; } return 0; case JSIOCGAXMAP: return copy_to_user(argp, joydev->abspam, sizeof(__u8) * (ABS_MAX + 1)) ? -EFAULT : 0; case JSIOCSBTNMAP: if (copy_from_user(joydev->keypam, argp, sizeof(__u16) * (KEY_MAX - BTN_MISC + 1))) return -EFAULT; for (i = 0; i < joydev->nkey; i++) { if (joydev->keypam[i] > KEY_MAX || joydev->keypam[i] < BTN_MISC) return -EINVAL; if (joydev->keypam[i] > KEY_MAX || joydev->keypam[i] < BTN_MISC) return -EINVAL; joydev->keymap[joydev->keypam[i] - BTN_MISC] = i; } return 0; case JSIOCGBTNMAP: return copy_to_user(argp, joydev->keypam, sizeof(__u16) * (KEY_MAX - BTN_MISC + 1)) ? -EFAULT : 0; default: if ((cmd & ~(_IOC_SIZEMASK << _IOC_SIZESHIFT)) == JSIOCGNAME(0)) { int len; if (!dev->name) return 0; if (!dev->name) return 0; len = strlen(dev->name) + 1; if (len > _IOC_SIZE(cmd)) len = _IOC_SIZE(cmd); if (copy_to_user(argp, dev->name, len)) return -EFAULT; if (len > _IOC_SIZE(cmd)) len = _IOC_SIZE(cmd); if (copy_to_user(argp, dev->name, len)) return -EFAULT; return len; } } Loading @@ -362,7 +381,9 @@ static long joydev_compat_ioctl(struct file *file, unsigned int cmd, unsigned lo struct JS_DATA_SAVE_TYPE_32 ds32; int err; if (!joydev->exist) return -ENODEV; if (!joydev->exist) return -ENODEV; switch(cmd) { case JS_SET_TIMELIMIT: err = get_user(tmp32, (s32 __user *) arg); Loading Loading @@ -395,8 +416,7 @@ static long joydev_compat_ioctl(struct file *file, unsigned int cmd, unsigned lo ds32.JS_SAVE = joydev->glue.JS_SAVE; ds32.JS_CORR = joydev->glue.JS_CORR; err = copy_to_user(argp, &ds32, sizeof(ds32)) ? -EFAULT : 0; err = copy_to_user(argp, &ds32, sizeof(ds32)) ? -EFAULT : 0; break; default: Loading @@ -412,7 +432,8 @@ static int joydev_ioctl(struct inode *inode, struct file *file, unsigned int cmd struct joydev *joydev = list->joydev; void __user *argp = (void __user *)arg; if (!joydev->exist) return -ENODEV; if (!joydev->exist) return -ENODEV; switch(cmd) { case JS_SET_TIMELIMIT: Loading Loading @@ -547,7 +568,7 @@ static struct input_device_id joydev_blacklist[] = { .evbit = { BIT(EV_KEY) }, .keybit = { [LONG(BTN_TOUCH)] = BIT(BTN_TOUCH) }, }, /* Avoid itouchpads, touchscreens and tablets */ { }, /* Terminating entry */ { } /* Terminating entry */ }; static struct input_device_id joydev_ids[] = { Loading @@ -566,7 +587,7 @@ static struct input_device_id joydev_ids[] = { .evbit = { BIT(EV_ABS) }, .absbit = { BIT(ABS_THROTTLE) }, }, { }, /* Terminating entry */ { } /* Terminating entry */ }; MODULE_DEVICE_TABLE(input, joydev_ids); Loading drivers/input/mousedev.c +27 −15 Original line number Diff line number Diff line Loading @@ -123,7 +123,9 @@ static void mousedev_touchpad_event(struct input_dev *dev, struct mousedev *mous if (mousedev->touch) { size = dev->absmax[ABS_X] - dev->absmin[ABS_X]; if (size == 0) size = 256 * 2; if (size == 0) size = 256 * 2; switch (code) { case ABS_X: fx(0) = value; Loading Loading @@ -155,18 +157,24 @@ static void mousedev_abs_event(struct input_dev *dev, struct mousedev *mousedev, switch (code) { case ABS_X: size = dev->absmax[ABS_X] - dev->absmin[ABS_X]; if (size == 0) size = xres ? : 1; if (value > dev->absmax[ABS_X]) value = dev->absmax[ABS_X]; if (value < dev->absmin[ABS_X]) value = dev->absmin[ABS_X]; if (size == 0) size = xres ? : 1; if (value > dev->absmax[ABS_X]) value = dev->absmax[ABS_X]; if (value < dev->absmin[ABS_X]) value = dev->absmin[ABS_X]; mousedev->packet.x = ((value - dev->absmin[ABS_X]) * xres) / size; mousedev->packet.abs_event = 1; break; case ABS_Y: size = dev->absmax[ABS_Y] - dev->absmin[ABS_Y]; if (size == 0) size = yres ? : 1; if (value > dev->absmax[ABS_Y]) value = dev->absmax[ABS_Y]; if (value < dev->absmin[ABS_Y]) value = dev->absmin[ABS_Y]; if (size == 0) size = yres ? : 1; if (value > dev->absmax[ABS_Y]) value = dev->absmax[ABS_Y]; if (value < dev->absmin[ABS_Y]) value = dev->absmin[ABS_Y]; mousedev->packet.y = yres - ((value - dev->absmin[ABS_Y]) * yres) / size; mousedev->packet.abs_event = 1; break; Loading Loading @@ -285,9 +293,8 @@ static void mousedev_touchpad_touch(struct mousedev *mousedev, int value) mousedev->touch = mousedev->pkt_count = 0; mousedev->frac_dx = 0; mousedev->frac_dy = 0; } else if (!mousedev->touch) } else if (!mousedev->touch) mousedev->touch = jiffies; } Loading Loading @@ -346,7 +353,9 @@ static int mousedev_fasync(int fd, struct file *file, int on) { int retval; struct mousedev_list *list = file->private_data; retval = fasync_helper(fd, file, on, &list->fasync); return retval < 0 ? retval : 0; } Loading Loading @@ -507,14 +516,16 @@ static ssize_t mousedev_write(struct file * file, const char __user * buffer, si list->imexseq = 0; list->mode = MOUSEDEV_EMUL_EXPS; } } else list->imexseq = 0; } else list->imexseq = 0; if (c == mousedev_imps_seq[list->impsseq]) { if (++list->impsseq == MOUSEDEV_SEQ_LEN) { list->impsseq = 0; list->mode = MOUSEDEV_EMUL_IMPS; } } else list->impsseq = 0; } else list->impsseq = 0; list->ps2[0] = 0xfa; Loading Loading @@ -598,6 +609,7 @@ static ssize_t mousedev_read(struct file * file, char __user * buffer, size_t co static unsigned int mousedev_poll(struct file *file, poll_table *wait) { struct mousedev_list *list = file->private_data; poll_wait(file, &list->mousedev->wait, wait); return ((list->ready || list->buffer) ? (POLLIN | POLLRDNORM) : 0) | (list->mousedev->exist ? 0 : (POLLHUP | POLLERR)); Loading drivers/input/tsdev.c +14 −8 Original line number Diff line number Diff line Loading @@ -230,6 +230,7 @@ static ssize_t tsdev_read(struct file *file, char __user *buffer, size_t count, static unsigned int tsdev_poll(struct file *file, poll_table * wait) { struct tsdev_list *list = file->private_data; poll_wait(file, &list->tsdev->wait, wait); return ((list->head == list->tail) ? 0 : (POLLIN | POLLRDNORM)) | (list->tsdev->exist ? 0 : (POLLHUP | POLLERR)); Loading @@ -248,11 +249,13 @@ static int tsdev_ioctl(struct inode *inode, struct file *file, sizeof (struct ts_calibration))) retval = -EFAULT; break; case TS_SET_CAL: if (copy_from_user (&tsdev->cal, (void __user *)arg, sizeof (struct ts_calibration))) retval = -EFAULT; break; default: retval = -EINVAL; break; Loading Loading @@ -284,9 +287,11 @@ static void tsdev_event(struct input_handle *handle, unsigned int type, case ABS_X: tsdev->x = value; break; case ABS_Y: tsdev->y = value; break; case ABS_PRESSURE: if (value > handle->dev->absmax[ABS_PRESSURE]) value = handle->dev->absmax[ABS_PRESSURE]; Loading @@ -307,6 +312,7 @@ static void tsdev_event(struct input_handle *handle, unsigned int type, else if (tsdev->x > xres) tsdev->x = xres; break; case REL_Y: tsdev->y += value; if (tsdev->y < 0) Loading @@ -323,6 +329,7 @@ static void tsdev_event(struct input_handle *handle, unsigned int type, case 0: tsdev->pressure = 0; break; case 1: if (!tsdev->pressure) tsdev->pressure = 1; Loading Loading @@ -370,8 +377,7 @@ static struct input_handle *tsdev_connect(struct input_handler *handler, struct class_device *cdev; int minor, delta; for (minor = 0; minor < TSDEV_MINORS/2 && tsdev_table[minor]; minor++); for (minor = 0; minor < TSDEV_MINORS / 2 && tsdev_table[minor]; minor++); if (minor >= TSDEV_MINORS / 2) { printk(KERN_ERR "tsdev: You have way too many touchscreens\n"); Loading Loading @@ -459,7 +465,7 @@ static struct input_device_id tsdev_ids[] = { .absbit = { BIT(ABS_X) | BIT(ABS_Y) | BIT(ABS_PRESSURE) }, }, /* A tablet like device with several gradations of pressure */ {},/* Terminating entry */ {} /* Terminating entry */ }; MODULE_DEVICE_TABLE(input, tsdev_ids); Loading Loading
drivers/input/evdev.c +8 −2 Original line number Diff line number Diff line Loading @@ -78,14 +78,19 @@ static int evdev_fasync(int fd, struct file *file, int on) { int retval; struct evdev_list *list = file->private_data; retval = fasync_helper(fd, file, on, &list->fasync); return retval < 0 ? retval : 0; } static int evdev_flush(struct file *file, fl_owner_t id) { struct evdev_list *list = file->private_data; if (!list->evdev->exist) return -ENODEV; if (!list->evdev->exist) return -ENODEV; return input_flush_device(&list->evdev->handle, file); } Loading Loading @@ -300,6 +305,7 @@ static ssize_t evdev_read(struct file * file, char __user * buffer, size_t count static unsigned int evdev_poll(struct file *file, poll_table *wait) { struct evdev_list *list = file->private_data; poll_wait(file, &list->evdev->wait, wait); return ((list->head == list->tail) ? 0 : (POLLIN | POLLRDNORM)) | (list->evdev->exist ? 0 : (POLLHUP | POLLERR)); Loading
drivers/input/input.c +25 −12 Original line number Diff line number Diff line Loading @@ -64,11 +64,13 @@ void input_event(struct input_dev *dev, unsigned int type, unsigned int code, in case EV_SYN: switch (code) { case SYN_CONFIG: if (dev->event) dev->event(dev, type, code, value); if (dev->event) dev->event(dev, type, code, value); break; case SYN_REPORT: if (dev->sync) return; if (dev->sync) return; dev->sync = 1; break; } Loading Loading @@ -137,7 +139,8 @@ void input_event(struct input_dev *dev, unsigned int type, unsigned int code, in if (code > MSC_MAX || !test_bit(code, dev->mscbit)) return; if (dev->event) dev->event(dev, type, code, value); if (dev->event) dev->event(dev, type, code, value); break; Loading @@ -147,7 +150,9 @@ void input_event(struct input_dev *dev, unsigned int type, unsigned int code, in return; change_bit(code, dev->led); if (dev->event) dev->event(dev, type, code, value); if (dev->event) dev->event(dev, type, code, value); break; Loading @@ -159,21 +164,25 @@ void input_event(struct input_dev *dev, unsigned int type, unsigned int code, in if (!!test_bit(code, dev->snd) != !!value) change_bit(code, dev->snd); if (dev->event) dev->event(dev, type, code, value); if (dev->event) dev->event(dev, type, code, value); break; case EV_REP: if (code > REP_MAX || value < 0 || dev->rep[code] == value) return; if (code > REP_MAX || value < 0 || dev->rep[code] == value) return; dev->rep[code] = value; if (dev->event) dev->event(dev, type, code, value); if (dev->event) dev->event(dev, type, code, value); break; case EV_FF: if (dev->event) dev->event(dev, type, code, value); if (dev->event) dev->event(dev, type, code, value); break; } Loading Loading @@ -336,9 +345,11 @@ static inline void input_wakeup_procfs_readers(void) static unsigned int input_proc_devices_poll(struct file *file, poll_table *wait) { int state = input_devices_state; poll_wait(file, &input_devices_poll_wait, wait); if (state != input_devices_state) return POLLIN | POLLRDNORM; return 0; } Loading Loading @@ -974,7 +985,8 @@ void input_unregister_device(struct input_dev *dev) { struct list_head *node, *next; if (!dev) return; if (!dev) return; del_timer_sync(&dev->timer); Loading Loading @@ -1005,7 +1017,8 @@ void input_register_handler(struct input_handler *handler) struct input_handle *handle; struct input_device_id *id; if (!handler) return; if (!handler) return; INIT_LIST_HEAD(&handler->h_list); Loading
drivers/input/joydev.c +45 −24 Original line number Diff line number Diff line Loading @@ -81,10 +81,7 @@ static int joydev_correct(int value, struct js_corr *corr) return 0; } if (value < -32767) return -32767; if (value > 32767) return 32767; return value; return value < -32767 ? -32767 : (value > 32767 ? 32767 : value); } static void joydev_event(struct input_handle *handle, unsigned int type, unsigned int code, int value) Loading @@ -96,7 +93,8 @@ static void joydev_event(struct input_handle *handle, unsigned int type, unsigne switch (type) { case EV_KEY: if (code < BTN_MISC || value == 2) return; if (code < BTN_MISC || value == 2) return; event.type = JS_EVENT_BUTTON; event.number = joydev->keymap[code - BTN_MISC]; event.value = value; Loading @@ -106,7 +104,8 @@ static void joydev_event(struct input_handle *handle, unsigned int type, unsigne event.type = JS_EVENT_AXIS; event.number = joydev->absmap[code]; event.value = joydev_correct(value, joydev->corr + event.number); if (event.value == joydev->abs[event.number]) return; if (event.value == joydev->abs[event.number]) return; joydev->abs[event.number] = event.value; break; Loading Loading @@ -134,7 +133,9 @@ static int joydev_fasync(int fd, struct file *file, int on) { int retval; struct joydev_list *list = file->private_data; retval = fasync_helper(fd, file, on, &list->fasync); return retval < 0 ? retval : 0; } Loading Loading @@ -222,8 +223,8 @@ static ssize_t joydev_read(struct file *file, char __user *buf, size_t count, lo return sizeof(struct JS_DATA_TYPE); } if (list->startup == joydev->nabs + joydev->nkey && list->head == list->tail && (file->f_flags & O_NONBLOCK)) if (list->startup == joydev->nabs + joydev->nkey && list->head == list->tail && (file->f_flags & O_NONBLOCK)) return -EAGAIN; retval = wait_event_interruptible(list->joydev->wait, Loading Loading @@ -276,6 +277,7 @@ static ssize_t joydev_read(struct file *file, char __user *buf, size_t count, lo static unsigned int joydev_poll(struct file *file, poll_table *wait) { struct joydev_list *list = file->private_data; poll_wait(file, &list->joydev->wait, wait); return ((list->head != list->tail || list->startup < list->joydev->nabs + list->joydev->nkey) ? (POLLIN | POLLRDNORM) : 0) | (list->joydev->exist ? 0 : (POLLHUP | POLLERR)); Loading @@ -291,20 +293,26 @@ static int joydev_ioctl_common(struct joydev *joydev, unsigned int cmd, void __u case JS_SET_CAL: return copy_from_user(&joydev->glue.JS_CORR, argp, sizeof(joydev->glue.JS_CORR)) ? -EFAULT : 0; case JS_GET_CAL: return copy_to_user(argp, &joydev->glue.JS_CORR, sizeof(joydev->glue.JS_CORR)) ? -EFAULT : 0; case JS_SET_TIMEOUT: return get_user(joydev->glue.JS_TIMEOUT, (s32 __user *) argp); case JS_GET_TIMEOUT: return put_user(joydev->glue.JS_TIMEOUT, (s32 __user *) argp); case JSIOCGVERSION: return put_user(JS_VERSION, (__u32 __user *) argp); case JSIOCGAXES: return put_user(joydev->nabs, (__u8 __user *) argp); case JSIOCGBUTTONS: return put_user(joydev->nkey, (__u8 __user *) argp); case JSIOCSCORR: if (copy_from_user(joydev->corr, argp, sizeof(joydev->corr[0]) * joydev->nabs)) Loading @@ -314,38 +322,49 @@ static int joydev_ioctl_common(struct joydev *joydev, unsigned int cmd, void __u joydev->abs[i] = joydev_correct(dev->abs[j], joydev->corr + i); } return 0; case JSIOCGCORR: return copy_to_user(argp, joydev->corr, sizeof(joydev->corr[0]) * joydev->nabs) ? -EFAULT : 0; case JSIOCSAXMAP: if (copy_from_user(joydev->abspam, argp, sizeof(__u8) * (ABS_MAX + 1))) return -EFAULT; for (i = 0; i < joydev->nabs; i++) { if (joydev->abspam[i] > ABS_MAX) return -EINVAL; if (joydev->abspam[i] > ABS_MAX) return -EINVAL; joydev->absmap[joydev->abspam[i]] = i; } return 0; case JSIOCGAXMAP: return copy_to_user(argp, joydev->abspam, sizeof(__u8) * (ABS_MAX + 1)) ? -EFAULT : 0; case JSIOCSBTNMAP: if (copy_from_user(joydev->keypam, argp, sizeof(__u16) * (KEY_MAX - BTN_MISC + 1))) return -EFAULT; for (i = 0; i < joydev->nkey; i++) { if (joydev->keypam[i] > KEY_MAX || joydev->keypam[i] < BTN_MISC) return -EINVAL; if (joydev->keypam[i] > KEY_MAX || joydev->keypam[i] < BTN_MISC) return -EINVAL; joydev->keymap[joydev->keypam[i] - BTN_MISC] = i; } return 0; case JSIOCGBTNMAP: return copy_to_user(argp, joydev->keypam, sizeof(__u16) * (KEY_MAX - BTN_MISC + 1)) ? -EFAULT : 0; default: if ((cmd & ~(_IOC_SIZEMASK << _IOC_SIZESHIFT)) == JSIOCGNAME(0)) { int len; if (!dev->name) return 0; if (!dev->name) return 0; len = strlen(dev->name) + 1; if (len > _IOC_SIZE(cmd)) len = _IOC_SIZE(cmd); if (copy_to_user(argp, dev->name, len)) return -EFAULT; if (len > _IOC_SIZE(cmd)) len = _IOC_SIZE(cmd); if (copy_to_user(argp, dev->name, len)) return -EFAULT; return len; } } Loading @@ -362,7 +381,9 @@ static long joydev_compat_ioctl(struct file *file, unsigned int cmd, unsigned lo struct JS_DATA_SAVE_TYPE_32 ds32; int err; if (!joydev->exist) return -ENODEV; if (!joydev->exist) return -ENODEV; switch(cmd) { case JS_SET_TIMELIMIT: err = get_user(tmp32, (s32 __user *) arg); Loading Loading @@ -395,8 +416,7 @@ static long joydev_compat_ioctl(struct file *file, unsigned int cmd, unsigned lo ds32.JS_SAVE = joydev->glue.JS_SAVE; ds32.JS_CORR = joydev->glue.JS_CORR; err = copy_to_user(argp, &ds32, sizeof(ds32)) ? -EFAULT : 0; err = copy_to_user(argp, &ds32, sizeof(ds32)) ? -EFAULT : 0; break; default: Loading @@ -412,7 +432,8 @@ static int joydev_ioctl(struct inode *inode, struct file *file, unsigned int cmd struct joydev *joydev = list->joydev; void __user *argp = (void __user *)arg; if (!joydev->exist) return -ENODEV; if (!joydev->exist) return -ENODEV; switch(cmd) { case JS_SET_TIMELIMIT: Loading Loading @@ -547,7 +568,7 @@ static struct input_device_id joydev_blacklist[] = { .evbit = { BIT(EV_KEY) }, .keybit = { [LONG(BTN_TOUCH)] = BIT(BTN_TOUCH) }, }, /* Avoid itouchpads, touchscreens and tablets */ { }, /* Terminating entry */ { } /* Terminating entry */ }; static struct input_device_id joydev_ids[] = { Loading @@ -566,7 +587,7 @@ static struct input_device_id joydev_ids[] = { .evbit = { BIT(EV_ABS) }, .absbit = { BIT(ABS_THROTTLE) }, }, { }, /* Terminating entry */ { } /* Terminating entry */ }; MODULE_DEVICE_TABLE(input, joydev_ids); Loading
drivers/input/mousedev.c +27 −15 Original line number Diff line number Diff line Loading @@ -123,7 +123,9 @@ static void mousedev_touchpad_event(struct input_dev *dev, struct mousedev *mous if (mousedev->touch) { size = dev->absmax[ABS_X] - dev->absmin[ABS_X]; if (size == 0) size = 256 * 2; if (size == 0) size = 256 * 2; switch (code) { case ABS_X: fx(0) = value; Loading Loading @@ -155,18 +157,24 @@ static void mousedev_abs_event(struct input_dev *dev, struct mousedev *mousedev, switch (code) { case ABS_X: size = dev->absmax[ABS_X] - dev->absmin[ABS_X]; if (size == 0) size = xres ? : 1; if (value > dev->absmax[ABS_X]) value = dev->absmax[ABS_X]; if (value < dev->absmin[ABS_X]) value = dev->absmin[ABS_X]; if (size == 0) size = xres ? : 1; if (value > dev->absmax[ABS_X]) value = dev->absmax[ABS_X]; if (value < dev->absmin[ABS_X]) value = dev->absmin[ABS_X]; mousedev->packet.x = ((value - dev->absmin[ABS_X]) * xres) / size; mousedev->packet.abs_event = 1; break; case ABS_Y: size = dev->absmax[ABS_Y] - dev->absmin[ABS_Y]; if (size == 0) size = yres ? : 1; if (value > dev->absmax[ABS_Y]) value = dev->absmax[ABS_Y]; if (value < dev->absmin[ABS_Y]) value = dev->absmin[ABS_Y]; if (size == 0) size = yres ? : 1; if (value > dev->absmax[ABS_Y]) value = dev->absmax[ABS_Y]; if (value < dev->absmin[ABS_Y]) value = dev->absmin[ABS_Y]; mousedev->packet.y = yres - ((value - dev->absmin[ABS_Y]) * yres) / size; mousedev->packet.abs_event = 1; break; Loading Loading @@ -285,9 +293,8 @@ static void mousedev_touchpad_touch(struct mousedev *mousedev, int value) mousedev->touch = mousedev->pkt_count = 0; mousedev->frac_dx = 0; mousedev->frac_dy = 0; } else if (!mousedev->touch) } else if (!mousedev->touch) mousedev->touch = jiffies; } Loading Loading @@ -346,7 +353,9 @@ static int mousedev_fasync(int fd, struct file *file, int on) { int retval; struct mousedev_list *list = file->private_data; retval = fasync_helper(fd, file, on, &list->fasync); return retval < 0 ? retval : 0; } Loading Loading @@ -507,14 +516,16 @@ static ssize_t mousedev_write(struct file * file, const char __user * buffer, si list->imexseq = 0; list->mode = MOUSEDEV_EMUL_EXPS; } } else list->imexseq = 0; } else list->imexseq = 0; if (c == mousedev_imps_seq[list->impsseq]) { if (++list->impsseq == MOUSEDEV_SEQ_LEN) { list->impsseq = 0; list->mode = MOUSEDEV_EMUL_IMPS; } } else list->impsseq = 0; } else list->impsseq = 0; list->ps2[0] = 0xfa; Loading Loading @@ -598,6 +609,7 @@ static ssize_t mousedev_read(struct file * file, char __user * buffer, size_t co static unsigned int mousedev_poll(struct file *file, poll_table *wait) { struct mousedev_list *list = file->private_data; poll_wait(file, &list->mousedev->wait, wait); return ((list->ready || list->buffer) ? (POLLIN | POLLRDNORM) : 0) | (list->mousedev->exist ? 0 : (POLLHUP | POLLERR)); Loading
drivers/input/tsdev.c +14 −8 Original line number Diff line number Diff line Loading @@ -230,6 +230,7 @@ static ssize_t tsdev_read(struct file *file, char __user *buffer, size_t count, static unsigned int tsdev_poll(struct file *file, poll_table * wait) { struct tsdev_list *list = file->private_data; poll_wait(file, &list->tsdev->wait, wait); return ((list->head == list->tail) ? 0 : (POLLIN | POLLRDNORM)) | (list->tsdev->exist ? 0 : (POLLHUP | POLLERR)); Loading @@ -248,11 +249,13 @@ static int tsdev_ioctl(struct inode *inode, struct file *file, sizeof (struct ts_calibration))) retval = -EFAULT; break; case TS_SET_CAL: if (copy_from_user (&tsdev->cal, (void __user *)arg, sizeof (struct ts_calibration))) retval = -EFAULT; break; default: retval = -EINVAL; break; Loading Loading @@ -284,9 +287,11 @@ static void tsdev_event(struct input_handle *handle, unsigned int type, case ABS_X: tsdev->x = value; break; case ABS_Y: tsdev->y = value; break; case ABS_PRESSURE: if (value > handle->dev->absmax[ABS_PRESSURE]) value = handle->dev->absmax[ABS_PRESSURE]; Loading @@ -307,6 +312,7 @@ static void tsdev_event(struct input_handle *handle, unsigned int type, else if (tsdev->x > xres) tsdev->x = xres; break; case REL_Y: tsdev->y += value; if (tsdev->y < 0) Loading @@ -323,6 +329,7 @@ static void tsdev_event(struct input_handle *handle, unsigned int type, case 0: tsdev->pressure = 0; break; case 1: if (!tsdev->pressure) tsdev->pressure = 1; Loading Loading @@ -370,8 +377,7 @@ static struct input_handle *tsdev_connect(struct input_handler *handler, struct class_device *cdev; int minor, delta; for (minor = 0; minor < TSDEV_MINORS/2 && tsdev_table[minor]; minor++); for (minor = 0; minor < TSDEV_MINORS / 2 && tsdev_table[minor]; minor++); if (minor >= TSDEV_MINORS / 2) { printk(KERN_ERR "tsdev: You have way too many touchscreens\n"); Loading Loading @@ -459,7 +465,7 @@ static struct input_device_id tsdev_ids[] = { .absbit = { BIT(ABS_X) | BIT(ABS_Y) | BIT(ABS_PRESSURE) }, }, /* A tablet like device with several gradations of pressure */ {},/* Terminating entry */ {} /* Terminating entry */ }; MODULE_DEVICE_TABLE(input, tsdev_ids); Loading