Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 25935f1 in mainline


Ignore:
Timestamp:
2017-12-18T09:34:53Z (4 years ago)
Author:
Petr Mánek <petr.manek@…>
Branches:
lfn, master
Children:
fc338e0
Parents:
17f8abc
Message:

tmon: nicer usage, more commands

File:
1 edited

Legend:

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

    r17f8abc r25935f1  
    4040#define NAME "tmon"
    4141
    42 static void print_usage(char *app_name)
     42static int fallback(int argc, char *argv[])
    4343{
    44         printf(NAME ": hello USB transfers!\n\n");
     44        // FIXME
     45        printf(NAME ": Not implemented, lol!\n");
     46        return 1;
    4547}
    4648
    4749typedef struct {
    4850        const char *name;
     51        const char *description;
    4952        int (*action)(int, char **);
    5053} usb_diag_cmd_t;
     
    5356        {
    5457                .name = "list",
     58                .description = "Print a list of connected diagnostic devices.",
    5559                .action = tmon_list,
    5660        },
    5761        {
    5862                .name = "test-bulk",
     63                .description = "Benchmark bulk endpoints of a diagnostic device.",
    5964                .action = tmon_test_bulk,
     65        },
     66        {
     67                .name = "test-intr",
     68                .description = "Benchmark interrupt endpoints of a diagnostic device.",
     69                .action = fallback,
     70        },
     71        {
     72                .name = "test-isoch",
     73                .description = "Benchmark isochronous endpoints of a diagnostic device.",
     74                .action = fallback,
    6075        },
    6176        {
     
    6378        }
    6479};
     80
     81static void print_usage(char *app_name)
     82{
     83        printf(NAME ": benchmark USB diagnostic device\n\n");
     84
     85        printf("Usage: %s command [options] [device]\n", app_name);
     86        printf("Available commands:\n");
     87        for (int i = 0; commands[i].name; ++i) {
     88                printf("      %s - %s\n", commands[i].name, commands[i].description);
     89        }
     90
     91        // TODO: Print options.
     92
     93        printf("\nIf no device is specified, the first device is used provided that no other device is connected.\n\n");
     94}
    6595
    6696int main(int argc, char *argv[])
Note: See TracChangeset for help on using the changeset viewer.