usb: kbd: Don't fail with iomux
PATCH 1/1 usb: kbd: Don't fail with iomux
stdin might not be set, which would cause iomux_doenv() to fail therefore causing probe_usb_keyboard() to fail. Furthermore if we do have iomux enabled, the sensible thing (in terms of user experience) would be to simply add ourselves to the list of stdin devices.
This fixes an issue with usbkbd on dragonboard410c with distro- bootcmd, where stdin is not set (so stdinname is null).
---
Somehow this patch was dropped on the floor. I don't remember which version # this is up to, search the list if you care. But this is the latest. I only noticed it was missing because u-boot crashes when you boot with usb-keyboard plugged in (at least on db410c) without it. So someone please apply this patch before it gets lost again.
common/usb_kbd.c | 46 +++++++++++++++++++++++++++++++--------------- include/console.h | 2 -- 2 files changed, 31 insertions(+), 17 deletions(-)
common/usb_kbd.c +31 -15
@@ -516,23 +516,39 @@ static int probe_usb_keyboard(struct usb_device *dev)return error; stdinname =env_get ("stdin" ); -#if CONFIG_IS_ENABLED (CONSOLE_MUX ) - error =iomux_doenv (stdin, stdinname); -if (error) -return error; -#else -/* Check if this is the standard input device. */ -if (strcmp (stdinname,DEVNAME )) -return 1 ; +if (CONFIG_IS_ENABLED (CONSOLE_MUX )) { +char *devname =DEVNAME ; +char *newstdin =NULL ; +/* +* stdin might not be set yet.. either way, with console- +* mux the sensible thing to do is add ourselves to the +* list of stdio devices: +*/ +if (stdinname && !strstr (stdinname,DEVNAME )) { + newstdin =malloc (strlen (stdinname) + +strlen ("," DEVNAME ) +1 ); +sprintf (newstdin,"%s," DEVNAME , stdinname); + stdinname = newstdin; + }else if (!stdinname) { + stdinname = devname; + } + error =iomux_doenv (stdin, stdinname); +free (newstdin); +if (error) +return error; + }else { +/* Check if this is the standard input device. */ +if (strcmp (stdinname,DEVNAME )) +return 1 ; -/* Reassign the console */ -if (overwrite_console ()) -return 1 ; +/* Reassign the console */ +if (overwrite_console ()) +return 1 ; - error =console_assign (stdin,DEVNAME ); -if (error) -return error; -#endif + error =console_assign (stdin,DEVNAME ); +if (error) +return error; + }return 0 ; }
include/console.h +0 -2
@@ -57,8 +57,6 @@ int console_announce_r(void);/* * CONSOLE multiplexing. */ -#ifdef CONFIG_CONSOLE_MUX #include <iomux.h> -#endif #endif
Signature · 1 line
2.13.5
PATCH 1/1 usb: kbd: Don't fail with iomux
Quoted 9 lines · Rob Clark
stdin might not be set, which would cause
iomux_doenv()to fail therefore causingprobe_usb_keyboard()to fail. Furthermore if we do have iomux enabled, the sensible thing (in terms of user experience) would be to simply add ourselves to the list of stdin devices.This fixes an issue with usbkbd on dragonboard410c with distro- bootcmd, where stdin is not set (so stdinname is null).
Signed-off-by Rob Clark <[email protected]>
Tested on RPi3 and a couple of other devices.
Quoted 91 lines
---
Somehow this patch was dropped on the floor. I don't remember which version # this is up to, search the list if you care. But this is the latest. I only noticed it was missing because u-boot crashes when you boot with usb-keyboard plugged in (at least on db410c) without it. So someone please apply this patch before it gets lost again.common/usb_kbd.c | 46 +++++++++++++++++++++++++++++++--------------- include/console.h | 2 -- 2 files changed, 31 insertions(+), 17 deletions(-)common/usb_kbd.c +31
-15@@ -516,23 +516,39 @@ static int probe_usb_keyboard(struct usb_device *dev)return error; stdinname =env_get ("stdin" ); -#if CONFIG_IS_ENABLED (CONSOLE_MUX ) - error =iomux_doenv (stdin, stdinname); -if (error) -return error; -#else -/* Check if this is the standard input device. */ -if (strcmp (stdinname,DEVNAME )) -return 1 ; +if (CONFIG_IS_ENABLED (CONSOLE_MUX )) { +char *devname =DEVNAME ; +char *newstdin =NULL ; +/* +* stdin might not be set yet.. either way, with console- +* mux the sensible thing to do is add ourselves to the +* list of stdio devices: +*/ +if (stdinname && !strstr (stdinname,DEVNAME )) { + newstdin =malloc (strlen (stdinname) + +strlen ("," DEVNAME ) +1 ); +sprintf (newstdin,"%s," DEVNAME , stdinname); + stdinname = newstdin; + }else if (!stdinname) { + stdinname = devname; + } + error =iomux_doenv (stdin, stdinname); +free (newstdin); +if (error) +return error; + }else { +/* Check if this is the standard input device. */ +if (strcmp (stdinname,DEVNAME )) +return 1 ; -/* Reassign the console */ -if (overwrite_console ()) -return 1 ; +/* Reassign the console */ +if (overwrite_console ()) +return 1 ; - error =console_assign (stdin,DEVNAME ); -if (error) -return error; -#endif + error =console_assign (stdin,DEVNAME ); +if (error) +return error; + }return 0 ; }include/console.h +0
-3@@ -57,8 +57,6 @@ int console_announce_r(void);/* * CONSOLE multiplexing. */ -#ifdef CONFIG_CONSOLE_MUX #include <iomux.h> -#endif #endif --2.13.5
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot
PATCH 1/1 usb: kbd: Don't fail with iomux
In reply to Rob ClarkQuoted 17 lines · Rob Clark
stdin might not be set, which would cause
iomux_doenv()to fail therefore causingprobe_usb_keyboard()to fail. Furthermore if we do have iomux enabled, the sensible thing (in terms of user experience) would be to simply add ourselves to the list of stdin devices.This fixes an issue with usbkbd on dragonboard410c with distro- bootcmd, where stdin is not set (so stdinname is null).
Signed-off-by Rob Clark <[email protected]>---
Somehow this patch was dropped on the floor. I don't remember which version # this is up to, search the list if you care. But this is the latest. I only noticed it was missing because u-boot crashes when you boot with usb-keyboard plugged in (at least on db410c) without it. So someone please apply this patch before it gets lost again.
Quoted 4 lines
common/usb_kbd.c | 46 +++++++++++++++++++++++++++++++--------------- include/console.h | 2 -- 2 files changed, 31 insertions(+), 17 deletions(-)
PATCH 1/1 usb: kbd: Don't fail with iomux
In reply to Rob Clark+Tom
Quoted 17 lines · Rob Clark
stdin might not be set, which would cause
iomux_doenv()to fail therefore causingprobe_usb_keyboard()to fail. Furthermore if we do have iomux enabled, the sensible thing (in terms of user experience) would be to simply add ourselves to the list of stdin devices.This fixes an issue with usbkbd on dragonboard410c with distro- bootcmd, where stdin is not set (so stdinname is null).
Signed-off-by Rob Clark <[email protected]>---
Somehow this patch was dropped on the floor. I don't remember which version # this is up to, search the list if you care. But this is the latest. I only noticed it was missing because u-boot crashes when you boot with usb-keyboard plugged in (at least on db410c) without it. So someone please apply this patch before it gets lost again.
Quoted 3 lines
common/usb_kbd.c | 46 +++++++++++++++++++++++++++++++--------------- include/console.h | 2 -- 2 files changed, 31 insertions(+), 17 deletions(-)