Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/usbinfo/hid.c

    re2dfa86 rfeeac0d  
    3636#include <stdio.h>
    3737#include <str_error.h>
    38 #include <usb/debug.h>
    3938#include <usb/classes/classes.h>
    4039#include <usb/dev/request.h>
     
    5150
    5251typedef struct {
    53         usb_device_t *usb_dev;
     52        usbinfo_device_t *dev;
    5453        hid_dump_type_t dump_type;
    5554        usb_standard_interface_descriptor_t *last_iface;
     
    101100        printf("%sParsed HID report descriptor for interface %d\n",
    102101            get_indent(0), iface_no);
    103         list_foreach(report->reports, report_it) {
    104                 usb_hid_report_description_t *description = list_get_instance(
    105                     report_it, usb_hid_report_description_t, reports_link);
     102        list_foreach(report->reports, reports_link,
     103            usb_hid_report_description_t, description) {
    106104                printf("%sReport %d (type %d)\n", get_indent(1),
    107105                    (int) description->report_id,
    108106                    (int) description->type);
    109                 list_foreach(description->report_items, item_it) {
    110                         usb_hid_report_field_t *field = list_get_instance(
    111                             item_it, usb_hid_report_field_t, ritems_link);
     107                list_foreach(description->report_items, ritems_link,
     108                    usb_hid_report_field_t, field) {
    112109                        printf("%sUsage page = 0x%04x    Usage = 0x%04x\n",
    113110                            get_indent(2),
     
    214211
    215212        retrieve_and_dump_hid_report(context->dump_type,
    216             usb_device_get_default_pipe(context->usb_dev),
    217             context->last_iface->interface_number, report_size);
    218 }
    219 
    220 
    221 void dump_hidreport_raw(usb_device_t *usb_dev)
     213            &context->dev->ctrl_pipe, context->last_iface->interface_number,
     214            report_size);
     215}
     216
     217
     218void dump_hidreport_raw(usbinfo_device_t *dev)
    222219{
    223220        descriptor_walk_context_t context = {
    224                 .usb_dev = usb_dev,
     221                .dev = dev,
    225222                .dump_type = HID_DUMP_RAW,
    226223                .last_iface = NULL
    227224        };
    228225
    229         usb_dp_walk_simple(
    230             usb_device_descriptors(usb_dev)->full_config,
    231             usb_device_descriptors(usb_dev)->full_config_size,
     226        usb_dp_walk_simple(dev->full_configuration_descriptor,
     227            dev->full_configuration_descriptor_size,
    232228            usb_dp_standard_descriptor_nesting,
    233229            descriptor_walk_callback, &context);
    234230}
    235231
    236 void dump_hidreport_usages(usb_device_t *usb_dev)
     232void dump_hidreport_usages(usbinfo_device_t *dev)
    237233{
    238234        descriptor_walk_context_t context = {
    239                 .usb_dev = usb_dev,
     235                .dev = dev,
    240236                .dump_type = HID_DUMP_USAGES,
    241237                .last_iface = NULL
    242238        };
    243239
    244         usb_dp_walk_simple(
    245             usb_device_descriptors(usb_dev)->full_config,
    246             usb_device_descriptors(usb_dev)->full_config_size,
     240        usb_dp_walk_simple(dev->full_configuration_descriptor,
     241            dev->full_configuration_descriptor_size,
    247242            usb_dp_standard_descriptor_nesting,
    248243            descriptor_walk_callback, &context);
Note: See TracChangeset for help on using the changeset viewer.