SOURCES: lcdproc-imon.patch (NEW) - adds support for iMON LCD pane...
czarny
czarny at pld-linux.org
Mon Nov 6 22:59:27 CET 2006
Author: czarny Date: Mon Nov 6 21:59:26 2006 GMT
Module: SOURCES Tag: HEAD
---- Log message:
- adds support for iMON LCD panel used in various, mostly HTPC, cases (including my new Thermalake Mozart Silver ;)
- extracted ouf of tweaked lcdproc from http://venky.ws/projects/imon/
---- Files affected:
SOURCES:
lcdproc-imon.patch (NONE -> 1.1) (NEW)
---- Diffs:
================================================================
Index: SOURCES/lcdproc-imon.patch
diff -u /dev/null SOURCES/lcdproc-imon.patch:1.1
--- /dev/null Mon Nov 6 22:59:26 2006
+++ SOURCES/lcdproc-imon.patch Mon Nov 6 22:59:20 2006
@@ -0,0 +1,365 @@
+diff -urN lcdproc-0.4.5/acconfig.h lcdproc-0.4.5-imon/acconfig.h
+--- lcdproc-0.4.5/acconfig.h 2004-03-14 16:50:22.000000000 +0100
++++ lcdproc-0.4.5-imon/acconfig.h 2005-01-24 01:48:31.000000000 +0100
+@@ -74,6 +74,8 @@
+
+ #undef T6963_DRV
+
++#undef IMON_DRV
++
+ /* Define the package name */
+ #undef PACKAGE
+
+diff -urN lcdproc-0.4.5/acinclude.m4 lcdproc-0.4.5-imon/acinclude.m4
+--- lcdproc-0.4.5/acinclude.m4 2004-03-14 16:50:22.000000000 +0100
++++ lcdproc-0.4.5-imon/acinclude.m4 2005-01-24 01:48:31.000000000 +0100
+@@ -8,13 +8,13 @@
+ [ mtxorb,cfontz,cwlnx,curses,text,lb216,]
+ [ hd44780,joy,irman,lircin,bayrad,glk,]
+ [ stv5730,sed1330,sed1520,svgalib,lcdm001,]
+- [ t6963,wirz-sli,sgx120]
++ [ t6963,wirz-sli,sgx120,imon]
+ [ \"all\" compiles all drivers],
+ drivers="$enableval",
+- drivers=[lcdm001,mtxorb,cfontz,cwlnx,curses,text,lb216,bayrad,glk,sgx120])
++ drivers=[lcdm001,mtxorb,cfontz,cwlnx,curses,text,lb216,bayrad,glk,sgx120,imon])
+
+ if test "$drivers" = "all"; then
+- drivers=[mtxorb,cfontz,cwlnx,curses,text,lb216,hd44780,joy,irman,lircin,bayrad,glk,stv5730,sed1330,sed1520,svgalib,lcdm001,t6963,wirz-sli,sgx120]
++ drivers=[mtxorb,cfontz,cwlnx,curses,text,lb216,hd44780,joy,irman,lircin,bayrad,glk,stv5730,sed1330,sed1520,svgalib,lcdm001,t6963,wirz-sli,sgx120,imon]
+ fi
+
+ drivers=`echo $drivers | sed 's/,/ /g'`
+@@ -121,6 +121,11 @@
+ AC_DEFINE(TEXT_DRV)
+ actdrivers=["$actdrivers text"]
+ ;;
++ imon)
++ DRIVERS="$DRIVERS imon.o"
++ AC_DEFINE(IMON_DRV)
++ actdrivers=["$actdrivers imon"]
++ ;;
+ lb216)
+ DRIVERS="$DRIVERS lb216.o"
+ AC_DEFINE(LB216_DRV)
+diff -urN lcdproc-0.4.5/LCDd.conf lcdproc-0.4.5-imon/LCDd.conf
+--- lcdproc-0.4.5/LCDd.conf 2004-03-14 16:50:22.000000000 +0100
++++ lcdproc-0.4.5-imon/LCDd.conf 2005-01-24 01:48:31.000000000 +0100
+@@ -40,7 +40,7 @@
+ [server]
+ # Server section with all kinds of settings for the LCDd server
+
+-Driver=none
++Driver=imon
+ #Driver=curses
+ #Driver=HD44780
+ #Driver=lcdm001
+@@ -78,7 +78,7 @@
+ # yes : always,
+ # no : when there are no other screens active.
+
+-Foreground=yes
++Foreground=no
+ # The server will stay in the foreground if set to true.
+ # Otherwise the server will fork to background and report
+ # to syslog
+@@ -537,7 +537,11 @@
+ # display size [20x4]
+ size=20x4
+
++[imon]
++# Ahanix/Soundgraph IMON driver
+
++Size=16x2
++Device=/dev/lcd0
+
+
+ [Wirz-sli]
+diff -urN lcdproc-0.4.5/server/drivers/imon.c lcdproc-0.4.5-imon/server/drivers/imon.c
+--- lcdproc-0.4.5/server/drivers/imon.c 1970-01-01 01:00:00.000000000 +0100
++++ lcdproc-0.4.5-imon/server/drivers/imon.c 2005-01-24 01:48:31.000000000 +0100
+@@ -0,0 +1,224 @@
++/**
++ * Driver for Ahanix/Soundgraph IMON IR/VFD Module
++ *
++ * (C) 2004, Venky Raju <dev at venky.ws>
++ *
++ * This source code is being released under the GPL.
++ * Please see the file COPYING in this package for details.
++ *
++ * Inspired by:
++ * TextMode driver (LCDproc authors?)
++ * Sasem driver (Oliver Stabel)
++ */
++
++#include <stdlib.h>
++#include <stdio.h>
++#include <unistd.h>
++#include <termios.h>
++#include <fcntl.h>
++#include <string.h>
++#include <sys/errno.h>
++#include <syslog.h>
++
++#include "lcd.h"
++#include "imon.h"
++#include "drv_base.h"
++#include "shared/report.h"
++#include "configfile.h"
++
++#define PAD '#'
++#define DEFAULT_DEVICE "/dev/usb/lcd"
++#define DEFAULT_SIZE "16x2"
++
++/**
++ * Function prototypes
++ */
++static void imon_close ();
++static void imon_clear ();
++static void imon_flush ();
++static void imon_string (int x, int y, char string[]);
++static void imon_chr (int x, int y, char c);
++/* static int imon_contrast (int contrast); */
++/* static void imon_backlight (int on); */
++/* static void imon_init_vbar (); */
++/* static void imon_init_hbar (); */
++/* static void imon_init_num (); */
++static void imon_vbar (int x, int len);
++static void imon_hbar (int x, int y, int len);
++/* static void imon_num (int x, int num); */
++/* static void imon_set_char (int n, char *dat); */
++/* static void imon_flush_box (int lft, int top, int rgt, int bot); */
++static void imon_draw_frame (char *dat);
++
++lcd_logical_driver *imon;
++static int imon_fd;
++
++
++/* The two value below are fake, we don't support custom char. */
++#define VFD_DEFAULT_CELL_WIDTH 5
++#define VFD_DEFAULT_CELL_HEIGHT 8
++
++int imon_init (lcd_logical_driver * driver, char *args)
++{
++ char buf[256];
++ int width=0, height=0;
++
++ imon = driver;
++
++ /* TODO?: replace DriverName with driver->name when that field exists.*/
++ #define DriverName "imon"
++
++ /* Get settings from config file*/
++
++ /* Get device */
++ strncpy (buf, config_get_string (DriverName, "device", 0, DEFAULT_DEVICE), sizeof (buf));
++ buf [sizeof(buf)-1] = 0;
++ report (RPT_INFO, "imon: using device %s", buf);
++
++ /* Open device for writing */
++ if ((imon_fd = open (buf, O_WRONLY)) < 0) {
++
++ report (RPT_ERR, "imon: error opening %s (%s)", buf, strerror (errno));
++ return -1;
++ }
++
++ /* Get size settings*/
++ strncpy (buf, config_get_string (DriverName , "Size" , 0 , DEFAULT_SIZE), sizeof(buf));
++ buf[sizeof(buf)-1] = 0;
++ if (sscanf(buf , "%dx%d", &width, &height ) != 2 || (width <= 0) || (height <= 0)) {
++ report (RPT_WARNING, "imon: cannot read size: %s. Using default value %s.\n",
++ buf, DEFAULT_SIZE);
++ sscanf (DEFAULT_SIZE , "%dx%d", &width, &height );
++ }
++
++ imon->wid = width;
++ imon->hgt = height;
++
++ /* Make sure the frame buffer is there... */
++ if (!imon->framebuf)
++ imon->framebuf = (unsigned char *) malloc (imon->wid * imon->hgt);
++ memset (imon->framebuf, ' ', imon->wid * imon->hgt);
++
++ imon->cellwid = VFD_DEFAULT_CELL_WIDTH;
++ imon->cellhgt = VFD_DEFAULT_CELL_HEIGHT;
++
++ /* Set the functions the driver supports */
++ imon->clear = imon_clear;
++ imon->string = imon_string;
++ imon->chr = imon_chr;
++ imon->vbar = imon_vbar;
++ imon->hbar = imon_hbar;
++ /* imon->init_vbar = NULL; */
++ /* imon->init_hbar = NULL; */
++ /* imon->num = imon_num; */
++ /* imon->init_num = NULL; */
++ imon->init = imon_init;
++ imon->close = imon_close;
++ imon->flush = imon_flush;
++ /* imon->flush_box = NULL; */
++ /* imon->contrast = NULL; */
++ /* imon->backlight = NULL; */
++ /* imon->set_char = NULL; */
++ /* imon->icon = NULL; */
++ imon->draw_frame = imon_draw_frame;
++ /* imon->getkey = NULL; */
++
++ return !0;
++}
++
++static void imon_close ()
++{
++ if (imon->framebuf != NULL)
++ free (imon->framebuf);
++
++ imon->framebuf = NULL;
++ close (imon_fd);
++}
++
++/**
++ * Clears the VFD screen
++ */
++static void imon_clear ()
++{
++ memset (imon->framebuf, ' ', imon->wid * imon->hgt);
++}
++
++/**
++ * Flushes all output to the VFD...
++ */
++static void imon_flush ()
++{
++ imon_draw_frame (imon->framebuf);
++}
++
++/**
++ * Prints a string on the VFD display, at position (x,y).
++ * The upper-left is (1,1) and the lower right is (16, 2).
++ */
++static void imon_string (int x, int y, char string[])
++{
++ int i;
++
++ for (i = 0; string[i]; i++)
++ imon_chr (x+i, y, string [i]);
++}
++
++
++/**
++ * Prints a character on the VFD display, at position (x,y).
++ * The upper-left is (1,1) and the lower right is (16,2).
++ */
++static void imon_chr (int x, int y, char ch)
++{
++ y--; x--;
++
++ switch (ch) {
++
++ case 0:
++ case -1:
++ ch = PAD;
++ break;
++ default:
++ ;
++ }
++
++ imon->framebuf[(y * imon->wid) + x] = ch;
++}
++
++/**
++ * Draws a vertical bar; erases entire column onscreen.
++ */
++static void imon_vbar (int x, int len)
++{
++ int y;
++ for (y = imon->hgt; y > 0 && len > 0; y--) {
++
++ imon_chr (x, y, '|');
++ len -= imon->cellhgt;
++ }
++
++}
++
++/**
++ * Draws a horizontal bar to the right.
++ */
++static void imon_hbar (int x, int y, int len)
++{
++ for (; x <= imon->wid && len > 0; x++) {
++
++ imon_chr (x, y, '-');
++ len -= imon->cellwid;
++ }
++
++}
++
++static void imon_flush_box (int lft, int top, int rgt, int bot)
++{
++ imon_flush ();
++}
++
++static void imon_draw_frame (char *dat)
++{
++ write (imon_fd, dat, 32);
++}
++
+diff -urN lcdproc-0.4.5/server/drivers/imon.h lcdproc-0.4.5-imon/server/drivers/imon.h
+--- lcdproc-0.4.5/server/drivers/imon.h 1970-01-01 01:00:00.000000000 +0100
++++ lcdproc-0.4.5-imon/server/drivers/imon.h 2005-01-24 01:48:31.000000000 +0100
+@@ -0,0 +1,21 @@
++/**
++ * Driver for Ahanix/Soundgraph IMON IR/VFD Module
++ *
++ * (C) 2004, Venky Raju <dev at venky.ws>
++ *
++ * This source code is being released under the GPL.
++ * Please see the file COPYING in this package for details.
++ *
++ * Inspired by:
++ * TextMode driver (LCDproc authors?)
++ * Sasem driver (Oliver Stabel)
++ */
++
++#ifndef IMON_H
++#define IMON_H
++
++extern lcd_logical_driver *imon;
++
++int imon_init (struct lcd_logical_driver *driver, char *args);
++
++#endif
+diff -urN lcdproc-0.4.5/server/drivers/lcd.c lcdproc-0.4.5-imon/server/drivers/lcd.c
+--- lcdproc-0.4.5/server/drivers/lcd.c 2004-03-14 16:50:25.000000000 +0100
++++ lcdproc-0.4.5-imon/server/drivers/lcd.c 2005-01-24 01:48:31.000000000 +0100
+@@ -87,6 +87,10 @@
+ #include "text.h"
+ #endif
+
++#ifdef IMON_DRV
++#include "imon.h"
++#endif
++
+ #ifdef DEBUG_DRV
+ #include "debug.h"
+ #endif
+@@ -200,6 +204,9 @@
+ #ifdef TEXT_DRV
+ {"text", text_init,},
+ #endif
++#ifdef IMON_DRV
++ {"imon", imon_init,},
++#endif
+ #ifdef DEBUG_DRV
+ {"debug", debug_init,},
+ #endif
+diff -urN lcdproc-0.4.5/server/drivers/Makefile.am lcdproc-0.4.5-imon/server/drivers/Makefile.am
+--- lcdproc-0.4.5/server/drivers/Makefile.am 2004-03-14 16:50:25.000000000 +0100
++++ lcdproc-0.4.5-imon/server/drivers/Makefile.am 2005-01-24 01:48:31.000000000 +0100
+@@ -1,6 +1,7 @@
+ noinst_LIBRARIES = libLCDdrivers.a
+ libLCDdrivers_a_SOURCES = lcd.c lcd.h lcd_lib.c lcd_lib.h
+ EXTRA_libLCDdrivers_a_SOURCES = MtxOrb.c MtxOrb.h text.c text.h \
++ imon.c imon.h \
+ lcdm001.c lcdm001.h \
+ curses_drv.c curses_drv.h drv_base.h \
+ hd44780.c hd44780.h lb216.c lb216.h \
================================================================
More information about the pld-cvs-commit
mailing list