Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 108650
Collapse All | Expand All

(-)lcdproc-0.4.5/LCDd.conf (+5 lines)
Lines 41-46 Link Here
41
# Server section with all kinds of settings for the LCDd server
41
# Server section with all kinds of settings for the LCDd server
42
42
43
Driver=none
43
Driver=none
44
#Driver=imon
44
#Driver=curses
45
#Driver=curses
45
#Driver=HD44780
46
#Driver=HD44780
46
#Driver=lcdm001
47
#Driver=lcdm001
Lines 537-543 Link Here
537
# display size [20x4]
538
# display size [20x4]
538
size=20x4
539
size=20x4
539
540
541
[imon]
542
# Ahanix/Soundgraph IMON driver
540
543
544
Size=16x2
545
Device=/dev/lcd0
541
546
542
547
543
[Wirz-sli]
548
[Wirz-sli]
(-)lcdproc-0.4.5/acconfig.h (+2 lines)
Lines 74-79 Link Here
74
74
75
#undef T6963_DRV
75
#undef T6963_DRV
76
76
77
#undef IMON_DRV
78
77
/* Define the package name */
79
/* Define the package name */
78
#undef PACKAGE
80
#undef PACKAGE
79
81
(-)lcdproc-0.4.5/acinclude.m4 (-3 / +8 lines)
Lines 8-20 Link Here
8
 	[                    mtxorb,cfontz,cwlnx,curses,text,lb216,]
8
 	[                    mtxorb,cfontz,cwlnx,curses,text,lb216,]
9
 	[                    hd44780,joy,irman,lircin,bayrad,glk,]
9
 	[                    hd44780,joy,irman,lircin,bayrad,glk,]
10
 	[                    stv5730,sed1330,sed1520,svgalib,lcdm001,]
10
 	[                    stv5730,sed1330,sed1520,svgalib,lcdm001,]
11
 	[                    t6963,wirz-sli,sgx120]
11
 	[                    t6963,wirz-sli,sgx120,imon]
12
	[                  \"all\" compiles all drivers],
12
	[                  \"all\" compiles all drivers],
13
  	drivers="$enableval", 
13
  	drivers="$enableval", 
14
  	drivers=[lcdm001,mtxorb,cfontz,cwlnx,curses,text,lb216,bayrad,glk,sgx120])
14
  	drivers=[lcdm001,mtxorb,cfontz,cwlnx,curses,text,lb216,bayrad,glk,sgx120,imon])
15
15
16
if test "$drivers" = "all"; then
16
if test "$drivers" = "all"; then
17
	drivers=[mtxorb,cfontz,cwlnx,curses,text,lb216,hd44780,joy,irman,lircin,bayrad,glk,stv5730,sed1330,sed1520,svgalib,lcdm001,t6963,wirz-sli,sgx120]
17
	drivers=[mtxorb,cfontz,cwlnx,curses,text,lb216,hd44780,joy,irman,lircin,bayrad,glk,stv5730,sed1330,sed1520,svgalib,lcdm001,t6963,wirz-sli,sgx120,imon]
18
fi
18
fi
19
19
20
  	drivers=`echo $drivers | sed 's/,/ /g'`
20
  	drivers=`echo $drivers | sed 's/,/ /g'`
Lines 121-126 Link Here
121
			AC_DEFINE(TEXT_DRV)
121
			AC_DEFINE(TEXT_DRV)
122
			actdrivers=["$actdrivers text"]
122
			actdrivers=["$actdrivers text"]
123
			;;
123
			;;
124
		imon)
125
			DRIVERS="$DRIVERS imon.o"
126
			AC_DEFINE(IMON_DRV)
127
			actdrivers=["$actdrivers imon"]
128
			;;
124
		lb216)
129
		lb216)
125
			DRIVERS="$DRIVERS lb216.o"
130
			DRIVERS="$DRIVERS lb216.o"
126
			AC_DEFINE(LB216_DRV)
131
			AC_DEFINE(LB216_DRV)
(-)lcdproc-0.4.5/server/drivers/Makefile.am (+1 lines)
Lines 1-6 Link Here
1
noinst_LIBRARIES = libLCDdrivers.a
1
noinst_LIBRARIES = libLCDdrivers.a
2
libLCDdrivers_a_SOURCES = lcd.c lcd.h lcd_lib.c lcd_lib.h
2
libLCDdrivers_a_SOURCES = lcd.c lcd.h lcd_lib.c lcd_lib.h
3
EXTRA_libLCDdrivers_a_SOURCES = MtxOrb.c MtxOrb.h text.c text.h \
3
EXTRA_libLCDdrivers_a_SOURCES = MtxOrb.c MtxOrb.h text.c text.h \
4
	imon.c imon.h \
4
        lcdm001.c lcdm001.h \
5
        lcdm001.c lcdm001.h \
5
        curses_drv.c curses_drv.h drv_base.h \
6
        curses_drv.c curses_drv.h drv_base.h \
6
        hd44780.c hd44780.h lb216.c lb216.h \
7
        hd44780.c hd44780.h lb216.c lb216.h \
(-)lcdproc-0.4.5/server/drivers/imon.c (+224 lines)
Line 0 Link Here
1
/**
2
 * Driver for Ahanix/Soundgraph IMON IR/VFD Module
3
 *
4
 * (C) 2004, Venky Raju <dev@venky.ws>
5
 *
6
 * This source code is being released under the GPL.
7
 * Please see the file COPYING in this package for details.
8
 *
9
 * Inspired by:
10
 * 	TextMode driver (LCDproc authors?)
11
 *	Sasem driver	(Oliver Stabel)
12
 */
13
14
#include <stdlib.h>
15
#include <stdio.h>
16
#include <unistd.h>
17
#include <termios.h>
18
#include <fcntl.h>
19
#include <string.h>
20
#include <sys/errno.h>
21
#include <syslog.h>
22
23
#include "lcd.h"
24
#include "imon.h"
25
#include "drv_base.h"
26
#include "shared/report.h"
27
#include "configfile.h"
28
29
#define PAD 			'#'
30
#define DEFAULT_DEVICE		"/dev/usb/lcd"
31
#define DEFAULT_SIZE		"16x2"
32
33
/**
34
 * Function prototypes
35
 */
36
static void imon_close ();
37
static void imon_clear ();
38
static void imon_flush ();
39
static void imon_string (int x, int y, char string[]);
40
static void imon_chr (int x, int y, char c);
41
/* static int imon_contrast (int contrast); */
42
/* static void imon_backlight (int on); */
43
/* static void imon_init_vbar (); */
44
/* static void imon_init_hbar (); */
45
/* static void imon_init_num (); */
46
static void imon_vbar (int x, int len);
47
static void imon_hbar (int x, int y, int len);
48
/* static void imon_num (int x, int num); */
49
/* static void imon_set_char (int n, char *dat); */
50
/* static void imon_flush_box (int lft, int top, int rgt, int bot); */
51
static void imon_draw_frame (char *dat);
52
53
lcd_logical_driver *imon;
54
static int imon_fd;
55
56
				
57
/* The two value below are fake, we don't support custom char. */
58
#define VFD_DEFAULT_CELL_WIDTH 5
59
#define VFD_DEFAULT_CELL_HEIGHT 8
60
61
int imon_init (lcd_logical_driver * driver, char *args)
62
{
63
	char buf[256];
64
	int width=0, height=0;
65
66
	imon = driver;
67
68
	/* TODO?: replace DriverName with driver->name when that field exists.*/
69
	#define DriverName "imon"
70
71
	/* Get settings from config file*/
72
73
	/* Get device */
74
	strncpy (buf, config_get_string (DriverName, "device", 0, DEFAULT_DEVICE), sizeof (buf));
75
	buf [sizeof(buf)-1] = 0;
76
	report (RPT_INFO, "imon: using device %s", buf);
77
78
	/* Open device for writing */
79
	if ((imon_fd = open (buf, O_WRONLY)) < 0) {
80
81
		report (RPT_ERR, "imon: error opening %s (%s)", buf, strerror (errno));
82
		return -1;
83
	}
84
85
	/* Get size settings*/
86
	strncpy (buf, config_get_string (DriverName , "Size" , 0 , DEFAULT_SIZE), sizeof(buf));
87
	buf[sizeof(buf)-1] = 0;
88
	if (sscanf(buf , "%dx%d", &width, &height ) != 2 || (width <= 0) || (height <= 0)) {
89
		report (RPT_WARNING, "imon: cannot read size: %s. Using default value %s.\n", 
90
				buf, DEFAULT_SIZE);
91
		sscanf (DEFAULT_SIZE , "%dx%d", &width, &height );
92
	}
93
94
	imon->wid = width;
95
	imon->hgt = height;
96
97
	/* Make sure the frame buffer is there... */
98
	if (!imon->framebuf)
99
		imon->framebuf = (unsigned char *) malloc (imon->wid * imon->hgt);
100
	memset (imon->framebuf, ' ', imon->wid * imon->hgt);
101
102
	imon->cellwid = VFD_DEFAULT_CELL_WIDTH;
103
	imon->cellhgt = VFD_DEFAULT_CELL_HEIGHT;
104
105
	/* Set the functions the driver supports */
106
	imon->clear = imon_clear;
107
	imon->string = imon_string;
108
	imon->chr = imon_chr;
109
	imon->vbar = imon_vbar;
110
	imon->hbar = imon_hbar;
111
	/* imon->init_vbar = NULL; */
112
	/* imon->init_hbar = NULL; */
113
	/* imon->num = imon_num; */
114
	/* imon->init_num = NULL; */
115
	imon->init = imon_init;
116
	imon->close = imon_close;
117
	imon->flush = imon_flush;
118
	/* imon->flush_box = NULL; */ 
119
	/* imon->contrast = NULL; */ 
120
	/* imon->backlight = NULL; */
121
	/* imon->set_char = NULL; */
122
	/* imon->icon = NULL; */
123
	imon->draw_frame = imon_draw_frame;
124
	/* imon->getkey = NULL; */
125
126
	return !0;		 
127
}
128
129
static void imon_close ()
130
{
131
	if (imon->framebuf != NULL)
132
		free (imon->framebuf);
133
134
	imon->framebuf = NULL;
135
	close (imon_fd);
136
}
137
138
/** 
139
 * Clears the VFD screen 
140
 */
141
static void imon_clear ()
142
{
143
	memset (imon->framebuf, ' ', imon->wid * imon->hgt);
144
}
145
146
/**
147
 * Flushes all output to the VFD...  
148
 */
149
static void imon_flush ()
150
{
151
	imon_draw_frame (imon->framebuf);
152
}
153
154
/**
155
 * Prints a string on the VFD display, at position (x,y).
156
 * The upper-left is (1,1) and the lower right is (16, 2).  
157
 */
158
static void imon_string (int x, int y, char string[])
159
{
160
	int i;
161
162
	for (i = 0; string[i]; i++)
163
		imon_chr (x+i, y, string [i]);
164
}
165
166
167
/**
168
 * Prints a character on the VFD display, at position (x,y).
169
 * The upper-left is (1,1) and the lower right is (16,2).
170
 */
171
static void imon_chr (int x, int y, char ch)
172
{
173
	y--; x--;
174
175
	switch (ch) {
176
177
		case 0:
178
		case -1:	
179
			ch = PAD;
180
			break;
181
		default:
182
			;
183
	}
184
185
	imon->framebuf[(y * imon->wid) + x] = ch;
186
}
187
188
/**
189
 * Draws a vertical bar; erases entire column onscreen.
190
 */
191
static void imon_vbar (int x, int len)
192
{
193
	int y;
194
	for (y = imon->hgt; y > 0 && len > 0; y--) {
195
196
		imon_chr (x, y, '|');
197
		len -= imon->cellhgt;
198
	}
199
200
}
201
202
/**
203
 * Draws a horizontal bar to the right.
204
 */
205
static void imon_hbar (int x, int y, int len)
206
{
207
	for (; x <= imon->wid && len > 0; x++) {
208
209
		imon_chr (x, y, '-');
210
		len -= imon->cellwid;
211
	}
212
213
}
214
215
static void imon_flush_box (int lft, int top, int rgt, int bot)
216
{
217
	imon_flush ();
218
}
219
220
static void imon_draw_frame (char *dat)
221
{
222
	write (imon_fd, dat, 32);
223
}
224
(-)lcdproc-0.4.5/server/drivers/imon.h (+21 lines)
Line 0 Link Here
1
/**
2
 * Driver for Ahanix/Soundgraph IMON IR/VFD Module
3
 *
4
 * (C) 2004, Venky Raju <dev@venky.ws>
5
 *
6
 * This source code is being released under the GPL.
7
 * Please see the file COPYING in this package for details.
8
 *
9
 * Inspired by:
10
 * 	TextMode driver (LCDproc authors?)
11
 *	Sasem driver	(Oliver Stabel)
12
 */
13
14
#ifndef IMON_H
15
#define IMON_H
16
17
extern lcd_logical_driver *imon;
18
19
int imon_init (struct lcd_logical_driver *driver, char *args);
20
21
#endif
(-)lcdproc-0.4.5/server/drivers/lcd.c (+7 lines)
Lines 87-92 Link Here
87
#include "text.h"
87
#include "text.h"
88
#endif
88
#endif
89
89
90
#ifdef IMON_DRV
91
#include "imon.h"
92
#endif
93
90
#ifdef DEBUG_DRV
94
#ifdef DEBUG_DRV
91
#include "debug.h"
95
#include "debug.h"
92
#endif
96
#endif
Lines 200-205 Link Here
200
#ifdef TEXT_DRV
204
#ifdef TEXT_DRV
201
	{"text", text_init,},
205
	{"text", text_init,},
202
#endif
206
#endif
207
#ifdef IMON_DRV
208
	{"imon", imon_init,},
209
#endif
203
#ifdef DEBUG_DRV
210
#ifdef DEBUG_DRV
204
	{"debug", debug_init,},
211
	{"debug", debug_init,},
205
#endif
212
#endif

Return to bug 108650