public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] config_distro_bootcmd: Avoid scanning usb twice (under some circumstances)
@ 2014-11-20 18:59 Hans de Goede
  2014-11-23 11:03 ` [U-Boot] " Hans de Goede
  0 siblings, 1 reply; 2+ messages in thread
From: Hans de Goede @ 2014-11-20 18:59 UTC (permalink / raw)
  To: u-boot

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(-)

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"
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [U-Boot] config_distro_bootcmd: Avoid scanning usb twice (under some circumstances)
  2014-11-20 18:59 [U-Boot] [PATCH] config_distro_bootcmd: Avoid scanning usb twice (under some circumstances) Hans de Goede
@ 2014-11-23 11:03 ` Hans de Goede
  0 siblings, 0 replies; 2+ messages in thread
From: Hans de Goede @ 2014-11-23 11:03 UTC (permalink / raw)
  To: u-boot

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-11-23 11:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-20 18:59 [U-Boot] [PATCH] config_distro_bootcmd: Avoid scanning usb twice (under some circumstances) Hans de Goede
2014-11-23 11:03 ` [U-Boot] " Hans de Goede

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox