-/* $Id: drv_Crystalfontz.c,v 1.20 2004/05/31 05:38:02 reinelt Exp $
+/* $Id: drv_Crystalfontz.c,v 1.21 2004/06/01 06:45:28 reinelt Exp $
*
* new style driver for Crystalfontz display modules
*
*
*
* $Log: drv_Crystalfontz.c,v $
+ * Revision 1.21 2004/06/01 06:45:28 reinelt
+ *
+ * some Fixme's processed
+ * documented some code
+ *
* Revision 1.20 2004/05/31 05:38:02 reinelt
*
* fixed possible bugs with user-defined chars (clear high bits)
static double Temperature[32] = {0.0,};
-// Fixme:
+// Fixme: GPO's not yet implemented
// static int GPO[8];
static int GPOS;
}
}
-// Fixme: other plugins for Fans, Temmperature sensors, ...
+// Fixme: other plugins for Fans, Temperature sensors, ...
break;
case 2:
CHAR0 = 0; // ASCII of first user-defineable char
- GOTO_COST = 20; // there is no goto on 633
+ GOTO_COST = 999; // there is no goto on 633
drv_generic_text_real_write = drv_CF_write2;
drv_generic_text_real_defchar = drv_CF_defchar23;
break;
case 3:
CHAR0 = 0; // ASCII of first user-defineable char
- // Fixme:
GOTO_COST = 3; // number of bytes a goto command requires
drv_generic_text_real_write = drv_CF_write3;
drv_generic_text_real_defchar = drv_CF_defchar23;
-/* $Id: drv_Cwlinux.c,v 1.10 2004/05/31 21:05:13 reinelt Exp $
+/* $Id: drv_Cwlinux.c,v 1.11 2004/06/01 06:45:29 reinelt Exp $
*
* new style driver for Cwlinux display modules
*
*
*
* $Log: drv_Cwlinux.c,v $
+ * Revision 1.11 2004/06/01 06:45:29 reinelt
+ *
+ * some Fixme's processed
+ * documented some code
+ *
* Revision 1.10 2004/05/31 21:05:13 reinelt
*
* fixed lots of bugs in the Cwlinux driver
static int Model;
static int Protocol;
-// Fixme:
+// Fixme: GPO's not yet implemented
// static int GPO[8];
static int GPOS;
-/* $Id: drv_HD44780.c,v 1.23 2004/05/31 05:38:02 reinelt Exp $
+/* $Id: drv_HD44780.c,v 1.24 2004/06/01 06:45:29 reinelt Exp $
*
* new style driver for HD44780-based displays
*
*
*
* $Log: drv_HD44780.c,v $
+ * Revision 1.24 2004/06/01 06:45:29 reinelt
+ *
+ * some Fixme's processed
+ * documented some code
+ *
* Revision 1.23 2004/05/31 05:38:02 reinelt
*
* fixed possible bugs with user-defined chars (clear high bits)
static int UseBusy = 0;
-// Fixme
+// Fixme: GPO's not yet implemented
static int GPOS;
// static int GPO=0;
}
-// Fixme
+// Fixme: GPO's
#if 0
static void drv_HD_setGPO (int bits)
{
-/* $Id: drv_M50530.c,v 1.6 2004/05/31 05:38:02 reinelt Exp $
+/* $Id: drv_M50530.c,v 1.7 2004/06/01 06:45:29 reinelt Exp $
*
* new style driver for M50530-based displays
*
*
*
* $Log: drv_M50530.c,v $
+ * Revision 1.7 2004/06/01 06:45:29 reinelt
+ *
+ * some Fixme's processed
+ * documented some code
+ *
* Revision 1.6 2004/05/31 05:38:02 reinelt
*
* fixed possible bugs with user-defined chars (clear high bits)
static unsigned char SIGNAL_IOC2;
static unsigned char SIGNAL_GPO;
-// Fixme
+// Fixme: GPO's not yet implemented
static int GPOS;
// static int GPO=0;
}
-// Fixme
+// Fixme: GPO's
#if 0
static void drv_M5_setGPO (int bits)
{
-/* $Id: drv_MatrixOrbital.c,v 1.27 2004/05/31 21:23:16 reinelt Exp $
+/* $Id: drv_MatrixOrbital.c,v 1.28 2004/06/01 06:45:29 reinelt Exp $
*
* new style driver for Matrix Orbital serial display modules
*
*
*
* $Log: drv_MatrixOrbital.c,v $
+ * Revision 1.28 2004/06/01 06:45:29 reinelt
+ *
+ * some Fixme's processed
+ * documented some code
+ *
* Revision 1.27 2004/05/31 21:23:16 reinelt
*
* some cleanups in the MatrixOrbital driver
static int Model;
static int Protocol;
-// Fixme:
+// Fixme: GPO's not yet implemented
// static int GPO[8];
static int GPOS;
debug ("rpm: buffer[5]=0x%01x", buffer[5]);
debug ("rpm: buffer[6]=0x%01x", buffer[6]);
- // Fixme:
+ // Fixme: RPM calculations???
RPM[num-1] = 42;
return RPM[num-1];
-/* $Id: drv_T6963.c,v 1.4 2004/02/24 05:55:04 reinelt Exp $
+/* $Id: drv_T6963.c,v 1.5 2004/06/01 06:45:30 reinelt Exp $
*
* new style driver for T6963-based displays
*
*
*
* $Log: drv_T6963.c,v $
+ * Revision 1.5 2004/06/01 06:45:30 reinelt
+ *
+ * some Fixme's processed
+ * documented some code
+ *
* Revision 1.4 2004/02/24 05:55:04 reinelt
*
* X11 driver ported
unsigned char *Buffer1, *Buffer2;
-// Fixme:
static int bug=0;
*
*
* $Log: drv_generic_graphic.c,v $
+ * Revision 1.7 2004/06/01 06:45:30 reinelt
+ *
+ * some Fixme's processed
+ * documented some code
+ *
* Revision 1.6 2004/03/03 03:47:04 reinelt
* big patch from Martin Hejl:
* - use qprintf() where appropriate
/*
*
- * exported fuctions:
+ * exported functions:
+ *
+ * int drv_generic_graphic_init (char *section, char *driver);
+ * initializes the generic graphic driver
+ *
+ * int drv_generic_graphic_draw (WIDGET *W);
+ * renders Text widget into framebuffer
+ * calls drv_generic_graphic_real_blit()
*
- * Fixme: document me!
+ * int drv_generic_graphic_icon_draw (WIDGET *W);
+ * renders Icon widget into framebuffer
+ * calls drv_generic_graphic_real_blit()
+ *
+ * int drv_generic_graphic_bar_draw (WIDGET *W);
+ * renders Bar widget into framebuffer
+ * calls drv_generic_graphic_real_blit()
+ *
+ * int drv_generic_graphic_quit (void);
+ * closes generic graphic driver
*
*/
+
#include "config.h"
#include <stdlib.h>
-/* $Id: drv_generic_graphic.h,v 1.2 2004/02/18 06:39:20 reinelt Exp $
+/* $Id: drv_generic_graphic.h,v 1.3 2004/06/01 06:45:30 reinelt Exp $
*
* generic driver helper for graphic displays
*
*
*
* $Log: drv_generic_graphic.h,v $
+ * Revision 1.3 2004/06/01 06:45:30 reinelt
+ *
+ * some Fixme's processed
+ * documented some code
+ *
* Revision 1.2 2004/02/18 06:39:20 reinelt
* T6963 driver for graphic displays finished
*
*
*/
-/*
- *
- * exported fuctions:
- *
- * Fixme: document me!
- *
- */
#ifndef _DRV_GENERIC_GRAPHIC_H_
#define _DRV_GENERIC_GRAPHIC_H_
-/* $Id: drv_generic_serial.c,v 1.10 2004/05/31 21:05:13 reinelt Exp $
+/* $Id: drv_generic_serial.c,v 1.11 2004/06/01 06:45:30 reinelt Exp $
*
* generic driver helper for serial and usbserial displays
*
*
*
* $Log: drv_generic_serial.c,v $
+ * Revision 1.11 2004/06/01 06:45:30 reinelt
+ *
+ * some Fixme's processed
+ * documented some code
+ *
* Revision 1.10 2004/05/31 21:05:13 reinelt
*
* fixed lots of bugs in the Cwlinux driver
*
* exported fuctions:
*
- * int drv_generic_serial_open (char *driver, char *port, speed_t speed);
+ * int drv_generic_serial_open (char *section, char *driver, unsigned int flags)
* opens the serial port
*
* int drv_generic_serial_poll (unsigned char *string, int len)
* reads from the serial or USB port
* without retry
*
- * int drv_generic_serial_read (unsigned char *string, int len);
+ * int drv_generic_serial_read (unsigned char *string, int len);
* reads from the serial or USB port
* with retry
*
- * void drv_generic_serial_write (unsigned char *string, int len);
+ * void drv_generic_serial_write (unsigned char *string, int len);
* writes to the serial or USB port
*
- * int drv_generic_serial_close (void);
+ * int drv_generic_serial_close (void);
* closes the serial port
*
*/
// *** generic serial/USB communication ***
// ****************************************
-pid_t drv_generic_serial_lock_port (char *Port)
+static pid_t drv_generic_serial_lock_port (char *Port)
{
char lockfile[256];
char tempfile[256];
-/* $Id: drv_generic_serial.h,v 1.4 2004/05/28 13:51:42 reinelt Exp $
+/* $Id: drv_generic_serial.h,v 1.5 2004/06/01 06:45:30 reinelt Exp $
*
* generic driver helper for serial and usbserial displays
*
*
*
* $Log: drv_generic_serial.h,v $
+ * Revision 1.5 2004/06/01 06:45:30 reinelt
+ *
+ * some Fixme's processed
+ * documented some code
+ *
* Revision 1.4 2004/05/28 13:51:42 reinelt
*
* ported driver for Beckmann+Egle Mini-Terminals
*
*/
-/*
- *
- * exported fuctions:
- *
- * Fixme: document me!
- *
- */
#ifndef _DRV_GENERIC_SERIALH_
#define _DRV_GENERIC_SERIAL_H_
-/* $Id: drv_generic_text.c,v 1.14 2004/05/26 11:37:36 reinelt Exp $
+/* $Id: drv_generic_text.c,v 1.15 2004/06/01 06:45:30 reinelt Exp $
*
* generic driver helper for text-based displays
*
*
*
* $Log: drv_generic_text.c,v $
+ * Revision 1.15 2004/06/01 06:45:30 reinelt
+ *
+ * some Fixme's processed
+ * documented some code
+ *
* Revision 1.14 2004/05/26 11:37:36 reinelt
*
* Curses driver ported.
*/
/*
+ *
+ * exported variables:
+ *
+ * extern int DROWS, DCOLS; // display size
+ * extern int LROWS, LCOLS; // layout size
+ * extern int XRES, YRES; // pixel width/height of one char
+ * extern int GOTO_COST; // number of bytes a goto command requires
+ * extern int CHARS, CHAR0; // number of user-defineable characters, ASCII of first char
+ * extern int ICONS; // number of user-defineable characters reserved for icons
+ *
+ *
+ * these functions must be implemented by the real driver:
+ *
+ * void (*drv_generic_text_real_write)(int row, int col, unsigned char *data, int len);
+ * writes a text of specified length at position (row, col)
+ *
+ * void (*drv_generic_text_real_defchar)(int ascii, unsigned char *buffer);
+ * defines the bitmap of a user-defined character
+ *
*
* exported fuctions:
*
- * Fixme: document me!
+ * int drv_generic_text_init (char *section, char *driver);
+ * initializes the generic text driver
+ *
+ * int drv_generic_text_draw (WIDGET *W);
+ * renders Text widget into framebuffer
+ * calls drv_generic_text_real_write()
+ *
+ * int drv_generic_text_icon_init (void);
+ * initializes the generic icon driver
+ *
+ * int drv_generic_text_icon_draw (WIDGET *W);
+ * renders Icon widget into framebuffer
+ * calls drv_generic_text_real_write() and drv_generic_text_real_defchar()
+ *
+ * int drv_generic_text_bar_init (int single_segments);
+ * initializes the generic icon driver
+ *
+ * void drv_generic_text_bar_add_segment (int val1, int val2, DIRECTION dir, int ascii);
+ * adds a 'fixed' character to the bar-renderer
+ *
+ * int drv_generic_text_bar_draw (WIDGET *W);
+ * renders Bar widget into framebuffer
+ * calls drv_generic_text_real_write() and drv_generic_text_real_defchar()
+ *
+ * int drv_generic_text_quit (void);
+ * closes the generic text driver
*
*/
-/* $Id: drv_generic_text.h,v 1.9 2004/05/26 11:37:36 reinelt Exp $
+/* $Id: drv_generic_text.h,v 1.10 2004/06/01 06:45:30 reinelt Exp $
*
* generic driver helper for text-based displays
*
*
*
* $Log: drv_generic_text.h,v $
+ * Revision 1.10 2004/06/01 06:45:30 reinelt
+ *
+ * some Fixme's processed
+ * documented some code
+ *
* Revision 1.9 2004/05/26 11:37:36 reinelt
*
* Curses driver ported.
*
*/
-/*
- *
- * exported fuctions:
- *
- * Fixme: document me!
- *
- */
#ifndef _DRV_GENERIC_TEXT_H_
#define _DRV_GENERIC_TEXT_H_
-/* $Id: hash.c,v 1.18 2004/05/31 16:39:06 reinelt Exp $
+/* $Id: hash.c,v 1.19 2004/06/01 06:45:30 reinelt Exp $
*
* hashes (associative arrays)
*
*
*
* $Log: hash.c,v $
+ * Revision 1.19 2004/06/01 06:45:30 reinelt
+ *
+ * some Fixme's processed
+ * documented some code
+ *
* Revision 1.18 2004/05/31 16:39:06 reinelt
*
* added NULL display driver (for debugging/profiling purposes)
/*
* exported functions:
*
- * hash_anything
- * Fixme: document me!
+ * void hash_set (HASH *Hash, char *key, char *val);
+ * set an entry in the hash
+ *
+ * void hash_set_delta (HASH *Hash, char *key, char *val);
+ * set a delta entry in the hash
+ *
+ * int hash_age (HASH *Hash, char *key, char **value);
+ * return time of last hash_set
+ *
+ * char *hash_get (HASH *Hash, char *key);
+ * fetch an entry from the hash
+ *
+ * double hash_get_delta (HASH *Hash, char *key, int delay);
+ * fetch a delta antry from the hash
+ *
+ * double hash_get_regex (HASH *Hash, char *key, int delay);
+ * fetch one or more entries from the hash
+ *
+ * void hash_destroy (HASH *Hash);
+ * releases hash
*
*/
-/* $Id: hash.h,v 1.11 2004/03/11 06:39:59 reinelt Exp $
+/* $Id: hash.h,v 1.12 2004/06/01 06:45:30 reinelt Exp $
*
* hashes (associative arrays)
*
*
*
* $Log: hash.h,v $
+ * Revision 1.12 2004/06/01 06:45:30 reinelt
+ *
+ * some Fixme's processed
+ * documented some code
+ *
* Revision 1.11 2004/03/11 06:39:59 reinelt
* big patch from Martin:
* - reuse filehandles
double hash_get_delta (HASH *Hash, char *key, int delay);
double hash_get_regex (HASH *Hash, char *key, int delay);
void hash_destroy (HASH *Hash);
+
#endif
-/* $Id: plugin_i2c_sensors.c,v 1.15 2004/05/31 21:05:13 reinelt Exp $
+/* $Id: plugin_i2c_sensors.c,v 1.16 2004/06/01 06:45:30 reinelt Exp $
*
* I2C sensors plugin
*
*
*
* $Log: plugin_i2c_sensors.c,v $
+ * Revision 1.16 2004/06/01 06:45:30 reinelt
+ *
+ * some Fixme's processed
+ * documented some code
+ *
* Revision 1.15 2004/05/31 21:05:13 reinelt
*
* fixed lots of bugs in the Cwlinux driver
#include "plugin.h"
#include "cfg.h"
#include "hash.h"
+#include "qprintf.h"
#ifdef WITH_DMALLOC
#include <dmalloc.h>
static int parse_i2c_sensors_sysfs(char *key)
{
- double value;
char val[32];
char buffer[32];
char file[64];
!strncmp(key, "curr", 4) ||
!strncmp(key, "in", 2) ||
!strncmp(key, "vid", 3)) {
- value = strtod(buffer, NULL);
- // FIXME: any way to do this without converting to double ?
- value /= 1000.0;
- sprintf(val, "%f", value);
-
+ qprintf(val, sizeof(val), "%f", strtod(buffer, NULL) / 1000.0);
} else {
- sprintf(val, "%s", buffer);
+ qprintf(val, sizeof(val), "%s", buffer);
// we supress this nasty \n at the end
val[strlen(val)-1]='\0';
}
// debug("%s pos %i -> BREAK", file, pos);
break;
} else {
- sprintf (final_key, "%s%s", procfs_tokens[tokens_index][pos], number);
+ qprintf (final_key, sizeof(final_key), "%s%s", procfs_tokens[tokens_index][pos], number);
// debug ("%s -> %s", final_key, value);
hash_set (&I2Csensors, final_key, value);
pos++;
-/* $Id: thread.c,v 1.3 2004/04/08 10:48:25 reinelt Exp $
+/* $Id: thread.c,v 1.4 2004/06/01 06:45:30 reinelt Exp $
*
* thread handling (mutex, shmem, ...)
*
*
*
* $Log: thread.c,v $
+ * Revision 1.4 2004/06/01 06:45:30 reinelt
+ *
+ * some Fixme's processed
+ * documented some code
+ *
* Revision 1.3 2004/04/08 10:48:25 reinelt
* finished plugin_exec
* modified thread handling
/*
* exported functions:
*
- * Fixme: document me!
+ * int mutex_create (void);
+ * creates a mutex and treturns its ID
+ *
+ * void mutex_lock (int semid);
+ * try to lock a mutex
+ *
+ * void mutex_unlock (int semid);
+ * unlock a mutex
+ *
+ * void mutex_destroy (int semid);
+ * release a mutex
+ *
+ *
+ * int shm_create (void **buffer, int size);
+ * create shared memory segment
+ *
+ * void shm_destroy (int shmid, void *buffer) ;
+ * release shared memory segment
+ *
+ * int thread_create (char *name, void (*thread)(void *data), void *data);
+ * create a new thread
*
*/
-/* $Id: timer.c,v 1.6 2004/03/03 04:44:16 reinelt Exp $
+/* $Id: timer.c,v 1.7 2004/06/01 06:45:30 reinelt Exp $
*
* generic timer handling
*
*
*
* $Log: timer.c,v $
+ * Revision 1.7 2004/06/01 06:45:30 reinelt
+ *
+ * some Fixme's processed
+ * documented some code
+ *
* Revision 1.6 2004/03/03 04:44:16 reinelt
* changes (cosmetics?) to the big patch from Martin
* hash patch un-applied
/*
* exported functions:
*
- * int timer_junk(void)
- * Fixme: document me :-(
+ * int timer_add (void(*callback)(void *data), void *data, int interval, int one_shot);
+ * adds a timer to the queue
+ *
+ * int timer_process (struct timespec *delay);
+ * process timer queue
+ *
+ * void timer_exit();
+ * release all timers
*
*/
-/* $Id: timer.h,v 1.2 2004/03/03 03:47:04 reinelt Exp $
+/* $Id: timer.h,v 1.3 2004/06/01 06:45:30 reinelt Exp $
*
* generic timer handling
*
*
*
* $Log: timer.h,v $
+ * Revision 1.3 2004/06/01 06:45:30 reinelt
+ *
+ * some Fixme's processed
+ * documented some code
+ *
* Revision 1.2 2004/03/03 03:47:04 reinelt
* big patch from Martin Hejl:
* - use qprintf() where appropriate
int timer_add (void(*callback)(void *data), void *data, int interval, int one_shot);
int timer_process (struct timespec *delay);
void timer_exit();
+
#endif