Commit bb6c8d8f authored by Philip Langdale's avatar Philip Langdale Committed by Jiri Kosina

HID: hiddev: Add 32bit ioctl compatibilty

The hiddev driver currently lacks 32bit ioctl compatibility, so
if you're running with a 64bit kernel and 32bit userspace, it won't
work.

I'm pretty sure that the only thing missing is a compat_ioctl
implementation as all structs have fixed size fields.

With this change I can use revoco to configure my MX Revolution mouse.
Signed-off-by: default avatarPhilip Langdale <philipl@overt.org>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent 44694359
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include <linux/usb.h> #include <linux/usb.h>
#include <linux/hid.h> #include <linux/hid.h>
#include <linux/hiddev.h> #include <linux/hiddev.h>
#include <linux/compat.h>
#include "usbhid.h" #include "usbhid.h"
#ifdef CONFIG_USB_DYNAMIC_MINORS #ifdef CONFIG_USB_DYNAMIC_MINORS
...@@ -738,6 +739,14 @@ static int hiddev_ioctl(struct inode *inode, struct file *file, unsigned int cmd ...@@ -738,6 +739,14 @@ static int hiddev_ioctl(struct inode *inode, struct file *file, unsigned int cmd
return -EINVAL; return -EINVAL;
} }
#ifdef CONFIG_COMPAT
static long hiddev_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
struct inode *inode = file->f_path.dentry->d_inode;
return hiddev_ioctl(inode, file, cmd, compat_ptr(arg));
}
#endif
static const struct file_operations hiddev_fops = { static const struct file_operations hiddev_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.read = hiddev_read, .read = hiddev_read,
...@@ -747,6 +756,9 @@ static const struct file_operations hiddev_fops = { ...@@ -747,6 +756,9 @@ static const struct file_operations hiddev_fops = {
.release = hiddev_release, .release = hiddev_release,
.ioctl = hiddev_ioctl, .ioctl = hiddev_ioctl,
.fasync = hiddev_fasync, .fasync = hiddev_fasync,
#ifdef CONFIG_COMPAT
.compat_ioctl = hiddev_compat_ioctl,
#endif
}; };
static struct usb_class_driver hiddev_class = { static struct usb_class_driver hiddev_class = {
......
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