Changeset 7b13d8e in mainline for uspace/app/usbinfo/info.c


Ignore:
Timestamp:
2011-03-17T22:59:37Z (14 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
aad3587
Parents:
4fa05a32
Message:

usbinfo prints match ids from interfaces too

File:
1 edited

Legend:

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

    r4fa05a32 r7b13d8e  
    5050}
    5151
     52static void dump_match_ids_from_interface(uint8_t *descriptor, size_t depth,
     53    void *arg)
     54{
     55        if (depth != 1) {
     56                return;
     57        }
     58        size_t descr_size = descriptor[0];
     59        if (descr_size < sizeof(usb_standard_interface_descriptor_t)) {
     60                return;
     61        }
     62        int descr_type = descriptor[1];
     63        if (descr_type != USB_DESCTYPE_INTERFACE) {
     64                return;
     65        }
     66
     67        usbinfo_device_t *dev = (usbinfo_device_t *) arg;
     68
     69        usb_standard_interface_descriptor_t *iface
     70            = (usb_standard_interface_descriptor_t *) descriptor;
     71
     72        printf("%sInterface #%d match ids (%s, 0x%02x, 0x%02x)\n",
     73            get_indent(0),
     74            (int) iface->interface_number,
     75            usb_str_class(iface->interface_class),
     76            (int) iface->interface_subclass,
     77            (int) iface->interface_protocol);
     78
     79        match_id_list_t matches;
     80        init_match_ids(&matches);
     81        usb_device_create_match_ids_from_interface(&dev->device_descriptor,
     82            iface, &matches);
     83        dump_match_ids(&matches, get_indent(1));
     84        clean_match_ids(&matches);
     85}
     86
    5287void dump_device_match_ids(usbinfo_device_t *dev)
    5388{
     
    5691        usb_device_create_match_ids_from_device_descriptor(
    5792            &dev->device_descriptor, &matches);
    58         dump_match_ids(&matches, get_indent(0));
     93        printf("%sDevice match ids (0x%04x by 0x%04x, %s)\n", get_indent(0),
     94            (int) dev->device_descriptor.product_id,
     95            (int) dev->device_descriptor.vendor_id,
     96            usb_str_class(dev->device_descriptor.device_class));
     97        dump_match_ids(&matches, get_indent(1));
     98        clean_match_ids(&matches);
     99
     100        usb_dp_walk_simple(dev->full_configuration_descriptor,
     101            dev->full_configuration_descriptor_size,
     102            usb_dp_standard_descriptor_nesting,
     103            dump_match_ids_from_interface,
     104            dev);
    59105}
    60106
Note: See TracChangeset for help on using the changeset viewer.