All of lore.kernel.org
 help / color / mirror / Atom feed
From: Robert Millan <rmh@aybabtu.com>
To: The development of GRUB 2 <grub-devel@gnu.org>
Subject: Re: [PATCH] Fixed ieee1275 console
Date: Mon, 1 Oct 2007 20:39:27 +0200	[thread overview]
Message-ID: <20071001183927.GA10233@thorin> (raw)
In-Reply-To: <8a2a06bb0710011114l5cc66483vc27b0b83eb3395e1@mail.gmail.com>

On Mon, Oct 01, 2007 at 08:14:16PM +0200, Marcin Kurek wrote:
> diff -urN grub2.org/include/grub/term.h grub2/include/grub/term.h
> --- grub2.org/include/grub/term.h	2007-07-22 01:32:22.000000000 +0200
> +++ grub2/include/grub/term.h	2007-10-01 19:20:49.734330521 +0200
> @@ -51,10 +51,13 @@
>  #define GRUB_TERM_NO_EDIT	(1 << 1)
>  /* Set when the terminal cannot do fancy things.  */
>  #define GRUB_TERM_DUMB		(1 << 2)
> +/* Set to use ascii menu borders.  */
> +#define GRUB_TERM_SIMPLE_MENU	(1 << 3) 
> +/* Set to use cp437 menu borders.  */
> +#define GRUB_TERM_CP437_MENU	(1 << 4)
>  /* Set when the terminal needs to be initialized.  */
>  #define GRUB_TERM_NEED_INIT	(1 << 16)

Is this a bitmask?  In this case, looks like you aren't using the right
numbers.  Now GRUB_TERM_SIMPLE_MENU == GRUB_TERM_DUMB | GRUB_TERM_NO_EDIT
OTOH if that's what you intended, I think it's better to build one macro
using the others.

> diff -urN grub2.org/term/i386/pc/vesafb.c grub2/term/i386/pc/vesafb.c
> --- grub2.org/term/i386/pc/vesafb.c	2007-07-22 01:32:31.000000000 +0200
> +++ grub2/term/i386/pc/vesafb.c	2007-10-01 19:37:38.160330521 +0200
> @@ -214,45 +214,7 @@
>  			       unsigned *width)
>  {
>    if (code > 0x7f)
> -    {
> -      /* Map some unicode characters to the VGA font, if possible.  */
> -      switch (code)
> -	{
> -	case 0x2190:	/* left arrow */
> -	  code = 0x1b;
> -	  break;
> -	case 0x2191:	/* up arrow */
> -	  code = 0x18;
> -	  break;
> -	case 0x2192:	/* right arrow */
> -	  code = 0x1a;
> -	  break;
> -	case 0x2193:	/* down arrow */
> -	  code = 0x19;
> -	  break;
> -	case 0x2501:	/* horizontal line */
> -	  code = 0xc4;
> -	  break;
> -	case 0x2503:	/* vertical line */
> -	  code = 0xb3;
> -	  break;
> -	case 0x250F:	/* upper-left corner */
> -	  code = 0xda;
> -	  break;
> -	case 0x2513:	/* upper-right corner */
> -	  code = 0xbf;
> -	  break;
> -	case 0x2517:	/* lower-left corner */
> -	  code = 0xc0;
> -	  break;
> -	case 0x251B:	/* lower-right corner */
> -	  code = 0xd9;
> -	  break;
> -
> -	default:
> -	  return grub_font_get_glyph (code, bitmap, width);
> -	}
> -    }
> +    return grub_font_get_glyph (code, bitmap, width);
>  
>    if (bitmap)
>      grub_memcpy (bitmap,
> @@ -601,7 +563,7 @@
>      .setcolorstate = grub_virtual_screen_setcolorstate,
>      .setcolor = grub_virtual_screen_setcolor,
>      .setcursor = grub_vesafb_setcursor,
> -    .flags = 0,
> +    .flags = GRUB_TERM_CP437_MENU,
>      .next = 0
>    };
>  
> diff -urN grub2.org/term/i386/pc/vga.c grub2/term/i386/pc/vga.c
> --- grub2.org/term/i386/pc/vga.c	2007-07-22 01:32:31.000000000 +0200
> +++ grub2/term/i386/pc/vga.c	2007-10-01 19:38:10.883330521 +0200
> @@ -198,45 +198,7 @@
>  get_vga_glyph (grub_uint32_t code, unsigned char bitmap[32], unsigned *width)
>  {
>    if (code > 0x7f)
> -    {
> -      /* Map some unicode characters to the VGA font, if possible.  */
> -      switch (code)
> -	{
> -	case 0x2190:	/* left arrow */
> -	  code = 0x1b;
> -	  break;
> -	case 0x2191:	/* up arrow */
> -	  code = 0x18;
> -	  break;
> -	case 0x2192:	/* right arrow */
> -	  code = 0x1a;
> -	  break;
> -	case 0x2193:	/* down arrow */
> -	  code = 0x19;
> -	  break;
> -	case 0x2501:	/* horizontal line */
> -	  code = 0xc4;
> -	  break;
> -	case 0x2503:	/* vertical line */
> -	  code = 0xb3;
> -	  break;
> -	case 0x250F:	/* upper-left corner */
> -	  code = 0xda;
> -	  break;
> -	case 0x2513:	/* upper-right corner */
> -	  code = 0xbf;
> -	  break;
> -	case 0x2517:	/* lower-left corner */
> -	  code = 0xc0;
> -	  break;
> -	case 0x251B:	/* lower-right corner */
> -	  code = 0xd9;
> -	  break;
> -
> -	default:
> -	  return grub_font_get_glyph (code, bitmap, width);
> -	}
> -    }
> +    return grub_font_get_glyph (code, bitmap, width);

This part doesn't look right.  vesa/vga is a whole different history.  At the
least vesa *does* support unicode.

> diff -urN grub2.org/term/ieee1275/ofconsole.c grub2/term/ieee1275/ofconsole.c
> --- grub2.org/term/ieee1275/ofconsole.c	2007-07-22 11:05:11.000000000 +0200
> +++ grub2/term/ieee1275/ofconsole.c	2007-10-01 19:01:49.820330521 +0200
> @@ -75,6 +75,7 @@
>  grub_ofconsole_putchar (grub_uint32_t c)
>  {
>    char chr = c;
> +  
>    if (c == '\n')
>      {
>        grub_curr_y++;
> @@ -86,6 +87,7 @@
>        if (grub_curr_x > grub_ofconsole_width)
>  	grub_putcode ('\n');
>      }
> +
>    grub_ieee1275_write (stdout_ihandle, &chr, 1, 0);
>  }

Please try to avoid cosmetical changes.

> diff -urN grub2.org/util/console.c grub2/util/console.c
> --- grub2.org/util/console.c	2007-07-22 01:32:31.000000000 +0200
> +++ grub2/util/console.c	2007-10-01 19:01:49.821330521 +0200
> @@ -44,47 +44,6 @@
>  static void
>  grub_ncurses_putchar (grub_uint32_t c)
>  {

Have you verified that grub-emu still builds / works?

> diff -urN grub2.org/term/ieee1275/ofconsole.c grub2/term/ieee1275/ofconsole.c
> --- grub2.org/term/ieee1275/ofconsole.c	2007-10-01 18:02:39.000000000 +0200
> +++ grub2/term/ieee1275/ofconsole.c	2007-10-01 18:06:33.000000000 +0200
> @@ -135,43 +135,56 @@
>  
>    grub_ieee1275_read (stdin_ihandle, &c, 1, &actual);
>  
> -  if (actual > 0 && c == '\e')
> +  if (actual > 0)
>      {
> -      grub_ieee1275_read (stdin_ihandle, &c, 1, &actual);
> -      if (actual <= 0)
> -	{
> -	  *key = '\e';
> -	  return 1;
> -	}
> +      if (c != '\e')
> +      {
> +        switch(c)
> +        {
> +          case 127:
> +            /* Backspace */
> +            c = '\b';
> +            break;

What is 127 normally?  For firmware bugs, we have a flag mechanism so that it
only affects the buggy firmware.  Check my latest commit to
kern/powerpc/ieee1275/cmain.c.

-- 
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call, if you are unable to speak?
(as seen on /.)



  reply	other threads:[~2007-10-01 18:41 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-01 10:57 [PATCH] Fixed ieee1275 console Marcin Kurek
2007-10-01 12:31 ` Robert Millan
2007-10-01 12:33 ` Robert Millan
2007-10-01 18:14   ` Marcin Kurek
2007-10-01 18:39     ` Robert Millan [this message]
2007-10-01 19:43       ` Marcin Kurek
2007-10-02 21:39         ` Robert Millan
2007-10-03 23:33           ` Marcin Kurek
2007-10-04 20:50             ` Robert Millan
2007-10-10 15:11               ` Marcin Kurek
2007-10-10 19:19                 ` Robert Millan
2007-10-10 21:57                   ` Marcin Kurek
2007-10-11 14:01                     ` Robert Millan
2007-10-11 15:06 ` Marco Gerards
2007-10-12 16:16   ` Marcin Kurek
2007-11-10 17:05     ` Marco Gerards
2007-11-11 11:02       ` Marcin Kurek
2007-11-18 11:37         ` Marco Gerards
2007-10-15 20:43   ` Marcin Kurek
2007-11-18 13:18     ` Marco Gerards
2007-11-18 12:11 ` Marco Gerards

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071001183927.GA10233@thorin \
    --to=rmh@aybabtu.com \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.