hdt: Adding display command to change background
authorErwan Velu <erwanaliasr1@gmail.com>
Tue, 29 May 2012 19:01:17 +0000 (21:01 +0200)
committerErwan Velu <erwanaliasr1@gmail.com>
Tue, 29 May 2012 19:01:17 +0000 (21:01 +0200)
This command allow switching the background image. This could be used
for example to give more explicit message to users.

Idea is coming from the FGTC project

com32/hdt/Makefile
com32/hdt/art/display.png [new file with mode: 0644]
com32/hdt/floppy/hdt.cfg
com32/hdt/hdt-cli-hdt.c
com32/hdt/hdt-cli.h

index ea9ddfe..c5becad 100644 (file)
@@ -74,6 +74,7 @@ hdt.img: hdt.c32 $(FLOPPY_DIR)/hdt.cfg $(FLOPPY_DIR)/mtools.conf $(topdir)/mtool
        MTOOLSRC=$(PWD)/$(FLOPPY_DIR)/mtools.conf $(MCOPY) $(FLOPPY_DIR)/syslinux.cfg a:
        MTOOLSRC=$(PWD)/$(FLOPPY_DIR)/mtools.conf $(MCOPY) $(FLOPPY_DIR)/$(MEMTEST) a:
        MTOOLSRC=$(PWD)/$(FLOPPY_DIR)/mtools.conf $(MCOPY) $(ART_DIR)/backgnd.png a:
+       MTOOLSRC=$(PWD)/$(FLOPPY_DIR)/mtools.conf $(MCOPY) $(ART_DIR)/display.png a:
        mv hdt.img hdt-$(VERSION).img
        ln -sf hdt-$(VERSION).img hdt.img
 
@@ -94,6 +95,7 @@ hdt.iso: hdt.c32 $(topdir)/core/isolinux.bin $(FLOPPY_DIR)/hdt.cfg memtest
        cp $(MENU_COM32) $(ISO_DIR)/$(ISOLINUX_DIR)
        cp $(CHAIN_COM32) $(ISO_DIR)/$(ISOLINUX_DIR)
        cp -av $(ART_DIR)/backgnd.png $(ISO_DIR)/$(ISOLINUX_DIR)
+       cp -av $(ART_DIR)/display.png $(ISO_DIR)/$(ISOLINUX_DIR)
        -[ ! -f $(GZ_PCI_IDS_FILE) ] && cp /usr/share/hwdata/pci.ids $(PCI_IDS_FILE) && $(GZIPPROG) $(PCI_IDS_FILE)
        -[ ! -f $(GZ_PCI_IDS_FILE) ] && cp /usr/share/pci.ids $(PCI_IDS_FILE) && $(GZIPPROG) $(PCI_IDS_FILE)
        -[ -f $(MODULES_ALIAS_FILE) ] && cp $(MODULES_ALIAS_FILE) $(ISO_DIR)/$(ISOLINUX_DIR)\
diff --git a/com32/hdt/art/display.png b/com32/hdt/art/display.png
new file mode 100644 (file)
index 0000000..31fabef
Binary files /dev/null and b/com32/hdt/art/display.png differ
index e5f3b0a..60b550f 100644 (file)
@@ -95,6 +95,16 @@ ENDTEXT
 COM32 hdt.c32
 APPEND modules_pcimap=modules.pcimap modules_alias=modules.alias pciids=pci.ids quiet vesa nomenu auto='show memory;say `########`;say `Starting memtest in 5 sec`%5;exit' postexec='memtest'
 
+LABEL display
+MENU LABEL Display feature (VESA mode)
+TEXT HELP
+ Starts HDT using the Command Line Interface (CLI)
+ VESA mode is enabled
+ A Picture is shown by using the display command
+ENDTEXT
+COM32 hdt.c32
+APPEND modules_pcimap=modules.pcimap modules_alias=modules.alias pciids=pci.ids quiet nomenu vesa auto='display display.png;'
+
 MENU SEPARATOR
 
 LABEL memtest
index f7f7e94..0fd51f3 100644 (file)
@@ -260,6 +260,18 @@ static void do_dump(int argc __unused, char **argv __unused,
 }
 
 /**
+ * do_display - display an image to user
+ **/
+static void do_display(int argc , char **argv ,
+                     struct s_hardware *hardware)
+{
+   (void) hardware;
+   if ((argc != 1) || (vesamode == false)) return;
+   printf("Display %s file\n",argv[0]);
+   vesacon_load_background(argv[0]);
+}
+
+/**
  * do_say - say message to user
  **/
 static void do_say(int argc , char **argv ,
@@ -357,6 +369,11 @@ struct cli_callback_descr list_hdt_default_modules[] = {
      .nomodule = true,
      },
     {
+     .name = CLI_DISPLAY,
+     .exec = do_display,
+     .nomodule = true,
+     },
+    {
      .name = NULL,
      .exec = NULL,
      .nomodule = false},
index 30fe518..0965dfa 100644 (file)
@@ -67,6 +67,7 @@
 #define CLI_DISABLE "disable"
 #define CLI_DUMP "dump"
 #define CLI_SAY "say"
+#define CLI_DISPLAY "display"
 
 typedef enum {
     INVALID_MODE,