grub-devel.gnu.org archive mirror
 help / color / mirror / Atom feed
* Mouse support in GRUB
@ 2011-10-01 13:39 Tirtha Chatterjee
  2011-10-01 17:10 ` Vladimir 'φ-coder/phcoder' Serbinenko
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Tirtha Chatterjee @ 2011-10-01 13:39 UTC (permalink / raw)
  To: grub-devel

Hi GRUB devels,

recently I came across the improvements made by Microsoft Windows 8 in
their bootloader.
http://blogs.msdn.com/b/b8/archive/2011/09/20/reengineering-the-windows-boot-experience.aspx

However I despise the operating system itself ( :-P ), the idea of a
beautiful graphical bootloader with mouse support integrated into it
felt amazing to me. It lowered the barrier for the user, and gave the
user an at-home experience right from switching on the computer. I
wanted to check if something similar can be done with GRUB, and found
out about the gfxmenu that was merged in 0.98. I think it is a great
step forward, and would be a really nice addition to all major
distributions in near future. However, I think that the graphical menu
is somewhat incomplete without mouse support. So I wish to work on
implementing mouse support for GRUB. However, I am a novice to the
GRUB codebase, and need some help with understanding the relevant
parts and with testing my implementation. I myself have done a little
bit of reading, reading the source code for the term module which
implements the keyboard support into GRUB, and have more or less
understood it. Also, I read up the HID specifications document for USB
devices.

It would be really wonderful if someone with experience with the
relevant code can help me by guiding me when needed, and help me with
a few of the problems i am facing with testing my build of GRUB with
qemu.


-- 
Regards
Tirtha Chatterjee
KDE developer
http://wyuka.co.cc/


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

* Re: Mouse support in GRUB
  2011-10-01 13:39 Mouse support in GRUB Tirtha Chatterjee
@ 2011-10-01 17:10 ` Vladimir 'φ-coder/phcoder' Serbinenko
  2011-10-01 17:12 ` Michal Suchanek
  2011-10-01 21:11 ` Vincent Pelletier
  2 siblings, 0 replies; 7+ messages in thread
From: Vladimir 'φ-coder/phcoder' Serbinenko @ 2011-10-01 17:10 UTC (permalink / raw)
  To: grub-devel

[-- Attachment #1: Type: text/plain, Size: 683 bytes --]

On 01.10.2011 15:39, Tirtha Chatterjee wrote:
> It would be really wonderful if someone with experience with the
> relevant code can help me by guiding me when needed, and help me with
> a few of the problems i am facing with testing my build of GRUB with
> qemu.
This is not an easy task. Unlike keyboard mouse needs to be either
polled pretty quickly or used with interrupts. Also it will mean that
you'll need to adjust graphics driver to show the cursor and to move it
quickly bypassing the usual core. Only the events like mouse clicks
should go through something like grub_checkkey or grub_checkkey itself.

-- 
Regards
Vladimir 'φ-coder/phcoder' Serbinenko



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 294 bytes --]

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

* Re: Mouse support in GRUB
  2011-10-01 13:39 Mouse support in GRUB Tirtha Chatterjee
  2011-10-01 17:10 ` Vladimir 'φ-coder/phcoder' Serbinenko
@ 2011-10-01 17:12 ` Michal Suchanek
  2011-10-01 17:39   ` Vladimir 'φ-coder/phcoder' Serbinenko
  2011-10-01 21:11 ` Vincent Pelletier
  2 siblings, 1 reply; 7+ messages in thread
From: Michal Suchanek @ 2011-10-01 17:12 UTC (permalink / raw)
  To: The development of GNU GRUB

On 1 October 2011 15:39, Tirtha Chatterjee
<tirtha.p.chatterjee@gmail.com> wrote:
> Hi GRUB devels,
>
> recently I came across the improvements made by Microsoft Windows 8 in
> their bootloader.
> http://blogs.msdn.com/b/b8/archive/2011/09/20/reengineering-the-windows-boot-experience.aspx
>
> However I despise the operating system itself ( :-P ), the idea of a
> beautiful graphical bootloader with mouse support integrated into it
> felt amazing to me. It lowered the barrier for the user, and gave the
> user an at-home experience right from switching on the computer. I

I don't think the user needs to feel exceptionally home at the
bootloader so long as the bootloader does its job well - boots the
system asap.

If you really want to lower the barrier then it would be good to have
touchscreen support on devices that have one. With a touchscreen the
user could select from the menu with much more ease than with a mouse.
This however needs the touch sensor come aligned with the screen or
some calibration needs to be done to figure out what part of the touch
sensor corresponds to which part of the screen.

Also if you want the user feel at home so much they don't need to
touch the keyboard how do you tackle the question much more
challenging than how to select from a graphical menu - what to select
from there, or what to load from the disk in case the menu is not
preconfigured.

Thanks

Michal


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

* Re: Mouse support in GRUB
  2011-10-01 17:12 ` Michal Suchanek
@ 2011-10-01 17:39   ` Vladimir 'φ-coder/phcoder' Serbinenko
  0 siblings, 0 replies; 7+ messages in thread
From: Vladimir 'φ-coder/phcoder' Serbinenko @ 2011-10-01 17:39 UTC (permalink / raw)
  To: grub-devel

[-- Attachment #1: Type: text/plain, Size: 2245 bytes --]

On 01.10.2011 19:12, Michal Suchanek wrote:
> On 1 October 2011 15:39, Tirtha Chatterjee
> <tirtha.p.chatterjee@gmail.com> wrote:
>> Hi GRUB devels,
>>
>> recently I came across the improvements made by Microsoft Windows 8 in
>> their bootloader.
>> http://blogs.msdn.com/b/b8/archive/2011/09/20/reengineering-the-windows-boot-experience.aspx
>>
>> However I despise the operating system itself ( :-P ), the idea of a
>> beautiful graphical bootloader with mouse support integrated into it
>> felt amazing to me. It lowered the barrier for the user, and gave the
>> user an at-home experience right from switching on the computer. I
> I don't think the user needs to feel exceptionally home at the
> bootloader so long as the bootloader does its job well - boots the
> system asap.
>
I agree. Also using keyboard is much faster and precise in this case and
doesn't need any additional knowledge. So entry barrier talk is a nonsense.
However in the domain of "fancy" people have strange preference and I
decided long time ago to allow such features as long as it's well coded
and disabled by default.
> If you really want to lower the barrier then it would be good to have
> touchscreen support on devices that have one. With a touchscreen the
> user could select from the menu with much more ease than with a mouse.
> This however needs the touch sensor come aligned with the screen or
> some calibration needs to be done to figure out what part of the touch
> sensor corresponds to which part of the screen.
>
I agree with this as well. Additionally some device can work in tablet
mode. Actually I tried to order touchbook because of exactly this reason
but never got one.
> Also if you want the user feel at home so much they don't need to
> touch the keyboard how do you tackle the question much more
> challenging than how to select from a graphical menu - what to select
> from there, or what to load from the disk in case the menu is not
> preconfigured.
>
> Thanks
>
> Michal
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel
>


-- 
Regards
Vladimir 'φ-coder/phcoder' Serbinenko



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 294 bytes --]

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

* Re: Mouse support in GRUB
  2011-10-01 13:39 Mouse support in GRUB Tirtha Chatterjee
  2011-10-01 17:10 ` Vladimir 'φ-coder/phcoder' Serbinenko
  2011-10-01 17:12 ` Michal Suchanek
@ 2011-10-01 21:11 ` Vincent Pelletier
  2011-10-01 21:18   ` Vladimir 'φ-coder/phcoder' Serbinenko
  2 siblings, 1 reply; 7+ messages in thread
From: Vincent Pelletier @ 2011-10-01 21:11 UTC (permalink / raw)
  To: grub-devel; +Cc: Tirtha Chatterjee

[-- Attachment #1: Type: Text/Plain, Size: 1122 bytes --]

Le samedi 01 octobre 2011 15:39:12, Tirtha Chatterjee a écrit :
> So I wish to work on implementing mouse support for GRUB.

I've attached the result of my early fidling with grub on sparc.
Yeah, once I got grub to load, I made a serial msmouse work instead of working 
on things like actually getting it to boot any OS.

It most certainly won't be applying cleanly on current code, and it is highly 
unlikely that I rebase it myself.

This adds 2 modules to grub, each with a single command.
Both modules require ieee1275, and were only tested on sparc.
One opens a serial port and moves a mouse cursor on screen. It doesn't 
integrate with anything (no event system...).
The other draws a mandelbrot fractal (this is off-topic, but it was in the 
same patch...).

More seriously, I feel the only value in this patch is in the ieee1275 
wrappers for framebuffer entrypoints.

If anyone feels like integrating any chunk, please do. I had signed the 
copyright assignment back then, so you can consider the FSF own copyright on 
that patch already, as far as I'm concerned.

-- 
Vincent Pelletier

[-- Attachment #2: mandel_mouse.diff --]
[-- Type: text/x-patch, Size: 33125 bytes --]

Index: commands/ieee1275/mandelbrot.c
===================================================================
RCS file: commands/ieee1275/mandelbrot.c
diff -N commands/ieee1275/mandelbrot.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ commands/ieee1275/mandelbrot.c	25 Aug 2005 09:05:09 -0000
@@ -0,0 +1,145 @@
+/* mandelbrot.c - Draws a nice Manldebrot fractal.  */
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2005  Free Software Foundation, Inc.
+ *
+ *  GRUB is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with GRUB; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <grub/rescue.h>
+#include <grub/dl.h>
+#include <grub/misc.h>
+#include <grub/machine/kernel.h>
+#include <grub/ieee1275/ieee1275.h>
+#include <grub/ieee1275/fb.h>
+#include <grub/ieee1275/fbprops.h>
+
+#ifndef GRUB_EMBED
+static grub_err_t
+grub_cmd_mandelbrot (struct grub_arg_list *state __attribute__ ((unused)),
+	             int argc, char **argv)
+#else /* GRUB_EMBED */
+static void
+grub_cmd_mandelbrot (int argc, char *argv[])
+#endif /* ! GRUB_EMBED */
+{
+  grub_ieee1275_ihandle_t screen;
+  grub_ieee1275_phandle_t pscreen;
+  const unsigned int nmax = 25;
+  unsigned int n, x, y, w, h, a;
+  const double xmin = -2.5, xmax = 2.5, ymin = -2, ymax = 2;
+  double dx, dy, rz, iz, tz, rc, ic;
+  unsigned char *fb, tmp[4];
+  char *device;
+  grub_ssize_t actual;
+
+  if(argc == 1)
+    device = argv[0];
+  else
+    device = "screen";
+  grub_printf("Using device %s...\n",device);
+  if (!grub_ieee1275_open (device, &screen))
+    {
+      grub_ieee1275_finddevice (device, &pscreen);
+      h = grub_ieee1275_fb_height (pscreen);
+      w = grub_ieee1275_fb_width (pscreen);
+      grub_printf("w=%d h=%d\n",w,h);
+      grub_ieee1275_get_property (pscreen,"address",tmp,sizeof(tmp),&actual);
+      fb = (unsigned char *) grub_ieee1275_decode_int_4(tmp);
+//      fb = (unsigned char *) grub_ieee1275_fb_addr (pscreen);
+      grub_printf ("Framebuffer is at %p.\nClearing screen...\n", fb);
+      for (a = 0; a < w * h; a++)
+        fb[a] = 0;
+      for (a = 0; a < 256; a++) /* Fill palette with shades of gray.  */
+        grub_ieee1275_setcolor (screen, a, a, a, a);
+      dx = (xmax - xmin) / w;
+      dy = (ymax - ymin) / h;
+      for (x = 0; x < w; x++)
+        {
+          rc = xmin + x * dx;
+          for (y = 0; y < h; y++)
+            {
+              ic = ymin + y * dy;
+              rz = 0;
+              iz = 0;
+              for (n = 1; n < nmax; n++)
+                {
+                  tz = rz * rz - iz * iz + rc;
+                  iz = 2 * rz * iz + ic;
+                  rz = tz;
+                  if (rz * rz + iz * iz >= 4)
+                    {
+                      fb[x+w*y] = (n*255/nmax) % 256;
+                      n = nmax;
+                    }
+                }
+              if (rz * rz + iz * iz < 4)
+                fb[x+w*y]=255;
+            }
+        }
+#if 0
+      grub_ieee1275_close (screen); /* If screen is closed, it goes black.  */
+#endif
+    }
+  grub_printf("Finished !\n");
+#ifndef GRUB_EMBED
+  return 0;
+#endif /* ! GRUB_EMBED */
+}
+
+\f
+#ifdef GRUB_EMBED
+void
+grub_mandelbrot_init (void)
+{
+  grub_rescue_register_command ("mandelbrot", grub_cmd_mandelbrot,
+                                "Draws a fractal.");
+}
+
+void
+grub_mandelbrot_fini (void)
+{
+  grub_rescue_unregister_command ("mandelbrot");
+}
+#else /* ! GRUB_EMBED */
+#ifdef GRUB_UTIL
+void
+grub_mandelbrot_init (void)
+{
+  grub_register_command ("mandelbrot", grub_cmd_mandelbrot,
+                         GRUB_COMMAND_FLAG_BOTH, "mandelbrot",
+                         "Draws a fractal.", 0);
+}
+
+void
+grub_mandelbrot_fini (void)
+{
+  grub_unregister_command ("mandelbrot");
+}
+#else /* ! GRUB_UTIL */
+GRUB_MOD_INIT
+{
+  (void)mod;			/* To stop warning. */
+  grub_register_command ("mandelbrot", grub_cmd_mandelbrot,
+                         GRUB_COMMAND_FLAG_BOTH, "mandelbrot",
+                         "Draws a fractal.", 0);
+}
+
+GRUB_MOD_FINI
+{
+  grub_unregister_command ("mandelbrot");
+}
+#endif /* GRUB_UTIL */
+#endif /* GRUB_EMBED */
Index: commands/ieee1275/mousetest.c
===================================================================
RCS file: commands/ieee1275/mousetest.c
diff -N commands/ieee1275/mousetest.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ commands/ieee1275/mousetest.c	25 Aug 2005 09:05:09 -0000
@@ -0,0 +1,240 @@
+/* mousetest.c - Basic mouse handling.  */
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2005  Free Software Foundation, Inc.
+ *
+ *  GRUB is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with GRUB; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <grub/rescue.h>
+#include <grub/dl.h>
+#include <grub/misc.h>
+#include <grub/machine/kernel.h>
+#include <grub/ieee1275/ieee1275.h>
+#include <grub/ieee1275/fb.h>
+#include <grub/ieee1275/fbprops.h>
+
+#ifndef GRUB_EMBED
+static grub_err_t
+grub_cmd_mousetest (struct grub_arg_list *state __attribute__ ((unused)),
+	        int argc, char **argv)
+#else /* GRUB_EMBED */
+static void
+grub_cmd_mousetest (int argc, char *argv[])
+#endif /* ! GRUB_EMBED */
+{
+  int x, y, w, h, a;
+  unsigned char color;
+  grub_ieee1275_ihandle_t screen, serial;
+  grub_ieee1275_phandle_t pscreen;
+  char *device, *mdevice, tmp[3];
+  static char car;
+  static grub_ssize_t actual;
+  static const unsigned char mousepic[16*16] = {
+    1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,
+    1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,
+    1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,
+    1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,
+    1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,
+    1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,
+    1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,
+    1,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,
+    1,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,
+    1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0};
+  if(argc == 2)
+  {
+    device = argv[0];
+    mdevice = argv[1];
+  }
+  else
+  {
+    device = "screen";
+    mdevice = "mouse";
+  }
+  grub_printf("Using screen device '%s', mouse device '%s'...\n",device, mdevice);
+  if (!grub_ieee1275_open (device, &screen))
+    {
+      grub_ieee1275_finddevice (device, &pscreen);
+      h = grub_ieee1275_fb_height (pscreen);
+      w = grub_ieee1275_fb_width (pscreen);
+      grub_ieee1275_fillrectangle (screen, 0, 0, 0, w, h); /* Clear screen.  */
+      grub_ieee1275_setcolor (screen, 0, 0, 0, 0);
+      grub_ieee1275_setcolor (screen, 1, 255, 255, 255);
+      grub_ieee1275_setcolor (screen, 2, 255, 255, 255); /* cadre */
+      grub_ieee1275_setcolor (screen, 3, 255, 0, 0); /* bg */
+      grub_ieee1275_setcolor (screen, 4, 0, 255, 0); /* bd */
+      grub_ieee1275_setcolor (screen, 5, 128, 128, 0); /* x */
+      grub_ieee1275_setcolor (screen, 6, 0, 128, 128); /* y */
+      x = w / 2;
+      y = h / 2;
+      color = 255;
+      if (! grub_ieee1275_open (mdevice, &serial))
+        {
+          tmp[0]='*';
+          tmp[1]='n';
+          grub_ieee1275_write (serial, tmp, 2, &actual);
+          /* XXX: Set as 1200 bauds.  Is it really needed ?  */
+          grub_ieee1275_setcolor (screen, 1, color, color, color);
+          grub_ieee1275_drawrectangle (screen, mousepic, x, y, 16, 16);
+          while (1)
+            {
+              /* Decode Microsoft mouse protocol.  */
+              a = 0;
+              while (a < 3)
+                {
+                  grub_ieee1275_read (serial, &car, 1, &actual);
+                  if(a == 0 && ! (car & 0x40))
+                    continue;
+                    /* We thought it was the first, and it isn't, loop.  */
+                  else if(a != 0 && (car & 0x40))
+                    tmp[a = 0] = car; /* We accidentaly found the first.  */
+                  else
+                    tmp[a++] = car; /* Nothing suspicious.  */
+                }
+              if (tmp[0] & 16) /* Right button.  */
+                color += 16;
+              if (tmp[0] & 32) /* Left button.  */
+                color -= 16;
+              grub_ieee1275_fillrectangle (screen, 0, x, y, 16, 16);
+              x += (signed char) (((tmp[0] & 0x3) << 6) | (tmp[1] & 0x3F));
+              y += (signed char) (((tmp[0] & 0xC) << 4) | (tmp[2] & 0x3F));
+              if (x < 0)
+                x = 0;
+              if (y < 0)
+                y = 0;
+              if (x > w)
+                x = w;
+              if (y > h)
+                y = h;
+
+              grub_ieee1275_setcolor (screen, 1, color, color, color);
+              grub_ieee1275_drawrectangle (screen, mousepic, x, y, 16, 16);
+
+              grub_ieee1275_fillrectangle (screen, 2, 0, 0, 90, 40);
+
+              grub_ieee1275_fillrectangle (screen, tmp[0] & 128 ? 1 : 0,
+                  5, 5, 10, 10);
+              grub_ieee1275_fillrectangle (screen, tmp[0] & 64 ? 1 : 0,
+                  15, 5, 10, 10);
+              grub_ieee1275_fillrectangle (screen, tmp[0] & 32 ? 3 : 0,
+                  25, 5, 10, 10);
+              grub_ieee1275_fillrectangle (screen, tmp[0] & 16 ? 4 : 0,
+                  35, 5, 10, 10);
+              grub_ieee1275_fillrectangle (screen, tmp[0] & 8 ? 6 : 0,
+                  45, 5, 10, 10);
+              grub_ieee1275_fillrectangle (screen, tmp[0] & 4 ? 6 : 0,
+                  55, 5, 10, 10);
+              grub_ieee1275_fillrectangle (screen, tmp[0] & 2 ? 5 : 0,
+                  65, 5, 10, 10);
+              grub_ieee1275_fillrectangle (screen, tmp[0] & 1 ? 5 : 0,
+                  75, 5, 10, 10);
+
+              grub_ieee1275_fillrectangle (screen, tmp[1] & 128 ? 1 : 0,
+                  5, 15, 10, 10);
+              grub_ieee1275_fillrectangle (screen, tmp[1] & 64 ? 1 : 0,
+                  15, 15, 10, 10);
+              grub_ieee1275_fillrectangle (screen, tmp[1] & 32 ? 5 : 0,
+                  25, 15, 10, 10);
+              grub_ieee1275_fillrectangle (screen, tmp[1] & 16 ? 5 : 0,
+                  35, 15, 10, 10);
+              grub_ieee1275_fillrectangle (screen, tmp[1] & 8 ? 5 : 0,
+                  45, 15, 10, 10);
+              grub_ieee1275_fillrectangle (screen, tmp[1] & 4 ? 5 : 0,
+                  55, 15, 10, 10);
+              grub_ieee1275_fillrectangle (screen, tmp[1] & 2 ? 5 : 0,
+                  65, 15, 10, 10);
+              grub_ieee1275_fillrectangle (screen, tmp[1] & 1 ? 5 : 0,
+                  75, 15, 10, 10);
+
+              grub_ieee1275_fillrectangle (screen, tmp[2] & 128 ? 1 : 0,
+                  5, 25, 10, 10);
+              grub_ieee1275_fillrectangle (screen, tmp[2] & 64 ? 1 : 0,
+                  15, 25, 10, 10);
+              grub_ieee1275_fillrectangle (screen, tmp[2] & 32 ? 6 : 0,
+                  25, 25, 10, 10);
+              grub_ieee1275_fillrectangle (screen, tmp[2] & 16 ? 6 : 0,
+                  35, 25, 10, 10);
+              grub_ieee1275_fillrectangle (screen, tmp[2] & 8 ? 6 : 0,
+                  45, 25, 10, 10);
+              grub_ieee1275_fillrectangle (screen, tmp[2] & 4 ? 6 : 0,
+                  55, 25, 10, 10);
+              grub_ieee1275_fillrectangle (screen, tmp[2] & 2 ? 6 : 0,
+                  65, 25, 10, 10);
+              grub_ieee1275_fillrectangle (screen, tmp[2] & 1 ? 6 : 0,
+                  75, 25, 10, 10);
+            }
+        }
+      else
+        grub_printf ("Unable to open mouse device !\n");
+#if 0
+      grub_ieee1275_close (screen); /* If screen is closed, it goes black.  */
+#endif
+    }
+  grub_printf("Finished !\n");
+#ifndef GRUB_EMBED
+  return 0;
+#endif /* ! GRUB_EMBED */
+}
+
+\f
+#ifdef GRUB_EMBED
+void
+grub_mousetest_init (void)
+{
+  grub_rescue_register_command ("mousetest", grub_cmd_mousetest,
+                                "Mouse test program.");
+}
+
+void
+grub_mousetest_fini (void)
+{
+  grub_rescue_unregister_command ("mousetest");
+}
+#else /* ! GRUB_EMBED */
+#ifdef GRUB_UTIL
+void
+grub_mousetest_init (void)
+{
+  grub_register_command ("mousetest", grub_cmd_mousetest,
+                         GRUB_COMMAND_FLAG_BOTH, "mousetest",
+                         "Mouse test program.", 0);
+}
+
+void
+grub_mousetest_fini (void)
+{
+  grub_unregister_command ("mousetest");
+}
+#else /* ! GRUB_UTIL */
+GRUB_MOD_INIT
+{
+  (void)mod;			/* To stop warning. */
+  grub_register_command ("mousetest", grub_cmd_mousetest,
+                         GRUB_COMMAND_FLAG_BOTH, "mousetest",
+                         "Mouse test program.", 0);
+}
+
+GRUB_MOD_FINI
+{
+  grub_unregister_command ("mousetest");
+}
+#endif /* GRUB_UTIL */
+#endif /* GRUB_EMBED */
Index: conf/powerpc-ieee1275.rmk
===================================================================
RCS file: /cvsroot/grub/grub2/conf/powerpc-ieee1275.rmk,v
retrieving revision 1.37
diff -u -p -r1.37 powerpc-ieee1275.rmk
--- conf/powerpc-ieee1275.rmk	20 Aug 2005 07:49:01 -0000	1.37
+++ conf/powerpc-ieee1275.rmk	25 Aug 2005 09:05:26 -0000
@@ -75,7 +75,8 @@ pkgdata_MODULES = _linux.mod linux.mod f
 	hfs.mod jfs.mod normal.mod hello.mod font.mod ls.mod \
 	boot.mod cmp.mod cat.mod terminal.mod fshelp.mod amiga.mod apple.mod \
 	pc.mod suspend.mod loopback.mod help.mod reboot.mod halt.mod sun.mod \
-	default.mod timeout.mod configfile.mod search.mod
+	default.mod timeout.mod configfile.mod search.mod mandelbrot.mod \
+	mousetest.mod fb.mod
 
 # For fshelp.mod.
 fshelp_mod_SOURCES = fs/fshelp.c
@@ -204,3 +205,16 @@ configfile_mod_CFLAGS = $(COMMON_CFLAGS)
 # For search.mod.
 search_mod_SOURCES = commands/search.c
 search_mod_CFLAGS = $(COMMON_CFLAGS)
+
+# For mandelbrot.mod
+mandelbrot_mod_SOURCES = commands/ieee1275/mandelbrot.c
+mandelbrot_mod_CFLAGS = $(COMMON_CFLAGS)
+
+# For mousetest.mod
+mousetest_mod_SOURCES = commands/ieee1275/mousetest.c
+mousetest_mod_CFLAGS = $(COMMON_CFLAGS)
+
+# For fb.mod
+fb_mod_SOURCES = video/ieee1275/fb.c video/ieee1275/fbprops.c
+fb_mod_CFLAGS = $(COMMON_CFLAGS)
+
Index: conf/sparc64-ieee1275.rmk
===================================================================
RCS file: /cvsroot/grub/grub2/conf/sparc64-ieee1275.rmk,v
retrieving revision 1.2
diff -u -p -r1.2 sparc64-ieee1275.rmk
--- conf/sparc64-ieee1275.rmk	21 Aug 2005 19:33:14 -0000	1.2
+++ conf/sparc64-ieee1275.rmk	25 Aug 2005 09:05:27 -0000
@@ -12,7 +12,8 @@ DEFSYMFILES += kernel_syms.lst
 grubof_HEADERS = arg.h boot.h device.h disk.h dl.h elf.h env.h err.h \
 	file.h fs.h kernel.h misc.h mm.h net.h rescue.h symbol.h \
 	term.h types.h loader.h \
-	partition.h pc_partition.h ieee1275/ieee1275.h machine/time.h
+	partition.h pc_partition.h ieee1275/ieee1275.h machine/time.h \
+	ieee1275/fb.h ieee1275/fbprops.h
 
 grubof_symlist.c: $(addprefix include/grub/,$(grubof_HEADERS)) gensymlist.sh
 	sh $(srcdir)/gensymlist.sh $(filter %.h,$^) > $@
@@ -59,9 +60,11 @@ grubof_SOURCES = kern/sparc64/ieee1275/i
 	kern/rescue.c kern/term.c term/ieee1275/ofconsole.c \
 	kern/sparc64/ieee1275/openfw.c disk/ieee1275/ofdisk.c \
 	kern/partition.c kern/env.c kern/sparc64/dl.c grubof_symlist.c \
-	kern/sparc64/cache.c
+	kern/sparc64/cache.c \
+	video/ieee1275/fb.c video/ieee1275/fbprops.c \
+	commands/ieee1275/mandelbrot.c commands/ieee1275/mousetest.c
 grubof_HEADERS = grub/sparc64/ieee1275/ieee1275.h
-grubof_CFLAGS = $(COMMON_CFLAGS)
+grubof_CFLAGS = $(COMMON_CFLAGS) -DGRUB_EMBED
 grubof_ASFLAGS = $(COMMON_ASFLAGS)
 grubof_LDFLAGS = -m64 -nostdlib -Wl,-N,-Ttext,0x200000,-Bstatic -Xlinker --oformat -Xlinker elf64-sparc
 
@@ -73,7 +76,8 @@ genmoddep_SOURCES = util/genmoddep.c
 #	hfs.mod jfs.mod normal.mod hello.mod font.mod ls.mod \
 #	boot.mod cmp.mod cat.mod terminal.mod fshelp.mod amiga.mod apple.mod \
 #	pc.mod suspend.mod loopback.mod help.mod reboot.mod halt.mod sun.mod \
-#	default.mod timeout.mod configfile.mod search.mod
+#	default.mod timeout.mod configfile.mod search.mod mandelbrot.mod \
+#	mousetest.mod fb.mod
 
 # For fshelp.mod.
 fshelp_mod_SOURCES = fs/fshelp.c
@@ -202,3 +206,16 @@ configfile_mod_CFLAGS = $(COMMON_CFLAGS)
 # For search.mod.
 search_mod_SOURCES = commands/search.c
 search_mod_CFLAGS = $(COMMON_CFLAGS)
+
+# For mandelbrot.mod
+mandelbrot_mod_SOURCES = commands/ieee1275/mandelbrot.c
+mandelbrot_mod_CFLAGS = $(COMMON_CFLAGS)
+
+# For mousetest.mod
+mousetest_mod_SOURCES = commands/ieee1275/mousetest.c
+mousetest_mod_CFLAGS = $(COMMON_CFLAGS)
+
+# For fb.mod
+fb_mod_SOURCES = video/ieee1275/fb.c video/ieee1275/fbprops.c
+fb_mod_CFLAGS = $(COMMON_CFLAGS)
+
Index: include/grub/ieee1275/fb.h
===================================================================
RCS file: include/grub/ieee1275/fb.h
diff -N include/grub/ieee1275/fb.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ include/grub/ieee1275/fb.h	25 Aug 2005 09:05:29 -0000
@@ -0,0 +1,54 @@
+/* fb.h - Access the Open Firmware client interface - framebuffer
+ * functions.  */
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2005  Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef GRUB_IEEE1275_FB_HEADER
+#define GRUB_IEEE1275_FB_HEADER	1
+
+#include <grub/types.h>
+#include <grub/ieee1275/ieee1275.h>
+
+int EXPORT_FUNC(grub_ieee1275_setcolor) (grub_ieee1275_ihandle_t ihandle,
+    grub_ieee1275_cell_t index, grub_ieee1275_cell_t red,
+    grub_ieee1275_cell_t green, grub_ieee1275_cell_t blue);
+int EXPORT_FUNC(grub_ieee1275_getcolor) (grub_ieee1275_ihandle_t ihandle,
+    grub_ieee1275_cell_t index, grub_ieee1275_cell_t *red,
+    grub_ieee1275_cell_t *green, grub_ieee1275_cell_t *blue);
+/* XXX: Test me !  */
+int EXPORT_FUNC(grub_ieee1275_setcolors) (grub_ieee1275_ihandle_t ihandle,
+    const void *adr, grub_ieee1275_cell_t index, grub_ieee1275_cell_t indices);
+/* XXX: Test me !  */
+int EXPORT_FUNC(grub_ieee1275_getcolors) (grub_ieee1275_ihandle_t ihandle,
+    void *adr, grub_ieee1275_cell_t index, grub_ieee1275_cell_t indices);
+/* XXX: Test me !  */
+int EXPORT_FUNC(grub_ieee1275_drawrectangle) (grub_ieee1275_ihandle_t ihandle,
+    const void *image, grub_ieee1275_cell_t left, grub_ieee1275_cell_t top,
+    grub_ieee1275_cell_t width, grub_ieee1275_cell_t height);
+/* XXX: Test me !  */
+int EXPORT_FUNC(grub_ieee1275_fillrectangle) (grub_ieee1275_ihandle_t ihandle,
+    grub_ieee1275_cell_t color, grub_ieee1275_cell_t left,
+    grub_ieee1275_cell_t top, grub_ieee1275_cell_t width,
+    grub_ieee1275_cell_t height);
+int EXPORT_FUNC(grub_ieee1275_readrectangle) (grub_ieee1275_ihandle_t ihandle,
+    void **image, grub_ieee1275_cell_t left, grub_ieee1275_cell_t top,
+    grub_ieee1275_cell_t width, grub_ieee1275_cell_t height); 
+/* XXX: Test me !  */
+
+#endif /* ! GRUB_IEEE1275_FB_HEADER */
Index: include/grub/ieee1275/fbprops.h
===================================================================
RCS file: include/grub/ieee1275/fbprops.h
diff -N include/grub/ieee1275/fbprops.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ include/grub/ieee1275/fbprops.h	25 Aug 2005 09:05:29 -0000
@@ -0,0 +1,43 @@
+/* fbprops.h - Access the Open Firmware client interface -  framebuffer
+ * properties.  */
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2005  Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef GRUB_IEEE1275_FBPROPS_HEADER
+#define GRUB_IEEE1275_FBPROPS_HEADER	1
+
+#include <grub/types.h>
+#include <grub/ieee1275/ieee1275.h>
+
+void * EXPORT_FUNC(grub_ieee1275_decode_address) (void *address);
+ /* XXX: Test me !  */
+void * EXPORT_FUNC(grub_ieee1275_getproperty_addr)
+  (grub_ieee1275_phandle_t phandle, char *property); /* XXX: Test me !  */
+void * EXPORT_FUNC(grub_ieee1275_fb_addr)
+  (grub_ieee1275_phandle_t phandle); /* XXX: Test me !  */
+int EXPORT_FUNC(grub_ieee1275_getproperty_4) (grub_ieee1275_phandle_t phandle,
+    char *property);
+int EXPORT_FUNC(grub_ieee1275_fb_height) (grub_ieee1275_phandle_t phandle);
+int EXPORT_FUNC(grub_ieee1275_fb_width) (grub_ieee1275_phandle_t phandle);
+/*int EXPORT_NO!_FUNC(grub_ieee1275_fb_linebytes)
+  (grub_ieee1275_phandle_t phandle); *//* XXX: Test me !  */
+/*int EXPORT_NO!_FUNC(grub_ieee1275_fb_depth)
+  (grub_ieee1275_phandle_t phandle);*//* XXX: Test me !  */
+
+#endif /* ! GRUB_IEEE1275_FBPROPS_HEADER */
Index: kern/sparc64/ieee1275/init.c
===================================================================
RCS file: /cvsroot/grub/grub2/kern/sparc64/ieee1275/init.c,v
retrieving revision 1.1
diff -u -p -r1.1 init.c
--- kern/sparc64/ieee1275/init.c	21 Aug 2005 18:42:55 -0000	1.1
+++ kern/sparc64/ieee1275/init.c	25 Aug 2005 09:05:30 -0000
@@ -205,11 +205,20 @@ grub_machine_init (void)
 	}
     }
 
+#ifdef GRUB_EMBED
+  grub_mandelbrot_init ();
+  grub_mousetest_init ();
+#endif /* GRUB_EMBED */
+
 }
 
 void
 grub_machine_fini (void)
 {
+#ifdef GRUB_EMBED
+  grub_mousetest_fini ();
+  grub_mandelbrot_fini ();
+#endif /* GRUB_EMBED */
   grub_ofdisk_fini ();
   grub_console_fini ();
 }
Index: video/ieee1275/fb.c
===================================================================
RCS file: video/ieee1275/fb.c
diff -N video/ieee1275/fb.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ video/ieee1275/fb.c	25 Aug 2005 09:05:31 -0000
@@ -0,0 +1,222 @@
+/* fb.c - Access the Open Firmware client interface -  framebuffer
+ * functions.  */
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2005  Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <grub/ieee1275/fb.h>
+
+int
+grub_ieee1275_setcolor (grub_ieee1275_ihandle_t ihandle,
+    grub_ieee1275_cell_t index, grub_ieee1275_cell_t red,
+    grub_ieee1275_cell_t green, grub_ieee1275_cell_t blue)
+{
+  struct write_args {
+    struct grub_ieee1275_common_hdr common;
+    char *method;
+    grub_ieee1275_ihandle_t ihandle;
+    grub_ieee1275_cell_t index;
+    grub_ieee1275_cell_t blue;
+    grub_ieee1275_cell_t green;
+    grub_ieee1275_cell_t red;
+  } args;
+
+  INIT_IEEE1275_COMMON (&args.common, "call-method", 6, 0);
+  args.method = "color!";
+  args.ihandle = ihandle;
+  args.index = index;
+  args.red = red;
+  args.green = green;
+  args.blue = blue;
+
+  if (IEEE1275_CALL_ENTRY_FN (&args) == -1)
+    return -1;
+  return 0;
+}
+
+int
+grub_ieee1275_getcolor (grub_ieee1275_ihandle_t ihandle,
+    grub_ieee1275_cell_t index, grub_ieee1275_cell_t *red,
+    grub_ieee1275_cell_t *green, grub_ieee1275_cell_t *blue)
+{
+  struct write_args {
+    struct grub_ieee1275_common_hdr common;
+    char *method;
+    grub_ieee1275_ihandle_t ihandle;
+    grub_ieee1275_cell_t index;
+    grub_ieee1275_cell_t blue; /* XXX: Right order for return values ?  */
+    grub_ieee1275_cell_t green;/* (here, top of stack last) */
+    grub_ieee1275_cell_t red;
+  } args;
+
+  INIT_IEEE1275_COMMON (&args.common, "call-method", 3, 3);
+  args.method = "color@";
+  args.ihandle = ihandle;
+  args.index = index;
+
+  if (IEEE1275_CALL_ENTRY_FN (&args) == -1)
+    return -1;
+
+  *red = args.red;
+  *green = args.green;
+  *blue = args.blue;
+
+  return 0;
+}
+
+int
+grub_ieee1275_setcolors (grub_ieee1275_ihandle_t ihandle, const void *adr,
+    grub_ieee1275_cell_t index, grub_ieee1275_cell_t indices)
+{
+  struct write_args {
+    struct grub_ieee1275_common_hdr common;
+    char *method;
+    grub_ieee1275_ihandle_t ihandle;
+    grub_ieee1275_cell_t indices;
+    grub_ieee1275_cell_t index;
+    const void *adr;
+  } args;
+
+  INIT_IEEE1275_COMMON (&args.common, "call-method", 3, 0);
+  args.method = "set-colors";
+  args.ihandle = ihandle;
+  args.adr = adr;
+  args.index = index;
+  args.indices = indices;
+
+  if (IEEE1275_CALL_ENTRY_FN (&args) == -1)
+    return -1;
+  return 0;
+}
+
+int
+grub_ieee1275_getcolors (grub_ieee1275_ihandle_t ihandle, void *adr,
+    grub_ieee1275_cell_t index, grub_ieee1275_cell_t indices)
+{
+  struct write_args {
+    struct grub_ieee1275_common_hdr common;
+    char *method;
+    grub_ieee1275_ihandle_t ihandle;
+    grub_ieee1275_cell_t indices;
+    grub_ieee1275_cell_t index;
+    void *adr;
+  } args;
+
+  INIT_IEEE1275_COMMON (&args.common, "call-method", 3, 0);
+  args.method = "get-colors";
+  args.ihandle = ihandle;
+  args.adr = adr;
+  args.index = index;
+  args.indices = indices;
+
+  if (IEEE1275_CALL_ENTRY_FN (&args) == -1)
+    return -1;
+  return 0;
+}
+
+int
+grub_ieee1275_drawrectangle (grub_ieee1275_ihandle_t ihandle, const void *image,
+    grub_ieee1275_cell_t left, grub_ieee1275_cell_t top,
+    grub_ieee1275_cell_t width, grub_ieee1275_cell_t height)
+{
+  struct write_args {
+    struct grub_ieee1275_common_hdr common;
+    char *method;
+    grub_ieee1275_ihandle_t ihandle;
+    grub_ieee1275_cell_t height;
+    grub_ieee1275_cell_t width;
+    grub_ieee1275_cell_t top;
+    grub_ieee1275_cell_t left;
+    const void *image;
+  } args;
+
+  INIT_IEEE1275_COMMON (&args.common, "call-method", 7, 0);
+  args.method = "draw-rectangle";
+  args.ihandle = ihandle;
+  args.image = image;
+  args.left = left;
+  args.top = top;
+  args.width = width;
+  args.height = height;
+
+  if (IEEE1275_CALL_ENTRY_FN (&args) == -1)
+    return -1;
+  return 0;
+}
+
+int
+grub_ieee1275_fillrectangle (grub_ieee1275_ihandle_t ihandle,
+    grub_ieee1275_cell_t color, grub_ieee1275_cell_t left,
+    grub_ieee1275_cell_t top, grub_ieee1275_cell_t width,
+    grub_ieee1275_cell_t height)
+{
+  struct write_args {
+    struct grub_ieee1275_common_hdr common;
+    char *method;
+    grub_ieee1275_ihandle_t ihandle;
+    grub_ieee1275_cell_t height;
+    grub_ieee1275_cell_t width;
+    grub_ieee1275_cell_t top;
+    grub_ieee1275_cell_t left;
+    grub_ieee1275_cell_t color;
+  } args;
+
+  INIT_IEEE1275_COMMON (&args.common, "call-method", 7, 0);
+  args.method = "fill-rectangle";
+  args.ihandle = ihandle;
+  args.color = color;
+  args.left = left;
+  args.top = top;
+  args.width = width;
+  args.height = height;
+
+  if (IEEE1275_CALL_ENTRY_FN (&args) == -1)
+    return -1;
+  return 0;
+}
+
+int
+grub_ieee1275_readrectangle (grub_ieee1275_ihandle_t ihandle, void **image,
+    grub_ieee1275_cell_t left, grub_ieee1275_cell_t top,
+    grub_ieee1275_cell_t width, grub_ieee1275_cell_t height)
+{
+  struct write_args {
+    struct grub_ieee1275_common_hdr common;
+    char *method;
+    grub_ieee1275_ihandle_t ihandle;
+    grub_ieee1275_cell_t height;
+    grub_ieee1275_cell_t width;
+    grub_ieee1275_cell_t top;
+    grub_ieee1275_cell_t left;
+    void **image;
+  } args;
+
+  INIT_IEEE1275_COMMON (&args.common, "call-method", 7, 0);
+  args.method = "read-rectangle";
+  args.ihandle = ihandle;
+  args.image = image;
+  args.left = left;
+  args.top = top;
+  args.width = width;
+  args.height = height;
+
+  if (IEEE1275_CALL_ENTRY_FN (&args) == -1)
+    return -1;
+  return 0;
+}
+
Index: video/ieee1275/fbprops.c
===================================================================
RCS file: video/ieee1275/fbprops.c
diff -N video/ieee1275/fbprops.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ video/ieee1275/fbprops.c	25 Aug 2005 09:05:31 -0000
@@ -0,0 +1,96 @@
+/* fbprops.c - Access the Open Firmware client interface -  framebuffer
+ * properties.  */
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2005  Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <grub/ieee1275/fbprops.h>
+
+void *
+grub_ieee1275_decode_address (void *address)
+{
+  union {
+    void *adr;
+    unsigned char bytes[GRUB_HOST_SIZEOF_VOID_P];
+  } from, to;
+  int pos;
+  from.adr = address;
+  for (pos = 0; pos < GRUB_HOST_SIZEOF_VOID_P; pos++)
+    to.bytes[pos] = from.bytes[GRUB_HOST_SIZEOF_VOID_P - pos - 1];
+  return to.adr;
+}
+
+int
+grub_ieee1275_getproperty_4 (grub_ieee1275_phandle_t phandle,
+    char *property)
+{
+  unsigned char tmp[4];
+  grub_ssize_t actual;
+  if (grub_ieee1275_get_property (phandle, property, tmp, sizeof (tmp), &actual)
+      || actual != sizeof (tmp))
+    return -1;
+  return grub_ieee1275_decode_int_4 (tmp);
+}
+
+void *
+grub_ieee1275_getproperty_addr (grub_ieee1275_phandle_t phandle,
+    char *property)
+{
+  void *tmp;
+/*  unsigned char tmp[4];*/
+  grub_ssize_t actual;
+  if (grub_ieee1275_get_property (phandle, property, &tmp, sizeof (tmp), &actual)
+      || actual != sizeof (tmp))
+    return (void *) -1;
+  return grub_ieee1275_decode_address (tmp);
+/*  return (void *) grub_ieee1275_decode_int_4 (tmp);*/
+}
+
+void *
+grub_ieee1275_fb_addr (grub_ieee1275_phandle_t phandle)
+{
+  return (void *) grub_ieee1275_getproperty_4 (phandle, "address");
+  /* XXX: this address is 4 bytes long only.  */
+}
+
+int
+grub_ieee1275_fb_height(grub_ieee1275_phandle_t phandle)
+{
+  return grub_ieee1275_getproperty_4 (phandle, "height");
+}
+
+int
+grub_ieee1275_fb_width(grub_ieee1275_phandle_t phandle)
+{
+  return grub_ieee1275_getproperty_4 (phandle, "width");
+}
+
+/* XXX: Not always supported.  */
+/*int
+grub_ieee1275_fb_linebytes(grub_ieee1275_phandle_t phandle)
+{
+  return grub_ieee1275_getproperty_4 (phandle, "linebytes");
+}*/
+
+/* XXX: Not always supported.  */
+/*int
+grub_ieee1275_fb_depth(grub_ieee1275_phandle_t phandle)
+{
+  return grub_ieee1275_getproperty_4 (phandle, "depth");
+}*/
+

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

* Re: Mouse support in GRUB
  2011-10-01 21:11 ` Vincent Pelletier
@ 2011-10-01 21:18   ` Vladimir 'φ-coder/phcoder' Serbinenko
  2011-12-13 22:41     ` Vladimir 'φ-coder/phcoder' Serbinenko
  0 siblings, 1 reply; 7+ messages in thread
From: Vladimir 'φ-coder/phcoder' Serbinenko @ 2011-10-01 21:18 UTC (permalink / raw)
  To: grub-devel

[-- Attachment #1: Type: text/plain, Size: 392 bytes --]

On 01.10.2011 23:11, Vincent Pelletier wrote:
> More seriously, I feel the only value in this patch is in the ieee1275 
> wrappers for framebuffer entrypoints.
Yes, that's interesting. We have ieee1275 framebuffer support on ppc but
it fails and hence is disabled on sparc. Expecting this patch will allow
me to find out why.

-- 
Regards
Vladimir 'φ-coder/phcoder' Serbinenko



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 294 bytes --]

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

* Re: Mouse support in GRUB
  2011-10-01 21:18   ` Vladimir 'φ-coder/phcoder' Serbinenko
@ 2011-12-13 22:41     ` Vladimir 'φ-coder/phcoder' Serbinenko
  0 siblings, 0 replies; 7+ messages in thread
From: Vladimir 'φ-coder/phcoder' Serbinenko @ 2011-12-13 22:41 UTC (permalink / raw)
  To: grub-devel

On 01.10.2011 23:18, Vladimir 'φ-coder/phcoder' Serbinenko wrote:
> On 01.10.2011 23:11, Vincent Pelletier wrote:
>> More seriously, I feel the only value in this patch is in the ieee1275
>> wrappers for framebuffer entrypoints.
> Yes, that's interesting. We have ieee1275 framebuffer support on ppc but
> it fails and hence is disabled on sparc. Expecting this patch will allow
> me to find out why.
Actually there was nothing wrong with ieee1275_fb and it works on sparc. 
The problem is that sparc64 code allocates only 2MiB at most for heap 
which is small for graphics. I'll see if there is a way to allocate more 
safely.


-- 
Regards
Vladimir 'φ-coder/phcoder' Serbinenko



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

end of thread, other threads:[~2011-12-13 22:41 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-01 13:39 Mouse support in GRUB Tirtha Chatterjee
2011-10-01 17:10 ` Vladimir 'φ-coder/phcoder' Serbinenko
2011-10-01 17:12 ` Michal Suchanek
2011-10-01 17:39   ` Vladimir 'φ-coder/phcoder' Serbinenko
2011-10-01 21:11 ` Vincent Pelletier
2011-10-01 21:18   ` Vladimir 'φ-coder/phcoder' Serbinenko
2011-12-13 22:41     ` Vladimir 'φ-coder/phcoder' Serbinenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).