detect command: Add -a option to detect all devices
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
parent
2d2ec6619b
commit
ab058b10eb
|
@ -28,8 +28,9 @@ static int do_detect(int argc, char *argv[])
|
||||||
int opt, i, ret;
|
int opt, i, ret;
|
||||||
int option_list = 0;
|
int option_list = 0;
|
||||||
int option_error = 0;
|
int option_error = 0;
|
||||||
|
int option_all = 0;
|
||||||
|
|
||||||
while ((opt = getopt(argc, argv, "el")) > 0) {
|
while ((opt = getopt(argc, argv, "ela")) > 0) {
|
||||||
switch (opt) {
|
switch (opt) {
|
||||||
case 'l':
|
case 'l':
|
||||||
option_list = 1;
|
option_list = 1;
|
||||||
|
@ -37,6 +38,11 @@ static int do_detect(int argc, char *argv[])
|
||||||
case 'e':
|
case 'e':
|
||||||
option_error = 1;
|
option_error = 1;
|
||||||
break;
|
break;
|
||||||
|
case 'a':
|
||||||
|
option_all = 1;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return COMMAND_ERROR_USAGE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,6 +54,15 @@ static int do_detect(int argc, char *argv[])
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (option_all) {
|
||||||
|
for_each_device(dev) {
|
||||||
|
ret = device_detect(dev);
|
||||||
|
if (ret && ret != -ENOSYS && option_error)
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (argc == optind)
|
if (argc == optind)
|
||||||
return COMMAND_ERROR_USAGE;
|
return COMMAND_ERROR_USAGE;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue