LCDproc development and user support list

Text archives Help


[Lcdproc] [PATCH] redesigned icon support


Chronological Thread 
  • From: avdongen at xs4all.nl (Arthur van Dongen)
  • Subject: [Lcdproc] [PATCH] redesigned icon support
  • Date: Thu, 01 Jan 2009 17:40:34 +0100

Hi all,

First I'd like to wish you all a happy and fruitful new year, with lots
of backlight and fluorescence ;-) In other words: Enjoy!

Having said that, I would like to present my second patch for the
support of icons on my MD8800 display. I implemented some remarks on my
first patch:
- I now use the term global_icon. I think it matches the purpose better,
and emphasises that it is not screen- or widget related.
- Parsing is now done in the core, not in the driver. This makes it
easier to add support in other drivers. In addition to static texts, the
parser also handles numbers, for using strings like "VOLUME.80".
- Drivers should export functions global_icon_set and global_icon_clear
to set and clear icons. The functions get an icon id, and should return
0 when the id is handled.
- Clients can use the get and set functions to test if a certain icon is
supported by the core and the loaded drivers.
- There is (currently) no interface available to test the status of the
icons. The reason is that this makes driver implementation easier.

The diff contains modifications to existing files and there are a few
new files:
drivers/globalicons.h, commands/globalicon_commands.[ch].

As always, any feedback is appreciated.

Arthur
-------------- next part --------------
? .cdtproject
? .project
? .settings
? LCDd_test.conf
? cvsdiff.out
? clients/.cdtproject
? clients/.project
? clients/.settings
? docs/LCDd.8
? docs/lcdproc-config.5
? docs/lcdproc.1
? docs/lcdproc-dev/README.tex
? docs/lcdproc-dev/a1960.html
? docs/lcdproc-dev/add-your-driver.tex
? docs/lcdproc-dev/bookinfo.tex
? docs/lcdproc-dev/c1245.html
? docs/lcdproc-dev/c150.html
? docs/lcdproc-dev/c1608.html
? docs/lcdproc-dev/c1707.html
? docs/lcdproc-dev/c35.html
? docs/lcdproc-dev/c47.html
? docs/lcdproc-dev/driver-api.tex
? docs/lcdproc-dev/introduction.tex
? docs/lcdproc-dev/language.tex
? docs/lcdproc-dev/lcdproc-dev.tex
? docs/lcdproc-dev/license.tex
? docs/lcdproc-dev/make-driver.tex
? docs/lcdproc-dev/shared-files.tex
? docs/lcdproc-dev/x11.html
? docs/lcdproc-dev/x114.html
? docs/lcdproc-dev/x1158.html
? docs/lcdproc-dev/x12.html
? docs/lcdproc-dev/x1255.html
? docs/lcdproc-dev/x1266.html
? docs/lcdproc-dev/x155.html
? docs/lcdproc-dev/x161.html
? docs/lcdproc-dev/x1614.html
? docs/lcdproc-dev/x1669.html
? docs/lcdproc-dev/x1713.html
? docs/lcdproc-dev/x1970.html
? docs/lcdproc-dev/x1980.html
? docs/lcdproc-dev/x1984.html
? docs/lcdproc-dev/x1990.html
? docs/lcdproc-dev/x2026.html
? docs/lcdproc-dev/x2031.html
? docs/lcdproc-dev/x2035.html
? docs/lcdproc-dev/x2039.html
? docs/lcdproc-dev/x2042.html
? docs/lcdproc-dev/x2045.html
? docs/lcdproc-dev/x2050.html
? docs/lcdproc-dev/x21.html
? docs/lcdproc-dev/x22.html
? docs/lcdproc-dev/x25.html
? docs/lcdproc-dev/x31.html
? docs/lcdproc-dev/x52.html
? docs/lcdproc-dev/x6.html
? docs/lcdproc-dev/x62.html
? docs/lcdproc-dev/x67.html
? docs/lcdproc-dev/x68.html
? docs/lcdproc-dev/x7.html
? docs/lcdproc-dev/x72.html
? docs/lcdproc-dev/x76.html
? docs/lcdproc-dev/x80.html
? docs/lcdproc-dev/x83.html
? docs/lcdproc-dev/x86.html
? docs/lcdproc-dev/x91.html
? docs/lcdproc-dev/x962.html
? scripts/init-LCDd.LSB
? scripts/init-lcdexec.LSB
? scripts/init-lcdexec.debian
? scripts/init-lcdproc.LSB
? scripts/init-lcdvc.LSB
? scripts/init-lcdvc.debian
? server/.cdtproject
? server/.project
? server/.settings
? server/commands/globalicon_commands.c
? server/commands/globalicon_commands.h
? server/drivers/globalicons.c
? server/drivers/globalicons.h
Index: server/driver.c
===================================================================
RCS file: /cvsroot/lcdproc/lcdproc/server/driver.c,v
retrieving revision 1.21
diff -u -r1.21 driver.c
--- server/driver.c 14 Dec 2008 23:38:42 -0000 1.21
+++ server/driver.c 1 Jan 2009 16:29:34 -0000
@@ -76,6 +76,8 @@
{ "output", offsetof(Driver, output), 0 },
{ "get_key", offsetof(Driver, get_key), 0 },
{ "get_info", offsetof(Driver, get_info), 0 },
+ { "globalicon_set", offsetof(Driver, globalicon_set), 0 },
+ { "globalicon_clear", offsetof(Driver, globalicon_clear), 0 },
{ NULL, 0, 0 }
};

@@ -654,7 +656,6 @@
drv->chr(drv, x+1, y, ch2);
}

-
/** Set cursor position and state.
* Fallback for the driver's \c cursor method if the driver does not provide
one.
* \param drv Pointer to driver structure.
Index: server/drivers.c
===================================================================
RCS file: /cvsroot/lcdproc/lcdproc/server/drivers.c,v
retrieving revision 1.23
diff -u -r1.23 drivers.c
--- server/drivers.c 30 Nov 2008 22:31:20 -0000 1.23
+++ server/drivers.c 1 Jan 2009 16:29:34 -0000
@@ -27,6 +27,7 @@
#include "drivers.h"
#include "driver.h"
#include "drivers/lcd.h"
+#include "drivers/globalicons.h"
#include "widget.h"
/* lcd.h is used for the driver API definition */

@@ -388,6 +389,60 @@
}
}

+/**
+ * Write global icon to all drivers.
+ * For drivers that define a globalicon_set() function, call it;
+ * \param icon symbolic value representing the icon. See globalicons.h
+ * \return 0 if any driver supports this icon.
+ * -1 if no driver reported OK in its globalicon_set function
call.
+ */
+int
+drivers_globalicon_set(global_icon_ids global_icon_id)
+{
+ Driver *drv;
+ int retval = -1;
+ int r = 0;
+ debug(RPT_DEBUG, "%s(icon=%x)", __FUNCTION__, global_icon_id);
+
+ ForAllDrivers(drv) {
+ /* Does the driver have the icon function ? */
+ if (drv->globalicon_set) {
+ /* Try driver call */
+ r = drv->globalicon_set(drv, global_icon_id);
+ if (r == 0)
+ retval = r;
+ }
+ }
+ return retval; // 0 if OK returned from any driver
+}
+
+/**
+ * Write global icon to all drivers.
+ * For drivers that define a globalicon_clear() function, call it;
+ * \param icon symbolic value representing the icon. See globalicons.h
+ * \return 0 if any driver supports this icon.
+ * -1 if no driver reported OK in its globalicon_clear function
call.
+ */
+int
+drivers_globalicon_clear(global_icon_ids global_icon_id)
+{
+ Driver *drv;
+ int retval = -1;
+ int r = 0;
+ debug(RPT_DEBUG, "%s(icon=%x)", __FUNCTION__, global_icon_id);
+
+ ForAllDrivers(drv) {
+ /* Does the driver have the icon function ? */
+ if (drv->globalicon_clear) {
+ /* Try driver call */
+ r = drv->globalicon_clear(drv, global_icon_id);
+ if (r == 0)
+ retval = r;
+ }
+ }
+ return retval; // 0 if OK returned from any driver
+}
+

/**
* Set cursor on all loaded drivers.
Index: server/drivers.h
===================================================================
RCS file: /cvsroot/lcdproc/lcdproc/server/drivers.h,v
retrieving revision 1.13
diff -u -r1.13 drivers.h
--- server/drivers.h 30 Nov 2008 22:31:20 -0000 1.13
+++ server/drivers.h 1 Jan 2009 16:29:34 -0000
@@ -80,6 +80,12 @@
void
drivers_backlight(int brightness);

+int
+drivers_globalicon_set(global_icon_ids global_icon_id);
+
+int
+drivers_globalicon_clear(global_icon_ids global_icon_id);
+
void
drivers_output(int state);

Index: server/widget.h
===================================================================
RCS file: /cvsroot/lcdproc/lcdproc/server/widget.h,v
retrieving revision 1.16
diff -u -r1.16 widget.h
--- server/widget.h 14 Dec 2008 09:33:01 -0000 1.16
+++ server/widget.h 1 Jan 2009 16:29:34 -0000
@@ -34,15 +34,15 @@

/** Widget structure */
typedef struct Widget {
- char *id; /**< the widget's name */
- WidgetType type; /**< the widget's type */
- Screen *screen; /**< What screen is this widget in ?
*/
- int x, y; /**< Position */
- int width, height; /**< Visible size */
+ char *id; /**< the widget's name */
+ WidgetType type; /**< the widget's type */
+ Screen *screen; /**< What screen is this widget in ? */
+ int x, y; /**< Position */
+ int width, height; /**< Visible size */
int left, top, right, bottom; /**< bounding rectangle */
- int length; /**< size or direction */
- int speed; /**< For scroller... */
- char *text; /**< text or binary data */
+ int length; /**< size or direction */
+ int speed; /**< For scroller... */
+ char *text; /**< text or binary data */
struct Screen *frame_screen; /**< frame widget get an associated
screen */
//LinkedList *kids; /* Frames can contain more
widgets...*/
} Widget;
Index: server/commands/Makefile.am
===================================================================
RCS file: /cvsroot/lcdproc/lcdproc/server/commands/Makefile.am,v
retrieving revision 1.3
diff -u -r1.3 Makefile.am
--- server/commands/Makefile.am 16 Jan 2006 19:36:59 -0000 1.3
+++ server/commands/Makefile.am 1 Jan 2009 16:29:34 -0000
@@ -2,7 +2,7 @@

noinst_LIBRARIES = libLCDcommands.a

-libLCDcommands_a_SOURCES = command_list.c command_list.h client_commands.c
client_commands.h menu_commands.c menu_commands.h screen_commands.c
screen_commands.h server_commands.c server_commands.h widget_commands.c
widget_commands.h
+libLCDcommands_a_SOURCES = command_list.c command_list.h client_commands.c
client_commands.h globalicon_commands.c globalicon_commands.h menu_commands.c
menu_commands.h screen_commands.c screen_commands.h server_commands.c
server_commands.h widget_commands.c widget_commands.h

AM_CPPFLAGS = -I$(top_srcdir) -I$(srcdir)/..

Index: server/commands/client_commands.h
===================================================================
RCS file: /cvsroot/lcdproc/lcdproc/server/commands/client_commands.h,v
retrieving revision 1.5
diff -u -r1.5 client_commands.h
--- server/commands/client_commands.h 30 Nov 2008 22:42:34 -0000 1.5
+++ server/commands/client_commands.h 1 Jan 2009 16:29:34 -0000
@@ -20,6 +20,5 @@
int client_add_key_func(Client *c, int argc, char **argv);
int client_del_key_func(Client *c, int argc, char **argv);
int backlight_func(Client *c, int argc, char **argv);
-
#endif

Index: server/commands/command_list.c
===================================================================
RCS file: /cvsroot/lcdproc/lcdproc/server/commands/command_list.c,v
retrieving revision 1.8
diff -u -r1.8 command_list.c
--- server/commands/command_list.c 30 Nov 2008 22:42:34 -0000 1.8
+++ server/commands/command_list.c 1 Jan 2009 16:29:34 -0000
@@ -23,37 +23,40 @@
#include "screen_commands.h"
#include "widget_commands.h"
#include "menu_commands.h"
+#include "globalicon_commands.h"

#include <stdlib.h>
#include <string.h>

static client_function commands[] = {
- { "test_func", test_func_func },
- { "hello", hello_func },
- { "client_set", client_set_func },
- { "client_add_key", client_add_key_func },
- { "client_del_key", client_del_key_func },
-/* { "screen_add_key", screen_add_key_func }, */
-/* { "screen_del_key", screen_del_key_func }, */
- { "screen_add", screen_add_func },
- { "screen_del", screen_del_func },
- { "screen_set", screen_set_func },
- { "widget_add", widget_add_func },
- { "widget_del", widget_del_func },
- { "widget_set", widget_set_func },
- { "menu_add_item", menu_add_item_func },
- { "menu_del_item", menu_del_item_func },
- { "menu_set_item", menu_set_item_func },
- { "menu_goto", menu_goto_func },
- { "menu_set_main", menu_set_main_func },
+ { "test_func", test_func_func },
+ { "hello", hello_func },
+ { "client_set", client_set_func },
+ { "client_add_key", client_add_key_func },
+ { "client_del_key", client_del_key_func },
+/* { "screen_add_key", screen_add_key_func }, */
+/* { "screen_del_key", screen_del_key_func }, */
+ { "screen_add", screen_add_func },
+ { "screen_del", screen_del_func },
+ { "screen_set", screen_set_func },
+ { "widget_add", widget_add_func },
+ { "widget_del", widget_del_func },
+ { "widget_set", widget_set_func },
+ { "menu_add_item", menu_add_item_func },
+ { "menu_del_item", menu_del_item_func },
+ { "menu_set_item", menu_set_item_func },
+ { "menu_goto", menu_goto_func },
+ { "menu_set_main", menu_set_main_func },
/* Misc stuff...*/
- { "backlight", backlight_func },
- { "output", output_func },
- { "noop", noop_func },
- { "info", info_func },
- { "sleep", sleep_func },
- { "bye", bye_func },
- { NULL, NULL},
+ { "backlight", backlight_func },
+ { "output", output_func },
+ { "globalicon_set", globalicon_set_func },
+ { "globalicon_clear",globalicon_clear_func },
+ { "noop", noop_func },
+ { "info", info_func },
+ { "sleep", sleep_func },
+ { "bye", bye_func },
+ { NULL, NULL},
};


Index: server/commands/screen_commands.c
===================================================================
RCS file: /cvsroot/lcdproc/lcdproc/server/commands/screen_commands.c,v
retrieving revision 1.13
diff -u -r1.13 screen_commands.c
--- server/commands/screen_commands.c 30 Nov 2008 22:42:34 -0000 1.13
+++ server/commands/screen_commands.c 1 Jan 2009 16:29:34 -0000
@@ -193,9 +193,13 @@
/* first try to interpret it as a number */
number = atoi(argv[i]);
if (number > 0) {
- if (number <= 64)
+ if (number <= 32)
+ number = PRI_INPUT;
+ else if (number <= 64)
+ number = PRI_ALERT;
+ else if (number <= 128)
number = PRI_FOREGROUND;
- else if (number < 192)
+ else if (number <= 192)
number = PRI_INFO;
else
number = PRI_BACKGROUND;
Index: server/drivers/MD8800.c
===================================================================
RCS file: /cvsroot/lcdproc/lcdproc/server/drivers/MD8800.c,v
retrieving revision 1.6
diff -u -r1.6 MD8800.c
--- server/drivers/MD8800.c 21 Dec 2008 10:04:37 -0000 1.6
+++ server/drivers/MD8800.c 1 Jan 2009 16:29:35 -0000
@@ -3,7 +3,7 @@
*/

/*
- Copyright (C) 2006 Stefan Herdler in collaboration with Martin M?.
+ Copyright (C) 2006 Stefan Herdler in collaboration with Martin M?ller.

This source Code is based on the NoritakeVFD, the serialVFD and the
CFontzPacket Driver of this package.
@@ -28,7 +28,7 @@

==============================================================================

Known hardware-commands of the MD8800 display
- discovered by Martin M? (listed in octal notation):
+ discovered by Martin M?ller (listed in octal notation):

\33\0abcdef (abcdef can be anything, it seems) - set clock, I think.
The mapping is: bb:aa dd.cc.eeff
@@ -179,6 +179,7 @@
#include <string.h>
#include <errno.h>
#include <syslog.h>
+#include <ctype.h>

#ifdef HAVE_CONFIG_H
# include "config.h"
@@ -189,12 +190,14 @@

#include "report.h"
#include "lcd_lib.h"
+#include "globalicons.h"

/* Constants for userdefchar_mode */
#define NUM_CCs 0 /* max. number of custom characters */
#define DEFAULT_OFF_BRIGHTNESS 300
#define DEFAULT_ON_BRIGHTNESS 1000

+
/** private data for the \c MD8800 driver */
typedef struct MD8800_private_data {
char device[200];
@@ -212,6 +215,12 @@
int hw_brightness;
int last_command;
int wifi_scan;
+ int playmode;
+ int recording;
+ int mediasrc;
+ int mediatype;
+ int volume;
+ int mail;
char info[255];
} PrivateData;

@@ -602,6 +611,510 @@
// Controls the custom icons.
//
//
+
+MODULE_EXPORT int
+MD8800_globalicon_set (Driver *drvthis, global_icon_ids global_icon_id)
+{
+ PrivateData *p = drvthis->private_data;
+
+ switch(global_icon_id)
+ {
+ case ALL_ALL:
+ p->playmode = PLAYMODE_ALL;
+ write(p->fd, "\x1B\x30\x1A\x01", 4); // turn on bounding box
+ write(p->fd, "\x1B\x31\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F",
11);
+ write(p->fd, "\x1B\x30\x08", 3); // Turn on REC icon
+ write(p->fd, &p->hw_brightness, 1); // .. using right
brightness level
+ write(p->fd, "\x1B\x30\x1C\x01", 4); // bounding box
+ write(p->fd, "\x1B\x30\x13\x01", 4); // turn on speaker icon
+ write(p->fd, "\x1B\x30\x14\x01", 4); // turn on muted speaker
icon
+ write(p->fd, "\x1B\x30\x0B\x01", 4); // turn on all volume
levels
+ write(p->fd, "\x1B\x30\x0C\x01", 4);
+ write(p->fd, "\x1B\x30\x0D\x01", 4);
+ write(p->fd, "\x1B\x30\x0E\x01", 4);
+ write(p->fd, "\x1B\x30\x0F\x01", 4);
+ write(p->fd, "\x1B\x30\x10\x01", 4);
+ write(p->fd, "\x1B\x30\x11\x01", 4);
+ write(p->fd, "\x1B\x30\x12\x01", 4);
+
+ write(p->fd, "\x1B\x30\x09\x01", 4); // mail envelope
+ write(p->fd, "\x1B\x30\x0A\x01", 4); // mail envelope fill
+ write(p->fd, "\x1B\x30\x1B\x01", 4); // turn on email
boundinbox
+
+ p->mediasrc = MEDIASOURCE_ALL;
+ write(p->fd, "\x1B\x30\x00", 3);
+ write(p->fd, &p->hw_brightness, 1);
+ write(p->fd, "\x1B\x30\x01", 3);
+ write(p->fd, &p->hw_brightness, 1);
+ write(p->fd, "\x1B\x30\x02", 3);
+ write(p->fd, &p->hw_brightness, 1);
+ write(p->fd, "\x1B\x30\x03", 3);
+ write(p->fd, &p->hw_brightness, 1);
+ write(p->fd, "\x1B\x30\x18\x01", 4);
+
+ p->mediatype = MEDIATYPE_ALL;
+ write(p->fd, "\x1B\x30\x04", 3);
+ write(p->fd, &p->hw_brightness, 1);
+ write(p->fd, "\x1B\x30\x05", 3);
+ write(p->fd, &p->hw_brightness, 1);
+ write(p->fd, "\x1B\x30\x06", 3);
+ write(p->fd, &p->hw_brightness, 1);
+ write(p->fd, "\x1B\x30\x07", 3);
+ write(p->fd, &p->hw_brightness, 1);
+ write(p->fd, "\x1B\x30\x19\x01", 4);
+
+ write(p->fd, "\x1B\x30\x15\x01", 4); // red wifi icon
+ write(p->fd, "\x1B\x30\x16\x01", 4);
+ write(p->fd, "\x1B\x30\x17\x01", 4);
+ break;
+ case PLAYMODE_ALL:
+ p->playmode = PLAYMODE_ALL;
+ write(p->fd, "\x1B\x30\x1A\x01", 4); // turn on bounding box
+ write(p->fd, "\x1B\x31\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F",
11);
+ break;
+ case PLAYMODE_PLAY:
+ p->playmode = PLAYMODE_PLAY;
+ write(p->fd, "\x1B\x30\x1A\x01", 4); // turn on bounding box
+ write(p->fd, "\x1B\x31\x00\x00\x08\x1C\x3E\x7F\x00\x00\x00",
11);
+ break;
+ case PLAYMODE_STOP:
+ p->playmode = PLAYMODE_STOP;
+ write(p->fd, "\x1B\x30\x1A\x01", 4); // turn on bounding box
+ write(p->fd, "\x1B\x31\x00\x3E\x3E\x3E\x3E\x3E\x00\x00\x00",
11);
+ break;
+ case PLAYMODE_PAUSE:
+ p->playmode = PLAYMODE_PAUSE;
+ write(p->fd, "\x1B\x30\x1A\x01", 4); // turn on bounding box
+ write(p->fd, "\x1B\x31\x00\x3E\x3E\x00\x3E\x3E\x00\x00\x00",
11);
+ break;
+ case PLAYMODE_FF:
+ p->playmode = PLAYMODE_FF;
+ write(p->fd, "\x1B\x30\x1A\x01", 4); // turn on bounding box
+ write(p->fd, "\x1B\x31\x00\x08\x1C\x3E\x08\x1C\x3E\x00\x00",
11);
+ break;
+ case PLAYMODE_REW:
+ p->playmode = PLAYMODE_REW;
+ write(p->fd, "\x1B\x30\x1A\x01", 4); // turn on bounding box
+ write(p->fd, "\x1B\x31\x00\x3E\x1C\x08\x3E\x1C\x08\x00\x00",
11);
+ break;
+ case RECORDING_REC:
+ case RECORDING_ALL:
+ p->recording = RECORDING_REC;
+ write(p->fd, "\x1B\x30\x1A\x01", 4); // turn on bounding box
+ write(p->fd, "\x1B\x30\x08", 3); // Turn on REC icon
+ write(p->fd, &p->hw_brightness, 1); // .. using right
brightness level
+ break;
+ case VOLUME_ALL:
+ write(p->fd, "\x1B\x30\x1C\x01", 4); // bounding box
+ write(p->fd, "\x1B\x30\x13\x01", 4); // turn on speaker icon
+ write(p->fd, "\x1B\x30\x14\x01", 4); // turn on muted speaker
icon
+ write(p->fd, "\x1B\x30\x0B\x01", 4); // turn on all volume
levels
+ write(p->fd, "\x1B\x30\x0C\x01", 4);
+ write(p->fd, "\x1B\x30\x0D\x01", 4);
+ write(p->fd, "\x1B\x30\x0E\x01", 4);
+ write(p->fd, "\x1B\x30\x0F\x01", 4);
+ write(p->fd, "\x1B\x30\x10\x01", 4);
+ write(p->fd, "\x1B\x30\x11\x01", 4);
+ write(p->fd, "\x1B\x30\x12\x01", 4);
+ break;
+ case VOLUME_MUTE:
+ write(p->fd, "\x1B\x30\x1C\x01", 4); // bounding box
+ write(p->fd, "\x1B\x30\x13\x00", 4); // turn off speaker icon
+ write(p->fd, "\x1B\x30\x14\x01", 4); // turn on muted speaker
icon
+ break;
+ case VOLUME_UNMUTE:
+ write(p->fd, "\x1B\x30\x1C\x01", 4); // bounding box
+ write(p->fd, "\x1B\x30\x13\x01", 4); // turn on speaker icon
+ write(p->fd, "\x1B\x30\x14\x00", 4); // turn off muted
speaker icon
+ break;
+ case MAIL_ALL:
+ write(p->fd, "\x1B\x30\x09\x01", 4);
+ write(p->fd, "\x1B\x30\x0A\x01", 4);
+ write(p->fd, "\x1B\x30\x1B\x01", 4); // turn on email
boundinbox
+ break;
+ case MAIL_OUTLINE:
+ p->mail = MAIL_OUTLINE;
+ write(p->fd, "\x1B\x30\x09\x01", 4);
+ write(p->fd, "\x1B\x30\x1B\x01", 4); // turn on email
boundingbox
+ break;
+ case MAIL_NEWMAIL:
+ p->mail = MAIL_NEWMAIL;
+ write(p->fd, "\x1B\x30\x09\x01", 4);
+ write(p->fd, "\x1B\x30\x0A\x01", 4);
+ write(p->fd, "\x1B\x30\x1B\x01", 4); // turn on email
boundinbox
+ break;
+ case MEDIASOURCE_ALL:
+ p->mediasrc = MEDIASOURCE_ALL;
+ write(p->fd, "\x1B\x30\x00", 3);
+ write(p->fd, &p->hw_brightness, 1);
+ write(p->fd, "\x1B\x30\x01", 3);
+ write(p->fd, &p->hw_brightness, 1);
+ write(p->fd, "\x1B\x30\x02", 3);
+ write(p->fd, &p->hw_brightness, 1);
+ write(p->fd, "\x1B\x30\x03", 3);
+ write(p->fd, &p->hw_brightness, 1);
+ write(p->fd, "\x1B\x30\x18\x01", 4);
+ break;
+ case MEDIASOURCE_HDD:
+ p->mediasrc = MEDIASOURCE_HDD;
+ write(p->fd, "\x1B\x30\x00", 3);
+ write(p->fd, &p->hw_brightness, 1);
+ write(p->fd, "\x1B\x30\x18\x01", 4);
+ break;
+ case MEDIASOURCE_IEEE1394:
+ p->mediasrc = MEDIASOURCE_IEEE1394;
+ write(p->fd, "\x1B\x30\x01", 3);
+ write(p->fd, &p->hw_brightness, 1);
+ write(p->fd, "\x1B\x30\x18\x01", 4);
+ break;
+ case MEDIASOURCE_CD:
+ p->mediasrc = MEDIASOURCE_CD;
+ write(p->fd, "\x1B\x30\x02", 3);
+ write(p->fd, &p->hw_brightness, 1);
+ write(p->fd, "\x1B\x30\x18\x01", 4);
+ break;
+ case MEDIASOURCE_USB:
+ p->mediasrc = MEDIASOURCE_USB;
+ write(p->fd, "\x1B\x30\x03", 3);
+ write(p->fd, &p->hw_brightness, 1);
+ write(p->fd, "\x1B\x30\x18\x01", 4);
+ break;
+ case MEDIATYPE_ALL:
+ p->mediatype = MEDIATYPE_ALL;
+ write(p->fd, "\x1B\x30\x04", 3);
+ write(p->fd, &p->hw_brightness, 1);
+ write(p->fd, "\x1B\x30\x05", 3);
+ write(p->fd, &p->hw_brightness, 1);
+ write(p->fd, "\x1B\x30\x06", 3);
+ write(p->fd, &p->hw_brightness, 1);
+ write(p->fd, "\x1B\x30\x07", 3);
+ write(p->fd, &p->hw_brightness, 1);
+ write(p->fd, "\x1B\x30\x19\x01", 4);
+ break;
+ case MEDIATYPE_MOVIE:
+ p->mediatype = MEDIATYPE_MOVIE;
+ write(p->fd, "\x1B\x30\x04", 3);
+ write(p->fd, &p->hw_brightness, 1);
+ write(p->fd, "\x1B\x30\x19\x01", 4);
+ break;
+ case MEDIATYPE_TV:
+ p->mediatype = MEDIATYPE_TV;
+ write(p->fd, "\x1B\x30\x05", 3);
+ write(p->fd, &p->hw_brightness, 1);
+ write(p->fd, "\x1B\x30\x19\x01", 4);
+ break;
+ case MEDIATYPE_MUSIC:
+ p->mediatype = MEDIATYPE_MUSIC;
+ write(p->fd, "\x1B\x30\x06", 3);
+ write(p->fd, &p->hw_brightness, 1);
+ write(p->fd, "\x1B\x30\x19\x01", 4);
+ break;
+ case MEDIATYPE_PHOTO:
+ p->mediatype = MEDIATYPE_PHOTO;
+ write(p->fd, "\x1B\x30\x07", 3);
+ write(p->fd, &p->hw_brightness, 1);
+ write(p->fd, "\x1B\x30\x19\x01", 4);
+ break;
+ case WIFI_ALL:
+ write(p->fd, "\x1B\x30\x1C\x01", 4); // bounding box
+ write(p->fd, "\x1B\x30\x15\x01", 4);
+ write(p->fd, "\x1B\x30\x16\x01", 4);
+ write(p->fd, "\x1B\x30\x17\x01", 4);
+ break;
+ case WIFI_ANTENNA:
+ write(p->fd, "\x1B\x30\x15\x01", 4);
+ break;
+ default:
+ if ((global_icon_id >= VOLUME_LEVEL_MIN) && (global_icon_id
<= VOLUME_LEVEL_MAX))
+ {
+ int volumeLevel = global_icon_id - VOLUME_LEVEL_MIN;
+ p->volume = volumeLevel;
+ if (volumeLevel > 100)
+ {
+ volumeLevel = -1;
+ }
+ if (volumeLevel >= 12)
+ write(p->fd, "\x1B\x30\x0B\x01", 4);
+ else
+ write(p->fd, "\x1B\x30\x0B\x00", 4);
+ if (volumeLevel >= 25)
+ write(p->fd, "\x1B\x30\x0C\x01", 4);
+ else
+ write(p->fd, "\x1B\x30\x0C\x00", 4);
+ if (volumeLevel >= 37)
+ write(p->fd, "\x1B\x30\x0D\x01", 4);
+ else
+ write(p->fd, "\x1B\x30\x0D\x00", 4);
+ if (volumeLevel >= 50)
+ write(p->fd, "\x1B\x30\x0E\x01", 4);
+ else
+ write(p->fd, "\x1B\x30\x0E\x00", 4);
+ if (volumeLevel >= 62)
+ write(p->fd, "\x1B\x30\x0F\x01", 4);
+ else
+ write(p->fd, "\x1B\x30\x0F\x00", 4);
+ if (volumeLevel >= 75)
+ write(p->fd, "\x1B\x30\x10\x01", 4);
+ else
+ write(p->fd, "\x1B\x30\x10\x00", 4);
+ if (volumeLevel >= 87)
+ write(p->fd, "\x1B\x30\x11\x01", 4);
+ else
+ write(p->fd, "\x1B\x30\x11\x00", 4);
+ if (volumeLevel >= 100)
+ write(p->fd, "\x1B\x30\x12\x01", 4);
+ else
+ write(p->fd, "\x1B\x30\x12\x00", 4);
+ break;
+ }
+ else if ((global_icon_id >= WIFI_LEVEL_MIN) &&
(global_icon_id <= WIFI_LEVEL_MAX))
+ {
+ int wifilevel = global_icon_id - WIFI_LEVEL_MIN;
+ if (wifilevel > 33)
+ write(p->fd, "\x1B\x30\x16\x01", 4);
+ else
+ write(p->fd, "\x1B\x30\x16\x00", 4);
+ if (wifilevel > 66)
+ write(p->fd, "\x1B\x30\x17\x01", 4);
+ else
+ write(p->fd, "\x1B\x30\x17\x00", 4);
+ break;
+ }
+ return -1;
+ }
+ return 0;
+}
+
+MODULE_EXPORT int
+MD8800_globalicon_clear (Driver *drvthis, global_icon_ids global_icon_id)
+{
+ PrivateData *p = drvthis->private_data;
+
+ switch(global_icon_id)
+ {
+ case ALL_ALL:
+ // clear playmode section
+ p->playmode = 0;
+ write(p->fd, "\x1B\x30\x1A\x00", 4); // turn off bounding box
+ write(p->fd, "\x1B\x31\x00\x00\x00\x00\x00\x00\x00\x00\x00",
11);
+
+ p->recording = 0;
+ write(p->fd, "\x1B\x30\x08\x00", 4); // Turn off REC icon
+ write(p->fd, "\x1B\x30\x1C\x00", 4); // bounding box
+
+ write(p->fd, "\x1B\x30\x13\x00", 4); // turn off speaker icon
+ write(p->fd, "\x1B\x30\x14\x00", 4); // turn off muted
speaker icon
+ write(p->fd, "\x1B\x30\x0B\x00", 4); // turn off all volume
levels
+ write(p->fd, "\x1B\x30\x0C\x00", 4);
+ write(p->fd, "\x1B\x30\x0D\x00", 4);
+ write(p->fd, "\x1B\x30\x0E\x00", 4);
+ write(p->fd, "\x1B\x30\x0F\x00", 4);
+ write(p->fd, "\x1B\x30\x10\x00", 4);
+ write(p->fd, "\x1B\x30\x11\x00", 4);
+ write(p->fd, "\x1B\x30\x12\x00", 4);
+
+ write(p->fd, "\x1B\x30\x09\x00", 4);
+ write(p->fd, "\x1B\x30\x0A\x00", 4);
+ write(p->fd, "\x1B\x30\x1B\x00", 4); // turn off email
boundinbox
+
+ write(p->fd, "\x1B\x30\x00\x00", 4); // media source
+ write(p->fd, "\x1B\x30\x01\x00", 4);
+ write(p->fd, "\x1B\x30\x02\x00", 4);
+ write(p->fd, "\x1B\x30\x03\x00", 4);
+ write(p->fd, "\x1B\x30\x18\x00", 4);
+
+ write(p->fd, "\x1B\x30\x04\x00", 4); // media type
+ write(p->fd, "\x1B\x30\x05\x00", 4);
+ write(p->fd, "\x1B\x30\x06\x00", 4);
+ write(p->fd, "\x1B\x30\x07\x00", 4);
+ write(p->fd, "\x1B\x30\x19\x00", 4);
+
+ write(p->fd, "\x1B\x30\x15\x00", 4); // red wifi icon
+ write(p->fd, "\x1B\x30\x16\x00", 4);
+ write(p->fd, "\x1B\x30\x17\x00", 4);
+ break;
+ case PLAYMODE_ALL:
+ p->playmode = 0;
+ write(p->fd, "\x1B\x30\x1A\x00", 4); // turn off bounding box
+ write(p->fd, "\x1B\x31\x00\x00\x00\x00\x00\x00\x00\x00\x00",
11);
+ break;
+ case PLAYMODE_PLAY:
+ if (p->playmode == PLAYMODE_PLAY)
+ {
+ p->playmode = 0;
+ write(p->fd, "\x1B\x30\x1A\x01", 4); // turn on
bounding box
+ write(p->fd,
"\x1B\x31\x00\x00\x00\x00\x00\x00\x00\x00\x00", 11);
+ }
+ break;
+ case PLAYMODE_STOP:
+ if (p->playmode == PLAYMODE_STOP)
+ {
+ p->playmode = 0;
+ write(p->fd, "\x1B\x30\x1A\x01", 4); // turn on
bounding box
+ write(p->fd,
"\x1B\x31\x00\x00\x00\x00\x00\x00\x00\x00\x00", 11);
+ }
+ break;
+ case PLAYMODE_PAUSE:
+ if (p->playmode == PLAYMODE_PAUSE)
+ {
+ p->playmode = 0;
+ write(p->fd, "\x1B\x30\x1A\x01", 4); // turn on
bounding box
+ write(p->fd,
"\x1B\x31\x00\x00\x00\x00\x00\x00\x00\x00\x00", 11);
+ }
+ break;
+ case PLAYMODE_FF:
+ if (p->playmode == PLAYMODE_FF)
+ {
+ p->playmode = 0;
+ write(p->fd, "\x1B\x30\x1A\x01", 4); // turn on
bounding box
+ write(p->fd,
"\x1B\x31\x00\x00\x00\x00\x00\x00\x00\x00\x00", 11);
+ }
+ break;
+ case PLAYMODE_REW:
+ if (p->playmode == PLAYMODE_REW)
+ {
+ p->playmode = 0;
+ write(p->fd, "\x1B\x30\x1A\x01", 4); // turn on
bounding box
+ write(p->fd,
"\x1B\x31\x00\x00\x00\x00\x00\x00\x00\x00\x00", 11);
+ }
+ break;
+ case RECORDING_REC:
+ p->recording = 0;
+ write(p->fd, "\x1B\x30\x08\x00", 4); // Turn off REC icon
+ break;
+ case RECORDING_ALL:
+ p->recording = 0;
+ write(p->fd, "\x1B\x30\x1A\x01", 4); // turn on bounding box
+ write(p->fd, "\x1B\x30\x08\x00", 4); // Turn off REC icon
+ break;
+ case VOLUME_ALL:
+ write(p->fd, "\x1B\x30\x1C\x00", 4); // bounding box
+ write(p->fd, "\x1B\x30\x13\x00", 4); // turn off speaker icon
+ write(p->fd, "\x1B\x30\x14\x00", 4); // turn off muted
speaker icon
+ write(p->fd, "\x1B\x30\x0B\x00", 4); // turn off all volume
levels
+ write(p->fd, "\x1B\x30\x0C\x00", 4);
+ write(p->fd, "\x1B\x30\x0D\x00", 4);
+ write(p->fd, "\x1B\x30\x0E\x00", 4);
+ write(p->fd, "\x1B\x30\x0F\x00", 4);
+ write(p->fd, "\x1B\x30\x10\x00", 4);
+ write(p->fd, "\x1B\x30\x11\x00", 4);
+ write(p->fd, "\x1B\x30\x12\x00", 4);
+ break;
+ case VOLUME_MUTE:
+ write(p->fd, "\x1B\x30\x14\x00", 4); // turn off muted
speaker icon
+ break;
+ case VOLUME_UNMUTE:
+ write(p->fd, "\x1B\x30\x13\x00", 4); // turn off speaker icon
+ break;
+ case MAIL_ALL:
+ write(p->fd, "\x1B\x30\x09\x00", 4);
+ write(p->fd, "\x1B\x30\x0A\x00", 4);
+ write(p->fd, "\x1B\x30\x1B\x00", 4); // turn off email
boundinbox
+ break;
+ case MAIL_OUTLINE:
+ write(p->fd, "\x1B\x30\x09\x00", 4);
+ break;
+ case MAIL_NEWMAIL:
+ p->mail = MAIL_NEWMAIL;
+ write(p->fd, "\x1B\x30\x09\x00", 4);
+ write(p->fd, "\x1B\x30\x0A\x00", 4);
+ break;
+ case MEDIASOURCE_ALL:
+ write(p->fd, "\x1B\x30\x00\x00", 4);
+ write(p->fd, "\x1B\x30\x01\x00", 4);
+ write(p->fd, "\x1B\x30\x02\x00", 4);
+ write(p->fd, "\x1B\x30\x03\x00", 4);
+ write(p->fd, "\x1B\x30\x18\x00", 4);
+ break;
+ case MEDIASOURCE_HDD:
+ write(p->fd, "\x1B\x30\x00\x00", 4);
+ break;
+ case MEDIASOURCE_IEEE1394:
+ write(p->fd, "\x1B\x30\x01\x00", 4);
+ break;
+ case MEDIASOURCE_CD:
+ write(p->fd, "\x1B\x30\x02\x00", 4);
+ break;
+ case MEDIASOURCE_USB:
+ write(p->fd, "\x1B\x30\x03\x00", 4);
+ break;
+ case MEDIATYPE_ALL:
+ write(p->fd, "\x1B\x30\x04\x00", 4);
+ write(p->fd, "\x1B\x30\x05\x00", 4);
+ write(p->fd, "\x1B\x30\x06\x00", 4);
+ write(p->fd, "\x1B\x30\x07\x00", 4);
+ write(p->fd, "\x1B\x30\x19\x00", 4);
+ break;
+ case MEDIATYPE_MOVIE:
+ write(p->fd, "\x1B\x30\x04\x00", 4);
+ break;
+ case MEDIATYPE_TV:
+ write(p->fd, "\x1B\x30\x05\x00", 4);
+ break;
+ case MEDIATYPE_MUSIC:
+ write(p->fd, "\x1B\x30\x06\x00", 4);
+ break;
+ case MEDIATYPE_PHOTO:
+ write(p->fd, "\x1B\x30\x07\x00", 4);
+ break;
+ case WIFI_ALL:
+ write(p->fd, "\x1B\x30\x1C\x00", 4); // bounding box
+ write(p->fd, "\x1B\x30\x15\x00", 4);
+ write(p->fd, "\x1B\x30\x16\x00", 4);
+ write(p->fd, "\x1B\x30\x17\x00", 4);
+ break;
+ case WIFI_ANTENNA:
+ write(p->fd, "\x1B\x30\x15\x00", 4);
+ break;
+ default:
+ if ((global_icon_id >= VOLUME_LEVEL_MIN) && (global_icon_id
<= VOLUME_LEVEL_MAX))
+ {
+ int volumeLevel = global_icon_id - VOLUME_LEVEL_MIN;
+ p->volume = volumeLevel;
+ if (volumeLevel > 100)
+ {
+ volumeLevel = -1;
+ }
+ if (volumeLevel >= 12)
+ write(p->fd, "\x1B\x30\x0B\x01", 4);
+ else
+ write(p->fd, "\x1B\x30\x0B\x00", 4);
+ if (volumeLevel >= 25)
+ write(p->fd, "\x1B\x30\x0C\x01", 4);
+ else
+ write(p->fd, "\x1B\x30\x0C\x00", 4);
+ if (volumeLevel >= 37)
+ write(p->fd, "\x1B\x30\x0D\x01", 4);
+ else
+ write(p->fd, "\x1B\x30\x0D\x00", 4);
+ if (volumeLevel >= 50)
+ write(p->fd, "\x1B\x30\x0E\x01", 4);
+ else
+ write(p->fd, "\x1B\x30\x0E\x00", 4);
+ if (volumeLevel >= 62)
+ write(p->fd, "\x1B\x30\x0F\x01", 4);
+ else
+ write(p->fd, "\x1B\x30\x0F\x00", 4);
+ if (volumeLevel >= 75)
+ write(p->fd, "\x1B\x30\x10\x01", 4);
+ else
+ write(p->fd, "\x1B\x30\x10\x00", 4);
+ if (volumeLevel >= 87)
+ write(p->fd, "\x1B\x30\x11\x01", 4);
+ else
+ write(p->fd, "\x1B\x30\x11\x00", 4);
+ if (volumeLevel >= 100)
+ write(p->fd, "\x1B\x30\x12\x01", 4);
+ else
+ write(p->fd, "\x1B\x30\x12\x00", 4);
+ break;
+ }
+ return -1;
+ }
+ return 0;
+}
+
+
MODULE_EXPORT void
MD8800_output (Driver *drvthis, int on)
{
Index: server/drivers/MD8800.h
===================================================================
RCS file: /cvsroot/lcdproc/lcdproc/server/drivers/MD8800.h,v
retrieving revision 1.3
diff -u -r1.3 MD8800.h
--- server/drivers/MD8800.h 2 Apr 2007 21:29:54 -0000 1.3
+++ server/drivers/MD8800.h 1 Jan 2009 16:29:35 -0000
@@ -1,6 +1,6 @@
/* This is the LCDproc driver for the VFD of the Medion MD8800 PC

- Copyright (C) 2006 Stefan Herdler in collaboration with Martin M?.
+ Copyright (C) 2006 Stefan Herdler in collaboration with Martin M?ller.
This source Code is based on the NoritakeVFD, the serialVFD and the
CFontzPacket Driver of this package.

@@ -46,6 +46,6 @@
MODULE_EXPORT void MD8800_set_brightness(Driver *drvthis, int state, int
promille);
MODULE_EXPORT int MD8800_get_brightness(Driver *drvthis, int state);
MODULE_EXPORT int MD8800_icon (Driver *drvthis, int x, int y, int icon);
-
-
+MODULE_EXPORT int MD8800_globalicon_set (Driver *drvthis, global_icon_ids
global_icon_id);
+MODULE_EXPORT int MD8800_globalicon_clear (Driver *drvthis, global_icon_ids
global_icon_id);
#endif
Index: server/drivers/lcd.h
===================================================================
RCS file: /cvsroot/lcdproc/lcdproc/server/drivers/lcd.h,v
retrieving revision 1.25
diff -u -r1.25 lcd.h
--- server/drivers/lcd.h 2 Apr 2007 21:29:54 -0000 1.25
+++ server/drivers/lcd.h 1 Jan 2009 16:29:35 -0000
@@ -79,6 +79,11 @@
* lot of things in that area might need to be changed.
*/

+#define ICONGROUP_LEN 16
+#define ICONGROUPMEMBER_LEN 16
+#define ICONGROUP_MEMBER_SEPARATOR '.'
+#include "globalicons.h"
+
/* Heartbeat data */
#define HEARTBEAT_OFF 0
#define HEARTBEAT_ON 1
@@ -147,6 +152,8 @@
void (*num) (struct lcd_logical_driver *drvthis, int x,
int num);
void (*heartbeat) (struct lcd_logical_driver *drvthis, int
state);
int (*icon) (struct lcd_logical_driver *drvthis, int x,
int y, int icon);
+ int (*globalicon_set) (struct lcd_logical_driver *drvthis,
global_icon_ids global_icon_id);
+ int (*globalicon_clear) (struct lcd_logical_driver *drvthis,
global_icon_ids global_icon_id);
void (*cursor) (struct lcd_logical_driver *drvthis, int x,
int y, int type);

/* user-defined character functions, are those still supported ? */
-------------- next part --------------
A non-text attachment was scrubbed...
Name: globalicons.h
Type: text/x-chdr
Size: 2101 bytes
Desc: not available
URL:
<http://lists.omnipotent.net/pipermail/lcdproc/attachments/20090101/b901145d/attachment-0002.h>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: globalicon_commands.c
Type: text/x-csrc
Size: 8813 bytes
Desc: not available
URL:
<http://lists.omnipotent.net/pipermail/lcdproc/attachments/20090101/b901145d/attachment-0001.c>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: globalicon_commands.h
Type: text/x-chdr
Size: 956 bytes
Desc: not available
URL:
<http://lists.omnipotent.net/pipermail/lcdproc/attachments/20090101/b901145d/attachment-0003.h>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
URL:
<http://lists.omnipotent.net/pipermail/lcdproc/attachments/20090101/b901145d/attachment-0001.pgp>



  • [Lcdproc] [PATCH] redesigned icon support, Arthur van Dongen, 01/01/2009

Archive powered by MHonArc 2.6.18.

Top of page