1 diff -urN lcd4linux.old/Makefile.in lcd4linux.dev/Makefile.in
2 --- lcd4linux.old/Makefile.in 2006-01-20 03:52:18.414424750 +0100
3 +++ lcd4linux.dev/Makefile.in 2006-01-20 07:59:02.782678750 +0100
5 lcd4linux_SOURCES = lcd4linux.c cfg.c cfg.h debug.c debug.h drv.c drv.h evaluator.c evaluator.h hash.c hash.h layout.c layout.h pid.c pid.h timer.c timer.h thread.c thread.h udelay.c udelay.h qprintf.c qprintf.h widget.c widget.h widget_text.c widget_text.h widget_bar.c widget_bar.h widget_icon.c widget_icon.h plugin.c plugin.h plugin_cfg.c plugin_math.c plugin_string.c plugin_test.c plugin_time.c
8 -EXTRA_lcd4linux_SOURCES = drv_generic_text.c drv_generic_text.h drv_generic_graphic.c drv_generic_graphic.h drv_generic_serial.c drv_generic_serial.h drv_generic_parport.c drv_generic_parport.h drv_generic_i2c.c drv_generic_i2c.h drv_BeckmannEgle.c drv_BWCT.c drv_Crystalfontz.c drv_Curses.c drv_Cwlinux.c drv_HD44780.c drv_Image.c drv_LCDLinux.c drv_LCDLinux.h drv_LCDTerm.c drv_M50530.c drv_MatrixOrbital.c drv_MilfordInstruments.c drv_Noritake.c drv_NULL.c drv_RouterBoard.c drv_serdisplib.c drv_SimpleLCD.c drv_T6963.c drv_Trefon.c drv_USBLCD.c drv_X11.c font_6x8.h lcd4linux_i2c.h plugin_apm.c plugin_cpuinfo.c plugin_diskstats.c plugin_dvb.c plugin_exec.c plugin_i2c_sensors.c plugin_imon.c plugin_isdn.c plugin_loadavg.c plugin_meminfo.c plugin_mysql.c plugin_netdev.c plugin_pop3.c plugin_ppp.c plugin_proc_stat.c plugin_python.c plugin_seti.c plugin_statfs.c plugin_uname.c plugin_uptime.c plugin_wireless.c plugin_xmms.c
9 +EXTRA_lcd4linux_SOURCES = drv_generic_text.c drv_generic_text.h drv_generic_graphic.c drv_generic_graphic.h drv_generic_serial.c drv_generic_serial.h drv_generic_parport.c drv_generic_parport.h drv_generic_i2c.c drv_generic_i2c.h drv_BeckmannEgle.c drv_BWCT.c drv_Crystalfontz.c drv_Curses.c drv_Cwlinux.c drv_HD44780.c drv_Image.c drv_LCDLinux.c drv_LCDLinux.h drv_LCDTerm.c drv_M50530.c drv_MatrixOrbital.c drv_FC-NEC.c drv_MilfordInstruments.c drv_Noritake.c drv_NULL.c drv_RouterBoard.c drv_serdisplib.c drv_SimpleLCD.c drv_T6963.c drv_Trefon.c drv_USBLCD.c drv_X11.c font_6x8.h lcd4linux_i2c.h plugin_apm.c plugin_cpuinfo.c plugin_diskstats.c plugin_dvb.c plugin_exec.c plugin_i2c_sensors.c plugin_imon.c plugin_isdn.c plugin_loadavg.c plugin_meminfo.c plugin_mysql.c plugin_netdev.c plugin_pop3.c plugin_ppp.c plugin_proc_stat.c plugin_python.c plugin_seti.c plugin_statfs.c plugin_uname.c plugin_uptime.c plugin_wireless.c plugin_xmms.c
12 EXTRA_DIST = lcd4linux.conf.sample lcd4kde.conf lcd4linux.kdelnk lcd4linux.xpm lcd4linux.lsm curses.m4 AUTHORS CREDITS FAQ NEWS TODO README README.Drivers README.Plugins README.KDE plugin_sample.c
14 drv_M50530.o: drv_M50530.c config.h debug.h cfg.h qprintf.h udelay.h \
15 plugin.h evaluator.h widget.h widget_text.h widget_icon.h \
16 widget_bar.h drv.h drv_generic_text.h drv_generic_parport.h
17 +drv_NEC-FC.o: drv_NEC-FC.c config.h debug.h cfg.h plugin.h \
18 + evaluator.h widget.h widget_text.h widget_icon.h widget_bar.h \
19 + drv.h drv_generic_text.h drv_generic_serial.h
20 drv_MatrixOrbital.o: drv_MatrixOrbital.c config.h debug.h cfg.h plugin.h \
21 evaluator.h widget.h widget_text.h widget_icon.h widget_bar.h \
22 drv.h drv_generic_text.h drv_generic_serial.h
23 diff -urN lcd4linux.old/config.h.in lcd4linux.dev/config.h.in
24 --- lcd4linux.old/config.h.in 2006-01-20 03:52:18.418423000 +0100
25 +++ lcd4linux.dev/config.h.in 2006-01-20 08:01:07.332164500 +0100
27 /* MatrixOrbital driver */
28 #undef WITH_MATRIXORBITAL
33 /* Milford Instruments driver */
36 diff -urN lcd4linux.old/configure lcd4linux.dev/configure
37 --- lcd4linux.old/configure 2006-01-20 03:52:18.418423000 +0100
38 +++ lcd4linux.dev/configure 2006-01-20 08:00:27.973391500 +0100
40 HD44780, LCDLinux, LCDTerm, M50530, MatrixOrbital,
41 MilfordInstruments, Noritake, NULL, PNG, PPM,
42 RouterBoard, serdisplib, SimpleLCD, T6963, Trefon,
45 --with-plugins=<list> choose which plugins to compile.
46 type --with-plugins=list for a list
66 @@ -6109,6 +6113,16 @@
70 +if test "$NEC_FC" = "yes"; then
72 + DRIVERS="$DRIVERS drv_NEC-FC.o"
74 +cat >>confdefs.h <<\_ACEOF
75 +#define WITH_NEC_FC 1
80 if test "$MILINST" = "yes"; then
81 DRIVERS="$DRIVERS drv_MilfordInstruments.o"
83 diff -urN lcd4linux.old/drv.c lcd4linux.dev/drv.c
84 --- lcd4linux.old/drv.c 2006-01-20 03:52:18.422421250 +0100
85 +++ lcd4linux.dev/drv.c 2006-01-20 08:02:30.895589500 +0100
87 extern DRIVER drv_LCDLinux;
88 extern DRIVER drv_LCDTerm;
89 extern DRIVER drv_M50530;
90 +extern DRIVER drv_NEC_FC;
91 extern DRIVER drv_MatrixOrbital;
92 extern DRIVER drv_MilfordInstruments;
93 extern DRIVER drv_Noritake;
95 #ifdef WITH_MATRIXORBITAL
102 &drv_MilfordInstruments,
104 diff -urN lcd4linux.old/drv_NEC-FC.c lcd4linux.dev/drv_NEC-FC.c
105 --- lcd4linux.old/drv_NEC-FC.c 1970-01-01 01:00:00.000000000 +0100
106 +++ lcd4linux.dev/drv_NEC-FC.c 2006-01-20 09:32:19.632985000 +0100
110 + * Driver for NEC FC20X2JA
111 + * Copyright (C) 2006, Felix Fietkau <nbd@openwrt.org>
113 + * Based on MatrixOrbital driver
115 + * LCD4Linux is free software; you can redistribute it and/or modify
116 + * it under the terms of the GNU General Public License as published by
117 + * the Free Software Foundation; either version 2, or (at your option)
118 + * any later version.
120 + * LCD4Linux is distributed in the hope that it will be useful,
121 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
122 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
123 + * GNU General Public License for more details.
125 + * You should have received a copy of the GNU General Public License
126 + * along with this program; if not, write to the Free Software
127 + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
133 + * exported fuctions:
135 + * struct DRIVER drv_NEC_FC_
150 +#include "widget_text.h"
151 +#include "widget_icon.h"
152 +#include "widget_bar.h"
154 +#include "drv_generic_text.h"
155 +#include "drv_generic_serial.h"
158 +static char Name[] = "NEC-FC";
159 +static int cur_pos = 0;
161 +static int Protocol;
163 +/* Fixme: GPO's not yet implemented */
164 +/* static int GPO[8]; */
177 +/* Fixme #1: number of gpo's should be verified */
178 +/* Fixme #2: protocol should be verified */
180 +static MODEL Models[] = {
181 + {0x01, "FC20X2JA", 2, 20, 0, 1},
182 + {0xff, "Unknown", -1, -1, 0, 0}
186 +/****************************************/
187 +/*** hardware dependant functions ***/
188 +/****************************************/
190 +static void drv_FC_clear(void)
192 + drv_generic_serial_write("\014", 1); /* Clear Screen */
197 +static void drv_FC_write(const int row, const int col, const char *data, const int len)
200 + int target = (row * DCOLS) + col;
204 + buf = malloc(len + 1);
205 + memcpy(buf, data, len);
209 + for (i = 0; i < -target; i++)
210 + drv_generic_serial_write("\x08", 1);
212 + for (i = 0; i < target; i++)
213 + drv_generic_serial_write("\x09", 1);
215 + cur_pos += target + len;
216 + if (cur_pos >= (DROWS * DCOLS))
219 + drv_generic_serial_write(data, len);
223 +static void drv_FC_defchar(const int ascii, const unsigned char *matrix)
226 + char cmd[11] = "\x1aN";
228 + cmd[2] = (char) ascii;
229 + for (i = 0; i < 8; i++) {
230 + cmd[i + 3] = matrix[i] & 0x1f;
232 + drv_generic_serial_write(cmd, 11);
236 +static int drv_FC_contrast(int contrast)
238 + char c = (char) contrast;
243 + drv_generic_serial_write(&c, 1);
248 +static int drv_FC_start(const char *section, const int quiet)
254 + model = cfg_get(section, "Model", NULL);
255 + if (model != NULL && *model != '\0') {
256 + for (i = 0; Models[i].type != 0xff; i++) {
257 + if (strcasecmp(Models[i].name, model) == 0)
260 + if (Models[i].type == 0xff) {
261 + error("%s: %s.Model '%s' is unknown from %s", Name, section, model, cfg_source());
265 + info("%s: using model '%s'", Name, Models[Model].name);
267 + info("%s: no '%s.Model' entry from %s, auto-dedecting", Name, section, cfg_source());
272 + if (drv_generic_serial_open(section, Name, 0) < 0)
275 + /* initialize global variables */
276 + DROWS = Models[Model].rows;
277 + DCOLS = Models[Model].cols;
278 + GPOS = Models[Model].gpos;
279 + Protocol = Models[Model].protocol;
283 + drv_generic_serial_write("\x01", 1); /* 100% lum */
284 + drv_generic_serial_write("\x14", 1); /* cursor on */
285 + drv_generic_serial_write("\x11", 1); /* scroll write */
288 + if (cfg_number(section, "Contrast", 0, 0, 255, &i) > 0) {
289 + drv_FC_contrast(i);
296 +/****************************************/
298 +/****************************************/
301 +static void plugin_contrast(RESULT * result, const int argc, RESULT * argv[])
307 + contrast = drv_FC_contrast(-1);
308 + SetResult(&result, R_NUMBER, &contrast);
311 + contrast = drv_FC_contrast(R2N(argv[0]));
312 + SetResult(&result, R_NUMBER, &contrast);
315 + error("%s::contrast(): wrong number of parameters", Name);
316 + SetResult(&result, R_STRING, "");
322 +/****************************************/
323 +/*** widget callbacks ***/
324 +/****************************************/
326 +/* using drv_generic_text_draw(W) */
327 +/* using drv_generic_text_icon_draw(W) */
328 +/* using drv_generic_text_bar_draw(W) */
331 +/****************************************/
332 +/*** exported functions ***/
333 +/****************************************/
337 +int drv_FC_list(void)
341 + for (i = 0; Models[i].type != 0xff; i++) {
342 + printf("%s ", Models[i].name);
348 +/* initialize driver & display */
349 +int drv_FC_init(const char *section, const int quiet)
354 + /* display preferences */
355 + XRES = 5; /* pixel width of one char */
356 + YRES = 8; /* pixel height of one char */
357 + CHARS = 8; /* number of user-defineable characters */
358 + CHAR0 = 0; /* ASCII of first user-defineable char */
359 + GOTO_COST = 4; /* number of bytes a goto command requires */
361 + /* real worker functions */
362 + drv_generic_text_real_write = drv_FC_write;
363 + drv_generic_text_real_defchar = drv_FC_defchar;
366 + /* start display */
367 + if ((ret = drv_FC_start(section, quiet)) != 0)
370 + /* initialize generic text driver */
371 + if ((ret = drv_generic_text_init(section, Name)) != 0)
374 + /* initialize generic icon driver */
375 + if ((ret = drv_generic_text_icon_init()) != 0)
378 + /* initialize generic bar driver */
379 + if ((ret = drv_generic_text_bar_init(0)) != 0)
382 + /* add fixed chars to the bar driver */
383 + drv_generic_text_bar_add_segment(0, 0, 255, 32); /* ASCII 32 = blank */
384 + drv_generic_text_bar_add_segment(255, 255, 255, 255); /* ASCII 255 = block */
386 + /* register text widget */
388 + wc.draw = drv_generic_text_draw;
389 + widget_register(&wc);
391 + /* register icon widget */
393 + wc.draw = drv_generic_text_icon_draw;
394 + widget_register(&wc);
396 + /* register bar widget */
398 + wc.draw = drv_generic_text_bar_draw;
399 + widget_register(&wc);
401 + /* register plugins */
402 + AddFunction("LCD::contrast", -1, plugin_contrast);
408 +/* close driver & display */
409 +int drv_FC_quit(const int quiet)
412 + info("%s: shutting down.", Name);
414 + drv_generic_text_quit();
416 + /* clear display */
419 + /* say goodbye... */
421 + drv_generic_text_greet("goodbye!", NULL);
424 + drv_generic_serial_close();
430 +DRIVER drv_NEC_FC = {