Skip to content

Commit

Permalink
HID: hidraw: fix samples miscompilation
Browse files Browse the repository at this point in the history
On systems where userspace doesn't have new hidraw.h populated to
/usr/include, the hidraw sample won't compile as it's missing the new
ioctl defitions.

Introduce temporary ugly workaround to define the ioctls "manually"
in such cases, just to avoid miscompilation in allmodconfig cases.

Reported-by: Stephen Rothwell <[email protected]>
Signed-off-by: Jiri Kosina <[email protected]>
  • Loading branch information
Jiri Kosina committed Apr 8, 2011
1 parent 1a978c5 commit cb3e85f
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions samples/hidraw/hid-example.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,17 @@
#include <linux/input.h>
#include <linux/hidraw.h>

/*
* Ugly hack to work around failing compilation on systems that don't
* yet populate new version of hidraw.h to userspace.
*
* If you need this, please have your distro update the kernel headers.
*/
#ifndef HIDIOCSFEATURE
#define HIDIOCSFEATURE(len) _IOC(_IOC_WRITE|_IOC_READ, 'H', 0x06, len)
#define HIDIOCGFEATURE(len) _IOC(_IOC_WRITE|_IOC_READ, 'H', 0x07, len)
#endif

/* Unix */
#include <sys/ioctl.h>
#include <sys/types.h>
Expand Down

0 comments on commit cb3e85f

Please sign in to comment.