hdt: Adding vesa mode support
authorErwan Velu <erwan.velu@free.fr>
Fri, 20 Nov 2009 15:49:42 +0000 (16:49 +0100)
committerErwan Velu <erwan.velu@free.fr>
Fri, 20 Nov 2009 15:49:42 +0000 (16:49 +0100)
Impact: cli can now be turned into vesa

Using the "vesa" keyword at boot time, you can enable the vesa mode for
the cli.

com32/hdt/hdt-common.c
com32/hdt/hdt-common.h
com32/hdt/hdt.c

index 55b0b7e..cdcd695 100644 (file)
@@ -58,6 +58,9 @@ void detect_parameters(const int argc, const char *argv[],
   /* Quiet mode - make the output more quiet */
   quiet = false;
 
+  /* Vesa mode isn't set until we explictly call it*/
+  vesamode = false;
+
   for (int i = 1; i < argc; i++) {
     if (!strncmp(argv[i], "quiet", 5)) {
         quiet = true;
@@ -81,6 +84,9 @@ void detect_parameters(const int argc, const char *argv[],
       strncpy(hardware->reboot_label, argv[i] + 7,
         sizeof(hardware->reboot_label));
       convert_isolinux_filename(hardware->reboot_label,hardware);
+    } else if (!strncmp(argv[i], "vesa", 4)) {
+        vesamode=true;
+       max_console_lines=24;
     } else if (!strncmp(argv[i], "auto=", 5)) {
                /* The auto= parameter is separated in several argv[]
                 * as it can contains spaces.
index f178b22..cd1dc3c 100644 (file)
 /* Defines if the cli is quiet*/
 bool quiet;
 
+/* Defines if we must use the vesa mode */
+bool vesamode;
+
+/* Defines the number of lines in the console
+ * Default is 20 for a std console */
+extern int max_console_lines;
+
 extern int display_line_nb;
 extern bool disable_more_printf;
 
@@ -84,7 +91,7 @@ extern bool disable_more_printf;
  */
 #define more_printf(...) do {\
  if (__likely(!disable_more_printf)) {\
-  if (display_line_nb == 20) {\
+  if (display_line_nb == max_console_lines) {\
    display_line_nb=0;\
    printf("\n--More--");\
    get_key(stdin, 0);\
index 30cb062..6daf3ae 100644 (file)
@@ -35,6 +35,7 @@
 #include <stdio.h>
 #include <console.h>
 #include <consoles.h>
+#include <syslinux/vesacon.h>
 #include "hdt.h"
 #include "hdt-cli.h"
 #include "hdt-menu.h"
@@ -42,6 +43,9 @@
 
 int display_line_nb = 0;
 bool disable_more_printf = false;
+/* Defines the number of lines in the console
+ * Default is 20 for a std console */
+int max_console_lines=20;
 
 int main(const int argc, const char *argv[])
 {
@@ -52,23 +56,25 @@ int main(const int argc, const char *argv[])
   snprintf(version_string, sizeof version_string, "%s %s (%s)",
            PRODUCT_NAME,VERSION, CODENAME);
 
+  /* Detecting parameters */
+  detect_parameters(argc, argv, &hardware);
+
   /* Opening the Syslinux console */
-  console_ansi_raw();
+  if (vesamode) openconsole(&dev_rawcon_r, &dev_vesaserial_w);
+  else console_ansi_raw();
 
   /* Cleaning structures */
   init_hardware(&hardware);
 
   /* Detecting Syslinux version */
   detect_syslinux(&hardware);
-
-  /* Detecting parameters */
-  detect_parameters(argc, argv, &hardware);
-
+  
   /* Clear the screen and reset position of the cursor */
   clear_screen();
   printf("\033[1;1H");
-
+  
   printf("%s\n", version_string);
+
   if ((arg = find_argument(argv + 1, "nomenu")) || (find_argument(argv+1,"auto")))
        start_cli_mode(&hardware);
   else {