Skip to contentSkip to conversation

Sugguestion: separate input and output driver

DISCUSSION Bean 3 participants 4 messages May 29, 2008

lore
Share & tools
lore

Bean

author
#0 lore raw

Currently, input and output are bundled together, this make it quite difficult to extend.

Input:
Keyboard, Serial

Output:
Text mode, Video mode

Now, the binding is fixed using individual module:

Keyboard + Text = console
Keyboard + Video = gfxterm
Serial + Text = serial
Serial + Video = ?

And there are mixing as well.

If we separate them, it would make things much clear. For example, the grub_term structure can be split into two mutually exclusive parts:

struct grub_term =
{
.name,
.init,
.fini,
.putchar,
.getcharwidth,
.checkkey,
.getkey,
.getwh,
.getxy,
.gotoxy,
.cls,
.setcolorstate,
.setcursor,
.flags,
.next
};

=>

struct grub_input
{
.name,
.init,
.fini,
.checkkey,
.getkey
.flags,
.next
}

+

struct grub_output
{
.name,
.init,
.fini,
.putchar,
.getcharwidth,
.getxy,
.gotoxy,
.cls,
.setcolorstate,
.setcursor,
.flags,
.next
}

Integration between input and output:

Input driver <=> console driver <=> Output driver

The console driver is the central part. It accepts virtual key from the input driver, and write to the virtual screen provided by output driver.

Signature · 1 line
Bean
#1 lore raw
Quoted 16 lines · Bean

Currently, input and output are bundled together, this make it quite difficult to extend.

Input:
Keyboard, Serial

Output:
Text mode, Video mode

Now, the binding is fixed using individual module:

Keyboard + Text = console
Keyboard + Video = gfxterm
Serial + Text = serial
Serial + Video = ?

Quoted 4 lines

And there are mixing as well.

If we separate them, it would make things much clear. For example, the grub_term structure can be split into two mutually exclusive parts:

I've been wanting to do this for a while, but never had time for it.

Other annoying situations this would solve are:

at_keyboard + ofconsole (currently done with an ifdef hack) usb_keyboard + (vga_term | bios_console)

Signature · 5 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What good is a phone call… if you are unable to speak?
(as seen on /.)
#2 lore raw
In reply to Bean
Quoted 9 lines · Bean

struct grub_input
{
}

+

struct grub_output
{
}

I suggest grub_term_input / grub_term_output, to avoid confusion with disk I/O.

Signature · 5 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What good is a phone call… if you are unable to speak?
(as seen on /.)
#3 lore raw
In reply to Bean
Quoted 9 lines · Bean

Currently, input and output are bundled together, this make it quite difficult to extend.

Input:
Keyboard, Serial

Output:
Text mode, Video mode

Quoted 6 lines

Now, the binding is fixed using individual module:

Keyboard + Text = console
Keyboard + Video = gfxterm
Serial + Text = serial
Serial + Video = ?

What do you mean by text? For the PC console, output is different than that of the serial console.

Besides that, this seams like a good plan. This is something we need, but no one took the time to implement this.

--
Marco