chiark / gitweb /
extract application info
authorian <ian>
Sun, 15 Jun 2008 20:03:06 +0000 (20:03 +0000)
committerian <ian>
Sun, 15 Jun 2008 20:03:06 +0000 (20:03 +0000)
hostside/hiddev-test.c

index 0979126101468dbbb1fa9b9e328002319c8039d3..a0a643989f137b0c27e09124875e47d3103dde1e 100644 (file)
@@ -14,6 +14,7 @@
 
 int main(void) {
   struct hiddev_usage_ref ev;
+  struct hiddev_field_info fi;
   int r, flag;
 
   flag= HIDDEV_FLAG_UREF|HIDDEV_FLAG_REPORT;
@@ -29,13 +30,36 @@ int main(void) {
     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
+    else {
       printf("report type %04x id %04x field index %04x"
-            " usage index %04x code %04x value %08lx\n",
+            " usage index %04x code %04x value %08lx ",
             ev.report_type, ev.report_id,
             ev.field_index,
             ev.usage_index, ev.usage_code,
             (unsigned long)ev.value);
+      memset(&fi,0x55,sizeof(fi));
+      fi.report_type= ev.report_type;
+      fi.report_id=   ev.report_id;
+      fi.field_index= ev.field_index;
+      r= ioctl(0, HIDIOCGFIELDINFO, &fi);
+      if (r) {
+       printf(" ? %s",strerror(errno));
+      } else {
+       printf(" maxusage %04x flags %04x"
+              " physical %04x %08lx..%08lx"
+              " logical %04x %08lx..%08lx"
+              " application %04x"
+              " unit %04x exponent %04x",
+              fi.maxusage, fi.flags,
+              fi.physical, (unsigned long)fi.physical_minimum,
+              (unsigned long)fi.physical_maximum,
+              fi.logical, (unsigned long)fi.logical_minimum,
+              (unsigned long)fi.logical_maximum,
+              fi.application,
+              fi.unit, fi.unit_exponent);
+      }
+      putchar('\n');
+    }
   }
 }