Drivers are now being loaded as modules.
This commit is contained in:
@@ -13,45 +13,51 @@ First read the README if you haven't already.
|
||||
|
||||
In order to compile LCDproc, you'll need:
|
||||
|
||||
an ANSI C compiler, we recommend GCC. Most Linux or BSD systems come
|
||||
an ANSI C compiler, we recommend GCC. Most Linux or BSD systems come
|
||||
with GCC.
|
||||
|
||||
GNU Make, Most Linux come with GNU Make, on some BSD you will need to
|
||||
install it. See the PLATFORM SPECIFIC section for more infos.
|
||||
GNU Make. It is available for all major distributions. If you want to
|
||||
compile it yourself, see http://www.gnu.org/software/make/make.html .
|
||||
|
||||
The GNU autotools, that is automake and autoconf. It is available for
|
||||
all major distributions. If you want to compile it yourself, see
|
||||
http://sources.redhat.com/automake/ and
|
||||
http://sources.redhat.com/autoconf/ .
|
||||
|
||||
LCDproc is in fact two things, a client (lcdproc) and a server (LCDd).
|
||||
The client gathers informations and sends them to the server.
|
||||
|
||||
The server displays the informations on an LCD display.
|
||||
The client and the server use a TCP connection to communicate, so it is
|
||||
possible to have a client on a box in Sweden showing its stats on a LCD
|
||||
display in the United States. For hardware reasons, the client is much
|
||||
more portable than the server. Here's are the prerequistes for both:
|
||||
display in the United States.
|
||||
|
||||
--- Client ---
|
||||
The client should run on any POSIX compliant system.
|
||||
It has been sucessfully tested on:
|
||||
Linux 2.2.x, Linux 2.4.x, NetBSD 1.5, OpenBSD 3.0
|
||||
In the future want it to run on Windows, MacOS and others.
|
||||
-- DISPLAYS -----------------------------------------------------------
|
||||
|
||||
--- Server ---
|
||||
The server needs to talk with the LCD display. At this time, it only works
|
||||
on Intel i386 (PC Compatible) architecture.
|
||||
It has been sucessfully tested on:
|
||||
Linux 2.2.x, Linux 2.4.x, NetBSD 1.5, OpenBSD 3.0
|
||||
Many different displays (or better said: output devices) are supported.
|
||||
Some of these devices also support input, for example with a keypad.
|
||||
There are drivers for input-only devices too.
|
||||
|
||||
Connecting the display to your system
|
||||
For LCDd (the server) to use the device, it needs to load a driver. The
|
||||
drivers are so called 'shared modules', that usually have an extension
|
||||
of .so . The drivers to be loaded should be specified in the config file
|
||||
(by one or more Driver= lines), or on the command line. The command line
|
||||
should only be used to override things in the config file. The drivers
|
||||
should be in a directory that is indicated by the DriverPath= line in
|
||||
the configfile.
|
||||
|
||||
Depending on what kind of LCD display that you have, there are several
|
||||
sources for informations. If your LCD display came with a manual, this
|
||||
is a great place to start. If you don't have a manual, then you must find
|
||||
out what kind of display this is, and check the related informations:
|
||||
is a great place to start. If you don't have a manual, then you must
|
||||
find out what kind of display this is, and check the related
|
||||
informations:
|
||||
|
||||
HD44780 and compatible: http://robijn.net/lcdproc/
|
||||
HD44780 and compatible: read docs/hd44780-howto.txt
|
||||
or alternatively see http://www.robijn.net/lcdproc/
|
||||
STV5730: http://www.adams-online.de/lcd/
|
||||
SED1520: http://www.adams-online.de/lcd/
|
||||
|
||||
Also take a look at the comments in the driver source code in
|
||||
Also take a look at the comments in the driver source code in
|
||||
server/drivers. You may have some good indications there.
|
||||
|
||||
You may want to take a look at LCDproc's hardware page at
|
||||
@@ -72,22 +78,22 @@ And read the available options, especially --enable-drivers
|
||||
Run make to build the server and all clients
|
||||
make
|
||||
|
||||
If you only want to compile the clients, you can omit to compile the
|
||||
If you only want to compile the clients, you can omit to compile the
|
||||
server:
|
||||
cd shared
|
||||
make
|
||||
cd ../clients
|
||||
make
|
||||
|
||||
Similarly, if you only want to compile the server, you can omit to
|
||||
Similarly, if you only want to compile the server, you can omit to
|
||||
compile the clients:
|
||||
cd shared
|
||||
make
|
||||
cd ../server
|
||||
make
|
||||
|
||||
Depending on your system, LCDproc will build in a few seconds to a
|
||||
few minutes. It's not very big.
|
||||
Depending on your system, LCDproc will build in a few seconds to a
|
||||
few minutes. It's not very big.
|
||||
|
||||
If you want, you can install it (if you're root) by typing:
|
||||
make install
|
||||
@@ -97,46 +103,59 @@ specified in configure.
|
||||
|
||||
-- PLATFORM SPECIFIC ------------------------------------------------
|
||||
|
||||
The lcdproc crew has tried to support a number of platforms. Platforms
|
||||
that are very non-standard are not and will probably never be supported.
|
||||
Both server & drivers and clients have their own difficulties in
|
||||
porting. Here's are the prerequistes for both:
|
||||
|
||||
--- Client ---
|
||||
The client should run on any POSIX compliant system.
|
||||
It has been sucessfully tested on:
|
||||
Linux 2.2.x, Linux 2.4.x, NetBSD 1.5, OpenBSD 3.0
|
||||
In the future want it to run on Windows, MacOS and others.
|
||||
|
||||
--- Server ---
|
||||
The server needs to talk with the LCD display. At this time, it works
|
||||
on very little more than on the Intel i386 (PC Compatible)
|
||||
architecture. It has been sucessfully tested on:
|
||||
Linux 2.2.x, Linux 2.4.x, NetBSD 1.5, OpenBSD 3.0
|
||||
|
||||
Here are some comments specific to each platform that LCDproc has been
|
||||
tested on.
|
||||
|
||||
--- Linux ---
|
||||
Nothing special to say, everything should go well.
|
||||
|
||||
You may be able to compile the server on something else than i386 if your
|
||||
linux installation can emulate ioperm, inb and outb commands. I heared
|
||||
that some Alpha do that.
|
||||
You may not be able to compile all drivers on something else than i386
|
||||
if your linux installation does not have ioperm, inb and outb commands.
|
||||
I heared that some Alpha do that. You can leave all parallel port
|
||||
drivers out and it should compile again.
|
||||
|
||||
--- NetBSD ---
|
||||
You need to use GUN Make instead of NetBSD's make.
|
||||
You can find a GNU Make binary package to use with pkg_add at:
|
||||
ftp://ftp.netbsd.org/pub/NetBSD/packages/pkgsrc/devel/gmake/README.html
|
||||
|
||||
Or download the source code at:
|
||||
http://www.gnu.org/software/make/make.html
|
||||
|
||||
You need to use GUN Make instead of NetBSD's make.
|
||||
Remember to type gmake instead of make to compile LCDproc.
|
||||
|
||||
The server will probably only compile on NetBSD/i386.
|
||||
|
||||
If you try to run LCDd and you get this error:
|
||||
Bus error (core dumped)
|
||||
It is likely that you did not have the right permission to access the ports.
|
||||
It is likely that you did not have the right permission to access the
|
||||
ports.
|
||||
Try starting the program as root.
|
||||
|
||||
As said ealier, the server should only compile on NetBSD/i386.
|
||||
|
||||
--- OpenBSD ---
|
||||
You need to use GUN Make instead of OpenBSD's make.
|
||||
You can find a GNU Make binary package to use with pkg_add at:
|
||||
ftp://ftp.openbsd.org/pub/OpenBSD/3.0/packages/i386/
|
||||
|
||||
Or download the source code at:
|
||||
http://www.gnu.org/software/make/make.html
|
||||
|
||||
As said ealier, the server should only compile on i386.
|
||||
You need to use GUN Make instead of OpenBSD's make.
|
||||
Remember to type gmake instead of make to compile LCDproc.
|
||||
The server will probably only compile on NetBSD/i386.
|
||||
|
||||
--- FreeBSD ---
|
||||
(not tested yet)
|
||||
It will compile fine on i386.
|
||||
|
||||
--- Other platforms ---
|
||||
If the build process fails, but you do know how to link a loadable
|
||||
module by hand, you can add the appropriate flags etcetera into
|
||||
acinclude.m4. Experience required. Please let us know if you got it
|
||||
working on a previously unsupported system, so we can include it in a
|
||||
next release.
|
||||
|
||||
-- RUNNING LCDPROC -----------------------------------------------------
|
||||
|
||||
@@ -152,20 +171,21 @@ to do.
|
||||
If you're in the LCDproc source directory, and have just built it, run:
|
||||
server/LCDd -c path/to/config/file
|
||||
|
||||
You can find out what drivers were compiled by running "LCDd -h".
|
||||
Note that you cannot use more than one display driver at the same time.
|
||||
For some extra options useful while testing things, try "LCDd -h".
|
||||
|
||||
For security reasons, LCDd only accept connections from the
|
||||
localhost, it will not accept connections from other computers on
|
||||
For security reasons, LCDd only accept connections from the
|
||||
localhost, it will not accept connections from other computers on
|
||||
the Internet. You can change this behavior in the configuration file.
|
||||
|
||||
--- Starting the client(s) ---
|
||||
|
||||
Then, you'll need some clients. LCDproc comes with one:
|
||||
Then, you'll need some clients. LCDproc comes with a few, of which the
|
||||
'lcdproc' client is the main client:
|
||||
clients/lcdproc/lcdproc C M T X &
|
||||
|
||||
This will run the main LCDproc client, with the [C]pu, [M]emory,
|
||||
[T]ime, and [X]load screens. The ampersand (&) puts it in the background.
|
||||
This will run the LCDproc client, with the [C]pu, [M]emory,
|
||||
[T]ime, and [X]load screens. The ampersand (&) puts it in the
|
||||
background.
|
||||
|
||||
By default, the client tries to connect to a server located on localhost
|
||||
and listening to port 13666. To change this, use the -s and -p options.
|
||||
@@ -184,8 +204,8 @@ In Debian:
|
||||
- Make a file "/etc/init.d/lcd" which works the same as the
|
||||
other scripts in that directory. (it should accept "start"
|
||||
and "stop" as parameters...)
|
||||
- To start, run "LCDd" with any necessary parameters. It will
|
||||
put itself in the background as a daemon.
|
||||
- To start, run "LCDd" with any necessary parameters. If possible
|
||||
it will put itself in the background as a daemon.
|
||||
- Also in the "start" section, add "lcdproc" with some
|
||||
parameters. Be sure to put a "&" on the end, or the system
|
||||
will get stuck there when you boot.
|
||||
@@ -194,17 +214,17 @@ In Debian:
|
||||
started in the "start" section. They will shut down and exit.
|
||||
I recommend killing the server after all the clients, but it
|
||||
really doesn't matter much.
|
||||
- Run (as root): update-rc.d lcd defaults
|
||||
This will create symlinks to start and stop the daemon, resp.
|
||||
from /etc/rc[2-5].d/S50lcd to /etc/init.d/lcd, and from
|
||||
/etc/rc[016].d/K50lcd to /etc/init.d/lcd.
|
||||
|
||||
- Now, add symlinks from /etc/rc[2-5].d/S50lcd to /etc/init.d/lcd,
|
||||
and be sure to get /etc/rc[06].d/K50lcd to /etc/init.d/lcd.
|
||||
This will cause LCDproc to shut down when your system does.
|
||||
That's all the distributions we've actually done this with so far..
|
||||
|
||||
That's all the OS`s we've actually done this with so far..
|
||||
|
||||
-- WEB SITE -------------------------------------------------------------
|
||||
-- WEB SITE ------------------------------------------------------------
|
||||
|
||||
Visit http://lcdproc.omnipotent.net/ for the latest updates and news
|
||||
for LCDproc. If you've got comments, suggestions, bug fixes, or
|
||||
for LCDproc. If you've got comments, suggestions, bug fixes, or
|
||||
problems (related to LCDproc, not women ;), send e-mail to either
|
||||
William W. Ferrell (willfe@yahoo.com) or Scott Scriven
|
||||
(toykeeper@cheerful.com).
|
||||
|
||||
@@ -71,6 +71,10 @@ ServerScreen=no
|
||||
Foreground=yes
|
||||
# The server will stay in the foreground if set to true.
|
||||
|
||||
DriverPath=server/drivers/
|
||||
# Where can we find the driver modules ?
|
||||
# Always place a slash as last character !
|
||||
|
||||
|
||||
|
||||
# Driver sections are below this line, in alphabetical order
|
||||
@@ -113,6 +117,7 @@ NewFirmware=no
|
||||
Reboot=no
|
||||
|
||||
[curses]
|
||||
file=curses_drv.so
|
||||
# Curses driver
|
||||
|
||||
# color settings
|
||||
@@ -313,6 +318,8 @@ Arguments="fill in here"
|
||||
#Port=0x378
|
||||
#Size=20x6
|
||||
|
||||
|
||||
|
||||
[text]
|
||||
# Text driver
|
||||
|
||||
|
||||
+6
-30
@@ -18,14 +18,6 @@
|
||||
/* Leave the following blank line there!! Autoheader needs it. */
|
||||
|
||||
|
||||
#undef LIRCIN_DRV
|
||||
|
||||
#undef BAYRAD_DRV
|
||||
|
||||
#undef CFONTZ_DRV
|
||||
|
||||
#undef CURSES_DRV
|
||||
|
||||
#undef CURSES_HAS__ACS_CHAR
|
||||
|
||||
#undef CURSES_HAS_ACS_MAP
|
||||
@@ -38,16 +30,6 @@
|
||||
|
||||
#undef DEFINED_ACS
|
||||
|
||||
#undef GLK_DRV
|
||||
|
||||
#undef HD44780_DRV
|
||||
|
||||
#undef IRMANIN_DRV
|
||||
|
||||
#undef JOY_DRV
|
||||
|
||||
#undef LB216_DRV
|
||||
|
||||
#undef LCDPORT
|
||||
|
||||
#undef LINUX
|
||||
@@ -56,18 +38,6 @@
|
||||
|
||||
#undef LOAD_MIN
|
||||
|
||||
#undef MTXORB_DRV
|
||||
|
||||
#undef LCDM001_DRV
|
||||
|
||||
#undef SED1330_DRV
|
||||
|
||||
#undef SED1520_DRV
|
||||
|
||||
#undef STV5730_DRV
|
||||
|
||||
#undef T6963_DRV
|
||||
|
||||
/* Define the package name */
|
||||
#undef PACKAGE
|
||||
|
||||
@@ -76,6 +46,8 @@
|
||||
|
||||
#undef API_VERSION
|
||||
|
||||
#undef MODULE_EXTENSION
|
||||
|
||||
#undef SLI_DRV
|
||||
|
||||
#undef SOLARIS
|
||||
@@ -84,6 +56,10 @@
|
||||
|
||||
#undef STAT_SMBFS
|
||||
|
||||
/* Define for AIX if your compiler is a genuine IBM xlC/xlC_r
|
||||
and you want support for AIX C++ shared extension modules. */
|
||||
#undef AIX_GENUINE_CPLUSPLUS
|
||||
|
||||
/* two-argument statfs with statfs.bsize member (AIX, 4.3BSD) */
|
||||
#undef STAT_STATFS2_BSIZE
|
||||
|
||||
|
||||
+132
-73
@@ -9,11 +9,11 @@ AC_ARG_ENABLE(drivers,
|
||||
[ hd44780,joy,irman,lircin,bayrad,glk,]
|
||||
[ stv5730,sed1330,sed1520,svgalib,lcdm001,t6963]
|
||||
[ \"all\" compiles all drivers],
|
||||
drivers="$enableval",
|
||||
drivers="$enableval",
|
||||
drivers=[lcdm001,mtxorb,cfontz,curses,text,lb216,bayrad,glk])
|
||||
|
||||
if test "$drivers" = "all"; then
|
||||
drivers=[mtxorb,cfontz,curses,text,lb216,hd44780,joy,irman,lircin,bayrad,glk,stv5730,sed1330,sed1520,svgalib,lcdm001,t6963]
|
||||
drivers=[mtxorb,cfontz,curses,text,lb216,hd44780,joy,irman,lirc,bayrad,glk,stv5730,sed1330,sed1520,svgalib,lcdm001,t6963]
|
||||
fi
|
||||
|
||||
drivers=`echo $drivers | sed 's/,/ /g'`
|
||||
@@ -22,43 +22,36 @@ fi
|
||||
|
||||
case "$driver" in
|
||||
lcdm001)
|
||||
DRIVERS="$DRIVERS lcdm001.o"
|
||||
AC_DEFINE(LCDM001_DRV)
|
||||
DRIVERS="$DRIVERS lcdm001${SO}"
|
||||
actdrivers=["$actdrivers lcdm001"]
|
||||
;;
|
||||
mtxorb)
|
||||
DRIVERS="$DRIVERS MtxOrb.o"
|
||||
AC_DEFINE(MTXORB_DRV)
|
||||
DRIVERS="$DRIVERS MtxOrb${SO}"
|
||||
actdrivers=["$actdrivers mtxorb"]
|
||||
;;
|
||||
glk)
|
||||
DRIVERS="$DRIVERS glk.o glkproto.o"
|
||||
AC_DEFINE(GLK_DRV)
|
||||
DRIVERS="$DRIVERS glk${SO}"
|
||||
actdrivers=["$actdrivers glk"]
|
||||
;;
|
||||
bayrad)
|
||||
DRIVERS="$DRIVERS bayrad.o"
|
||||
AC_DEFINE(BAYRAD_DRV)
|
||||
DRIVERS="$DRIVERS bayrad${SO}"
|
||||
actdrivers=["$actdrivers bayrad"]
|
||||
;;
|
||||
cfontz)
|
||||
DRIVERS="$DRIVERS CFontz.o"
|
||||
AC_DEFINE(CFONTZ_DRV)
|
||||
DRIVERS="$DRIVERS CFontz${SO}"
|
||||
actdrivers=["$actdrivers cfontz"]
|
||||
;;
|
||||
sli)
|
||||
DRIVERS="$DRIVERS wirz-sli.o"
|
||||
AC_DEFINE(SLI_DRV)
|
||||
sli)
|
||||
DRIVERS="$DRIVERS wirz-sli${SO}"
|
||||
actdrivers=["$actdrivers sli"]
|
||||
;;
|
||||
curses)
|
||||
AC_CHECK_HEADERS(ncurses.h curses.h)
|
||||
AC_CHECK_LIB(ncurses, main,
|
||||
AC_CHECK_LIB(ncurses, main,
|
||||
AC_CHECK_HEADER(ncurses.h,
|
||||
dnl We have ncurses.h and libncurses, add driver.
|
||||
LIBCURSES="-lncurses"
|
||||
DRIVERS="$DRIVERS curses_drv.o"
|
||||
AC_DEFINE(CURSES_DRV)
|
||||
DRIVERS="$DRIVERS curses_drv${SO}"
|
||||
actdrivers=["$actdrivers curses"]
|
||||
,
|
||||
dnl else
|
||||
@@ -66,12 +59,11 @@ dnl else
|
||||
)
|
||||
,
|
||||
dnl else
|
||||
AC_CHECK_LIB(curses, main,
|
||||
AC_CHECK_LIB(curses, main,
|
||||
AC_CHECK_HEADER(curses.h,
|
||||
dnl We have curses.h and libcurses, add driver.
|
||||
LIBCURSES="-lcurses"
|
||||
DRIVERS="$DRIVERS curses_drv.o"
|
||||
AC_DEFINE(CURSES_DRV)
|
||||
DRIVERS="$DRIVERS curses_drv${SO}"
|
||||
actdrivers=["$actdrivers curses"]
|
||||
,
|
||||
dnl else
|
||||
@@ -82,9 +74,9 @@ dnl else
|
||||
AC_MSG_WARN([The curses driver needs the curses (or ncurses) library.]),
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
AC_CURSES_ACS_ARRAY
|
||||
|
||||
|
||||
AC_CACHE_CHECK([for redrawwin() in curses], ac_cv_curses_redrawwin,
|
||||
[oldlibs="$LIBS"
|
||||
LIBS="$LIBS $LIBCURSES"
|
||||
@@ -94,7 +86,7 @@ dnl else
|
||||
if test "$ac_cv_curses_redrawwin" = yes; then
|
||||
AC_DEFINE(CURSES_HAS_REDRAWWIN)
|
||||
fi
|
||||
|
||||
|
||||
AC_CACHE_CHECK([for wcolor_set() in curses], ac_cv_curses_wcolor_set,
|
||||
[oldlibs="$LIBS"
|
||||
LIBS="$LIBS $LIBCURSES"
|
||||
@@ -106,24 +98,20 @@ dnl else
|
||||
fi
|
||||
;;
|
||||
text)
|
||||
DRIVERS="$DRIVERS text.o"
|
||||
AC_DEFINE(TEXT_DRV)
|
||||
DRIVERS="$DRIVERS text${SO}"
|
||||
actdrivers=["$actdrivers text"]
|
||||
;;
|
||||
lb216)
|
||||
DRIVERS="$DRIVERS lb216.o"
|
||||
AC_DEFINE(LB216_DRV)
|
||||
DRIVERS="$DRIVERS lb216${SO}"
|
||||
actdrivers=["$actdrivers lb216"]
|
||||
;;
|
||||
hd44780)
|
||||
DRIVERS="$DRIVERS hd44780.o hd44780-4bit.o hd44780-ext8bit.o lcd_sem.o hd44780-serialLpt.o hd44780-winamp.o hd44780-picanlcd.o"
|
||||
AC_DEFINE(HD44780_DRV)
|
||||
DRIVERS="$DRIVERS hd44780${SO}"
|
||||
actdrivers=["$actdrivers hd44780"]
|
||||
;;
|
||||
joy)
|
||||
joy)
|
||||
AC_CHECK_HEADER(linux/joystick.h,
|
||||
DRIVERS="$DRIVERS joy.o"
|
||||
AC_DEFINE(JOY_DRV)
|
||||
DRIVERS="$DRIVERS joy${SO}"
|
||||
actdrivers=["$actdrivers joy"]
|
||||
,
|
||||
dnl else
|
||||
@@ -131,21 +119,19 @@ dnl else
|
||||
)
|
||||
;;
|
||||
irman)
|
||||
AC_CHECK_LIB(irman, main,
|
||||
AC_CHECK_LIB(irman, main,
|
||||
LIBIRMAN="-lirman"
|
||||
DRIVERS="$DRIVERS irmanin.o"
|
||||
AC_DEFINE(IRMANIN_DRV)
|
||||
DRIVERS="$DRIVERS irman${SO}"
|
||||
actdrivers=["$actdrivers irman"]
|
||||
,
|
||||
dnl else
|
||||
AC_MSG_WARN([The irman driver needs the irman library.])
|
||||
)
|
||||
;;
|
||||
lircin)
|
||||
AC_CHECK_LIB(lirc_client, main,
|
||||
lirc)
|
||||
AC_CHECK_LIB(lirc_client, main,
|
||||
LIBLIRC_CLIENT="-llirc_client"
|
||||
DRIVERS="$DRIVERS lircin.o"
|
||||
AC_DEFINE(LIRCIN_DRV)
|
||||
DRIVERS="$DRIVERS lirc${SO}"
|
||||
actdrivers=["$actdrivers lircin"]
|
||||
,
|
||||
dnl else
|
||||
@@ -153,36 +139,31 @@ dnl else
|
||||
)
|
||||
;;
|
||||
sed1330)
|
||||
DRIVERS="$DRIVERS sed1330.o"
|
||||
AC_DEFINE(SED1330_DRV)
|
||||
DRIVERS="$DRIVERS sed1330${SO}"
|
||||
actdrivers=["$actdrivers sed1330"]
|
||||
;;
|
||||
sed1520)
|
||||
DRIVERS="$DRIVERS sed1520.o"
|
||||
AC_DEFINE(SED1520_DRV)
|
||||
DRIVERS="$DRIVERS sed1520${SO}"
|
||||
actdrivers=["$actdrivers sed1520"]
|
||||
;;
|
||||
stv5730)
|
||||
DRIVERS="$DRIVERS stv5730.o"
|
||||
AC_DEFINE(STV5730_DRV)
|
||||
DRIVERS="$DRIVERS stv5730${SO}"
|
||||
actdrivers=["$actdrivers stv5730"]
|
||||
;;
|
||||
svgalib)
|
||||
AC_CHECK_LIB(vga, main,
|
||||
AC_CHECK_LIB(vga, main,
|
||||
LIBSVGA="-lvga -lvgagl"
|
||||
DRIVERS="$DRIVERS svgalib_drv.o"
|
||||
AC_DEFINE(SVGALIB_DRV)
|
||||
DRIVERS="$DRIVERS svgalib_drv${SO}"
|
||||
actdrivers=["$actdrivers svgalib"]
|
||||
,
|
||||
dnl else
|
||||
AC_MSG_WARN([The svgalib driver needs the vga library]))
|
||||
;;
|
||||
t6963)
|
||||
DRIVERS="$DRIVERS t6963.o"
|
||||
AC_DEFINE(T6963_DRV)
|
||||
DRIVERS="$DRIVERS t6963${SO}"
|
||||
actdrivers=["$actdrivers t6963"]
|
||||
;;
|
||||
*)
|
||||
*)
|
||||
AC_MSG_ERROR([Unknown driver $driver])
|
||||
;;
|
||||
esac
|
||||
@@ -203,22 +184,22 @@ dnl
|
||||
dnl Curses test to check if we use _acs_char* or acs_map*
|
||||
dnl
|
||||
AC_DEFUN(AC_CURSES_ACS_ARRAY, [
|
||||
AC_CACHE_CHECK([for acs_map in curses.h], ac_cv_curses_acs_map,
|
||||
AC_CACHE_CHECK([for acs_map in curses.h], ac_cv_curses_acs_map,
|
||||
[AC_TRY_COMPILE([#include <curses.h>], [ char map = acs_map['p'] ], ac_cv_curses_acs_map=yes, ac_cv_curses_acs_map=no)])
|
||||
|
||||
|
||||
if test "$ac_cv_curses_acs_map" = yes
|
||||
then
|
||||
AC_DEFINE(CURSES_HAS_ACS_MAP)
|
||||
else
|
||||
|
||||
AC_CACHE_CHECK([for _acs_char in curses.h], ac_cv_curses__acs_char,
|
||||
|
||||
AC_CACHE_CHECK([for _acs_char in curses.h], ac_cv_curses__acs_char,
|
||||
[AC_TRY_COMPILE([#include <curses.h>], [ char map = _acs_char['p'] ], ac_cv_curses__acs_char=yes, ac_cv_curses__acs_char=no)])
|
||||
|
||||
if test "$ac_cv_curses__acs_char" = yes
|
||||
then
|
||||
AC_DEFINE(CURSES_HAS__ACS_CHAR)
|
||||
fi
|
||||
|
||||
|
||||
fi
|
||||
])
|
||||
|
||||
@@ -231,7 +212,7 @@ AC_DEFUN([AC_FIND_MTAB_FILE], [
|
||||
dnl Linux
|
||||
if test -e "/etc/mtab"; then
|
||||
ac_cv_mtab_file=/etc/mtab
|
||||
else
|
||||
else
|
||||
dnl Solaris
|
||||
if test -e "/etc/mnttab"; then
|
||||
ac_cv_mtab_file=/etc/mnttab
|
||||
@@ -243,7 +224,7 @@ AC_DEFUN([AC_FIND_MTAB_FILE], [
|
||||
fi
|
||||
fi
|
||||
])
|
||||
if test "$ac_cv_mtab_file"; then
|
||||
if test ! -z "$ac_cv_mtab_file"; then
|
||||
AC_DEFINE_UNQUOTED([MTAB_FILE], ["$ac_cv_mtab_file"], [Location of your mounted filesystem table file])
|
||||
fi
|
||||
])
|
||||
@@ -419,11 +400,11 @@ AC_DEFUN(AC_GET_FS_INFO, [
|
||||
dnl fi
|
||||
])
|
||||
|
||||
dnl 1.1 (2001/07/26) -- Miscellaneous @ ac-archive-0.5.32
|
||||
dnl Warren Young <warren@etr-usa.com>
|
||||
dnl This macro checks for the SysV IPC header files. It only checks
|
||||
dnl that you can compile a program with them, not whether the system
|
||||
dnl actually implements working SysV IPC.
|
||||
dnl 1.1 (2001/07/26) -- Miscellaneous @ ac-archive-0.5.32
|
||||
dnl Warren Young <warren@etr-usa.com>
|
||||
dnl This macro checks for the SysV IPC header files. It only checks
|
||||
dnl that you can compile a program with them, not whether the system
|
||||
dnl actually implements working SysV IPC.
|
||||
dnl http://ac-archive.sourceforge.net/Miscellaneous/etr_sysv_ipc.html
|
||||
AC_DEFUN([ETR_SYSV_IPC],
|
||||
[
|
||||
@@ -444,15 +425,15 @@ AC_CACHE_CHECK([for System V IPC headers], ac_cv_sysv_ipc, [
|
||||
fi
|
||||
]) dnl ETR_SYSV_IPC
|
||||
|
||||
dnl 1.1 (2001/07/26) -- Miscellaneous @ ac-archive-0.5.32
|
||||
dnl Warren Young <warren@etr-usa.com>
|
||||
dnl This macro checks to see if sys/sem.h defines union semun. Some
|
||||
dnl systems do, some systems don't. Your code must be able to deal with
|
||||
dnl this possibility; if HAVE_STRUCT_SEMUM isn't defined for a given system,
|
||||
dnl you have to define this structure before you can call functions
|
||||
dnl like semctl().
|
||||
dnl You should call ETR_SYSV_IPC before this macro, to separate the check
|
||||
dnl for System V IPC headers from the check for struct semun.
|
||||
dnl 1.1 (2001/07/26) -- Miscellaneous @ ac-archive-0.5.32
|
||||
dnl Warren Young <warren@etr-usa.com>
|
||||
dnl This macro checks to see if sys/sem.h defines union semun. Some
|
||||
dnl systems do, some systems don't. Your code must be able to deal with
|
||||
dnl this possibility; if HAVE_STRUCT_SEMUM isn't defined for a given system,
|
||||
dnl you have to define this structure before you can call functions
|
||||
dnl like semctl().
|
||||
dnl You should call ETR_SYSV_IPC before this macro, to separate the check
|
||||
dnl for System V IPC headers from the check for struct semun.
|
||||
dnl http://ac-archive.sourceforge.net/Miscellaneous/etr_struct_semun.html
|
||||
AC_DEFUN([ETR_UNION_SEMUN],
|
||||
[
|
||||
@@ -474,3 +455,81 @@ AC_CACHE_CHECK([for union semun], ac_cv_union_semun, [
|
||||
[ Define if your system's sys/sem.h file defines union semun ])
|
||||
fi
|
||||
]) dnl ETR_UNION_SEMUN
|
||||
|
||||
dnl Loadable modules determination.
|
||||
dnl Joris Robijn, 2002
|
||||
dnl I choose not to use libtool.
|
||||
dnl If your platform does not compile or link the modules correctly, add
|
||||
dnl appropriate flags here.
|
||||
AC_DEFUN([AC_MODULES_INFO],
|
||||
[
|
||||
AC_SUBST(SO)
|
||||
dnl $SO is the extension of shared libraries (including the dot!)
|
||||
dnl It is available in the program code as MODULE_EXTENSION
|
||||
AC_MSG_CHECKING(module extension)
|
||||
case $host in
|
||||
hp*|HP*)
|
||||
SO=.sl;;
|
||||
cygwin*)
|
||||
SO=.dll;;
|
||||
*)
|
||||
SO=.so;;
|
||||
esac
|
||||
AC_DEFINE_UNQUOTED(MODULE_EXTENSION,"$SO")
|
||||
AC_MSG_RESULT($SO)
|
||||
|
||||
AC_SUBST(CCSHARED)
|
||||
dnl CCSHARED are the flags used to compile the sources for the shared library
|
||||
AC_SUBST(LDSHARED)
|
||||
dnl LDSHARED are the flags used to create shared library.
|
||||
|
||||
dnl By default assume a GNU compatible build system
|
||||
CCSHARED="-fPIC"
|
||||
LDSHARED="-shared"
|
||||
dnl Now override flags that should be different
|
||||
case "$host" in
|
||||
SunOS/4*)
|
||||
LDSHARED=""
|
||||
;;
|
||||
SunOS/5*)
|
||||
if test ! "$GCC" = "yes" ; then
|
||||
LDSHARED="-G";
|
||||
fi
|
||||
;;
|
||||
hp*|HP*)
|
||||
if test ! "$GCC" = "yes"; then
|
||||
CCSHARED="+z";
|
||||
fi
|
||||
LDSHARED="-b"
|
||||
;;
|
||||
CYGWIN*)
|
||||
CCSHARED="-DUSE_DL_IMPORT"
|
||||
LDSHARED="-shared -Wl,--enable-auto-image-base"
|
||||
;;
|
||||
BSD/OS*/4*)
|
||||
CCSHARED="-fpic"
|
||||
;;
|
||||
esac
|
||||
|
||||
dnl checks for libraries
|
||||
AC_CHECK_LIB(dl, dlopen) # Dynamic linking for Linux, *BSD, SunOS/Solaris and SYSV
|
||||
AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX
|
||||
|
||||
dnl End of loadable modules determination
|
||||
]) dnl AC_MODULES_INFO
|
||||
|
||||
|
||||
dnl Generate the drivers/Makefile.am file from Makefile.am.pre
|
||||
dnl Joris Robijn, 2002
|
||||
AC_DEFUN([AC_GENERATE_MAKEFILE_AM],
|
||||
[
|
||||
echo creating server/drivers/Makefile.am
|
||||
( cd $srcdir/server/drivers
|
||||
SO_WO_DOT=`echo $SO|sed 's/[[.]]//'`
|
||||
sed "s/[[!]]SO[[!]]/$SO_WO_DOT/g" < Makefile.am.pre | \
|
||||
sed "s/[[!]]DRIVERS[[!]]/$DRIVERS/g" > Makefile.am
|
||||
)
|
||||
|
||||
dnl End of Generate drivers Makefile.am
|
||||
]) dnl AC_GENERATE_MAKEFILE_AM
|
||||
|
||||
|
||||
+10
-6
@@ -1,6 +1,6 @@
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
AC_INIT(clients/lcdproc/batt.c)
|
||||
AM_INIT_AUTOMAKE(lcdproc, 0.5beta)
|
||||
AM_INIT_AUTOMAKE(lcdproc, 0.5dev)
|
||||
AM_CONFIG_HEADER(config.h)
|
||||
|
||||
AC_CANONICAL_HOST
|
||||
@@ -132,7 +132,7 @@ AC_DEFINE_UNQUOTED(LCDPORT, $LCDPORT)
|
||||
|
||||
AC_DEFINE_UNQUOTED(PROTOCOL_VERSION, "0.3")
|
||||
|
||||
AC_DEFINE_UNQUOTED(API_VERSION, "0.5beta")
|
||||
AC_DEFINE_UNQUOTED(API_VERSION, "0.5")
|
||||
|
||||
|
||||
AC_ARG_WITH(loadmax,
|
||||
@@ -151,13 +151,17 @@ AC_ARG_WITH(loadmin,
|
||||
)
|
||||
AC_DEFINE_UNQUOTED(LOAD_MIN, $LOAD_MIN)
|
||||
|
||||
AC_MODULES_INFO
|
||||
|
||||
LCD_DRIVERS_SELECT
|
||||
|
||||
AC_GENERATE_MAKEFILE_AM
|
||||
|
||||
AC_OUTPUT(Makefile
|
||||
shared/Makefile
|
||||
server/Makefile
|
||||
server/drivers/Makefile
|
||||
clients/Makefile
|
||||
shared/Makefile
|
||||
server/Makefile
|
||||
server/drivers/Makefile
|
||||
clients/Makefile
|
||||
clients/lcdproc/Makefile
|
||||
clients/examples/Makefile
|
||||
clients/headlines/Makefile
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
SUBDIRS=drivers
|
||||
sbin_PROGRAMS=LCDd
|
||||
LCDd_SOURCES= client_data.c client_data.h client_functions.c client_functions.h client_menu.h clients.c clients.h input.c input.h main.c main.h menu.c menu.h menus.c menus.h parse.c parse.h render.c render.h screen.c screen.h screenlist.c screenlist.h serverscreens.c serverscreens.h sock.c sock.h widget.c widget.h configfile.c configfile.h drivers.c drivers.h driver.c driver.h
|
||||
LCDd_LDADD = drivers/libLCDdrivers.a ../shared/libLCDstuff.a @LIBCURSES@ @LIBIRMAN@ @LIBLIRC_CLIENT@ @LIBSVGA@
|
||||
LCDd_LDADD = ../shared/libLCDstuff.a
|
||||
INCLUDES = -I$(top_srcdir)
|
||||
|
||||
+118
-60
@@ -12,12 +12,12 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <malloc.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <sys/errno.h>
|
||||
#include <dlfcn.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
@@ -31,7 +31,47 @@
|
||||
#include "drivers/lcd.h"
|
||||
/* lcd.h is used for the driver API definition */
|
||||
|
||||
void * lcd_find_init (char *driver); /* HACK TO USE THIS WHILE NO LOADABLE DRIVERS */
|
||||
|
||||
typedef struct driver_symbols {
|
||||
char *name;
|
||||
short offset; /* offset in Driver structure */
|
||||
short required;
|
||||
} DriverSymbols;
|
||||
|
||||
DriverSymbols driver_symbols[] = {
|
||||
{ "api_version", offsetof(Driver, api_version), 1 },
|
||||
{ "stay_in_foreground", offsetof(Driver, stay_in_foreground), 1 },
|
||||
{ "supports_multiple", offsetof(Driver, supports_multiple), 1 },
|
||||
{ "symbol_prefix", offsetof(Driver, symbol_prefix), 1 },
|
||||
{ "init", offsetof(Driver, init), 1 },
|
||||
{ "close", offsetof(Driver, close), 1 },
|
||||
{ "width", offsetof(Driver, width), 1 },
|
||||
{ "height", offsetof(Driver, height), 1 },
|
||||
{ "clear", offsetof(Driver, clear), 1 },
|
||||
{ "flush", offsetof(Driver, flush), 1 },
|
||||
{ "string", offsetof(Driver, string), 1 },
|
||||
{ "chr", offsetof(Driver, chr), 1 },
|
||||
{ "vbar", offsetof(Driver, vbar), 0 },
|
||||
{ "hbar", offsetof(Driver, hbar), 0 },
|
||||
{ "num", offsetof(Driver, num), 0 },
|
||||
{ "heartbeat", offsetof(Driver, heartbeat), 0 },
|
||||
{ "icon", offsetof(Driver, icon), 0 },
|
||||
{ "cursor", offsetof(Driver, cursor), 0 },
|
||||
{ "set_char", offsetof(Driver, set_char), 0 },
|
||||
{ "get_free_chars", offsetof(Driver, get_free_chars), 0 },
|
||||
{ "cellwidth", offsetof(Driver, cellwidth), 0 },
|
||||
{ "cellheight", offsetof(Driver, cellheight), 0 },
|
||||
{ "get_contrast", offsetof(Driver, get_contrast), 0 },
|
||||
{ "set_contrast", offsetof(Driver, set_contrast), 0 },
|
||||
{ "get_brightness", offsetof(Driver, get_brightness), 0 },
|
||||
{ "set_brightness", offsetof(Driver, set_brightness), 0 },
|
||||
{ "backlight", offsetof(Driver, backlight), 0 },
|
||||
{ "output", offsetof(Driver, output), 0 },
|
||||
{ "get_key", offsetof(Driver, get_key), 0 },
|
||||
{ "get_info", offsetof(Driver, get_info), 0 },
|
||||
{ NULL, 0, 0 }
|
||||
};
|
||||
|
||||
|
||||
|
||||
/* Functions for the driver */
|
||||
@@ -43,59 +83,55 @@ static int driver_store_private_ptr(Driver * driver, void * private_data);
|
||||
Driver *
|
||||
driver_load( char * name, char * filename, char * args )
|
||||
{
|
||||
void (*driver_init)();
|
||||
Driver * driver = NULL;
|
||||
int res;
|
||||
|
||||
debug( RPT_DEBUG, "Loading driver [%.40s]", name );
|
||||
report( RPT_INFO, "driver_load( name=\"%.40s\", filename=\"%.80s\", args=\"%.80s\")", name, filename, args );
|
||||
|
||||
/* Allocate memory for new driver struct */
|
||||
driver = malloc( sizeof( Driver ));
|
||||
memset( driver, 0, sizeof (Driver));
|
||||
|
||||
/* Load the driver modules and fill the symbols */
|
||||
if( driver_bind_module( driver ) < 0 ) {
|
||||
report( RPT_ERR, "Driver [%.40s] load failed", name );
|
||||
free( driver );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Find the driver in the array of driver types OLD CODE IS CALLED HERE */
|
||||
if ((driver_init = lcd_find_init(name)) == NULL) {
|
||||
/* Driver not found */
|
||||
report( RPT_ERR, "Unknown driver [%.40s]", name);
|
||||
return NULL;
|
||||
}
|
||||
driver->init = (int (*)(Driver*,char*)) driver_init;
|
||||
|
||||
/* And store its name and filename */
|
||||
driver->name = malloc( strlen( name ) + 1 );
|
||||
strcpy( driver->name, name );
|
||||
driver->filename = malloc( strlen( filename ) + 1 );
|
||||
strcpy( driver->filename, filename );
|
||||
|
||||
/* Call the init function */
|
||||
report( RPT_DEBUG, "Calling driver [%.40s] init function", driver->name );
|
||||
res = driver->init( driver, args );
|
||||
if( res < 0 ) {
|
||||
report( RPT_ERR, "Driver [%.40s] init failed, return code < 0", driver->name );
|
||||
/* Driver load failed, don't add driver to list
|
||||
* Free driver structure again
|
||||
*/
|
||||
/* Load and bind the driver module and locate the symbols */
|
||||
if( driver_bind_module( driver ) < 0 ) {
|
||||
report( RPT_ERR, "Driver [%.40s] binding failed", name );
|
||||
free( driver->name );
|
||||
free( driver->filename );
|
||||
free( driver );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Check if necesary functions are filled
|
||||
* SHOULD BE DONE BEFORE CALLING INIT WHEN WE HAVE LOADABLE DRIVERS
|
||||
*/
|
||||
if( ! driver_has_obligatory_symbols( driver ) ) {
|
||||
report( RPT_ERR, "Driver [%.40s] does not have all obligatory symbols", driver->name );
|
||||
driver_unload( driver );
|
||||
/* Check module version */
|
||||
if( strcmp( *(driver->api_version), API_VERSION ) != 0 ) {
|
||||
report( RPT_ERR, "Driver [%.40s] is of an incompatible version", name );
|
||||
driver_unbind_module( driver );
|
||||
free( driver->name );
|
||||
free( driver->filename );
|
||||
free( driver );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Call the init function */
|
||||
debug( RPT_DEBUG, "Calling driver [%.40s] init function", driver->name );
|
||||
res = driver->init( driver, args );
|
||||
if( res < 0 ) {
|
||||
report( RPT_ERR, "Driver [%.40s] init failed, return code < 0", driver->name );
|
||||
/* Driver load failed, driver should not be added to list
|
||||
* Free driver structure again
|
||||
*/
|
||||
driver_unbind_module( driver );
|
||||
free( driver->name );
|
||||
free( driver->filename );
|
||||
free( driver );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
debug( RPT_NOTICE, "Driver [%.40s] loaded", driver->name );
|
||||
|
||||
return driver;
|
||||
@@ -109,7 +145,7 @@ driver_unload( Driver * driver )
|
||||
if( driver->close )
|
||||
driver->close (driver);
|
||||
|
||||
/* FUTURE: UNLOAD THE LOADED MODULE */
|
||||
/* Unlaod the module */
|
||||
driver_unbind_module( driver );
|
||||
|
||||
/* Free its data */
|
||||
@@ -125,11 +161,54 @@ driver_unload( Driver * driver )
|
||||
int
|
||||
driver_bind_module( Driver * driver )
|
||||
{
|
||||
/* Clear the struct, including all functions */
|
||||
memset( driver, 0, sizeof(Driver) );
|
||||
int i;
|
||||
int missing_symbols = 0;
|
||||
|
||||
/* FUTURE: GET THE SYMBOLS FROM THE DRIVER MODULE */
|
||||
/* Load the module */
|
||||
driver->module_handle = dlopen( driver->filename, RTLD_NOW );
|
||||
if( driver->module_handle == NULL ) {
|
||||
report( RPT_ERR, "Could not dlopen driver module %.40s: %s", driver->filename, dlerror() );
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* And locate the symbols */
|
||||
for( i=0; driver_symbols[i].name; i++ ) {
|
||||
void (**p)();
|
||||
p = (void(**)() ) ((size_t)driver + (driver_symbols[i].offset));
|
||||
*p = NULL;
|
||||
|
||||
/* Add the symbol_prefix */
|
||||
if( driver->symbol_prefix ) {
|
||||
char *s = malloc( strlen( *(driver->symbol_prefix) ) + strlen( driver_symbols[i].name ) + 1 );
|
||||
strcpy( s, *(driver->symbol_prefix) ) ;
|
||||
strcat( s, driver_symbols[i].name );
|
||||
debug( RPT_DEBUG, "finding symbol: %s", s );
|
||||
*p = dlsym( driver->module_handle, s );
|
||||
free( s );
|
||||
}
|
||||
/* Retrieve the symbol */
|
||||
if( !*p ) {
|
||||
debug( RPT_DEBUG, "finding symbol: %s", driver_symbols[i].name );
|
||||
*p = dlsym( driver->module_handle, driver_symbols[i].name );
|
||||
}
|
||||
|
||||
if( *p ) {
|
||||
debug( RPT_DEBUG, "found symbol at: %p", *p );
|
||||
}
|
||||
|
||||
/* Was the symbol required but not found ? */
|
||||
if( !*p && driver_symbols[i].required ) {
|
||||
report( RPT_ERR, "Module [%.40s] does not have required symbol: %s", driver->name, driver_symbols[i].name );
|
||||
missing_symbols = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* If errors, leave now while we can :) */
|
||||
if( missing_symbols ) {
|
||||
report( RPT_ERR, "Driver [%.40s] does not have all obligatory symbols", driver->name );
|
||||
dlclose( driver->module_handle );
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
/* Add our exported functions */
|
||||
@@ -159,33 +238,12 @@ driver_bind_module( Driver * driver )
|
||||
int
|
||||
driver_unbind_module( Driver * driver )
|
||||
{
|
||||
dlclose( driver->module_handle );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
driver_has_obligatory_symbols( Driver * driver )
|
||||
{
|
||||
if( driver->api_version == NULL
|
||||
|| driver->stay_in_foreground == NULL
|
||||
|| driver->supports_multiple == NULL ) {
|
||||
report( RPT_ERR, "Driver [%.40s] misses symbols", driver->name );
|
||||
return 0;
|
||||
}
|
||||
|
||||
if( driver_does_output(driver)
|
||||
&& ( driver->width == NULL
|
||||
|| driver->height == NULL
|
||||
|| driver->clear == NULL
|
||||
|| driver->string == NULL
|
||||
|| driver->chr == NULL )) {
|
||||
report( RPT_ERR, "Driver [%.40s] does output but misses a obligatory function", driver->name );
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
driver_does_output( Driver * driver )
|
||||
{
|
||||
|
||||
@@ -29,9 +29,6 @@ driver_bind_module( Driver * driver );
|
||||
int
|
||||
driver_unbind_module( Driver * driver );
|
||||
|
||||
bool
|
||||
driver_has_obligatory_symbols( Driver * driver );
|
||||
|
||||
bool
|
||||
driver_does_output( Driver * driver );
|
||||
|
||||
|
||||
+38
-80
@@ -12,7 +12,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <malloc.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
@@ -25,6 +24,7 @@
|
||||
|
||||
#include "shared/LL.h"
|
||||
#include "shared/report.h"
|
||||
#include "configfile.h"
|
||||
|
||||
#include "drivers.h"
|
||||
#include "driver.h"
|
||||
@@ -39,11 +39,15 @@ DisplayProps * display_props = NULL;
|
||||
|
||||
|
||||
int
|
||||
drivers_load_driver( char * name, char * filename, char * args )
|
||||
drivers_load_driver( char * name )
|
||||
{
|
||||
Driver * driver;
|
||||
char * s;
|
||||
char * driverpath;
|
||||
char * filename;
|
||||
char * args;
|
||||
|
||||
report( RPT_INFO, "drivers_load_driver( name=\"%.40s\", filename=\"%.80s\", args=\"%.80s\")", name, filename, args );
|
||||
report( RPT_INFO, "drivers_load_driver( name=\"%.40s\")", name );
|
||||
|
||||
/* First driver ? */
|
||||
if( !loaded_drivers ) {
|
||||
@@ -55,15 +59,45 @@ drivers_load_driver( char * name, char * filename, char * args )
|
||||
}
|
||||
}
|
||||
|
||||
/* Retrieve data from config file */
|
||||
s = config_get_string( "server", "driverpath", 0, "" );
|
||||
driverpath = malloc( strlen(s) + 1 );
|
||||
strcpy( driverpath, s );
|
||||
|
||||
s = config_get_string( name, "file", 0, NULL );
|
||||
if( s ) {
|
||||
filename = malloc( strlen(driverpath) + strlen(s) + 1 );
|
||||
strcpy( filename, driverpath );
|
||||
strcat( filename, s );
|
||||
} else {
|
||||
filename = malloc( strlen(driverpath) + strlen(name) + strlen(MODULE_EXTENSION) + 1 );
|
||||
strcpy( filename, driverpath );
|
||||
strcat( filename, name );
|
||||
strcat( filename, MODULE_EXTENSION );
|
||||
}
|
||||
|
||||
s = config_get_string( name, "arguments", 0, "" );
|
||||
args = malloc( strlen(s)+1 );
|
||||
strcpy( args, s );
|
||||
|
||||
/* Load the module */
|
||||
driver = driver_load( name, filename, args );
|
||||
if( driver == NULL )
|
||||
if( driver == NULL ) {
|
||||
/* It failed. The message has already been given by driver_load() */
|
||||
report( RPT_INFO, "Module %.40s could not be loaded", filename );
|
||||
free( driverpath );
|
||||
free( filename );
|
||||
free( args );
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Add driver to list */
|
||||
LL_Push( loaded_drivers, driver );
|
||||
|
||||
free( driverpath );
|
||||
free( filename );
|
||||
free( args );
|
||||
|
||||
/* If first driver, store display properties */
|
||||
if( driver_does_output(driver) && !display_props ) {
|
||||
if( driver->width(driver) <= 0 || driver->width(driver) > LCD_MAX_WIDTH
|
||||
@@ -185,55 +219,11 @@ drivers_chr( int x, int y, char c )
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
drivers_init_vbar() /* TO BE REMOVED */
|
||||
{
|
||||
Driver *drv;
|
||||
|
||||
report( RPT_INFO, "drivers_init_vbar()" );
|
||||
|
||||
ForAllDrivers(drv) {
|
||||
if( drv->init_vbar )
|
||||
drv->init_vbar(drv);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
drivers_init_hbar() /* TO BE REMOVED */
|
||||
{
|
||||
Driver *drv;
|
||||
|
||||
report( RPT_INFO, "drivers_init_hbar()" );
|
||||
|
||||
ForAllDrivers(drv) {
|
||||
if( drv->init_hbar )
|
||||
drv->init_hbar(drv);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
drivers_init_num() /* TO BE REMOVED */
|
||||
{
|
||||
Driver *drv;
|
||||
|
||||
report( RPT_INFO, "drivers_init_num()" );
|
||||
|
||||
ForAllDrivers(drv) {
|
||||
if( drv->init_num )
|
||||
drv->init_num( drv );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
drivers_vbar( int x, int y, int len, int promille, int pattern )
|
||||
{
|
||||
Driver *drv;
|
||||
|
||||
int old_len;
|
||||
|
||||
report( RPT_INFO, "drivers_vbar( x=%d, y=%d, len=%d, promille=%d, pattern=%d )", x, y, len, promille, pattern );
|
||||
|
||||
/* NEW FUNCTIONS
|
||||
@@ -247,21 +237,6 @@ drivers_vbar( int x, int y, int len, int promille, int pattern )
|
||||
drv->vbar( drv, x, y, len, promille, pattern );
|
||||
}
|
||||
}
|
||||
|
||||
/* OLD FUNCTIONS
|
||||
*
|
||||
* We need to convert the bar lengths, because the displays can
|
||||
* have different pixels per char
|
||||
*/
|
||||
|
||||
old_len = (long) display_props->cellheight * len * promille / 1000;
|
||||
|
||||
ForAllDrivers(drv) {
|
||||
if( drv->old_vbar ) {
|
||||
drv->old_vbar( drv, x, old_len );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -269,31 +244,14 @@ void
|
||||
drivers_hbar( int x, int y, int len, int promille, int pattern )
|
||||
{
|
||||
Driver *drv;
|
||||
int old_len;
|
||||
|
||||
report( RPT_INFO, "drivers_hbar( x=%d, y=%d, len=%d, promille=%d, pattern=%d )", x, y, len, promille, pattern );
|
||||
|
||||
/* NEW FUNCTIONS */
|
||||
|
||||
ForAllDrivers(drv) {
|
||||
if( drv->hbar ) {
|
||||
drv->hbar( drv, x, y, len, promille, pattern );
|
||||
}
|
||||
}
|
||||
|
||||
/* OLD FUNCTIONS
|
||||
*
|
||||
* We need to convert the bar lengths, because the displays can
|
||||
* have different pixels per char
|
||||
*/
|
||||
|
||||
old_len = (long) display_props->cellwidth * len * promille / 1000;
|
||||
|
||||
ForAllDrivers(drv) {
|
||||
if( drv->old_hbar ) {
|
||||
drv->old_hbar( drv, x, y, old_len );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ extern DisplayProps * display_props;
|
||||
|
||||
|
||||
int
|
||||
drivers_load_driver( char * name, char * filename, char * args );
|
||||
drivers_load_driver( char * name );
|
||||
/* returns:
|
||||
* <0 error
|
||||
* 0 ok, driver is an input driver only
|
||||
|
||||
+5
-28
@@ -37,7 +37,7 @@
|
||||
#include "CFontz.h"
|
||||
//#include "drv_base.h"
|
||||
//#include "shared/debug.h"
|
||||
#include "shared/str.h"
|
||||
//#include "shared/str.h"
|
||||
#include "report.h"
|
||||
#include "lcd_lib.h"
|
||||
//#include "server/configfile.h"
|
||||
@@ -68,11 +68,14 @@ MODULE_EXPORT int stay_in_foreground = 1;
|
||||
MODULE_EXPORT int supports_multiple = 0;
|
||||
MODULE_EXPORT char *symbol_prefix = "CFontz_";
|
||||
|
||||
|
||||
// Internal functions
|
||||
static void CFontz_linewrap (int on);
|
||||
static void CFontz_autoscroll (int on);
|
||||
static void CFontz_hidecursor ();
|
||||
static void CFontz_reboot ();
|
||||
static void CFontz_init_vbar (Driver * drvthis);
|
||||
static void CFontz_init_hbar (Driver * drvthis);
|
||||
|
||||
|
||||
// TODO: Get the frame buffers working right
|
||||
@@ -80,7 +83,7 @@ static void CFontz_reboot ();
|
||||
/////////////////////////////////////////////////////////////////
|
||||
// Opens com port and sets baud correctly...
|
||||
//
|
||||
int
|
||||
MODULE_EXPORT int
|
||||
CFontz_init (Driver * drvthis, char *args)
|
||||
{
|
||||
struct termios portset;
|
||||
@@ -202,32 +205,6 @@ CFontz_init (Driver * drvthis, char *args)
|
||||
CFontz_autoscroll (0);
|
||||
//CFontz_backlight (drvthis, backlight_brightness); // render.c variables should not be used in drivers !
|
||||
|
||||
// Set variables for server
|
||||
drvthis->api_version = api_version;
|
||||
drvthis->stay_in_foreground = &stay_in_foreground;
|
||||
drvthis->supports_multiple = &supports_multiple;
|
||||
|
||||
// Set the functions the driver supports
|
||||
|
||||
drvthis->clear = CFontz_clear;
|
||||
drvthis->string = CFontz_string;
|
||||
drvthis->chr = CFontz_chr;
|
||||
drvthis->vbar = CFontz_vbar;
|
||||
//drvthis->init_vbar = CFontz_init_vbar;
|
||||
drvthis->hbar = CFontz_hbar;
|
||||
//drvthis->init_hbar = CFontz_init_hbar;
|
||||
drvthis->num = CFontz_num;
|
||||
|
||||
drvthis->init = CFontz_init;
|
||||
drvthis->close = CFontz_close;
|
||||
drvthis->flush = CFontz_flush;
|
||||
drvthis->get_contrast = CFontz_get_contrast;
|
||||
drvthis->set_contrast = CFontz_set_contrast;
|
||||
drvthis->backlight = CFontz_backlight;
|
||||
drvthis->set_char = CFontz_set_char;
|
||||
drvthis->icon = CFontz_icon;
|
||||
drvthis->heartbeat = CFontz_heartbeat;
|
||||
|
||||
CFontz_set_contrast (drvthis, contrast);
|
||||
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#define DEFAULT_SIZE "20x4"
|
||||
|
||||
|
||||
int CFontz_init (Driver * drvthis, char *device);
|
||||
MODULE_EXPORT int CFontz_init (Driver * drvthis, char *device);
|
||||
MODULE_EXPORT void CFontz_close (Driver * drvthis);
|
||||
MODULE_EXPORT int CFontz_width (Driver * drvthis);
|
||||
MODULE_EXPORT int CFontz_height (Driver * drvthis);
|
||||
@@ -34,7 +34,4 @@ MODULE_EXPORT int CFontz_get_contrast (Driver * drvthis);
|
||||
MODULE_EXPORT void CFontz_set_contrast (Driver * drvthis, int contrast);
|
||||
MODULE_EXPORT void CFontz_backlight (Driver * drvthis, int on);
|
||||
|
||||
MODULE_EXPORT void CFontz_init_vbar (Driver * drvthis);
|
||||
MODULE_EXPORT void CFontz_init_hbar (Driver * drvthis);
|
||||
|
||||
#endif
|
||||
|
||||
+57
-28
@@ -1,28 +1,57 @@
|
||||
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 \
|
||||
lcdm001.c lcdm001.h \
|
||||
curses_drv.c curses_drv.h drv_base.h \
|
||||
hd44780.c hd44780.h lb216.c lb216.h \
|
||||
hd44780-4bit.c hd44780-4bit.h lpt-port.h timing.h \
|
||||
hd44780-ext8bit.c hd44780-ext8bit.h lcd_sem.c lcd_sem.h \
|
||||
hd44780-serialLpt.c hd44780-serialLpt.h \
|
||||
hd44780-winamp.c hd44780-winamp.h \
|
||||
hd44780-picanlcd.c hd44780-picanlcd.h \
|
||||
hd44780-low.h hd44780-drivers.h hd44780-charmap.h \
|
||||
sed1330.c sed1330.h \
|
||||
sed1520.c sed1520.h sed1520fm.c \
|
||||
stv5730.c stv5730.h \
|
||||
port.h joy.c joy.h irmanin.c irmanin.h \
|
||||
bayrad.h bayrad.c \
|
||||
CFontz.c CFontz.h lircin.c lircin.h debug.h \
|
||||
glk.c glk.h glkproto.c glkproto.h \
|
||||
svgalib_drv.c svgalib_drv.h \
|
||||
t6963.c t6963.h t6963_font.h
|
||||
libLCDdrivers_a_DEPENDENCIES = @DRIVERS@
|
||||
libLCDdrivers_a_LIBADD = @DRIVERS@
|
||||
# NOTE: $(srcdir)/.. is to get .h files from the server directory
|
||||
# $(top_srcdir) is to get .h files from shared/...
|
||||
# These are necessary because a VPATH build has split source and build
|
||||
# directories and these files are in the VPATH'd source area.
|
||||
INCLUDES = -I$(srcdir)/.. -I$(top_srcdir)
|
||||
## We use bin_ to generate the shared libraries, because automake only
|
||||
## supports libtool shared libraries. But we don't want to use libtool...
|
||||
##
|
||||
## configure replaces all occurrences of so to the appropriate extension
|
||||
## (without dot!)
|
||||
##
|
||||
|
||||
pkglib_PROGRAMS = @DRIVERS@
|
||||
EXTRA_PROGRAMS = bayrad.so CFontz.so curses_drv.so glk.so hd44780.so irman.so joy.so lb216.so lcdm001.so lirc.so MtxOrb.so sed1330.so sed1520.so stv5730.so svga.so t6963.so text.so wirz_sli.so
|
||||
noinst_LIBRARIES = libLCD.a
|
||||
|
||||
EXTRA_DIST = Makefile.am.pre
|
||||
nodist_DIST = Makefile.am
|
||||
|
||||
## How to compile the files for the modules:
|
||||
CCFLAGS += @CCSHARED@
|
||||
|
||||
## And how to build them
|
||||
LDFLAGS += @LDSHARED@
|
||||
|
||||
## Forget the libs that the server core requires
|
||||
LIBS=
|
||||
|
||||
CFontz_so_LDADD = libLCD.a
|
||||
curses_drv_so_LDADD = @LIBCURSES@
|
||||
hd44780_so_LDADD = libLCD.a
|
||||
irman_so_LDADD = @LIBIRMAN@
|
||||
lirc_so_LDADD = @LIBLIRC_CLIENT@
|
||||
svga_so_LDADD = @LIBSVGA@
|
||||
t6963_so_LDADD = libLCD.a
|
||||
|
||||
libLCD_a_SOURCES = lcd_lib.h lcd_lib.c
|
||||
|
||||
bayrad_so_SOURCES = lcd.h bayrad.h bayrad.c report.h
|
||||
CFontz_so_SOURCES = lcd.h CFontz.c CFontz.h report.h
|
||||
curses_drv_so_SOURCES = lcd.h curses_drv.h curses_drv.c report.h
|
||||
glk_so_SOURCES = lcd.h glk.c glk.h glkproto.c glkproto.h report.h
|
||||
hd44780_so_SOURCES = lcd.h hd44780.h hd44780.c hd44780-drivers.h hd44780-low.h hd44780-charmap.h hd44780-4bit.c hd44780-4bit.h hd44780-ext8bit.c hd44780-ext8bit.h lcd_sem.c lcd_sem.h hd44780-serialLpt.c hd44780-serialLpt.h hd44780-winamp.c hd44780-winamp.h hd44780-picanlcd.c hd44780-picanlcd.h port.h lpt-port.h timing.h report.h
|
||||
irman_so_SOURCES = lcd.h irmanin.c irmanin.h report.h
|
||||
joy_so_SOURCES = lcd.h joy.c joy.h port.h report.h
|
||||
lb216_so_SOURCES = lcd.h lb216.c lb216.h report.h
|
||||
lcdm001_so_SOURCES = lcd.h lcdm001.c lcdm001.h report.h
|
||||
lirc_so_SOURCES = lcd.h lircin.c lircin.h report.h
|
||||
MtxOrb_so_SOURCES = lcd.h MtxOrb.c MtxOrb.h report.h bigfont.h
|
||||
sed1330_so_SOURCES = lcd.h sed1330.h sed1330.c port.h lpt-port.h timing.h report.h
|
||||
sed1520_so_SOURCES = lcd.h sed1520.c sed1520.h sed1520fm.c sed1520fm.h port.h report.h
|
||||
stv5730_so_SOURCES = lcd.h stv5730.c stv5730.h report.h
|
||||
svga_so_SOURCES = lcd.h svgalib_drv.c svgalib_drv.h report.h
|
||||
t6963_so_SOURCES = lcd.h t6963.c t6963.h t6963_font.h report.h
|
||||
text_so_SOURCES = lcd.h text.h text.c report.h
|
||||
wirz_sli_so_SOURCES = lcd.h wirz-sli.h wirz-sli.c report.h
|
||||
|
||||
Makefile.am: Makefile.am.pre
|
||||
@echo Makefile.am.pre has been changed, please rerun configure.
|
||||
@false
|
||||
|
||||
INCLUDES = -I$(top_srcdir)
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
## We use bin_ to generate the shared libraries, because automake only
|
||||
## supports libtool shared libraries. But we don't want to use libtool...
|
||||
##
|
||||
## configure replaces all occurrences of !SO! to the appropriate extension
|
||||
## (without dot!)
|
||||
##
|
||||
|
||||
pkglib_PROGRAMS = @DRIVERS@
|
||||
EXTRA_PROGRAMS = bayrad.!SO! CFontz.!SO! curses_drv.!SO! glk.!SO! hd44780.!SO! irman.!SO! joy.!SO! lb216.!SO! lcdm001.!SO! lirc.!SO! MtxOrb.!SO! sed1330.!SO! sed1520.!SO! stv5730.!SO! svga.!SO! t6963.!SO! text.!SO! wirz_sli.!SO!
|
||||
noinst_LIBRARIES = libLCD.a
|
||||
|
||||
EXTRA_DIST = Makefile.am.pre
|
||||
nodist_DIST = Makefile.am
|
||||
|
||||
## How to compile the files for the modules:
|
||||
CCFLAGS += @CCSHARED@
|
||||
|
||||
## And how to build them
|
||||
LDFLAGS += @LDSHARED@
|
||||
|
||||
## Forget the libs that the server core requires
|
||||
LIBS=
|
||||
|
||||
CFontz_!SO!_LDADD = libLCD.a
|
||||
curses_drv_!SO!_LDADD = @LIBCURSES@
|
||||
hd44780_!SO!_LDADD = libLCD.a
|
||||
irman_!SO!_LDADD = @LIBIRMAN@
|
||||
lirc_!SO!_LDADD = @LIBLIRC_CLIENT@
|
||||
svga_!SO!_LDADD = @LIBSVGA@
|
||||
t6963_!SO!_LDADD = libLCD.a
|
||||
|
||||
libLCD_a_SOURCES = lcd_lib.h lcd_lib.c
|
||||
|
||||
bayrad_!SO!_SOURCES = lcd.h bayrad.h bayrad.c report.h
|
||||
CFontz_!SO!_SOURCES = lcd.h CFontz.c CFontz.h report.h
|
||||
curses_drv_!SO!_SOURCES = lcd.h curses_drv.h curses_drv.c report.h
|
||||
glk_!SO!_SOURCES = lcd.h glk.c glk.h glkproto.c glkproto.h report.h
|
||||
hd44780_!SO!_SOURCES = lcd.h hd44780.h hd44780.c hd44780-drivers.h hd44780-low.h hd44780-charmap.h hd44780-4bit.c hd44780-4bit.h hd44780-ext8bit.c hd44780-ext8bit.h lcd_sem.c lcd_sem.h hd44780-serialLpt.c hd44780-serialLpt.h hd44780-winamp.c hd44780-winamp.h hd44780-picanlcd.c hd44780-picanlcd.h port.h lpt-port.h timing.h report.h
|
||||
irman_!SO!_SOURCES = lcd.h irmanin.c irmanin.h report.h
|
||||
joy_!SO!_SOURCES = lcd.h joy.c joy.h port.h report.h
|
||||
lb216_!SO!_SOURCES = lcd.h lb216.c lb216.h report.h
|
||||
lcdm001_!SO!_SOURCES = lcd.h lcdm001.c lcdm001.h report.h
|
||||
lirc_!SO!_SOURCES = lcd.h lircin.c lircin.h report.h
|
||||
MtxOrb_!SO!_SOURCES = lcd.h MtxOrb.c MtxOrb.h report.h bigfont.h
|
||||
sed1330_!SO!_SOURCES = lcd.h sed1330.h sed1330.c port.h lpt-port.h timing.h report.h
|
||||
sed1520_!SO!_SOURCES = lcd.h sed1520.c sed1520.h sed1520fm.c sed1520fm.h port.h report.h
|
||||
stv5730_!SO!_SOURCES = lcd.h stv5730.c stv5730.h report.h
|
||||
svga_!SO!_SOURCES = lcd.h svgalib_drv.c svgalib_drv.h report.h
|
||||
t6963_!SO!_SOURCES = lcd.h t6963.c t6963.h t6963_font.h report.h
|
||||
text_!SO!_SOURCES = lcd.h text.h text.c report.h
|
||||
wirz_sli_!SO!_SOURCES = lcd.h wirz-sli.h wirz-sli.c report.h
|
||||
|
||||
Makefile.am: Makefile.am.pre
|
||||
@echo Makefile.am.pre has been changed, please rerun configure.
|
||||
@false
|
||||
|
||||
INCLUDES = -I$(top_srcdir)
|
||||
+57
-90
@@ -1,4 +1,4 @@
|
||||
/* This is the LCDproc driver for Matrix Orbital devices
|
||||
/* This is the LCDproc driver for Matrix Orbital devices
|
||||
(http://www.matrixorbital.com)
|
||||
|
||||
For the Matrix Orbital LCD* LKD* VFD* and VKD* displays
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
@@ -48,9 +48,23 @@
|
||||
#include "lcd_lib.h"
|
||||
#include "MtxOrb.h"
|
||||
|
||||
#include "shared/report.h"
|
||||
#include "shared/str.h"
|
||||
#include "input.h"
|
||||
#include "report.h"
|
||||
//#include "shared/str.h"
|
||||
//#include "input.h"
|
||||
/* Above 3 lines modified by Joris */
|
||||
#define INPUT_PAUSE_KEY 'A'
|
||||
#define INPUT_BACK_KEY 'B'
|
||||
#define INPUT_FORWARD_KEY 'C'
|
||||
#define INPUT_MAIN_MENU_KEY 'D'
|
||||
#define MTXORB_DEFAULT_PAUSE_KEY 'A'
|
||||
#define MTXORB_DEFAULT_BACK_KEY 'B'
|
||||
#define MTXORB_DEFAULT_FORWARD_KEY 'C'
|
||||
#define MTXORB_DEFAULT_MAIN_MENU_KEY 'D'
|
||||
#define DEFAULT_SIZE "20x4"
|
||||
#define DEFAULT_BACKLIGHT 1
|
||||
#define DEFAULT_TYPE "lcd"
|
||||
#define CONFIG_FILE
|
||||
/* Above 5 lines added by Joris :( */
|
||||
|
||||
#define IS_LCD_DISPLAY (MtxOrb_type == MTXORB_LCD)
|
||||
#define IS_LKD_DISPLAY (MtxOrb_type == MTXORB_LKD)
|
||||
@@ -66,9 +80,9 @@
|
||||
RESP: Because software emulated hbar/vbar permit simultaneous use.
|
||||
*/
|
||||
|
||||
/* TODO: Find a better way to deal with the bitmap/name of custom char
|
||||
/* TODO: Find a better way to deal with the bitmap/name of custom char
|
||||
* Here the value link to the enum and the definition at the end.
|
||||
*/
|
||||
*/
|
||||
#define START_FONT 30
|
||||
#define WHITE 254
|
||||
#define BLACK 255
|
||||
@@ -182,7 +196,7 @@ static void MtxOrb_cursorblink (Driver *drvthis, int on);
|
||||
|
||||
|
||||
static int
|
||||
MtxOrb_parse_type (char * str) {
|
||||
MtxOrb_parse_type (Driver *drvthis, char * str) {
|
||||
char c;
|
||||
c = str[0];
|
||||
|
||||
@@ -209,7 +223,7 @@ MtxOrb_parse_type (char * str) {
|
||||
}
|
||||
|
||||
static int
|
||||
MtxOrb_parse_speed (char *arg) {
|
||||
MtxOrb_parse_speed (Driver *drvthis, char *arg) {
|
||||
int speed;
|
||||
|
||||
switch (atoi(arg)) {
|
||||
@@ -245,7 +259,7 @@ MtxOrb_usage (void) {
|
||||
}
|
||||
|
||||
int
|
||||
MtxOrb_parse_contrast (char * str) {
|
||||
MtxOrb_parse_contrast (Driver *drvthis, char * str) {
|
||||
int contrast;
|
||||
|
||||
contrast = atoi (str);
|
||||
@@ -259,13 +273,13 @@ MtxOrb_parse_contrast (char * str) {
|
||||
|
||||
#ifdef CONFIG_FILE
|
||||
/* Parse one key from the configfile */
|
||||
static char MtxOrb_parse_keypad_setting (char * sectionname, char * keyname, char default_value)
|
||||
static char MtxOrb_parse_keypad_setting (Driver *drvthis, char * keyname, char default_value)
|
||||
{
|
||||
char return_val = 0;
|
||||
char * s;
|
||||
char buf [255];
|
||||
|
||||
s = config_get_string ( sectionname, keyname, 0, NULL);
|
||||
s = drvthis->config_get_string ( drvthis->name, keyname, 0, NULL);
|
||||
if (s != NULL){
|
||||
strncpy (buf, s, sizeof(buf));
|
||||
buf[sizeof(buf)-1]=0;
|
||||
@@ -283,7 +297,7 @@ static char MtxOrb_parse_keypad_setting (char * sectionname, char * keyname, cha
|
||||
*
|
||||
* Called to initialize driver settings
|
||||
*/
|
||||
int
|
||||
MODULE_EXPORT int
|
||||
MtxOrb_init (Driver *drvthis, char *args)
|
||||
{
|
||||
#ifdef CONFIG_FILE
|
||||
@@ -300,23 +314,18 @@ MtxOrb_init (Driver *drvthis, char *args)
|
||||
|
||||
MtxOrb_type = MTXORB_LKD; // Assume it's an LCD w/keypad
|
||||
|
||||
MtxOrb = driver;
|
||||
|
||||
debug( RPT_INFO, "MtxOrb: init(%p,%s)", driver, args );
|
||||
|
||||
/* TODO: replace DriverName with driver->name when that field exists. */
|
||||
#define DriverName "MtxOrb"
|
||||
debug( RPT_INFO, "MtxOrb: init(%p,%s)", drvthis, args );
|
||||
|
||||
|
||||
/* READ CONFIG FILE */
|
||||
|
||||
/* Get serial device to use */
|
||||
strncpy(device, config_get_string ( DriverName , "device" , 0 , DEFAULT_DEVICE),sizeof(device));
|
||||
strncpy(device, drvthis->config_get_string ( drvthis->name , "device" , 0 , DEFAULT_DEVICE),sizeof(device));
|
||||
device[sizeof(device)-1]=0;
|
||||
report (RPT_INFO,"MtxOrb: Using device: %s", device);
|
||||
|
||||
/* Get display size */
|
||||
strncpy(size, config_get_string ( DriverName , "size" , 0 , DEFAULT_SIZE),sizeof(size));
|
||||
strncpy(size, drvthis->config_get_string ( drvthis->name , "size" , 0 , DEFAULT_SIZE),sizeof(size));
|
||||
size[sizeof(size)-1]=0;
|
||||
if( sscanf(size , "%dx%d", &w, &h ) != 2
|
||||
|| (w <= 0) || (w > LCD_MAX_WIDTH)
|
||||
@@ -324,18 +333,18 @@ MtxOrb_init (Driver *drvthis, char *args)
|
||||
report (RPT_WARNING, "MtxOrb: Cannot read size: %s. Using default value %s.", size, DEFAULT_SIZE);
|
||||
sscanf( DEFAULT_SIZE , "%dx%d", &w, &h );
|
||||
}
|
||||
driver->wid = w;
|
||||
driver->hgt = h;
|
||||
width = w;
|
||||
height = h;
|
||||
|
||||
/* Get contrast */
|
||||
if (0<=config_get_int ( DriverName , "Contrast" , 0 , DEFAULT_CONTRAST) && config_get_int ( DriverName , "Contrast" , 0 , DEFAULT_CONTRAST) <= 255) {
|
||||
contrast = config_get_int ( DriverName , "Contrast" , 0 , DEFAULT_CONTRAST);
|
||||
if (0<=drvthis->config_get_int ( drvthis->name , "Contrast" , 0 , DEFAULT_CONTRAST) && drvthis->config_get_int ( drvthis->name , "Contrast" , 0 , DEFAULT_CONTRAST) <= 255) {
|
||||
contrast = drvthis->config_get_int ( drvthis->name , "Contrast" , 0 , DEFAULT_CONTRAST);
|
||||
} else {
|
||||
report (RPT_WARNING, "MtxOrb: Contrast must be between 0 and 255. Using default value.");
|
||||
}
|
||||
|
||||
/* Get speed */
|
||||
tmp = config_get_int ( DriverName , "Speed" , 0 , DEFAULT_SPEED);
|
||||
tmp = drvthis->config_get_int ( drvthis->name , "Speed" , 0 , DEFAULT_SPEED);
|
||||
|
||||
switch (tmp) {
|
||||
case 1200:
|
||||
@@ -372,12 +381,12 @@ MtxOrb_init (Driver *drvthis, char *args)
|
||||
|
||||
|
||||
/* Get backlight setting*/
|
||||
if(config_get_bool( DriverName , "enablebacklight" , 0 , DEFAULT_BACKLIGHT)) {
|
||||
if(drvthis->config_get_bool( drvthis->name , "enablebacklight" , 0 , DEFAULT_BACKLIGHT)) {
|
||||
backlightenabled = 1;
|
||||
}
|
||||
|
||||
/* Get display type */
|
||||
strncpy(buf, config_get_string ( DriverName , "type" , 0 , DEFAULT_TYPE),sizeof(size));
|
||||
strncpy(buf, drvthis->config_get_string ( drvthis->name , "type" , 0 , DEFAULT_TYPE),sizeof(buf));
|
||||
buf[sizeof(buf)-1]=0;
|
||||
|
||||
if (strncasecmp(buf, "lcd", 3) == 0) {
|
||||
@@ -396,7 +405,7 @@ MtxOrb_init (Driver *drvthis, char *args)
|
||||
/* Get keypad settings*/
|
||||
|
||||
/* keypad test mode? */
|
||||
if (config_get_bool( DriverName , "keypad_test_mode" , 0 , 0)) {
|
||||
if (drvthis->config_get_bool( drvthis->name , "keypad_test_mode" , 0 , 0)) {
|
||||
report (RPT_INFO, "MtxOrb: Entering keypad test mode...\n");
|
||||
keypad_test_mode = 1;
|
||||
}
|
||||
@@ -406,19 +415,19 @@ MtxOrb_init (Driver *drvthis, char *args)
|
||||
* So there's no need to get them from the configfile in keypad test mode.
|
||||
*/
|
||||
/* pause_key */
|
||||
pause_key = MtxOrb_parse_keypad_setting (DriverName, "pause_key", MTXORB_DEFAULT_PAUSE_KEY);
|
||||
pause_key = MtxOrb_parse_keypad_setting (drvthis, "pause_key", MTXORB_DEFAULT_PAUSE_KEY);
|
||||
report (RPT_DEBUG, "MtxOrb: Using \"%c\" as pause_key.", pause_key);
|
||||
|
||||
/* back_key */
|
||||
back_key = MtxOrb_parse_keypad_setting (DriverName, "back_key", MTXORB_DEFAULT_BACK_KEY);
|
||||
back_key = MtxOrb_parse_keypad_setting (drvthis, "back_key", MTXORB_DEFAULT_BACK_KEY);
|
||||
report (RPT_DEBUG, "MtxOrb: Using \"%c\" as back_key", back_key);
|
||||
|
||||
/* forward_key */
|
||||
forward_key = MtxOrb_parse_keypad_setting (DriverName, "forward_key", MTXORB_DEFAULT_FORWARD_KEY);
|
||||
forward_key = MtxOrb_parse_keypad_setting (drvthis, "forward_key", MTXORB_DEFAULT_FORWARD_KEY);
|
||||
report (RPT_DEBUG, "MtxOrb: Using \"%c\" as forward_key", forward_key);
|
||||
|
||||
/* main_menu_key */
|
||||
main_menu_key = MtxOrb_parse_keypad_setting (DriverName, "main_menu_key", MTXORB_DEFAULT_MAIN_MENU_KEY);
|
||||
main_menu_key = MtxOrb_parse_keypad_setting (drvthis, "main_menu_key", MTXORB_DEFAULT_MAIN_MENU_KEY);
|
||||
report (RPT_DEBUG, "MtxOrb: Using \"%c\" as main_menu_key", main_menu_key);
|
||||
}
|
||||
|
||||
@@ -472,14 +481,14 @@ MtxOrb_init (Driver *drvthis, char *args)
|
||||
report (RPT_ERR, "MtxOrb_init: %s requires an argument\n", argv[i]);
|
||||
return -1;
|
||||
}
|
||||
contrast = MtxOrb_parse_contrast (argv[++i]);
|
||||
contrast = MtxOrb_parse_contrast (drvthis, argv[++i]);
|
||||
break;
|
||||
case 's':
|
||||
if (i + 1 > argc) {
|
||||
report (RPT_ERR, "MtxOrb_init: %s requires an argument\n", argv[i]);
|
||||
return -1;
|
||||
}
|
||||
speed = MtxOrb_parse_speed (argv[++i]);
|
||||
speed = MtxOrb_parse_speed (drvthis, argv[++i]);
|
||||
break;
|
||||
case 'h':
|
||||
MtxOrb_usage();
|
||||
@@ -518,7 +527,7 @@ MtxOrb_init (Driver *drvthis, char *args)
|
||||
return -1;
|
||||
}
|
||||
i++;
|
||||
MtxOrb_type = MtxOrb_parse_type(argv[i]);
|
||||
MtxOrb_type = MtxOrb_parse_type(drvthis, argv[i]);
|
||||
break;
|
||||
default:
|
||||
printf ("Invalid parameter: %s\n", argv[i]);
|
||||
@@ -584,48 +593,6 @@ MtxOrb_init (Driver *drvthis, char *args)
|
||||
MtxOrb_cursorblink (drvthis, DEFAULT_CURSORBLINK);
|
||||
MtxOrb_set_contrast (drvthis, contrast);
|
||||
|
||||
/*
|
||||
* Configure the display functions
|
||||
*/
|
||||
|
||||
/* Set variables for server */
|
||||
drvthis->api_version = api_version;
|
||||
drvthis->stay_in_foreground = &stay_in_foreground;
|
||||
drvthis->supports_multiple = &supports_multiple;
|
||||
|
||||
/* Set the functions the driver supports */
|
||||
drvthis->clear = MtxOrb_clear;
|
||||
drvthis->string = MtxOrb_string;
|
||||
drvthis->chr = MtxOrb_chr;
|
||||
drvthis->num = MtxOrb_num;
|
||||
|
||||
/* Old stuff that are going to be removed */
|
||||
drvthis->old_vbar = MtxOrb_old_vbar;
|
||||
drvthis->init_vbar = MtxOrb_init_old_vbar; /* EMPTY NOW */
|
||||
drvthis->old_hbar = MtxOrb_old_hbar;
|
||||
drvthis->init_hbar = MtxOrb_init_old_hbar; /* EMPTY NOW */
|
||||
drvthis->old_icon = MtxOrb_old_icon;
|
||||
drvthis->init_num = MtxOrb_init_old_num; /* EMPTY NOW */
|
||||
/* Old stuff that are going to be removed */
|
||||
|
||||
drvthis->init = MtxOrb_init;
|
||||
drvthis->close = MtxOrb_close;
|
||||
drvthis->width = MtxOrb_width;
|
||||
drvthis->height = MtxOrb_height;
|
||||
drvthis->flush = MtxOrb_flush;
|
||||
drvthis->get_contrast = MtxOrb_get_contrast;
|
||||
drvthis->set_contrast = MtxOrb_set_contrast;
|
||||
drvthis->backlight = MtxOrb_backlight;
|
||||
drvthis->output = MtxOrb_output;
|
||||
drvthis->set_char = MtxOrb_set_char;
|
||||
|
||||
/* Looking for the segfault... */
|
||||
/* drvthis->icon = MtxOrb_icon; */
|
||||
|
||||
drvthis->getkey = MtxOrb_getkey;
|
||||
drvthis->get_info = MtxOrb_get_info;
|
||||
drvthis->heartbeat = MtxOrb_heartbeat;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -788,7 +755,7 @@ MtxOrb_chr (Driver *drvthis, int x, int y, char c)
|
||||
ValidX(x);
|
||||
ValidY(y);
|
||||
|
||||
/* write immediately to screen... this code was taken
|
||||
/* write immediately to screen... this code was taken
|
||||
* from the LK202-25; should work for others, yes?
|
||||
* snprintf(out, sizeof(out), "\x0FEG%c%c%c", x, y, c);
|
||||
* write (fd, out, 4);
|
||||
@@ -845,7 +812,7 @@ MtxOrb_set_contrast (Driver *drvthis, int promille)
|
||||
/******************************
|
||||
* Sets the backlight on or off -- can be done quickly for
|
||||
* an intermediate brightness...
|
||||
*
|
||||
*
|
||||
* WARNING: off switches vfd/vkd displays off entirely
|
||||
* so maybe it is best to start LCDd with -b on
|
||||
*
|
||||
@@ -915,7 +882,7 @@ MtxOrb_output (Driver *drvthis, int on)
|
||||
} else {
|
||||
int i;
|
||||
|
||||
/* Other displays have six output ports;
|
||||
/* Other displays have six output ports;
|
||||
* the value "on" is a binary value determining which
|
||||
* ports are turned on (1) and off (0).
|
||||
*/
|
||||
@@ -1241,7 +1208,7 @@ MtxOrb_num (Driver *drvthis, int pos, int val)
|
||||
/* printf("pos: %d char: %d val: %d\n", pos, c, val); */
|
||||
for (y=0;y<4;y++) {
|
||||
for (x=0;x<3;x++) {
|
||||
MtxOrb_icon (drvthis, x+pos, y+1, START_FONT + normal[c][x + (y * 3)]);
|
||||
MtxOrb_icon (drvthis, x+pos, y+1, START_FONT + normal[c][x + (y * 3)]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1285,7 +1252,7 @@ MtxOrb_set_char (Driver *drvthis, int n, char *dat)
|
||||
for (col = 0; col < cellwidth; col++) {
|
||||
/* shift to make room for new scan line data */
|
||||
letter <<= 1;
|
||||
/* Now read a single bit of data
|
||||
/* Now read a single bit of data
|
||||
* -- one entry in dat[] --
|
||||
* and add it to the binary data in "letter"
|
||||
*/
|
||||
@@ -1366,9 +1333,9 @@ MtxOrb_ask_bar (Driver *drvthis, int type)
|
||||
/* This bypass the search for WHITE and BLACK */
|
||||
if (type==barw) return 32;
|
||||
if (type==barb) return 255;
|
||||
|
||||
|
||||
/* If the screen was clear then no graphic caracter are in use yet. */
|
||||
if (clear) {
|
||||
if (clear) {
|
||||
for (pos = 0; pos < 8; pos++) use[pos] = 0;
|
||||
clear = 0;
|
||||
}
|
||||
@@ -1391,7 +1358,7 @@ MtxOrb_ask_bar (Driver *drvthis, int type)
|
||||
pos = last_not_in_use;
|
||||
}
|
||||
|
||||
if (pos != 8) {
|
||||
if (pos != 8) {
|
||||
/* A caracter is found (Best match could solve our problem).
|
||||
* REMOVE: fprintf(stderr, "GLU: MtxOrb_ask_bar| found at %d.\n", pos);
|
||||
*/
|
||||
@@ -1399,15 +1366,15 @@ MtxOrb_ask_bar (Driver *drvthis, int type)
|
||||
MtxOrb_set_known_char (drvthis, pos, type);
|
||||
/* fprintf(stderr, "GLU: MtxOrb_ask_bar [Set a char] pos: %d.\n", pos); */
|
||||
/* Define a new graphic caracter. */
|
||||
def[pos] = type;
|
||||
def[pos] = type;
|
||||
/* Remember that now the caracter is available. */
|
||||
}
|
||||
if (!use[pos]) {
|
||||
if (!use[pos]) {
|
||||
/* If the caracter is no yet in use (but defined). */
|
||||
use[pos] = 1;
|
||||
use[pos] = 1;
|
||||
/* Remember it is in use (so protect it from re-use). */
|
||||
}
|
||||
}
|
||||
}
|
||||
if (pos==8) {
|
||||
/* pos=65; ("A")? */
|
||||
switch (type) {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include "lcd.h"
|
||||
|
||||
int MtxOrb_init (Driver *drvthis, char *device);
|
||||
MODULE_EXPORT int MtxOrb_init (Driver *drvthis, char *device);
|
||||
MODULE_EXPORT void MtxOrb_close (Driver *drvthis);
|
||||
MODULE_EXPORT int MtxOrb_width (Driver *drvthis);
|
||||
MODULE_EXPORT int MtxOrb_height (Driver *drvthis);
|
||||
|
||||
+1
-27
@@ -317,7 +317,7 @@ MODULE_EXPORT char *symbol_prefix = "bayrad_";
|
||||
////////////////////////////////////////////////////////////
|
||||
// init() should set up any device-specific stuff, and
|
||||
// point all the function pointers.
|
||||
int
|
||||
MODULE_EXPORT int
|
||||
bayrad_init(Driver *drvthis, char *args)
|
||||
{
|
||||
|
||||
@@ -456,32 +456,6 @@ bayrad_init(Driver *drvthis, char *args)
|
||||
/* Reset and clear the BayRAD */
|
||||
write(fd, "\x80\x86\x00\x1a\x1e", 5); // sync,reset to type 0, clear screen, home
|
||||
|
||||
|
||||
// Set variables for server
|
||||
drvthis->api_version = api_version;
|
||||
drvthis->stay_in_foreground = &stay_in_foreground;
|
||||
drvthis->supports_multiple = &supports_multiple;
|
||||
|
||||
// Set the functions the driver supports
|
||||
drvthis->clear = bayrad_clear;
|
||||
drvthis->string = bayrad_string;
|
||||
drvthis->chr = bayrad_chr;
|
||||
drvthis->vbar = bayrad_vbar;
|
||||
//drvthis->init_vbar = bayrad_init_vbar;
|
||||
drvthis->hbar = bayrad_hbar;
|
||||
//drvthis->init_hbar = bayrad_init_hbar;
|
||||
//drvthis->num = NULL; //bayrad_num;
|
||||
//drvthis->init_num = NULL; //bayrad_init_num;
|
||||
drvthis->init = bayrad_init;
|
||||
drvthis->close = bayrad_close;
|
||||
drvthis->flush = bayrad_flush;
|
||||
drvthis->backlight = bayrad_backlight;
|
||||
drvthis->set_char = bayrad_set_char;
|
||||
drvthis->icon = bayrad_icon;
|
||||
|
||||
drvthis->get_key = bayrad_get_key;
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
#include "lcd.h"
|
||||
|
||||
int bayrad_init(Driver * drvthis, char *args);
|
||||
MODULE_EXPORT int bayrad_init(Driver * drvthis, char *args);
|
||||
MODULE_EXPORT void bayrad_close(Driver * drvthis);
|
||||
MODULE_EXPORT int bayrad_width(Driver * drvthis);
|
||||
MODULE_EXPORT int bayrad_height(Driver * drvthis);
|
||||
|
||||
+17
-57
@@ -61,8 +61,6 @@ SunOS (5.5.1):
|
||||
#include <curses.h>
|
||||
#endif
|
||||
|
||||
#include "shared/str.h"
|
||||
|
||||
#include "lcd.h"
|
||||
#include "curses_drv.h"
|
||||
#include "report.h"
|
||||
@@ -234,11 +232,10 @@ MODULE_EXPORT int supports_multiple = 0;
|
||||
MODULE_EXPORT char *symbol_prefix = "curses_drv_";
|
||||
|
||||
|
||||
int
|
||||
MODULE_EXPORT int
|
||||
curses_drv_init (Driver *drvthis, char *args)
|
||||
{
|
||||
char buf[256];
|
||||
int w, h;
|
||||
|
||||
// Colors....
|
||||
chtype back_color = DEFAULT_BACKGROUND_COLOR,
|
||||
@@ -249,19 +246,6 @@ curses_drv_init (Driver *drvthis, char *args)
|
||||
int screen_begx = CONF_DEF_TOP_LEFT_X,
|
||||
screen_begy = CONF_DEF_TOP_LEFT_Y;
|
||||
|
||||
// Set display sizes
|
||||
if( drvthis->request_display_width() > 0
|
||||
&& drvthis->request_display_height() > 0 ) {
|
||||
// Use size from primary driver
|
||||
width = drvthis->request_display_width();
|
||||
height = drvthis->request_display_height();
|
||||
}
|
||||
else {
|
||||
// Use default size
|
||||
width = LCD_DEFAULT_WIDTH;
|
||||
height = LCD_DEFAULT_HEIGHT;
|
||||
}
|
||||
|
||||
/*Get settings from config file*/
|
||||
|
||||
/*Get color settings*/
|
||||
@@ -284,21 +268,26 @@ curses_drv_init (Driver *drvthis, char *args)
|
||||
//TODO: Make it possible to configure the backlight's "off" color and its "on" color
|
||||
// Or maybe don't do so? - Rene Wagner
|
||||
|
||||
/*Get size settings*/
|
||||
strncpy(buf, drvthis->config_get_string ( drvthis->name , "size" , 0 , CONF_DEF_SIZE), sizeof(buf));
|
||||
buf[sizeof(buf)-1]=0;
|
||||
if( sscanf(buf , "%dx%d", &w, &h ) != 2
|
||||
|| (w <= 0)
|
||||
|| (h <= 0)) {
|
||||
report (RPT_WARNING, "CURSES: Cannot read size: %s. Using default value.\n", buf);
|
||||
//sscanf( CONF_DEF_SIZE , "%dx%d", &width, &height );
|
||||
// default value is already set
|
||||
/* Get size settings */
|
||||
if( drvthis->request_display_width() > 0
|
||||
&& drvthis->request_display_height() > 0 ) {
|
||||
/* If this driver is secondairy driver, use size from primary driver */
|
||||
width = drvthis->request_display_width();
|
||||
height = drvthis->request_display_height();
|
||||
}
|
||||
else {
|
||||
width = w;
|
||||
height = h;
|
||||
/* Use our own size from config file */
|
||||
strncpy(buf, drvthis->config_get_string ( drvthis->name , "size" , 0 , CONF_DEF_SIZE), sizeof(buf));
|
||||
buf[sizeof(buf)-1]=0;
|
||||
if( sscanf(buf , "%dx%d", &width, &height ) != 2
|
||||
|| (width <= 0)
|
||||
|| (height <= 0)) {
|
||||
report (RPT_WARNING, "CURSES: Cannot read size: %s. Using default value: %s\n", buf, CONF_DEF_SIZE);
|
||||
sscanf( CONF_DEF_SIZE , "%dx%d", &width, &height );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*Get position settings*/
|
||||
if (0<=drvthis->config_get_int ( drvthis->name , "topleftx" , 0 , CONF_DEF_TOP_LEFT_X) && drvthis->config_get_int ( drvthis->name , "topleftx" , 0 , CONF_DEF_TOP_LEFT_X) <= 255) {
|
||||
screen_begx = drvthis->config_get_int ( drvthis->name , "topleftx" , 0 , CONF_DEF_TOP_LEFT_X);
|
||||
@@ -348,35 +337,6 @@ curses_drv_init (Driver *drvthis, char *args)
|
||||
|
||||
curses_drv_clear (drvthis);
|
||||
|
||||
// Set variables for server
|
||||
drvthis->api_version = api_version;
|
||||
drvthis->stay_in_foreground = &stay_in_foreground;
|
||||
drvthis->supports_multiple = &supports_multiple;
|
||||
|
||||
// Set the functions the driver supports
|
||||
drvthis->init = curses_drv_init;
|
||||
drvthis->close = curses_drv_close;
|
||||
drvthis->width = curses_drv_width;
|
||||
drvthis->height = curses_drv_height;
|
||||
drvthis->clear = curses_drv_clear;
|
||||
drvthis->flush = curses_drv_flush;
|
||||
drvthis->string = curses_drv_string;
|
||||
drvthis->chr = curses_drv_chr;
|
||||
|
||||
drvthis->vbar = curses_drv_vbar;
|
||||
//drvthis->init_vbar = NULL;
|
||||
drvthis->hbar = curses_drv_hbar;
|
||||
//drvthis->init_hbar = NULL;
|
||||
drvthis->num = curses_drv_num;
|
||||
//drvthis->init_num = curses_drv_init_num;
|
||||
|
||||
drvthis->backlight = curses_drv_backlight;
|
||||
//drvthis->set_char = NULL;
|
||||
drvthis->icon = curses_drv_icon;
|
||||
|
||||
drvthis->get_key = curses_drv_get_key;
|
||||
drvthis->heartbeat = curses_drv_heartbeat;
|
||||
|
||||
// Change the character used for "..."
|
||||
ELLIPSIS = '~';
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include "lcd.h"
|
||||
|
||||
int curses_drv_init (Driver * drvthis, char *args);
|
||||
MODULE_EXPORT int curses_drv_init (Driver * drvthis, char *args);
|
||||
MODULE_EXPORT void curses_drv_close (Driver *drvthis);
|
||||
MODULE_EXPORT int curses_drv_width (Driver *drvthis);
|
||||
MODULE_EXPORT int curses_drv_height (Driver *drvthis);
|
||||
@@ -28,7 +28,7 @@ MODULE_EXPORT void curses_drv_init_num (Driver *drvthis);
|
||||
#define CONF_DEF_FOREGR "blue"
|
||||
#define CONF_DEF_BACKGR "cyan"
|
||||
#define CONF_DEF_BACKLIGHT "red"
|
||||
#define CONF_DEF_SIZE "20x4" // currently not used, LCD_DEFAULT_WIDTH etc. is used
|
||||
#define CONF_DEF_SIZE "20x4"
|
||||
#define CONF_DEF_TOP_LEFT_X 7
|
||||
#define CONF_DEF_TOP_LEFT_Y 7
|
||||
|
||||
|
||||
+1
-29
@@ -36,7 +36,7 @@ MODULE_EXPORT char *symbol_prefix = "debug_";
|
||||
// TODO: somehow allow access to the driver->framebuffer to each
|
||||
// function...
|
||||
|
||||
int
|
||||
MODULE_EXPORT int
|
||||
debug_init (Driver *drvthis, char *args)
|
||||
{
|
||||
report (RPT_INFO, "debug_init()");
|
||||
@@ -45,34 +45,6 @@ debug_init (Driver *drvthis, char *args)
|
||||
|
||||
debug_clear (drvthis);
|
||||
|
||||
// Set variables for server
|
||||
drvthis->api_version = api_version;
|
||||
drvthis->stay_in_foreground = &stay_in_foreground;
|
||||
drvthis->supports_multiple = &supports_multiple;
|
||||
|
||||
// Set the functions the driver supports
|
||||
drvthis->clear = debug_clear;
|
||||
drvthis->string = debug_string;
|
||||
drvthis->chr = debug_chr;
|
||||
drvthis->vbar = debug_vbar;
|
||||
drvthis->hbar = debug_hbar;
|
||||
drvthis->init_num = debug_init_num;
|
||||
drvthis->num = debug_num;
|
||||
|
||||
drvthis->init = debug_init;
|
||||
drvthis->close = debug_close;
|
||||
drvthis->width = debug_width;
|
||||
drvthis->height = debug_height;
|
||||
drvthis->flush = debug_flush;
|
||||
drvthis->set_contrast = debug_set_contrast;
|
||||
drvthis->backlight = debug_backlight;
|
||||
drvthis->set_char = debug_set_char;
|
||||
drvthis->icon = debug_icon;
|
||||
drvthis->init_vbar = debug_init_vbar;
|
||||
drvthis->init_hbar = debug_init_hbar;
|
||||
|
||||
drvthis->get_key = debug_get_key;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include "lcd.h"
|
||||
|
||||
int debug_init (Driver *drvthis, char *args);
|
||||
MODULE_EXPORT int debug_init (Driver *drvthis, char *args);
|
||||
MODULE_EXPORT void debug_close (Driver *drvthis);
|
||||
MODULE_EXPORT int debug_width (Driver *drvthis);
|
||||
MODULE_EXPORT int debug_height (Driver *drvthis);
|
||||
|
||||
@@ -1,317 +0,0 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <termios.h>
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
#include <sys/errno.h>
|
||||
|
||||
#include "lcd.h"
|
||||
#include "drv_base.h"
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
////////////////////// Base "class" to derive from ///////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
lcd_logical_driver *drv_base;
|
||||
|
||||
// TODO: Get lcd.framebuf to properly work as whatever driver is running...
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// init() should set up any device-specific stuff, and
|
||||
// point all the function pointers.
|
||||
int
|
||||
drv_base_init (struct lcd_logical_driver *driver, char *args)
|
||||
{
|
||||
// printf("drv_base_init()\n");
|
||||
|
||||
drv_base = driver;
|
||||
|
||||
driver->wid = 20;
|
||||
driver->hgt = 4;
|
||||
|
||||
// You must use driver->framebuf here, but may use lcd.framebuf later.
|
||||
if (!driver->framebuf)
|
||||
driver->framebuf = malloc (driver->wid * driver->hgt);
|
||||
|
||||
if (!driver->framebuf) {
|
||||
drv_base_close ();
|
||||
return -1;
|
||||
}
|
||||
// Debugging...
|
||||
// if(lcd.framebuf) printf("Frame buffer: %i\n", (int)lcd.framebuf);
|
||||
|
||||
memset (driver->framebuf, ' ', driver->wid * driver->hgt);
|
||||
// drv_base_clear();
|
||||
|
||||
driver->cellwid = 5;
|
||||
driver->cellhgt = 8;
|
||||
|
||||
driver->clear = drv_base_clear;
|
||||
driver->string = drv_base_string;
|
||||
driver->chr = drv_base_chr;
|
||||
driver->vbar = drv_base_vbar;
|
||||
driver->init_vbar = drv_base_init_vbar;
|
||||
driver->hbar = drv_base_hbar;
|
||||
driver->init_hbar = drv_base_init_hbar;
|
||||
driver->num = drv_base_num;
|
||||
driver->init_num = drv_base_init_num;
|
||||
|
||||
driver->init = drv_base_init;
|
||||
driver->close = drv_base_close;
|
||||
driver->flush = drv_base_flush;
|
||||
driver->flush_box = drv_base_flush_box;
|
||||
driver->contrast = drv_base_contrast;
|
||||
driver->backlight = drv_base_backlight;
|
||||
driver->set_char = drv_base_set_char;
|
||||
driver->icon = drv_base_icon;
|
||||
driver->draw_frame = drv_base_draw_frame;
|
||||
|
||||
driver->getkey = drv_base_getkey;
|
||||
|
||||
return 200; // 200 is arbitrary. (must be 1 or more)
|
||||
}
|
||||
|
||||
// Below here, you may use either lcd.framebuf or driver->framebuf..
|
||||
// lcd.framebuf will be set to the appropriate buffer before calling
|
||||
// your driver.
|
||||
|
||||
void
|
||||
drv_base_close ()
|
||||
{
|
||||
if (lcd.framebuf != NULL)
|
||||
free (lcd.framebuf);
|
||||
|
||||
lcd.framebuf = NULL;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
// Clears the LCD screen
|
||||
//
|
||||
void
|
||||
drv_base_clear ()
|
||||
{
|
||||
memset (lcd.framebuf, ' ', lcd.wid * lcd.hgt);
|
||||
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// Flushes all output to the lcd...
|
||||
//
|
||||
void
|
||||
drv_base_flush ()
|
||||
{
|
||||
//lcd.draw_frame(lcd.framebuf);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
// Prints a string on the lcd display, at position (x,y). The
|
||||
// upper-left is (1,1), and the lower right should be (20,4).
|
||||
//
|
||||
void
|
||||
drv_base_string (int x, int y, char string[])
|
||||
{
|
||||
int i;
|
||||
|
||||
x -= 1; // Convert 1-based coords to 0-based...
|
||||
y -= 1;
|
||||
|
||||
for (i = 0; string[i]; i++) {
|
||||
// Check for buffer overflows...
|
||||
if ((y * lcd.wid) + x + i > (lcd.wid * lcd.hgt))
|
||||
break;
|
||||
lcd.framebuf[(y * lcd.wid) + x + i] = string[i];
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
// Prints a character on the lcd display, at position (x,y). The
|
||||
// upper-left is (1,1), and the lower right should be (20,4).
|
||||
//
|
||||
void
|
||||
drv_base_chr (int x, int y, char c)
|
||||
{
|
||||
y--;
|
||||
x--;
|
||||
|
||||
lcd.framebuf[(y * lcd.wid) + x] = c;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Sets the contrast of the display. Value is 0-255, where 140 is
|
||||
// what I consider "just right".
|
||||
//
|
||||
int
|
||||
drv_base_contrast (int contrast)
|
||||
{
|
||||
// printf("Contrast: %i\n", contrast);
|
||||
return -1;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Turns the lcd backlight on or off...
|
||||
//
|
||||
void
|
||||
drv_base_backlight (int on)
|
||||
{
|
||||
/*
|
||||
if(on)
|
||||
{
|
||||
printf("Backlight ON\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Backlight OFF\n");
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Tells the driver to get ready for vertical bargraphs.
|
||||
//
|
||||
void
|
||||
drv_base_init_vbar ()
|
||||
{
|
||||
// printf("Vertical bars.\n");
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Tells the driver to get ready for horizontal bargraphs.
|
||||
//
|
||||
void
|
||||
drv_base_init_hbar ()
|
||||
{
|
||||
// printf("Horizontal bars.\n");
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Tells the driver to get ready for big numbers, if possible.
|
||||
//
|
||||
void
|
||||
drv_base_init_num ()
|
||||
{
|
||||
// printf("Big Numbers.\n");
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Draws a big (4-row) number.
|
||||
//
|
||||
void
|
||||
drv_base_num (int x, int num)
|
||||
{
|
||||
// printf("BigNum(%i, %i)\n", x, num);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Changes the font data of character n.
|
||||
//
|
||||
void
|
||||
drv_base_set_char (int n, char *dat)
|
||||
{
|
||||
// printf("Set Character %i\n", n);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
// Draws a vertical bar, from the bottom of the screen up.
|
||||
//
|
||||
void
|
||||
drv_base_vbar (int x, int len)
|
||||
{
|
||||
int y;
|
||||
for (y = lcd.hgt; y > 0 && len > 0; y--) {
|
||||
drv_base_chr (x, y, '|');
|
||||
|
||||
len -= lcd.cellhgt;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
// Draws a horizontal bar to the right.
|
||||
//
|
||||
void
|
||||
drv_base_hbar (int x, int y, int len)
|
||||
{
|
||||
for (; x <= lcd.wid && len > 0; x++) {
|
||||
drv_base_chr (x, y, '-');
|
||||
|
||||
len -= lcd.cellwid;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
// Sets character 0 to an icon...
|
||||
//
|
||||
void
|
||||
drv_base_icon (int which, char dest)
|
||||
{
|
||||
// printf("Char %i set to icon %i\n", dest, which);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Send a rectangular area to the display.
|
||||
//
|
||||
// I've just called drv_base_flush() because there's not much point yet
|
||||
// in flushing less than the entire framebuffer.
|
||||
//
|
||||
void
|
||||
drv_base_flush_box (int lft, int top, int rgt, int bot)
|
||||
{
|
||||
//drv_base_flush();
|
||||
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Draws the framebuffer on the display.
|
||||
//
|
||||
// The commented-out code is from the text driver.
|
||||
//
|
||||
void
|
||||
drv_base_draw_frame (char *dat)
|
||||
{
|
||||
/*
|
||||
int i, j;
|
||||
|
||||
char out[LCD_MAX_WIDTH];
|
||||
|
||||
if(!dat) return;
|
||||
|
||||
for(i=0; i<lcd.wid; i++)
|
||||
{
|
||||
out[i] = '-';
|
||||
}
|
||||
out[lcd.wid] = 0;
|
||||
printf("+%s+\n", out);
|
||||
|
||||
|
||||
for(i=0; i<lcd.hgt; i++)
|
||||
{
|
||||
for(j=0; j<lcd.wid; j++)
|
||||
{
|
||||
out[j] = dat[j+(i*lcd.wid)];
|
||||
}
|
||||
out[lcd.wid] = 0;
|
||||
printf("|%s|\n", out);
|
||||
|
||||
}
|
||||
|
||||
for(i=0; i<lcd.wid; i++)
|
||||
{
|
||||
out[i] = '-';
|
||||
}
|
||||
out[lcd.wid] = 0;
|
||||
printf("+%s+\n", out);
|
||||
*/
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Tries to read a character from an input device...
|
||||
//
|
||||
// Return 0 for "nothing available".
|
||||
//
|
||||
char
|
||||
drv_base_getkey ()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -1,117 +0,0 @@
|
||||
#ifndef LCD_DRV_BASE_H
|
||||
#define LCD_DRV_BASE_H
|
||||
|
||||
/********************************************************************
|
||||
How to make a driver for LCDproc
|
||||
|
||||
Note: Insert the name of your driver in place of the phrase "new_driver".
|
||||
|
||||
1. Copy drv_base.c and drv_base.h to new_driver.c and new_driver.h.
|
||||
|
||||
2. Decide which functions you want to override, which ones you want
|
||||
to leave alone, and which ones you don't want at all. If you
|
||||
write your own driver functions, they will get called when
|
||||
appropriate. Or, you can let the default driver "drv_base"
|
||||
handle a function for you. But, if you really don't want a
|
||||
function, you can completely prevent your driver from providing
|
||||
it. This is discussed in step 5.
|
||||
|
||||
2.1. Remove all functions which you don't want to override, and the
|
||||
ones you don't want at all.
|
||||
|
||||
3. Rename all functions from "drv_base_*" to "new_driver_*".
|
||||
|
||||
4. Write the new driver functions.
|
||||
Be sure to do one of the following in/for your new_driver_close():
|
||||
- free the framebuffer lcd.framebuf
|
||||
- let the default driver handle close()
|
||||
- call drv_base_close()
|
||||
This will ensure that the frame buffer gets freed.
|
||||
|
||||
5. Register your functions in your new_driver_init(), like the following:
|
||||
driver->clear = new_driver_clear; // We want to handle this one
|
||||
driver->string = (void *)-1; // Leave this to the default
|
||||
driver->getkey = NULL; // This should never get called
|
||||
|
||||
The convention here is to set NULL for all the functions which
|
||||
your driver doesn't handle (and which you don't want the default
|
||||
functions to be called for). Or, set -1 to indicate that the
|
||||
driver should support the function but can use the default
|
||||
behavior in drv_base.c. Or, to indicate that your driver should
|
||||
handle a function, just set it like clear() above.
|
||||
|
||||
6. Add the driver to lcd.c, in the physical drivers section, protected
|
||||
by an #ifdef like the rest of the drivers are.
|
||||
|
||||
7. Add your driver to the Makefile, and Makefile.config, in the same
|
||||
style as the existing ones.
|
||||
|
||||
Notes:
|
||||
|
||||
Don't call lcd.whatever() functions within your driver. This causes
|
||||
a lot of potentially puzzling problems.
|
||||
|
||||
However, feel free to access lcd.framebuf in your driver (but not in
|
||||
your init() function!). It will always point to the frame buffer
|
||||
you should be writing to. This will usually be your own frame
|
||||
buffer, but could potentially be another frame buffer, if another
|
||||
driver wants to access your functions.
|
||||
|
||||
Your driver will be provided with a frame buffer which contains one
|
||||
byte per character on the LCD. The default is a 20x4, so that's 80
|
||||
bytes. You can free this and reallocate it to something else if you
|
||||
need to. A graphical driver may want to do this, for example.
|
||||
|
||||
If you don't set a function pointer, it will default to NULL, since
|
||||
they get nullified before the driver's init() is called.
|
||||
|
||||
Assume that your driver may be added or removed dynamically, and
|
||||
that more than one instance may exist at a time. In other words, it
|
||||
should init and close cleanly, and not depend on global variables.
|
||||
|
||||
Special arguments will be passed through the "args" variable to your
|
||||
_init() function. This is just a string, and you determine the
|
||||
syntax of it. Please document the syntax so that it can easily be
|
||||
included in the lcdproc config file. I suggest arguments such as
|
||||
"port=0x378" or "-device /dev/ttyS0". These come directly from the
|
||||
lcdproc server config file, so they should be human-readable. An
|
||||
example may look like this:
|
||||
|
||||
# Set up two MtxOrb LCD's and a curses display on VT 2
|
||||
Driver MtxOrb -device /dev/ttyS0 -keypad on
|
||||
Driver curses -color off -size 20x4 -vt 2
|
||||
Driver MtxOrb -device /dev/ttyS3 -size 20x2 -keypad off
|
||||
# Before you ask, no, not all of these options are implemented yet.
|
||||
|
||||
Also, the driver API (if it can be called that) may change soon.
|
||||
There seem to be several functions which just don't do anything
|
||||
important... and there are other potential improvements too.
|
||||
|
||||
And... When in doubt, look at how the other drivers do it. :)
|
||||
|
||||
******************************************************************/
|
||||
|
||||
extern lcd_logical_driver *drv_base;
|
||||
|
||||
int drv_base_init (struct lcd_logical_driver *driver, char *args);
|
||||
void drv_base_close ();
|
||||
void drv_base_clear ();
|
||||
void drv_base_flush ();
|
||||
void drv_base_string (int x, int y, char string[]);
|
||||
void drv_base_chr (int x, int y, char c);
|
||||
int drv_base_contrast (int contrast);
|
||||
void drv_base_backlight (int on);
|
||||
void drv_base_output (int on);
|
||||
void drv_base_vbar (int x, int len);
|
||||
void drv_base_init_vbar ();
|
||||
void drv_base_hbar (int x, int y, int len);
|
||||
void drv_base_init_hbar ();
|
||||
void drv_base_num (int x, int num);
|
||||
void drv_base_init_num ();
|
||||
void drv_base_set_char (int n, char *dat);
|
||||
void drv_base_icon (int which, char dest);
|
||||
void drv_base_flush_box (int lft, int top, int rgt, int bot);
|
||||
void drv_base_draw_frame (char *dat);
|
||||
char drv_base_getkey ();
|
||||
|
||||
#endif
|
||||
+1
-29
@@ -62,7 +62,7 @@ MODULE_EXPORT char *symbol_prefix = "glk_";
|
||||
////////////////////////////////////////////////////////////
|
||||
// init() should set up any device-specific stuff, and
|
||||
// point all the function pointers.
|
||||
int
|
||||
MODULE_EXPORT int
|
||||
glk_init(Driver *drvthis, char *args)
|
||||
{
|
||||
char * argv[64];
|
||||
@@ -206,34 +206,6 @@ glk_init(Driver *drvthis, char *args)
|
||||
// Set contrast
|
||||
glk_set_contrast( drvthis, contrast );
|
||||
|
||||
// Set variables for server
|
||||
drvthis->api_version = api_version;
|
||||
drvthis->stay_in_foreground = &stay_in_foreground;
|
||||
drvthis->supports_multiple = &supports_multiple;
|
||||
|
||||
// Set the functions the driver supports
|
||||
drvthis->clear = glk_clear;
|
||||
drvthis->string = glk_string;
|
||||
drvthis->chr = glk_chr;
|
||||
drvthis->old_vbar = glk_vbar;
|
||||
drvthis->init_vbar = glk_init_vbar;
|
||||
drvthis->old_hbar = glk_hbar;
|
||||
drvthis->init_hbar = glk_init_hbar;
|
||||
drvthis->num = glk_num ;
|
||||
drvthis->init_num = glk_init_num ;
|
||||
|
||||
drvthis->init = glk_init;
|
||||
drvthis->close = glk_close;
|
||||
drvthis->flush = glk_flush;
|
||||
drvthis->get_contrast = glk_get_contrast;
|
||||
drvthis->set_contrast = glk_set_contrast;
|
||||
drvthis->backlight = glk_backlight;
|
||||
drvthis->output = glk_output;
|
||||
drvthis->set_char = glk_set_char;
|
||||
drvthis->old_icon = glk_icon;
|
||||
|
||||
drvthis->getkey = glk_getkey;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include "lcd.h"
|
||||
|
||||
int glk_init(Driver *drvthis, char *args);
|
||||
MODULE_EXPORT int glk_init(Driver *drvthis, char *args);
|
||||
MODULE_EXPORT void glk_close(Driver *drvthis);
|
||||
MODULE_EXPORT int glk_width(Driver *drvthis);
|
||||
MODULE_EXPORT int glk_height(Driver *drvthis);
|
||||
|
||||
@@ -65,7 +65,6 @@
|
||||
#include "lpt-port.h"
|
||||
|
||||
#include "port.h"
|
||||
#include "shared/str.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
@@ -19,9 +19,7 @@
|
||||
|
||||
#include "hd44780-picanlcd.h"
|
||||
#include "hd44780-low.h"
|
||||
#include "hd44780.h"
|
||||
|
||||
#include "shared/str.h"
|
||||
#include "report.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
@@ -54,7 +54,6 @@
|
||||
#include "lpt-port.h"
|
||||
|
||||
#include "port.h"
|
||||
#include "shared/str.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
@@ -63,7 +63,6 @@
|
||||
#include "lpt-port.h"
|
||||
|
||||
#include "port.h"
|
||||
#include "shared/str.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
@@ -69,7 +69,6 @@
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include "shared/str.h"
|
||||
#include "lcd.h"
|
||||
#include "lcd_lib.h"
|
||||
#include "hd44780.h"
|
||||
@@ -121,7 +120,7 @@ MODULE_EXPORT char *symbol_prefix = "HD44780_";
|
||||
/////////////////////////////////////////////////////////////////
|
||||
// Opens com port and sets baud correctly...
|
||||
//
|
||||
int
|
||||
MODULE_EXPORT int
|
||||
HD44780_init (Driver * drvthis, char *args)
|
||||
{
|
||||
// TODO: remove the two magic numbers below
|
||||
@@ -251,8 +250,6 @@ HD44780_init (Driver * drvthis, char *args)
|
||||
if ( p->have_keypad ) {
|
||||
int x, y;
|
||||
|
||||
drvthis->get_key = HD44780_get_key;
|
||||
|
||||
// Read keymap
|
||||
for( x=0; x<KEYPAD_MAXX; x++ ) {
|
||||
char buf[40];
|
||||
@@ -293,36 +290,6 @@ HD44780_init (Driver * drvthis, char *args)
|
||||
}
|
||||
}
|
||||
|
||||
// Set variables for server
|
||||
drvthis->api_version = api_version;
|
||||
drvthis->stay_in_foreground = &stay_in_foreground;
|
||||
drvthis->supports_multiple = &supports_multiple;
|
||||
|
||||
// Set the functions the driver supports...
|
||||
// These are the default HD44780 functions
|
||||
drvthis->init = HD44780_init;
|
||||
drvthis->close = HD44780_close;
|
||||
drvthis->width = HD44780_width;
|
||||
drvthis->height = HD44780_height;
|
||||
drvthis->flush = HD44780_flush;
|
||||
drvthis->clear = HD44780_clear;
|
||||
drvthis->chr = HD44780_chr;
|
||||
drvthis->string = HD44780_string;
|
||||
//drvthis->flush_box = HD44780_flush_box; // TO BE REMOVED
|
||||
//drvthis->contrast = HD44780_contrast; // contrast is set by potmeter we assume
|
||||
|
||||
//drvthis->output = HD44780_output; // not implemented
|
||||
//drvthis->init_vbar = HD44780_init_vbar;
|
||||
//drvthis->init_hbar = HD44780_init_hbar;
|
||||
drvthis->vbar = HD44780_vbar;
|
||||
drvthis->hbar = HD44780_hbar;
|
||||
drvthis->init_num = HD44780_init_num;
|
||||
drvthis->num = HD44780_num;
|
||||
drvthis->heartbeat = HD44780_heartbeat;
|
||||
drvthis->set_char = HD44780_set_char;
|
||||
drvthis->icon = HD44780_icon;
|
||||
//drvthis->draw_frame = HD44780_draw_frame; // TO BE REMOVED
|
||||
|
||||
if ((p->hd44780_functions = (HD44780_functions *) malloc (sizeof (HD44780_functions))) == NULL) {
|
||||
fprintf (stderr, "Error mallocing for function struct");
|
||||
return -1;
|
||||
@@ -1075,6 +1042,8 @@ HD44780_get_key(Driver *drvthis)
|
||||
char * keystr = NULL;
|
||||
struct timeval curr_time, time_diff;
|
||||
|
||||
if( ! p->have_keypad ) return NULL;
|
||||
|
||||
gettimeofday(&curr_time,NULL);
|
||||
|
||||
scancode = p->hd44780_functions->scankeypad(p);
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
#include "lcd.h"
|
||||
|
||||
int HD44780_init (struct lcd_logical_driver *driver, char *args);
|
||||
MODULE_EXPORT int HD44780_init (struct lcd_logical_driver *driver, char *args);
|
||||
MODULE_EXPORT void HD44780_close (Driver *drvthis);
|
||||
MODULE_EXPORT int HD44780_width (Driver *drvthis);
|
||||
MODULE_EXPORT int HD44780_height (Driver *drvthis);
|
||||
@@ -39,8 +39,8 @@ MODULE_EXPORT void HD44780_backlight (Driver *drvthis, int on);
|
||||
|
||||
MODULE_EXPORT char * HD44780_get_key (Driver *drvthis);
|
||||
|
||||
MODULE_EXPORT void HD44780_init_vbar (Driver *drvthis);
|
||||
MODULE_EXPORT void HD44780_init_hbar (Driver *drvthis);
|
||||
MODULE_EXPORT void HD44780_init_num (Driver *drvthis);
|
||||
static void HD44780_init_vbar (Driver *drvthis);
|
||||
static void HD44780_init_hbar (Driver *drvthis);
|
||||
static void HD44780_init_num (Driver *drvthis);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -75,7 +75,7 @@ lcd_logical_driver *irmanin;
|
||||
////////////////////////////////////////////////////////////
|
||||
// init() should set up any device-specific stuff, and
|
||||
// point all the function pointers.
|
||||
int
|
||||
MODULE_EXPORT int
|
||||
irmanin_init (struct lcd_logical_driver *driver, char *args)
|
||||
{
|
||||
char device[256];
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
|
||||
extern lcd_logical_driver *joy;
|
||||
|
||||
int irmanin_init (struct lcd_logical_driver *driver, char *args);
|
||||
void irmanin_close ();
|
||||
char irmanin_getkey ();
|
||||
MODULE_EXPORT int irmanin_init (struct lcd_logical_driver *driver, char *args);
|
||||
MODULE_EXPORT void irmanin_close ();
|
||||
MODULE_EXPORT char irmanin_getkey ();
|
||||
|
||||
#endif
|
||||
|
||||
+1
-10
@@ -65,7 +65,7 @@ MODULE_EXPORT char *symbol_prefix = "joy_";
|
||||
////////////////////////////////////////////////////////////
|
||||
// init() should set up any device-specific stuff, and
|
||||
// point all the function pointers.
|
||||
int
|
||||
MODULE_EXPORT int
|
||||
joy_init (Driver *drvthis, char *args)
|
||||
{
|
||||
char device[256];
|
||||
@@ -105,15 +105,6 @@ joy_init (Driver *drvthis, char *args)
|
||||
|
||||
}
|
||||
|
||||
// Set variables for server
|
||||
drvthis->api_version = api_version;
|
||||
drvthis->stay_in_foreground = &stay_in_foreground;
|
||||
drvthis->supports_multiple = &supports_multiple;
|
||||
|
||||
// Set the functions the driver supports
|
||||
drvthis->getkey = joy_getkey;
|
||||
drvthis->close = joy_close;
|
||||
|
||||
if ((fd = open (device, O_RDONLY)) < 0)
|
||||
return -1;
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include "lcd.h"
|
||||
|
||||
int joy_init (Driver *drvthis, char *args);
|
||||
MODULE_EXPORT int joy_init (Driver *drvthis, char *args);
|
||||
MODULE_EXPORT void joy_close (Driver *drvthis);
|
||||
|
||||
MODULE_EXPORT char joy_getkey (Driver *drvthis);
|
||||
|
||||
+1
-26
@@ -68,7 +68,7 @@ MODULE_EXPORT char *symbol_prefix = "LB216_";
|
||||
/////////////////////////////////////////////////////////////////
|
||||
// Opens com port and sets baud correctly...
|
||||
//
|
||||
int
|
||||
MODULE_EXPORT int
|
||||
LB216_init(Driver * drvthis, char *args)
|
||||
{
|
||||
char *argv[64];
|
||||
@@ -211,31 +211,6 @@ LB216_init(Driver * drvthis, char *args)
|
||||
LB216_hidecursor();
|
||||
LB216_backlight(drvthis, backlight_brightness);
|
||||
|
||||
// Set variables for server
|
||||
drvthis->api_version = api_version;
|
||||
drvthis->stay_in_foreground = &stay_in_foreground;
|
||||
drvthis->supports_multiple = &supports_multiple;
|
||||
|
||||
// Set the functions the driver supports
|
||||
drvthis->clear = LB216_clear;
|
||||
drvthis->string = LB216_string;
|
||||
drvthis->chr = LB216_chr;
|
||||
drvthis->old_vbar = LB216_vbar;
|
||||
drvthis->init_vbar = LB216_init_vbar;
|
||||
drvthis->old_hbar = LB216_hbar;
|
||||
drvthis->init_hbar = LB216_init_hbar;
|
||||
//drvthis->num = NULL;
|
||||
//drvthis->init_num = NULL;
|
||||
|
||||
drvthis->init = LB216_init;
|
||||
drvthis->close = LB216_close;
|
||||
drvthis->width = LB216_width;
|
||||
drvthis->height = LB216_height;
|
||||
drvthis->flush = LB216_flush;
|
||||
drvthis->backlight = LB216_backlight;
|
||||
drvthis->set_char = LB216_set_char;
|
||||
drvthis->old_icon = LB216_icon;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include "lcd.h"
|
||||
|
||||
int LB216_init(Driver * drvthis, char *device);
|
||||
MODULE_EXPORT int LB216_init(Driver * drvthis, char *device);
|
||||
MODULE_EXPORT void LB216_close(Driver * drvthis);
|
||||
MODULE_EXPORT int LB216_width (Driver *drvthis);
|
||||
MODULE_EXPORT int LB216_height (Driver *drvthis);
|
||||
|
||||
@@ -1,714 +0,0 @@
|
||||
/*
|
||||
* Driver master (lcd.c)
|
||||
*
|
||||
* This code actually sets up the drivers as requested,
|
||||
* initializes drivers, and allocates memory for drivers.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* These drivers don't seem to be in the build process yet;
|
||||
* so here we fake it and define these variables...!
|
||||
*
|
||||
* Not pretty, but it works and its up here so everyone
|
||||
* can see... and you can yank them out of the comments
|
||||
* to make it work.
|
||||
*/
|
||||
|
||||
// #define SVGALIB_DRV
|
||||
// #define T6963_DRV
|
||||
|
||||
#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>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "shared/LL.h"
|
||||
#include "shared/report.h"
|
||||
|
||||
#include "lcd.h"
|
||||
|
||||
/*
|
||||
static int lcd_drv_init (lcd_logical_driver * driver, char *args);
|
||||
static void lcd_drv_close ();
|
||||
static void lcd_drv_clear ();
|
||||
static void lcd_drv_flush ();
|
||||
static void lcd_drv_string (int x, int y, char *string);
|
||||
static void lcd_drv_chr (int x, int y, char c);
|
||||
static int lcd_drv_contrast (int contrast);
|
||||
static void lcd_drv_backlight (int on);
|
||||
static void lcd_drv_output (int on);
|
||||
static void lcd_drv_init_vbar ();
|
||||
static void lcd_drv_init_hbar ();
|
||||
static void lcd_drv_init_num ();
|
||||
static void lcd_drv_num (int x, int num);
|
||||
static void lcd_drv_set_char (int n, char *dat);
|
||||
static void lcd_drv_vbar (int x, int len);
|
||||
static void lcd_drv_hbar (int x, int y, int len);
|
||||
static void lcd_drv_icon (int which, char dest);
|
||||
static void lcd_drv_flush_box (int lft, int top, int rgt, int bot);
|
||||
static void lcd_drv_draw_frame ();
|
||||
static char lcd_drv_getkey ();
|
||||
static char lcd_drv_getkey_loop ();
|
||||
static char *lcd_drv_getinfo ();
|
||||
static void lcd_drv_heartbeat (int type);
|
||||
*/
|
||||
|
||||
/*
|
||||
* Add all of the driver's header files in...
|
||||
* but WHY?
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef LCDM001_DRV
|
||||
#include "lcdm001.h"
|
||||
#endif
|
||||
|
||||
#ifdef MTXORB_DRV
|
||||
#include "MtxOrb.h"
|
||||
#endif
|
||||
|
||||
#ifdef CFONTZ_DRV
|
||||
#include "CFontz.h"
|
||||
#endif
|
||||
|
||||
#ifdef LB216_DRV
|
||||
#include "lb216.h"
|
||||
#endif
|
||||
|
||||
#ifdef TEXT_DRV
|
||||
#include "text.h"
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_DRV
|
||||
#include "debug.h"
|
||||
#endif
|
||||
|
||||
#ifdef CURSES_DRV
|
||||
#include "curses_drv.h"
|
||||
#endif
|
||||
|
||||
#ifdef HD44780_DRV
|
||||
#include "hd44780.h"
|
||||
#endif
|
||||
|
||||
#ifdef SLI_DRV
|
||||
#include "wirz-sli.h"
|
||||
#endif
|
||||
|
||||
#ifdef JOY_DRV
|
||||
#include "joy.h"
|
||||
#endif
|
||||
|
||||
#ifdef IRMANIN_DRV
|
||||
#include "irmanin.h"
|
||||
#endif
|
||||
|
||||
#ifdef LIRCIN_DRV
|
||||
#include "lircin.h"
|
||||
#endif
|
||||
|
||||
#ifdef BAYRAD_DRV
|
||||
#include "bayrad.h"
|
||||
#endif
|
||||
|
||||
#ifdef SED1330_DRV
|
||||
#include "sed1330.h"
|
||||
#endif
|
||||
|
||||
#ifdef SED1520_DRV
|
||||
#include "sed1520.h"
|
||||
#endif
|
||||
|
||||
#ifdef STV5730_DRV
|
||||
#include "stv5730.h"
|
||||
#endif
|
||||
|
||||
#ifdef GLK_DRV
|
||||
#include "glk.h"
|
||||
#endif
|
||||
|
||||
#ifdef SVGALIB_DRV
|
||||
#include "svgalib_drv.h"
|
||||
#endif
|
||||
|
||||
#ifdef T6963_DRV
|
||||
#include "t6963.h"
|
||||
#endif
|
||||
|
||||
// Make program more readable and understandable;
|
||||
// hide details...
|
||||
//#define ResetList(a) LL_Rewind(a)
|
||||
//#define GetDriverData(a) ((lcd_logical_driver *)LL_Get(a))
|
||||
//#define NextDriver(a) (LL_Next(a))
|
||||
//#define MoreDrivers(a) (LL_Next(a) == 0)
|
||||
//#define DriverPresent(a) (a)
|
||||
//#define FunctionPresent(a) ((a) != 0)
|
||||
|
||||
// TODO: Make a Windows server, and clients...?
|
||||
|
||||
//Driver *lcd_root = NULL;
|
||||
//Driver *lcd_ptr = NULL;
|
||||
|
||||
// TODO: Add multiple names for the same driver?
|
||||
//
|
||||
// Would allow the use of "MatrixOrbital" (for example) or
|
||||
// "Joystick" or "CrystalFontz" or similar more memorable
|
||||
// names, as well as older ones...
|
||||
//
|
||||
lcd_physical_driver drivers[] = {
|
||||
|
||||
#ifdef LCDM001_DRV
|
||||
{"lcdm001", lcdm001_init,},
|
||||
{"LCDM001", lcdm001_init,},
|
||||
#endif
|
||||
#ifdef MTXORB_DRV
|
||||
{"MtxOrb", MtxOrb_init,},
|
||||
{"MatrixOrbital", MtxOrb_init,},
|
||||
#endif
|
||||
#ifdef CFONTZ_DRV
|
||||
{"CFontz", CFontz_init,},
|
||||
{"CrystalFontz", CFontz_init,},
|
||||
#endif
|
||||
#ifdef HD44780_DRV
|
||||
{"HD44780", HD44780_init,},
|
||||
{"Hitachi", HD44780_init,},
|
||||
#endif
|
||||
#ifdef SLI_DRV
|
||||
{"sli", sli_init,},
|
||||
{"Wirz", sli_init,},
|
||||
#endif
|
||||
#ifdef LB216_DRV
|
||||
{"LB216", LB216_init,},
|
||||
#endif
|
||||
#ifdef TEXT_DRV
|
||||
{"text", text_init,},
|
||||
#endif
|
||||
#ifdef DEBUG_DRV
|
||||
{"debug", debug_init,},
|
||||
#endif
|
||||
#ifdef CURSES_DRV
|
||||
{"curses", curses_drv_init,},
|
||||
{"ncurses", curses_drv_init,},
|
||||
#endif
|
||||
#ifdef JOY_DRV
|
||||
{"joy", joy_init,},
|
||||
{"joystick", joy_init,},
|
||||
#endif
|
||||
#ifdef IRMANIN_DRV
|
||||
{"irmanin", irmanin_init,},
|
||||
#endif
|
||||
#ifdef LIRCIN_DRV
|
||||
{"lircin", lircin_init,},
|
||||
#endif
|
||||
#ifdef BAYRAD_DRV
|
||||
{"BayRAD", bayrad_init,},
|
||||
#endif
|
||||
#ifdef GLK_DRV
|
||||
{"glk", glk_init,},
|
||||
{"glc", glk_init,},
|
||||
#endif
|
||||
#ifdef SED1330_DRV
|
||||
{"sed1330", sed1330_init,},
|
||||
#endif
|
||||
#ifdef SED1520_DRV
|
||||
{"sed1520", sed1520_init,},
|
||||
#endif
|
||||
#ifdef STV5730_DRV
|
||||
{"stv5730", stv5730_init,},
|
||||
#endif
|
||||
#ifdef SVGALIB_DRV
|
||||
{"svgalib", svgalib_drv_init,},
|
||||
{"vga", svgalib_drv_init,},
|
||||
{"svga", svgalib_drv_init,},
|
||||
#endif
|
||||
#ifdef T6963_DRV
|
||||
{"t6963", t6963_init,},
|
||||
{"Toshiba", t6963_init,},
|
||||
#endif
|
||||
|
||||
{NULL, NULL,},
|
||||
|
||||
};
|
||||
|
||||
LinkedList *list;
|
||||
|
||||
#define CurrentDriver (drivers[i].name)
|
||||
#define NextDriver (drivers[i+1].name)
|
||||
|
||||
void
|
||||
lcd_list_drivers (void) {
|
||||
int i = 0;
|
||||
|
||||
printf("\t");
|
||||
while (CurrentDriver != NULL) {
|
||||
printf("%s", CurrentDriver);
|
||||
|
||||
if (NextDriver != NULL)
|
||||
printf(", ");
|
||||
|
||||
i++;
|
||||
if ((i % 8) == 0)
|
||||
printf("\n\t");
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// This function initializes a few basics as well as the
|
||||
// "base" array. To initialize a specific driver, use the
|
||||
// lcd_add_driver() function.
|
||||
//
|
||||
// This was eliminated; everything
|
||||
// done here is to be replaced by the use of lcd_add_driver()...
|
||||
|
||||
/*
|
||||
int
|
||||
lcd_init (char *args)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
*/
|
||||
|
||||
// This sets up all of the "wrapper" driver functions
|
||||
// which call all of the drivers in turn.
|
||||
//
|
||||
|
||||
/*
|
||||
static int
|
||||
lcd_drv_init (struct lcd_logical_driver *driver, char *args)
|
||||
{
|
||||
driver->wid = LCD_STD_WIDTH;
|
||||
driver->hgt = LCD_STD_HEIGHT;
|
||||
|
||||
driver->cellwid = LCD_STD_CELL_WIDTH;
|
||||
driver->cellhgt = LCD_STD_CELL_HEIGHT;
|
||||
|
||||
driver->framebuf = NULL;
|
||||
driver->nextkey = NULL;
|
||||
|
||||
driver->daemonize = 1;
|
||||
|
||||
// Set up these wrapper functions...
|
||||
driver->clear = lcd_drv_clear;
|
||||
driver->string = lcd_drv_string;
|
||||
driver->chr = lcd_drv_chr;
|
||||
driver->vbar = lcd_drv_vbar;
|
||||
driver->hbar = lcd_drv_hbar;
|
||||
driver->init_num = lcd_drv_init_num;
|
||||
driver->num = lcd_drv_num;
|
||||
|
||||
driver->init = lcd_drv_init;
|
||||
driver->close = lcd_drv_close;
|
||||
driver->flush = lcd_drv_flush;
|
||||
driver->flush_box = lcd_drv_flush_box;
|
||||
driver->contrast = lcd_drv_contrast;
|
||||
driver->backlight = lcd_drv_backlight;
|
||||
driver->output = lcd_drv_output;
|
||||
driver->set_char = lcd_drv_set_char;
|
||||
driver->icon = lcd_drv_icon;
|
||||
driver->init_vbar = lcd_drv_init_vbar;
|
||||
driver->init_hbar = lcd_drv_init_hbar;
|
||||
driver->draw_frame = lcd_drv_draw_frame;
|
||||
|
||||
driver->getkey = lcd_drv_getkey;
|
||||
driver->getinfo = lcd_drv_getinfo;
|
||||
driver->heartbeat = lcd_drv_heartbeat;
|
||||
|
||||
return 1; // 1 is arbitrary. (must be 1 or more)
|
||||
}
|
||||
|
||||
#define ChkNull(a,b,c) if ((driver->a) == 0) { syslog(LOG_INFO, "warning: %s: null entries deprecated!", (c)); driver->a = (b); }
|
||||
#define ChkBaseDrv(a,b,c) if ((driver->a) == (void *) -1) { syslog(LOG_ERR, "warning: %s: base driver has been REMOVED!", (c)); driver->a = (b); }
|
||||
|
||||
static int
|
||||
lcd_drv_patch_init (struct lcd_logical_driver *driver)
|
||||
{
|
||||
// These are to patch drivers that use "NULL" as a valid value...
|
||||
ChkNull(clear, lcd_drv_clear, "clear");
|
||||
ChkNull(string, lcd_drv_string, "string");
|
||||
ChkNull(chr, lcd_drv_chr, "chr");
|
||||
ChkNull(vbar, lcd_drv_vbar, "vbar");
|
||||
ChkNull(hbar, lcd_drv_hbar, "hbar");
|
||||
ChkNull(init_num, lcd_drv_init_num, "init_num");
|
||||
ChkNull(num, lcd_drv_num, "num");
|
||||
|
||||
ChkNull(init, lcd_drv_init, "init");
|
||||
ChkNull(close, lcd_drv_close, "close");
|
||||
ChkNull(flush, lcd_drv_flush, "flush");
|
||||
ChkNull(flush_box, lcd_drv_flush_box, "flush_box");
|
||||
ChkNull(contrast, lcd_drv_contrast, "contrast");
|
||||
ChkNull(backlight, lcd_drv_backlight, "backlight");
|
||||
ChkNull(output, lcd_drv_output, "output");
|
||||
ChkNull(set_char, lcd_drv_set_char, "set_char");
|
||||
ChkNull(icon, lcd_drv_icon, "icon");
|
||||
ChkNull(init_vbar, lcd_drv_init_vbar, "init_vbar");
|
||||
ChkNull(init_hbar, lcd_drv_init_hbar, "init_hbar");
|
||||
ChkNull(draw_frame, lcd_drv_draw_frame, "draw_frame");
|
||||
|
||||
ChkNull(getkey, lcd_drv_getkey, "getkey");
|
||||
ChkNull(getinfo, lcd_drv_getinfo, "getinfo");
|
||||
ChkNull(heartbeat, lcd_drv_heartbeat, "heartbeat");
|
||||
|
||||
// Now check for base driver entries...;
|
||||
ChkBaseDrv(clear, lcd_drv_clear, "clear");
|
||||
ChkBaseDrv(string, lcd_drv_string, "string");
|
||||
ChkBaseDrv(chr, lcd_drv_chr, "chr");
|
||||
ChkBaseDrv(vbar, lcd_drv_vbar, "vbar");
|
||||
ChkBaseDrv(hbar, lcd_drv_hbar, "hbar");
|
||||
ChkBaseDrv(init_num, lcd_drv_init_num, "init_num");
|
||||
ChkBaseDrv(num, lcd_drv_num, "num");
|
||||
|
||||
ChkBaseDrv(init, lcd_drv_init, "init");
|
||||
ChkBaseDrv(close, lcd_drv_close, "close");
|
||||
ChkBaseDrv(flush, lcd_drv_flush, "flush");
|
||||
ChkBaseDrv(flush_box, lcd_drv_flush_box, "flush_box");
|
||||
ChkBaseDrv(contrast, lcd_drv_contrast, "contrast");
|
||||
ChkBaseDrv(backlight, lcd_drv_backlight, "backlight");
|
||||
ChkBaseDrv(output, lcd_drv_output, "output");
|
||||
ChkBaseDrv(set_char, lcd_drv_set_char, "set_char");
|
||||
ChkBaseDrv(icon, lcd_drv_icon, "icon");
|
||||
ChkBaseDrv(init_vbar, lcd_drv_init_vbar, "init_vbar");
|
||||
ChkBaseDrv(init_hbar, lcd_drv_init_hbar, "init_hbar");
|
||||
ChkBaseDrv(draw_frame, lcd_drv_draw_frame, "draw_frame");
|
||||
|
||||
ChkBaseDrv(getkey, lcd_drv_getkey, "getkey");
|
||||
ChkBaseDrv(getinfo, lcd_drv_getinfo, "getinfo");
|
||||
ChkBaseDrv(heartbeat, lcd_drv_heartbeat, "heartbeat");
|
||||
|
||||
return 0;
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
* This function can be replaced later with something
|
||||
* that utilizes the results of dynamic library loading
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
void *
|
||||
lcd_find_init (char *driver) {
|
||||
int i;
|
||||
|
||||
if (!driver)
|
||||
return NULL;
|
||||
|
||||
for (i = 0; drivers[i].name; i++) {
|
||||
if (strcasecmp(driver, drivers[i].name) == 0) {
|
||||
return (*drivers[i].init);
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
// TODO: lcd_remove_driver()
|
||||
|
||||
/*
|
||||
Driver *
|
||||
lcd_allocate_driver () {
|
||||
Driver *driver;
|
||||
//int driver_size;
|
||||
|
||||
// This bit of fakery allows us to use lcd as the first
|
||||
// allocated buffer, which is what everything currently uses for
|
||||
// output in the main server code.
|
||||
|
||||
#define FirstTime (lcd_ptr->framebuf == NULL)
|
||||
|
||||
if ((driver = malloc(sizeof(Driver))) == NULL) {
|
||||
syslog(LOG_ERR, "error allocating driver space!");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (lcd_root == NULL)
|
||||
lcd_root = driver;
|
||||
|
||||
if (lcd_ptr == NULL)
|
||||
lcd_ptr = driver;
|
||||
|
||||
return driver;
|
||||
}
|
||||
|
||||
// This initializes the specified driver and sends parameters to
|
||||
// it. This is the function which calls, for example,
|
||||
// MtxOrb_init. The specifics come from the drivers[] array.
|
||||
|
||||
|
||||
static char (*main_getkey) () = NULL;
|
||||
|
||||
int
|
||||
lcd_add_driver (char *driver, char *args)
|
||||
{
|
||||
int i;
|
||||
char buf[80];
|
||||
int (*init_driver) ();
|
||||
|
||||
lcd_logical_driver *ptr = NULL;
|
||||
lcd_logical_driver *add = NULL;
|
||||
|
||||
if (!driver)
|
||||
return -1;
|
||||
|
||||
if ((init_driver = (void *) lcd_find_init(driver)) != NULL) {
|
||||
|
||||
snprintf(buf, sizeof(buf), "adding %s driver", driver);
|
||||
syslog(LOG_INFO, buf);
|
||||
|
||||
// This creates an instance of the lcd structure specific to the
|
||||
// driver... it is passed to the driver's init routine...
|
||||
|
||||
if ((add = lcd_allocate_driver()) == NULL)
|
||||
return -1;
|
||||
|
||||
memset (add, 0, sizeof (lcd_logical_driver));
|
||||
|
||||
// Default settings for the driver...
|
||||
lcd_drv_init(add, NULL);
|
||||
|
||||
i = init_driver (add, args);
|
||||
|
||||
if (!add->framebuf) {
|
||||
if ((add->framebuf = malloc (add->wid * add->hgt)) == NULL) {
|
||||
snprintf (buf, sizeof(buf), "couldn't allocate framebuffer of %d chars for driver \"%s\"",
|
||||
(add->wid * add->hgt), driver);
|
||||
syslog (LOG_ERR, buf);
|
||||
// free (add);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
memset (add->framebuf, ' ', (add->wid * add->hgt));
|
||||
|
||||
// Now patch up the returned driver structure
|
||||
// before returning
|
||||
lcd_drv_patch_init (add); // patches drivers that think NULL is okay...
|
||||
|
||||
if (main_getkey == NULL) {
|
||||
|
||||
// Patch the getkey with the getkey loop...
|
||||
main_getkey = add->getkey;
|
||||
add->getkey = lcd_drv_getkey_loop;
|
||||
add->nextkey = NULL;
|
||||
|
||||
} else {
|
||||
|
||||
// Tack additional drivers onto the getkey list...
|
||||
ptr = lcd_root;
|
||||
while (ptr->nextkey)
|
||||
ptr = ptr->nextkey;
|
||||
|
||||
// ptr now points to a driver which contains
|
||||
// a nextkey which is NULL... add the new
|
||||
// driver in.
|
||||
ptr->nextkey = add;
|
||||
}
|
||||
|
||||
return i;
|
||||
} else {
|
||||
snprintf(buf, sizeof(buf), "invalid driver: %s", driver);
|
||||
syslog(LOG_ERR, buf);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
*/
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// All functions below here call their respective driver functions...
|
||||
//
|
||||
// The way it works is this:
|
||||
// It loops through the list of drivers, calling each one to keep
|
||||
// them all synchronized. During this loop...
|
||||
// - First, set the framebuffer to point to the drivers' framebuffer.
|
||||
// (this ensures that whatever driver gets called will operate on
|
||||
// the correct buffer)
|
||||
// - Then, it checks to see what sort of call to make.
|
||||
// driver->func() > 0 means it should call the driver function.
|
||||
// driver->func() == NULL means it should not make a call.
|
||||
// driver->func() == -1 means it should call the generic driver.
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
/*
|
||||
* The functions below are null functions which are used
|
||||
* when a particular driver does not set them.
|
||||
*
|
||||
*/
|
||||
|
||||
// lcd_drv_close ()
|
||||
// lcd_drv_clear ()
|
||||
// lcd_drv_flush ()
|
||||
// lcd_drv_string (int x, int y, char string[])
|
||||
// lcd_drv_chr (int x, int y, char c)
|
||||
// lcd_drv_contrast (int contrast)
|
||||
// lcd_drv_backlight (int on)
|
||||
// lcd_drv_output (int on)
|
||||
// lcd_drv_init_vbar ()
|
||||
// lcd_drv_init_hbar ()
|
||||
// lcd_drv_init_num ()
|
||||
// lcd_drv_num (int x, int num)
|
||||
// lcd_drv_set_char (int n, char *dat)
|
||||
// lcd_drv_vbar (int x, int len)
|
||||
// lcd_drv_hbar (int x, int y, int len)
|
||||
// lcd_drv_icon (int which, char dest)
|
||||
// lcd_drv_flush_box (int lft, int top, int rgt, int bot)
|
||||
// lcd_drv_draw_frame (char *dat)
|
||||
// lcd_drv_getkey ()
|
||||
// lcd_drv_getinfo ()
|
||||
|
||||
/*
|
||||
static void
|
||||
lcd_drv_close ()
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
static void
|
||||
lcd_drv_clear ()
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
static void
|
||||
lcd_drv_flush ()
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
static void
|
||||
lcd_drv_string (int x, int y, char *string)
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
static void
|
||||
lcd_drv_chr (int x, int y, char c)
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
static int
|
||||
lcd_drv_contrast (int contrast)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void
|
||||
lcd_drv_backlight (int on)
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
static void
|
||||
lcd_drv_output (int on)
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
static void
|
||||
lcd_drv_init_vbar ()
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
static void
|
||||
lcd_drv_init_hbar ()
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
static void
|
||||
lcd_drv_init_num ()
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
static void
|
||||
lcd_drv_num (int x, int num)
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
static void
|
||||
lcd_drv_set_char (int n, char *dat)
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
static void
|
||||
lcd_drv_vbar (int x, int len)
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
static void
|
||||
lcd_drv_hbar (int x, int y, int len)
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
static void
|
||||
lcd_drv_icon (int which, char dest)
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
static void
|
||||
lcd_drv_flush_box (int lft, int top, int rgt, int bot)
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
static void
|
||||
lcd_drv_draw_frame (char *dat)
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
static char *
|
||||
lcd_drv_getinfo ()
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static char
|
||||
lcd_drv_getkey ()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
// This loops through all defined getkeys, returning
|
||||
// the first input that it finds, if any.
|
||||
|
||||
|
||||
static char
|
||||
lcd_drv_getkey_loop () {
|
||||
Driver *driver;
|
||||
char c;
|
||||
|
||||
if ((c = main_getkey()) != 0)
|
||||
return c;
|
||||
|
||||
driver = lcd_root;
|
||||
while ((driver = driver->nextkey) != NULL)
|
||||
if ((c = driver->getkey()) > 0)
|
||||
return c;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
lcd_drv_heartbeat (int type)
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
*/
|
||||
+7
-27
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* client.h
|
||||
* lcd.h
|
||||
* This file is part of LCDd, the lcdproc server.
|
||||
*
|
||||
* This file is released under the GNU General Public License. Refer to the
|
||||
@@ -24,6 +24,8 @@
|
||||
#ifndef LCD_H
|
||||
#define LCD_H
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
/* Maximum supported sizes */
|
||||
#define LCD_MAX_WIDTH 256
|
||||
#define LCD_MAX_HEIGHT 256
|
||||
@@ -71,9 +73,9 @@
|
||||
|
||||
/* What does the shared module handle look like on the current platform? */
|
||||
#define MODULE_HANDLE void*
|
||||
|
||||
/* And how do we define the exported functions */
|
||||
#define MODULE_EXPORT static
|
||||
/* WHILE NOT MODULES static BECAUSE OTHERWISE WE HAVE MULTIPLE IDENTICAL SYMBOLS */
|
||||
#define MODULE_EXPORT
|
||||
|
||||
typedef struct lcd_logical_driver {
|
||||
|
||||
@@ -84,10 +86,10 @@ typedef struct lcd_logical_driver {
|
||||
/******** Variables in the driver module ********/
|
||||
/* The driver loader will look for symbols with these names ! */
|
||||
|
||||
char *api_version;
|
||||
char **api_version;
|
||||
int *stay_in_foreground; /* Does this driver require to be in foreground ? */
|
||||
int *supports_multiple; /* Does this driver support multiple instances ? */
|
||||
char *func_prefix; /* What should be prepended to the function names ? */
|
||||
char **symbol_prefix; /* What should alternatively be prepended to the function names ? */
|
||||
|
||||
|
||||
/******** Functions in the driver module ********/
|
||||
@@ -132,20 +134,6 @@ typedef struct lcd_logical_driver {
|
||||
|
||||
char * (*get_info) ();
|
||||
|
||||
|
||||
/* OLD FUNCTIONS */
|
||||
void (*old_vbar) (struct lcd_logical_driver* drvthis, int x, int len);
|
||||
void (*old_hbar) (struct lcd_logical_driver* drvthis, int x, int y, int len);
|
||||
void (*old_icon) (struct lcd_logical_driver* drvthis, int which, char dest);
|
||||
/* THESE 3 TO BE REMOVED */
|
||||
|
||||
void (*init_vbar) ();
|
||||
void (*init_hbar) ();
|
||||
void (*init_num) ();
|
||||
void (*draw_frame) ();
|
||||
void (*flush_box) (int lft, int top, int rgt, int bot);
|
||||
/* THESE 4 TO BE REMOVED */
|
||||
|
||||
/* Returns 0 for "no key pressed", or (A-Z). */
|
||||
char (*getkey) ();
|
||||
/* TO BE REMOVED, IS RENAMED AND CHANGED */
|
||||
@@ -189,12 +177,4 @@ typedef struct lcd_logical_driver {
|
||||
|
||||
} Driver;
|
||||
|
||||
|
||||
void lcd_list_drivers (void); /* TO BE REMOVED WHEN WE HAVE LOADABLE MODULES */
|
||||
|
||||
typedef struct lcd_physical_driver { /* TO BE REMOVED WHEN WE HAVE LOADABLE MODULES */
|
||||
char *name;
|
||||
int (*init) (struct lcd_logical_driver * driver, char *device);
|
||||
} lcd_physical_driver;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -60,7 +60,6 @@
|
||||
|
||||
#include "lcd.h"
|
||||
#include "lcdm001.h"
|
||||
#include "shared/str.h"
|
||||
#include "report.h"
|
||||
//#include "configfile.h"
|
||||
|
||||
@@ -174,7 +173,7 @@ lcdm001_cursorblink (Driver *drvthis, int on)
|
||||
* init() should set up any device-specific stuff, and
|
||||
* point all the function pointers.
|
||||
*/
|
||||
int
|
||||
MODULE_EXPORT int
|
||||
lcdm001_init (Driver *drvthis, char *args)
|
||||
{
|
||||
char device[200];
|
||||
@@ -250,40 +249,6 @@ lcdm001_init (Driver *drvthis, char *args)
|
||||
snprintf (out, sizeof(out), "\%cL%c%c", 126, 0, 0);
|
||||
write (fd, out, 4);
|
||||
|
||||
// Set variables for server
|
||||
drvthis->api_version = api_version;
|
||||
drvthis->stay_in_foreground = &stay_in_foreground;
|
||||
drvthis->supports_multiple = &supports_multiple;
|
||||
|
||||
// Set the functions the driver supports
|
||||
drvthis->clear = lcdm001_clear;
|
||||
drvthis->width = lcdm001_width;
|
||||
drvthis->height = lcdm001_height;
|
||||
drvthis->string = lcdm001_string;
|
||||
drvthis->chr = lcdm001_chr;
|
||||
drvthis->old_vbar =lcdm001_vbar;
|
||||
//init_vbar is not needed
|
||||
drvthis->old_hbar = lcdm001_hbar;
|
||||
//init_hbar is not needed
|
||||
drvthis->num = lcdm001_num;
|
||||
//init_num is not needed
|
||||
|
||||
drvthis->init = lcdm001_init;
|
||||
drvthis->close = lcdm001_close;
|
||||
drvthis->flush = lcdm001_flush;
|
||||
//contrast and backlight are not implemented as
|
||||
//changing the contrast or the state of the backlight
|
||||
//is not supported by the device
|
||||
//Well ... you could make use of your screw drvthis and
|
||||
//soldering iron ;)
|
||||
drvthis->output = lcdm001_output;
|
||||
//set_char is not implemented as custom chars are not
|
||||
//supported by the device
|
||||
drvthis->old_icon = lcdm001_icon;
|
||||
|
||||
drvthis->getkey = lcdm001_getkey;
|
||||
drvthis->heartbeat = lcdm001_heartbeat;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
/* REMOVE: I don't thing this is actualy needed. */
|
||||
/* extern lcd_logical_driver *lcdm001; */
|
||||
|
||||
int lcdm001_init (struct lcd_logical_driver *driver, char *args);
|
||||
MODULE_EXPORT int lcdm001_init (struct lcd_logical_driver *driver, char *args);
|
||||
MODULE_EXPORT void lcdm001_close (Driver *drvthis);
|
||||
MODULE_EXPORT int lcdm001_width (Driver *drvthis);
|
||||
MODULE_EXPORT int lcdm001_height (Driver *drvthis);
|
||||
|
||||
+1
-10
@@ -87,21 +87,12 @@ lircin_getkey (Driver * drvthis)
|
||||
////////////////////////////////////////////////////////////
|
||||
// init() should set up any device-specific stuff, and
|
||||
// point all the function pointers.
|
||||
int
|
||||
MODULE_EXPORT int
|
||||
lircin_init (Driver * drvthis, char *args)
|
||||
{
|
||||
|
||||
/* assign funktions */
|
||||
|
||||
// Set variables for server
|
||||
drvthis->api_version = api_version;
|
||||
drvthis->stay_in_foreground = &stay_in_foreground;
|
||||
drvthis->supports_multiple = &supports_multiple;
|
||||
|
||||
// Set the functions the driver supports
|
||||
drvthis->getkey = lircin_getkey;
|
||||
drvthis->close = lircin_close;
|
||||
|
||||
/* open socket to lirc */
|
||||
|
||||
if (-1 == (fd = lirc_init ("lcdd", 1))) {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include "lcd.h"
|
||||
|
||||
int lircin_init (Driver * drvthis, char *args);
|
||||
MODULE_EXPORT int lircin_init (Driver * drvthis, char *args);
|
||||
MODULE_EXPORT void lircin_close (Driver * drvthis);
|
||||
MODULE_EXPORT char lircin_getkey (Driver * drvthis);
|
||||
|
||||
|
||||
@@ -170,9 +170,8 @@
|
||||
|
||||
#include "port.h"
|
||||
#include "lpt-port.h"
|
||||
#include "shared/str.h"
|
||||
#include "shared/report.h"
|
||||
#include "configfile.h"
|
||||
#include "report.h"
|
||||
//#include "configfile.h"
|
||||
#include "timing.h"
|
||||
#define uPause timing_uPause
|
||||
|
||||
@@ -256,7 +255,7 @@ inline void sed1330_set_pixel( PrivateData * p, int x, int y, int value );
|
||||
/////////////////////////////////////////////////////////////////
|
||||
// Init the driver and display
|
||||
//
|
||||
int
|
||||
MODULE_EXPORT int
|
||||
sed1330_init( Driver * drvthis, char *args )
|
||||
{
|
||||
char * s;
|
||||
@@ -265,8 +264,6 @@ sed1330_init( Driver * drvthis, char *args )
|
||||
|
||||
debug( RPT_INFO, "SED1330: init(%p,%s)", drvthis, args );
|
||||
|
||||
// TODO: replace DriverName with driver->name when that field exists.
|
||||
|
||||
|
||||
// Alocate and store private p
|
||||
p = (PrivateData *) malloc( sizeof(PrivateData) );
|
||||
@@ -281,13 +278,14 @@ sed1330_init( Driver * drvthis, char *args )
|
||||
// READ THE CONFIG FILE
|
||||
|
||||
// Port
|
||||
port = config_get_int( drvthis->name, "port", 0, 0x278 );
|
||||
port = drvthis->config_get_int( drvthis->name, "port", 0, 0x278 );
|
||||
p->port = port;
|
||||
|
||||
// Type
|
||||
s = drvthis->config_get_string( drvthis->name, "type", 0, NULL );
|
||||
if( !s ) {
|
||||
report( RPT_ERR, "SED1330: you need to specify the display type" );
|
||||
return -1;
|
||||
} else if( strcmp( s, "G321D" ) == 0 ) {
|
||||
p->type = TYPE_G321D;
|
||||
p->graph_width = 320;
|
||||
@@ -363,39 +361,6 @@ sed1330_init( Driver * drvthis, char *args )
|
||||
if (timing_init() == -1)
|
||||
return -1;
|
||||
|
||||
// Set variables for server
|
||||
drvthis->stay_in_foreground = &stay_in_foreground;
|
||||
drvthis->api_version = api_version;
|
||||
drvthis->supports_multiple = &supports_multiple;
|
||||
|
||||
// Set the functions the driver supports...
|
||||
drvthis->init = sed1330_init;
|
||||
drvthis->close = sed1330_close;
|
||||
|
||||
drvthis->width = sed1330_width;
|
||||
drvthis->height = sed1330_height;
|
||||
|
||||
drvthis->flush = sed1330_flush;
|
||||
drvthis->clear = sed1330_clear;
|
||||
drvthis->chr = sed1330_chr;
|
||||
drvthis->string = sed1330_string;
|
||||
//drvthis->init_vbar = sed1330_init_vbar;
|
||||
//drvthis->init_hbar = sed1330_init_hbar;
|
||||
drvthis->vbar = sed1330_vbar;
|
||||
drvthis->hbar = sed1330_hbar;
|
||||
//drvthis->init_num = sed1330_init_num;
|
||||
drvthis->num = sed1330_num;
|
||||
drvthis->heartbeat = sed1330_heartbeat;
|
||||
//drvthis->set_char = sed1330_set_char;
|
||||
//drvthis->icon = sed1330_icon;
|
||||
|
||||
// drvthis->contrast = sed1330_contrast; // contrast is set by potmeter we assume
|
||||
// drvthis->output = sed1330_output; // not implemented
|
||||
|
||||
// drvthis->flush_box = sed1330_flush_box; // NOT SUPPORTED ANYMORE
|
||||
// drvthis->draw_frame = sed1330_draw_frame; // NOT SUPPORTED ANYMORE
|
||||
|
||||
|
||||
// INITIALIZE THE LCD
|
||||
// End reset-state
|
||||
debug( RPT_DEBUG, "SED1330: initializing LCD" );
|
||||
@@ -413,11 +378,11 @@ sed1330_init( Driver * drvthis, char *args )
|
||||
sed1330_command( p, CMD_SCROLL, 10, ((char[6]) {SCR1_L,SCR1_H,0xC7,SCR2_L,SCR2_H,0xC7}) ); // screen1 and screen2 memory locations
|
||||
break;
|
||||
case TYPE_G121C:
|
||||
sed1330_command( p, CMD_SYSTEM_SET, 8, ((char[8]) {0x30,0x80+CHARWIDTH-1,CHARHEIGHT-1,0x14,0x18,0x7F,0x16,0x00}) ); // Set textmode 21x12
|
||||
sed1330_command( p, CMD_SYSTEM_SET, 8, ((char[8]) {0x30,0x80+CHARWIDTH-1,CHARHEIGHT-1,0x14,0x58,0x7F,0x16,0x00}) ); // Set textmode 21x12
|
||||
sed1330_command( p, CMD_SCROLL, 10, ((char[6]) {SCR1_L,SCR1_H,0xC7,SCR2_L,SCR2_H,0xC7}) ); // screen1 and screen2 memory locations
|
||||
break;
|
||||
case TYPE_G242C:
|
||||
sed1330_command( p, CMD_SYSTEM_SET, 8, ((char[8]) {0x30,0x80+CHARWIDTH-1,CHARHEIGHT-1,0x27,0x2B,0x7F,0x29,0x00}) ); // Set textmode 40x12
|
||||
sed1330_command( p, CMD_SYSTEM_SET, 8, ((char[8]) {0x30,0x80+CHARWIDTH-1,CHARHEIGHT-1,0x27,0x58,0x7F,0x29,0x00}) ); // Set textmode 40x12
|
||||
sed1330_command( p, CMD_SCROLL, 10, ((char[6]) {SCR1_L,SCR1_H,0xC7,SCR2_L,SCR2_H,0xC7}) ); // screen1 and screen2 memory locations
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "lcd.h"
|
||||
|
||||
int sed1330_init( Driver * drvthis, char *args );
|
||||
MODULE_EXPORT int sed1330_init( Driver * drvthis, char *args );
|
||||
MODULE_EXPORT void sed1330_close( Driver * drvthis );
|
||||
MODULE_EXPORT int sed1330_width( Driver * drvthis );
|
||||
MODULE_EXPORT int sed1330_height( Driver * drvthis );
|
||||
|
||||
@@ -31,7 +31,8 @@
|
||||
#include "port.h"
|
||||
#include "timing.h"
|
||||
#define uPause timing_uPause
|
||||
#include "sed1520fm.c"
|
||||
|
||||
#include "sed1520fm.h"
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
@@ -144,7 +145,7 @@ drawchar2fb (int x, int y, unsigned char z)
|
||||
// This initialises the stuff. We support supplying port as
|
||||
// a command line argument.
|
||||
//
|
||||
int
|
||||
MODULE_EXPORT int
|
||||
sed1520_init (Driver *drvthis, char *args)
|
||||
{
|
||||
char *argv[64], *str;
|
||||
@@ -234,35 +235,6 @@ sed1520_init (Driver *drvthis, char *args)
|
||||
cellwidth = 6;
|
||||
cellheight = 8;
|
||||
|
||||
|
||||
// Set variables for server
|
||||
drvthis->api_version = api_version;
|
||||
drvthis->stay_in_foreground = &stay_in_foreground;
|
||||
drvthis->supports_multiple = &supports_multiple;
|
||||
|
||||
// Set the functions the driver supports
|
||||
drvthis->clear = sed1520_clear;
|
||||
drvthis->string = sed1520_string;
|
||||
drvthis->chr = sed1520_chr;
|
||||
drvthis->old_vbar = sed1520_vbar;
|
||||
drvthis->old_hbar = sed1520_hbar;
|
||||
drvthis->num = sed1520_num;
|
||||
drvthis->init = sed1520_init;
|
||||
drvthis->close = sed1520_close;
|
||||
drvthis->flush = sed1520_flush;
|
||||
drvthis->set_char = sed1520_set_char;
|
||||
|
||||
drvthis->old_icon = sed1520_icon;
|
||||
// We dont't need init for vbar,hbar and friends.
|
||||
//drvthis->init_hbar = NULL;
|
||||
//drvthis->init_vbar = NULL;
|
||||
//drvthis->init_num = NULL;
|
||||
// Neither contrast nor backlight are controllable.
|
||||
//drvthis->contrast = NULL;
|
||||
//drvthis->backlight = NULL;
|
||||
// There are some unused input lines that may be used for input,
|
||||
// but nothing is programmed so far.
|
||||
//drvthis->getkey = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include "lcd.h"
|
||||
|
||||
int sed1520_init (Driver *drvthis, char *args);
|
||||
MODULE_EXPORT int sed1520_init (Driver *drvthis, char *args);
|
||||
MODULE_EXPORT void sed1520_close (Driver *drvthis);
|
||||
MODULE_EXPORT int sed1520_width (Driver *drvthis);
|
||||
MODULE_EXPORT int sed1520_height (Driver *drvthis);
|
||||
|
||||
@@ -836,7 +836,7 @@ unsigned char fontmap[256][8] = {
|
||||
|
||||
//FIXME: make big chars use less memory
|
||||
|
||||
static unsigned char *fontbignum[10][24] = {
|
||||
unsigned char *fontbignum[10][24] = {
|
||||
{
|
||||
"++++++++++++++++++",
|
||||
"++++++++++++++++++",
|
||||
@@ -1089,7 +1089,7 @@ static unsigned char *fontbignum[10][24] = {
|
||||
"++++++++++++++++++"}
|
||||
};
|
||||
|
||||
static unsigned char *fontbigdp[] = {
|
||||
unsigned char *fontbigdp[] = {
|
||||
"++++++",
|
||||
"++++++",
|
||||
"++++++",
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
#include <sys/errno.h>
|
||||
#include <sys/io.h>
|
||||
//#include <sys/io.h>
|
||||
#include <time.h>
|
||||
#include "port.h"
|
||||
#include "timing.h"
|
||||
@@ -279,7 +279,7 @@ stv5730_drawchar2fb (int x, int y, unsigned char z)
|
||||
// This initialises the stuff. We support supplying port as
|
||||
// a command line argument.
|
||||
//
|
||||
int
|
||||
MODULE_EXPORT int
|
||||
stv5730_init (Driver *drvthis, char *args)
|
||||
{
|
||||
char *argv[64], *str;
|
||||
@@ -440,39 +440,6 @@ stv5730_init (Driver *drvthis, char *args)
|
||||
// clear screen
|
||||
memset (stv5730_framebuf, 0, STV5730_WID * STV5730_HGT);
|
||||
|
||||
// Set variables for server
|
||||
drvthis->api_version = api_version;
|
||||
drvthis->stay_in_foreground = &stay_in_foreground;
|
||||
drvthis->supports_multiple = &supports_multiple;
|
||||
|
||||
// Set the functions the driver supports
|
||||
drvthis->clear = stv5730_clear;
|
||||
drvthis->string = stv5730_string;
|
||||
drvthis->chr = stv5730_chr;
|
||||
drvthis->old_vbar = stv5730_vbar;
|
||||
drvthis->old_hbar = stv5730_hbar;
|
||||
drvthis->num = stv5730_num;
|
||||
drvthis->init = stv5730_init;
|
||||
drvthis->close = stv5730_close;
|
||||
drvthis->width = stv5730_width;
|
||||
drvthis->height = stv5730_height;
|
||||
drvthis->cellwidth = stv5730_cellwidth;
|
||||
drvthis->cellheight = stv5730_cellheight;
|
||||
drvthis->flush = stv5730_flush;
|
||||
// We dont't have any programmable chars.
|
||||
//drvthis->set_char = NULL;
|
||||
|
||||
drvthis->old_icon = stv5730_icon;
|
||||
// We dont't need init for vbar,hbar and friends.
|
||||
//drvthis->init_hbar = NULL;
|
||||
//drvthis->init_vbar = NULL;
|
||||
//drvthis->init_num = NULL;
|
||||
// Neither contrast nor backlight are controllable.
|
||||
//drvthis->contrast = NULL;
|
||||
//drvthis->backlight = NULL;
|
||||
// There are some unused input lines that may be used for input,
|
||||
// but nothing is programmed so far.
|
||||
//drvthis->getkey = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include "lcd.h"
|
||||
|
||||
int stv5730_init (Driver *drvthis, char *args);
|
||||
MODULE_EXPORT int stv5730_init (Driver *drvthis, char *args);
|
||||
MODULE_EXPORT void stv5730_close (Driver *drvthis);
|
||||
MODULE_EXPORT int stv5730_width (Driver *drvthis);
|
||||
MODULE_EXPORT int stv5730_height (Driver *drvthis);
|
||||
|
||||
@@ -242,7 +242,7 @@ spaced_gl_writen (int x, int y, int count, char *text)
|
||||
|
||||
static char icon_char = '@';
|
||||
|
||||
int
|
||||
MODULE_EXPORT int
|
||||
svgalib_drv_init (struct lcd_logical_driver *driver, char *args)
|
||||
{
|
||||
char *argv[64];
|
||||
@@ -277,31 +277,6 @@ svgalib_drv_init (struct lcd_logical_driver *driver, char *args)
|
||||
|
||||
gl_clearscreen (gl_rgbcolor (0, 0, 0));
|
||||
|
||||
driver->daemonize = 0; // don't daemonize...
|
||||
|
||||
// Override output functions...
|
||||
driver->clear = svgalib_drv_clear;
|
||||
driver->string = svgalib_drv_string;
|
||||
driver->chr = svgalib_drv_chr;
|
||||
driver->vbar = svgalib_drv_vbar;
|
||||
//driver->init_vbar = NULL;
|
||||
driver->hbar = svgalib_drv_hbar;
|
||||
//driver->init_hbar = NULL;
|
||||
driver->num = svgalib_drv_num;
|
||||
driver->init_num = svgalib_drv_init_num;
|
||||
|
||||
driver->init = svgalib_drv_init;
|
||||
driver->close = svgalib_drv_close;
|
||||
driver->flush = svgalib_drv_flush;
|
||||
driver->flush_box = svgalib_drv_flush_box;
|
||||
//driver->contrast = NULL;
|
||||
//driver->backlight = NULL;
|
||||
//driver->set_char = NULL;
|
||||
driver->icon = svgalib_drv_icon;
|
||||
driver->draw_frame = svgalib_drv_draw_frame;
|
||||
|
||||
driver->getkey = svgalib_drv_getkey;
|
||||
|
||||
// Change the character used for padding the title bars...
|
||||
SVGALIB_PAD = '#';
|
||||
// Change the character used for "..."
|
||||
|
||||
+2
-32
@@ -18,7 +18,7 @@
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
//#include <asm/io.h>
|
||||
#include <sys/perm.h>
|
||||
//#include <sys/perm.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
@@ -28,7 +28,6 @@
|
||||
#include "t6963.h"
|
||||
#include "t6963_font.h"
|
||||
|
||||
#include "shared/str.h"
|
||||
#include "shared/debug.h"
|
||||
#include "report.h"
|
||||
#include "lcd_lib.h"
|
||||
@@ -60,7 +59,7 @@ MODULE_EXPORT int stay_in_foreground = 0;
|
||||
MODULE_EXPORT int supports_multiple = 0;
|
||||
MODULE_EXPORT char *symbol_prefix = "t6963_";
|
||||
|
||||
int
|
||||
MODULE_EXPORT int
|
||||
t6963_init (Driver *drvthis, char *args)
|
||||
{
|
||||
int w, h, p;
|
||||
@@ -153,35 +152,6 @@ t6963_init (Driver *drvthis, char *args)
|
||||
}
|
||||
|
||||
|
||||
debug (RPT_DEBUG, "T6963: Setting function pointers...\n");
|
||||
|
||||
// Set variables for server
|
||||
drvthis->stay_in_foreground = &stay_in_foreground;
|
||||
drvthis->api_version = api_version;
|
||||
drvthis->supports_multiple = &supports_multiple;
|
||||
|
||||
debug (RPT_DEBUG, "T6963: Server variables set!");
|
||||
|
||||
// Set the functions the driver supports
|
||||
drvthis->width = t6963_width;
|
||||
drvthis->height = t6963_height;
|
||||
drvthis->clear = t6963_clear;
|
||||
drvthis->string = t6963_string;
|
||||
drvthis->chr = t6963_chr;
|
||||
drvthis->vbar = t6963_vbar;
|
||||
drvthis->hbar = t6963_hbar;
|
||||
drvthis->num = t6963_num;
|
||||
drvthis->init = t6963_init;
|
||||
drvthis->close = t6963_close;
|
||||
drvthis->flush = t6963_flush;
|
||||
drvthis->set_char = t6963_set_char;
|
||||
drvthis->icon = t6963_icon;
|
||||
drvthis->heartbeat = t6963_heartbeat;
|
||||
|
||||
//drvthis->get_key = t6963_get_key;
|
||||
|
||||
debug (RPT_DEBUG, "T6963: Supported functions set!");
|
||||
|
||||
debug (RPT_DEBUG, "T6963: Sending init to display...");
|
||||
|
||||
T6963_CEHI; // disable chip
|
||||
|
||||
@@ -114,7 +114,7 @@ typedef unsigned char u8;
|
||||
// ****************************************************************************************
|
||||
|
||||
|
||||
int t6963_init (Driver *drvthis, char *args);
|
||||
MODULE_EXPORT int t6963_init (Driver *drvthis, char *args);
|
||||
MODULE_EXPORT void t6963_close (Driver *drvthis);
|
||||
MODULE_EXPORT int t6963_width (Driver *drvthis);
|
||||
MODULE_EXPORT int t6963_height (Driver *drvthis);
|
||||
|
||||
+1
-32
@@ -82,7 +82,7 @@ MODULE_EXPORT char *symbol_prefix = "text_";
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
int
|
||||
MODULE_EXPORT int
|
||||
text_init (Driver *drvthis, char *args)
|
||||
{
|
||||
// Set display sizes
|
||||
@@ -102,37 +102,6 @@ text_init (Driver *drvthis, char *args)
|
||||
framebuf = (unsigned char *) malloc (width * height);
|
||||
memset (framebuf, ' ', width * height);
|
||||
|
||||
// Set variables for server
|
||||
drvthis->api_version = api_version;
|
||||
drvthis->stay_in_foreground = &stay_in_foreground;
|
||||
drvthis->supports_multiple = &supports_multiple;
|
||||
|
||||
// Set the functions the driver supports
|
||||
drvthis->init = text_init;
|
||||
drvthis->close = text_close;
|
||||
drvthis->width = text_width;
|
||||
drvthis->height = text_height;
|
||||
|
||||
drvthis->clear = text_clear;
|
||||
drvthis->flush = text_flush;
|
||||
drvthis->string = text_string;
|
||||
drvthis->chr = text_chr;
|
||||
|
||||
drvthis->vbar = text_vbar;
|
||||
//drvthis->init_vbar = NULL;
|
||||
drvthis->hbar = text_hbar;
|
||||
//drvthis->init_hbar = NULL;
|
||||
drvthis->num = text_num;
|
||||
//drvthis->init_num = NULL;
|
||||
|
||||
drvthis->set_contrast = text_set_contrast;
|
||||
drvthis->backlight = text_backlight;
|
||||
|
||||
//drvthis->set_char = NULL;
|
||||
//drvthis->icon = NULL;
|
||||
|
||||
//drvthis->get_key = NULL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include "lcd.h"
|
||||
|
||||
int text_init (Driver * drvthis, char *args);
|
||||
MODULE_EXPORT int text_init (Driver * drvthis, char *args);
|
||||
MODULE_EXPORT void text_close (Driver *drvthis);
|
||||
MODULE_EXPORT int text_width (Driver *drvthis);
|
||||
MODULE_EXPORT int text_height (Driver *drvthis);
|
||||
|
||||
@@ -46,7 +46,7 @@ MODULE_EXPORT char *symbol_prefix = "sli_";
|
||||
/////////////////////////////////////////////////////////////////
|
||||
// Opens com port and sets baud correctly...
|
||||
//
|
||||
int
|
||||
MODULE_EXPORT int
|
||||
sli_init (Driver *drvthis, char *args)
|
||||
{
|
||||
char *argv[64];
|
||||
@@ -159,32 +159,6 @@ sli_init (Driver *drvthis, char *args)
|
||||
width = 15;
|
||||
height = 2;
|
||||
|
||||
// Set variables for server
|
||||
drvthis->api_version = api_version;
|
||||
drvthis->stay_in_foreground = &stay_in_foreground;
|
||||
drvthis->supports_multiple = &supports_multiple;
|
||||
|
||||
// Set the functions the driver supports
|
||||
drvthis->clear = sli_clear;
|
||||
drvthis->string = sli_string;
|
||||
drvthis->chr = sli_chr;
|
||||
drvthis->old_vbar = sli_vbar;
|
||||
drvthis->init_vbar = sli_init_vbar;
|
||||
drvthis->old_hbar = sli_hbar;
|
||||
drvthis->init_hbar = sli_init_hbar;
|
||||
//drvthis->num = NULL;
|
||||
//drvthis->init_num = NULL;
|
||||
|
||||
drvthis->init = sli_init;
|
||||
drvthis->close = sli_close;
|
||||
drvthis->flush = sli_flush;
|
||||
//drvthis->contrast = NULL;
|
||||
//drvthis->backlight = NULL;
|
||||
drvthis->set_char = sli_set_char;
|
||||
drvthis->old_icon = sli_icon;
|
||||
|
||||
//drvthis->getkey = NULL;
|
||||
|
||||
return fd;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include "lcd.h"
|
||||
|
||||
int sli_init (Driver *drvthis, char *args);
|
||||
MODULE_EXPORT int sli_init (Driver *drvthis, char *args);
|
||||
MODULE_EXPORT void sli_close (Driver *drvthis);
|
||||
MODULE_EXPORT int sli_width (Driver *drvthis);
|
||||
MODULE_EXPORT int sli_height (Driver *drvthis);
|
||||
|
||||
+37
-102
@@ -53,12 +53,12 @@ extern int optind, optopt, opterr;
|
||||
|
||||
#define MAX_TIMER 0x10000
|
||||
|
||||
/*#define DEFAULT_DEBUG_LEVEL 1*/
|
||||
#define DEFAULT_LCD_PORT LCDPORT
|
||||
#define DEFAULT_BIND_ADDR "127.0.0.1"
|
||||
#define DEFAULT_CONFIGFILE "/etc/LCDd.conf"
|
||||
#define DEFAULT_USER "nobody"
|
||||
#define DEFAULT_DRIVER "curses"
|
||||
#define DEFAULT_DRIVER_PATH
|
||||
#define DEFAULT_WAITTIME 8
|
||||
#define MAX_DRIVERS 8
|
||||
#define DEFAULT_DAEMON_MODE 1
|
||||
@@ -89,14 +89,14 @@ char *build_date = __DATE__;
|
||||
#define UNSET_INT -1
|
||||
#define UNSET_STR "\01"
|
||||
|
||||
int debug_level; /* for compatibility with MtxOrb and joy drivers.
|
||||
/* int debug_level; for compatibility with MtxOrb and joy drivers.
|
||||
* I was about to remove the comment in front of this.
|
||||
* Now how do we become compatible WITHOUT this debug_level ?*/
|
||||
|
||||
int lcd_port = UNSET_INT;
|
||||
char bind_addr[64] = UNSET_STR;
|
||||
char configfile[256] = UNSET_STR;
|
||||
char user[64] = UNSET_STR;
|
||||
char bind_addr[64]; /* Do not preinit these strings as they will occupy */
|
||||
char configfile[256]; /* a lot of space in the executable. */
|
||||
char user[64]; /* The values will be overwritten anyway... */
|
||||
|
||||
int daemon_mode = UNSET_INT;
|
||||
int enable_server_screen = UNSET_INT;
|
||||
@@ -107,34 +107,9 @@ static int serverStarted = 0;
|
||||
|
||||
/* The drivers and their driver parameters*/
|
||||
char *drivernames[MAX_DRIVERS];
|
||||
char *driverfilenames[MAX_DRIVERS];
|
||||
char *driverargs[MAX_DRIVERS];
|
||||
int num_drivers = 0;
|
||||
|
||||
|
||||
/* The parameter structure and args[] should
|
||||
* be removed when getopt(3) is implemented,
|
||||
* as there won't be any need for them then.
|
||||
* typedef struct parameter {
|
||||
* char *sh, *lg; */ /* short and long versions*/
|
||||
/*} parameter;
|
||||
+
|
||||
* This is currently only a list of available arguments, but doesn't
|
||||
* really *do* anything. It just helps to figure out which parameters
|
||||
* go to the server, and which ones go to individual drivers...
|
||||
*static parameter args[] = {
|
||||
* {"-h", "--help"},
|
||||
* {"-d", "--driver"},
|
||||
* {"-t", "--type"},
|
||||
* {"-f", "--foreground"},
|
||||
* {"-b", "--backlight"},
|
||||
* {"-i", "--serverinfo"},
|
||||
* {"-w", "--waittime"},
|
||||
* {NULL, NULL},
|
||||
*};
|
||||
*/
|
||||
|
||||
|
||||
/**** Local functions ****/
|
||||
void exit_program (int val);
|
||||
void HelpScreen ();
|
||||
@@ -149,9 +124,8 @@ int drop_privs(char *user);
|
||||
int init_drivers();
|
||||
int init_screens();
|
||||
void do_mainloop();
|
||||
void lcd_list_drivers();
|
||||
|
||||
#define ESSENTIAL(f) {int r; if( ( r=(f) )<0 ) { report( RPT_CRIT,"Critical error, abort"); return r;}}
|
||||
#define ESSENTIAL(f) {int r; if( ( r=(f) )<0 ) { report( RPT_CRIT,"Critical error, abort"); exit_program(0);}}
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
@@ -212,13 +186,13 @@ main (int argc, char **argv)
|
||||
set_default_settings();
|
||||
|
||||
/* Set reporting values*/
|
||||
debug_level = reportLevel;
|
||||
/*debug_level = reportLevel; */
|
||||
ESSENTIAL( set_reporting( reportLevel, (reportToSyslog?RPT_DEST_SYSLOG:RPT_DEST_STDERR) ) );
|
||||
report( RPT_NOTICE, "Set report level to %d, output to %s", reportLevel, (reportToSyslog?"syslog":"stderr") );
|
||||
|
||||
/* Startup the server*/
|
||||
ESSENTIAL( init_sockets() );
|
||||
ESSENTIAL( init_drivers() );
|
||||
ESSENTIAL( init_sockets() );
|
||||
ESSENTIAL( init_screens() );
|
||||
ESSENTIAL( drop_privs(user) );
|
||||
|
||||
@@ -263,11 +237,7 @@ clear_settings ()
|
||||
|
||||
for( i=0; i < num_drivers; i++ ) {
|
||||
free( drivernames[i] );
|
||||
free( driverfilenames[i] );
|
||||
free( driverargs[i] );
|
||||
drivernames[i] = NULL;
|
||||
driverfilenames[i] = NULL;
|
||||
driverargs[i] = NULL;
|
||||
}
|
||||
num_drivers = 0;
|
||||
}
|
||||
@@ -277,7 +247,7 @@ clear_settings ()
|
||||
int
|
||||
process_command_line (int argc, char **argv)
|
||||
{
|
||||
char c;
|
||||
signed char c;
|
||||
|
||||
/*report( RPT_INFO, "process_command_line()" );*/
|
||||
|
||||
@@ -290,13 +260,8 @@ process_command_line (int argc, char **argv)
|
||||
case 'd':
|
||||
/* Add to a list of drivers to be initialized later...*/
|
||||
if (num_drivers < MAX_DRIVERS) {
|
||||
drivernames[num_drivers] = malloc( strlen(optarg)+1 );
|
||||
driverfilenames[num_drivers] = malloc( strlen(optarg)+1 );
|
||||
driverargs[num_drivers] = malloc(1);
|
||||
|
||||
drivernames[num_drivers] = malloc( strlen(optarg)+1 );
|
||||
strcpy( drivernames[num_drivers], optarg );
|
||||
strcpy( driverfilenames[num_drivers], optarg );
|
||||
strcpy( driverargs[num_drivers], "" );
|
||||
num_drivers ++;
|
||||
} else
|
||||
report( RPT_ERR, "Too many drivers!" );
|
||||
@@ -374,7 +339,6 @@ process_command_line (int argc, char **argv)
|
||||
int
|
||||
process_configfile ( char *configfile )
|
||||
{
|
||||
int i;
|
||||
char * s;
|
||||
/*char buf[64];*/
|
||||
|
||||
@@ -382,11 +346,9 @@ process_configfile ( char *configfile )
|
||||
|
||||
/* Read server settings*/
|
||||
|
||||
config_read_file( configfile );
|
||||
|
||||
/* if( debug_level == UNSET_INT )
|
||||
* debug_level = config_get_int( "server", "debug", 0, UNSET_INT );
|
||||
*/
|
||||
if( config_read_file( configfile ) != 0 ) {
|
||||
report( RPT_WARNING, "Could not read config file: %s", configfile );
|
||||
}
|
||||
|
||||
if( lcd_port == UNSET_INT )
|
||||
lcd_port = config_get_int( "server", "port", 0, UNSET_INT );
|
||||
@@ -402,8 +364,8 @@ process_configfile ( char *configfile )
|
||||
if( default_duration == 0 )
|
||||
default_duration = UNSET_INT;
|
||||
else if( default_duration * TIME_UNIT < 2e6 ) {
|
||||
report( RPT_ERR, "Waittime should be at least 2 (seconds)" );
|
||||
return -1;
|
||||
report( RPT_WARNING, "Waittime should be at least 2 (seconds). Set to 2 seconds." );
|
||||
default_duration = 2e6 / TIME_UNIT;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -431,7 +393,7 @@ process_configfile ( char *configfile )
|
||||
backlight = BACKLIGHT_OPEN;
|
||||
}
|
||||
else if( strcmp( s, UNSET_STR ) != 0 ) {
|
||||
report( RPT_ERR, "Backlight state should be on, off or open" );
|
||||
report( RPT_WARNING, "Backlight state should be on, off or open" );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -455,35 +417,17 @@ process_configfile ( char *configfile )
|
||||
/* read the drivernames*/
|
||||
|
||||
while( 1 ) {
|
||||
s = config_get_string( "server", "driver", num_drivers, "" );
|
||||
if( !s || s[0] == 0 )
|
||||
s = config_get_string( "server", "driver", num_drivers, NULL );
|
||||
if( !s )
|
||||
break;
|
||||
|
||||
drivernames[num_drivers] = malloc(strlen(s)+1);
|
||||
driverfilenames[num_drivers] = malloc(1);
|
||||
driverargs[num_drivers] = malloc(1);
|
||||
|
||||
strcpy( drivernames[num_drivers], s );
|
||||
strcpy( driverfilenames[num_drivers], "" );
|
||||
strcpy( driverargs[num_drivers], "" );
|
||||
|
||||
num_drivers++;
|
||||
if( s[0] != 0 ) {
|
||||
drivernames[num_drivers] = malloc(strlen(s)+1);
|
||||
strcpy( drivernames[num_drivers], s );
|
||||
num_drivers++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Now read the driver options that the server needs
|
||||
* Drivers can read their own options later...
|
||||
*/
|
||||
for( i=0; i<num_drivers; i ++ ) {
|
||||
s = config_get_string( drivernames[i], "file", 0, "" );
|
||||
driverfilenames[i] = realloc( driverfilenames[i], strlen(s)+1 );
|
||||
strcpy (driverfilenames[i], s );
|
||||
|
||||
s = config_get_string( drivernames[i], "arguments", 0, "" );
|
||||
driverargs[i] = realloc( driverargs[i], strlen(s)+1 );
|
||||
strcpy (driverargs[i], s );
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -495,9 +439,6 @@ set_default_settings()
|
||||
|
||||
/* Set defaults into unfilled variables....*/
|
||||
|
||||
/* if (debug_level == UNSET_INT)
|
||||
* debug_level = DEFAULT_DEBUG_LEVEL;
|
||||
*/
|
||||
if (lcd_port == UNSET_INT)
|
||||
lcd_port = DEFAULT_LCD_PORT;
|
||||
if (strcmp( bind_addr, UNSET_STR ) == 0)
|
||||
@@ -524,13 +465,8 @@ set_default_settings()
|
||||
/* Use default driver*/
|
||||
if( num_drivers == 0 ) {
|
||||
drivernames[0] = malloc(strlen(DEFAULT_DRIVER)+1);
|
||||
driverfilenames[0] = malloc(1);
|
||||
driverargs[0] = malloc(1);
|
||||
strcpy(drivernames[0], DEFAULT_DRIVER);
|
||||
strcpy(driverfilenames[0], "");
|
||||
strcpy(driverargs[0], "");
|
||||
|
||||
num_drivers++;
|
||||
num_drivers = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -596,7 +532,7 @@ init_drivers()
|
||||
|
||||
for (i = 0; i < num_drivers; i++) {
|
||||
|
||||
res = drivers_load_driver (drivernames[i], driverfilenames[i], driverargs[i]);
|
||||
res = drivers_load_driver (drivernames[i]);
|
||||
if (res >= 0) {
|
||||
/* Load went OK */
|
||||
|
||||
@@ -783,13 +719,15 @@ exit_program (int val)
|
||||
* things are shut down in shouldn't matter...
|
||||
*/
|
||||
|
||||
strncpy(buf, "Server shutting down on ", sizeof (buf) );
|
||||
switch(val) {
|
||||
case 1: strcat(buf, "SIGHUP"); break;
|
||||
case 2: strcat(buf, "SIGINT"); break;
|
||||
case 15: strcat(buf, "SIGTERM"); break;
|
||||
default: snprintf(buf, sizeof(buf), "Server shutting down on signal %d", val); break;
|
||||
/* Other values should not be seen, but just in case.. */
|
||||
if( val > 0 ) {
|
||||
strncpy(buf, "Server shutting down on ", sizeof (buf) );
|
||||
switch(val) {
|
||||
case 1: strcat(buf, "SIGHUP"); break;
|
||||
case 2: strcat(buf, "SIGINT"); break;
|
||||
case 15: strcat(buf, "SIGTERM"); break;
|
||||
default: snprintf(buf, sizeof(buf), "Server shutting down on signal %d", val); break;
|
||||
/* Other values should not be seen, but just in case.. */
|
||||
}
|
||||
}
|
||||
|
||||
report(RPT_NOTICE, buf); /* report it */
|
||||
@@ -801,11 +739,11 @@ exit_program (int val)
|
||||
reportLevel = DEFAULT_REPORTLEVEL;
|
||||
set_reporting( reportLevel, (reportToSyslog?RPT_DEST_SYSLOG:RPT_DEST_STDERR) );
|
||||
|
||||
goodbye_screen (); /* display goodbye screen on LCD display */
|
||||
drivers_unload_all (); /* release driver memory and file descriptors */
|
||||
|
||||
/* Shutdown things if server start was complete */
|
||||
if( serverStarted ) {
|
||||
goodbye_screen (); /* display goodbye screen on LCD display */
|
||||
drivers_unload_all (); /* release driver memory and file descriptors */
|
||||
|
||||
client_shutdown (); /* shutdown clients (must come first) */
|
||||
screenlist_shutdown (); /* shutdown screens (must come after client_shutdown) */
|
||||
sock_close_all (); /* close all open sockets (must come after client_shutdown) */
|
||||
@@ -845,9 +783,6 @@ HelpScreen ()
|
||||
fprintf (stdout, "\t-s\t\tOutput messages to syslog\n");
|
||||
fprintf (stdout, "\t-r <level>\tReport level (default=2)\n");
|
||||
|
||||
fprintf (stdout, "\nCurrently available drivers:\n");
|
||||
lcd_list_drivers();
|
||||
|
||||
/*fprintf (stdout, "\tHelp on each driver's parameters are obtained upon request:\n\t\t\"LCDd -d driver --help\"\n");*/
|
||||
/*fprintf (stdout, "Example:\n");*/
|
||||
/*fprintf (stdout, "\tLCDd -d MtxOrb \"--device /dev/lcd --contrast 200\" -d joy\n");*/
|
||||
|
||||
+3
-3
@@ -257,7 +257,7 @@ draw_frame (LinkedList * list,
|
||||
break;
|
||||
case WID_HBAR:
|
||||
if (reset) {
|
||||
drivers_init_hbar ();
|
||||
//drivers_init_hbar ();
|
||||
reset = 0;
|
||||
}
|
||||
if ((w->x > 0) && (w->y > 0)) {
|
||||
@@ -288,7 +288,7 @@ draw_frame (LinkedList * list,
|
||||
break;
|
||||
case WID_VBAR: /* FIXME: Vbars don't work in frames!*/
|
||||
if (reset) {
|
||||
drivers_init_vbar ();
|
||||
//drivers_init_vbar ();
|
||||
reset = 0;
|
||||
}
|
||||
if ((w->x > 0) && (w->y > 0)) {
|
||||
@@ -512,7 +512,7 @@ draw_frame (LinkedList * list,
|
||||
/* NOTE: y=10 means COLON (:)*/
|
||||
if ((w->x > 0) && (w->y >= 0) && (w->y <= 10)) {
|
||||
if (reset) {
|
||||
drivers_init_num ();
|
||||
//drivers_init_num ();
|
||||
reset = 0;
|
||||
}
|
||||
drivers_num (w->x + left, w->y);
|
||||
|
||||
+12
-9
@@ -48,8 +48,9 @@ void report( const int level, const char *format, .../*args*/ )
|
||||
va_list ap;
|
||||
va_start(ap, format); /* measure the required size (the number of elements of format) */
|
||||
|
||||
switch( report_dest ) {
|
||||
case RPT_DEST_STDERR:
|
||||
|
||||
switch( report_dest ) {
|
||||
case RPT_DEST_STDERR:
|
||||
vfprintf( stderr, format, ap );
|
||||
fprintf( stderr, "\n" );
|
||||
break;
|
||||
@@ -57,9 +58,9 @@ void report( const int level, const char *format, .../*args*/ )
|
||||
vsyslog( LOG_USER|(level+2), format, ap );
|
||||
break;
|
||||
case RPT_DEST_STORE:
|
||||
vsnprintf( buf, sizeof(buf), format, ap );
|
||||
buf[sizeof(buf)-1] = 0; // be sure to have a terminating 0
|
||||
store_report_message( level, buf );
|
||||
vsnprintf( buf, sizeof(buf), format, ap );
|
||||
buf[sizeof(buf)-1] = 0; // be sure to have a terminating 0
|
||||
store_report_message( level, buf );
|
||||
break;
|
||||
}
|
||||
va_end(ap);
|
||||
@@ -93,10 +94,12 @@ int set_reporting( int new_level, int new_dest )
|
||||
|
||||
static void store_report_message( int level, const char *message )
|
||||
{
|
||||
stored_msgs[num_stored_msgs] = malloc(strlen( message )+1);
|
||||
strcpy( stored_msgs[num_stored_msgs], message );
|
||||
stored_levels[num_stored_msgs] = level;
|
||||
num_stored_msgs ++;
|
||||
if( num_stored_msgs < MAX_STORED_MSGS ) {
|
||||
stored_msgs[num_stored_msgs] = malloc(strlen( message )+1);
|
||||
strcpy( stored_msgs[num_stored_msgs], message );
|
||||
stored_levels[num_stored_msgs] = level;
|
||||
num_stored_msgs ++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user