diff mbox

[U-Boot] config_distro_bootcmd: Avoid scanning usb twice (under some circumstances)

Message ID 1416509997-6536-1-git-send-email-hdegoede@redhat.com
State Superseded
Delegated to: Hans de Goede
Headers show

Commit Message

Hans de Goede Nov. 20, 2014, 6:59 p.m. UTC
When using usb-keyboard support, the preboot env variable must be set to a
command to scan usb, so that the keyboard is available to interrupt autoboot.

The logical command to add when using config_distro_bootcmd.h is
"run usb_init", as that does a "setenv usb_need_init false" which should avoid
a second scan when booting from usb.

However this does not work because config_distro_bootcmd sets
bootcmd to "setenv usb_need_init; ...".

This is not necessary "if ${usb_need_init}" will evaluate to true just as well
if usb_need_init is not set at all. So drop the BOOTENV_SET_USB_NEED_INIT
macro and calling of it, thereby fixing the double usb-scan.

While at it do the same for scsi_need_init which was modelled after the usb
code.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 include/config_distro_bootcmd.h | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

Comments

Hans de Goede Nov. 23, 2014, 11:03 a.m. UTC | #1
Hi,

On 11/20/2014 07:59 PM, Hans de Goede wrote:
> When using usb-keyboard support, the preboot env variable must be set to a
> command to scan usb, so that the keyboard is available to interrupt autoboot.
> 
> The logical command to add when using config_distro_bootcmd.h is
> "run usb_init", as that does a "setenv usb_need_init false" which should avoid
> a second scan when booting from usb.
> 
> However this does not work because config_distro_bootcmd sets
> bootcmd to "setenv usb_need_init; ...".
> 
> This is not necessary "if ${usb_need_init}" will evaluate to true just as well
> if usb_need_init is not set at all. So drop the BOOTENV_SET_USB_NEED_INIT
> macro and calling of it, thereby fixing the double usb-scan.
> 
> While at it do the same for scsi_need_init which was modelled after the usb
> code.

Self-NAK, this breaks things after an "env save" command, as then the env
saved will contain usb_need_init=false, and usb will no longer get scanned.

I'll look into a different fix.

Regards,

Hans
diff mbox

Patch

diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h
index be616e8..2b515bc 100644
--- a/include/config_distro_bootcmd.h
+++ b/include/config_distro_bootcmd.h
@@ -54,7 +54,6 @@ 
 
 #ifdef CONFIG_CMD_SCSI
 #define BOOTENV_RUN_SCSI_INIT "run scsi_init; "
-#define BOOTENV_SET_SCSI_NEED_INIT "setenv scsi_need_init; "
 #define BOOTENV_SHARED_SCSI \
 	"scsi_init=" \
 		"if ${scsi_need_init}; then " \
@@ -69,7 +68,6 @@ 
 #define BOOTENV_DEV_NAME_SCSI	BOOTENV_DEV_NAME_BLKDEV
 #else
 #define BOOTENV_RUN_SCSI_INIT
-#define BOOTENV_SET_SCSI_NEED_INIT
 #define BOOTENV_SHARED_SCSI
 #define BOOTENV_DEV_SCSI \
 	BOOT_TARGET_DEVICES_references_SCSI_without_CONFIG_CMD_SCSI
@@ -91,7 +89,6 @@ 
 
 #ifdef CONFIG_CMD_USB
 #define BOOTENV_RUN_USB_INIT "run usb_init; "
-#define BOOTENV_SET_USB_NEED_INIT "setenv usb_need_init; "
 #define BOOTENV_SHARED_USB \
 	"usb_init=" \
 		"if ${usb_need_init}; then " \
@@ -106,7 +103,6 @@ 
 #define BOOTENV_DEV_NAME_USB	BOOTENV_DEV_NAME_BLKDEV
 #else
 #define BOOTENV_RUN_USB_INIT
-#define BOOTENV_SET_USB_NEED_INIT
 #define BOOTENV_SHARED_USB
 #define BOOTENV_DEV_USB \
 	BOOT_TARGET_DEVICES_references_USB_without_CONFIG_CMD_USB
@@ -202,7 +198,7 @@ 
 	\
 	BOOT_TARGET_DEVICES(BOOTENV_DEV)                                  \
 	\
-	"bootcmd=" BOOTENV_SET_USB_NEED_INIT BOOTENV_SET_SCSI_NEED_INIT   \
+	"bootcmd="                                                        \
 		"for target in ${boot_targets}; do "                      \
 			"run bootcmd_${target}; "                         \
 		"done\0"