Selecting the CONFIG_SYS_CONSOLE_ENV_OVERWRITE option actually prevents the
CONFIG_USB_KEYBOARD option from working as expected, i.e. USB keyboards end
up not working as console inputs when "usbkbd" is properly specified as part
of the value of the "stdin" environment variable.  Describe this clearly in
the two relevant Kconfig files, to prevent any possible confusion.

In more detail, the console_init_r() function ends up overwriting the "stdin"
environment variable so it contains only the devices available at that point
(which doesn't include "usbkbd"), while the "usb start" operation is performed
much later, at which point the probe_usb_keyboard() function cannot assign any
discovered USB keyboards to the console because "usbkbd" is no longer present
in the "stdin" environment variable.

Reported-by: Dang Huynh <danc...@riseup.net>
Co-developed-by: Piotr Zalewski <pz010001011...@proton.me>
Signed-off-by: Piotr Zalewski <pz010001011...@proton.me>
Signed-off-by: Dragan Simic <dsi...@manjaro.org>
---
 common/Kconfig      | 7 +++++++
 drivers/usb/Kconfig | 3 ++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/common/Kconfig b/common/Kconfig
index 0e8c44f3f745..267a646e9d4e 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -297,6 +297,13 @@ config SYS_CONSOLE_ENV_OVERWRITE
          start-up (after relocation). This causes the environment to be
          updated to match the console devices actually chosen.
 
+         When selected, USB keyboards will not be registered as console
+         input devices regardless of the proper environment settings, i.e.
+         despite properly having "usbkbd" as part of the value of the
+         "stdin" environment variable.
+
+         If unsure, say N.
+
 config SYS_CONSOLE_INFO_QUIET
        bool "Don't display the console devices on boot"
        help
diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig
index 960b6a906ac4..4d52e382f570 100644
--- a/drivers/usb/Kconfig
+++ b/drivers/usb/Kconfig
@@ -106,7 +106,8 @@ config USB_KEYBOARD
        select SYS_STDIO_DEREGISTER
        ---help---
          Say Y here if you want to use a USB keyboard for U-Boot command line
-         input.
+         input.  Also say N for SYS_CONSOLE_ENV_OVERWRITE and see the help for
+         that option for more details.
 
 config USB_ONBOARD_HUB
        bool "Onboard USB hub support"

Reply via email to