forked from xinu-os/xinu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
xsh_usbinfo.c
49 lines (42 loc) · 1.17 KB
/
xsh_usbinfo.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*
* @file xsh_usbinfo.c
*/
/* Embedded Xinu, Copyright (C) 2013. All rights reserved. */
#include <conf.h>
#ifdef WITH_USB
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <usb_subsystem.h>
/**
* @ingroup shell
*
* Shell command (usbinfo).
* @param nargs number of arguments in args array
* @param args array of arguments
* @return OK for success, SYSERR otherwise
*/
shellcmd xsh_usbinfo(int nargs, char *args[])
{
/* Output help, if '--help' argument was supplied */
if (nargs == 2 && strcmp(args[1], "--help") == 0)
{
printf("Usage: %s\n\n", args[0]);
printf("Description:\n");
printf("\tDisplays information about the devices attached to the USB bus\n");
printf("Options:\n");
printf("\t--help\tdisplay this help and exit\n");
return OK;
}
/* Check for correct number of arguments */
if (nargs > 1)
{
fprintf(stderr, "%s: too many arguments\n", args[0]);
fprintf(stderr, "Try '%s --help' for more information\n",
args[0]);
return SYSERR;
}
/* Call into the core USB driver. */
return usbinfo();
}
#endif /* WITH_USB */