make LCDd's exit message configurable
This commit is contained in:
@@ -37,6 +37,7 @@ v.0.5dev (ongoing development)
|
|||||||
+ picolcd - driver for Mini-box.com USB LCD picoLCD (Gatewood Green)
|
+ picolcd - driver for Mini-box.com USB LCD picoLCD (Gatewood Green)
|
||||||
+ new ConnectionType pertelian in hd44780 driver (Matteo Pillon)
|
+ new ConnectionType pertelian in hd44780 driver (Matteo Pillon)
|
||||||
+ new ConnectionType lcd2usb in hd44780 driver
|
+ new ConnectionType lcd2usb in hd44780 driver
|
||||||
|
+ make LCDd's GoodBye message configurable
|
||||||
|
|
||||||
v.0.5.1
|
v.0.5.1
|
||||||
+ config file support in lcdproc client (Andrew Foss)
|
+ config file support in lcdproc client (Andrew Foss)
|
||||||
|
|||||||
@@ -78,6 +78,10 @@ User=nobody
|
|||||||
# NOTE: Always place a slash as last character !
|
# NOTE: Always place a slash as last character !
|
||||||
DriverPath=server/drivers/
|
DriverPath=server/drivers/
|
||||||
|
|
||||||
|
# GoodBye message: each entry represents a display line; default: builtin
|
||||||
|
#GoodBye="Thanks for using"
|
||||||
|
#GoodBye=" LCDproc!"
|
||||||
|
|
||||||
# The "...Key=" lines define what the server does with keypresses that
|
# The "...Key=" lines define what the server does with keypresses that
|
||||||
# don't go to any client.
|
# don't go to any client.
|
||||||
# These are the defaults:
|
# These are the defaults:
|
||||||
|
|||||||
@@ -27,8 +27,6 @@ one there, so I'll keep thinking on it for now.
|
|||||||
just to not display a useless menu.
|
just to not display a useless menu.
|
||||||
Let the server menu name be configurable in the config file with the
|
Let the server menu name be configurable in the config file with the
|
||||||
[menu]menuentryname="Menu Name" option in LCDd.conf.
|
[menu]menuentryname="Menu Name" option in LCDd.conf.
|
||||||
* setting the goodbye msg - which we set to "shutting down", instead of
|
|
||||||
"Thanks for using lcdproc+linux"
|
|
||||||
|
|
||||||
3. SEG - adds the ability to get a stack trace for the LCDd daemon. I
|
3. SEG - adds the ability to get a stack trace for the LCDd daemon. I
|
||||||
didn't actually catch a useful trace w/ it, but might be a nice
|
didn't actually catch a useful trace w/ it, but might be a nice
|
||||||
|
|||||||
@@ -241,22 +241,3 @@ diff -ruNp lcdproc-0.5.1-orig/server/serverscreens.c lcdproc-0.5.1-working/serve
|
|||||||
} else {
|
} else {
|
||||||
w->text[0] = 0;
|
w->text[0] = 0;
|
||||||
}
|
}
|
||||||
@@ -157,6 +173,18 @@ goodbye_screen ()
|
|
||||||
char *l16 = " LCDproc! ";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
+#ifndef OPT // disable config goobye
|
|
||||||
+ char * goodbye_string;
|
|
||||||
+
|
|
||||||
+ if ( (goodbye_string = strdup(config_get_string("server", "goodbye", 0, "")))) {
|
|
||||||
+ t20=t16=goodbye_string;
|
|
||||||
+ if (strlen(goodbye_string) > 16 )
|
|
||||||
+ l16 = goodbye_string + 16;
|
|
||||||
+ if (strlen(goodbye_string) > 20 )
|
|
||||||
+ l20 = goodbye_string + 20;
|
|
||||||
+ }
|
|
||||||
+#endif //OPT
|
|
||||||
+
|
|
||||||
if( !display_props )
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
|
|||||||
@@ -221,6 +221,39 @@ settings for the LCDproc server <application>LCDd</application>.
|
|||||||
to syslog. Defaults to <literal>no</literal>.
|
to syslog. Defaults to <literal>no</literal>.
|
||||||
</para></listitem>
|
</para></listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
<varlistentry>
|
||||||
|
<term>
|
||||||
|
<command>GoodBye=</command>
|
||||||
|
<arg choice="plain"><replaceable>GOODBYEMSG</replaceable></arg>
|
||||||
|
</term>
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
Define the message left on the screen when LCDd exits.
|
||||||
|
If not given, it defaults to the builtin
|
||||||
|
<literal>Thanks for using LCDproc!</literal>.
|
||||||
|
If it is given, each <code>GoodBye=</code> directive represents
|
||||||
|
a line on the display.
|
||||||
|
</para>
|
||||||
|
<para>
|
||||||
|
The <replaceable>GOODBYEMSG</replaceable>s will be printed on
|
||||||
|
the display one after each other starting on the beginning of each line.
|
||||||
|
So, the definition of
|
||||||
|
<programlisting>
|
||||||
|
GoodBye=" So Long,"
|
||||||
|
GoodBye=" and"
|
||||||
|
GoodBye="Thanks for All the Fish!"
|
||||||
|
</programlisting>
|
||||||
|
prints the well known dolphin's message on the first 3 lines
|
||||||
|
of the display (which obviously needs to be 24 columns wide
|
||||||
|
to show the full last line).
|
||||||
|
</para>
|
||||||
|
<para>
|
||||||
|
To simply disable the default builtin message, and leave the screen blank
|
||||||
|
a single <code>GoodBye=""</code> suffices.
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
</variablelist>
|
</variablelist>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+29
-39
@@ -22,6 +22,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "shared/report.h"
|
#include "shared/report.h"
|
||||||
|
#include "shared/configfile.h"
|
||||||
|
|
||||||
#include "drivers/lcd.h"
|
#include "drivers/lcd.h"
|
||||||
#include "drivers.h"
|
#include "drivers.h"
|
||||||
@@ -139,53 +140,42 @@ update_server_screen ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
goodbye_screen ()
|
goodbye_screen()
|
||||||
{
|
{
|
||||||
char *b20 = " ";
|
if(!display_props)
|
||||||
char *t20 = " Thanks for using ";
|
|
||||||
#ifdef LINUX
|
|
||||||
char *l20 = " LCDproc and Linux! ";
|
|
||||||
#else
|
|
||||||
char *l20 = " LCDproc! ";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
char *b16 = " ";
|
|
||||||
char *t16 = "Thanks for using";
|
|
||||||
#ifdef LINUX
|
|
||||||
char *l16 = " LCDproc+Linux! ";
|
|
||||||
#else
|
|
||||||
char *l16 = " LCDproc! ";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if( !display_props )
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
drivers_clear ();
|
drivers_clear();
|
||||||
|
|
||||||
if (display_props->height >= 4) {
|
if (config_has_key("Server", "GoodBye")) { /* custom GoodBye */
|
||||||
if (display_props->width >= 20) {
|
int i;
|
||||||
drivers_string (1, 1, b20);
|
|
||||||
drivers_string (1, 2, t20);
|
/* loop over all display lines to read config & display message */
|
||||||
drivers_string (1, 3, l20);
|
for (i = 0; i < display_props->height; i++) {
|
||||||
drivers_string (1, 4, b20);
|
const char *line = config_get_string("Server", "GoodBye", i, "");
|
||||||
} else {
|
|
||||||
drivers_string (1, 1, b16);
|
drivers_string(1, 1+i, line);
|
||||||
drivers_string (1, 2, t16);
|
|
||||||
drivers_string (1, 3, l16);
|
|
||||||
drivers_string (1, 4, b16);
|
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
if (display_props->width >= 20) {
|
else { /* default GoodBye */
|
||||||
drivers_string (1, 1, t20);
|
if ((display_props->height >= 2) && (display_props->width >= 16)) {
|
||||||
drivers_string (1, 2, l20);
|
int xoffs = (display_props->width - 16) / 2;
|
||||||
} else {
|
int yoffs = (display_props->height - 2) / 2;
|
||||||
drivers_string (1, 1, t16);
|
|
||||||
drivers_string (1, 2, l16);
|
char *top = "Thanks for using";
|
||||||
|
#ifdef LINUX
|
||||||
|
char *low = "LCDproc & Linux!";
|
||||||
|
#else
|
||||||
|
char *low = " LCDproc! ";
|
||||||
|
#endif
|
||||||
|
|
||||||
|
drivers_string(1+xoffs, 1+yoffs, top);
|
||||||
|
drivers_string(1+xoffs, 2+yoffs, low);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
drivers_cursor (1, 1, CURSOR_OFF);
|
drivers_cursor(1, 1, CURSOR_OFF);
|
||||||
drivers_flush ();
|
drivers_flush();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user