mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] OMAP4_USBboot: Change output text formatting
@ 2014-03-22 17:39 Vicente Bergas
  2014-03-24  6:59 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Vicente Bergas @ 2014-03-22 17:39 UTC (permalink / raw)
  To: barebox; +Cc: Vicente Bergas

The basic console used for USBboot has two different formattings,
one for text coming from the host and another for text coming from
the target.
This change makes both formattings readable regardless of the
console background color.

Signed-off-by: Vicente Bergas <vicencb@gmail.com>
---
 scripts/omap4_usbboot/omap4_usbboot.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/scripts/omap4_usbboot/omap4_usbboot.c b/scripts/omap4_usbboot/omap4_usbboot.c
index e521086..0e5abcb 100644
--- a/scripts/omap4_usbboot/omap4_usbboot.c
+++ b/scripts/omap4_usbboot/omap4_usbboot.c
@@ -35,16 +35,17 @@
 #define WHITE   8
 #define RED     1
 #define BLACK   0
-#define FORMAT        "%c[%d;%d;%dm"
-#define TARGET_FORMAT 0x1B, BRIGHT, RED+30, BLACK+40
-#define HOST_FORMAT   0x1B, RESET, WHITE+30, BLACK+40
-#define host_print(fmt, arg...)	printf(FORMAT fmt FORMAT, \
+#define TFORMAT       "%c[%d;%dm"
+#define HFORMAT       "%c[%dm"
+#define TARGET_FORMAT 0x1B, BRIGHT, RED+30
+#define HOST_FORMAT   0x1B, RESET
+#define host_print(fmt, arg...)	printf(HFORMAT fmt TFORMAT, \
 					HOST_FORMAT, ##arg, TARGET_FORMAT)
 
 void panic(struct termios *t_restore)
 {
 	tcsetattr(STDIN_FILENO, TCSANOW, t_restore);
-	printf(FORMAT, HOST_FORMAT);
+	printf(HFORMAT, HOST_FORMAT);
 	exit(1);
 }
 
@@ -354,7 +355,7 @@ int usb_boot(
 	tcgetattr(STDIN_FILENO, &vars.t_restore);
 	tn = vars.t_restore;
 	tn.c_lflag &= ~(ICANON | ECHO);
-	printf(FORMAT, TARGET_FORMAT);
+	printf(TFORMAT, TARGET_FORMAT);
 	tcsetattr(STDIN_FILENO, TCSANOW, &tn);
 	if (pthread_create(&thread, NULL, listenerTask, &vars))
 		host_print("listenerTask failed\n");
@@ -375,7 +376,7 @@ int usb_boot(
 	usb_close(usb);
 	pthread_mutex_destroy(&vars.usb_mutex);
 	tcsetattr(STDIN_FILENO, TCSANOW, &vars.t_restore);
-	printf(FORMAT, HOST_FORMAT);
+	printf(HFORMAT, HOST_FORMAT);
 	return 0;
 }
 
@@ -415,7 +416,7 @@ int main(int argc, char **argv)
 	sz = s.st_size;
 	close(fd);
 	argv++;
-	printf(FORMAT, HOST_FORMAT);
+	printf(HFORMAT, HOST_FORMAT);
 	for (once = 1;;) {
 		usb = usb_open(match_omap4_bootloader);
 		if (usb)
-- 
1.9.1


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

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

* Re: [PATCH] OMAP4_USBboot: Change output text formatting
  2014-03-22 17:39 [PATCH] OMAP4_USBboot: Change output text formatting Vicente Bergas
@ 2014-03-24  6:59 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2014-03-24  6:59 UTC (permalink / raw)
  To: Vicente Bergas; +Cc: barebox

On Sat, Mar 22, 2014 at 05:39:04PM +0000, Vicente Bergas wrote:
> The basic console used for USBboot has two different formattings,
> one for text coming from the host and another for text coming from
> the target.
> This change makes both formattings readable regardless of the
> console background color.
> 
> Signed-off-by: Vicente Bergas <vicencb@gmail.com>

Applied, thanks

Sascha

> ---
>  scripts/omap4_usbboot/omap4_usbboot.c | 17 +++++++++--------
>  1 file changed, 9 insertions(+), 8 deletions(-)
> 
> diff --git a/scripts/omap4_usbboot/omap4_usbboot.c b/scripts/omap4_usbboot/omap4_usbboot.c
> index e521086..0e5abcb 100644
> --- a/scripts/omap4_usbboot/omap4_usbboot.c
> +++ b/scripts/omap4_usbboot/omap4_usbboot.c
> @@ -35,16 +35,17 @@
>  #define WHITE   8
>  #define RED     1
>  #define BLACK   0
> -#define FORMAT        "%c[%d;%d;%dm"
> -#define TARGET_FORMAT 0x1B, BRIGHT, RED+30, BLACK+40
> -#define HOST_FORMAT   0x1B, RESET, WHITE+30, BLACK+40
> -#define host_print(fmt, arg...)	printf(FORMAT fmt FORMAT, \
> +#define TFORMAT       "%c[%d;%dm"
> +#define HFORMAT       "%c[%dm"
> +#define TARGET_FORMAT 0x1B, BRIGHT, RED+30
> +#define HOST_FORMAT   0x1B, RESET
> +#define host_print(fmt, arg...)	printf(HFORMAT fmt TFORMAT, \
>  					HOST_FORMAT, ##arg, TARGET_FORMAT)
>  
>  void panic(struct termios *t_restore)
>  {
>  	tcsetattr(STDIN_FILENO, TCSANOW, t_restore);
> -	printf(FORMAT, HOST_FORMAT);
> +	printf(HFORMAT, HOST_FORMAT);
>  	exit(1);
>  }
>  
> @@ -354,7 +355,7 @@ int usb_boot(
>  	tcgetattr(STDIN_FILENO, &vars.t_restore);
>  	tn = vars.t_restore;
>  	tn.c_lflag &= ~(ICANON | ECHO);
> -	printf(FORMAT, TARGET_FORMAT);
> +	printf(TFORMAT, TARGET_FORMAT);
>  	tcsetattr(STDIN_FILENO, TCSANOW, &tn);
>  	if (pthread_create(&thread, NULL, listenerTask, &vars))
>  		host_print("listenerTask failed\n");
> @@ -375,7 +376,7 @@ int usb_boot(
>  	usb_close(usb);
>  	pthread_mutex_destroy(&vars.usb_mutex);
>  	tcsetattr(STDIN_FILENO, TCSANOW, &vars.t_restore);
> -	printf(FORMAT, HOST_FORMAT);
> +	printf(HFORMAT, HOST_FORMAT);
>  	return 0;
>  }
>  
> @@ -415,7 +416,7 @@ int main(int argc, char **argv)
>  	sz = s.st_size;
>  	close(fd);
>  	argv++;
> -	printf(FORMAT, HOST_FORMAT);
> +	printf(HFORMAT, HOST_FORMAT);
>  	for (once = 1;;) {
>  		usb = usb_open(match_omap4_bootloader);
>  		if (usb)
> -- 
> 1.9.1
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 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] 2+ messages in thread

end of thread, other threads:[~2014-03-24  6:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-22 17:39 [PATCH] OMAP4_USBboot: Change output text formatting Vicente Bergas
2014-03-24  6:59 ` Sascha Hauer

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