/* $Id: isdn.c,v 1.13 2004/01/29 04:40:02 reinelt Exp $ * * ISDN specific functions * * Copyright 1999, 2000 Michael Reinelt * * 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. * * * $Log: isdn.c,v $ * Revision 1.13 2004/01/29 04:40:02 reinelt * every .c file includes "config.h" now * * Revision 1.12 2003/11/24 11:34:54 reinelt * * 'Fixed' Rows which do not scroll by Lars Kempe * temporary workaround for debian kernel-header bug * * Revision 1.11 2003/10/05 17:58:50 reinelt * libtool junk; copyright messages cleaned up * * Revision 1.10 2003/06/21 05:46:18 reinelt * DVB client integrated * * Revision 1.9 2001/05/27 07:19:28 reinelt * * fixed a warning in pixmap.c * temporarily fixed a bug in isdn.c (ISDN_MAX_CHANNELS is no longer defined?) * fixed a bug in configure.in (--with-drivers=xyz did not work) * * Revision 1.8 2000/08/10 18:42:20 reinelt * * fixed some bugs with the new syslog code * * Revision 1.7 2000/08/10 09:44:09 reinelt * * new debugging scheme: error(), info(), debug() * uses syslog if in daemon mode * * Revision 1.6 2000/04/15 11:56:35 reinelt * * more debug messages * * Revision 1.5 2000/03/13 15:58:24 reinelt * * release 0.9 * moved row parsing to parser.c * all basic work finished * * Revision 1.4 2000/03/10 17:36:02 reinelt * * first unstable but running release * * Revision 1.3 2000/03/07 11:01:34 reinelt * * system.c cleanup * * Revision 1.2 2000/03/06 06:04:06 reinelt * * minor cleanups * */ /* * exported functions: * * Isdn (int *rx, int *tx, int *usage) * returns 0 if ok, -1 if error * sets *usage to all channels USAGE or'ed together * sets received/transmitted bytes in *rx, *tx * */ #include "config.h" #include #include #include #include #include #include #include #include // Fixme: my debian has some bugs with kernel headers #if 0 #include #else #define IIOCGETCPS _IO('I',21) #endif // Fixme: ISDN_MAX_CHANNELS seems undefined in recent kernels #ifndef ISDN_MAX_CHANNELS #define ISDN_MAX_CHANNELS 64 #endif #include "debug.h" #include "isdn.h" #include "filter.h" typedef struct { unsigned long in; unsigned long out; } CPS; static int Usage (void) { static int fd=0; char buffer[4096], *p; int i, usage; if (fd==-1) return 0; fd=open ("/dev/isdninfo", O_RDONLY | O_NDELAY); if (fd==-1) { error ("open(/dev/isdninfo) failed: %s", strerror(errno)); return 0; } if (read (fd, buffer, sizeof(buffer))==-1) { error ("read(/dev/isdninfo) failed: %s", strerror(errno)); fd=-1; return 0; } if (close(fd)==-1) { error ("close(/dev/isdninfo) failed: %s", strerror(errno)); fd=-1; return 0; } p=strstr(buffer, "usage:"); if (p==NULL) { error ("parse(/dev/isdninfo) failed: no usage line"); fd=-1; return 0; } p+=6; usage=0; for (i=0; ipre { line-height: 125%; margin: 0; } td.linenos pre { color: #000000; background-color: #f0f0f0; padding: 0 5px 0 5px; } span.linenos { color: #000000; background-color: #f0f0f0; padding: 0 5px 0 5px; } td.linenos pre.special { color: #000000; background-color: #ffffc0; padding: 0 5px 0 5px; } span.linenos.special { color: #000000; background-color: #ffffc0; padding: 0 5px 0 5px; } .highlight .hll { background-color: #ffffcc } .highlight .c { color: #888888 } /* Comment */ .highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */ .highlight .k { color: #008800; font-weight: bold } /* Keyword */ .highlight .ch { color: #888888 } /* Comment.Hashbang */ .highlight .cm { color: #888888 } /* Comment.Multiline */ .highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */ .highlight .cpf { color: #888888 } /* Comment.PreprocFile */ .highlight .c1 { color: #888888 } /* Comment.Single */ .highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */ .highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ .highlight .ge { font-style: italic } /* Generic.Emph */ .highlight .gr { color: #aa0000 } /* Generic.Error */ .highlight .gh { color: #333333 } /* Generic.Heading */ .highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ .highlight .go { color: #888888 } /* Generic.Output */ .highlight .gp { color: #555555 } /* Generic.Prompt */ .highlight .gs { font-weight: bold } /* Generic.Strong */ .highlight .gu { color: #666666 } /* Generic.Subheading */ .highlight .gt { color: #aa0000 } /* Generic.Traceback */ .highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ .highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ .highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ .highlight .kp { color: #008800 } /* Keyword.Pseudo */ .highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ .highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */ .highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */ .highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ .highlight .na { color: #336699 } /* Name.Attribute */ .highlight .nb { color: #003388 } /* Name.Builtin */ .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
#
# $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!