chiark / gitweb /
new hiddev-test program wip for keyboard leftover keys in vendor page(s)
authorian <ian>
Sat, 14 Jun 2008 22:50:28 +0000 (22:50 +0000)
committerian <ian>
Sat, 14 Jun 2008 22:50:28 +0000 (22:50 +0000)
hostside/.cvsignore
hostside/Makefile
hostside/hiddev-test.c [new file with mode: 0644]

index 7195c3c82a7b5891dd9999065f748d355eb8e4e8..5fc004d1936bab29f2ccdf4f6173eb4e5fc767db 100644 (file)
@@ -28,3 +28,4 @@ record-y.[ch]
 evdev-manip
 input-codes.h
 +dump.*
+hiddev-test
index 9e60d67292219f9a7a397ccb680d40fcd77b5974..7942d75979bca7c774cef22f4f91faabe89328de 100644 (file)
@@ -6,7 +6,7 @@ AUTOINCS=       auproto-pic.h layoutinfo.h selectors.h retransmit-table.h \
                errorcodes.h stastate.h record-y.h record-l.h \
                realtime+dflags.h input-codes.h
 TARGETS=       hostside-old gui-plan-bot realtime topology-dump \
-               evdev-manip \
+               evdev-manip hiddev-test \
                $(addsuffix .speeds.ps, $(TRAINS)) \
                $(addsuffix .speeds.record, $(TRAINS))
 
@@ -79,6 +79,8 @@ realtime+dflags.h: debug-extractor $(addsuffix .c, $(REALTIME_CORE))
 
 evdev-manip:   evdev-manip.o utils.o $(LIBOOP_OBJS)
 
+hiddev-test:   hiddev-test.o utils.o
+
 safety:                safety.o utils.o trackloc.o ../layout/ours.layout-data.o
                $(LINK)
 
diff --git a/hostside/hiddev-test.c b/hostside/hiddev-test.c
new file mode 100644 (file)
index 0000000..0979126
--- /dev/null
@@ -0,0 +1,44 @@
+/**/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include <sys/types.h>
+#include <sys/ioctl.h>
+
+#include <linux/types.h>
+#include <linux/hiddev.h>
+
+#include "common.h"
+
+int main(void) {
+  struct hiddev_usage_ref ev;
+  int r, flag;
+
+  flag= HIDDEV_FLAG_UREF|HIDDEV_FLAG_REPORT;
+  r= ioctl(0, HIDIOCSFLAG, &flag);
+  if (r) diee("ioctl HIDIOCSFLAG");
+
+  for (;;) {
+    r= fread(&ev,1,sizeof(ev),stdin);
+    if (feof(stdin)) exit(0);
+    if (ferror(stdin)) diee("fread stdin");
+    assert(r==sizeof(ev));
+
+    if (ev.field_index == HID_FIELD_INDEX_NONE)
+      printf("report type %04x id %04x field index NONE\n",
+            ev.report_type, ev.report_id);
+    else
+      printf("report type %04x id %04x field index %04x"
+            " usage index %04x code %04x value %08lx\n",
+            ev.report_type, ev.report_id,
+            ev.field_index,
+            ev.usage_index, ev.usage_code,
+            (unsigned long)ev.value);
+  }
+}
+
+const char *progname= "hiddev-test";
+void die_hook(void) { }
+void die_vprintf_hook(const char *fmt, va_list al) { }