Changeset 0e45e7f in mainline for uspace/app


Ignore:
Timestamp:
2011-03-21T13:28:31Z (15 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
48fe0c9, 925e099
Parents:
2e1d5d70 (diff), f8e1a2c (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

USB request wrappers, usbinfo tunning (#53, #136)

The request wrappers are not tested because no driver uses them
(https://sourceforge.net/apps/trac/helenos-usb/ticket/53).

Added full descriptor dump back to usbinfo application
(https://sourceforge.net/apps/trac/helenos-usb/ticket/136).

Location:
uspace/app/usbinfo
Files:
3 edited

Legend:

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

    r2e1d5d70 r0e45e7f  
    4242#include <usb/classes/classes.h>
    4343#include <usb/classes/hid.h>
     44#include <usb/classes/hub.h>
    4445#include "usbinfo.h"
    4546
     
    119120    usb_standard_configuration_descriptor_t *descriptor)
    120121{
    121         printf("%sConfiguration #%d (%zu interfaces)\n", prefix,
     122        printf("%sConfiguration #%d (%zu interfaces, total %zuB)\n", prefix,
    122123            (int) descriptor->configuration_number,
    123             (size_t) descriptor->interface_count);
     124            (size_t) descriptor->interface_count,
     125            (size_t) descriptor->total_length);
    124126}
    125127
     
    156158}
    157159
    158 
    159 static void dump_descriptor_tree_brief_callback(uint8_t *descriptor,
     160static void dump_descriptor_tree_brief_hub(const char *prefix,
     161    usb_hub_descriptor_header_t *descriptor)
     162{
     163        printf("%shub (%d ports)\n", prefix,
     164            (int) descriptor->port_count);
     165}
     166
     167
     168static void dump_descriptor_tree_callback(uint8_t *descriptor,
    160169    size_t depth, void *arg)
    161170{
     
    174183                if (descr_size >= sizeof(descriptor_type)) { \
    175184                        callback(indent, (descriptor_type *) descriptor); \
     185                        if (arg != NULL) { \
     186                                usb_dump_standard_descriptor(stdout, \
     187                                    get_indent(depth +2), "\n", \
     188                                    descriptor, descr_size); \
     189                        } \
    176190                } else { \
    177191                        descr_type = -1; \
     
    194208                    usb_standard_hid_descriptor_t,
    195209                    dump_descriptor_tree_brief_hid);
     210                /*
     211                 * Probably useless, hub descriptor shall not be part of
     212                 * configuration descriptor.
     213                 */
     214                _BRANCH(USB_DESCTYPE_HUB,
     215                    usb_hub_descriptor_header_t,
     216                    dump_descriptor_tree_brief_hub);
    196217
    197218                default:
     
    206227void dump_descriptor_tree_brief(usbinfo_device_t *dev)
    207228{
    208         dump_descriptor_tree_brief_callback((uint8_t *)&dev->device_descriptor,
     229        dump_descriptor_tree_callback((uint8_t *)&dev->device_descriptor,
    209230            (size_t) -1, NULL);
    210231        usb_dp_walk_simple(dev->full_configuration_descriptor,
    211232            dev->full_configuration_descriptor_size,
    212233            usb_dp_standard_descriptor_nesting,
    213             dump_descriptor_tree_brief_callback,
     234            dump_descriptor_tree_callback,
    214235            NULL);
    215236}
     237
     238void dump_descriptor_tree_full(usbinfo_device_t *dev)
     239{
     240        dump_descriptor_tree_callback((uint8_t *)&dev->device_descriptor,
     241            (size_t) -1, dev);
     242        usb_dp_walk_simple(dev->full_configuration_descriptor,
     243            dev->full_configuration_descriptor_size,
     244            usb_dp_standard_descriptor_nesting,
     245            dump_descriptor_tree_callback,
     246            dev);
     247}
     248
    216249
    217250void dump_strings(usbinfo_device_t *dev)
  • uspace/app/usbinfo/main.c

    r2e1d5d70 r0e45e7f  
    134134        _OPTION("-m --match-ids", "Print match ids generated for the device.");
    135135        _OPTION("-t --descriptor-tree", "Print descriptor tree.");
     136        _OPTION("-T --descriptor-tree-full", "Print detailed descriptor tree");
    136137        _OPTION("-s --strings", "Try to print all string descriptors.");
    137138
     
    149150        {"match-ids", no_argument, NULL, 'm'},
    150151        {"descriptor-tree", no_argument, NULL, 't'},
     152        {"descriptor-tree-full", no_argument, NULL, 'T'},
    151153        {"strings", no_argument, NULL, 's'},
    152154        {0, 0, NULL, 0}
    153155};
    154 static const char *short_options = "himts";
     156static const char *short_options = "himtTs";
    155157
    156158static usbinfo_action_t actions[] = {
     
    168170                .opt = 't',
    169171                .action = dump_descriptor_tree_brief,
     172                .active = false
     173        },
     174        {
     175                .opt = 'T',
     176                .action = dump_descriptor_tree_full,
    170177                .active = false
    171178        },
  • uspace/app/usbinfo/usbinfo.h

    r2e1d5d70 r0e45e7f  
    8282void dump_device_match_ids(usbinfo_device_t *);
    8383void dump_descriptor_tree_brief(usbinfo_device_t *);
     84void dump_descriptor_tree_full(usbinfo_device_t *);
    8485void dump_strings(usbinfo_device_t *);
    8586
Note: See TracChangeset for help on using the changeset viewer.