Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Philip Langdale <philipl@overt.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>

authored by

Philip Langdale and committed by
Jiri Kosina
bb6c8d8f 44694359

+12
+12
drivers/hid/usbhid/hiddev.c
··· 34 34 #include <linux/usb.h> 35 35 #include <linux/hid.h> 36 36 #include <linux/hiddev.h> 37 + #include <linux/compat.h> 37 38 #include "usbhid.h" 38 39 39 40 #ifdef CONFIG_USB_DYNAMIC_MINORS ··· 739 738 return -EINVAL; 740 739 } 741 740 741 + #ifdef CONFIG_COMPAT 742 + static long hiddev_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) 743 + { 744 + struct inode *inode = file->f_path.dentry->d_inode; 745 + return hiddev_ioctl(inode, file, cmd, compat_ptr(arg)); 746 + } 747 + #endif 748 + 742 749 static const struct file_operations hiddev_fops = { 743 750 .owner = THIS_MODULE, 744 751 .read = hiddev_read, ··· 756 747 .release = hiddev_release, 757 748 .ioctl = hiddev_ioctl, 758 749 .fasync = hiddev_fasync, 750 + #ifdef CONFIG_COMPAT 751 + .compat_ioctl = hiddev_compat_ioctl, 752 + #endif 759 753 }; 760 754 761 755 static struct usb_class_driver hiddev_class = {