mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-22 07:01:39 +00:00
USB Storage, add meaningful return value
This patch changes the "usb storage" command to return success if it finds a USB storage device, otherwise it returns error. Signed-off-by: Markus Klotzbuecher <mk@denx.de>
This commit is contained in:
parent
18e69a35ef
commit
f6b44e0e4d
2 changed files with 7 additions and 5 deletions
|
@ -529,8 +529,7 @@ int do_usb (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strncmp(argv[1], "stor", 4) == 0) {
|
if (strncmp(argv[1], "stor", 4) == 0) {
|
||||||
usb_stor_info();
|
return usb_stor_info();
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strncmp(argv[1],"part",4) == 0) {
|
if (strncmp(argv[1],"part",4) == 0) {
|
||||||
|
|
|
@ -188,17 +188,20 @@ void usb_show_progress(void)
|
||||||
* show info on storage devices; 'usb start/init' must be invoked earlier
|
* show info on storage devices; 'usb start/init' must be invoked earlier
|
||||||
* as we only retrieve structures populated during devices initialization
|
* as we only retrieve structures populated during devices initialization
|
||||||
*/
|
*/
|
||||||
void usb_stor_info(void)
|
int usb_stor_info(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (usb_max_devs > 0)
|
if (usb_max_devs > 0) {
|
||||||
for (i = 0; i < usb_max_devs; i++) {
|
for (i = 0; i < usb_max_devs; i++) {
|
||||||
printf (" Device %d: ", i);
|
printf (" Device %d: ", i);
|
||||||
dev_print(&usb_dev_desc[i]);
|
dev_print(&usb_dev_desc[i]);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
else
|
} else {
|
||||||
printf("No storage devices, perhaps not 'usb start'ed..?\n");
|
printf("No storage devices, perhaps not 'usb start'ed..?\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*********************************************************************************
|
/*********************************************************************************
|
||||||
|
|
Loading…
Add table
Reference in a new issue