From: ian Date: Sat, 14 Jun 2008 22:50:28 +0000 (+0000) Subject: new hiddev-test program wip for keyboard leftover keys in vendor page(s) X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ijackson/git?a=commitdiff_plain;h=1ce3d561934dfa503a7f310a8edb830502687e29;p=trains.git new hiddev-test program wip for keyboard leftover keys in vendor page(s) --- diff --git a/hostside/.cvsignore b/hostside/.cvsignore index 7195c3c..5fc004d 100644 --- a/hostside/.cvsignore +++ b/hostside/.cvsignore @@ -28,3 +28,4 @@ record-y.[ch] evdev-manip input-codes.h +dump.* +hiddev-test diff --git a/hostside/Makefile b/hostside/Makefile index 9e60d67..7942d75 100644 --- a/hostside/Makefile +++ b/hostside/Makefile @@ -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 index 0000000..0979126 --- /dev/null +++ b/hostside/hiddev-test.c @@ -0,0 +1,44 @@ +/**/ + +#include +#include +#include + +#include +#include + +#include +#include + +#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) { }