mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-22 22:51:37 +00:00
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: (75 commits) Input: wacom - specify Cinitq supported tools Input: ab8500-ponkey - fix IRQ freeing in error path Input: adp5588-keys - use more obvious i2c_device_id name string Input: ad7877 - switch to using threaded IRQ Input: ad7877 - use attribute group to control visibility of attributes Input: serio - add support for PS2Mult multiplexer protocol Input: wacom - properly enable runtime PM Input: ad7877 - filter events where pressure is beyond the maximum Input: ad7877 - implement EV_KEY:BTN_TOUCH reporting Input: ad7877 - implement specified chip select behavior Input: hp680_ts_input - use cancel_delayed_work_sync() Input: mousedev - correct lockdep annotation Input: ads7846 - switch to using threaded IRQ Input: serio - support multiple child devices per single parent Input: synaptics - simplify pass-through port handling Input: add ROHM BU21013 touch panel controller support Input: omap4-keypad - wake-up on events & long presses Input: omap4-keypad - fix interrupt line configuration Input: omap4-keypad - SYSCONFIG register configuration Input: omap4-keypad - use platform device helpers ...
This commit is contained in:
commit
3a99c63190
75 changed files with 5789 additions and 1853 deletions
|
@ -534,6 +534,80 @@ static int handle_eviocgbit(struct input_dev *dev,
|
|||
}
|
||||
#undef OLD_KEY_MAX
|
||||
|
||||
static int evdev_handle_get_keycode(struct input_dev *dev,
|
||||
void __user *p, size_t size)
|
||||
{
|
||||
struct input_keymap_entry ke;
|
||||
int error;
|
||||
|
||||
memset(&ke, 0, sizeof(ke));
|
||||
|
||||
if (size == sizeof(unsigned int[2])) {
|
||||
/* legacy case */
|
||||
int __user *ip = (int __user *)p;
|
||||
|
||||
if (copy_from_user(ke.scancode, p, sizeof(unsigned int)))
|
||||
return -EFAULT;
|
||||
|
||||
ke.len = sizeof(unsigned int);
|
||||
ke.flags = 0;
|
||||
|
||||
error = input_get_keycode(dev, &ke);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
if (put_user(ke.keycode, ip + 1))
|
||||
return -EFAULT;
|
||||
|
||||
} else {
|
||||
size = min(size, sizeof(ke));
|
||||
|
||||
if (copy_from_user(&ke, p, size))
|
||||
return -EFAULT;
|
||||
|
||||
error = input_get_keycode(dev, &ke);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
if (copy_to_user(p, &ke, size))
|
||||
return -EFAULT;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int evdev_handle_set_keycode(struct input_dev *dev,
|
||||
void __user *p, size_t size)
|
||||
{
|
||||
struct input_keymap_entry ke;
|
||||
|
||||
memset(&ke, 0, sizeof(ke));
|
||||
|
||||
if (size == sizeof(unsigned int[2])) {
|
||||
/* legacy case */
|
||||
int __user *ip = (int __user *)p;
|
||||
|
||||
if (copy_from_user(ke.scancode, p, sizeof(unsigned int)))
|
||||
return -EFAULT;
|
||||
|
||||
if (get_user(ke.keycode, ip + 1))
|
||||
return -EFAULT;
|
||||
|
||||
ke.len = sizeof(unsigned int);
|
||||
ke.flags = 0;
|
||||
|
||||
} else {
|
||||
size = min(size, sizeof(ke));
|
||||
|
||||
if (copy_from_user(&ke, p, size))
|
||||
return -EFAULT;
|
||||
|
||||
if (ke.len > sizeof(ke.scancode))
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return input_set_keycode(dev, &ke);
|
||||
}
|
||||
|
||||
static long evdev_do_ioctl(struct file *file, unsigned int cmd,
|
||||
void __user *p, int compat_mode)
|
||||
{
|
||||
|
@ -580,25 +654,6 @@ static long evdev_do_ioctl(struct file *file, unsigned int cmd,
|
|||
|
||||
return 0;
|
||||
|
||||
case EVIOCGKEYCODE:
|
||||
if (get_user(t, ip))
|
||||
return -EFAULT;
|
||||
|
||||
error = input_get_keycode(dev, t, &v);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
if (put_user(v, ip + 1))
|
||||
return -EFAULT;
|
||||
|
||||
return 0;
|
||||
|
||||
case EVIOCSKEYCODE:
|
||||
if (get_user(t, ip) || get_user(v, ip + 1))
|
||||
return -EFAULT;
|
||||
|
||||
return input_set_keycode(dev, t, v);
|
||||
|
||||
case EVIOCRMFF:
|
||||
return input_ff_erase(dev, (int)(unsigned long) p, file);
|
||||
|
||||
|
@ -620,7 +675,6 @@ static long evdev_do_ioctl(struct file *file, unsigned int cmd,
|
|||
|
||||
/* Now check variable-length commands */
|
||||
#define EVIOC_MASK_SIZE(nr) ((nr) & ~(_IOC_SIZEMASK << _IOC_SIZESHIFT))
|
||||
|
||||
switch (EVIOC_MASK_SIZE(cmd)) {
|
||||
|
||||
case EVIOCGKEY(0):
|
||||
|
@ -654,6 +708,12 @@ static long evdev_do_ioctl(struct file *file, unsigned int cmd,
|
|||
return -EFAULT;
|
||||
|
||||
return error;
|
||||
|
||||
case EVIOC_MASK_SIZE(EVIOCGKEYCODE):
|
||||
return evdev_handle_get_keycode(dev, p, size);
|
||||
|
||||
case EVIOC_MASK_SIZE(EVIOCSKEYCODE):
|
||||
return evdev_handle_set_keycode(dev, p, size);
|
||||
}
|
||||
|
||||
/* Multi-number variable-length handlers */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue