mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-31 03:21:32 +00:00
Prevent USB commands from working when USB is stopped.
This commit is contained in:
parent
7455af41d1
commit
e51aae3829
3 changed files with 12 additions and 0 deletions
|
@ -2,6 +2,8 @@
|
||||||
Changes since U-Boot 1.1.4:
|
Changes since U-Boot 1.1.4:
|
||||||
======================================================================
|
======================================================================
|
||||||
|
|
||||||
|
* Prevent USB commands from working when USB is stopped.
|
||||||
|
|
||||||
* Add rudimentary handling of alternate settings of USB interfaces.
|
* Add rudimentary handling of alternate settings of USB interfaces.
|
||||||
This is in order to fix issues with some USB sticks or knives timing
|
This is in order to fix issues with some USB sticks or knives timing
|
||||||
out during initialisation. Some code readability improvements.
|
out during initialisation. Some code readability improvements.
|
||||||
|
|
|
@ -444,6 +444,7 @@ int do_usb (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
struct usb_device *dev = NULL;
|
struct usb_device *dev = NULL;
|
||||||
|
extern char usb_started;
|
||||||
#ifdef CONFIG_USB_STORAGE
|
#ifdef CONFIG_USB_STORAGE
|
||||||
block_dev_desc_t *stor_dev;
|
block_dev_desc_t *stor_dev;
|
||||||
#endif
|
#endif
|
||||||
|
@ -477,6 +478,10 @@ int do_usb (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||||
usb_stop();
|
usb_stop();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
if (!usb_started) {
|
||||||
|
printf("USB is stopped. Please issue 'usb start' first.\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
if (strncmp(argv[1],"tree",4) == 0) {
|
if (strncmp(argv[1],"tree",4) == 0) {
|
||||||
printf("\nDevice Tree:\n");
|
printf("\nDevice Tree:\n");
|
||||||
usb_show_tree(usb_get_dev_index(0));
|
usb_show_tree(usb_get_dev_index(0));
|
||||||
|
|
|
@ -72,6 +72,8 @@ static int running;
|
||||||
static int asynch_allowed;
|
static int asynch_allowed;
|
||||||
static struct devrequest setup_packet;
|
static struct devrequest setup_packet;
|
||||||
|
|
||||||
|
char usb_started; /* flag for the started/stopped USB status */
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* some forward declerations...
|
* some forward declerations...
|
||||||
*/
|
*/
|
||||||
|
@ -110,10 +112,12 @@ int usb_init(void)
|
||||||
printf("scanning bus for devices... ");
|
printf("scanning bus for devices... ");
|
||||||
running=1;
|
running=1;
|
||||||
usb_scan_devices();
|
usb_scan_devices();
|
||||||
|
usb_started = 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
printf("Error, couldn't init Lowlevel part\n");
|
printf("Error, couldn't init Lowlevel part\n");
|
||||||
|
usb_started = 0;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -124,6 +128,7 @@ int usb_init(void)
|
||||||
int usb_stop(void)
|
int usb_stop(void)
|
||||||
{
|
{
|
||||||
asynch_allowed=1;
|
asynch_allowed=1;
|
||||||
|
usb_started = 0;
|
||||||
usb_hub_reset();
|
usb_hub_reset();
|
||||||
return usb_lowlevel_stop();
|
return usb_lowlevel_stop();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue