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