Commit 9fe41455 authored by Linus Torvalds's avatar Linus Torvalds

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:
  Input: define separate EVIOCGKEYCODE_V2/EVIOCSKEYCODE_V2
  Input: wacom - add another Bamboo Pen ID (0xd4)
parents b0c3844d ab4e0192
...@@ -534,76 +534,73 @@ static int handle_eviocgbit(struct input_dev *dev, ...@@ -534,76 +534,73 @@ static int handle_eviocgbit(struct input_dev *dev,
} }
#undef OLD_KEY_MAX #undef OLD_KEY_MAX
static int evdev_handle_get_keycode(struct input_dev *dev, static int evdev_handle_get_keycode(struct input_dev *dev, void __user *p)
void __user *p, size_t size)
{ {
struct input_keymap_entry ke; struct input_keymap_entry ke = {
.len = sizeof(unsigned int),
.flags = 0,
};
int __user *ip = (int __user *)p;
int error; int error;
memset(&ke, 0, sizeof(ke)); /* legacy case */
if (copy_from_user(ke.scancode, p, sizeof(unsigned int)))
if (size == sizeof(unsigned int[2])) { return -EFAULT;
/* legacy case */
int __user *ip = (int __user *)p;
if (copy_from_user(ke.scancode, p, sizeof(unsigned int))) error = input_get_keycode(dev, &ke);
return -EFAULT; if (error)
return error;
ke.len = sizeof(unsigned int); if (put_user(ke.keycode, ip + 1))
ke.flags = 0; return -EFAULT;
error = input_get_keycode(dev, &ke); return 0;
if (error) }
return error;
if (put_user(ke.keycode, ip + 1)) static int evdev_handle_get_keycode_v2(struct input_dev *dev, void __user *p)
return -EFAULT; {
struct input_keymap_entry ke;
int error;
} else { if (copy_from_user(&ke, p, sizeof(ke)))
size = min(size, sizeof(ke)); return -EFAULT;
if (copy_from_user(&ke, p, size)) error = input_get_keycode(dev, &ke);
return -EFAULT; if (error)
return error;
error = input_get_keycode(dev, &ke); if (copy_to_user(p, &ke, sizeof(ke)))
if (error) return -EFAULT;
return error;
if (copy_to_user(p, &ke, size))
return -EFAULT;
}
return 0; return 0;
} }
static int evdev_handle_set_keycode(struct input_dev *dev, static int evdev_handle_set_keycode(struct input_dev *dev, void __user *p)
void __user *p, size_t size)
{ {
struct input_keymap_entry ke; struct input_keymap_entry ke = {
.len = sizeof(unsigned int),
memset(&ke, 0, sizeof(ke)); .flags = 0,
};
int __user *ip = (int __user *)p;
if (size == sizeof(unsigned int[2])) { if (copy_from_user(ke.scancode, p, sizeof(unsigned int)))
/* legacy case */ return -EFAULT;
int __user *ip = (int __user *)p;
if (copy_from_user(ke.scancode, p, sizeof(unsigned int))) if (get_user(ke.keycode, ip + 1))
return -EFAULT; return -EFAULT;
if (get_user(ke.keycode, ip + 1)) return input_set_keycode(dev, &ke);
return -EFAULT; }
ke.len = sizeof(unsigned int); static int evdev_handle_set_keycode_v2(struct input_dev *dev, void __user *p)
ke.flags = 0; {
struct input_keymap_entry ke;
} else { if (copy_from_user(&ke, p, sizeof(ke)))
size = min(size, sizeof(ke)); return -EFAULT;
if (copy_from_user(&ke, p, size)) if (ke.len > sizeof(ke.scancode))
return -EFAULT; return -EINVAL;
if (ke.len > sizeof(ke.scancode))
return -EINVAL;
}
return input_set_keycode(dev, &ke); return input_set_keycode(dev, &ke);
} }
...@@ -669,6 +666,18 @@ static long evdev_do_ioctl(struct file *file, unsigned int cmd, ...@@ -669,6 +666,18 @@ static long evdev_do_ioctl(struct file *file, unsigned int cmd,
return evdev_grab(evdev, client); return evdev_grab(evdev, client);
else else
return evdev_ungrab(evdev, client); return evdev_ungrab(evdev, client);
case EVIOCGKEYCODE:
return evdev_handle_get_keycode(dev, p);
case EVIOCSKEYCODE:
return evdev_handle_set_keycode(dev, p);
case EVIOCGKEYCODE_V2:
return evdev_handle_get_keycode_v2(dev, p);
case EVIOCSKEYCODE_V2:
return evdev_handle_set_keycode_v2(dev, p);
} }
size = _IOC_SIZE(cmd); size = _IOC_SIZE(cmd);
...@@ -708,12 +717,6 @@ static long evdev_do_ioctl(struct file *file, unsigned int cmd, ...@@ -708,12 +717,6 @@ static long evdev_do_ioctl(struct file *file, unsigned int cmd,
return -EFAULT; return -EFAULT;
return error; 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 */ /* Multi-number variable-length handlers */
......
...@@ -1436,6 +1436,8 @@ static struct wacom_features wacom_features_0xD2 = ...@@ -1436,6 +1436,8 @@ static struct wacom_features wacom_features_0xD2 =
{ "Wacom Bamboo Craft", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, 63, BAMBOO_PT }; { "Wacom Bamboo Craft", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, 63, BAMBOO_PT };
static struct wacom_features wacom_features_0xD3 = static struct wacom_features wacom_features_0xD3 =
{ "Wacom Bamboo 2FG 6x8", WACOM_PKGLEN_BBFUN, 21648, 13530, 1023, 63, BAMBOO_PT }; { "Wacom Bamboo 2FG 6x8", WACOM_PKGLEN_BBFUN, 21648, 13530, 1023, 63, BAMBOO_PT };
static const struct wacom_features wacom_features_0xD4 =
{ "Wacom Bamboo Pen", WACOM_PKGLEN_BBFUN, 14720, 9200, 255, 63, BAMBOO_PT };
static struct wacom_features wacom_features_0xD8 = static struct wacom_features wacom_features_0xD8 =
{ "Wacom Bamboo Comic 2FG", WACOM_PKGLEN_BBFUN, 21648, 13530, 1023, 63, BAMBOO_PT }; { "Wacom Bamboo Comic 2FG", WACOM_PKGLEN_BBFUN, 21648, 13530, 1023, 63, BAMBOO_PT };
static struct wacom_features wacom_features_0xDA = static struct wacom_features wacom_features_0xDA =
...@@ -1510,6 +1512,7 @@ const struct usb_device_id wacom_ids[] = { ...@@ -1510,6 +1512,7 @@ const struct usb_device_id wacom_ids[] = {
{ USB_DEVICE_WACOM(0xD1) }, { USB_DEVICE_WACOM(0xD1) },
{ USB_DEVICE_WACOM(0xD2) }, { USB_DEVICE_WACOM(0xD2) },
{ USB_DEVICE_WACOM(0xD3) }, { USB_DEVICE_WACOM(0xD3) },
{ USB_DEVICE_WACOM(0xD4) },
{ USB_DEVICE_WACOM(0xD8) }, { USB_DEVICE_WACOM(0xD8) },
{ USB_DEVICE_WACOM(0xDA) }, { USB_DEVICE_WACOM(0xDA) },
{ USB_DEVICE_WACOM(0xDB) }, { USB_DEVICE_WACOM(0xDB) },
......
...@@ -104,8 +104,10 @@ struct input_keymap_entry { ...@@ -104,8 +104,10 @@ struct input_keymap_entry {
#define EVIOCGREP _IOR('E', 0x03, unsigned int[2]) /* get repeat settings */ #define EVIOCGREP _IOR('E', 0x03, unsigned int[2]) /* get repeat settings */
#define EVIOCSREP _IOW('E', 0x03, unsigned int[2]) /* set repeat settings */ #define EVIOCSREP _IOW('E', 0x03, unsigned int[2]) /* set repeat settings */
#define EVIOCGKEYCODE _IOR('E', 0x04, struct input_keymap_entry) /* get keycode */ #define EVIOCGKEYCODE _IOR('E', 0x04, unsigned int[2]) /* get keycode */
#define EVIOCSKEYCODE _IOW('E', 0x04, struct input_keymap_entry) /* set keycode */ #define EVIOCGKEYCODE_V2 _IOR('E', 0x04, struct input_keymap_entry)
#define EVIOCSKEYCODE _IOW('E', 0x04, unsigned int[2]) /* set keycode */
#define EVIOCSKEYCODE_V2 _IOW('E', 0x04, struct input_keymap_entry)
#define EVIOCGNAME(len) _IOC(_IOC_READ, 'E', 0x06, len) /* get device name */ #define EVIOCGNAME(len) _IOC(_IOC_READ, 'E', 0x06, len) /* get device name */
#define EVIOCGPHYS(len) _IOC(_IOC_READ, 'E', 0x07, len) /* get physical location */ #define EVIOCGPHYS(len) _IOC(_IOC_READ, 'E', 0x07, len) /* get physical location */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment