}
#endif /* CONFIG_USB_STORAGE */
+static int do_usb_stop_keyboard(void)
+{
+#ifdef CONFIG_USB_KEYBOARD
+ if (usb_kbd_deregister() != 0) {
+ printf("USB not stopped: usbkbd still using USB\n");
+ return 1;
+ }
+#endif
+ return 0;
+}
/******************************************************************************
* usb command intepreter
if ((strncmp(argv[1], "reset", 5) == 0) ||
(strncmp(argv[1], "start", 5) == 0)) {
bootstage_mark_name(BOOTSTAGE_ID_USB_START, "usb_start");
+ if (do_usb_stop_keyboard() != 0)
+ return 1;
usb_stop();
printf("(Re)start USB...\n");
if (usb_init() >= 0) {
return 0;
}
if (strncmp(argv[1], "stop", 4) == 0) {
-#ifdef CONFIG_USB_KEYBOARD
- if (argc == 2) {
- if (usb_kbd_deregister() != 0) {
- printf("USB not stopped: usbkbd still"
- " using USB\n");
- return 1;
- }
- } else {
- /* forced stop, switch console in to serial */
+ if (argc != 2)
console_assign(stdin, "serial");
- usb_kbd_deregister();
- }
-#endif
+ if (do_usb_stop_keyboard() != 0)
+ return 1;
printf("stopping USB..\n");
usb_stop();
return 0;