Skip to content

Commit cb3e85f

Browse files
author
Jiri Kosina
committed
HID: hidraw: fix samples miscompilation
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]>
1 parent 1a978c5 commit cb3e85f

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

samples/hidraw/hid-example.c

+11
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,17 @@
1414
#include <linux/input.h>
1515
#include <linux/hidraw.h>
1616

17+
/*
18+
* Ugly hack to work around failing compilation on systems that don't
19+
* yet populate new version of hidraw.h to userspace.
20+
*
21+
* If you need this, please have your distro update the kernel headers.
22+
*/
23+
#ifndef HIDIOCSFEATURE
24+
#define HIDIOCSFEATURE(len) _IOC(_IOC_WRITE|_IOC_READ, 'H', 0x06, len)
25+
#define HIDIOCGFEATURE(len) _IOC(_IOC_WRITE|_IOC_READ, 'H', 0x07, len)
26+
#endif
27+
1728
/* Unix */
1829
#include <sys/ioctl.h>
1930
#include <sys/types.h>

0 commit comments

Comments
 (0)