[syslinux:master] hdt: Adding sleep command

syslinux-bot for Erwan Velu erwanaliasr1 at gmail.com
Mon Oct 22 12:51:05 PDT 2012


Commit-ID:  871650dd981da850bc05eae6de7471b3069926e9
Gitweb:     http://www.syslinux.org/commit/871650dd981da850bc05eae6de7471b3069926e9
Author:     Erwan Velu <erwanaliasr1 at gmail.com>
AuthorDate: Tue, 29 May 2012 21:14:33 +0200
Committer:  Erwan Velu <erwanaliasr1 at gmail.com>
CommitDate: Tue, 29 May 2012 21:14:33 +0200

hdt: Adding sleep command

This command will help users getting some delay between two automatic
commands.

As an example, it can be used to show a serie of pictures.

---
 com32/hdt/Makefile       |    2 ++
 com32/hdt/art/red.png    |  Bin 0 -> 19674 bytes
 com32/hdt/floppy/hdt.cfg |    2 +-
 com32/hdt/hdt-cli-hdt.c  |   17 +++++++++++++++++
 com32/hdt/hdt-cli.h      |    1 +
 5 files changed, 21 insertions(+), 1 deletions(-)

diff --git a/com32/hdt/Makefile b/com32/hdt/Makefile
index c5becad..add640a 100644
--- a/com32/hdt/Makefile
+++ b/com32/hdt/Makefile
@@ -75,6 +75,7 @@ hdt.img: hdt.c32 $(FLOPPY_DIR)/hdt.cfg $(FLOPPY_DIR)/mtools.conf $(topdir)/mtool
 	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:
+	MTOOLSRC=$(PWD)/$(FLOPPY_DIR)/mtools.conf $(MCOPY) $(ART_DIR)/red.png a:
 	mv hdt.img hdt-$(VERSION).img
 	ln -sf hdt-$(VERSION).img hdt.img
 
@@ -96,6 +97,7 @@ hdt.iso: hdt.c32 $(topdir)/core/isolinux.bin $(FLOPPY_DIR)/hdt.cfg memtest
 	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)
+	cp -av $(ART_DIR)/red.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/red.png b/com32/hdt/art/red.png
new file mode 100644
index 0000000..c5616ac
Binary files /dev/null and b/com32/hdt/art/red.png differ
diff --git a/com32/hdt/floppy/hdt.cfg b/com32/hdt/floppy/hdt.cfg
index 60b550f..a5afd60 100644
--- a/com32/hdt/floppy/hdt.cfg
+++ b/com32/hdt/floppy/hdt.cfg
@@ -103,7 +103,7 @@ TEXT HELP
  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;'
+APPEND modules_pcimap=modules.pcimap modules_alias=modules.alias pciids=pci.ids quiet nomenu vesa auto='display display.png; sleep 5000; display red.png'
 
 MENU SEPARATOR
 
diff --git a/com32/hdt/hdt-cli-hdt.c b/com32/hdt/hdt-cli-hdt.c
index 0fd51f3..70cd049 100644
--- a/com32/hdt/hdt-cli-hdt.c
+++ b/com32/hdt/hdt-cli-hdt.c
@@ -260,6 +260,18 @@ static void do_dump(int argc __unused, char **argv __unused,
 }
 
 /**
+ * do_sleep - sleep a number of milliseconds
+ **/ 
+static void do_sleep(int argc , char **argv ,
+		      struct s_hardware *hardware)
+{
+   (void) hardware;
+   if (argc != 1) return;
+   printf("Sleep %d milliseconds\n",atoi(argv[0]));
+   msleep(atoi(argv[0]));
+}
+
+/**
  * do_display - display an image to user
  **/
 static void do_display(int argc , char **argv ,
@@ -374,6 +386,11 @@ struct cli_callback_descr list_hdt_default_modules[] = {
      .nomodule = true,
      },
     {
+     .name = CLI_SLEEP,
+     .exec = do_sleep,
+     .nomodule = true,
+     },
+    {
      .name = NULL,
      .exec = NULL,
      .nomodule = false},
diff --git a/com32/hdt/hdt-cli.h b/com32/hdt/hdt-cli.h
index 0965dfa..82a4fc9 100644
--- a/com32/hdt/hdt-cli.h
+++ b/com32/hdt/hdt-cli.h
@@ -68,6 +68,7 @@
 #define CLI_DUMP "dump"
 #define CLI_SAY "say"
 #define CLI_DISPLAY "display"
+#define CLI_SLEEP "sleep"
 
 typedef enum {
     INVALID_MODE,


More information about the Syslinux-commits mailing list