From a46a91ac0c11b70b0c6ddbc0bf70a7131763698c Mon Sep 17 00:00:00 2001 From: ian Date: Sun, 15 Jun 2008 20:03:06 +0000 Subject: [PATCH] extract application info --- hostside/hiddev-test.c | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/hostside/hiddev-test.c b/hostside/hiddev-test.c index 0979126..a0a6439 100644 --- a/hostside/hiddev-test.c +++ b/hostside/hiddev-test.c @@ -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'); + } } } -- 2.30.2