Restrict terminfo to serial
This commit is contained in:
parent
686ff5b4d1
commit
9f0cd916a4
3 changed files with 29 additions and 26 deletions
|
@ -21,15 +21,17 @@
|
|||
|
||||
#include <grub/err.h>
|
||||
#include <grub/types.h>
|
||||
#include <grub/term.h>
|
||||
|
||||
char *grub_terminfo_get_current (void);
|
||||
grub_err_t grub_terminfo_set_current (const char *);
|
||||
|
||||
void grub_terminfo_gotoxy (grub_uint8_t x, grub_uint8_t y);
|
||||
void grub_terminfo_cls (void);
|
||||
void grub_terminfo_reverse_video_on (void);
|
||||
void grub_terminfo_reverse_video_off (void);
|
||||
void grub_terminfo_cursor_on (void);
|
||||
void grub_terminfo_cursor_off (void);
|
||||
void grub_terminfo_gotoxy (grub_uint8_t x, grub_uint8_t y,
|
||||
grub_term_output_t oterm);
|
||||
void grub_terminfo_cls (grub_term_output_t oterm);
|
||||
void grub_terminfo_reverse_video_on (grub_term_output_t oterm);
|
||||
void grub_terminfo_reverse_video_off (grub_term_output_t oterm);
|
||||
void grub_terminfo_cursor_on (grub_term_output_t oterm);
|
||||
void grub_terminfo_cursor_off (grub_term_output_t oterm);
|
||||
|
||||
#endif /* ! GRUB_TERMINFO_HEADER */
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#define TEXT_WIDTH 80
|
||||
#define TEXT_HEIGHT 25
|
||||
|
||||
static struct grub_term_output grub_serial_term_output;
|
||||
static unsigned int xpos, ypos;
|
||||
static unsigned int keep_track = 1;
|
||||
static unsigned int registered = 0;
|
||||
|
@ -413,7 +414,7 @@ grub_serial_gotoxy (grub_uint8_t x, grub_uint8_t y)
|
|||
else
|
||||
{
|
||||
keep_track = 0;
|
||||
grub_terminfo_gotoxy (x, y);
|
||||
grub_terminfo_gotoxy (x, y, &grub_serial_term_output);
|
||||
keep_track = 1;
|
||||
|
||||
xpos = x;
|
||||
|
@ -425,7 +426,7 @@ static void
|
|||
grub_serial_cls (void)
|
||||
{
|
||||
keep_track = 0;
|
||||
grub_terminfo_cls ();
|
||||
grub_terminfo_cls (&grub_serial_term_output);
|
||||
keep_track = 1;
|
||||
|
||||
xpos = ypos = 0;
|
||||
|
@ -439,10 +440,10 @@ grub_serial_setcolorstate (const grub_term_color_state state)
|
|||
{
|
||||
case GRUB_TERM_COLOR_STANDARD:
|
||||
case GRUB_TERM_COLOR_NORMAL:
|
||||
grub_terminfo_reverse_video_off ();
|
||||
grub_terminfo_reverse_video_off (&grub_serial_term_output);
|
||||
break;
|
||||
case GRUB_TERM_COLOR_HIGHLIGHT:
|
||||
grub_terminfo_reverse_video_on ();
|
||||
grub_terminfo_reverse_video_on (&grub_serial_term_output);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -454,9 +455,9 @@ static void
|
|||
grub_serial_setcursor (const int on)
|
||||
{
|
||||
if (on)
|
||||
grub_terminfo_cursor_on ();
|
||||
grub_terminfo_cursor_on (&grub_serial_term_output);
|
||||
else
|
||||
grub_terminfo_cursor_off ();
|
||||
grub_terminfo_cursor_off (&grub_serial_term_output);
|
||||
}
|
||||
|
||||
static struct grub_term_input grub_serial_term_input =
|
||||
|
|
|
@ -108,52 +108,52 @@ grub_terminfo_set_current (const char *str)
|
|||
|
||||
/* Wrapper for grub_putchar to write strings. */
|
||||
static void
|
||||
putstr (const char *str)
|
||||
putstr (const char *str, grub_term_output_t oterm)
|
||||
{
|
||||
while (*str)
|
||||
grub_putchar (*str++);
|
||||
grub_putcode (*str++, oterm);
|
||||
}
|
||||
|
||||
/* Move the cursor to the given position starting with "0". */
|
||||
void
|
||||
grub_terminfo_gotoxy (grub_uint8_t x, grub_uint8_t y)
|
||||
grub_terminfo_gotoxy (grub_uint8_t x, grub_uint8_t y, grub_term_output_t oterm)
|
||||
{
|
||||
putstr (grub_terminfo_tparm (term.gotoxy, y, x));
|
||||
putstr (grub_terminfo_tparm (term.gotoxy, y, x), oterm);
|
||||
}
|
||||
|
||||
/* Clear the screen. */
|
||||
void
|
||||
grub_terminfo_cls (void)
|
||||
grub_terminfo_cls (grub_term_output_t oterm)
|
||||
{
|
||||
putstr (grub_terminfo_tparm (term.cls));
|
||||
putstr (grub_terminfo_tparm (term.cls), oterm);
|
||||
}
|
||||
|
||||
/* Set reverse video mode on. */
|
||||
void
|
||||
grub_terminfo_reverse_video_on (void)
|
||||
grub_terminfo_reverse_video_on (grub_term_output_t oterm)
|
||||
{
|
||||
putstr (grub_terminfo_tparm (term.reverse_video_on));
|
||||
putstr (grub_terminfo_tparm (term.reverse_video_on), oterm);
|
||||
}
|
||||
|
||||
/* Set reverse video mode off. */
|
||||
void
|
||||
grub_terminfo_reverse_video_off (void)
|
||||
grub_terminfo_reverse_video_off (grub_term_output_t oterm)
|
||||
{
|
||||
putstr (grub_terminfo_tparm (term.reverse_video_off));
|
||||
putstr (grub_terminfo_tparm (term.reverse_video_off), oterm);
|
||||
}
|
||||
|
||||
/* Show cursor. */
|
||||
void
|
||||
grub_terminfo_cursor_on (void)
|
||||
grub_terminfo_cursor_on (grub_term_output_t oterm)
|
||||
{
|
||||
putstr (grub_terminfo_tparm (term.cursor_on));
|
||||
putstr (grub_terminfo_tparm (term.cursor_on), oterm);
|
||||
}
|
||||
|
||||
/* Hide cursor. */
|
||||
void
|
||||
grub_terminfo_cursor_off (void)
|
||||
grub_terminfo_cursor_off (grub_term_output_t oterm)
|
||||
{
|
||||
putstr (grub_terminfo_tparm (term.cursor_off));
|
||||
putstr (grub_terminfo_tparm (term.cursor_off), oterm);
|
||||
}
|
||||
|
||||
/* GRUB Command. */
|
||||
|
|
Loading…
Reference in a new issue