+ Changed protocol to 0.3 because we now accept both -foo and foo
as argument introducers. in 0.4-pre10, these were changed
from foo to -foo and this broke many clients. This change
should fix that and be backward/forward compatible.
+ Added a noop function to the protocol. This is useful for writing
shell script clients of LCDproc.
+ Changed the shared sock_send_string function to NOT send the
ending NUL ('\0') byte with the string. This was confusing
in Perl clients which saw NUL's as the first character of
each reply. WARNING: The LCDPROC client depended on this
behavior, your client may too. Use the newline instead.
See the code in clients/lcdproc/main.c (look for "switch(buf[i])")
to see one way to handle this. This should allow new clients
to connect to old servers and vice-versa.
+ Messed with include structure in .c files. It should no longer
be necessary to specify ../.. to get to shared code headers.
Also, since we are using automake, the global config.h can be
found with just #include "config.h" as it's location is included
in a -I to the compilers. As a result "make distcheck" now works.
This commit is contained in:
@@ -11,23 +11,44 @@ Coming soon: (?) (my list of stuff to do soon...)
|
||||
* Better syntax for driver parameters
|
||||
* Dynamically-loaded driver system
|
||||
|
||||
v0.4-????:
|
||||
v0.4.1:
|
||||
+ Changed protocol to 0.3 because we now accept both -foo and foo
|
||||
as argument introducers. in 0.4-pre10, these were changed
|
||||
from foo to -foo and this broke many clients. This change
|
||||
should fix that and be backward/forward compatible.
|
||||
+ Added a noop function to the protocol. This is useful for writing
|
||||
shell script clients of LCDproc.
|
||||
+ Changed the shared sock_send_string function to NOT send the
|
||||
ending NUL ('\0') byte with the string. This was confusing
|
||||
in Perl clients which saw NUL's as the first character of
|
||||
each reply. WARNING: The LCDPROC client depended on this
|
||||
behavior, your client may too. Use the newline instead.
|
||||
See the code in clients/lcdproc/main.c (look for "switch(buf[i])")
|
||||
to see one way to handle this. This should allow new clients
|
||||
to connect to old servers and vice-versa.
|
||||
+ Messed with include structure in .c files. It should no longer
|
||||
be necessary to specify ../.. to get to shared code headers.
|
||||
Also, since we are using automake, the global config.h can be
|
||||
found with just #include "config.h" as it's location is included
|
||||
in a -I to the compilers. As a result "make distcheck" now works.
|
||||
+ Added support for client_add_key and friends. Clients MUST now
|
||||
request keys to get notified. Keys are NO LONGER broadcast to all
|
||||
clients. Keys are now tied to a SCREEN. (We should probably rename
|
||||
the command to screen_add_key huh...) If the current screen is
|
||||
has requested the key just pressed, the client gets the key and no
|
||||
other client gets it. Clients only get one key notification even
|
||||
if they have multiple screens requesting a given key.
|
||||
clients. Keys are now tied to a SCREEN and CLIENT. There are new
|
||||
commands (screen_add_key, screen_del_key) to bind keys to a
|
||||
screen. If the current screen has requested the key just pressed,
|
||||
the client gets the key and no other client gets it. If the current
|
||||
screen has not requested the current key, then the key is broadcast
|
||||
to all clients who requested that key with client_add_key. Clients
|
||||
might want to request a "hotkey" with client_add_key so they will
|
||||
be notified of that key no matter what screen is currently on the
|
||||
display, and then request whatever other keys a screen uses with
|
||||
screen_add_key.
|
||||
+ Added driver for Matrix Orbital GLK12232-25 graphical display.
|
||||
Display is run in text mode since there isn't enough information in
|
||||
the widgets. If we knew the max width/height of an hbar/vbar, we
|
||||
could use graphical vbar/hbar's. Oh well. BigNums' look really
|
||||
cool though. You'll need some additional characters in the "Small Font"
|
||||
font (and the BigNumbers font) for this to work.
|
||||
+ Left the client_add_key routines alone and created new screen_add_key
|
||||
and screen_del_key to allow per screen keystrokes. If someone else
|
||||
implements a global client_key function, they can do that.
|
||||
+ Rewrote Big Number Clock function in chrono.c. Many problems with
|
||||
it have been fixed. It now uses number value 10 to display a colon
|
||||
in between the digits. Don't know what this will do on a the MtxOrb
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
bin_PROGRAMS = lcdproc
|
||||
lcdproc_SOURCES = main.c main.h mode.c mode.h batt.c batt.h chrono.c chrono.h cpu.c cpu.h cpu_smp.c cpu_smp.h disk.c disk.h load.c load.h mem.c mem.h
|
||||
lcdproc_LDADD = ../../shared/libLCDstuff.a
|
||||
INCLUDES = -I$(top_srcdir)
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include <fcntl.h>
|
||||
#include <sys/utsname.h>
|
||||
|
||||
#include "../../shared/sockets.h"
|
||||
#include "shared/sockets.h"
|
||||
|
||||
#include "main.h"
|
||||
#include "mode.h"
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
#include "../../shared/sockets.h"
|
||||
#include "../../shared/debug.h"
|
||||
#include "shared/sockets.h"
|
||||
#include "shared/debug.h"
|
||||
|
||||
#include "main.h"
|
||||
#include "mode.h"
|
||||
|
||||
@@ -49,8 +49,8 @@
|
||||
#include <unistd.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "../../shared/sockets.h"
|
||||
#include "../../shared/debug.h"
|
||||
#include "shared/sockets.h"
|
||||
#include "shared/debug.h"
|
||||
|
||||
#include "main.h"
|
||||
#include "mode.h"
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include <sys/statfs.h>
|
||||
#endif
|
||||
|
||||
#include "../../shared/sockets.h"
|
||||
#include "shared/sockets.h"
|
||||
|
||||
#include "main.h"
|
||||
#include "mode.h"
|
||||
|
||||
+17
-19
@@ -230,25 +230,21 @@ main_loop (mode * sequence)
|
||||
argc = 0;
|
||||
newtoken = 1;
|
||||
for (i = 0; i < len; i++) {
|
||||
if (buf[i]) // For regular letters, keep tokenizing...
|
||||
{
|
||||
switch (buf[i]) {
|
||||
case ' ':
|
||||
newtoken = 1;
|
||||
buf[i] = 0;
|
||||
break;
|
||||
case '\n':
|
||||
buf[i] = 0;
|
||||
default:
|
||||
if (newtoken) {
|
||||
argv[argc] = buf + i;
|
||||
argc++;
|
||||
}
|
||||
newtoken = 0;
|
||||
break;
|
||||
switch (buf[i]) {
|
||||
case ' ':
|
||||
newtoken = 1;
|
||||
buf[i] = 0;
|
||||
break;
|
||||
default: // regular chars, keep tokenizing
|
||||
if (newtoken) {
|
||||
argv[argc] = buf + i;
|
||||
argc++;
|
||||
}
|
||||
} else // If we've got a zero, it's the end of a string...
|
||||
{
|
||||
newtoken = 0;
|
||||
break;
|
||||
case '\0':
|
||||
case '\n':
|
||||
buf[i] = 0;
|
||||
if (argc > 0) {
|
||||
//printf("%s %s\n", argv[0], argv[1]);
|
||||
if (0 == strcmp (argv[0], "listen")) {
|
||||
@@ -293,9 +289,11 @@ main_loop (mode * sequence)
|
||||
}
|
||||
}
|
||||
|
||||
// Restart tokenizing
|
||||
argc = 0;
|
||||
newtoken = 1;
|
||||
}
|
||||
break ;
|
||||
} // switch( buf[i] )
|
||||
}
|
||||
|
||||
len = sock_recv (sock, buf, 8000);
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
#include <fcntl.h>
|
||||
#include <dirent.h>
|
||||
|
||||
#include "../../shared/sockets.h"
|
||||
#include "../../shared/LL.h"
|
||||
#include "shared/sockets.h"
|
||||
#include "shared/LL.h"
|
||||
|
||||
#include "main.h"
|
||||
#include "mode.h"
|
||||
@@ -19,7 +19,12 @@
|
||||
#include <strings.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/swap.h>
|
||||
#include <procfs.h>
|
||||
#ifdef HAVE_SYS_PROCFS_H
|
||||
# include <sys/procfs.h>
|
||||
#endif
|
||||
#ifdef HAVE_PROCFS_H
|
||||
# include <procfs.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/utsname.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
|
||||
@@ -75,29 +75,11 @@ print $remote "widget_add metar cloud string\n";
|
||||
print $remote "widget_add metar wind string\n";
|
||||
|
||||
# set metar source
|
||||
|
||||
my $ua = new LWP::UserAgent;
|
||||
|
||||
my $req = new HTTP::Request GET =>
|
||||
"http://weather.noaa.gov/cgi-bin/mgetmetar.pl?cccc=$site_code";
|
||||
|
||||
# fork data collector from socket handling
|
||||
|
||||
$kidpid = fork();
|
||||
|
||||
# Parent
|
||||
if ($kidpid) {
|
||||
|
||||
while (1==1) {
|
||||
# read socket
|
||||
my $lcdconnect = <$remote>;
|
||||
}
|
||||
|
||||
# child
|
||||
|
||||
} else
|
||||
{
|
||||
|
||||
# fetch weather information
|
||||
while (1==1) {
|
||||
|
||||
@@ -136,13 +118,13 @@ while (1==1) {
|
||||
my $metartime = $m->TIME;
|
||||
my $c_dew = $m->C_DEW;
|
||||
my $f_temp = $m->F_TEMP;
|
||||
my $wind_dir_eng = $m->WIND_DIR_DEG;
|
||||
my $wind_mph = $m->WIND_MPH;
|
||||
my $wind_dir_eng = $m->WIND_DIR_ENG;
|
||||
my $wind_mph = int($m->WIND_MPH);
|
||||
my $sky = $m->SKY;
|
||||
my $time = localtime(time);
|
||||
print $remote "widget_set metar title {Weather LOWG " . $metartime . "}\n";
|
||||
print $remote "widget_set metar temp 1 2 {Temp " .$c_temp. "C (" .$c_dew. "C Dew)}\n";
|
||||
print $remote "widget_set metar wind 1 3 {Wind " .$wind_dir_eng. "G, " .$wind_mph. "mph}\n";
|
||||
print $remote "widget_set metar title {Weather $site_code $metartime}\n";
|
||||
print $remote "widget_set metar temp 1 2 {Temp ${c_temp}C (${c_dew}C Dew)}\n";
|
||||
print $remote "widget_set metar wind 1 3 {Wind ${wind_dir_eng}, ${wind_mph}mph}\n";
|
||||
print $remote "widget_set metar cloud 1 4 {Sky " . join(',', @{$m->{sky}}) . "}\n";
|
||||
# print "The temperature at $site_code is $c_temp C as of $time.\n";
|
||||
# print "The wind blows to $wind_dir_eng, speed $wind_mph mph\n";
|
||||
@@ -150,13 +132,12 @@ while (1==1) {
|
||||
} # end else
|
||||
# eat all input from LCDd
|
||||
while(defined($input = <$remote>)) {
|
||||
if ( $input =~ /^success$/ ) next;
|
||||
next if ( $input =~ /^success$/ );
|
||||
#print $input;
|
||||
}
|
||||
print "Sleeping 15 minutes.\n";
|
||||
sleep 900;
|
||||
}
|
||||
}
|
||||
|
||||
close($remote);
|
||||
exit;
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
AC_INIT(clients/lcdproc/batt.c)
|
||||
AM_INIT_AUTOMAKE(lcdproc, 0.4-pre9)
|
||||
AM_INIT_AUTOMAKE(lcdproc, 0.4.1)
|
||||
AM_CONFIG_HEADER(config.h)
|
||||
|
||||
AC_CANONICAL_HOST
|
||||
@@ -110,7 +110,7 @@ AC_ARG_WITH(lcdport,
|
||||
)
|
||||
AC_DEFINE_UNQUOTED(LCDPORT, $LCDPORT)
|
||||
|
||||
AC_DEFINE_UNQUOTED(PROTOCOL_VERSION, "0.2")
|
||||
AC_DEFINE_UNQUOTED(PROTOCOL_VERSION, "0.3")
|
||||
|
||||
|
||||
AC_ARG_WITH(loadmax,
|
||||
|
||||
@@ -2,3 +2,4 @@ SUBDIRS=drivers
|
||||
sbin_PROGRAMS=LCDd
|
||||
LCDd_SOURCES= client_data.c client_data.h client_functions.c client_functions.h client_menu.h clients.c clients.h input.c input.h main.c main.h menu.c menu.h menus.c menus.h parse.c parse.h render.c render.h screen.c screen.h screenlist.c screenlist.h serverscreens.c serverscreens.h sock.c sock.h widget.c widget.h
|
||||
LCDd_LDADD = drivers/libLCDdrivers.a ../shared/libLCDstuff.a @LIBCURSES@ @LIBIRMAN@ @LIBLIRC_CLIENT@
|
||||
INCLUDES = -I$(top_srcdir)
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "../shared/debug.h"
|
||||
#include "shared/debug.h"
|
||||
|
||||
#include "client_data.h"
|
||||
#include "screen.h"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef CLIENT_DATA_H
|
||||
#define CLIENT_DATA_H
|
||||
|
||||
#include "../shared/LL.h"
|
||||
#include "shared/LL.h"
|
||||
|
||||
#define CLIENT_NAME_SIZE 256
|
||||
|
||||
|
||||
+60
-54
@@ -15,8 +15,8 @@
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "../shared/debug.h"
|
||||
#include "../shared/sockets.h"
|
||||
#include "shared/debug.h"
|
||||
#include "shared/sockets.h"
|
||||
|
||||
#include "drivers/lcd.h"
|
||||
|
||||
@@ -45,13 +45,13 @@ client_function commands[] = {
|
||||
{"menu_add", menu_add_func},
|
||||
{"menu_del", menu_del_func},
|
||||
{"menu_set", menu_set_func},
|
||||
// TODO: Adhere these to the naming convention?
|
||||
{"menu_item_add", menu_item_add_func},
|
||||
{"menu_item_del", menu_item_del_func},
|
||||
{"menu_item_set", menu_item_set_func},
|
||||
{"menu_add_item", menu_add_item_func},
|
||||
{"menu_del_item", menu_del_item_func},
|
||||
{"menu_set_item", menu_set_item_func},
|
||||
// Misc stuff...
|
||||
{"backlight", backlight_func},
|
||||
{"output", output_func},
|
||||
{"noop", noop_func},
|
||||
{NULL, NULL},
|
||||
};
|
||||
|
||||
@@ -110,7 +110,8 @@ client_set_func (client * c, int argc, char **argv)
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
// Handle the "name" parameter
|
||||
if (0 == strcmp (argv[i], "-name")) {
|
||||
if (0 == strcmp (argv[i], "-name")
|
||||
|| 0 == strcmp (argv[i], "name")) {
|
||||
if (argc > i + 1) {
|
||||
i++;
|
||||
debug ("client_set: name=\"%s\"\n", argv[i]);
|
||||
@@ -272,40 +273,26 @@ screen_add_key_func (client * c, int argc, char **argv)
|
||||
sock_send_string (c->sock, "huh? Invalid screen id\n");
|
||||
return 0;
|
||||
}
|
||||
// Find the keys widget
|
||||
w = widget_find( s, KEYS_WIDGETID );
|
||||
if (!w) {
|
||||
int err ;
|
||||
// No keys widget, create a new one
|
||||
err = widget_add (s, KEYS_WIDGETID, types[WID_KEYS], NULL, c->sock);
|
||||
if (err < 0) {
|
||||
fprintf (stderr, "screen_add_key: Error creating keys widget\n");
|
||||
} else {
|
||||
w = widget_find (s, KEYS_WIDGETID );
|
||||
}
|
||||
};
|
||||
|
||||
if (w) {
|
||||
// Have a widget
|
||||
if (!w->text) {
|
||||
// Save supplied key list
|
||||
w->text = strdup( keys );
|
||||
} else {
|
||||
// Add supplied keys to existing list
|
||||
// NOTE: There could be duplicates in the resulting list
|
||||
// That's OK, it's the existence of the key in the list
|
||||
// that's important. We'll be more careful in the delete
|
||||
// key function.
|
||||
char * new ;
|
||||
new = realloc( w->text, strlen(w->text) + strlen(keys) +1 );
|
||||
if( new ) {
|
||||
w->text = new ;
|
||||
strcat( new, keys );
|
||||
}
|
||||
// Save the keys
|
||||
if (!s->keys) {
|
||||
// Save supplied key list
|
||||
s->keys = strdup( keys );
|
||||
} else {
|
||||
// Add supplied keys to existing list
|
||||
// NOTE: There could be duplicates in the resulting list
|
||||
// That's OK, it's the existence of the key in the list
|
||||
// that's important. We'll be more careful in the delete
|
||||
// key function.
|
||||
char * new ;
|
||||
new = realloc( s->keys, strlen(s->keys) + strlen(keys) +1 );
|
||||
if( new ) {
|
||||
s->keys = new ;
|
||||
strcat( new, keys );
|
||||
}
|
||||
}
|
||||
|
||||
if (!w) {
|
||||
if (!s->keys) {
|
||||
sock_send_string(c->sock, "huh? failed\n");
|
||||
} else
|
||||
sock_send_string(c->sock, "success\n");
|
||||
@@ -349,18 +336,17 @@ screen_del_key_func (client * c, int argc, char **argv)
|
||||
sock_send_string (c->sock, "huh? Invalid screen id\n");
|
||||
return 0;
|
||||
}
|
||||
// Find the keys widget
|
||||
w = widget_find( s, KEYS_WIDGETID );
|
||||
if (w && w->text) {
|
||||
// Got the widget, remove keys from the text member
|
||||
// Do we have keys?
|
||||
if (s->keys) {
|
||||
// Have keys, remove keys from the list
|
||||
// NOTE: We let malloc/realloc remember the length
|
||||
// of the allocated storage. If keys are later
|
||||
// added, realloc (in add_key above) will make
|
||||
// sure there is enough space at w->text
|
||||
// sure there is enough space at s->keys
|
||||
char * from ;
|
||||
char * to ;
|
||||
|
||||
to = from = w->text ;
|
||||
to = from = s->keys ;
|
||||
while( *from ) {
|
||||
// Is this key to be deleted from the list?
|
||||
if( strchr( keys, *from ) ) {
|
||||
@@ -482,7 +468,8 @@ screen_set_func (client * c, int argc, char **argv)
|
||||
// Handle the rest of the parameters
|
||||
for (i = 2; i < argc; i++) {
|
||||
// Handle the "name" parameter
|
||||
if (0 == strcmp (argv[i], "-name")) {
|
||||
if (0 == strcmp (argv[i], "-name")
|
||||
|| 0 == strcmp (argv[i], "name")) {
|
||||
if (argc > i + 1) {
|
||||
i++;
|
||||
debug ("screen_set: name=\"%s\"\n", argv[i]);
|
||||
@@ -497,7 +484,8 @@ screen_set_func (client * c, int argc, char **argv)
|
||||
}
|
||||
}
|
||||
// Handle the "priority" parameter
|
||||
else if (0 == strcmp (argv[i], "-priority")) {
|
||||
else if (0 == strcmp (argv[i], "-priority")
|
||||
|| 0 == strcmp (argv[i], "priority")) {
|
||||
if (argc > i + 1) {
|
||||
i++;
|
||||
debug ("screen_set: priority=\"%s\"\n", argv[i]);
|
||||
@@ -512,7 +500,8 @@ screen_set_func (client * c, int argc, char **argv)
|
||||
}
|
||||
}
|
||||
// Handle the "duration" parameter
|
||||
else if (0 == strcmp (argv[i], "-duration")) {
|
||||
else if (0 == strcmp (argv[i], "-duration")
|
||||
|| 0 == strcmp (argv[i], "duration")) {
|
||||
if (argc > i + 1) {
|
||||
i++;
|
||||
debug ("screen_set: duration=\"%s\"\n", argv[i]);
|
||||
@@ -527,7 +516,8 @@ screen_set_func (client * c, int argc, char **argv)
|
||||
}
|
||||
}
|
||||
// Handle the "heartbeat" parameter
|
||||
else if (0 == strcmp (argv[i], "-heartbeat")) {
|
||||
else if (0 == strcmp (argv[i], "-heartbeat")
|
||||
|| 0 == strcmp (argv[i], "heartbeat")) {
|
||||
if (argc > i + 1) {
|
||||
i++;
|
||||
debug ("screen_set: heartbeat=\"%s\"\n", argv[i]);
|
||||
@@ -553,7 +543,8 @@ screen_set_func (client * c, int argc, char **argv)
|
||||
}
|
||||
}
|
||||
// Handle the "wid" parameter
|
||||
else if (0 == strcmp (argv[i], "-wid")) {
|
||||
else if (0 == strcmp (argv[i], "-wid")
|
||||
|| 0 == strcmp (argv[i], "wid")) {
|
||||
if (argc > i + 1) {
|
||||
i++;
|
||||
debug ("screen_set: wid=\"%s\"\n", argv[i]);
|
||||
@@ -568,7 +559,8 @@ screen_set_func (client * c, int argc, char **argv)
|
||||
}
|
||||
}
|
||||
// Handle the "hgt" parameter
|
||||
else if (0 == strcmp (argv[i], "-hgt")) {
|
||||
else if (0 == strcmp (argv[i], "-hgt")
|
||||
|| 0 == strcmp (argv[i], "hgt")) {
|
||||
if (argc > i + 1) {
|
||||
i++;
|
||||
debug ("screen_set: hgt=\"%s\"\n", argv[i]);
|
||||
@@ -637,8 +629,9 @@ widget_add_func (client * c, int argc, char **argv)
|
||||
|
||||
// Check for additional flags...
|
||||
if (argc > 4) {
|
||||
// Handle the "-in" flag to place widgets in a container...
|
||||
if (0 == strcmp (argv[4], "-in")) {
|
||||
// Handle the "in" flag to place widgets in a container...
|
||||
if (0 == strcmp (argv[4], "-in")
|
||||
|| 0 == strcmp (argv[4], "in")) {
|
||||
if (argc < 6) {
|
||||
sock_send_string (c->sock, "huh? Specify a frame to place widget in\n");
|
||||
return 0;
|
||||
@@ -1020,7 +1013,7 @@ menu_set_func (client * c, int argc, char **argv)
|
||||
// Adds an item to a menu
|
||||
//
|
||||
int
|
||||
menu_item_add_func (client * c, int argc, char **argv)
|
||||
menu_add_item_func (client * c, int argc, char **argv)
|
||||
{
|
||||
|
||||
if (!c->data->ack)
|
||||
@@ -1035,7 +1028,7 @@ menu_item_add_func (client * c, int argc, char **argv)
|
||||
// Deletes an item from a menu
|
||||
//
|
||||
int
|
||||
menu_item_del_func (client * c, int argc, char **argv)
|
||||
menu_del_item_func (client * c, int argc, char **argv)
|
||||
{
|
||||
|
||||
if (!c->data->ack)
|
||||
@@ -1052,7 +1045,7 @@ menu_item_del_func (client * c, int argc, char **argv)
|
||||
// For example, text displayed, widget type, value, etc...
|
||||
//
|
||||
int
|
||||
menu_item_set_func (client * c, int argc, char **argv)
|
||||
menu_set_item_func (client * c, int argc, char **argv)
|
||||
{
|
||||
|
||||
if (!c->data->ack)
|
||||
@@ -1154,6 +1147,19 @@ output_func (client * c, int argc, char **argv)
|
||||
return 0;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Does nothing, returns "noop complete" message
|
||||
//
|
||||
// This is useful for shell scripts or programs that want to talk
|
||||
// with LCDproc and not get deadlocked. Send a noop after each
|
||||
// command and look for the "noop complete" message.
|
||||
int
|
||||
noop_func (client * c, int argc, char **argv)
|
||||
{
|
||||
sock_send_string (c->sock, "noop complete\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -28,11 +28,12 @@ int widget_set_func (client * c, int argc, char **argv);
|
||||
int menu_add_func (client * c, int argc, char **argv);
|
||||
int menu_del_func (client * c, int argc, char **argv);
|
||||
int menu_set_func (client * c, int argc, char **argv);
|
||||
int menu_item_add_func (client * c, int argc, char **argv);
|
||||
int menu_item_del_func (client * c, int argc, char **argv);
|
||||
int menu_item_set_func (client * c, int argc, char **argv);
|
||||
int menu_add_item_func (client * c, int argc, char **argv);
|
||||
int menu_del_item_func (client * c, int argc, char **argv);
|
||||
int menu_set_item_func (client * c, int argc, char **argv);
|
||||
int backlight_func (client * c, int argc, char **argv);
|
||||
int output_func (client * c, int argc, char **argv);
|
||||
int noop_func (client * c, int argc, char **argv);
|
||||
|
||||
extern client_function commands[];
|
||||
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@
|
||||
|
||||
#include "clients.h"
|
||||
#include "client_data.h"
|
||||
#include "../shared/debug.h"
|
||||
#include "shared/debug.h"
|
||||
|
||||
LL *clients;
|
||||
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
#define CLIENTS_H
|
||||
|
||||
#include "client_data.h"
|
||||
#include "../shared/LL.h"
|
||||
#include "shared/LL.h"
|
||||
|
||||
typedef struct client {
|
||||
int sock;
|
||||
|
||||
@@ -5,15 +5,17 @@
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include "lcd.h"
|
||||
#include "CFontz.h"
|
||||
#include "drv_base.h"
|
||||
|
||||
#include "../render.h"
|
||||
|
||||
#include "../../shared/debug.h"
|
||||
#include "../../shared/str.h"
|
||||
#include "../../config.h"
|
||||
#include "render.h"
|
||||
#include "shared/debug.h"
|
||||
#include "shared/str.h"
|
||||
|
||||
static int custom = 0;
|
||||
typedef enum {
|
||||
|
||||
@@ -14,3 +14,8 @@ EXTRA_libLCDdrivers_a_SOURCES = MtxOrb.c MtxOrb.h text.c text.h \
|
||||
glk.c glk.h glkproto.c glkproto.h
|
||||
libLCDdrivers_a_DEPENDENCIES = @DRIVERS@
|
||||
libLCDdrivers_a_LIBADD = @DRIVERS@
|
||||
# NOTE: $(srcdir)/.. is to get .h files from the server directory
|
||||
# $(top_srcdir) is to get .h files from shared/...
|
||||
# These are necessary because a VPATH build has split source and build
|
||||
# directories and these files are in the VPATH'd source area.
|
||||
INCLUDES = -I$(srcdir)/.. -I$(top_srcdir)
|
||||
|
||||
@@ -5,13 +5,16 @@
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include "lcd.h"
|
||||
#include "MtxOrb.h"
|
||||
#include "drv_base.h"
|
||||
|
||||
#include "../../shared/debug.h"
|
||||
#include "../../shared/str.h"
|
||||
#include "../../config.h"
|
||||
#include "shared/debug.h"
|
||||
#include "shared/str.h"
|
||||
|
||||
static int custom = 0;
|
||||
static enum {MTXORB_LCD, MTXORB_LKD, MTXORB_VFD, MTXORB_VKD} MtxOrb_type;
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <termios.h>
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
#include <sys/errno.h>
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
@@ -26,7 +26,6 @@
|
||||
# endif
|
||||
#endif
|
||||
#ifdef SOLARIS
|
||||
# include <errno.h>
|
||||
# include <strings.h>
|
||||
#endif
|
||||
#include "lcd.h"
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include <curses.h>
|
||||
#endif
|
||||
|
||||
#include "../../shared/str.h"
|
||||
#include "shared/str.h"
|
||||
|
||||
#include "lcd.h"
|
||||
#include "curses_drv.h"
|
||||
|
||||
@@ -355,18 +355,13 @@ int glk_contrast(int contrast)
|
||||
//
|
||||
void glk_backlight(int on)
|
||||
{
|
||||
/*
|
||||
if(on)
|
||||
{
|
||||
if(on) {
|
||||
// printf("Backlight ON\n");
|
||||
glkputl( PortFD, GLKCommand, 0x42, 0, EOF );
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
// printf("Backlight OFF\n");
|
||||
glkputl( PortFD, GLKCommand, 0x46, EOF );
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
@@ -638,7 +633,7 @@ char glk_getkey()
|
||||
msec_diff = (now.tv_sec - lastkey.tv_sec) * 1000 ;
|
||||
msec_diff += (now.tv_usec - lastkey.tv_usec) / 1000 ;
|
||||
// printf( "KEY %c down for %d msec\n", key, msec_diff );
|
||||
if( msec_diff > 2000 ) {
|
||||
if( msec_diff > 1000 ) {
|
||||
/* Generate repeat event */
|
||||
c = key | 0x20 ; /* Upper case to lower case */
|
||||
++lastkey.tv_sec ; /* HACK HACK. repeat at 1 sec intervals */
|
||||
@@ -656,6 +651,7 @@ char glk_getkey()
|
||||
case 'L' : c = 'D' ; break ; /* Menu/Exit */
|
||||
case 'U' : c = 'E' ; break ; /* Up */
|
||||
case 'K' : c = 'F' ; break ; /* Down */
|
||||
|
||||
case 'v' : c = 'N' ; break ;
|
||||
case 'p' : c = 'O' ; break ;
|
||||
case 'q' : c = 'P' ; break ;
|
||||
|
||||
@@ -81,14 +81,12 @@ GLKDisplay *
|
||||
* framing errors incase the module transmits back
|
||||
* to back with only one stop bit.
|
||||
*/
|
||||
#ifndef IRIX
|
||||
#ifndef SOLARIS
|
||||
cfmakeraw( &new ); /* Sets CS8 */
|
||||
#endif
|
||||
#endif
|
||||
new.c_iflag |= IGNPAR ; /* Ignore framing/parity errors */
|
||||
new.c_cflag &= ~(CBAUD | CRTSCTS ) ;
|
||||
new.c_cflag |= speed | CREAD | CLOCAL | CSTOPB ;
|
||||
new.c_iflag &= ~( IGNBRK | BRKINT | PARMRK | IGNPAR | ISTRIP
|
||||
| INLCR | IGNCR | ICRNL | IXON );
|
||||
new.c_oflag &= ~OPOST;
|
||||
new.c_lflag &= ~( ECHO | ECHONL | ICANON | ISIG | IEXTEN );
|
||||
new.c_cflag &= ~( CBAUD | CSIZE | PARENB | CRTSCTS );
|
||||
new.c_cflag |= speed | CS8 | CREAD | CLOCAL | CSTOPB ;
|
||||
new.c_cc[VMIN] = 0 ;
|
||||
new.c_cc[VTIME] = GLK_TIMEOUT ;
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
#include "hd44780-4bit.h"
|
||||
#include "port.h"
|
||||
|
||||
#include "../../shared/str.h"
|
||||
#include "shared/str.h"
|
||||
#include <sys/perm.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#include "hd44780-winamp.h"
|
||||
#include "port.h"
|
||||
|
||||
#include "../../shared/str.h"
|
||||
#include "shared/str.h"
|
||||
#include <sys/perm.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
# include <time.h>
|
||||
#endif
|
||||
|
||||
#include "../../shared/str.h"
|
||||
#include "shared/str.h"
|
||||
|
||||
#include "lcd.h"
|
||||
#include "hd44780.h"
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
#define __u32 unsigned int
|
||||
#define __u8 unsigned char
|
||||
|
||||
#include "../../shared/debug.h"
|
||||
#include "../../shared/str.h"
|
||||
#include "shared/debug.h"
|
||||
#include "shared/str.h"
|
||||
|
||||
#define NAME_LENGTH 128
|
||||
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
|
||||
#include <linux/joystick.h>
|
||||
|
||||
#include "../../shared/debug.h"
|
||||
#include "../../shared/str.h"
|
||||
#include "shared/debug.h"
|
||||
#include "shared/str.h"
|
||||
|
||||
#define NAME_LENGTH 128
|
||||
|
||||
|
||||
+11
-10
@@ -5,22 +5,23 @@
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#ifdef HAVE_NCURSES_H
|
||||
#include <ncurses.h>
|
||||
#else
|
||||
#include <curses.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include "../../shared/str.h"
|
||||
#ifdef HAVE_NCURSES_H
|
||||
# include <ncurses.h>
|
||||
#else
|
||||
# include <curses.h>
|
||||
#endif
|
||||
|
||||
#include "shared/str.h"
|
||||
#include "shared/debug.h"
|
||||
#include "lcd.h"
|
||||
#include "lb216.h"
|
||||
#include "drv_base.h"
|
||||
|
||||
#include "../render.h"
|
||||
|
||||
#include "../../shared/debug.h"
|
||||
#include "../../config.h"
|
||||
#include "render.h"
|
||||
|
||||
static int custom=0;
|
||||
typedef enum {
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "../../shared/LL.h"
|
||||
#include "shared/LL.h"
|
||||
|
||||
#include "lcd.h"
|
||||
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
#define __u32 unsigned int
|
||||
#define __u8 unsigned char
|
||||
|
||||
#include "../../shared/debug.h"
|
||||
#include "../../shared/str.h"
|
||||
#include "shared/debug.h"
|
||||
#include "shared/str.h"
|
||||
|
||||
#define NAME_LENGTH 128
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#include <vga.h>
|
||||
#include <vgagl.h>
|
||||
|
||||
#include "../../shared/str.h"
|
||||
#include "shared/str.h"
|
||||
|
||||
#include "lcd.h"
|
||||
#include "svgalib_drv.h"
|
||||
|
||||
@@ -15,8 +15,8 @@
|
||||
#include "wirz-sli.h"
|
||||
#include "drv_base.h"
|
||||
|
||||
#include "../../shared/debug.h"
|
||||
#include "../../shared/str.h"
|
||||
#include "shared/debug.h"
|
||||
#include "shared/str.h"
|
||||
|
||||
static int custom = 0;
|
||||
typedef enum {
|
||||
|
||||
+2
-2
@@ -28,8 +28,8 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "../shared/sockets.h"
|
||||
#include "../shared/debug.h"
|
||||
#include "shared/sockets.h"
|
||||
#include "shared/debug.h"
|
||||
|
||||
#include "drivers/lcd.h"
|
||||
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@
|
||||
#include <signal.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "../shared/debug.h"
|
||||
#include "shared/debug.h"
|
||||
|
||||
#include "drivers/lcd.h"
|
||||
#include "sock.h"
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "../shared/debug.h"
|
||||
#include "shared/debug.h"
|
||||
|
||||
#include "drivers/lcd.h"
|
||||
|
||||
|
||||
+3
-3
@@ -13,9 +13,9 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "../shared/LL.h"
|
||||
#include "../shared/sockets.h"
|
||||
#include "../shared/debug.h"
|
||||
#include "shared/LL.h"
|
||||
#include "shared/sockets.h"
|
||||
#include "shared/debug.h"
|
||||
#include "clients.h"
|
||||
#include "client_functions.h"
|
||||
#include "parse.h"
|
||||
|
||||
+2
-2
@@ -16,8 +16,8 @@
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "../shared/debug.h"
|
||||
#include "../shared/LL.h"
|
||||
#include "shared/debug.h"
|
||||
#include "shared/LL.h"
|
||||
|
||||
#include "drivers/lcd.h"
|
||||
|
||||
|
||||
+6
-4
@@ -2,7 +2,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "../shared/debug.h"
|
||||
#include "shared/debug.h"
|
||||
|
||||
#include "drivers/lcd.h"
|
||||
|
||||
@@ -25,12 +25,12 @@ screen_create ()
|
||||
|
||||
s->id = NULL;
|
||||
s->name = NULL;
|
||||
s->priority = 128;
|
||||
// TODO: Make the screen duration configurable!
|
||||
s->duration = 32;
|
||||
s->priority = 128; // Default priority
|
||||
s->duration = 32; // Default duration (~ 8 seconds)
|
||||
s->heartbeat = 1;
|
||||
s->wid = lcd.wid;
|
||||
s->hgt = lcd.hgt;
|
||||
s->keys = NULL;
|
||||
s->parent = NULL;
|
||||
s->widgets = NULL;
|
||||
|
||||
@@ -63,6 +63,8 @@ screen_destroy (screen * s)
|
||||
free (s->id);
|
||||
if (s->name)
|
||||
free (s->name);
|
||||
if (s->keys)
|
||||
free (s->keys);
|
||||
|
||||
free (s);
|
||||
|
||||
|
||||
+2
-1
@@ -1,7 +1,7 @@
|
||||
#ifndef SCREEN_H
|
||||
#define SCREEN_H
|
||||
|
||||
#include "../shared/LL.h"
|
||||
#include "shared/LL.h"
|
||||
#include "clients.h"
|
||||
|
||||
typedef struct screen {
|
||||
@@ -11,6 +11,7 @@ typedef struct screen {
|
||||
int priority;
|
||||
int duration;
|
||||
int heartbeat;
|
||||
char *keys;
|
||||
LL *widgets;
|
||||
client *parent;
|
||||
} screen;
|
||||
|
||||
+3
-3
@@ -1,9 +1,9 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "../shared/LL.h"
|
||||
#include "../shared/sockets.h"
|
||||
#include "../shared/debug.h"
|
||||
#include "shared/LL.h"
|
||||
#include "shared/sockets.h"
|
||||
#include "shared/debug.h"
|
||||
#include "screenlist.h"
|
||||
#include "screen.h"
|
||||
#include "clients.h"
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
#ifndef SOCKETS_H
|
||||
#define SOCKETS_H
|
||||
|
||||
#include "../shared/sockets.h"
|
||||
#include "shared/sockets.h"
|
||||
|
||||
typedef struct sockaddr_in sockaddr_in;
|
||||
|
||||
|
||||
+2
-23
@@ -2,8 +2,8 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "../shared/sockets.h"
|
||||
#include "../shared/debug.h"
|
||||
#include "shared/sockets.h"
|
||||
#include "shared/debug.h"
|
||||
|
||||
#include "screen.h"
|
||||
#include "widget.h"
|
||||
@@ -17,7 +17,6 @@ char *types[] = { "none",
|
||||
"scroller",
|
||||
"frame",
|
||||
"num",
|
||||
"keys",
|
||||
//"",
|
||||
NULL,
|
||||
};
|
||||
@@ -107,26 +106,6 @@ widget_find (screen * s, char *id)
|
||||
debug ("widget_find(%s)\n", id);
|
||||
|
||||
return widget_finder (s->widgets, id);
|
||||
/*
|
||||
LL_Rewind(s->widgets);
|
||||
do {
|
||||
w = LL_Get(s->widgets);
|
||||
if( (w) && (0 == strcmp(w->id, id)))
|
||||
{
|
||||
debug("widget_find: Found %s\n", id);
|
||||
return w;
|
||||
}
|
||||
// TODO: Search kids too!
|
||||
if( w->type == WID_FRAME )
|
||||
{
|
||||
err = widget_finder(w->kids, id);
|
||||
if(err) return err;
|
||||
}
|
||||
|
||||
} while(LL_Next(s->widgets) == 0);
|
||||
|
||||
return NULL;
|
||||
*/
|
||||
}
|
||||
|
||||
widget *
|
||||
|
||||
@@ -26,7 +26,6 @@ typedef struct widget {
|
||||
#define WID_SCROLLER 6
|
||||
#define WID_FRAME 7
|
||||
#define WID_NUM 8
|
||||
#define WID_KEYS 9
|
||||
|
||||
#define WID_MAX_DIR 4
|
||||
|
||||
|
||||
+3
-1
@@ -1,7 +1,9 @@
|
||||
#ifndef DEBUG_H
|
||||
#define DEBUG_H
|
||||
|
||||
#include "../config.h"
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
|
||||
|
||||
+1
-2
@@ -8,7 +8,6 @@
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netdb.h>
|
||||
#include <sys/socket.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
@@ -96,7 +95,7 @@ sock_send_string (int fd, char *string)
|
||||
if (!string)
|
||||
return -1;
|
||||
|
||||
len = strlen (string) + 1;
|
||||
len = strlen (string) ;
|
||||
while (offset != len) {
|
||||
// write isn't guaranteed to send the entire string at once,
|
||||
// so we have to sent it in a loop like this
|
||||
|
||||
Reference in New Issue
Block a user