Loading drivers/hid/hidraw.c +28 −0 Original line number Diff line number Diff line Loading @@ -265,6 +265,34 @@ static long hidraw_ioctl(struct file *file, unsigned int cmd, break; } default: { struct hid_device *hid = dev->hid; if (_IOC_TYPE(cmd) != 'H' || _IOC_DIR(cmd) != _IOC_READ) return -EINVAL; if (_IOC_NR(cmd) == _IOC_NR(HIDIOCGRAWNAME(0))) { int len; if (!hid->name) return 0; len = strlen(hid->name) + 1; if (len > _IOC_SIZE(cmd)) len = _IOC_SIZE(cmd); return copy_to_user(user_arg, hid->name, len) ? -EFAULT : len; } if (_IOC_NR(cmd) == _IOC_NR(HIDIOCGRAWPHYS(0))) { int len; if (!hid->phys) return 0; len = strlen(hid->phys) + 1; if (len > _IOC_SIZE(cmd)) len = _IOC_SIZE(cmd); return copy_to_user(user_arg, hid->phys, len) ? -EFAULT : len; } } ret = -ENOTTY; } unlock_kernel(); Loading include/linux/hidraw.h +2 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,8 @@ struct hidraw_devinfo { #define HIDIOCGRDESCSIZE _IOR('H', 0x01, int) #define HIDIOCGRDESC _IOR('H', 0x02, struct hidraw_report_descriptor) #define HIDIOCGRAWINFO _IOR('H', 0x03, struct hidraw_devinfo) #define HIDIOCGRAWNAME(len) _IOC(_IOC_READ, 'H', 0x04, len) #define HIDIOCGRAWPHYS(len) _IOC(_IOC_READ, 'H', 0x05, len) #define HIDRAW_FIRST_MINOR 0 #define HIDRAW_MAX_DEVICES 64 Loading Loading
drivers/hid/hidraw.c +28 −0 Original line number Diff line number Diff line Loading @@ -265,6 +265,34 @@ static long hidraw_ioctl(struct file *file, unsigned int cmd, break; } default: { struct hid_device *hid = dev->hid; if (_IOC_TYPE(cmd) != 'H' || _IOC_DIR(cmd) != _IOC_READ) return -EINVAL; if (_IOC_NR(cmd) == _IOC_NR(HIDIOCGRAWNAME(0))) { int len; if (!hid->name) return 0; len = strlen(hid->name) + 1; if (len > _IOC_SIZE(cmd)) len = _IOC_SIZE(cmd); return copy_to_user(user_arg, hid->name, len) ? -EFAULT : len; } if (_IOC_NR(cmd) == _IOC_NR(HIDIOCGRAWPHYS(0))) { int len; if (!hid->phys) return 0; len = strlen(hid->phys) + 1; if (len > _IOC_SIZE(cmd)) len = _IOC_SIZE(cmd); return copy_to_user(user_arg, hid->phys, len) ? -EFAULT : len; } } ret = -ENOTTY; } unlock_kernel(); Loading
include/linux/hidraw.h +2 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,8 @@ struct hidraw_devinfo { #define HIDIOCGRDESCSIZE _IOR('H', 0x01, int) #define HIDIOCGRDESC _IOR('H', 0x02, struct hidraw_report_descriptor) #define HIDIOCGRAWINFO _IOR('H', 0x03, struct hidraw_devinfo) #define HIDIOCGRAWNAME(len) _IOC(_IOC_READ, 'H', 0x04, len) #define HIDIOCGRAWPHYS(len) _IOC(_IOC_READ, 'H', 0x05, len) #define HIDRAW_FIRST_MINOR 0 #define HIDRAW_MAX_DEVICES 64 Loading