aboutsummaryrefslogtreecommitdiffstats
path: root/lcd4linux.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--lcd4linux.c88
-rw-r--r--lcd4linux.conf.sample128
2 files changed, 185 insertions, 31 deletions
diff --git a/lcd4linux.c b/lcd4linux.c
index 0fc3d15..842f653 100644
--- a/lcd4linux.c
+++ b/lcd4linux.c
@@ -1,11 +1,10 @@
-/* $Id: lcd4linux.c 783 2007-03-22 06:10:36Z michael $
- * $URL: https://ssl.bulix.org/svn/lcd4linux/branches/0.10.1/lcd4linux.c $
- * $URL: https://ssl.bulix.org/svn/lcd4linux/branches/0.10.1/lcd4linux.c $
+/* $Id: lcd4linux.c 1106 2010-02-07 14:03:46Z mzuther $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/lcd4linux.c $
*
* LCD4Linux
*
- * Copyright (C) 1999, 2000, 2001, 2002, 2003 Michael Reinelt <reinelt@eunet.at>
- * Copyright (C) 2004, 2005, 2006, 2007 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ * Copyright (C) 1999, 2000, 2001, 2002, 2003 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
*
* This file is part of LCD4Linux.
*
@@ -35,6 +34,8 @@
#include <errno.h>
#include <signal.h>
#include <time.h>
+#include <sys/types.h> /* umask() */
+#include <sys/stat.h> /* umask() */
#include "svn_version.h"
#include "cfg.h"
@@ -44,10 +45,11 @@
#include "udelay.h"
#include "drv.h"
#include "timer.h"
+#include "timer_group.h"
#include "layout.h"
#include "plugin.h"
#include "thread.h"
-
+#include "event.h"
#include "widget.h"
#include "widget_timer.h"
@@ -58,7 +60,8 @@
#define PIDFILE "/var/run/lcd4linux.pid"
static char *release = "LCD4Linux " VERSION "-" SVN_VERSION;
-static char *copyright = "Copyright (C) 2005, 2006, 2007 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>";
+static char *copyright =
+ "Copyright (C) 2005, 2006, 2007, 2008, 2009 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>";
static char **my_argv;
extern char *output;
@@ -69,10 +72,34 @@ static void usage(void)
{
printf("%s\n", release);
printf("%s\n", copyright);
- printf("usage: lcd4linux [-h]\n");
- printf(" lcd4linux [-l]\n");
- printf(" lcd4linux [-c key=value] [-i] [-f config-file] [-v] [-p pid-file]\n");
- printf(" lcd4linux [-c key=value] [-F] [-f config-file] [-o output-file] [-q] [-v]\n");
+ printf("\n");
+ printf("usage:\n");
+ printf(" lcd4linux [-h]\n");
+ printf(" lcd4linux [-l]\n");
+ printf(" lcd4linux [-c key=value] [-i] [-f config-file] [-v] [-p pid-file]\n");
+ printf(" lcd4linux [-c key=value] [-F] [-f config-file] [-o output-file] [-q] [-v]\n");
+ printf("\n");
+ printf("options:\n");
+ printf(" -h help\n");
+ printf(" -l list available display drivers and plugins\n");
+ printf(" -c <key>=<value> overwrite entries from the config-file\n");
+ printf(" -i enter interactive mode (after display initialisation)\n");
+ printf(" -ii enter interactive mode (before display initialisation)\n");
+ printf(" -f <config-file> use configuration from <config-file> instead of /etc/lcd4linux.conf\n");
+ printf(" -v generate info messages\n");
+ printf(" -vv generate debugging messages\n");
+ printf(" -p <pid-file> specify a different pid-file location (default is /var/run/lcd4linux.pid)\n");
+ printf(" -F do not fork and detach (run in foreground)\n");
+ printf(" -o <output-file> write picture to file (raster driver only)\n");
+ printf(" -q suppress startup and exit splash screen\n");
+#ifdef WITH_X11
+ printf("special X11 options:\n");
+ printf(" -display <X11 display name> preceeds X connection given in $DISPLAY\n");
+ printf(" -synchronous use synchronized communication with X server (for debugging)\n");
+ printf("\n");
+ printf("\n");
+ printf("\n");
+#endif
}
static void interactive_mode(void)
@@ -187,6 +214,7 @@ int main(int argc, char *argv[])
int c;
int quiet = 0;
int interactive = 0;
+ int list_mode = 0;
int pid;
/* save arguments for restart */
@@ -203,6 +231,13 @@ int main(int argc, char *argv[])
running_foreground = 0;
running_background = 0;
+#ifdef WITH_X11
+ drv_X11_parseArgs(&argc, argv);
+ if (argc != thread_argc) {
+ /* info() will not work here because verbose level is not known */
+ printf("recognized special X11 parameters\n");
+ }
+#endif
while ((c = getopt(argc, argv, "c:Ff:hilo:qvp:")) != EOF) {
switch (c) {
@@ -225,10 +260,8 @@ int main(int argc, char *argv[])
interactive++;
break;
case 'l':
- printf("%s\n", release);
- printf("%s\n", copyright);
- drv_list();
- exit(0);
+ list_mode++;
+ break;
case 'o':
output = optarg;
break;
@@ -256,16 +289,31 @@ int main(int argc, char *argv[])
running_foreground = 1;
}
- info("Version " VERSION "-" SVN_VERSION " starting");
+ if (list_mode > 0) {
+ printf("%s\n", release);
+ printf("%s\n", copyright);
+ printf("\n");
+ drv_list();
+ printf("\n");
+ plugin_list();
+ printf("\n");
+ exit(0);
+ }
+
+ info("%s starting", release);
if (!running_foreground && (my_argv[0] == NULL || my_argv[0][0] != '/')) {
info("invoked without full path; restart may not work!");
}
- if (cfg_init(cfg) == -1)
+ if (cfg_init(cfg) == -1) {
+ error("Error reading configuration. Exit!");
exit(1);
+ }
- if (plugin_init() == -1)
+ if (plugin_init() == -1) {
+ error("Error initializing plugins. Exit!");
exit(1);
+ }
display = cfg_get(NULL, "Display", NULL);
if (display == NULL || *display == '\0') {
@@ -316,6 +364,7 @@ int main(int argc, char *argv[])
debug("initializing driver %s", driver);
if (drv_init(section, driver, quiet) == -1) {
+ error("Error initializing driver %s: Exit!", driver);
pid_exit(pidfile);
exit(1);
}
@@ -356,7 +405,7 @@ int main(int argc, char *argv[])
struct timespec delay;
if (timer_process(&delay) < 0)
break;
- nanosleep(&delay, NULL);
+ event_process(&delay);
}
debug("leaving main loop");
@@ -365,6 +414,7 @@ int main(int argc, char *argv[])
pid_exit(pidfile);
cfg_exit();
plugin_exit();
+ timer_exit_group();
timer_exit();
if (got_signal == SIGHUP) {
diff --git a/lcd4linux.conf.sample b/lcd4linux.conf.sample
index c485b39..cf90750 100644
--- a/lcd4linux.conf.sample
+++ b/lcd4linux.conf.sample
@@ -1,5 +1,5 @@
-# $Id: lcd4linux.conf.sample 759 2007-02-04 05:55:58Z michael $
-# $URL: https://ssl.bulix.org/svn/lcd4linux/branches/0.10.1/lcd4linux.conf.sample $
+# $Id: lcd4linux.conf.sample 1133 2010-11-19 09:02:34Z harbaum $
+# $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/lcd4linux.conf.sample $
Variables {
@@ -41,6 +41,13 @@ Display LCD-Linux {
UseBusy 0
}
+Display IRLCD {
+ Driver 'IRLCD'
+ Size '16x2'
+ Backlight 0
+ Icons 1
+}
+
Display LCD2USB {
Driver 'LCD2USB'
Size '20x2'
@@ -48,6 +55,17 @@ Display LCD2USB {
Icons 1
}
+Display GLCD2USB {
+ Driver 'GLCD2USB'
+ Brightness 255
+}
+
+Display ABP08-16x3 {
+ Driver 'LW_ABP'
+ Port '/dev/tts/0'
+ Speed 19200
+ Size '16x3'
+}
Display LCD2041 {
Driver 'MatrixOrbital'
@@ -254,6 +272,13 @@ Display picoLCD {
Icons 1
}
+Display picoLCDGraphic {
+ Driver 'picoLCDGraphic'
+ Size '256x64'
+ Contrast 0
+ Backlight 100
+}
+
Display SC1602D {
Driver 'HD44780'
Port '/dev/parports/0'
@@ -303,7 +328,7 @@ Display HD44780-I2C {
Display LCDTerm {
- Driver 'LCDTerm
+ Driver 'LCDTerm'
Port '/dev/tts/0'
Speed 19200
Size '20x4'
@@ -318,6 +343,15 @@ Display SimpleLCD {
Size '20x2'
}
+Display PHAnderson {
+ Driver 'PHAnderson'
+ Port '/dev/tts/0'
+ Speed 19200
+ Size '24x2'
+ Blackligth 100
+ Bootscreen '123456789012345678901234ABCDEFGHIJKLMNOPQRSTUVWX'
+}
+
Display BA63 {
Driver 'WincorNixdorf'
Model 'BA63'
@@ -356,6 +390,13 @@ Display CT20x4 {
}
+Display ULA200 {
+ Driver 'ULA200'
+ Size '20x4'
+ Icons 0
+ Backlight 1
+}
+
Display USBLCD {
Driver 'USBLCD'
# Port '/dev/lcd0'
@@ -440,6 +481,12 @@ Display ctinclud {
Inverted 0
}
+Display ASTUSB {
+ Driver 'ASTUSB'
+ Size '20x4'
+ Backlight 1
+}
+
Display XWindow {
Driver 'X11'
Size '120x32'
@@ -447,12 +494,11 @@ Display XWindow {
Pixel '4+1'
Gap '-1x-1'
Border 20
-# Foreground '#000000'
-# Background '#80d000'
-# Halfground '#70c000'
- Foreground '000000cc'
- Background '00000022'
- Basecolor '80d000'
+ Buttons 2
+ Foreground '000000cc'
+ Background '00000022'
+ Basecolor '80d000'
+ Bordercolor '90e000'
}
Display Image {
@@ -472,6 +518,26 @@ Display Image {
Basecolor '80d000'
}
+Display VNC {
+ Driver 'VNC'
+ Font '6x8'
+ Port '5900'
+ Xres '320'
+ Yres '140'
+ Bpp '4'
+ Maxclients '2'
+ Buttons '4'
+ Keypadxofs '40'
+ Keypadyofs '70'
+ Keypadygap '10'
+ Keypadcol '8745877'
+ Osd_showtime '2000'
+# Password 'password'
+ Maxfps '25'
+# HttpDir '/path/to/classfiles'
+ HttpPort '5800'
+}
+
#Plugin KVV {
# StationID '12_701'
# Refresh 30
@@ -500,6 +566,31 @@ Plugin Pop3 {
}
+Plugin DBus {
+ # signal 0 is displayed IM msg
+ #
+ signal0sender 'im.pidgin.purple.PurpleService' # should be in the form com.domain.app.service,
+ # the :1.23 form given by dbus-monitor will NOT work,
+ # if unsure skip it
+ signal0path '/im/pidgin/purple/PurpleObject' # find using dbus-monitor
+ signal0interface 'im.pidgin.purple.PurpleInterface' # find using dbus-monitor
+ signal0member 'DisplayedImMsg' # find using dbus-monitor
+ signal0eventname 'got_im' # make something up, all Text widgets with an
+ # event option matching this will be updated
+}
+
+
+#this example prints the second argument of signal# 0
+#(in this case it prints the message displayed)
+Widget Pidgin {
+ class 'Text'
+ expression dbus::argument(0, 1) . ': ' . dbus::argument(0, 2))
+ width 20
+ align 'R'
+ event 'got_im'
+}
+
+
Widget OS {
class 'Text'
expression '*** '.uname('sysname').' '.uname('release').' ***'
@@ -688,6 +779,16 @@ Widget Uptime {
update 1000
}
+Widget mpris_TrackPosition_bar {
+ class 'Bar'
+ expression mpris_dbus::method_PositionGet('org.kde.amarok')
+ length 40
+ min 0
+ max 100
+ direction 'E'
+ style 'H'
+ update 200
+}
# debugging widgets
@@ -1199,6 +1300,7 @@ Layout Debug {
#Display 'T6963-240x128'
#Display 'T6963-240x128D'
#Display 'XWindow'
+#Display 'IRLCD'
#Display 'USBLCD'
#Display 'BWCT'
#Display 'Image'
@@ -1207,15 +1309,17 @@ Layout Debug {
#Display 'LPH7508-serdisplib'
#Display 'LPH7508'
#Display 'ctinclud'
-Display 'picoLCD'
+#Display 'picoLCD'
+#Display 'VNC'
+Display 'GLCD2USB'
#Layout 'Default'
-#Layout 'TestLayer'
+Layout 'TestLayer'
#Layout 'TestImage'
#Layout 'L8x2'
#Layout 'L16x1'
#Layout 'L16x2'
-Layout 'L20x2'
+#Layout 'L20x2'
#Layout 'L40x2'
#Layout 'Test'
#Layout 'Test2'