mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] console_countdown: Add CR as valid return key
@ 2020-07-16 13:27 Jules Maselbas
  2020-08-10 19:46 ` Sascha Hauer
  0 siblings, 1 reply; 4+ messages in thread
From: Jules Maselbas @ 2020-07-16 13:27 UTC (permalink / raw)
  To: Barebox List; +Cc: Jules Maselbas

Now both LF ('\n') and CR ('\r') are valid keys to abort
console_countdown when using CONSOLE_COUNTDOWN_RETURN flag.

Signed-off-by: Jules Maselbas <jmaselbas@kalray.eu>
---
 common/console_countdown.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/console_countdown.c b/common/console_countdown.c
index 74dc38279..b92948f50 100644
--- a/common/console_countdown.c
+++ b/common/console_countdown.c
@@ -64,7 +64,7 @@ int console_countdown(int timeout_s, unsigned flags, const char *keys,
 					goto out;
 				if (flags & CONSOLE_COUNTDOWN_ANYKEY)
 					goto out;
-				if (flags & CONSOLE_COUNTDOWN_RETURN && key == '\n')
+				if (flags & CONSOLE_COUNTDOWN_RETURN && (key == '\n' || key == '\r'))
 					goto out;
 				if (flags & CONSOLE_COUNTDOWN_CTRLC && key == 3)
 					goto out;
-- 
2.17.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH] console_countdown: Add CR as valid return key
  2020-07-16 13:27 [PATCH] console_countdown: Add CR as valid return key Jules Maselbas
@ 2020-08-10 19:46 ` Sascha Hauer
  2020-08-11  9:29   ` Jules Maselbas
  0 siblings, 1 reply; 4+ messages in thread
From: Sascha Hauer @ 2020-08-10 19:46 UTC (permalink / raw)
  To: Jules Maselbas; +Cc: Barebox List

Hi Jules,

On Thu, Jul 16, 2020 at 03:27:53PM +0200, Jules Maselbas wrote:
> Now both LF ('\n') and CR ('\r') are valid keys to abort
> console_countdown when using CONSOLE_COUNTDOWN_RETURN flag.

I have no problem with this change, but out of curiosity: In which case
do you need it?

Regards,
 Sascha

> 
> Signed-off-by: Jules Maselbas <jmaselbas@kalray.eu>
> ---
>  common/console_countdown.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/common/console_countdown.c b/common/console_countdown.c
> index 74dc38279..b92948f50 100644
> --- a/common/console_countdown.c
> +++ b/common/console_countdown.c
> @@ -64,7 +64,7 @@ int console_countdown(int timeout_s, unsigned flags, const char *keys,
>  					goto out;
>  				if (flags & CONSOLE_COUNTDOWN_ANYKEY)
>  					goto out;
> -				if (flags & CONSOLE_COUNTDOWN_RETURN && key == '\n')
> +				if (flags & CONSOLE_COUNTDOWN_RETURN && (key == '\n' || key == '\r'))
>  					goto out;
>  				if (flags & CONSOLE_COUNTDOWN_CTRLC && key == 3)
>  					goto out;
> -- 
> 2.17.1
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH] console_countdown: Add CR as valid return key
  2020-08-10 19:46 ` Sascha Hauer
@ 2020-08-11  9:29   ` Jules Maselbas
  2020-08-11 11:24     ` Sascha Hauer
  0 siblings, 1 reply; 4+ messages in thread
From: Jules Maselbas @ 2020-08-11  9:29 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: Barebox List

Hi Sascha,

> I have no problem with this change, but out of curiosity: In which case
> do you need it?
I am using minicom to communicate with barebox through an UART interface.
It seems that minicom is sending an carriage return when the enter key
is pressed.

I know there is the termios/stty option `ocrnl` to convert CR to LF but
I didn't found a way to do the same in minicom, there is the `Add linefeed`
option but it doesn't work...

Maybe I am missing somthing but I think it is better if both CR and LF
are accepted, this way no configuration is required if the tty interface
only send LF.


Jules

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH] console_countdown: Add CR as valid return key
  2020-08-11  9:29   ` Jules Maselbas
@ 2020-08-11 11:24     ` Sascha Hauer
  0 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2020-08-11 11:24 UTC (permalink / raw)
  To: Jules Maselbas; +Cc: Barebox List

On Tue, Aug 11, 2020 at 11:29:46AM +0200, Jules Maselbas wrote:
> Hi Sascha,
> 
> > I have no problem with this change, but out of curiosity: In which case
> > do you need it?
> I am using minicom to communicate with barebox through an UART interface.
> It seems that minicom is sending an carriage return when the enter key
> is pressed.

You could give microcom a try, see https://github.com/pengutronix/microcom.
It's also contained in Debian/Ubuntu. Instead of having its own terminal
emulation it just sends the characters through to your existing
terminal.

Anyway, when it helps to better work with minicom: Applied, thanks

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

end of thread, other threads:[~2020-08-11 11:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-16 13:27 [PATCH] console_countdown: Add CR as valid return key Jules Maselbas
2020-08-10 19:46 ` Sascha Hauer
2020-08-11  9:29   ` Jules Maselbas
2020-08-11 11:24     ` Sascha Hauer

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