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))
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)
--- /dev/null
+/**/
+
+#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) { }