Changeset e9c02b7 in mainline for uspace/app/usbinfo/hid.c
- Timestamp:
- 2011-06-17T20:42:13Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 051f96b
- Parents:
- dec55ce
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/usbinfo/hid.c
rdec55ce re9c02b7 38 38 #include <usb/classes/classes.h> 39 39 #include <usb/dev/request.h> 40 #include <usb/hid/hidparser.h> 40 41 #include <errno.h> 41 42 #include "usbinfo.h" … … 84 85 } 85 86 87 /** Dumps HID report in pseudo human-readable format. 88 * 89 * @param iface_no USB interface the report belongs to. 90 * @param report Parsed report descriptor. 91 */ 92 static void dump_hid_report_brief(int iface_no, usb_hid_report_t *report) 93 { 94 printf("%sParsed HID report descriptor for interface %d\n", 95 get_indent(0), iface_no); 96 list_foreach(report->reports, report_it) { 97 usb_hid_report_description_t *description = list_get_instance(report_it, usb_hid_report_description_t, link); 98 printf("%sReport %d (type %d)\n", get_indent(1), 99 (int) description->report_id, 100 (int) description->type); 101 list_foreach(description->report_items, item_it) { 102 usb_hid_report_field_t *field = list_get_instance(item_it, usb_hid_report_field_t, link); 103 printf("%sUsage page = 0x%04x Usage = 0x%04x\n", 104 get_indent(2), 105 (int) field->usage_page, (int) field->usage); 106 } 107 } 108 } 109 86 110 /** Retrieves HID report from given USB device and dumps it. 87 111 * … … 115 139 } 116 140 141 usb_hid_report_t report; 142 rc = usb_hid_parse_report_descriptor(&report, raw_report, report_size); 143 if (rc != EOK) { 144 usb_log_error("Failed to part report descriptor: %s.\n", 145 str_error(rc)); 146 } 147 117 148 dump_hid_report_raw(iface_no, raw_report, report_size); 149 dump_hid_report_brief(iface_no, &report); 118 150 119 151 free(raw_report); 152 usb_hid_free_report(&report); 120 153 } 121 154
Note:
See TracChangeset
for help on using the changeset viewer.