/* $Id$ * $URL$ * * LED matrix driver for LCD4Linux * (see http://www.harbaum.org/till/ledmatrix for hardware) * * Copyright (C) 2006 Till Harbaum * * This file is part of LCD4Linux. * * LCD4Linux is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * LCD4Linux is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* * * exported fuctions: * * struct DRIVER drv_LEDMatrix * */ /* * Options: * IPAddress */ #include "config.h" #include #include #include #include #include #include #include #include /* include network specific headers */ #include #include #include #include #include #include "debug.h" #include "cfg.h" #include "qprintf.h" #include "plugin.h" #include "widget.h" #include "widget_text.h" #include "widget_icon.h" #include "widget_bar.h" #include "drv.h" #include "drv_generic_graphic.h" /* display command bytes */ #define DSP_CMD_ECHO 0 #define DSP_CMD_NOP 1 #define DSP_CMD_IMAGE 2 #define DSP_CMD_ACK 3 #define DSP_CMD_IR 4 #define DSP_CMD_BEEP 5 #define DSP_DEFAULT_PORT 4711 #define DSP_MEM (80 * 32 * 2 / 8) #define DEFAULT_X_OFFSET 1 /* with a font width of 6 */ static char Name[] = "LEDMatrix"; static char *IPAddress = NULL; static int sock = -1; static struct sockaddr_in dsp_addr; static unsigned char tx_buffer[DSP_MEM + 1]; static int port = DSP_DEFAULT_PORT; static void drv_LEDMatrix_blit(const int row, const int col, const int height, const int width) { int r, c, i; fd_set rfds; struct timeval tv; unsigned char reply[256]; struct sockaddr_in cli_addr; socklen_t fromlen; int ack = 0; int timeout = 10; for (r = row; r < row + height; r++) { for (c = col; c < col + width; c++) { /* LEDMATRIX supports three colors: 10b == green, 01b == red, 11b == amber */ unsigned char color = 0; RGBA p = drv_generic_graphic_rgb(r, c); if (p.G >= 128) color |= 0x80; if (p.R >= 128) color |= 0x40; /* ignore blue ... */ tx_buffer[1 + 20 * r + c / 4] &= ~(0xc0 >> (2 * (c & 3))); tx_buffer[1 + 20 * r + c / 4] |= color >> (2 * (c & 3)); } } /* scan entire display */ tx_buffer[0] = DSP_CMD_IMAGE; do { if ((sendto(sock, tx_buffer, DSP_MEM + 1, 0, (struct sockaddr *) &dsp_addr, sizeof(dsp_addr))) != DSP_MEM + 1) error("%s: sendto error on socket", Name); /* now wait for reply */ FD_ZERO(&rfds); FD_SET(sock, &rfds); tv.tv_sec = 0; tv.tv_usec = 100000; /* wait 1 sec for ack */ if ((i = select(FD_SETSIZE, &rfds, NULL, NULL, &tv)) < 0) { info("%s: Select error: %s", Name, strerror(errno)); } if (FD_ISSET(sock, &rfds)) { /* wait for ack */ fromlen = sizeof(dsp_addr); i = recvfrom(sock, reply, sizeof(reply), 0, (struct sockaddr *) &cli_addr, &fromlen); if (i < 0) { info("%s: Receive error: %s", Name, strerror(errno)); } else { if ((i == 2) && (reply[0] == DSP_CMD_ACK) && (reply[1] == DSP_CMD_IMAGE)) { ack = 1; } else if ((i > 1) && (reply[0] == DSP_CMD_IR)) { /* maybe used later: */ /* ir_receive(reply+1, i-1); */ } else { info("%s: Unexpected reply message", Name); } } } timeout--; } while ((!ack) && (timeout > 0)); if (timeout == 0) { error("%s: display reply t
#
# $Id: README.KDE,v 1.1 2000/04/03 06:53:09 reinelt Exp $
#

This is the README file for the KDE integration of lcd4linux


First: lcd4linux is  NO  KDE program!

But: lcd4linux with the X11-driver can be integrated in KDE, so that it
drives a little window in the KDE panel.

This so called 'swallowing on panel' can be accomplished by using a .kdelnk
file and a special configuration. Both files come with this package, but should
be adopted to your needs.

The KDE panel windows must have a size of 45x45 pixels. We get this size by
using a size of 6x5 characters, each character has 6x8 pixels. By using
a horizontal gap of 1 pixel between characters, we get a size of 

horizontal: 6 chars * 6 pixels + 5 gaps = 41 pixels
vertical:   5 chars * 8 pixels          = 40 pixels

With a border size of 2 pixels this gives a size of 45 x 44 pixels. Great!

I prefer using 5 vertical bars (load avg, CPU busy, CPU system, disk read+write,
network receive+transmit, ISDN in+out), but you use any other combination you
like.


INSTALLATION:

* download and compile lcd4linux
* edit lcd4linux.kdelnk and copy to $KDEDIR/share/applnk/apps/System
* copy lcd4linux.xpm to $KDEDIR/share/icons
* copy lcd4kde.conf to /etc
* create a /etc/lcd4X11.conf (this will be used if you start lcd4linux from the menu
  or by clicking on the panel window
* use "Panel/Add Application" from the K menu to create a panel entry
* restart KPanel

Enjoy!