Re: linux-next: build failure after merge of the hid tree

From: Jiri Kosina
Date: Fri Apr 08 2011 - 19:55:24 EST


On Thu, 7 Apr 2011, Stephen Rothwell wrote:

> Hi Jiri,
>
> After merging the hid tree, today's linux-next build (x86_64 allmodconfig)
> failed like this:
>
> samples/hidraw/hid-example.c: In function 'main':
> samples/hidraw/hid-example.c:103: warning: implicit declaration of function 'HIDIOCSFEATURE'
> samples/hidraw/hid-example.c:111: warning: implicit declaration of function 'HIDIOCGFEATURE'
> tmp/ccK96SHd.o: In function `main':
> hid-example.c:(.text+0x205): undefined reference to `HIDIOCSFEATURE'
> hid-example.c:(.text+0x23e): undefined reference to `HIDIOCGFEATURE'
>
> Caused by commit c54ea4918c2b ("HID: Documentation for hidraw"). I can
> only assume that linux/hidraw.h is being included from /usr/include and
> not the kernel tree being built?
>
> I have used the hid tree from next-20110406 for today.

OK, I have introduced the patch below to the branch now. I am not proud of
it, but I don't see other option currently. Will remove it after some
time.



From: Jiri Kosina <jkosina@xxxxxxx>
Subject: [PATCH] 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 <sfr@xxxxxxxxxxxxxxxx>
Signed-off-by: Jiri Kosina <jkosina@xxxxxxx>
---
samples/hidraw/hid-example.c | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/samples/hidraw/hid-example.c b/samples/hidraw/hid-example.c
index 40e3d62..816e2dc 100644
--- a/samples/hidraw/hid-example.c
+++ b/samples/hidraw/hid-example.c
@@ -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>
--
1.7.3.1


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/