]> git.webhop.me Git - lcd4linux.git/commitdiff
- dpf: read goodbye message from /tmp/lcd/goodbye
authorsvenhoefer <svenhoefer@svenhoefer.com>
Tue, 3 May 2016 10:21:01 +0000 (12:21 +0200)
committersvenhoefer <svenhoefer@svenhoefer.com>
Tue, 3 May 2016 10:27:37 +0000 (12:27 +0200)
drv_dpf.c
drv_generic_graphic.c

index d4c051d562df96244d2eb2512c2738dbffa779a8..01243c29fadd137523aeec1bd15c2ec385f090e4 100644 (file)
--- a/drv_dpf.c
+++ b/drv_dpf.c
@@ -418,9 +418,41 @@ int drv_dpf_quit(const int quiet)
     drv_generic_graphic_clear();
 
     /* say goodbye... */
-    if (!quiet) {
-       drv_generic_graphic_greet("goodbye!", NULL);
-    }
+       //read goodby message from /tmp/lcd/goodbye
+       char line1[80], value[80];
+       FILE *fp;
+       int i, size;
+
+       fp = fopen("/tmp/lcd/goodbye", "r");
+       if (!fp) {
+               debug("couldn't open file '/tmp/lcd/goodbye'");
+               line1[0] = '\0';
+               if (!quiet) {
+                       drv_generic_graphic_greet("goodbye!", NULL);
+               }
+       } else {
+               i = 0;
+               while (!feof(fp) && i++ < 1) {
+                       fgets(value, sizeof(value), fp);
+                       size = strcspn(value, "\r\n");
+                       strncpy(line1, value, size);
+                       line1[size] = '\0';
+                       /* more than 80 chars, chew up rest of line */
+                       while (!feof(fp) && strchr(value, '\n') == NULL) {
+                               fgets(value, sizeof(value), fp);
+                       }
+               }
+               fclose(fp);
+               if (i <= 1) {
+                       debug("'/tmp/lcd/goodbye' seems empty");
+                       line1[0] = '\0';
+               }
+               /* remove the file */
+               debug("removing '/tmp/lcd/goodbye'");
+               unlink("/tmp/lcd/goodbye");
+
+               drv_generic_graphic_greet(NULL, line1);
+       }
 
     drv_generic_graphic_quit();
 
index 847bbf4f0d881a0c54e8c3d99b614417c22362fc..396f2294cbc1bec8ff34b828a34fde9342e54271 100644 (file)
@@ -290,6 +290,7 @@ static void drv_generic_graphic_render(const int layer, const int row, const int
 /* say hello to the user */
 int drv_generic_graphic_greet(const char *msg1, const char *msg2)
 {
+#if 0
     char *line1[] = { "* LCD4Linux " VERSION " *",
        "LCD4Linux " VERSION,
        "* LCD4Linux *",
@@ -302,6 +303,10 @@ int drv_generic_graphic_greet(const char *msg1, const char *msg2)
        "lcd4linux.bulix.org",
        NULL
     };
+#endif
+
+    char *line1[] = { NULL };
+    char *line2[] = { NULL };
 
     int i;
     int flag = 0;