chiark / gitweb /
evdev-manip compiles and mostly works
authorian <ian>
Thu, 5 Jun 2008 23:07:06 +0000 (23:07 +0000)
committerian <ian>
Thu, 5 Jun 2008 23:07:06 +0000 (23:07 +0000)
hostside/evdev-manip.c

index 6fa2c636c3e260cd6c60b3f5ebfe7bcf002cbe04..72ae4e5fa7036a8bd9f6fe1d69bbc69b7a97ec1f 100644 (file)
@@ -43,10 +43,17 @@ static void pr_table_str(const InputEventStringInfo *strings, int nstrings,
   printf("%s %s", string->prefix, string->main);
 }
 
+static void pr_time(struct timeval tv) {
+  printf("%ju.%06d", (uintmax_t)tv.tv_sec, (int)tv.tv_usec);
+}
+
 static void dump_event(Device *d, const struct input_event *ie) {
   const InputEventTypeInfo *t;
 
   printf("event ");
+  pr_time(ie->time);
+
+  printf(" ");
   PR_TABLE_STR(ev, ie->type);
 
   printf(" ");
@@ -77,7 +84,7 @@ static void process_device(Device *d) {
   int r, remain;
   char *p;
 
-  printf("event-group-start device %s\n",d->path);
+  printf("report-from device %s\n",d->path);
 
   for (;;) {
     for (p=(void*)&ie, remain=sizeof(ie);
@@ -93,9 +100,9 @@ static void process_device(Device *d) {
       assert(r <= remain);
     }
     if (ie.type == EV_SYN) {
-      printf("synchronised %ju.%06d\n",
-            (uintmax_t)ie.time.tv_sec,
-            (int)ie.time.tv_usec);
+      printf("synch ");
+      pr_time(ie.time);
+      printf("\n");
       break;
     }
 
@@ -151,7 +158,7 @@ static void getdevice(const char *path) {
   r= ioctl(d->fd, EVIOCGID, &iid);  if (r) diee("%s: failed to get id",path);
   printf("device %s bustype ", path);
   PR_TABLE_STR(bus, iid.bustype);
-  printf(" vendor %#x product #%x version %#x\n",
+  printf(" vendor %#x product %#x version %#x\n",
         iid.vendor, iid.product, iid.version);
   mflushstdout();
 
@@ -162,6 +169,8 @@ static void getdevice(const char *path) {
 int main(int argc, const char **argv) {
   const char *arg;
 
+  mode= &mode_dump;
+
   while ((arg= *++argv)) {
     if (arg[0] != '-') {
       getdevice(arg);