Ignore:
File:
1 edited

Legend:

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

    r99ea659c r07b9203e  
    4444#include "usbinfo.h"
    4545
    46 #define DEFAULT_HOST_CONTROLLER_PATH "/virt/usbhc"
    47 
    4846static void print_usage(char *app_name)
    4947{
    5048        printf(NAME ": query USB devices for descriptors\n\n");
    5149        printf("Usage: %s /path/to/hc usb-address\n where\n", app_name);
    52         printf("   /path/to/hc   Devman path to USB host controller " \
    53             "(use `-' for\n");
    54         printf("                   default HC at `%s').\n",
    55             DEFAULT_HOST_CONTROLLER_PATH);
     50        printf("   /path/to/hc   Devman path to USB host controller\n");
    5651        printf("   usb-address   USB address of device to be queried\n");
    5752        printf("\n");
     
    7368}
    7469
    75 int main(int argc, char *argv[])
     70int main(int argc, char * argv[])
    7671{
    7772        if (argc != 3) {
     
    8681         * Connect to given host controller driver.
    8782         */
    88         if (str_cmp(hc_path, "-") == 0) {
    89                 hc_path = (char *) DEFAULT_HOST_CONTROLLER_PATH;
    90         }
    9183        int hc_phone = connect_to_hc(hc_path);
    9284        if (hc_phone < 0) {
     
    115107         */
    116108        usb_standard_device_descriptor_t device_descriptor;
    117         usb_dprintf(NAME, 1,
     109        usb_dprintf("usbinfo", 1,
    118110            "usb_drv_req_get_device_descriptor(%d, %d, %p)\n",
    119111            hc_phone, (int) address, &device_descriptor);
     
    129121        dump_standard_device_descriptor(&device_descriptor);
    130122
    131         /*
    132          * Get first configuration descriptor and dump it.
    133          */
    134         usb_standard_configuration_descriptor_t config_descriptor;
    135         int config_index = 0;
    136         usb_dprintf(NAME, 1,
    137             "usb_drv_req_get_bare_configuration_descriptor(%d, %d, %d, %p)\n",
    138             hc_phone, (int) address, config_index, &config_descriptor);
    139 
    140         rc = usb_drv_req_get_bare_configuration_descriptor(hc_phone, address,
    141             config_index, &config_descriptor );
    142         if (rc != EOK) {
    143                 fprintf(stderr,
    144                     NAME ": failed to fetch standard configuration descriptor: %s.\n",
    145                     str_error(rc));
    146                 return rc;
    147         }
    148         dump_standard_configuration_descriptor(config_index,
    149             &config_descriptor);
    150 
    151         void *full_config_descriptor = malloc(config_descriptor.total_length);
    152         usb_dprintf(NAME, 1,
    153             "usb_drv_req_get_full_configuration_descriptor(%d, %d, %d, %p, %zu)\n",
    154             hc_phone, (int) address, config_index,
    155             full_config_descriptor, config_descriptor.total_length);
    156 
    157         rc = usb_drv_req_get_full_configuration_descriptor(hc_phone, address,
    158             config_index,
    159             full_config_descriptor, config_descriptor.total_length, NULL);
    160         if (rc != EOK) {
    161                 fprintf(stderr,
    162                     NAME ": failed to fetch full configuration descriptor: %s.\n",
    163                     str_error(rc));
    164                 return rc;
    165         }
    166         dump_buffer("Full configuration descriptor:",
    167             full_config_descriptor, config_descriptor.total_length);
    168123
    169124        return EOK;
Note: See TracChangeset for help on using the changeset viewer.