On Tue, May 18, 2004 at 10:47:10AM +0200, Vojtech Pavlik wrote: > On Mon, May 17, 2004 at 09:58:55AM -0400, Adam Kropelin wrote: > > On Mon, May 17, 2004 at 04:03:20PM +0400, Sergey Vlasov wrote: > > > On Sun, May 16, 2004 at 02:58:03PM -0700, Greg KH wrote: > > > > Ick, does hiddev really need hid.h? If so, then we need to move it to > > > > include/linux/. > > > > > > How about this patch (applies both to 2.4 and 2.6)? > > > > <snip> > > > > > +#define HID_MAX_MULTI_USAGES 1024 > > > struct hiddev_usage_ref_multi { > > > struct hiddev_usage_ref uref; > > > __u32 num_values; > > > - __s32 values[HID_MAX_USAGES]; > > > + __s32 values[HID_MAX_MULTI_USAGES]; > > > }; > > > > That certainly beats redefining the ioctls, although it probably wants > > the bit below as well. > > > > I'll make a rollup patch if this is the direction we want to go. > > This sounds sane, yes, please do.
This patch adds COMPATIBLE_IOCTLs for hiddev. Since all hiddev ioctl structures use explicitly sized types or int, COMPATIBLE_IOCTL should be sufficient for all archs. HIDIOCGNAME and HIDIOCGPHYS have been omitted because they play games with encoding user-supplied data in the ioctl len field, thus making them unsuitable for COMPATIBLE_IOCTL. The patch includes decoupling hiddev.h from hid.h based on a suggestion from Sergey Vlasov <[EMAIL PROTECTED]>. Compile tested on sparc64. An earlier version without header cleanup was functionally tested on sparc64 as well. --Adam diff -Nru linux-2.6.6/drivers/usb/input/hiddev.c linux-2.6.6-adk/drivers/usb/input/hiddev.c --- linux-2.6.6/drivers/usb/input/hiddev.c Wed May 12 11:52:25 2004 +++ linux-2.6.6-adk/drivers/usb/input/hiddev.c Mon May 17 09:21:16 2004 @@ -642,7 +642,7 @@ goto inval; if (cmd == HIDIOCGUSAGES || cmd == HIDIOCSUSAGES) { - if (uref_multi->num_values >= HID_MAX_USAGES || + if (uref_multi->num_values >= HID_MAX_MULTI_USAGES || uref->usage_index >= field->maxusage || (uref->usage_index + uref_multi->num_values) >= field->maxusage) goto inval; diff -Nru linux-2.6.6/fs/compat_ioctl.c linux-2.6.6-adk/fs/compat_ioctl.c --- linux-2.6.6/fs/compat_ioctl.c Wed May 12 11:52:26 2004 +++ linux-2.6.6-adk/fs/compat_ioctl.c Tue May 18 08:24:37 2004 @@ -114,6 +114,8 @@ #include <linux/filter.h> #include <linux/msdos_fs.h> +#include <linux/hiddev.h> + #undef INCLUDES #endif diff -Nru linux-2.6.6/include/linux/compat_ioctl.h linux-2.6.6-adk/include/linux/compat_ioctl.h --- linux-2.6.6/include/linux/compat_ioctl.h Wed May 12 11:52:31 2004 +++ linux-2.6.6-adk/include/linux/compat_ioctl.h Sun May 16 14:12:28 2004 @@ -720,3 +720,20 @@ COMPATIBLE_IOCTL(SIOCGIWRETRY) COMPATIBLE_IOCTL(SIOCSIWPOWER) COMPATIBLE_IOCTL(SIOCGIWPOWER) +/* hiddev */ +COMPATIBLE_IOCTL(HIDIOCGVERSION) +COMPATIBLE_IOCTL(HIDIOCAPPLICATION) +COMPATIBLE_IOCTL(HIDIOCGDEVINFO) +COMPATIBLE_IOCTL(HIDIOCGSTRING) +COMPATIBLE_IOCTL(HIDIOCINITREPORT) +COMPATIBLE_IOCTL(HIDIOCGREPORT) +COMPATIBLE_IOCTL(HIDIOCSREPORT) +COMPATIBLE_IOCTL(HIDIOCGREPORTINFO) +COMPATIBLE_IOCTL(HIDIOCGFIELDINFO) +COMPATIBLE_IOCTL(HIDIOCGUSAGE) +COMPATIBLE_IOCTL(HIDIOCSUSAGE) +COMPATIBLE_IOCTL(HIDIOCGUCODE) +COMPATIBLE_IOCTL(HIDIOCGFLAG) +COMPATIBLE_IOCTL(HIDIOCSFLAG) +COMPATIBLE_IOCTL(HIDIOCGCOLLECTIONINDEX) +COMPATIBLE_IOCTL(HIDIOCGCOLLECTIONINFO) diff -Nru linux-2.6.6/include/linux/hiddev.h linux-2.6.6-adk/include/linux/hiddev.h --- linux-2.6.6/include/linux/hiddev.h Wed May 12 11:51:46 2004 +++ linux-2.6.6-adk/include/linux/hiddev.h Tue May 18 09:52:42 2004 @@ -128,10 +128,11 @@ /* hiddev_usage_ref_multi is used for sending multiple bytes to a control. * It really manifests itself as setting the value of consecutive usages */ +#define HID_MAX_MULTI_USAGES 1024 struct hiddev_usage_ref_multi { struct hiddev_usage_ref uref; __u32 num_values; - __s32 values[HID_MAX_USAGES]; + __s32 values[HID_MAX_MULTI_USAGES]; }; /* FIELD_INDEX_NONE is returned in read() data from the kernel when flags @@ -213,6 +214,11 @@ */ #ifdef CONFIG_USB_HIDDEV +struct hid_device; +struct hid_usage; +struct hid_field; +struct hid_report; + int hiddev_connect(struct hid_device *); void hiddev_disconnect(struct hid_device *); void hiddev_hid_event(struct hid_device *hid, struct hid_field *field, ------------------------------------------------------- This SF.Net email is sponsored by: SourceForge.net Broadband Sign-up now for SourceForge Broadband and get the fastest 6.0/768 connection for only $19.95/mo for the first 3 months! http://ads.osdn.com/?ad_id=2562&alloc_id=6184&op=click _______________________________________________ [EMAIL PROTECTED] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel