More formatting updates. Reduced whitespace, looks even better.

This commit is contained in:
William Ferrell
2000-03-30 20:43:33 +00:00
parent a98c8109a8
commit ddfd41f53e
78 changed files with 0 additions and 590 deletions
-2
View File
@@ -14,7 +14,6 @@
Leave the following blank line there!! Autoheader needs it. */
#undef LIRCIN_DRV
#undef CFONTZ_DRV
@@ -74,7 +73,6 @@
/* Define the package version */
#undef VERSION
/* Leave that blank line there!! Autoheader needs it.
If you're adding to this file, keep in mind:
The entries are in sort -df order: alphabetical, case insensitive,
-10
View File
@@ -13,7 +13,6 @@
int batt_fd = 0;
static int get_batt_stat (int *acstat, int *battstat, int *battflag, int *percent);
static int
@@ -39,8 +38,6 @@ get_batt_stat (int *acstat, int *battstat, int *battflag, int *percent)
}
int
batt_init ()
{
@@ -64,7 +61,6 @@ batt_close ()
return 0;
}
////////////////////////////////////////////////////////////////////////
// Battery Screen shows apm battery status...
//
@@ -82,7 +78,6 @@ battery_screen (int rep, int display)
int acstat = 0, battstat = 0, battflag = 0, percent = 0;
if (first) {
first = 0;
@@ -107,7 +102,6 @@ battery_screen (int rep, int display)
get_batt_stat (&acstat, &battstat, &battflag, &percent);
if (percent >= 0)
sprintf (buffer, "%i%%", percent);
else
@@ -117,7 +111,6 @@ battery_screen (int rep, int display)
if (display)
sock_send_string (sock, tmp);
if (lcd_hgt >= 4) // 4-line version of the screen
{
sprintf (tmp, "widget_set B one 1 2 {");
@@ -139,8 +132,6 @@ battery_screen (int rep, int display)
if (display)
sock_send_string (sock, tmp);
sprintf (tmp, "widget_set B two 1 3 {");
if (battflag == 0xff) {
sprintf (tmp + strlen (tmp), "Battery Stat Unknown");
@@ -161,7 +152,6 @@ battery_screen (int rep, int display)
if (display)
sock_send_string (sock, tmp);
if (percent > 0) {
sprintf (tmp, "widget_set B gauge 2 4 %i\n", (percent * ((lcd_wid - 2) * lcd_cellwid) / 100));
if (display)
-1
View File
@@ -6,5 +6,4 @@ int batt_close ();
int battery_screen (int rep, int display);
#endif
-33
View File
@@ -20,7 +20,6 @@ static char sysname[SYS_NMLN];
static double get_uptime (double *up, double *idle);
static double
get_uptime (double *up, double *idle)
{
@@ -34,7 +33,6 @@ get_uptime (double *up, double *idle)
return uptime;
}
// A couple of tables for later use...
static char *days[] = {
"Sunday, ",
@@ -84,8 +82,6 @@ static char *shortmonths[] = {
"Dec",
};
int
chrono_init ()
{
@@ -113,14 +109,11 @@ chrono_init ()
free (unamebuf);
}
return 0;
}
int
chrono_close ()
{
@@ -132,8 +125,6 @@ chrono_close ()
return 0;
}
//////////////////////////////////////////////////////////////////////
// Time Screen displays current time and date, uptime, OS ver...
//
@@ -158,8 +149,6 @@ time_screen (int rep, int display)
int i = 0;
char colon;
if (first) {
first = 0;
@@ -178,17 +167,14 @@ time_screen (int rep, int display)
}
}
if (colons)
colon = ':';
else
colon = ' ';
time (&thetime);
rtime = localtime (&thetime);
if (TwentyFourHour) {
sprintf (hr, "%02d", rtime->tm_hour);
} else {
@@ -211,12 +197,9 @@ time_screen (int rep, int display)
sprintf (min, "%02d", rtime->tm_min);
sprintf (sec, "%02d", rtime->tm_sec);
strcpy (day, shortdays[rtime->tm_wday]);
strcpy (month, shortmonths[rtime->tm_mon]);
///////////////////// Write the title bar (os name and version)
if (lcd_hgt >= 4) {
@@ -225,13 +208,11 @@ time_screen (int rep, int display)
if (display)
sock_send_string (sock, tmp);
}
/////////////////////// Display the time...
if (lcd_hgt >= 4) {
get_uptime (&uptime, &idle);
idle = (idle * 100) / uptime;
if (TwentyFourHour)
sprintf (tmp, "%s%c%s%c%s %2i%% idle", hr, colon, min, colon, sec, (int) idle);
else
@@ -242,14 +223,11 @@ time_screen (int rep, int display)
if (display)
sock_send_string (sock, buffer);
sprintf (tmp, "%s %s %d, %d", day, month, rtime->tm_mday, (rtime->tm_year + 1900));
sprintf (buffer, "widget_set T two 3 3 {%s}\n", tmp);
if (display)
sock_send_string (sock, buffer);
/////////////////////// Display the uptime...
i = (int) uptime / 86400;
sprintf (day, "Up %d day%s,", i, (i != 1 ? "s" : ""));
@@ -269,7 +247,6 @@ time_screen (int rep, int display)
if (display)
sock_send_string (sock, buffer);
} else // 20x2 version of the screen
{
sprintf (tmp, "widget_set T one 1 2 {");
@@ -285,15 +262,11 @@ time_screen (int rep, int display)
sock_send_string (sock, tmp);
}
colons = colons ^ 1;
return 0;
} // End time_screen()
//////////////////////////////////////////////////////////////////////
// Clock Screen displays current time and date...
//
@@ -332,7 +305,6 @@ clock_screen (int rep, int display)
}
}
if (colons)
colon = ':';
else
@@ -365,7 +337,6 @@ clock_screen (int rep, int display)
}
strcpy (month, months[rtime->tm_mon]);
if (lcd_hgt >= 4) // 4-line version of the screen
{
sprintf (tmp, "widget_set O two 1 3 {");
@@ -377,7 +348,6 @@ clock_screen (int rep, int display)
if (display)
sock_send_string (sock, tmp);
sprintf (tmp, "widget_set O three 2 4 {");
sprintf (tmp + strlen (tmp), "%s %d, %d", month, rtime->tm_mday, (rtime->tm_year + 1900));
sprintf (tmp + strlen (tmp), "}\n");
@@ -401,8 +371,6 @@ clock_screen (int rep, int display)
return 0;
} // End clock_screen()
////////////////////////////////////////////////////////////////////
// Uptime Screen shows info about system uptime and OS version
//
@@ -469,7 +437,6 @@ uptime_screen (int rep, int display)
return 0;
} // End uptime_screen()
//////////////////////////////////////////////////////////////////////
// Big Clock Screen displays current time...
//
-15
View File
@@ -18,7 +18,6 @@ struct load {
int load_fd = 0;
static void get_load (struct load *result);
static void
get_load (struct load *result)
{
@@ -40,8 +39,6 @@ get_load (struct load *result)
last_load.idle = curr_load.idle;
}
int
cpu_init ()
{
@@ -63,7 +60,6 @@ cpu_close ()
return 0;
}
//////////////////////////////////////////////////////////////////////////
// CPU screen shows info about percentage of the CPU being used
//
@@ -78,7 +74,6 @@ cpu_screen (int rep, int display)
static float cpu[CPU_BUF_SIZE + 1][5]; // last buffer is scratch
struct load load;
if (first) {
first = 0;
@@ -148,7 +143,6 @@ cpu_screen (int rep, int display)
*/
}
// Average values for final result
for (i = 0; i < 5; i++) {
value = 0;
@@ -159,7 +153,6 @@ cpu_screen (int rep, int display)
cpu[CPU_BUF_SIZE][i] = value;
}
if (lcd_hgt >= 4) {
value = cpu[CPU_BUF_SIZE][4];
n = (int) (value * 70.0);
@@ -264,8 +257,6 @@ cpu_screen (int rep, int display)
return 0;
} // End cpu_screen()
//////////////////////////////////////////////////////////////////////////
// Cpu Graph Screen shows a quick-moving histogram of CPU use.
//
@@ -282,7 +273,6 @@ cpu_graph_screen (int rep, int display)
struct load load;
int status = 0;
if (first) {
first = 0;
sock_send_string (sock, "screen_add G\n");
@@ -314,7 +304,6 @@ cpu_graph_screen (int rep, int display)
// Read new data
cpu[CPU_BUF_SIZE - 1] = ((float) load.user + (float) load.system + (float) load.nice) / (float) load.total;
// Only clear on first display...
if (!rep) {
/*
@@ -323,7 +312,6 @@ cpu_graph_screen (int rep, int display)
cpu[i] = cpu[CPU_BUF_SIZE-1];
*/
}
// Average values for final result
value = 0;
for (j = 0; j < CPU_BUF_SIZE; j++) {
@@ -332,7 +320,6 @@ cpu_graph_screen (int rep, int display)
value /= (float) CPU_BUF_SIZE;
cpu[CPU_BUF_SIZE] = value;
maxload = 0;
for (i = 0; i < lcd_wid - 1; i++) {
cpu_past[i] = cpu_past[i + 1];
@@ -357,8 +344,6 @@ cpu_graph_screen (int rep, int display)
if (display)
sock_send_string (sock, tmp);
if (n > maxload)
maxload = n;
-2
View File
@@ -1,11 +1,9 @@
#ifndef CPU_H
#define CPU_H
int cpu_init ();
int cpu_close ();
int cpu_screen (int rep, int display);
int cpu_graph_screen (int rep, int display);
-3
View File
@@ -106,7 +106,6 @@ get_load (struct load *result, int *numcpus)
}
}
int
cpu_smp_init ()
{
@@ -128,7 +127,6 @@ cpu_smp_close ()
return 0;
}
//////////////////////////////////////////////////////////////////////////
// CPU screen shows info about percentage of the CPU being used
//
@@ -212,7 +210,6 @@ cpu_smp_screen (int rep, int display)
#endif
cpu[z][CPU_BUF_SIZE - 1][4] = (((float) load[z].user + (float) load[z].system + (float) load[z].nice) / (float) load[z].total) * 100.0;
// Average values for final result
for (i = 4; i < 5; i++) {
value = 0;
-2
View File
@@ -1,11 +1,9 @@
#ifndef CPU_SMP_H
#define CPU_SMP_H
int cpu_smp_init ();
int cpu_smp_close ();
int cpu_smp_screen (int rep, int display);
#endif
-11
View File
@@ -27,7 +27,6 @@
#include <sys/statfs.h>
#endif
#include "../../shared/sockets.h"
#include "main.h"
@@ -36,14 +35,11 @@
FILE *mtab_fd;
typedef struct mounts {
char dev[256], type[64], mpoint[256];
long bsize, blocks, bfree, files, ffree;
} mounts;
static int
get_fs (mounts fs[])
{
@@ -115,7 +111,6 @@ disk_close ()
return 0;
}
///////////////////////////////////////////////////////////////////////////
// Gives disk stats.
//
@@ -143,7 +138,6 @@ disk_screen (int rep, int display)
#define huge long long int
huge size;
if (first) {
first = 0;
@@ -163,7 +157,6 @@ disk_screen (int rep, int display)
sock_send_string (sock, "widget_set D err2 5 3 {Filesystems}\n");
}
// Grab disk stats on first display, and fill "table".
// Get rid of old, unmounted filesystems...
memset (table, 0, sizeof (struct disp) * 256);
@@ -210,14 +203,11 @@ disk_screen (int rep, int display)
}
}
if (!count) {
sock_send_string (sock, "widget_set D err1 1 2 {Error Retrieving}\n");
sock_send_string (sock, "widget_set D err2 1 3 {Filesystem Stats}\n");
return 0;
}
// Display stuff... (show for two seconds, then scroll once per
// second, then hold at the end for two seconds)
sprintf (buffer, "widget_set D f 1 2 %i %i %i %i v 12\n", lcd_wid, lcd_hgt, lcd_wid, count);
@@ -249,7 +239,6 @@ disk_screen (int rep, int display)
sock_send_string (sock, tmp);
}
num_disks = count;
#undef huge
-7
View File
@@ -24,7 +24,6 @@ get_loadavg (void)
return load;
}
int
load_init ()
{
@@ -45,7 +44,6 @@ load_close ()
return 0;
}
///////////////////////////////////////////////////////////////////////////
// Shows a display very similar to "xload"'s histogram.
//
@@ -59,7 +57,6 @@ xload_screen (int rep, int display)
float loadmax = 0, factor, x;
int status = 0;
if (first) // Only the first time this is ever called...
{
first = 0;
@@ -92,8 +89,6 @@ xload_screen (int rep, int display)
sock_send_string (sock, tmp);
}
for (n = 0; n < (lcd_wid - 2); n++)
loads[n] = loads[n + 1];
loads[lcd_wid - 2] = get_loadavg ();
@@ -110,7 +105,6 @@ xload_screen (int rep, int display)
//if(display) sock_send_string(sock, tmp);
sock_send_string (sock, tmp);
if (loadmax < 1.0)
factor = (float) (lcd_cellhgt) * ((lcd_hgt == 2) ? 2.0 : 3.0);
else
@@ -141,6 +135,5 @@ xload_screen (int rep, int display)
//if(display) sock_send_string(sock, tmp);
sock_send_string (sock, tmp);
return status;
} // End xload_screen()
-3
View File
@@ -8,12 +8,9 @@
#define LOAD_MIN 0.5
#endif
int load_init ();
int load_close ();
int xload_screen (int rep, int display);
#endif
-13
View File
@@ -18,10 +18,8 @@
#include "../../shared/sockets.h"
#include "../../shared/debug.h"
// TODO: Commenting... Everything!
int Quit = 0;
int sock;
@@ -33,7 +31,6 @@ int lcd_hgt;
int lcd_cellwid;
int lcd_cellhgt;
/*
Mode List:
See below... (default_sequence[])
@@ -47,7 +44,6 @@ void main_loop (mode * sequence);
// 1/8th second is a single time unit...
#define TIME_UNIT 125000
// Contains a list of modes to run
mode default_sequence[] = {
// which on off inv timer/visible
@@ -75,7 +71,6 @@ mode default_sequence[] = {
// TODO: Config file; not just command line
int
main (int argc, char **argv)
{
@@ -97,8 +92,6 @@ main (int argc, char **argv)
// and just in case, "kill -KILL" (which cannot be trapped; but oh well)
signal (SIGKILL, exit_program);
// Command line
memcpy (sequence, default_sequence, sizeof (default_sequence));
for (i = 1, j = 0; i < argc; i++) {
@@ -157,7 +150,6 @@ main (int argc, char **argv)
}
}
// Connect to the server...
usleep (500000); // wait for the server to start up
sock = sock_connect (server, port);
@@ -168,7 +160,6 @@ main (int argc, char **argv)
sock_send_string (sock, "hello\n");
usleep (500000); // wait for the server to say hi.
// We grab the real values below, from the "connect" line.
lcd_wid = 20;
lcd_hgt = 4;
@@ -186,7 +177,6 @@ main (int argc, char **argv)
return 0;
}
void
HelpScreen ()
{
@@ -203,7 +193,6 @@ HelpScreen ()
exit (0);
}
///////////////////////////////////////////////////////////////////
// Called upon TERM and INTR signals...
//
@@ -216,7 +205,6 @@ exit_program (int val)
exit (0);
}
///////////////////////////////////////////////////////////////////
// Main program loop...
//
@@ -230,7 +218,6 @@ main_loop (mode * sequence)
int argc, newtoken;
int len;
// Main loop
// Run whatever screen we want, then wait. Woo-hoo!
while (!Quit) {
-4
View File
@@ -11,7 +11,6 @@ extern int lcd_hgt;
extern int lcd_cellwid;
extern int lcd_cellhgt;
typedef struct mode {
char which; // Which screen is it?
int on_time; // How often to update while visible?
@@ -21,8 +20,6 @@ typedef struct mode {
int visible; // Can we be seen right now?
} mode;
#define BLINK_ON 0x10
#define BLINK_OFF 0x11
#define BACKLIGHT_OFF 0x20
@@ -30,7 +27,6 @@ typedef struct mode {
#define HOLD_SCREEN 0x30
#define CONTINUE 0x31
#define LCD_MAX_WIDTH 80
#define LCD_MAX_HEIGHT 80
-22
View File
@@ -38,7 +38,6 @@ get_mem_info (struct meminfo *result)
result[1].free = getentry ("SwapFree:", buffer);
}
int
mem_init ()
{
@@ -60,7 +59,6 @@ mem_close ()
return 0;
}
/////////////////////////////////////////////////////////////////////////
// Mem Screen displays info about memory and swap usage...
//
@@ -121,10 +119,8 @@ mem_screen (int rep, int display)
//sock_send_string(sock, "\n");
}
get_mem_info (mem);
// flip the title back and forth...
if (lcd_hgt >= 4) {
if (which_title & 4) {
@@ -134,7 +130,6 @@ mem_screen (int rep, int display)
sock_send_string (sock, "widget_set M title { MEM -==- SWAP}\n");
which_title = (which_title + 1) & 7;
// Total memory
sprintf (tmp, "widget_set M memtotl 1 2 {%6dk}\n", mem[0].total);
if (display)
@@ -155,7 +150,6 @@ mem_screen (int rep, int display)
if (display)
sock_send_string (sock, tmp);
// Free memory graph
n = (int) (35.0 - ((float) mem[0].free + (float) mem[0].buffers + (float) mem[0].cache)
/ (float) mem[0].total * 35.0);
@@ -179,7 +173,6 @@ mem_screen (int rep, int display)
if (display)
sock_send_string (sock, tmp);
// Free memory graph
value = ((float) mem[0].free + (float) mem[0].buffers + (float) mem[0].cache)
/ (float) mem[0].total;
@@ -217,16 +210,11 @@ mem_screen (int rep, int display)
if (display)
sock_send_string (sock, tmp);
}
return 0;
} // End mem_screen()
typedef struct proc_mem_info {
char name[16]; // Is this really long enough?
// Size isn't used any more...
@@ -235,7 +223,6 @@ typedef struct proc_mem_info {
int number;
} proc_mem_info;
static int
sort_procs (void *a, void *b)
{
@@ -252,7 +239,6 @@ sort_procs (void *a, void *b)
return (two->totl > one->totl);
}
int
mem_top_screen (int rep, int display)
{
@@ -271,7 +257,6 @@ mem_top_screen (int rep, int display)
const int
NameLineLen = strlen (NameLine), VmSizeLineLen = strlen (VmSizeLine), VmDataLineLen = strlen (VmDataLine), VmStkLineLen = strlen (VmStkLine), VmExeLineLen = strlen (VmExeLine), VmRSSLineLen = strlen (VmRSSLine);
int threshold = 400, unique;
int i;
proc_mem_info *p;
@@ -299,14 +284,12 @@ mem_top_screen (int rep, int display)
sock_send_string (sock, "widget_set S 1 1 1 Checking...\n");
}
procs = LL_new ();
if (!procs) {
fprintf (stderr, "mem_top_screen: Error allocating list\n");
return -1;
}
if ((proc = opendir ("/proc")) == NULL) {
fprintf (stderr, "mem_top_screen: unable to open /proc");
perror ("");
@@ -383,7 +366,6 @@ mem_top_screen (int rep, int display)
}
closedir (proc);
// Now, print some info...
LL_Rewind (procs);
LL_Sort (procs, sort_procs);
@@ -408,9 +390,6 @@ mem_top_screen (int rep, int display)
LL_Next (procs);
}
end: // Ack! I hate using labels!
// Now clean it all up...
LL_Rewind (procs);
@@ -423,7 +402,6 @@ mem_top_screen (int rep, int display)
} while (LL_Next (procs) == 0);
LL_Destroy (procs);
return 0;
} // End mem_top_screen()
-1
View File
@@ -7,5 +7,4 @@ int mem_close ();
int mem_screen (int rep, int display);
int mem_top_screen (int rep, int display);
#endif
-10
View File
@@ -29,7 +29,6 @@
#include "load.h"
#include "mem.h"
int ELLIPSIS = '-';
// TODO: Clean this up... Support multiple display sizes..
@@ -40,7 +39,6 @@ char host[16];
void reread (int f, char *errmsg);
int getentry (const char *tag, const char *bufptr);
int
mode_init (mode * sequence)
{
@@ -120,8 +118,6 @@ mode_init (mode * sequence)
}
}
return 0;
}
@@ -137,7 +133,6 @@ mode_close ()
cpu_smp_close ();
}
int
update_screen (mode * m, int display)
{
@@ -224,7 +219,6 @@ update_screen (mode * m, int display)
}
void
reread (int f, char *errmsg)
{
@@ -255,7 +249,6 @@ getentry (const char *tag, const char *bufptr)
return -1;
}
///////////////////////////////////////////////////////////////////////////
//////////////////////// Let the Modes Begin! /////////////////////////////
///////////////////////////////////////////////////////////////////////////
@@ -264,9 +257,6 @@ getentry (const char *tag, const char *bufptr)
char tmp[1024];
////////////////////////////////////////////////////////////////////////
// Credit Screen shows who wrote this...
//
-1
View File
@@ -23,7 +23,6 @@ int update_screen (mode * m, int display);
int credit_screen (int rep, int display);
// These are for the modescreens' use only..
void reread (int f, char *errmsg);
int getentry (const char *tag, const char *bufptr);
-3
View File
@@ -6,7 +6,6 @@
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@@ -17,8 +16,6 @@
#include "screen.h"
#include "screenlist.h"
int
client_data_init (client_data * d)
{
-2
View File
@@ -3,7 +3,6 @@
#include "../shared/LL.h"
#define CLIENT_NAME_SIZE 256
typedef struct client_data {
@@ -16,7 +15,6 @@ typedef struct client_data {
} client_data;
// sets up an existing (empty) client_data struct
int client_data_init (client_data * d);
// destroys members of a client's data
-28
View File
@@ -9,7 +9,6 @@
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@@ -28,7 +27,6 @@
#include "widget.h"
#include "client_functions.h"
client_function commands[] = {
{"test_func", test_func_func},
{"hello", hello_func},
@@ -54,10 +52,8 @@ client_function commands[] = {
{NULL, NULL},
};
// TODO: Maybe more error-checking for "->"'s?
///////////////////////////////////////////////////////////////////////////
// Debugging only.. prints out a list of arguments it receives
//
@@ -75,7 +71,6 @@ test_func_func (client * c, int argc, char **argv)
return 0;
}
///////////////////////////////////////////////////////////////////////////
// The client must say "hello" before doing anything else.
//
@@ -144,7 +139,6 @@ int
client_add_key_func (client * c, int argc, char **argv)
{
if (!c->data->ack)
return 1;
@@ -161,7 +155,6 @@ int
client_del_key_func (client * c, int argc, char **argv)
{
if (!c->data->ack)
return 1;
@@ -190,7 +183,6 @@ screen_add_func (client * c, int argc, char **argv)
return 0;
}
debug ("screen_add: Adding screen %s\n", argv[1]);
err = screen_add (c, argv[1]);
if (err < 0)
@@ -221,7 +213,6 @@ screen_del_func (client * c, int argc, char **argv)
return 0;
}
debug ("screen_del: Deleting screen %s\n", argv[1]);
err = screen_remove (c, argv[1]);
if (err < 0)
@@ -248,7 +239,6 @@ screen_set_func (client * c, int argc, char **argv)
if (!c->data->ack)
return 1;
// If there weren't enough parameters...
if (argc < 2) {
sock_send_string (c->sock, "huh? You must specify a screen id\n");
@@ -260,7 +250,6 @@ screen_set_func (client * c, int argc, char **argv)
return 0;
}
id = argv[1];
s = screen_find (c, id);
if (!s) {
@@ -385,11 +374,9 @@ widget_add_func (client * c, int argc, char **argv)
char *in = NULL;
screen *s;
if (!c->data->ack)
return 1;
// If there weren't enough parameters...
if (argc < 2) {
sock_send_string (c->sock, "huh? You must specify a screen id\n");
@@ -408,7 +395,6 @@ widget_add_func (client * c, int argc, char **argv)
return 0;
}
sid = argv[1];
wid = argv[2];
@@ -431,7 +417,6 @@ widget_add_func (client * c, int argc, char **argv)
in = argv[5];
}
}
// Add the widget and set its type...
err = widget_add (s, wid, type, in, c->sock);
if (err < 0)
@@ -469,7 +454,6 @@ widget_del_func (client * c, int argc, char **argv)
return 0;
}
sid = argv[1];
wid = argv[2];
@@ -509,7 +493,6 @@ widget_set_func (client * c, int argc, char **argv)
if (!c->data->ack)
return 1;
// If there weren't enough parameters...
if (argc < 2) {
sock_send_string (c->sock, "huh? You must specify a screen id\n");
@@ -524,7 +507,6 @@ widget_set_func (client * c, int argc, char **argv)
return 0;
}
sid = argv[1];
wid = argv[2];
s = screen_find (c, sid);
@@ -545,7 +527,6 @@ widget_set_func (client * c, int argc, char **argv)
}
return 0;
}
// FIXME? Shouldn't this be handled in widget.c?
i = 3;
switch (w->type) {
@@ -750,7 +731,6 @@ int
menu_add_func (client * c, int argc, char **argv)
{
if (!c->data->ack)
return 1;
@@ -766,7 +746,6 @@ int
menu_del_func (client * c, int argc, char **argv)
{
if (!c->data->ack)
return 1;
@@ -784,7 +763,6 @@ int
menu_set_func (client * c, int argc, char **argv)
{
if (!c->data->ack)
return 1;
@@ -800,7 +778,6 @@ int
menu_item_add_func (client * c, int argc, char **argv)
{
if (!c->data->ack)
return 1;
@@ -816,7 +793,6 @@ int
menu_item_del_func (client * c, int argc, char **argv)
{
if (!c->data->ack)
return 1;
@@ -834,7 +810,6 @@ int
menu_item_set_func (client * c, int argc, char **argv)
{
if (!c->data->ack)
return 1;
@@ -863,10 +838,8 @@ backlight_func (client * c, int argc, char **argv)
return 0;
}
debug ("backlight(%s)\n", argv[1]);
switch (backlight) {
case BACKLIGHT_OPEN:
if (0 == strcmp ("on", argv[1])) {
@@ -912,7 +885,6 @@ output_func (client * c, int argc, char **argv)
return 0;
}
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
-3
View File
@@ -1,7 +1,6 @@
#ifndef CLIENT_FUNCTION_H
#define CLIENT_FUNCTION_H
/*
The function list for clients is stored in a table, and the items each
point to a function to call, defined below.
@@ -35,6 +34,4 @@ int output_func (client * c, int argc, char **argv);
extern client_function commands[];
#endif
-1
View File
@@ -21,5 +21,4 @@ typedef struct client_menu_item {
char child[]; // For the "submenu" type
} client_menu;
#endif
-6
View File
@@ -20,8 +20,6 @@
#include "client_data.h"
#include "../shared/debug.h"
LL *clients;
// Initialize and kill client list...
@@ -47,7 +45,6 @@ client_shutdown ()
debug ("client_shutdown()\n");
// Free all client structures...
// Note that the regular list loop doesn't work here, because
// client_destroy() calls LL_Remove()
@@ -73,7 +70,6 @@ client_shutdown ()
return 0;
}
// Create and destroy clients....
client *
client_create (int sock)
@@ -93,7 +89,6 @@ client_create (int sock)
c->data = NULL;
c->messages = NULL;
c->sock = sock;
// Set up message list...
@@ -235,7 +230,6 @@ client_get (client * c)
return NULL;
}
client *
client_find_sock (int sock)
{
-3
View File
@@ -13,12 +13,10 @@ typedef struct client {
extern LL *clients;
// Initialize and kill client list...
int client_init ();
int client_shutdown ();
// Create and destroy clients....
client *client_create (int sock);
int client_destroy (client * c);
@@ -35,5 +33,4 @@ void *client_get (client * c);
// Search for a client with a particular filedescriptor...
client *client_find_sock (int sock);
#endif
-25
View File
@@ -22,8 +22,6 @@ typedef enum {
beat = 8
} custom_type;
static int fd;
static void CFontz_linewrap (int on);
@@ -148,7 +146,6 @@ CFontz_init (lcd_logical_driver * driver, char *args)
cfsetispeed (&portset, speed);
tcsetattr (fd, TCSANOW, &portset);
// Set display-specific stuff..
if (reboot) {
CFontz_reboot ();
@@ -161,13 +158,11 @@ CFontz_init (lcd_logical_driver * driver, char *args)
CFontz_autoscroll (0);
CFontz_backlight (backlight_brightness);
if (!driver->framebuf) {
fprintf (stderr, "CFontz_init: No frame buffer.\n");
driver->close ();
return -1;
}
// Set the functions the driver supports...
driver->clear = (void *) -1;
@@ -201,8 +196,6 @@ CFontz_init (lcd_logical_driver * driver, char *args)
return fd;
}
/////////////////////////////////////////////////////////////////
// Clean-up
//
@@ -217,22 +210,18 @@ CFontz_close ()
CFontz->framebuf = NULL;
}
void
CFontz_flush ()
{
CFontz_draw_frame (lcd.framebuf);
}
void
CFontz_flush_box (int lft, int top, int rgt, int bot)
{
int y;
char out[LCD_MAX_WIDTH];
// printf("Flush (%i,%i)-(%i,%i)\n", lft, top, rgt, bot);
for (y = top; y <= bot; y++) {
@@ -242,10 +231,8 @@ CFontz_flush_box (int lft, int top, int rgt, int bot)
}
}
/////////////////////////////////////////////////////////////////
// Prints a character on the lcd display, at position (x,y). The
// upper-left is (1,1), and the lower right should be (20,4).
@@ -261,7 +248,6 @@ CFontz_chr (int x, int y, char c)
lcd.framebuf[(y * lcd.wid) + x] = c;
}
/////////////////////////////////////////////////////////////////
// Changes screen contrast (0-255; 140 seems good)
//
@@ -282,7 +268,6 @@ CFontz_contrast (int contrast)
return status;
}
/////////////////////////////////////////////////////////////////
// Sets the backlight on or off -- can be done quickly for
// an intermediate brightness...
@@ -300,7 +285,6 @@ CFontz_backlight (int on)
write (fd, out, 3);
}
/////////////////////////////////////////////////////////////////
// Toggle the built-in linewrapping feature
//
@@ -329,7 +313,6 @@ CFontz_autoscroll (int on)
write (fd, out, 1);
}
/////////////////////////////////////////////////////////////////
// Get rid of the blinking curson
//
@@ -352,7 +335,6 @@ CFontz_reboot ()
write (fd, out, 1);
}
/////////////////////////////////////////////////////////////////
// Sets up for vertical bars. Call before lcd.vbar()
//
@@ -529,7 +511,6 @@ CFontz_vbar (int x, int len)
{
char map[9] = { 32, 1, 2, 3, 4, 5, 6, 7, 255 };
int y;
for (y = lcd.hgt; y > 0 && len > 0; y--) {
if (len >= lcd.cellhgt)
@@ -562,7 +543,6 @@ CFontz_hbar (int x, int y, int len)
}
/////////////////////////////////////////////////////////////////
// Sets up for big numbers.
//
@@ -571,7 +551,6 @@ CFontz_init_num ()
{
}
/////////////////////////////////////////////////////////////////
// Writes a big number.
//
@@ -583,7 +562,6 @@ CFontz_num (int x, int num)
write (fd, out, 3);
}
/////////////////////////////////////////////////////////////////
// Sets a custom character from 0-7...
//
@@ -606,7 +584,6 @@ CFontz_set_char (int n, char *dat)
sprintf (out, "%c%c", 25, n);
write (fd, out, 2);
for (row = 0; row < lcd.cellhgt; row++) {
letter = 0;
for (col = 0; col < lcd.cellwid; col++) {
@@ -617,7 +594,6 @@ CFontz_set_char (int n, char *dat)
}
}
void
CFontz_icon (int which, char dest)
{
@@ -662,7 +638,6 @@ CFontz_icon (int which, char dest)
CFontz_set_char (dest, &icons[which][0]);
}
/////////////////////////////////////////////////////////////
// Blasts a single frame onscreen, to the lcd...
//
-3
View File
@@ -1,7 +1,6 @@
#ifndef CFONTZ_H
#define CFONTZ_H
extern lcd_logical_driver *CFontz;
int CFontz_init (lcd_logical_driver * driver, char *device);
@@ -21,6 +20,4 @@ void CFontz_set_char (int n, char *dat);
void CFontz_icon (int which, char dest);
void CFontz_draw_frame (char *dat);
#endif
-31
View File
@@ -56,8 +56,6 @@ static int clear = 1;
static int def[9] = { -1, -1, -1, -1, -1, -1, -1, -1, -1 };
static int use[9] = { 1, 0, 0, 0, 0, 0, 0, 0, 0 };
static void MtxOrb_linewrap (int on);
static void MtxOrb_autoscroll (int on);
static void MtxOrb_cursorblink (int on);
@@ -82,10 +80,8 @@ MtxOrb_init (lcd_logical_driver * driver, char *args)
char device[256] = "/dev/lcd";
int speed = B19200;
MtxOrb = driver;
//debug("MtxOrb_init: Args(all): %s\n", args);
argc = get_args (argv, args, 64);
@@ -159,19 +155,16 @@ MtxOrb_init (lcd_logical_driver * driver, char *args)
cfsetispeed (&portset, speed);
tcsetattr (fd, TCSANOW, &portset);
// Set display-specific stuff..
MtxOrb_linewrap (1);
MtxOrb_autoscroll (1);
MtxOrb_cursorblink (0);
if (!driver->framebuf) {
fprintf (stderr, "MtxOrb_init: No frame buffer.\n");
driver->close ();
return -1;
}
// Set the functions the driver supports...
// driver->clear = (void *)-1;
@@ -206,7 +199,6 @@ MtxOrb_init (lcd_logical_driver * driver, char *args)
return fd;
}
// TODO: Check this quick hack to detect clear of the screen.
/////////////////////////////////////////////////////////////////
// Clear: catch up when the screen get clear to be able to
@@ -221,7 +213,6 @@ MtxOrb_clear ()
clear = 1;
}
/////////////////////////////////////////////////////////////////
// Clean-up
//
@@ -236,21 +227,18 @@ MtxOrb_close ()
MtxOrb->framebuf = NULL;
}
void
MtxOrb_flush ()
{
MtxOrb_draw_frame (lcd.framebuf);
}
void
MtxOrb_flush_box (int lft, int top, int rgt, int bot)
{
int y;
char out[LCD_MAX_WIDTH];
// printf("Flush (%i,%i)-(%i,%i)\n", lft, top, rgt, bot);
for (y = top; y <= bot; y++) {
@@ -260,10 +248,8 @@ MtxOrb_flush_box (int lft, int top, int rgt, int bot)
}
}
/////////////////////////////////////////////////////////////////
// Prints a character on the lcd display, at position (x,y). The
// upper-left is (1,1), and the lower right should be (20,4).
@@ -277,7 +263,6 @@ MtxOrb_chr (int x, int y, char c)
lcd.framebuf[(y * lcd.wid) + x] = c;
}
/////////////////////////////////////////////////////////////////
// Changes screen contrast (0-255; 140 seems good)
//
@@ -296,7 +281,6 @@ MtxOrb_contrast (int contrast)
return status;
}
/////////////////////////////////////////////////////////////////
// Sets the backlight on or off -- can be done quickly for
// an intermediate brightness...
@@ -314,7 +298,6 @@ MtxOrb_backlight (int on)
}
}
/////////////////////////////////////////////////////////////////
// Sets output port on or off
void
@@ -330,7 +313,6 @@ MtxOrb_output (int on)
}
}
/////////////////////////////////////////////////////////////////
// Toggle the built-in linewrapping feature
//
@@ -345,7 +327,6 @@ MtxOrb_linewrap (int on)
write (fd, out, 2);
}
/////////////////////////////////////////////////////////////////
// Toggle the built-in automatic scrolling feature
//
@@ -360,7 +341,6 @@ MtxOrb_autoscroll (int on)
write (fd, out, 2);
}
// TODO: make sure this doesn't mess up non-VFD displays
/////////////////////////////////////////////////////////////////
// Toggle cursor blink on/off
@@ -376,7 +356,6 @@ MtxOrb_cursorblink (int on)
write (fd, out, 2);
}
//// TODO: Might not be needed anymore...
/////////////////////////////////////////////////////////////////
// Sets up for vertical bars. Call before lcd.vbar()
@@ -503,7 +482,6 @@ MtxOrb_num (int x, int num)
write (fd, out, 4);
}
// TODO: This could be higly optimised if data where to be pre-computed.
/////////////////////////////////////////////////////////////////
@@ -538,7 +516,6 @@ MtxOrb_set_char (int n, char *dat)
}
}
void
MtxOrb_icon (int which, char dest)
{
@@ -605,8 +582,6 @@ MtxOrb_draw_frame (char *dat)
}
/////////////////////////////////////////////////////////////
// returns one character from the keypad...
// (A-Z) on success, 0 on failure...
@@ -642,7 +617,6 @@ MtxOrb_led (int which, int on)
}
}
/////////////////////////////////////////////////////////////////
// Ask for dynamic allocation of a custom caracter to be
// a well none bar graphic. The function is suppose to
@@ -791,7 +765,6 @@ MtxOrb_ask_bar (int type)
return (pos);
}
/////////////////////////////////////////////////////////////////
// Sets up a well known character for use.
//
@@ -1030,12 +1003,8 @@ MtxOrb_set_known_char (int car, int type)
MtxOrb_set_char (car, &all_bar[type][0]);
}
/////////////////STOP READING --- TRASH IS AT THE END////////////////
// TODO: Remove this code wich was use for developpement.
// PS: There might be reference to this code left, so keep it for some time.
void
-1
View File
@@ -1,7 +1,6 @@
#ifndef MTXORB_H
#define MTXORB_H
extern lcd_logical_driver *MtxOrb;
int MtxOrb_init (lcd_logical_driver * driver, char *device);
-13
View File
@@ -21,7 +21,6 @@
#include "curses_drv.h"
#include "drv_base.h"
lcd_logical_driver *curses_drv;
int PAD = 255;
@@ -33,7 +32,6 @@ int ELLIPSIS = 7;
static char icon_char = '@';
int
curses_drv_init (struct lcd_logical_driver *driver, char *args)
{
@@ -41,7 +39,6 @@ curses_drv_init (struct lcd_logical_driver *driver, char *args)
int argc;
int i, j;
argc = get_args (argv, args, 64);
for (i = 0; i < argc; i++) {
@@ -78,7 +75,6 @@ curses_drv_init (struct lcd_logical_driver *driver, char *args)
}
curses_drv = driver;
// Init curses...
@@ -146,7 +142,6 @@ curses_drv_clear ()
}
/////////////////////////////////////////////////////////////////
// Prints a string on the lcd display, at position (x,y). The
// upper-left is (1,1), and the lower right should be (20,4).
@@ -215,7 +210,6 @@ curses_drv_num (int x, int num)
curses_drv_chr (x + dx, y, c);
}
/////////////////////////////////////////////////////////////////
// Draws a vertical bar; erases entire column onscreen.
//
@@ -254,13 +248,10 @@ curses_drv_hbar (int x, int y, int len)
len -= lcd.cellwid;
}
// move(y-1, x-1);
// hline(0, len/lcd.cellwid);
}
/////////////////////////////////////////////////////////////////
// Sets character 0 to an icon...
//
@@ -291,14 +282,12 @@ curses_drv_flush ()
curses_drv_draw_frame (curses_drv->framebuf);
}
void
curses_drv_flush_box (int lft, int top, int rgt, int bot)
{
curses_drv_flush ();
}
void
curses_drv_draw_frame (char *dat)
{
@@ -308,8 +297,6 @@ curses_drv_draw_frame (char *dat)
}
char
curses_drv_getkey ()
{
-2
View File
@@ -1,7 +1,6 @@
#ifndef LCD_CURSES_H
#define LCD_CURSES_H
extern lcd_logical_driver *curses_drv;
int curses_drv_init (struct lcd_logical_driver *driver, char *args);
@@ -20,5 +19,4 @@ char curses_drv_getkey ();
void curses_drv_init_num ();
void curses_drv_num (int x, int num);
#endif
-20
View File
@@ -9,7 +9,6 @@
#include "lcd.h"
#include "debug.h"
//////////////////////////////////////////////////////////////////////////
////////////////////// For Debugging Output //////////////////////////////
//////////////////////////////////////////////////////////////////////////
@@ -17,7 +16,6 @@
// TODO: somehow allow access to the driver->framebuffer to each
// function...
int
debug_init (struct lcd_logical_driver *driver, char *args)
{
@@ -28,7 +26,6 @@ debug_init (struct lcd_logical_driver *driver, char *args)
driver->framebuf = malloc (lcd.wid * lcd.hgt);
}
if (!driver->framebuf) {
debug_close ();
return -1;
@@ -61,7 +58,6 @@ debug_init (struct lcd_logical_driver *driver, char *args)
driver->getkey = debug_getkey;
return 200; // 200 is arbitrary. (must be 1 or more)
}
@@ -70,7 +66,6 @@ debug_close ()
{
// Ack! This shouldn't crash the program, but does.. Why??
printf ("debug_close()\n");
// This is the line which crashes.
@@ -95,7 +90,6 @@ debug_clear ()
}
//////////////////////////////////////////////////////////////////
// Flushes all output to the lcd...
//
@@ -107,7 +101,6 @@ debug_flush ()
lcd.draw_frame ();
}
/////////////////////////////////////////////////////////////////
// Prints a string on the lcd display, at position (x,y). The
// upper-left is (1,1), and the lower right should be (20,4).
@@ -120,7 +113,6 @@ debug_string (int x, int y, char string[])
printf ("string(%i, %i):%s \n", x, y, string);
x -= 1; // Convert 1-based coords to 0-based...
y -= 1;
@@ -138,15 +130,12 @@ debug_chr (int x, int y, char c)
{
printf ("character(%i, %i):%c\n", x, y, c);
y--;
x--;
lcd.framebuf[(y * lcd.wid) + x] = c;
}
void
debug_contrast (int contrast)
{
@@ -203,7 +192,6 @@ debug_vbar (int x, int len)
printf ("Vbar(%i, %i)\n", x, len);
for (y = lcd.hgt; y > 0 && len > 0; y--) {
debug_chr (x, y, '|');
@@ -220,7 +208,6 @@ debug_hbar (int x, int y, int len)
{
printf ("Hbar(%i, %i, %i)\n", x, y, len);
for (; x < lcd.wid && len > 0; x++) {
debug_chr (x, y, '-');
@@ -229,7 +216,6 @@ debug_hbar (int x, int y, int len)
}
/////////////////////////////////////////////////////////////////
// Sets character 0 to an icon...
//
@@ -239,18 +225,15 @@ debug_icon (int which, char dest)
printf ("Char %i is icon %i\n", dest, which);
}
void
debug_flush_box (int lft, int top, int rgt, int bot)
{
printf ("Flush Box(%i, %i)-(%i, %i)\n", lft, top, rgt, bot);
debug_flush ();
}
void
debug_draw_frame (char *dat)
{
@@ -260,7 +243,6 @@ debug_draw_frame (char *dat)
printf ("draw_frame()\n");
if (!dat)
return;
@@ -272,7 +254,6 @@ debug_draw_frame (char *dat)
out[lcd.wid] = 0;
printf ("+%s+\n", out);
for (i = 0; i < lcd.hgt; i++) {
for (j = 0; j < lcd.wid; j++) {
out[j] = dat[j + (i * lcd.wid)];
@@ -290,7 +271,6 @@ debug_draw_frame (char *dat)
}
char
debug_getkey ()
{
-2
View File
@@ -1,7 +1,6 @@
#ifndef LCD_DEBUG_H
#define LCD_DEBUG_H
int debug_init (struct lcd_logical_driver *driver, char *args);
void debug_close ();
void debug_clear ();
@@ -22,5 +21,4 @@ void debug_flush_box (int lft, int top, int rgt, int bot);
void debug_draw_frame (char *dat);
char debug_getkey ();
#endif
-10
View File
@@ -9,7 +9,6 @@
#include "lcd.h"
#include "drv_base.h"
//////////////////////////////////////////////////////////////////////////
////////////////////// Base "class" to derive from ///////////////////////
//////////////////////////////////////////////////////////////////////////
@@ -18,7 +17,6 @@ lcd_logical_driver *drv_base;
// TODO: Get lcd.framebuf to properly work as whatever driver is running...
////////////////////////////////////////////////////////////
// init() should set up any device-specific stuff, and
// point all the function pointers.
@@ -71,11 +69,9 @@ drv_base_init (struct lcd_logical_driver *driver, char *args)
driver->getkey = drv_base_getkey;
return 200; // 200 is arbitrary. (must be 1 or more)
}
// Below here, you may use either lcd.framebuf or driver->framebuf..
// lcd.framebuf will be set to the appropriate buffer before calling
// your driver.
@@ -99,7 +95,6 @@ drv_base_clear ()
}
//////////////////////////////////////////////////////////////////
// Flushes all output to the lcd...
//
@@ -109,7 +104,6 @@ drv_base_flush ()
//lcd.draw_frame(lcd.framebuf);
}
/////////////////////////////////////////////////////////////////
// Prints a string on the lcd display, at position (x,y). The
// upper-left is (1,1), and the lower right should be (20,4).
@@ -143,7 +137,6 @@ drv_base_chr (int x, int y, char c)
lcd.framebuf[(y * lcd.wid) + x] = c;
}
//////////////////////////////////////////////////////////////////////
// Sets the contrast of the display. Value is 0-255, where 140 is
// what I consider "just right".
@@ -247,7 +240,6 @@ drv_base_hbar (int x, int y, int len)
}
/////////////////////////////////////////////////////////////////
// Sets character 0 to an icon...
//
@@ -257,7 +249,6 @@ drv_base_icon (int which, char dest)
// printf("Char %i set to icon %i\n", dest, which);
}
//////////////////////////////////////////////////////////////////////
// Send a rectangular area to the display.
//
@@ -314,7 +305,6 @@ drv_base_draw_frame (char *dat)
*/
}
//////////////////////////////////////////////////////////////////////
// Tries to read a character from an input device...
//
-2
View File
@@ -46,7 +46,6 @@
7. Add your driver to the Makefile, and Makefile.config, in the same
style as the existing ones.
Notes:
Don't call lcd.whatever() functions within your driver. This causes
@@ -115,5 +114,4 @@ void drv_base_flush_box (int lft, int top, int rgt, int bot);
void drv_base_draw_frame (char *dat);
char drv_base_getkey ();
#endif
-2
View File
@@ -51,7 +51,6 @@
void lcdstat_HD44780_senddata (unsigned char displayID, unsigned char flags, unsigned char ch);
#define RS 0x10
#define RW 0x20
#define EN1 0x40
@@ -138,7 +137,6 @@ hd_init_4bit (HD44780_functions * hd44780_functions, lcd_logical_driver * driver
return 0;
}
// lcdstat_HD44780_senddata
void
lcdstat_HD44780_senddata (unsigned char displayID, unsigned char iflags, unsigned char ch)
-3
View File
@@ -45,7 +45,6 @@
void lcdtime_HD44780_senddata (unsigned char displayID, unsigned char flags, unsigned char ch);
#define nRS nSTRB
#define nRW nLF
#define EN1 INIT
@@ -58,7 +57,6 @@ void lcdtime_HD44780_senddata (unsigned char displayID, unsigned char flags, uns
static unsigned int lptPort;
static int semid;
// initialise the driver
int
hd_init_ext8bit (HD44780_functions * hd44780_functions, lcd_logical_driver * driver, char *args, unsigned int port)
@@ -77,7 +75,6 @@ hd_init_ext8bit (HD44780_functions * hd44780_functions, lcd_logical_driver * dri
return 0;
}
// lcdtime_HD44780_senddata
void
lcdtime_HD44780_senddata (unsigned char displayID, unsigned char flags, unsigned char ch)
-2
View File
@@ -35,7 +35,6 @@ extern HD44780_functions *hd44780_functions;
#define RS_DATA 0x00
#define RS_INSTR 0x01
#define CLEAR 0x01
#define HOMECURSOR 0x02
@@ -72,7 +71,6 @@ extern HD44780_functions *hd44780_functions;
#define POSITION 0x80
// Parallel port pin definitions
// Output lines
#define nSTRB 0x01 /* negative logic */
-3
View File
@@ -43,11 +43,9 @@ void shiftreg (unsigned char displayID, unsigned char r);
#define EN1 4
#define EN2 32
static unsigned int lp;
static char lastkey = 0;
// Initialisation
int
hd_init_serialLpt (HD44780_functions * hd44780_functions, lcd_logical_driver * driver, char *args, unsigned int port)
@@ -86,7 +84,6 @@ hd_init_serialLpt (HD44780_functions * hd44780_functions, lcd_logical_driver * d
return 0;
}
void
lcdserLpt_HD44780_senddata (unsigned char displayID, unsigned char flags, unsigned char ch)
{
-2
View File
@@ -49,7 +49,6 @@ static int EnMaskSize = sizeof (EnMask) / sizeof (unsigned char);
static unsigned int lptPort;
static int extIF = 0; // non-zero if extended interface
// initialise the driver
int
hd_init_winamp (HD44780_functions * hd44780_functions, lcd_logical_driver * driver, char *args, unsigned int port)
@@ -78,7 +77,6 @@ hd_init_winamp (HD44780_functions * hd44780_functions, lcd_logical_driver * driv
return 0;
}
// lcdwinamp_HD44780_senddata
void
lcdwinamp_HD44780_senddata (unsigned char displayID, unsigned char flags, unsigned char ch)
-16
View File
@@ -42,7 +42,6 @@
#include "hd44780-low.h"
#include "hd44780-drivers.h"
// default parallel port address
#ifndef LPTPORT
#define LPTPORT 0x378
@@ -50,7 +49,6 @@
unsigned int port = LPTPORT;
lcd_logical_driver *HD44780;
HD44780_functions *hd44780_functions;
@@ -71,7 +69,6 @@ static int numDisplays = 0;
// input span list but is kept to save some cpu cycles.
static int *dispSizes = NULL;
// function declarations
void HD44780_flush ();
void HD44780_flush_box (int lft, int top, int rgt, int bot);
@@ -225,7 +222,6 @@ HD44780_init (lcd_logical_driver * driver, char *args)
//HD44780_close();
return -1;
}
// Set the functions the driver supports...
// These are the default HD44780 functions
driver->clear = (void *) -1;
@@ -303,7 +299,6 @@ uPause (int delayCalls)
//TODO: put in option for nanosleep rather than dummy I/O call
}
// displayID - ID of display to use (0 = all displays)
static void
HD44780_senddata (unsigned char displayID, unsigned char flags, unsigned char ch)
@@ -312,7 +307,6 @@ HD44780_senddata (unsigned char displayID, unsigned char flags, unsigned char ch
hd44780_functions->uPause (40);
}
/////////////////////////////////////////////////////////////////
// Clean-up
//
@@ -358,7 +352,6 @@ HD44780_flush ()
HD44780_draw_frame (lcd.framebuf);
}
void
HD44780_flush_box (int lft, int top, int rgt, int bot)
{
@@ -377,7 +370,6 @@ HD44780_flush_box (int lft, int top, int rgt, int bot)
}
/////////////////////////////////////////////////////////////////
// Changes screen contrast (0-255; 140 seems good)
//
@@ -396,7 +388,6 @@ HD44780_backlight (int on)
{
}
/////////////////////////////////////////////////////////////////
// Toggle the built-in linewrapping feature
//
@@ -421,7 +412,6 @@ common_autoscroll (int on)
hd44780_functions->uPause (1600);
}
/////////////////////////////////////////////////////////////////
// Sets up for vertical bars. Call before lcd.vbar()
//
@@ -602,7 +592,6 @@ HD44780_hbar (int x, int y, int len)
}
}
/////////////////////////////////////////////////////////////////
// Sets up for big numbers.
//
@@ -614,7 +603,6 @@ HD44780_init_num ()
//write(fd, out, 2);
}
/////////////////////////////////////////////////////////////////
// Writes a big number.
//
@@ -626,7 +614,6 @@ HD44780_num (int x, int num)
//write(fd, out, 4);
}
/////////////////////////////////////////////////////////////////
// Sets a custom character from 0-7...
//
@@ -657,7 +644,6 @@ HD44780_set_char (int n, char *dat)
}
}
void
HD44780_icon (int which, char dest)
{
@@ -697,11 +683,9 @@ HD44780_icon (int which, char dest)
};
HD44780_set_char (dest, &icons[which][0]);
}
/////////////////////////////////////////////////////////////
// Blasts a single frame onscreen, to the lcd...
//
-7
View File
@@ -14,11 +14,9 @@
#include <sys/types.h>
#include <errno.h>
#define __u32 unsigned int
#define __u8 unsigned char
#include "../../shared/debug.h"
#include "../../shared/str.h"
@@ -28,7 +26,6 @@
#include "irmanin.h"
#include "../../../libirman-0.4.1b/irman.h"
char *progname = "irmanin";
char *codes[] = {
@@ -62,8 +59,6 @@ char *codes[] = {
/* end */ NULL
};
//////////////////////////////////////////////////////////////////////////
////////////////////// Base "class" to derive from ///////////////////////
//////////////////////////////////////////////////////////////////////////
@@ -162,7 +157,6 @@ irmanin_init (struct lcd_logical_driver *driver, char *args)
return 1; // 200 is arbitrary. (must be 1 or more)
}
void
irmanin_close ()
{
@@ -175,7 +169,6 @@ irmanin_close ()
ir_finish ();
}
//////////////////////////////////////////////////////////////////////
// Tries to read a character from an input device...
//
-2
View File
@@ -1,12 +1,10 @@
#ifndef LCD_IRMANIN__H
#define LCD_IRMANIN_H
extern lcd_logical_driver *joy;
int irmanin_init (struct lcd_logical_driver *driver, char *args);
void irmanin_close ();
char irmanin_getkey ();
#endif
-16
View File
@@ -8,24 +8,18 @@
#include <sys/ioctl.h>
#include <sys/types.h>
#define __u32 unsigned int
#define __u8 unsigned char
#include <linux/joystick.h>
#include "../../shared/debug.h"
#include "../../shared/str.h"
#define NAME_LENGTH 128
#include "lcd.h"
#include "joy.h"
//////////////////////////////////////////////////////////////////////////
////////////////////// Base "class" to derive from ///////////////////////
//////////////////////////////////////////////////////////////////////////
@@ -44,12 +38,10 @@ char jsname[NAME_LENGTH] = "Unknown";
int *axis;
int *button;
// Configured for a Gravis Gamepad (2 axis, 4 button)
char *axismap = "EFGHIJKLMNOPQRST";
char *buttonmap = "BDACEFGHIJKLMNOP";
////////////////////////////////////////////////////////////
// init() should set up any device-specific stuff, and
// point all the function pointers.
@@ -62,7 +54,6 @@ joy_init (struct lcd_logical_driver *driver, char *args)
joy = driver;
strcpy (device, "/dev/js0");
argc = get_args (argv, args, 64);
@@ -96,14 +87,9 @@ joy_init (struct lcd_logical_driver *driver, char *args)
}
driver->getkey = joy_getkey;
driver->close = joy_close;
/* FIXME: This crashes!
if(args)
{
@@ -131,7 +117,6 @@ joy_init (struct lcd_logical_driver *driver, char *args)
return fd; // 200 is arbitrary. (must be 1 or more)
}
void
joy_close ()
{
@@ -147,7 +132,6 @@ joy_close ()
}
//////////////////////////////////////////////////////////////////////
// Tries to read a character from an input device...
//
-2
View File
@@ -1,12 +1,10 @@
#ifndef LCD_JOY_H
#define LCD_JOY_H
extern lcd_logical_driver *joy;
int joy_init (struct lcd_logical_driver *driver, char *args);
void joy_close ();
char joy_getkey ();
#endif
-18
View File
@@ -58,7 +58,6 @@
// TODO: Make a Windows server, and clients...?
lcd_logical_driver lcd;
lcd_physical_driver drivers[] = {
@@ -140,7 +139,6 @@ lcd_init (char *args)
}
// TODO: lcd_remove_driver()
int
@@ -198,7 +196,6 @@ lcd_shutdown ()
{
lcd_logical_driver *driver;
LL_Rewind (list);
do {
driver = (lcd_logical_driver *) LL_Get (list);
@@ -223,8 +220,6 @@ lcd_shutdown ()
return 0;
}
int
lcd_drv_init (struct lcd_logical_driver *driver, char *args)
{
@@ -275,12 +270,9 @@ lcd_drv_init (struct lcd_logical_driver *driver, char *args)
lcd.getkey = lcd_drv_getkey;
return 1; // 1 is arbitrary. (must be 1 or more)
}
//////////////////////////////////////////////////////////////////////
// All functions below here call their respective driver functions...
//
@@ -296,7 +288,6 @@ lcd_drv_init (struct lcd_logical_driver *driver, char *args)
// driver->func() == -1 means it should call the generic driver.
//////////////////////////////////////////////////////////////////////
void
lcd_drv_close ()
{
@@ -342,7 +333,6 @@ lcd_drv_clear ()
}
void
lcd_drv_flush ()
{
@@ -363,7 +353,6 @@ lcd_drv_flush ()
} while (LL_Next (list) == 0);
}
void
lcd_drv_string (int x, int y, char string[])
{
@@ -404,8 +393,6 @@ lcd_drv_chr (int x, int y, char c)
} while (LL_Next (list) == 0);
}
int
lcd_drv_contrast (int contrast)
{
@@ -474,7 +461,6 @@ lcd_drv_output (int on)
} while (LL_Next (list) == 0);
}
void
lcd_drv_init_vbar ()
{
@@ -615,7 +601,6 @@ lcd_drv_hbar (int x, int y, int len)
} while (LL_Next (list) == 0);
}
void
lcd_drv_icon (int which, char dest)
{
@@ -636,7 +621,6 @@ lcd_drv_icon (int which, char dest)
} while (LL_Next (list) == 0);
}
void
lcd_drv_flush_box (int lft, int top, int rgt, int bot)
{
@@ -658,7 +642,6 @@ lcd_drv_flush_box (int lft, int top, int rgt, int bot)
}
// TODO: Check whether lcd.draw_frame() should really take a framebuffer
// TODO: as an argument, or if it should always use lcd.framebuf
void
@@ -682,7 +665,6 @@ lcd_drv_draw_frame (char *dat)
}
char
lcd_drv_getkey ()
{
-5
View File
@@ -7,13 +7,10 @@
#define LCD_MAX_HGT 256
#define LCD_MAX_HEIGHT 256
int lcd_init (char *args);
int lcd_add_driver (char *driver, char *args);
int lcd_shutdown ();
/////////////////////////////////////////////////////////////////
// Driver functions / info held here...
//
@@ -64,10 +61,8 @@ typedef struct lcd_physical_driver {
int (*init) (struct lcd_logical_driver * driver, char *device);
} lcd_physical_driver;
extern lcd_logical_driver lcd;
int lcd_drv_init (lcd_logical_driver * driver, char *args);
void lcd_drv_close ();
void lcd_drv_clear ();
-6
View File
@@ -17,7 +17,6 @@
#define __u32 unsigned int
#define __u8 unsigned char
#include "../../shared/debug.h"
#include "../../shared/str.h"
@@ -26,7 +25,6 @@
#include "lcd.h"
#include "lircin.h"
char *progname = "lircin";
int fd;
@@ -35,7 +33,6 @@ struct sockaddr_un addr;
static struct lirc_config *config;
//////////////////////////////////////////////////////////////////////////
////////////////////// Base "class" to derive from ///////////////////////
//////////////////////////////////////////////////////////////////////////
@@ -56,7 +53,6 @@ lircin_close ()
lirc_deinit ();
}
//////////////////////////////////////////////////////////////////////
// Tries to read a character from an input device...
//
@@ -84,7 +80,6 @@ lircin_getkey ()
return 0;
}
////////////////////////////////////////////////////////////
// init() should set up any device-specific stuff, and
// point all the function pointers.
@@ -101,7 +96,6 @@ lircin_init (struct lcd_logical_driver *driver, char *args)
/* open socket to lirc */
if (-1 == (fd = lirc_init ("lcdd", 1))) {
fprintf (stderr, "no infrared remote support available\n");
return -1;
-2
View File
@@ -1,12 +1,10 @@
#ifndef LCD_LIRCIN_H
#define LCD_LIRCIN_H
extern lcd_logical_driver *lircin;
int lircin_init (struct lcd_logical_driver *driver, char *args);
void lircin_close ();
char lircin_getkey ();
#endif
-22
View File
@@ -15,7 +15,6 @@
*/
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
@@ -33,8 +32,6 @@
#include "svgalib_drv.h"
#include "drv_base.h"
/* Small font */
const unsigned char simple_font5x7[] = {
@@ -168,14 +165,11 @@ const unsigned char simple_font5x7[] = {
/* ascii '126' (~) */ 31, 27, 23, 0, 23, 27, 31
};
// <start user definable!!!>
#define SVGALIB_FONT_VER 10 /* vertical spacing between lines (pixels) */
#define SVGALIB_Y_OFFSET 40 /* distance from the top of the screen (pixels) */
// <end user defineable!!!>
// No, I don't understand SVGALIB key mappings or a neat way of doing this
// Cursor keys manifest themselves as 3 byte excapes in svgalib: 27,91
// followed by one of the codes below.
@@ -193,7 +187,6 @@ void *SVGALIB_font; /* normal font */
void *SVGALIB_highfont; /* highlighted font (not used yet) */
void *SVGALIB_warnfont; /* warning font (not used yet) */
/*
Setting SVGALIB_figure_mappings will trap all keypresses and write the
vga_getkey() codes out to a file. You can then mod the getkey() function
@@ -208,10 +201,6 @@ int SVGALIB_figure_mappings = 0;
////////////////////// For Output on SVGALIB screen //////////////////////
//////////////////////////////////////////////////////////////////////////
void
ExpandGroovyFont (int w, int ht, unsigned char col, const unsigned char *fnt, unsigned char *ptr)
// Expand groovy 5x7 font into an area of memory
@@ -239,7 +228,6 @@ ExpandGroovyFont (int w, int ht, unsigned char col, const unsigned char *fnt, un
}
void
spaced_gl_writen (int x, int y, int count, char *text)
//
@@ -252,10 +240,8 @@ spaced_gl_writen (int x, int y, int count, char *text)
}
}
static char icon_char = '@';
int
svgalib_drv_init (struct lcd_logical_driver *driver, char *args)
{
@@ -291,7 +277,6 @@ svgalib_drv_init (struct lcd_logical_driver *driver, char *args)
gl_clearscreen (gl_rgbcolor (0, 0, 0));
// Override output functions...
driver->clear = svgalib_drv_clear;
driver->string = svgalib_drv_string;
@@ -337,7 +322,6 @@ svgalib_drv_clear ()
gl_clearscreen (gl_rgbcolor (0, 0, 0));
}
/////////////////////////////////////////////////////////////////
// Prints a string on the lcd display, at position (x,y). The
// upper-left is (1,1), and the lower right should be (20,4).
@@ -408,7 +392,6 @@ svgalib_drv_num (int x, int num)
svgalib_drv_chr (x + dx, y, c);
}
/////////////////////////////////////////////////////////////////
// Draws a vertical bar; erases entire column onscreen.
//
@@ -444,7 +427,6 @@ svgalib_drv_hbar (int x, int y, int len)
}
}
/////////////////////////////////////////////////////////////////
// Sets character 0 to an icon...
//
@@ -465,25 +447,21 @@ svgalib_drv_icon (int which, char dest)
}
}
void
svgalib_drv_flush ()
{
}
void
svgalib_drv_flush_box (int lft, int top, int rgt, int bot)
{
}
void
svgalib_drv_draw_frame (char *dat)
{
}
char
svgalib_drv_getkey ()
{
-2
View File
@@ -1,7 +1,6 @@
#ifndef LCD_SVGALIB_H
#define LCD_SVGALIB_H
extern lcd_logical_driver *vgalib_drv;
int svgalib_drv_init (struct lcd_logical_driver *driver, char *args);
@@ -20,5 +19,4 @@ char svgalib_drv_getkey ();
void svgalib_drv_init_num ();
void svgalib_drv_num (int x, int num);
#endif
-10
View File
@@ -10,7 +10,6 @@
#include "text.h"
#include "drv_base.h"
lcd_logical_driver *text;
//////////////////////////////////////////////////////////////////////////
@@ -27,7 +26,6 @@ text_init (lcd_logical_driver * driver, char *args)
return -1;
}
driver->wid = 20;
driver->hgt = 4;
driver->cellwid = 5;
@@ -55,7 +53,6 @@ text_init (lcd_logical_driver * driver, char *args)
driver->getkey = NULL;
return 200; // 200 is arbitrary. (must be 1 or more)
}
@@ -75,7 +72,6 @@ text_clear ()
}
//////////////////////////////////////////////////////////////////
// Flushes all output to the lcd...
//
@@ -85,7 +81,6 @@ text_flush ()
text_draw_frame (lcd.framebuf);
}
/////////////////////////////////////////////////////////////////
// Prints a string on the lcd display, at position (x,y). The
// upper-left is (1,1), and the lower right should be (20,4).
@@ -116,8 +111,6 @@ text_chr (int x, int y, char c)
lcd.framebuf[(y * lcd.wid) + x] = c;
}
int
text_contrast (int contrast)
{
@@ -199,7 +192,6 @@ text_hbar (int x, int y, int len)
}
void
text_flush_box (int lft, int top, int rgt, int bot)
{
@@ -207,7 +199,6 @@ text_flush_box (int lft, int top, int rgt, int bot)
}
void
text_draw_frame (char *dat)
{
@@ -226,7 +217,6 @@ text_draw_frame (char *dat)
out[lcd.wid] = 0;
printf ("+%s+\n", out);
for (i = 0; i < lcd.hgt; i++) {
for (j = 0; j < lcd.wid; j++) {
out[j] = dat[j + (i * lcd.wid)];
-1
View File
@@ -21,5 +21,4 @@ void text_set_char (int n, char *dat);
void text_flush_box (int lft, int top, int rgt, int bot);
void text_draw_frame (char *dat);
#endif
-11
View File
@@ -128,7 +128,6 @@ sli_init (lcd_logical_driver * driver, char *args)
out[1] = 0x001; /* Clear LCD, not sure if this belongs here */
write (fd, out, 2);
if (!driver->framebuf) {
fprintf (stderr, "sli_init: No frame buffer.\n");
driver->close ();
@@ -140,7 +139,6 @@ sli_init (lcd_logical_driver * driver, char *args)
driver->wid = 15;
driver->hgt = 2;
// Set the functions the driver supports...
driver->clear = (void *) -1;
@@ -168,7 +166,6 @@ sli_init (lcd_logical_driver * driver, char *args)
return fd;
}
/* Clean-up */
void
sli_close ()
@@ -181,14 +178,12 @@ sli_close ()
sli->framebuf = NULL;
}
void
sli_flush ()
{
sli_draw_frame (lcd.framebuf);
}
/* no bounds checking is done in MtxOrb.c (which I shamelessly ripped)
this is bad imho, so I added it.. may remove later
speed is not a huge issue though, this isnt a
@@ -218,7 +213,6 @@ sli_flush_box (int lft, int top, int rgt, int bot)
write (fd, lcd.framebuf + (y * lcd.wid) + lft, rgt - lft + 1);
}
}
/////////////////////////////////////////////////////////////////
@@ -234,7 +228,6 @@ sli_chr (int x, int y, char c)
lcd.framebuf[(y * lcd.wid) + x] = c;
}
/////////////////////////////////////////////////////////////////
// Sets up for vertical bars. Call before lcd.vbar()
//
@@ -405,7 +398,6 @@ sli_vbar (int x, int len)
{
char map[9] = { 32, 1, 2, 3, 4, 5, 6, 7, 255 };
int y;
for (y = lcd.hgt; y > 0 && len > 0; y--) {
if (len >= lcd.cellhgt)
@@ -438,7 +430,6 @@ sli_hbar (int x, int y, int len)
}
/////////////////////////////////////////////////////////////////
// Sets a custom character from 0-7...
//
@@ -480,7 +471,6 @@ sli_set_char (int n, char *dat)
write (fd, out, 2);
}
void
sli_icon (int which, char dest)
{
@@ -525,7 +515,6 @@ sli_icon (int which, char dest)
sli_set_char (dest, &icons[which][0]);
}
/////////////////////////////////////////////////////////////
// Blasts a single frame onscreen, to the lcd...
//
-3
View File
@@ -7,7 +7,6 @@
#ifndef SLI_H
#define SLI_H
extern lcd_logical_driver *sli;
int sli_init (lcd_logical_driver * driver, char *device);
@@ -28,6 +27,4 @@ void sli_icon (int which, char dest);
void sli_draw_frame (char *dat);
char sli_getkey ();
#endif
-3
View File
@@ -40,7 +40,6 @@
#include "input.h"
int server_input (int key);
// FIXME! The server tends to crash when "E" is pressed.. (?!)
@@ -90,8 +89,6 @@ handle_input ()
return 0;
}
int
server_input (int key)
{
-2
View File
@@ -1,9 +1,7 @@
#ifndef INPUT_H
#define INPUT_H
// Accepts and uses keypad input while displaying screens...
int handle_input ();
#endif
-19
View File
@@ -32,12 +32,10 @@
#include "input.h"
#include "main.h"
char *version = VERSION;
char *protocol_version = PROTOCOL_VERSION;
char *build_date = __DATE__;
/* no longer needed
static screen_size sizes[] =
{
@@ -63,11 +61,9 @@ static parameter args[] = {
{NULL, NULL},
};
void exit_program (int val);
void HelpScreen ();
int
main (int argc, char **argv)
{
@@ -81,8 +77,6 @@ main (int argc, char **argv)
char *str, *ing; // strings for commandline handling
// screen_size *size = &sizes[0]; // No longer needed
// Ctrl-C will cause a clean exit...
signal (SIGINT, exit_program);
// and "kill"...
@@ -92,8 +86,6 @@ main (int argc, char **argv)
// and just in case, "kill -KILL" (which cannot be trapped; but oh well)
signal (SIGKILL, exit_program);
// If no paramaters given, give the help screen.
if (argc == 1)
HelpScreen ();
@@ -116,12 +108,9 @@ main (int argc, char **argv)
}
#endif
// Set up lcd driver base system
lcd_init ("");
// Parse the command line now...
// TODO: Move this to a separate function?
for (i = 1; i < argc; i++) {
@@ -221,8 +210,6 @@ main (int argc, char **argv)
}
}
// Now init a bunch of required stuff...
if (sock_create_server () <= 0) {
@@ -247,9 +234,6 @@ main (int argc, char **argv)
server_screen->priority = 256;
}
// Main loop...
while (1) {
sock_poll_clients ();
@@ -280,14 +264,12 @@ main (int argc, char **argv)
usleep (TIME_UNIT);
}
// Quit!
exit_program (0);
return 0;
}
void
exit_program (int val)
{
@@ -310,7 +292,6 @@ exit_program (int val)
}
void
HelpScreen ()
{
-1
View File
@@ -30,5 +30,4 @@ typedef struct parameter {
char *sh, *lg; // short and long versions
} parameter;
#endif
-16
View File
@@ -57,22 +57,17 @@ draw_heartbeat ()
static int PAD = 255;
typedef struct menu_info {
int selected;
int length;
} menu_info;
static int draw_menu (Menu menu, menu_info * info);
static int fill_menu_info (Menu menu, menu_info * info);
static int menu_handle_action (menu_item * item);
static int slid_func (menu_item * item);
int
do_menu (Menu menu)
{
@@ -84,13 +79,11 @@ do_menu (Menu menu)
int (*func) ();
int (*readfunc) (int);
if (!menu)
return MENU_ERROR;
fill_menu_info (menu, &info);
while (!done) {
// Keep the cursor off titles... (?)
while (menu[info.selected].type == TYPE_TITL) {
@@ -100,7 +93,6 @@ do_menu (Menu menu)
info.selected -= 2;
}
draw_menu (menu, &info);
// FIXME: This should use a better keypress interface, which
@@ -114,7 +106,6 @@ do_menu (Menu menu)
// Check for client input...
}
// Handle the key according to the keybindings...
switch (key) {
case 'D':
@@ -198,13 +189,11 @@ draw_menu (Menu menu, menu_info * info)
// these should maybe be removed:
int wid = lcd.wid, hgt = lcd.hgt;
if (!menu)
return MENU_ERROR;
lcd.clear ();
// Scroll down until the selected item is centered, if possible...
top = info->selected - (hgt / 2);
if (top < 0)
@@ -216,8 +205,6 @@ draw_menu (Menu menu, menu_info * info)
if (top < 0)
top = 0;
// Draw all visible items...
for (i = top; i < bottom; i++, y++) {
if (i == info->selected)
@@ -263,14 +250,12 @@ draw_menu (Menu menu, menu_info * info)
if (bottom < info->length)
lcd.chr (1, hgt, 'v');
draw_heartbeat ();
//lcd.flush();
return 0;
}
static int
fill_menu_info (Menu menu, menu_info * info)
{
@@ -293,7 +278,6 @@ menu_handle_action (menu_item * item)
return MENU_OK;
}
static int
slid_func (menu_item * item)
{
-7
View File
@@ -1,7 +1,6 @@
#ifndef MENU_H
#define MENU_H
#if 0
/*************************************************************************
Menus!
@@ -48,7 +47,6 @@ menu_item OptionsMenu[] = {
0, 0, 0,
};
///////////////// Elsewhere, we declare these...
void Shutdown_func()
@@ -96,7 +94,6 @@ and sliders should return 0-255.
**************************************************************************/
#endif
// Return codes from selected menu items...
#define MENU_ERROR -0x7FFF0000
#define MENU_OK 0
@@ -125,18 +122,14 @@ and sliders should return 0-255.
#define MENU_MINUS 4
#define MENU_READ 5
typedef struct menu_item {
char *text;
int type;
void *data;
} menu_item;
#define Menu menu_item *
int do_menu (Menu menu);
#endif
-7
View File
@@ -10,7 +10,6 @@
*/
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
@@ -24,7 +23,6 @@
#include "render.h"
#include "serverscreens.h"
int Shutdown_func ();
int System_halt_func ();
int Reboot_func ();
@@ -41,7 +39,6 @@ int Backlight_Off_func ();
int Backlight_On_func ();
int Backlight_Open_func ();
menu_item main_menu[] = {
{"LCDproc", 0, 0}, // Title
{"Options", TYPE_MENU, (void *) options_menu},
@@ -92,8 +89,6 @@ menu_item Backlight_menu[] = {
{0, 0, 0},
};
///////////////////////////////////////////////////////////////////////
// Plug-in functions for menu items
//
@@ -167,7 +162,6 @@ OK_func ()
return MENU_OK;
}
int
Time24_func (int input)
{
@@ -295,7 +289,6 @@ Contrast_func (int input)
return (status | MENU_OK);
}
void
server_menu ()
{
-3
View File
@@ -9,7 +9,6 @@
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@@ -21,8 +20,6 @@
#include "client_functions.h"
#include "parse.h"
int
parse_all_client_messages ()
{
-13
View File
@@ -9,12 +9,10 @@
This will probably take a while to do. :(
THIS FILE IS MESSY! Anyone care to rewrite it nicely? Please?? :)
*/
#include <string.h>
#include <stdio.h>
@@ -28,8 +26,6 @@
#include "widget.h"
#include "render.h"
int heartbeat = HEART_OPEN;
int backlight = BACKLIGHT_OPEN;
int backlight_state = BACKLIGHT_OPEN;
@@ -43,7 +39,6 @@ static int reset;
static int draw_frame (LL * list, char fscroll, int left, int top, int right, int bottom, int fwid, int fhgt, int fspeed, int timer);
int
draw_screen (screen * s, int timer)
{
@@ -64,11 +59,8 @@ draw_screen (screen * s, int timer)
reset = 0;
old_s = s;
lcd.clear ();
switch (backlight_state) {
case BACKLIGHT_OFF:
lcd.backlight (backlight_off_brightness);
@@ -101,10 +93,8 @@ draw_screen (screen * s, int timer)
draw_frame (s->widgets, 'v', 0, 0, lcd.wid, lcd.hgt, s->wid, s->hgt, s->duration / s->hgt, timer);
//debug("draw_screen done\n");
if (heartbeat) {
if ((s->heartbeat == 1) || heartbeat == HEART_ON) {
// Set this to pulsate like a real heart beat...
@@ -176,8 +166,6 @@ draw_frame (LL * list, char fscroll, int left, int top, int right, int bottom, i
//debug("draw_frame: %8x, %i\n", frame, timer);
LL_Rewind (list);
do {
w = (widget *) LL_Get (list);
@@ -447,6 +435,5 @@ draw_frame (LL * list, char fscroll, int left, int top, int right, int bottom, i
}
} while (LL_Next (list) == 0);
return 0;
}
-2
View File
@@ -3,7 +3,6 @@
#include "screen.h"
#define HEART_OFF 0
#define HEART_ON 1
#define HEART_OPEN 2
@@ -25,5 +24,4 @@ extern int backlight_off_brightness;
extern int output_state;
int draw_screen (screen * s, int timer);
#endif
-5
View File
@@ -12,7 +12,6 @@
#include "screenlist.h"
#include "screen.h"
screen *
screen_create ()
{
@@ -60,7 +59,6 @@ screen_destroy (screen * s)
} while (LL_Next (s->widgets) == 0);
LL_Destroy (s->widgets);
if (s->id)
free (s->id);
if (s->name)
@@ -71,7 +69,6 @@ screen_destroy (screen * s)
return 0;
}
screen *
screen_find (client * c, char *id)
{
@@ -96,7 +93,6 @@ screen_find (client * c, char *id)
return NULL;
}
int
screen_add (client * c, char *id)
{
@@ -129,7 +125,6 @@ screen_add (client * c, char *id)
// TODO: Check for errors here?
LL_Push (c->data->screenlist, (void *) s);
// Now, add it to the screenlist...
if (screenlist_add (s) < 0) {
fprintf (stderr, "screen_add: Error queueing new screen\n");
-2
View File
@@ -15,7 +15,6 @@ typedef struct screen {
client *parent;
} screen;
screen *screen_create ();
int screen_destroy (screen * s);
@@ -24,5 +23,4 @@ screen *screen_find (client * c, char *id);
int screen_add (client * c, char *id);
int screen_remove (client * c, char *id);
#endif
-12
View File
@@ -8,15 +8,12 @@
#include "screen.h"
#include "clients.h"
int screenlist_action = 0;
int timer = 0;
LL *screenlist;
int screenlist_add_end (screen * screen);
screen *screenlist_next_roll ();
screen *screenlist_prev_roll ();
@@ -25,7 +22,6 @@ screen *screenlist_next_priority ();
int compare_priority (void *one, void *two);
int compare_addresses (void *one, void *two);
int
screenlist_init ()
{
@@ -95,11 +91,9 @@ screenlist_current ()
static screen *old_s = NULL;
client *c;
//debug("screenlist_current:\n");
//LL_dprint(screenlist);
s = (screen *) LL_GetFirst (screenlist);
// FIXME: Make sure the screen/client exists!
@@ -139,8 +133,6 @@ screenlist_current ()
}
}
old_s = s;
//debug("screenlist_current: return %8x\n", s);
@@ -173,7 +165,6 @@ screenlist_next ()
// Otherwise, reset it to regular operation
screenlist_action = 0;
//debug("Screenlist_next: calling handler...\n");
// Call the selected queuing function...
@@ -202,7 +193,6 @@ screenlist_prev ()
// Otherwise, reset it no regular operation
screenlist_action = 0;
// Call the selected queuing function...
// TODO: Different queueing modes...
s = screenlist_prev_roll ();
@@ -210,7 +200,6 @@ screenlist_prev ()
return s;
}
// Adds new screens to the end of the screenlist...
int
screenlist_add_end (screen * screen)
@@ -259,7 +248,6 @@ screenlist_prev_roll ()
return screenlist_current ();
}
int
compare_priority (void *one, void *two)
{
-2
View File
@@ -3,7 +3,6 @@
#include "screen.h"
#define SCR_HOLD 1
#define SCR_SKIP 2
#define SCR_BACK 3
@@ -27,5 +26,4 @@ screen *screenlist_prev ();
int screenlist_remove (screen * s);
int screenlist_remove_all (screen * s);
#endif
-6
View File
@@ -51,7 +51,6 @@ server_screen_init ()
widget_add (server_screen, "two", "string", NULL, 1);
widget_add (server_screen, "three", "string", NULL, 1);
// Now, initialize all the widgets...
w = widget_find (server_screen, "title");
if (w) {
@@ -87,8 +86,6 @@ server_screen_init ()
fprintf (stderr, "server_screen_init: Can't find widget three\n");
}
// And enqueue the screen
screenlist_add (server_screen);
@@ -97,7 +94,6 @@ server_screen_init ()
return 0;
}
int
update_server_screen (int timer)
{
@@ -106,11 +102,9 @@ update_server_screen (int timer)
screen *s;
int num_screens;
// Draw a title...
//strcpy(title, "LCDproc Server");
// Now get info on the number of connected clients...
num_clients = 0;
num_screens = 0;
-1
View File
@@ -3,7 +3,6 @@
#include "screen.h"
extern screen *server_screen;
int server_screen_init ();
-8
View File
@@ -18,7 +18,6 @@
#include "clients.h"
#include "../shared/debug.h"
/**************************************************
LCDproc sockets code...
@@ -31,10 +30,8 @@ int orig_sock;
// Length of longest transmission allowed at once...
#define MAXMSG 8192
int read_from_client (int filedes);
// Creates a socket in internet space
int
sock_create_inet_socket (unsigned short int port)
@@ -81,7 +78,6 @@ sock_create_server ()
return -1;
}
if (listen (sock, 1) < 0) {
perror ("sock_create_server: Listen error");
return -1;
@@ -111,7 +107,6 @@ sock_create_server ()
return sock;
}
int
sock_poll_clients ()
{
@@ -152,7 +147,6 @@ sock_poll_clients ()
fcntl (new, F_SETFL, O_NONBLOCK);
// TODO: Create new "client" here... (done?)
if (client_create (new) == NULL) {
fprintf (stderr, "sock_poll_clients: error creating client %i\n", i);
@@ -185,7 +179,6 @@ sock_poll_clients ()
return 0;
}
int
read_from_client (int filedes)
{
@@ -199,7 +192,6 @@ read_from_client (int filedes)
//debug("read_from_client(%i): ...done\n", filedes);
debug ("read_from_client(%i): %i bytes\n", filedes, nbytes);
if (nbytes < 0) // Read error? No data available?
{
// TODO: check errno here!
-3
View File
@@ -1,13 +1,10 @@
#ifndef SOCKETS_H
#define SOCKETS_H
#include "../shared/sockets.h"
typedef struct sockaddr_in sockaddr_in;
// Server functions...
int sock_create_server ();
int sock_create_inet_socket (unsigned short int port);
-12
View File
@@ -8,7 +8,6 @@
#include "screen.h"
#include "widget.h"
char *types[] = { "none",
"string",
"hbar",
@@ -22,11 +21,9 @@ char *types[] = { "none",
NULL,
};
static widget *widget_finder (LL * list, char *id);
static int widget_remover (LL * list, widget * w);
widget *
widget_create ()
{
@@ -179,7 +176,6 @@ widget_add (screen * s, char *id, char *type, char *in, int sock)
debug ("widget_add(%s, %s, %s)\n", id, type, in);
if (!s)
return -1;
if (!id)
@@ -187,7 +183,6 @@ widget_add (screen * s, char *id, char *type, char *in, int sock)
list = s->widgets;
if (0 == strcmp (id, "heartbeat")) {
s->heartbeat = 1;
return 0;
@@ -231,10 +226,8 @@ widget_add (screen * s, char *id, char *type, char *in, int sock)
return 2;
}
debug ("widget_add: making widget\n");
// Now, make it...
w = widget_create ();
if (!w) {
@@ -260,11 +253,9 @@ widget_add (screen * s, char *id, char *type, char *in, int sock)
}
}
}
// TODO: Check for errors here?
LL_Push (list, (void *) w);
return 0;
}
@@ -283,7 +274,6 @@ widget_remove (screen * s, char *id, int sock)
list = s->widgets;
if (0 == strcmp (id, "heartbeat")) {
s->heartbeat = 0;
return 0;
@@ -311,7 +301,6 @@ widget_remove (screen * s, char *id, int sock)
// return 0;
}
int
widget_remover (LL * list, widget * w)
{
@@ -325,7 +314,6 @@ widget_remover (LL * list, widget * w)
if (!w)
return 0;
// Search through the list...
LL_Rewind (list);
do {
-2
View File
@@ -31,7 +31,6 @@ typedef struct widget {
extern char *types[];
widget *widget_create ();
int widget_destroy (widget * w);
@@ -40,5 +39,4 @@ widget *widget_find (screen * s, char *id);
int widget_add (screen * s, char *id, char *type, char *in, int sock);
int widget_remove (screen * s, char *id, int sock);
#endif
-15
View File
@@ -112,7 +112,6 @@ LL_node_DestroyData (LL_node * node)
return 0;
}
//////////////////////////////////////////////////////////////////////
// Returns to the beginning of the list...
int
@@ -186,7 +185,6 @@ LL_Prev (LL * list)
}
}
//////////////////////////////////////////////////////////////////////
// Data manipulation
void *
@@ -214,7 +212,6 @@ LL_Put (LL * list, void *data)
return 0;
}
//////////////////////////////////////////////////////////////////////
LL_node *
LL_GetNode (LL * list)
@@ -240,7 +237,6 @@ LL_PutNode (LL * list, LL_node * node)
return 0;
}
//////////////////////////////////////////////////////////////////////
void *
LL_GetFirst (LL * list) // gets data from first node
@@ -308,7 +304,6 @@ LL_AddNode (LL * list, void *add) // Adds node AFTER current one
//LL_dprint(list);
node = malloc (sizeof (LL_node));
if (!node)
return -1;
@@ -408,7 +403,6 @@ LL_DeleteNode (LL * list)
LL_dprint (list);
#endif
next = list->current->next;
prev = list->current->prev;
data = list->current->data;
@@ -457,7 +451,6 @@ LL_Remove (LL * list, void *data)
return NULL;
}
//////////////////////////////////////////////////////////////////////
// Stack operations
int
@@ -613,8 +606,6 @@ LL_UnRoll (LL * list) // Roll the other way...
return 0;
}
//////////////////////////////////////////////////////////////////////
// Add an item to the end of its "priority group"
// The list is assumed to be sorted already...
@@ -652,8 +643,6 @@ LL_PriorityEnqueue (LL * list, void *add, int compare (void *, void *))
return 0;
}
//////////////////////////////////////////////////////////////////////
int
LL_SwapNodes (LL_node * one, LL_node * two) // Switch two nodes positions...
@@ -694,7 +683,6 @@ LL_SwapNodes (LL_node * one, LL_node * two) // Switch two nodes positions...
if (secondnext == one)
two->prev = one;
return 0;
}
@@ -755,7 +743,6 @@ LL_Find (LL * list, int compare (void *, void *), void *value)
return NULL;
}
//////////////////////////////////////////////////////////////////////
// Sorts the list, then rewinds it...
//
@@ -767,7 +754,6 @@ LL_Sort (LL * list, int compare (void *, void *))
LL_node *best, *last; // best match and last node in the list
LL_node *current;
if (!list)
return -1;
if (!compare)
@@ -781,7 +767,6 @@ LL_Sort (LL * list, int compare (void *, void *))
if (numnodes < 2)
return 0;
for (i = numnodes - 1; i > 0; i--) {
LL_Rewind (list); // get the first node again
best = last; // reset our "best" node
-7
View File
@@ -1,8 +1,6 @@
#ifndef LL_H
#define LL_H
/***********************************************************************
Linked Lists! (Doubly-Linked Lists)
*******************************************************************
@@ -115,7 +113,6 @@
That's about it, for now... Be sure to free the list when you're done!
***********************************************************************/
// See LL.c for more detailed descriptions of these functions.
typedef struct LL_node {
@@ -128,8 +125,6 @@ typedef struct LL {
LL_node *current;
} LL;
// Creates a new list...
LL *LL_new ();
// Destroying lists...
@@ -188,7 +183,6 @@ int LL_UnRoll (LL * list); // Roll the other way...
int LL_PriorityEnqueue (LL * list, void *add, int compare (void *, void *));
int LL_SwapNodes (LL_node * one, LL_node * two); // Switch two nodes positions...
int LL_nSwapNodes (int one, int two); // Switch two nodes positions...
@@ -200,7 +194,6 @@ void *LL_Find (LL * list, int compare (void *, void *), void *value);
// Sorts the list...
int LL_Sort (LL * list, int compare (void *, void *));
// Debugging...
void LL_dprint (LL * list);
-6
View File
@@ -16,21 +16,17 @@
#include "debug.h"
#include "sockets.h"
/**************************************************
LCDproc client sockets code...
Feel free to use this in your own clients... :)
**************************************************/
// Length of longest transmission allowed at once...
#define MAXMSG 8192
typedef struct sockaddr_in sockaddr_in;
static int
sock_init_sockaddr (sockaddr_in * name, const char *hostname, unsigned short int port)
{
@@ -57,7 +53,6 @@ sock_connect (char *host, unsigned short int port)
int sock;
int err = 0;
debug ("sock_connect: Creating socket\n");
sock = socket (PF_INET, SOCK_STREAM, 0);
if (sock < 0) {
@@ -77,7 +72,6 @@ sock_connect (char *host, unsigned short int port)
fcntl (sock, F_SETFL, O_NONBLOCK);
return sock;
}
-6
View File
@@ -11,8 +11,6 @@
#define LCDPORT 13666
#endif
/*
Socket functions available to server and clients...
(ignore the rest of the comments... I was babbling out random ideas)
@@ -20,7 +18,6 @@
This should have stuff to read/write sockets, open/close them, etc...
*/
// Client functions...
int sock_connect (char *host, unsigned short int port);
int sock_close (int fd);
@@ -32,7 +29,6 @@ int sock_recv_string (int fd, char *dest, size_t maxlen);
int sock_send (int fd, void *src, size_t size);
int sock_recv (int fd, void *dest, size_t maxlen);
// Er, ignore the rest of this file. I'll clean it up sometime...
/*****************************************************************
@@ -84,8 +80,6 @@ int sock_recv (int fd, void *dest, size_t maxlen);
Key D Next/+
Key E OtherSequence
******************************************************************/
#endif