]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
usb: kbd: Allow "usb reset" to continue when an usb kbd is used
authorHans de Goede <hdegoede@redhat.com>
Sat, 20 Sep 2014 14:54:38 +0000 (16:54 +0200)
committerMarek Vasut <marex@denx.de>
Mon, 6 Oct 2014 12:50:43 +0000 (14:50 +0200)
Use the new force parameter to make the stdio_deregister succeed, replacing
stdin with a nulldev, and assume that the usb keyboard will come back after
the reset.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
common/cmd_usb.c
common/usb_kbd.c
include/usb.h

index b2aa44c2a724eab626800598f17696261b6f2f57..c192498257fe8f60fed0f41e4c4f97b8fcd0d986 100644 (file)
@@ -430,10 +430,10 @@ static int do_usbboot(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 }
 #endif /* CONFIG_USB_STORAGE */
 
-static int do_usb_stop_keyboard(void)
+static int do_usb_stop_keyboard(int force)
 {
 #ifdef CONFIG_USB_KEYBOARD
-       if (usb_kbd_deregister() != 0) {
+       if (usb_kbd_deregister(force) != 0) {
                printf("USB not stopped: usbkbd still using USB\n");
                return 1;
        }
@@ -460,7 +460,7 @@ static int do_usb(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
        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)
+               if (do_usb_stop_keyboard(1) != 0)
                        return 1;
                usb_stop();
                printf("(Re)start USB...\n");
@@ -482,7 +482,7 @@ static int do_usb(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
        if (strncmp(argv[1], "stop", 4) == 0) {
                if (argc != 2)
                        console_assign(stdin, "serial");
-               if (do_usb_stop_keyboard() != 0)
+               if (do_usb_stop_keyboard(0) != 0)
                        return 1;
                printf("stopping USB..\n");
                usb_stop();
index dcb693d0c3b18102de40cdfa438b99f4ac01223b..fdc083c70cf9952ec000429355b605b2ec4ff43c 100644 (file)
@@ -547,10 +547,10 @@ int drv_usb_kbd_init(void)
 }
 
 /* Deregister the keyboard. */
-int usb_kbd_deregister(void)
+int usb_kbd_deregister(int force)
 {
 #ifdef CONFIG_SYS_STDIO_DEREGISTER
-       int ret = stdio_deregister(DEVNAME, 0);
+       int ret = stdio_deregister(DEVNAME, force);
        if (ret && ret != -ENODEV)
                return ret;
 
index d9fedeeff7de98bcc192fc2b76e561db067010ab..c355fbe4819836a18bcfacd94c592feb612fcdd3 100644 (file)
@@ -216,7 +216,7 @@ int usb_host_eth_scan(int mode);
 #ifdef CONFIG_USB_KEYBOARD
 
 int drv_usb_kbd_init(void);
-int usb_kbd_deregister(void);
+int usb_kbd_deregister(int force);
 
 #endif
 /* routines */