* [U-Boot] [PATCH 1/2] hush: Pull out U-Boot prompt display and read functionality
@ 2016-01-27 3:47 Marek Vasut
2016-01-27 3:47 ` [U-Boot] [PATCH 2/2] hush: Add rudimentary support for PS1 and PS2 Marek Vasut
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: Marek Vasut @ 2016-01-27 3:47 UTC (permalink / raw)
To: u-boot
Pull the code which displays U-Boot prompt and reads the command line
into a separate function. No functional change.
Signed-off-by: Marek Vasut <marex@denx.de>
---
common/cli_hush.c | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)
diff --git a/common/cli_hush.c b/common/cli_hush.c
index 2fbfdbe..cbaf22e 100644
--- a/common/cli_hush.c
+++ b/common/cli_hush.c
@@ -974,6 +974,20 @@ static inline void setup_prompt_string(int promptmode, char **prompt_str)
}
#endif
+#ifdef __U_BOOT__
+static int uboot_cli_readline(struct in_str *i)
+{
+ char *prompt;
+
+ if (i->promptmode == 1)
+ prompt = CONFIG_SYS_PROMPT;
+ else
+ prompt = CONFIG_SYS_PROMPT_HUSH_PS2;
+
+ return cli_readline(prompt);
+}
+#endif
+
static void get_user_input(struct in_str *i)
{
#ifndef __U_BOOT__
@@ -1003,11 +1017,8 @@ static void get_user_input(struct in_str *i)
bootretry_reset_cmd_timeout();
i->__promptme = 1;
- if (i->promptmode == 1) {
- n = cli_readline(CONFIG_SYS_PROMPT);
- } else {
- n = cli_readline(CONFIG_SYS_PROMPT_HUSH_PS2);
- }
+ n = uboot_cli_readline(i);
+
#ifdef CONFIG_BOOT_RETRY_TIME
if (n == -2) {
puts("\nTimeout waiting for command\n");
--
2.1.4
^ permalink raw reply related [flat|nested] 8+ messages in thread* [U-Boot] [PATCH 2/2] hush: Add rudimentary support for PS1 and PS2
2016-01-27 3:47 [U-Boot] [PATCH 1/2] hush: Pull out U-Boot prompt display and read functionality Marek Vasut
@ 2016-01-27 3:47 ` Marek Vasut
2016-01-27 6:37 ` Heiko Schocher
` (2 more replies)
2016-01-27 6:34 ` [U-Boot] [PATCH 1/2] hush: Pull out U-Boot prompt display and read functionality Heiko Schocher
` (2 subsequent siblings)
3 siblings, 3 replies; 8+ messages in thread
From: Marek Vasut @ 2016-01-27 3:47 UTC (permalink / raw)
To: u-boot
Add trivial support for changing the U-Boot command prompt string
by setting PS1 and PS2 environment variables. Only static variables
are supported.
Signed-off-by: Marek Vasut <marex@denx.de>
---
README | 8 ++++++++
common/cli_hush.c | 10 ++++++++++
2 files changed, 18 insertions(+)
diff --git a/README b/README
index ece4793..8fb25c6 100644
--- a/README
+++ b/README
@@ -2894,6 +2894,14 @@ CBFS (Coreboot Filesystem) support
Enable editing and History functions for interactive
command line input operations
+- Command Line PS1/PS2 support:
+ CONFIG_CMDLINE_PS_SUPPORT
+
+ Enable support for changing the command prompt string
+ at run-time. Only static string is supported so far.
+ The string is obtained from environment variables PS1
+ and PS2.
+
- Default Environment:
CONFIG_EXTRA_ENV_SETTINGS
diff --git a/common/cli_hush.c b/common/cli_hush.c
index cbaf22e..00861e2 100644
--- a/common/cli_hush.c
+++ b/common/cli_hush.c
@@ -978,12 +978,22 @@ static inline void setup_prompt_string(int promptmode, char **prompt_str)
static int uboot_cli_readline(struct in_str *i)
{
char *prompt;
+ char __maybe_unused *ps_prompt = NULL;
if (i->promptmode == 1)
prompt = CONFIG_SYS_PROMPT;
else
prompt = CONFIG_SYS_PROMPT_HUSH_PS2;
+#ifdef CONFIG_CMDLINE_PS_SUPPORT
+ if (i->promptmode == 1)
+ ps_prompt = getenv("PS1");
+ else
+ ps_prompt = getenv("PS2");
+ if (ps_prompt)
+ prompt = ps_prompt;
+#endif
+
return cli_readline(prompt);
}
#endif
--
2.1.4
^ permalink raw reply related [flat|nested] 8+ messages in thread* [U-Boot] [PATCH 2/2] hush: Add rudimentary support for PS1 and PS2
2016-01-27 3:47 ` [U-Boot] [PATCH 2/2] hush: Add rudimentary support for PS1 and PS2 Marek Vasut
@ 2016-01-27 6:37 ` Heiko Schocher
2016-01-27 22:53 ` Simon Glass
2016-02-08 20:46 ` [U-Boot] [U-Boot, " Tom Rini
2 siblings, 0 replies; 8+ messages in thread
From: Heiko Schocher @ 2016-01-27 6:37 UTC (permalink / raw)
To: u-boot
Hello Marek,
Am 27.01.2016 um 04:47 schrieb Marek Vasut:
> Add trivial support for changing the U-Boot command prompt string
> by setting PS1 and PS2 environment variables. Only static variables
> are supported.
>
> Signed-off-by: Marek Vasut <marex@denx.de>
> ---
> README | 8 ++++++++
> common/cli_hush.c | 10 ++++++++++
> 2 files changed, 18 insertions(+)
Nice!
Reviewed-by: Heiko Schocher <hs@denx.de>
bye,
Heiko
>
> diff --git a/README b/README
> index ece4793..8fb25c6 100644
> --- a/README
> +++ b/README
> @@ -2894,6 +2894,14 @@ CBFS (Coreboot Filesystem) support
> Enable editing and History functions for interactive
> command line input operations
>
> +- Command Line PS1/PS2 support:
> + CONFIG_CMDLINE_PS_SUPPORT
> +
> + Enable support for changing the command prompt string
> + at run-time. Only static string is supported so far.
> + The string is obtained from environment variables PS1
> + and PS2.
> +
> - Default Environment:
> CONFIG_EXTRA_ENV_SETTINGS
>
> diff --git a/common/cli_hush.c b/common/cli_hush.c
> index cbaf22e..00861e2 100644
> --- a/common/cli_hush.c
> +++ b/common/cli_hush.c
> @@ -978,12 +978,22 @@ static inline void setup_prompt_string(int promptmode, char **prompt_str)
> static int uboot_cli_readline(struct in_str *i)
> {
> char *prompt;
> + char __maybe_unused *ps_prompt = NULL;
>
> if (i->promptmode == 1)
> prompt = CONFIG_SYS_PROMPT;
> else
> prompt = CONFIG_SYS_PROMPT_HUSH_PS2;
>
> +#ifdef CONFIG_CMDLINE_PS_SUPPORT
> + if (i->promptmode == 1)
> + ps_prompt = getenv("PS1");
> + else
> + ps_prompt = getenv("PS2");
> + if (ps_prompt)
> + prompt = ps_prompt;
> +#endif
> +
> return cli_readline(prompt);
> }
> #endif
>
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
^ permalink raw reply [flat|nested] 8+ messages in thread* [U-Boot] [PATCH 2/2] hush: Add rudimentary support for PS1 and PS2
2016-01-27 3:47 ` [U-Boot] [PATCH 2/2] hush: Add rudimentary support for PS1 and PS2 Marek Vasut
2016-01-27 6:37 ` Heiko Schocher
@ 2016-01-27 22:53 ` Simon Glass
2016-02-08 20:46 ` [U-Boot] [U-Boot, " Tom Rini
2 siblings, 0 replies; 8+ messages in thread
From: Simon Glass @ 2016-01-27 22:53 UTC (permalink / raw)
To: u-boot
On 26 January 2016 at 20:47, Marek Vasut <marex@denx.de> wrote:
> Add trivial support for changing the U-Boot command prompt string
> by setting PS1 and PS2 environment variables. Only static variables
> are supported.
>
> Signed-off-by: Marek Vasut <marex@denx.de>
> ---
> README | 8 ++++++++
> common/cli_hush.c | 10 ++++++++++
> 2 files changed, 18 insertions(+)
>
Reviewed-by: Simon Glass <sjg@chromium.org>
^ permalink raw reply [flat|nested] 8+ messages in thread
* [U-Boot] [U-Boot, 2/2] hush: Add rudimentary support for PS1 and PS2
2016-01-27 3:47 ` [U-Boot] [PATCH 2/2] hush: Add rudimentary support for PS1 and PS2 Marek Vasut
2016-01-27 6:37 ` Heiko Schocher
2016-01-27 22:53 ` Simon Glass
@ 2016-02-08 20:46 ` Tom Rini
2 siblings, 0 replies; 8+ messages in thread
From: Tom Rini @ 2016-02-08 20:46 UTC (permalink / raw)
To: u-boot
On Wed, Jan 27, 2016 at 04:47:55AM +0100, Marek Vasut wrote:
> Add trivial support for changing the U-Boot command prompt string
> by setting PS1 and PS2 environment variables. Only static variables
> are supported.
>
> Signed-off-by: Marek Vasut <marex@denx.de>
> Reviewed-by: Heiko Schocher <hs@denx.de>
> Reviewed-by: Simon Glass <sjg@chromium.org>
Applied to u-boot/master, thanks!
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160208/1f556fc6/attachment.sig>
^ permalink raw reply [flat|nested] 8+ messages in thread
* [U-Boot] [PATCH 1/2] hush: Pull out U-Boot prompt display and read functionality
2016-01-27 3:47 [U-Boot] [PATCH 1/2] hush: Pull out U-Boot prompt display and read functionality Marek Vasut
2016-01-27 3:47 ` [U-Boot] [PATCH 2/2] hush: Add rudimentary support for PS1 and PS2 Marek Vasut
@ 2016-01-27 6:34 ` Heiko Schocher
2016-01-27 22:53 ` Simon Glass
2016-02-08 20:46 ` [U-Boot] [U-Boot, " Tom Rini
3 siblings, 0 replies; 8+ messages in thread
From: Heiko Schocher @ 2016-01-27 6:34 UTC (permalink / raw)
To: u-boot
Hello Marek,
Am 27.01.2016 um 04:47 schrieb Marek Vasut:
> Pull the code which displays U-Boot prompt and reads the command line
> into a separate function. No functional change.
>
> Signed-off-by: Marek Vasut <marex@denx.de>
> ---
> common/cli_hush.c | 21 ++++++++++++++++-----
> 1 file changed, 16 insertions(+), 5 deletions(-)
Reviewed-by: Heiko Schocher <hs@denx.de>
bye,
Heiko
>
> diff --git a/common/cli_hush.c b/common/cli_hush.c
> index 2fbfdbe..cbaf22e 100644
> --- a/common/cli_hush.c
> +++ b/common/cli_hush.c
> @@ -974,6 +974,20 @@ static inline void setup_prompt_string(int promptmode, char **prompt_str)
> }
> #endif
>
> +#ifdef __U_BOOT__
> +static int uboot_cli_readline(struct in_str *i)
> +{
> + char *prompt;
> +
> + if (i->promptmode == 1)
> + prompt = CONFIG_SYS_PROMPT;
> + else
> + prompt = CONFIG_SYS_PROMPT_HUSH_PS2;
> +
> + return cli_readline(prompt);
> +}
> +#endif
> +
> static void get_user_input(struct in_str *i)
> {
> #ifndef __U_BOOT__
> @@ -1003,11 +1017,8 @@ static void get_user_input(struct in_str *i)
>
> bootretry_reset_cmd_timeout();
> i->__promptme = 1;
> - if (i->promptmode == 1) {
> - n = cli_readline(CONFIG_SYS_PROMPT);
> - } else {
> - n = cli_readline(CONFIG_SYS_PROMPT_HUSH_PS2);
> - }
> + n = uboot_cli_readline(i);
> +
> #ifdef CONFIG_BOOT_RETRY_TIME
> if (n == -2) {
> puts("\nTimeout waiting for command\n");
>
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
^ permalink raw reply [flat|nested] 8+ messages in thread* [U-Boot] [PATCH 1/2] hush: Pull out U-Boot prompt display and read functionality
2016-01-27 3:47 [U-Boot] [PATCH 1/2] hush: Pull out U-Boot prompt display and read functionality Marek Vasut
2016-01-27 3:47 ` [U-Boot] [PATCH 2/2] hush: Add rudimentary support for PS1 and PS2 Marek Vasut
2016-01-27 6:34 ` [U-Boot] [PATCH 1/2] hush: Pull out U-Boot prompt display and read functionality Heiko Schocher
@ 2016-01-27 22:53 ` Simon Glass
2016-02-08 20:46 ` [U-Boot] [U-Boot, " Tom Rini
3 siblings, 0 replies; 8+ messages in thread
From: Simon Glass @ 2016-01-27 22:53 UTC (permalink / raw)
To: u-boot
On 26 January 2016 at 20:47, Marek Vasut <marex@denx.de> wrote:
> Pull the code which displays U-Boot prompt and reads the command line
> into a separate function. No functional change.
>
> Signed-off-by: Marek Vasut <marex@denx.de>
> ---
> common/cli_hush.c | 21 ++++++++++++++++-----
> 1 file changed, 16 insertions(+), 5 deletions(-)
Reviewed-by: Simon Glass <sjg@chromium.org>
^ permalink raw reply [flat|nested] 8+ messages in thread
* [U-Boot] [U-Boot, 1/2] hush: Pull out U-Boot prompt display and read functionality
2016-01-27 3:47 [U-Boot] [PATCH 1/2] hush: Pull out U-Boot prompt display and read functionality Marek Vasut
` (2 preceding siblings ...)
2016-01-27 22:53 ` Simon Glass
@ 2016-02-08 20:46 ` Tom Rini
3 siblings, 0 replies; 8+ messages in thread
From: Tom Rini @ 2016-02-08 20:46 UTC (permalink / raw)
To: u-boot
On Wed, Jan 27, 2016 at 04:47:54AM +0100, Marek Vasut wrote:
> Pull the code which displays U-Boot prompt and reads the command line
> into a separate function. No functional change.
>
> Signed-off-by: Marek Vasut <marex@denx.de>
> Reviewed-by: Heiko Schocher <hs@denx.de>
> Reviewed-by: Simon Glass <sjg@chromium.org>
Applied to u-boot/master, thanks!
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160208/c34d9470/attachment.sig>
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2016-02-08 20:46 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-27 3:47 [U-Boot] [PATCH 1/2] hush: Pull out U-Boot prompt display and read functionality Marek Vasut
2016-01-27 3:47 ` [U-Boot] [PATCH 2/2] hush: Add rudimentary support for PS1 and PS2 Marek Vasut
2016-01-27 6:37 ` Heiko Schocher
2016-01-27 22:53 ` Simon Glass
2016-02-08 20:46 ` [U-Boot] [U-Boot, " Tom Rini
2016-01-27 6:34 ` [U-Boot] [PATCH 1/2] hush: Pull out U-Boot prompt display and read functionality Heiko Schocher
2016-01-27 22:53 ` Simon Glass
2016-02-08 20:46 ` [U-Boot] [U-Boot, " Tom Rini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox