summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan McCrohan <jmccrohan@gmail.com>2016-12-16 19:32:45 -0500
committerJonathan McCrohan <jmccrohan@gmail.com>2016-12-16 19:32:45 -0500
commit97f683b2a8a16f77035979bec27c51300f701dba (patch)
treedf9c0f1bc14f28c61ed8173137c51a451dad2eb7
Import lcd4linux_0.11.0~svn1203.orig.tar.gz
[dgit import orig lcd4linux_0.11.0~svn1203.orig.tar.gz]
-rw-r--r--.cvsignore9
-rw-r--r--AUTHORS5
-rw-r--r--COPYING340
-rw-r--r--CREDITS4
-rw-r--r--ChangeLog4974
-rw-r--r--CodingStyle25
-rw-r--r--INSTALL237
-rw-r--r--Makefile.am201
-rw-r--r--Makefile.in1166
-rw-r--r--NEWS5
-rw-r--r--README5
-rw-r--r--TODO5
-rw-r--r--aclocal.m42814
-rw-r--r--ax_python_devel.m4323
-rwxr-xr-xbootstrap18
-rw-r--r--cfg.c714
-rw-r--r--cfg.h40
-rwxr-xr-xconfig.guess1526
-rw-r--r--config.h.in688
-rw-r--r--config.rpath666
-rwxr-xr-xconfig.sub1658
-rwxr-xr-xconfigure19607
-rw-r--r--configure.ac176
-rw-r--r--contrib/picoLCD/lcd4linux.conf629
-rw-r--r--contrib/picoLCD/lcd4linux.conf.mrtg92
-rw-r--r--contrib/picoLCD/lcd4linux.conf.rss143
-rw-r--r--contrib/picoLCD/lcd4linux.conf.rss.timers128
-rw-r--r--contrib/picoLCD/mrtg.py21
-rw-r--r--contrib/picoLCD/rsstimer.py92
-rw-r--r--curses.m4322
-rw-r--r--debug.c93
-rw-r--r--debug.h40
-rw-r--r--depcomp589
-rw-r--r--drivers.m4959
-rw-r--r--drv.c327
-rw-r--r--drv.h56
-rw-r--r--drv_ASTUSB.c512
-rw-r--r--drv_BWCT.c401
-rw-r--r--drv_BeckmannEgle.c735
-rw-r--r--drv_Crystalfontz.c1185
-rw-r--r--drv_Curses.c373
-rw-r--r--drv_Cwlinux.c538
-rwxr-xr-xdrv_D4D.c924
-rw-r--r--drv_EA232graphic.c618
-rw-r--r--drv_EFN.c400
-rw-r--r--drv_FW8888.c309
-rw-r--r--drv_FutabaVFD.c418
-rw-r--r--drv_G15.c675
-rw-r--r--drv_GLCD2USB.c648
-rw-r--r--drv_HD44780.c1507
-rw-r--r--drv_IRLCD.c406
-rw-r--r--drv_Image.c485
-rw-r--r--drv_LCD2USB.c679
-rw-r--r--drv_LCDLinux.c367
-rw-r--r--drv_LCDTerm.c291
-rw-r--r--drv_LEDMatrix.c321
-rw-r--r--drv_LPH7508.c528
-rw-r--r--drv_LUIse.c336
-rw-r--r--drv_LW_ABP.c682
-rw-r--r--drv_M50530.c688
-rw-r--r--drv_MatrixOrbital.c611
-rw-r--r--drv_MatrixOrbitalGX.c571
-rw-r--r--drv_MilfordInstruments.c285
-rw-r--r--drv_NULL.c195
-rw-r--r--drv_Newhaven.c526
-rw-r--r--drv_Noritake.c389
-rw-r--r--drv_PHAnderson.c416
-rw-r--r--drv_PICGraphic.c478
-rw-r--r--drv_Pertelian.c331
-rw-r--r--drv_RouterBoard.c693
-rw-r--r--drv_Sample.c601
-rw-r--r--drv_SamsungSPF.c511
-rw-r--r--drv_ShuttleVFD.c429
-rw-r--r--drv_SimpleLCD.c350
-rw-r--r--drv_T6963.c576
-rw-r--r--drv_TeakLCM.c1025
-rw-r--r--drv_Trefon.c416
-rw-r--r--drv_USBHUB.c341
-rw-r--r--drv_USBLCD.c508
-rw-r--r--drv_WincorNixdorf.c276
-rw-r--r--drv_X11.c808
-rw-r--r--drv_dpf.c726
-rw-r--r--drv_generic.c115
-rw-r--r--drv_generic.h43
-rw-r--r--drv_generic_gpio.c246
-rw-r--r--drv_generic_gpio.h47
-rw-r--r--drv_generic_graphic.c731
-rw-r--r--drv_generic_graphic.h58
-rw-r--r--drv_generic_i2c.c218
-rw-r--r--drv_generic_i2c.h63
-rw-r--r--drv_generic_keypad.c76
-rw-r--r--drv_generic_keypad.h38
-rw-r--r--drv_generic_parport.c566
-rw-r--r--drv_generic_parport.h100
-rw-r--r--drv_generic_serial.c415
-rw-r--r--drv_generic_serial.h39
-rw-r--r--drv_generic_text.c1001
-rw-r--r--drv_generic_text.h57
-rw-r--r--drv_mdm166a.c594
-rw-r--r--drv_picoLCD.c492
-rw-r--r--drv_picoLCDGraphic.c749
-rw-r--r--drv_serdisplib.c388
-rw-r--r--drv_st2205.c247
-rw-r--r--drv_ula200.c791
-rw-r--r--drv_vnc.c547
-rw-r--r--evaluator.c1468
-rw-r--r--evaluator.h69
-rw-r--r--event.c302
-rw-r--r--event.h68
-rw-r--r--font_6x8.h870
-rw-r--r--font_6x8_bold.h902
-rw-r--r--glcd2usb.h34
-rw-r--r--hash.c505
-rw-r--r--hash.h83
-rwxr-xr-xindent.sh20
-rwxr-xr-xinstall-sh519
-rw-r--r--layout.c203
-rw-r--r--layout.h35
-rw-r--r--lcd4kde.conf19
-rw-r--r--lcd4linux.c440
-rw-r--r--lcd4linux.conf.sample1376
-rw-r--r--lcd4linux.kdelnk14
-rw-r--r--lcd4linux.lsm16
-rw-r--r--lcd4linux.xpm62
-rw-r--r--lcd4linux_i2c.h611
-rwxr-xr-xmissing367
-rwxr-xr-xmkinstalldirs161
-rwxr-xr-xnph-png41
-rw-r--r--pid.c150
-rw-r--r--pid.h33
-rw-r--r--plugin.c538
-rw-r--r--plugin.h36
-rw-r--r--plugin_apm.c199
-rw-r--r--plugin_asterisk.c304
-rw-r--r--plugin_button_exec.c111
-rw-r--r--plugin_cfg.c140
-rw-r--r--plugin_cpuinfo.c166
-rw-r--r--plugin_dbus.c857
-rw-r--r--plugin_diskstats.c155
-rw-r--r--plugin_dvb.c169
-rw-r--r--plugin_event.c94
-rw-r--r--plugin_exec.c284
-rw-r--r--plugin_fifo.c318
-rw-r--r--plugin_file.c106
-rw-r--r--plugin_gps.c725
-rw-r--r--plugin_hddtemp.c282
-rw-r--r--plugin_huawei.c1162
-rw-r--r--plugin_i2c_sensors.c375
-rw-r--r--plugin_iconv.c142
-rw-r--r--plugin_imon.c629
-rw-r--r--plugin_isdn.c254
-rw-r--r--plugin_kvv.c814
-rw-r--r--plugin_loadavg.c141
-rw-r--r--plugin_math.c169
-rw-r--r--plugin_meminfo.c137
-rw-r--r--plugin_mpd.c931
-rw-r--r--plugin_mpris_dbus.c325
-rw-r--r--plugin_mysql.c243
-rw-r--r--plugin_netdev.c190
-rw-r--r--plugin_netinfo.c325
-rw-r--r--plugin_pop3.c346
-rw-r--r--plugin_ppp.c131
-rw-r--r--plugin_proc_stat.c381
-rw-r--r--plugin_python.c144
-rw-r--r--plugin_qnaplog.c427
-rw-r--r--plugin_raspi.c187
-rw-r--r--plugin_sample.c220
-rw-r--r--plugin_seti.c163
-rw-r--r--plugin_statfs.c100
-rw-r--r--plugin_string.c145
-rw-r--r--plugin_test.c112
-rw-r--r--plugin_time.c113
-rw-r--r--plugin_uname.c92
-rw-r--r--plugin_uptime.c238
-rw-r--r--plugin_w1retap.c264
-rw-r--r--plugin_wireless.c675
-rw-r--r--plugin_xmms.c148
-rw-r--r--plugins.m4639
-rw-r--r--png.html8
-rw-r--r--property.c174
-rw-r--r--property.h50
-rw-r--r--qprintf.c260
-rw-r--r--qprintf.h38
-rw-r--r--rgb.c64
-rw-r--r--rgb.h41
-rwxr-xr-xsmoketest.sh41
-rw-r--r--svn_version.h1
-rwxr-xr-xsvn_version.sh15
-rw-r--r--thread.c193
-rw-r--r--thread.h66
-rw-r--r--timer.c502
-rw-r--r--timer.h46
-rw-r--r--timer_group.c538
-rw-r--r--timer_group.h41
-rw-r--r--tux.pngbin0 -> 253 bytes
-rw-r--r--udelay.c114
-rw-r--r--udelay.h50
-rw-r--r--usbhub.conf94
-rw-r--r--widget.c308
-rw-r--r--widget.h84
-rw-r--r--widget_bar.c240
-rw-r--r--widget_bar.h58
-rw-r--r--widget_gpo.c130
-rw-r--r--widget_gpo.h42
-rw-r--r--widget_icon.c212
-rw-r--r--widget_icon.h48
-rw-r--r--widget_image.c292
-rw-r--r--widget_image.h48
-rw-r--r--widget_keypad.c146
-rw-r--r--widget_keypad.h53
-rw-r--r--widget_text.c451
-rw-r--r--widget_text.h58
-rw-r--r--widget_timer.c147
-rw-r--r--widget_timer.h44
214 files changed, 99317 insertions, 0 deletions
diff --git a/.cvsignore b/.cvsignore
new file mode 100644
index 0000000..b1ab72c
--- /dev/null
+++ b/.cvsignore
@@ -0,0 +1,9 @@
+Makefile
+.deps
+autom4te.cache
+config.h
+config.log
+config.status
+lcd4linux
+stamp-h1
+smoketest.log
diff --git a/AUTHORS b/AUTHORS
new file mode 100644
index 0000000..59c51b7
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1,5 @@
+# $Id: AUTHORS 730 2007-01-14 13:50:28Z michael $
+# $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/AUTHORS $
+
+Sorry, there is no AUTHORS anymore.
+Go to http://lcd4linux.bulix.org for a list of developers an contributors.
diff --git a/COPYING b/COPYING
new file mode 100644
index 0000000..d60c31a
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,340 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
diff --git a/CREDITS b/CREDITS
new file mode 100644
index 0000000..b3f4a65
--- /dev/null
+++ b/CREDITS
@@ -0,0 +1,4 @@
+$Id: CREDITS 730 2007-01-14 13:50:28Z michael $
+$URL: https://ssl.bulix.org/svn/lcd4linux/trunk/CREDITS $
+
+see http://lcd4linux.bulix.org for an up-to-date list of contributors!
diff --git a/ChangeLog b/ChangeLog
new file mode 100644
index 0000000..1bde524
--- /dev/null
+++ b/ChangeLog
@@ -0,0 +1,4974 @@
+2009-01-14 michael
+
+ * [r964]
+ add support for Dell M1730 LCD to the G15 driver by
+ lcd4linux@hayward.uk.com
+
+ * [r963]
+ initial brightness fixed
+
+2009-01-13 volker
+
+ * [r962]
+ indentation, svn-version
+
+ * [r961]
+ speedup X11 display
+
+2009-01-13 michael
+
+ * [r960]
+ new example for X11 config
+
+ * [r959]
+ heavy X11 reorganization to (hopefully) finally fix Tickets #141
+ and #117
+
+ * [r958]
+ list sub-drivers for serdisplib without -v
+
+ * [r957]
+ moved 'print list of drivers and plugins' to the end of configure
+
+2009-01-12 michux
+
+ * [r956]
+ update copyright
+
+2009-01-12 volker
+
+ * [r955]
+ additional verbose messages
+
+2009-01-12 michux
+
+ * [r954]
+ fix some compiler warnings
+
+2009-01-11 michux
+
+ * [r953]
+ plugin_fifo: fix compile warnings
+
+ * [r952]
+ drv_st2205u: add verbose error message
+
+2009-01-09 volker
+
+ * [r951]
+ version of linked serdisplib in long verbose output
+
+2009-01-08 michael
+
+ * [r950]
+ hhdtemp plugin fixed
+
+2009-01-06 michael
+
+ * [r949]
+ hddtemp autconf bug fixed
+
+ * [r948]
+ compiler warnings fixed
+
+ * [r947]
+ indentation
+
+ * [r946]
+ unused array 'tokenNames' removed
+
+ * [r945]
+ compiler warning removed
+
+ * [r944]
+ initialize plugin on first use
+
+ * [r943]
+ indentation
+
+ * [r942]
+ initialize fifo on first use
+
+ * [r941]
+ cosmetics
+
+2009-01-04 michael
+
+ * [r940]
+ new string operators eq ne gt ge lt le
+
+ * [r939]
+ indentation
+
+ * [r938]
+ typo fixed
+
+ * [r937]
+ disable unimplemented ioctls
+
+2009-01-01 michael
+
+ * [r936]
+ distcheck bugs fixed
+
+ * [r935]
+ button debugging changed
+
+ * [r934]
+ widget_bar scale debugging changed
+
+2008-12-31 michux
+
+ * [r933]
+ add buttons to X11 sample conf
+
+2008-12-31 michael
+
+ * [r932]
+ clear pixel to BG_COL (Ticket #117)
+
+ * [r931]
+ version bumped to 0.11.0
+
+ * [r930]
+ netinfo plugin added to smoketest
+
+ * [r929]
+ ported r847 (new Display CW12832 128x32) from volker_dev
+
+ * [r928]
+ ported r846 from volker_dev
+
+ * [r927]
+ ported r839 from volker_dev
+
+ * [r926]
+ ported r838 from volker_dev
+
+ * [r925]
+ ported r837 from volker_dev
+
+ * [r924]
+ ported r835 from volker_dev
+
+ * [r923]
+ ported r834 from volker_dev
+
+ * [r922]
+ r828: 'additional verbose and info messages' ported from
+ volker_dev
+
+ * [r921]
+ includes for umask() ported from volker_dev (r827)
+
+ * [r920]
+ handle config files with <CR><LF> (DOS line ending) ported from
+ volker_dev (r826)
+
+ * [r919]
+ netinfo plugin ported from volker_dev (r823)
+
+ * [r918]
+ format characters in qprintf() with optional length (r821) ported
+ from volker_dev
+
+ * [r917]
+ short circuit evaluation ported from volker_dev (r820,r822,r824)
+
+ * [r916]
+ Fixes a buffer underrun error and possible array index issues by
+ mcarey@...
+
+2008-12-27 michael
+
+ * [r915]
+ ported r819 from volker_dev
+
+ * [r914]
+ ported and modified r818 from volker_dev
+
+ * [r913]
+ port r817 from volker_dev
+
+ * [r912]
+ ported (modified) r815 from voker_dev
+
+2008-12-24 michael
+
+ * [r911]
+ cleanup & cosmetics
+
+ * [r910]
+ driver for the PHAnderson serial-to-HD44780 adapter boards by
+ Nicolas Weill
+
+ * [r909]
+ w1retap plugin by Jonathan Hudson
+
+ * [r908]
+ Enables/controls the backlight on the Pertelian LCD device by
+ Jonathan Hudson
+
+2008-12-23 michael
+
+ * [r907]
+ hddtemp plugin from Scott Bronson
+
+ * [r906]
+ keypad bug fixed
+
+ * [r905]
+ patch from a.nielsen: inverted parport signals, support GPI on
+ HD44780
+
+ * [r904]
+ indent run
+
+2008-11-25 michux
+
+ * [r903]
+ fix lcd4linux driver for multible onboard controllers
+
+2008-11-23 michux
+
+ * [r902]
+ fix automake - check for libftdi
+
+2008-11-22 michux
+
+ * [r901]
+ update button_exec plugin - fix segfault
+
+ * [r900]
+ update fifo plugin - untested
+
+2008-10-07 bwalle
+
+ * [r899]
+ Replace write to external variable usb_debug by calling
+ usb_set_debug().
+ This fixes build on openSUSE Factory.
+
+2008-10-06 michael
+
+ * [r898]
+ adding GPI to picoLCD for reading button events by Igor Mammedov
+ <niallain@gmail.com>
+
+ * [r897]
+ properties fixed
+
+2008-10-05 bwalle
+
+ * [r896]
+ Rebuild auto-generated autoconf stuff due to last change in
+ drivers.m4.
+
+ * [r895]
+ Add 'ULA200' driver when --with-drivers=all is specified
+
+2008-09-14 michael
+
+ * [r894]
+ strftime_tz patch from Bernhard Walle
+
+2008-09-08 michael
+
+ * [r893]
+ strftime_tz() plugin by Bernhard Walle
+
+2008-09-03 michael
+
+ * [r892]
+ ULA200 driver by Bernhard Walle
+
+ * [r891]
+ indent
+
+2008-08-31 sonic74
+
+ * [r890]
+ Increased the maximum bps to 230400, if defined in <termios.h>.
+
+2008-08-27 sonic74
+
+ * [r889]
+
+
+2008-08-27 michael
+
+ * [r888]
+ D4D updates by Sven
+
+2008-08-03 michael
+
+ * [r887]
+ driver for 4D Systems serial displays by Sven Killig
+
+ * [r886]
+ signed/unsigned mismatch
+
+2008-07-26 michux
+
+ * [r885]
+ added command functions
+
+2008-07-15 michael
+
+ * [r884]
+ added IRLCD driver by Jean-Philippe Civade
+
+ * [r883]
+ 'autoreconf -f -i' run & config.rpath added
+
+ * [r882]
+ forgot to add drv_picoLCDGraphic.c :-(
+
+ * [r881]
+ picoLCDGraphic driver by Nicu Pavel added
+
+ * [r880]
+ widget_keypad.h added to drv_HD44780
+
+ * [r879]
+ indent run
+
+ * [r878]
+ automake-1.10.1
+
+2008-04-15 michux
+
+ * [r877]
+ forgot include
+
+ * [r876]
+ add signal handler, improve error check
+
+2008-04-14 michux
+
+ * [r875]
+ minor update
+
+2008-04-12 michux
+
+ * [r874]
+ Makefiles again, this time libiconv stuff is fixed
+
+ * [r873]
+ fix error, introduced in r857
+
+ * [r872]
+ update Makefiles
+
+ * [r871]
+ clean up
+
+2008-04-10 michux
+
+ * [r870]
+ Add the year 2008 to the copyright
+
+ * [r869]
+ Add basic FIFO plugin
+
+2008-04-04 michux
+
+ * [r868]
+ fixed autoconf
+
+ * [r867]
+ update autoconf
+
+ * [r866]
+ Add asterisk plugin, thanks to mcarey@yostengineering.com
+
+2008-04-03 michux
+
+ * [r865]
+ fix typo, close #114
+
+ * [r864]
+ update charset for Crystalfontz Model 632 and 634
+
+2008-03-05 michux
+
+ * [r863]
+ improve error messages
+
+2008-03-03 michux
+
+ * [r862]
+ reformat plugin_mpd - use c style comments
+
+ * [r861]
+ correct code format (indent)
+
+ * [r860]
+ correct code format (indent)
+
+ * [r859]
+ new plugin: button_exec by Wolfgang Henerbichler
+
+ * [r858]
+ add new driver (st2205) by Jeroen/Sprite_tm
+
+ * [r857]
+ new plugin: button_exec by Wolfgang Henerbichler
+
+ * [r856]
+ add keypad support for module lcm162
+
+ * [r855]
+ add new driver (st2205) by Jeroen/Sprite_tm
+
+2008-02-27 michux
+
+ * [r854]
+ add signal handler to plugin_mpd
+
+ * [r853]
+ plugin_mpd, update to v0.81, fix connection issues
+
+2008-02-25 michux
+
+ * [r852]
+ update mpd plugin to v0.8 - makefile needs some work now
+
+2008-01-28 michux
+
+ * [r851]
+ disable default emulator code
+
+ * [r850]
+ minor updates
+
+ * [r849]
+ added pingpong scrolling
+
+2008-01-24 michux
+
+ * [r848]
+
+
+2007-10-17 volker
+
+ * [r847]
+ added new display 128x32 (CW12832)
+
+ * [r846]
+ info about property change
+
+2007-10-03 michael
+
+ * [r845]
+ automatic marquee patch from Manuel Grot
+
+2007-10-01 michael
+
+ * [r844]
+ RDTSC delay and inclusion of asm/msr.h removed
+
+ * [r843]
+ driver for Pertelian display by Andy Powell
+
+2007-09-15 michael
+
+ * [r842]
+ GPS plugin V0.3 by michu
+
+ * [r841]
+ GPS plugin V0.2 by michu
+
+2007-09-09 michael
+
+ * [r840]
+ email address changed
+
+2007-08-25 volker
+
+ * [r839]
+ additional information about decision which plugin and drivers
+ are included via configure
+
+2007-08-23 volker
+
+ * [r838]
+ existence of netdevice corrected (less cpu load)
+
+ * [r837]
+ logging info clarified
+
+ * [r836]
+ Indentation
+
+2007-08-13 volker
+
+ * [r835]
+ Absicherung gegen Abfragen nicht vorhandener Daten
+
+ * [r834]
+ erweiterte Ausgabe bei Daten ueber unterstuetzte Hardware
+
+2007-07-27 michael
+
+ * [r833]
+ Fix compilation with kernel 2.6.22 by Guillaume LECERF
+
+ * [r832]
+ MPD plugin patch from michu
+
+ * [r831]
+ GPS plugin update by michu
+
+ * [r830]
+ indentation
+
+2007-07-12 volker
+
+ * [r829]
+ svn version updated
+
+ * [r828]
+ additional verbose and info messages
+
+2007-07-08 volker
+
+ * [r827]
+ includes for umask(); svnversion updated
+
+2007-06-27 volker
+
+ * [r826]
+ handle config files with <CR><LF> (DOS line ending)
+
+ * [r825]
+ added plugin_netdev
+
+ * [r824]
+ copy&paste error corrected
+
+ * [r823]
+ new plugin: netinfo
+
+ * [r822]
+ indentation with ./indent.sh; short circuit evaluation modified
+
+2007-06-25 volker
+
+ * [r821]
+ format characters in qprintf() with optional length
+
+ * [r820]
+ calculate only necessary elements of operands
+
+2007-06-24 volker
+
+ * [r819]
+ optimization on changing brightness of backlight
+
+2007-06-22 volker
+
+ * [r818]
+ list plugins
+
+ * [r817]
+ disable plugins where preconditions not given: compiles mostly
+ under MacOS X
+
+ * [r816]
+ keypad support added for X11 driver
+
+2007-06-21 volker
+
+ * [r815]
+ optimized layer drawing (no drawing under opaque pixel)
+
+ * [r814]
+ LCD::brightness, keypad
+
+ * [r813]
+ default for Brightness is 255
+
+2007-06-20 volker
+
+ * [r812]
+ LCD::brightness in drv_X11 corrected
+
+ * [r811]
+ development of new experimental features
+
+ * [r810]
+ global variable for backlight color
+
+ * [r809]
+ keypad support completed; new property brightness implemented
+
+ * [r808]
+ maximum value for brightness is 8
+
+2007-06-17 michael
+
+ * [r807]
+ buttons for X11 driver (thanks to Volker Gering)
+
+ * [r806]
+ Apple has no utsbuf.domainname (thanks to Volker Gering)
+
+ * [r805]
+ strndup() replacement
+
+ * [r804]
+ better usage output by Volker Gering
+
+2007-06-08 michael
+
+ * [r803]
+ Image driver libgd dependancy fix
+
+2007-06-04 michael
+
+ * [r802]
+ big MPD patch from Robert Buchholz
+
+2007-05-19 michael
+
+ * [r801]
+ gps plugin, code by michu / www.neophob.com
+
+2007-05-17 michael
+
+ * [r800]
+ backported r799 from trunk
+
+ * [r799]
+ compile error on m68k fixed (debian bug 405898)
+
+2007-05-04 michael
+
+ * [r798]
+ typo in LUIse driver fixed
+
+2007-05-02 michael
+
+ * [r797]
+ some compiler warnings fixed
+
+2007-04-30 michael
+
+ * [r796]
+ LCD4Linux-0.10.1-RC2
+
+ * [r795]
+ ChangeLog updated
+
+ * [r794]
+ svn2cl moved and optimized
+
+ * [r793]
+ svn2cl.sh added
+
+ * [r792]
+ port r791 from trunk
+
+ * [r791]
+ link Cwlinux with keypad support
+
+ * [r790]
+ ported r777 from trunk
+
+ * [r789]
+ ported r784-r788 from trunk
+
+2007-04-28 michael
+
+ * [r788]
+ patch from Fox: Fix a typo that prevent Bar display to work
+
+ * [r787]
+ patch from FoX that fixes compilation with kernel 2.6.21
+
+2007-04-23 michael
+
+ * [r786]
+ MPD plugin patch from michu
+
+2007-04-20 michael
+
+ * [r785]
+ keypad and firmware support for Cwlinux (patch from Volker
+ Gering)
+
+ * [r784]
+ iowait,irq and softirq added (patch from Roman Jozsef)
+
+2007-03-22 michael
+
+ * [r783]
+ backport r782 from trunk
+
+2007-03-21 michael
+
+ * [r782]
+ plugin_file patch from Mark Richards
+
+2007-03-13 michael
+
+ * [r781]
+ backport r780 from trunk
+
+ * [r780]
+ Crystalfontz keypad patch from kenson
+
+2007-03-05 michael
+
+ * [r779]
+ ported changeset 778 from branches/0.10.1
+
+ * [r778]
+ picoLCD linker error fixed (libusb was missing)
+
+2007-02-28 michael
+
+ * [r777]
+ imon::quantity and imon::status patch from Stefan Gmeiner /
+ Christian Brueggemann
+
+2007-02-26 michael
+
+ * [r776]
+ backported 774:775 from trunk
+
+ * [r775]
+ ChangeLog refresh
+
+ * [r774]
+ compiler warnings on x86_64 fixed
+
+2007-02-25 michael
+
+ * [r773]
+ backport 768:771 from trunk, version changed to 0.10.1-RC2
+
+ * [r772]
+ ChangeLog refreshed
+
+ * [r771]
+ lots of compiler warnings removed, C++-style comments removed,
+ changed struc initialisation from 'field:value' to '.field=value'
+
+2007-02-24 michael
+
+ * [r770]
+ strstr() and substr() added to string plugin
+
+ * [r769]
+ ChangeLog processed with svn2cl
+
+ * [r768]
+ LCD4Linux-0.10.1-RC1
+
+ * [r767]
+ trunk version incremented to 0.10.2-SVN
+
+ * [r766]
+ branch 0.10.1 created
+
+ * [r765]
+ tag 0.10.0 created
+
+ * [r764]
+ Version number changed to 0.10.1-RC1
+
+2007-02-05 michael
+
+ * [r763]
+ only use picoLCD if libusb is available
+
+2007-02-04 michael
+
+ * [r762]
+ svn version bumped manually
+
+ * [r761]
+ autoconf & smoketest bugs fixed
+
+ * [r760]
+ 'Electronic Assembly' driver by Stefan Gmeiner
+
+ * [r759]
+ picoLCD driver bugs fixed
+
+2007-01-23 michael
+
+ * [r758]
+ drv_picoLCD was missing in distribution
+
+ * [r757]
+ removed -SVN from version string
+
+ * [r756]
+ try to add svn version
+
+2007-01-21 michael
+
+ * [r755]
+ indent
+
+ * [r754]
+ new function 'decode()'
+
+ * [r753]
+ removed unused variable
+
+2007-01-20 michael
+
+ * [r752]
+ keypad widget cleanup
+
+ * [r751]
+ GPO cleanup
+
+ * [r750]
+ minor fixes to evaluator
+
+ * [r749]
+ dynamic properties for bars; new 'property_valid()' helper
+
+ * [r748]
+ indent
+
+2007-01-19 michael
+
+ * [r747]
+ driver for picoLCD displays from mini-box.com by Nicu Pavel
+
+ * [r746]
+ dynamic properties for keypad widget
+
+ * [r745]
+ indent
+
+2007-01-18 michael
+
+ * [r744]
+ dynamic properties for Icon widget
+
+2007-01-17 michael
+
+ * [r743]
+ dynamic properties for GPO's
+
+ * [r742]
+ removed DOS newlines again :-(
+
+ * [r741]
+ indent
+
+ * [r740]
+ changed version number from 0.10.1-CVS to 0.10.1-SVN
+
+2007-01-16 michael
+
+ * [r739]
+ new driver 'HD44780-I2C'
+
+ * [r738]
+ Fix compilation of plugin_wireless.c with linux kernel 2.6.19
+ from Guillaume LECERF
+
+ * [r737]
+ Patch from Robert Buchholz: NULL driver link error fixed, m4
+ files included in distribution
+
+ * [r736]
+ patch from Mattia Jona-Lasinio for lcd-linux 0.12.0
+
+ * [r735]
+ svn keywords
+
+ * [r734]
+ removed some DOS newlines
+
+2007-01-15 michael
+
+ * [r733]
+ minor cosmetic changes and fixes
+
+2007-01-14 michael
+
+ * [r732]
+ re-bootstrapped
+
+ * [r731]
+ svn keywords corrected
+
+ * [r730]
+ svn keywords corrected
+
+ * [r729]
+ added svn properties and keywords
+
+ * [r728]
+ changed $Revision to $Rev
+
+ * [r727]
+ removed all tags
+
+ * [r726]
+ svn properties fixed
+
+ * [r725]
+ svn:ignore ported from .cvsignore
+
+ * [r724]
+ switch from CVS to SVN
+
+2006-10-01 reinelt
+
+ * [r723]
+ [lcd4linux @ 2006-10-01 11:54:38 by reinelt]
+ timer widget uses properties
+
+2006-09-29 reinelt
+
+ * [r722]
+ [lcd4linux @ 2006-09-29 04:48:21 by reinelt]
+ image widget uses properties now; new property 'reload'
+
+2006-10-04 root
+
+ * [r721]
+ image widget memory leaks fixed (thanks to Magne Torresen)
+
+2006-09-19 entropy
+
+ * [r720]
+ [lcd4linux @ 2006-09-19 11:20:52 by entropy]
+ Added missing prototypes
+
+2006-09-15 siretart
+
+ * [r719]
+ [lcd4linux @ 2006-09-15 20:30:03 by siretart]
+ rerun bootstrap on request from Ernst Bachmann
+ <e.bachmann@xebec.de>
+ Message-Id: <200609152109.17600.e.bachmann@xebec.de>
+
+2006-09-15 entropy
+
+ * [r718]
+ [lcd4linux @ 2006-09-15 19:06:47 by entropy]
+ debug spam reduced, comment typo fixed
+
+ * [r717]
+ [lcd4linux @ 2006-09-15 19:00:50 by entropy]
+ iconv charset converter plugin
+
+2006-09-14 entropy
+
+ * [r716]
+ [lcd4linux @ 2006-09-14 20:36:39 by entropy]
+ Improved example showing how to display network and hdd activity
+ on an usb hub
+
+ * [r715]
+ [lcd4linux @ 2006-09-14 11:19:29 by entropy]
+ New cmdline option -p to specify the pidfile location
+
+2006-09-14 reinelt
+
+ * [r714]
+ [lcd4linux @ 2006-09-14 04:08:54 by reinelt]
+ variables use a static list, no realloc, linear search
+
+ * [r713]
+ [lcd4linux @ 2006-09-14 03:49:14 by reinelt]
+ indent run
+
+2006-09-13 entropy
+
+ * [r712]
+ [lcd4linux @ 2006-09-13 20:07:59 by entropy]
+ Fixing bug #1494773 (compiles only on i368/amd64 machines) by
+ providing a dummy implementation for other archs
+
+ * [r711]
+ [lcd4linux @ 2006-09-13 20:04:57 by entropy]
+ threads change argv[0] to their thread name, for a neat 'ps'
+ output
+
+2006-09-13 reinelt
+
+ * [r710]
+ [lcd4linux @ 2006-09-13 05:33:39 by reinelt]
+ plugin_file: return empty string if file cannot be read;
+ widget_text: load property as 'string', not as variable
+ (triggered an ugly bug with variable list reallocated)
+
+2006-09-08 reinelt
+
+ * [r709]
+ [lcd4linux @ 2006-09-08 19:00:46 by reinelt]
+ give up after 10 write errors to serial device
+
+2006-09-07 reinelt
+
+ * [r708]
+ [lcd4linux @ 2006-09-07 09:06:25 by reinelt]
+ lots of wrong printf formats corrected (thanks to Ernst Bachmann)
+
+2006-09-06 reinelt
+
+ * [r707]
+ [lcd4linux @ 2006-09-06 05:22:09 by reinelt]
+ some autoconf updates
+
+2006-09-04 siretart
+
+ * [r706]
+ [lcd4linux @ 2006-09-04 16:48:32 by siretart]
+ rerun bootstrap on current debian/etch system using automake1.9
+ to
+ make my previous commits active
+
+ * [r705]
+ [lcd4linux @ 2006-09-04 16:47:39 by siretart]
+ These changes were necessary to make lcd4linux build on current
+ debian etch/unstable
+ systems. I cannot really imagine how this was supposed to work,
+ so I replaced
+ the old modified python.m4 with an uptodate version of
+ ac_python_devel.m4 from
+ autoconf_archive. both .m4 files seem to have a common anchestor,
+ but ac_python_devel.m4
+ has clearly seen a lot of more love, so let's better stay with
+ upstream
+ (autoconf archive), so we can blame them if anything breaks.
+
+ Moreover, this actually works
+
+ * [r704]
+ [lcd4linux @ 2006-09-04 16:41:21 by siretart]
+ removing debianisation from upstream source, as discussed with
+ Michael on private mail.
+
+ Rationale: I try to keep an updated lcd4linux in debian/sid. If
+ you need the debinisation,
+ please use my packages as base. If you want more updated package,
+ please drop me a note,
+ and I'll arrange another upload to unstable (or experimental,
+ depending on the state
+ of the cvs).
+
+ * [r703]
+ [lcd4linux @ 2006-09-04 16:35:43 by siretart]
+ fix linking with modular xorg. See http://bugs.debian.org/381606
+ for reference
+
+ * [r702]
+ [lcd4linux @ 2006-09-04 16:33:21 by siretart]
+ beautify bootstrap script
+
+2006-08-23 harbaum
+
+ * [r701]
+ [lcd4linux @ 2006-08-23 17:45:37 by harbaum]
+ Umlaut translation bugfix
+
+2006-08-23 reinelt
+
+ * [r700]
+ [lcd4linux @ 2006-08-23 05:05:40 by reinelt]
+ CF635 added to lcd4linux.conf.sample
+
+2006-08-17 harbaum
+
+ * [r699]
+ [lcd4linux @ 2006-08-17 19:11:40 by harbaum]
+ Small plugin_kvv bugfixes and new abbreviate option
+
+2006-08-17 reinelt
+
+ * [r698]
+ [lcd4linux @ 2006-08-17 05:06:26 by reinelt]
+ LCD2USB driver missing keypad symbols fixed
+
+2006-08-16 reinelt
+
+ * [r697]
+ [lcd4linux @ 2006-08-16 14:18:14 by reinelt]
+ T6963 enhancements: soft timing, DualScan, Cell size
+
+2006-08-15 harbaum
+
+ * [r696]
+ [lcd4linux @ 2006-08-15 17:28:27 by harbaum]
+ Cleaned up thread and error handling
+
+2006-08-14 harbaum
+
+ * [r695]
+ [lcd4linux @ 2006-08-14 19:24:22 by harbaum]
+ Umlaut support, added KVV HTTP-User-Agent
+
+2006-08-14 reinelt
+
+ * [r694]
+ [lcd4linux @ 2006-08-14 05:54:03 by reinelt]
+ minor warnings fixed, CFLAGS changed (no-strict-aliasing)
+
+2006-08-13 harbaum
+
+ * [r693]
+ [lcd4linux @ 2006-08-13 18:45:25 by harbaum]
+ Little cleanup ...
+
+ * [r692]
+ [lcd4linux @ 2006-08-13 18:14:03 by harbaum]
+ Added KVV plugin
+
+2006-08-13 reinelt
+
+ * [r691]
+ [lcd4linux @ 2006-08-13 11:38:20 by reinelt]
+ text widget uses dynamic properties
+
+ * [r690]
+ [lcd4linux @ 2006-08-13 09:53:10 by reinelt]
+ dynamic properties added (used by 'style' of text widget)
+
+ * [r689]
+ [lcd4linux @ 2006-08-13 06:46:51 by reinelt]
+ T6963 soft-timing & enhancements; indent
+
+2006-08-11 reinelt
+
+ * [r688]
+ [lcd4linux @ 2006-08-11 11:59:29 by reinelt]
+ M50530 minor fixes
+
+2006-08-10 reinelt
+
+ * [r687]
+ [lcd4linux @ 2006-08-10 20:40:46 by reinelt]
+ M50530 enhancements: Timings, busy-flag checking
+
+ * [r686]
+ [lcd4linux @ 2006-08-10 19:06:52 by reinelt]
+ new 'fuzz' parameter for timings
+
+2006-08-09 harbaum
+
+ * [r685]
+ [lcd4linux @ 2006-08-09 17:25:34 by harbaum]
+ Better bar color support and new bold font
+
+2006-08-08 harbaum
+
+ * [r684]
+ [lcd4linux @ 2006-08-08 20:16:28 by harbaum]
+ Added "extracolor" (used for e.g. bar border) and RGB support for
+ LEDMATRIX
+
+2006-08-08 reinelt
+
+ * [r683]
+ [lcd4linux @ 2006-08-08 19:35:21 by reinelt]
+ USBHUB driver from Ernst Bachmann
+
+ * [r682]
+ [lcd4linux @ 2006-08-08 19:28:18 by reinelt]
+ widget type checking corrected
+
+2006-08-05 harbaum
+
+ * [r681]
+ [lcd4linux @ 2006-08-05 21:08:01 by harbaum]
+ New LEDMATRIX driver (see http://www.harbaum.org/till/ledmatrix)
+
+2006-07-31 reinelt
+
+ * [r680]
+ [lcd4linux @ 2006-07-31 03:48:09 by reinelt]
+ preparations for scrolling
+
+2006-07-30 lfcorreia
+
+ * [r679]
+ [lcd4linux @ 2006-07-30 11:29:02 by lfcorreia]
+ Make changes suggested by Michael, only one init function is
+ needed
+
+ * [r678]
+ [lcd4linux @ 2006-07-30 11:16:27 by lfcorreia]
+ Add back drv_generic_i2c_close function
+
+2006-07-29 lfcorreia
+
+ * [r677]
+ [lcd4linux @ 2006-07-29 21:12:31 by lfcorreia]
+ Add UPPERCASE string plugin function
+
+ * [r676]
+ [lcd4linux @ 2006-07-29 21:04:43 by lfcorreia]
+ Better error handling, add proper I2C SLAVE device detection (not
+ 100% finished)
+
+ * [r675]
+ [lcd4linux @ 2006-07-29 20:59:12 by lfcorreia]
+ Fix wrong timing at I2C initialization
+
+2006-07-19 cmay
+
+ * [r674]
+ [lcd4linux @ 2006-07-19 01:57:01 by cmay]
+ fixed double read of last line in file
+
+ * [r673]
+ [lcd4linux @ 2006-07-19 01:48:11 by cmay]
+ Ran indent.sh to make pretty code.
+
+ * [r672]
+ [lcd4linux @ 2006-07-19 01:35:31 by cmay]
+ Renamed keypad direction names to avoid conflict with Curses
+ library defs.
+ Added keypad support to Curses display driver.
+
+2006-07-18 nicowallmeier
+
+ * [r671]
+ [lcd4linux @ 2006-07-18 17:04:55 by nicowallmeier]
+ Changed test for libmpd
+
+2006-07-14 reinelt
+
+ * [r670]
+ [lcd4linux @ 2006-07-14 20:15:11 by reinelt]
+ buffer too small (thanks to anonymous)
+
+2006-07-12 reinelt
+
+ * [r669]
+ [lcd4linux @ 2006-07-12 21:01:41 by reinelt]
+ thread_destroy, minor cleanups
+
+ * [r668]
+ [lcd4linux @ 2006-07-12 20:47:51 by reinelt]
+ indent
+
+ * [r667]
+ [lcd4linux @ 2006-07-12 20:45:30 by reinelt]
+ G15 and thread patch by Anton
+
+2006-06-25 reinelt
+
+ * [r666]
+ [lcd4linux @ 2006-06-25 15:13:00 by reinelt]
+ automake-1.9 cleanups
+
+ * [r665]
+ [lcd4linux @ 2006-06-25 14:58:38 by reinelt]
+ switch to automake-1.9
+
+2006-06-21 reinelt
+
+ * [r664]
+ [lcd4linux @ 2006-06-21 05:12:43 by reinelt]
+ added checks for libgd version 2 (thanks to Sam)
+
+2006-06-20 reinelt
+
+ * [r663]
+ [lcd4linux @ 2006-06-20 08:50:58 by reinelt]
+ widget_image linker error hopefully finally fixed
+
+2006-06-19 reinelt
+
+ * [r662]
+ [lcd4linux @ 2006-06-19 15:12:54 by reinelt]
+ bootstrapped
+
+ * [r661]
+ [lcd4linux @ 2006-06-19 12:02:17 by reinelt]
+ linker error from widget_image fixed
+
+ * [r660]
+ [lcd4linux @ 2006-06-19 11:54:08 by reinelt]
+ removed dependency to usb.h from sample driver
+
+2006-04-17 reinelt
+
+ * [r659]
+ [lcd4linux @ 2006-04-17 08:10:42 by reinelt]
+ LCDLinux patch from Mattia; widget_image moved to EXTRA_SOURCE
+
+2006-04-15 reinelt
+
+ * [r658]
+ [lcd4linux @ 2006-04-15 05:22:52 by reinelt]
+ mpd plugin from Stefan Kuhne
+
+2006-04-14 harbaum
+
+ * [r657]
+ [lcd4linux @ 2006-04-14 20:59:38 by harbaum]
+ Disable inclusion of Image driver in drv.c if no gd was found.
+
+2006-04-09 reinelt
+
+ * [r656]
+ [lcd4linux @ 2006-04-09 17:46:14 by reinelt]
+ vertical bar patch fro graphic displays by Ronald Hopfer
+
+ * [r655]
+ [lcd4linux @ 2006-04-09 14:17:49 by reinelt]
+ autoconf/library fixes, image and graphic display inversion
+
+2006-03-29 reinelt
+
+ * [r654]
+ [lcd4linux @ 2006-03-29 08:57:58 by reinelt]
+ vertical bar patch from Manuel Lausch
+
+2006-03-18 harbaum
+
+ * [r653]
+ [lcd4linux @ 2006-03-18 14:54:36 by harbaum]
+ Improved USB error recovery
+
+2006-03-10 tooly-bln
+
+ * [r652]
+ [lcd4linux @ 2006-03-10 18:06:52 by tooly-bln]
+ replace drv_generic_graphic_FB with drv_generic_graphic_black
+
+2006-02-27 reinelt
+
+ * [r651]
+ [lcd4linux @ 2006-02-27 08:12:34 by reinelt]
+ use serdisplib's full color support
+
+ * [r650]
+ [lcd4linux @ 2006-02-27 07:53:52 by reinelt]
+ some more graphic issues fixed
+
+ * [r649]
+ [lcd4linux @ 2006-02-27 06:15:55 by reinelt]
+ indent...
+
+ * [r648]
+ [lcd4linux @ 2006-02-27 06:14:46 by reinelt]
+ graphic bug resulting in all black pixels solved
+
+2006-02-25 geronet
+
+ * [r647]
+ [lcd4linux @ 2006-02-25 13:36:33 by geronet]
+ updated indent.sh, applied coding style
+
+2006-02-24 geronet
+
+ * [r646]
+ [lcd4linux @ 2006-02-24 13:07:10 by geronet]
+ hollow bars for graphic lcd's
+
+2006-02-22 cmay
+
+ * [r645]
+ [lcd4linux @ 2006-02-22 15:59:39 by cmay]
+ removed KEYPADSIZE cruft per harbaum's suggestion
+
+2006-02-21 harbaum
+
+ * [r644]
+ [lcd4linux @ 2006-02-21 21:43:03 by harbaum]
+ Keypad support for LCD2USB
+
+2006-02-21 cmay
+
+ * [r643]
+ [lcd4linux @ 2006-02-21 15:55:59 by cmay]
+ removed new update function for keypad, consolidated it with draw
+
+ * [r642]
+ [lcd4linux @ 2006-02-21 15:52:30 by cmay]
+ added back CF635 GPO counts in model struct lost after last merge
+
+2006-02-21 reinelt
+
+ * [r641]
+ [lcd4linux @ 2006-02-21 05:50:34 by reinelt]
+ keypad support from Cris Maj
+
+2006-02-19 reinelt
+
+ * [r640]
+ [lcd4linux @ 2006-02-19 15:42:18 by reinelt]
+ file plugin from Chris Maj
+
+ * [r639]
+ [lcd4linux @ 2006-02-19 15:37:38 by reinelt]
+ CF635 GPO patch from cmaj
+
+ * [r638]
+ [lcd4linux @ 2006-02-19 07:20:53 by reinelt]
+ image support nearly finished
+
+2006-02-12 harbaum
+
+ * [r637]
+ [lcd4linux @ 2006-02-12 14:32:24 by harbaum]
+ Configurable bus/device id
+
+2006-02-09 harbaum
+
+ * [r636]
+ [lcd4linux @ 2006-02-09 20:32:49 by harbaum]
+ LCD2USB bus testing, version verification ...
+
+2006-02-08 reinelt
+
+ * [r635]
+ [lcd4linux @ 2006-02-08 04:55:03 by reinelt]
+ moved widget registration to drv_generic_graphic
+
+2006-02-07 reinelt
+
+ * [r634]
+ [lcd4linux @ 2006-02-07 05:36:13 by reinelt]
+ Layers added to Layout
+
+2006-02-06 reinelt
+
+ * [r633]
+ [lcd4linux @ 2006-02-06 06:29:30 by reinelt]
+ Image driver uses RGBA
+
+2006-01-30 harbaum
+
+ * [r632]
+ [lcd4linux @ 2006-01-30 20:21:51 by harbaum]
+ LCD2USB: Added support for displays with two controllers
+
+2006-01-30 reinelt
+
+ * [r631]
+ [lcd4linux @ 2006-01-30 12:53:07 by reinelt]
+ replaced strncpy with strcpy where possible
+
+ * [r630]
+ [lcd4linux @ 2006-01-30 06:31:25 by reinelt]
+ ChangeLog
+
+ * [r629]
+ [lcd4linux @ 2006-01-30 06:25:48 by reinelt]
+ added CVS Revision
+
+ * [r628]
+ [lcd4linux @ 2006-01-30 06:17:17 by reinelt]
+ added CVS Revision
+
+ * [r627]
+ [lcd4linux @ 2006-01-30 06:11:36 by reinelt]
+ changed Result->length to Result->size
+
+ * [r626]
+ [lcd4linux @ 2006-01-30 05:47:34 by reinelt]
+ graphic subsystem changed to full-color RGBA
+
+2006-01-28 harbaum
+
+ * [r625]
+ [lcd4linux @ 2006-01-28 15:36:17 by harbaum]
+ Fix: string termination bug in eval()
+
+2006-01-26 harbaum
+
+ * [r624]
+ [lcd4linux @ 2006-01-26 19:26:26 by harbaum]
+ Added LCD2USB support
+
+2006-01-23 reinelt
+
+ * [r623]
+ [lcd4linux @ 2006-01-23 06:17:18 by reinelt]
+ timer widget added
+
+2006-01-22 reinelt
+
+ * [r622]
+ [lcd4linux @ 2006-01-22 10:01:09 by reinelt]
+ allow 'static' icons with speed=0
+
+ * [r621]
+ [lcd4linux @ 2006-01-22 09:16:05 by reinelt]
+ Image Widget framework added
+
+2006-01-21 reinelt
+
+ * [r620]
+ [lcd4linux @ 2006-01-21 17:43:25 by reinelt]
+ minor cosmetic fixes
+
+ * [r619]
+ [lcd4linux @ 2006-01-21 15:25:02 by reinelt]
+ GPIO subsystem in drivers.m4 added
+
+ * [r618]
+ [lcd4linux @ 2006-01-21 13:26:43 by reinelt]
+ Logitech G-15 keyboard LCD driver from Dave Ingram
+
+ * [r617]
+ [lcd4linux @ 2006-01-21 09:40:20 by reinelt]
+ Big Memory Leak in Evaluator fixed (thanks to Oliver Gehrke)
+
+2006-01-20 reinelt
+
+ * [r616]
+ [lcd4linux @ 2006-01-20 15:58:05 by reinelt]
+ MySQL::count() added again
+
+ * [r615]
+ [lcd4linux @ 2006-01-20 15:43:25 by reinelt]
+ MySQL::query() returns a value, not the number of rows
+
+2006-01-18 reinelt
+
+ * [r614]
+ [lcd4linux @ 2006-01-18 11:49:48 by reinelt]
+ adopted to lcd-linux-0.9.2
+
+2006-01-16 reinelt
+
+ * [r613]
+ [lcd4linux @ 2006-01-16 15:39:58 by reinelt]
+ MySQL::queryvalue() extension from Harald Klemm
+
+2006-01-06 tooly-bln
+
+ * [r612]
+ [lcd4linux @ 2006-01-06 16:56:49 by tooly-bln]
+
+2006-01-06 reinelt
+
+ * [r611]
+ [lcd4linux @ 2006-01-06 08:12:19 by reinelt]
+ GPO's for Crystalfontz
+
+ * [r610]
+ [lcd4linux @ 2006-01-06 07:06:57 by reinelt]
+ GPO's for RouterBoard
+
+2006-01-05 reinelt
+
+ * [r609]
+ [lcd4linux @ 2006-01-05 19:27:26 by reinelt]
+ HD44780 power supply from parport
+
+ * [r608]
+ [lcd4linux @ 2006-01-05 18:56:57 by reinelt]
+ more GPO stuff
+
+2006-01-05 nicowallmeier
+
+ * [r607]
+ [lcd4linux @ 2006-01-05 15:53:45 by nicowallmeier]
+ fixed compatility with gcc 2.95
+
+2006-01-03 reinelt
+
+ * [r606]
+ [lcd4linux @ 2006-01-03 13:20:05 by reinelt]
+ LUIse driver added
+
+ * [r605]
+ [lcd4linux @ 2006-01-03 06:13:44 by reinelt]
+ GPIO's for MatrixOrbital
+
+2005-12-20 reinelt
+
+ * [r604]
+ [lcd4linux @ 2005-12-20 07:07:43 by reinelt]
+ further work on GPO's, HD44780 GPO support
+
+2005-12-19 reinelt
+
+ * [r603]
+ [lcd4linux @ 2005-12-19 05:08:27 by reinelt]
+ GPO's added to the Sample driver
+
+2005-12-18 reinelt
+
+ * [r602]
+ [lcd4linux @ 2005-12-18 16:18:34 by reinelt]
+ GPO's added again
+
+2005-12-13 reinelt
+
+ * [r601]
+ [lcd4linux @ 2005-12-13 14:07:28 by reinelt]
+ LPH7508 driver finished
+
+2005-12-12 reinelt
+
+ * [r600]
+ [lcd4linux @ 2005-12-12 09:08:08 by reinelt]
+ finally removed old udelay code path; read timing values from
+ config
+
+ * [r599]
+ [lcd4linux @ 2005-12-12 05:52:03 by reinelt]
+ type of delays is 'unsigned long'
+
+2005-12-11 reinelt
+
+ * [r598]
+ [lcd4linux @ 2005-12-11 14:55:28 by reinelt]
+ contrast range for BWCT is 0..255, not 0..100
+
+2005-11-06 reinelt
+
+ * [r597]
+ [lcd4linux @ 2005-11-06 09:54:43 by reinelt]
+ fixed icon size removed, uses XRES & YRES (I hope this doesn't
+ lead to problemes...)
+
+ * [r596]
+ [lcd4linux @ 2005-11-06 09:17:20 by reinelt]
+ re-use icons (thanks to Jesus de Santos Garcia)
+
+2005-11-05 reinelt
+
+ * [r595]
+ [lcd4linux @ 2005-11-05 06:34:09 by reinelt]
+ README.Drivers removed
+
+ * [r594]
+ [lcd4linux @ 2005-11-05 06:26:51 by reinelt]
+ littly typo corrected
+
+2005-11-04 reinelt
+
+ * [r593]
+ [lcd4linux @ 2005-11-04 14:10:38 by reinelt]
+ drv_Sample and drv_LPH7508
+
+ * [r592]
+ [lcd4linux @ 2005-11-04 05:39:33 by reinelt]
+ README.Plugins removed
+
+ * [r591]
+ [lcd4linux @ 2005-11-04 04:53:08 by reinelt]
+ sample plugin activated
+
+ * [r590]
+ [lcd4linux @ 2005-11-04 04:44:52 by reinelt]
+ LPH7508 driver (not yet finished)
+
+2005-10-02 reinelt
+
+ * [r589]
+ [lcd4linux @ 2005-10-02 07:58:48 by reinelt]
+ HD44780 address setup time increased
+
+2005-09-14 reinelt
+
+ * [r588]
+ [lcd4linux @ 2005-09-14 15:08:32 by reinelt]
+ fixed drivers.m4 to link generic text driver for several displays
+ (thanks to Ludovic Gomez for pointing this out)
+
+2005-09-07 reinelt
+
+ * [r587]
+ [lcd4linux @ 2005-09-07 06:51:44 by reinelt]
+ Support for CF635 added
+
+2005-09-02 reinelt
+
+ * [r586]
+ [lcd4linux @ 2005-09-02 05:27:08 by reinelt]
+ double-fork daemonize patch from Petri Damsten
+
+2005-08-27 reinelt
+
+ * [r585]
+ [lcd4linux @ 2005-08-27 07:02:25 by reinelt]
+ LCD-Linux updated to 0.9.0
+
+2005-08-22 reinelt
+
+ * [r584]
+ [lcd4linux @ 2005-08-22 05:44:43 by reinelt]
+ new driver 'WincorNixdorf'
+ some fixes to the bar code
+
+2005-08-21 reinelt
+
+ * [r583]
+ [lcd4linux @ 2005-08-21 08:18:56 by reinelt]
+ CrystalFontz ACK processing
+
+2005-08-20 reinelt
+
+ * [r582]
+ [lcd4linux @ 2005-08-20 10:10:13 by reinelt]
+ TREFON patch from Stephan Trautvetter:
+ drv_TF_init: CHAR0 set to 0 instead of 1
+ drv_TF_write: combine the GOTO and the data into one packet
+ drv_TF_write: add GOTO-Case for resolutions 8x1/20x4 characters
+ drv_TF_start: test for existing resolutions from TREFON USB-LCDs
+ implemented
+ the use of 'asc255bug 1' is recommendable
+
+2005-07-06 reinelt
+
+ * [r581]
+ [lcd4linux @ 2005-07-06 04:40:18 by reinelt]
+ GCC-4 fixes
+
+2005-06-19 reinelt
+
+ * [r580]
+ [lcd4linux @ 2005-06-19 17:57:06 by reinelt]
+ cosmetics...
+
+2005-06-15 reinelt
+
+ * [r579]
+ [lcd4linux @ 2005-06-15 05:24:35 by reinelt]
+ updated LCD-Linux driver to version 0.8.9
+
+2005-06-13 reinelt
+
+ * [r578]
+ [lcd4linux @ 2005-06-13 03:43:46 by reinelt]
+ undo PPEXCL activation...
+
+ * [r577]
+ [lcd4linux @ 2005-06-13 03:38:25 by reinelt]
+ try PPEXCL again, but ignore result
+
+2005-06-11 reinelt
+
+ * [r576]
+ [lcd4linux @ 2005-06-11 10:57:45 by reinelt]
+ changed version to 0.10.1-CVS
+
+ * [r575]
+ [lcd4linux @ 2005-06-11 04:14:05 by reinelt]
+ final 0.10.0 release, Changelog updated
+
+2005-06-10 reinelt
+
+ * [r574]
+ [lcd4linux @ 2005-06-10 11:22:28 by reinelt]
+ double-check for X11 headers (AC_PATH_XTRA is buggy)
+
+ * [r573]
+ [lcd4linux @ 2005-06-10 09:51:44 by reinelt]
+ depcomp removed
+
+ * [r572]
+ [lcd4linux @ 2005-06-10 05:02:28 by reinelt]
+ ChangeLog
+
+ * [r571]
+ [lcd4linux @ 2005-06-10 05:00:36 by reinelt]
+ version number set to 0.10.0
+
+ * [r570]
+ [lcd4linux @ 2005-06-10 04:54:10 by reinelt]
+ removed ltmain.sh
+
+ * [r569]
+ [lcd4linux @ 2005-06-10 04:53:44 by reinelt]
+ removed libtool and ltmain.sh
+
+2005-06-09 reinelt
+
+ * [r568]
+ [lcd4linux @ 2005-06-09 17:41:47 by reinelt]
+ M50530 fixes (many thanks to Szymon Bieganski)
+
+2005-06-06 reinelt
+
+ * [r567]
+ [lcd4linux @ 2005-06-06 09:24:07 by reinelt]
+ two bugs in plugin_mysql.c fixed
+
+2005-06-03 reinelt
+
+ * [r566]
+ [lcd4linux @ 2005-06-03 17:04:52 by reinelt]
+ hopefully solved the AM_PYTHON_PATH issue finally
+
+ * [r565]
+ [lcd4linux @ 2005-06-03 04:45:57 by reinelt]
+ renamed AM_PYTHON to MY_PYTHON...
+
+2005-06-01 reinelt
+
+ * [r564]
+ [lcd4linux @ 2005-06-01 12:50:25 by reinelt]
+ ifdef'ed unused function to avoid compiler warning
+
+ * [r563]
+ [lcd4linux @ 2005-06-01 12:46:31 by reinelt]
+ --with-python added to configure
+
+ * [r562]
+ [lcd4linux @ 2005-06-01 12:09:11 by reinelt]
+ removed ^M from lcd4linux_i2c.h; indent.sh run
+
+2005-06-01 pk_richman
+
+ * [r561]
+ [lcd4linux @ 2005-06-01 11:17:54 by pk_richman]
+ marked unused parameters
+
+2005-05-31 lfcorreia
+
+ * [r560]
+ [lcd4linux @ 2005-05-31 21:30:56 by lfcorreia]
+ fix my email address
+
+ * [r559]
+ [lcd4linux @ 2005-05-31 21:28:42 by lfcorreia]
+ fix typo
+
+ * [r558]
+ [lcd4linux @ 2005-05-31 21:26:56 by lfcorreia]
+ fix my email address
+
+ * [r557]
+ [lcd4linux @ 2005-05-31 21:06:36 by lfcorreia]
+ replace the accidently deleted Python detection code
+
+ * [r556]
+ [lcd4linux @ 2005-05-31 20:42:54 by lfcorreia]
+ new file: lcd4linux_i2c.h
+ avoid the problems detecting the proper I2C kernel include files
+
+ rearrange all the other autoconf stuff to remove I2C detection
+
+ new method by Paul Kamphuis to write to the I2C device
+
+2005-05-28 reinelt
+
+ * [r555]
+ [lcd4linux @ 2005-05-28 09:08:30 by reinelt]
+ fixed plugins.m4 bug found by Martin
+
+ * [r554]
+ [lcd4linux @ 2005-05-28 09:06:14 by reinelt]
+ serdisplib cosmetics
+
+2005-05-13 reinelt
+
+ * [r553]
+ [lcd4linux @ 2005-05-13 05:44:44 by reinelt]
+ ChangeLog updated
+
+ * [r552]
+ [lcd4linux @ 2005-05-13 05:43:25 by reinelt]
+ added drv_LCDLinux.h to extra_sources
+
+2005-05-12 reinelt
+
+ * [r551]
+ [lcd4linux @ 2005-05-12 14:55:47 by reinelt]
+ plugins for serdisplib driver
+
+ * [r550]
+ [lcd4linux @ 2005-05-12 05:52:43 by reinelt]
+ serdisplib GET_VERSION_MAJOR macro
+
+2005-05-11 reinelt
+
+ * [r549]
+ [lcd4linux @ 2005-05-11 04:27:49 by reinelt]
+ small serdisplib bugs fixed
+
+2005-05-10 reinelt
+
+ * [r548]
+ [lcd4linux @ 2005-05-10 13:20:10 by reinelt]
+ added serdisplib driver
+
+2005-05-08 reinelt
+
+ * [r547]
+ [lcd4linux @ 2005-05-08 04:32:43 by reinelt]
+ CodingStyle added and applied
+
+2005-05-06 reinelt
+
+ * [r546]
+ [lcd4linux @ 2005-05-06 06:41:53 by reinelt]
+ python2.4 added to python.m4
+
+ * [r545]
+ [lcd4linux @ 2005-05-06 06:37:34 by reinelt]
+ hollow bar patch from geronet
+
+ * [r544]
+ [lcd4linux @ 2005-05-06 05:40:02 by reinelt]
+ remove documentation pass#2
+
+ * [r543]
+ [lcd4linux @ 2005-05-06 05:36:58 by reinelt]
+ removed documentation again :-(
+
+2005-05-05 reinelt
+
+ * [r542]
+ [lcd4linux @ 2005-05-05 08:36:12 by reinelt]
+ changed SELECT to SLCTIN
+
+2005-05-04 obconseil
+
+ * [r541]
+ [lcd4linux @ 2005-05-04 07:18:44 by obconseil]
+ Driver modified according to Michels's recommendations :
+
+ - Suppressed linux/parport.h depandancy. It was not needed
+ anyway.
+ - Compile-time disable the wait_busy polling function, replaced
+ with a time wait.
+ - Replaced the hardwire_* calls by their wire_* equivalent, to
+ adapt other wirings.
+ - Created a "Models" structure, containing parameters for the
+ display.
+ - Other cleanups, to remove compile-time warnings.
+
+2005-05-04 reinelt
+
+ * [r540]
+ [lcd4linux @ 2005-05-04 06:13:05 by reinelt]
+ parport_wire_status() added
+
+ * [r539]
+ [lcd4linux @ 2005-05-04 05:42:37 by reinelt]
+ Noritake driver added
+
+ * [r538]
+ [lcd4linux @ 2005-05-04 05:22:12 by reinelt]
+ * replaced fprintf(stderr,... with error()
+ * corrected a "dangling reference" memory problem
+ * removed some PyErr_Print() spam
+ * fixed a segmentation fault that occured when python module was
+ not
+ found
+ * improved error messages
+
+2005-05-03 reinelt
+
+ * [r537]
+ [lcd4linux @ 2005-05-03 11:13:23 by reinelt]
+ rearranged autoconf a bit,
+ libX11 will be linked only if really needed (i.e. when the X11
+ driver has been selected)
+ plugin_python filled with life
+
+2005-05-02 reinelt
+
+ * [r536]
+ [lcd4linux @ 2005-05-02 10:29:20 by reinelt]
+ preparations for python bindings and python plugin
+
+ * [r535]
+ [lcd4linux @ 2005-05-02 05:15:46 by reinelt]
+ make busy-flag checking configurable for LCD-Linux driver
+
+2005-04-30 reinelt
+
+ * [r534]
+ [lcd4linux @ 2005-04-30 06:02:09 by reinelt]
+ LCD-Linux display size set up from lcd4linux.conf
+
+2005-04-24 reinelt
+
+ * [r533]
+ [lcd4linux @ 2005-04-24 05:27:09 by reinelt]
+ Trefon Backlight added
+
+ * [r532]
+ [lcd4linux @ 2005-04-24 04:41:28 by reinelt]
+ Changelog updated
+
+ * [r531]
+ [lcd4linux @ 2005-04-24 04:33:46 by reinelt]
+ driver for TREFON USB LCD's added
+
+2005-04-20 reinelt
+
+ * [r530]
+ [lcd4linux @ 2005-04-20 05:49:21 by reinelt]
+ Changed the code to add some VT100-compatible control sequences
+ (see the comments above).
+ A configfile boolean option 'VT100_Support' (default to 1)
+ indicate if the display in
+ used support these control-sequences or not.
+
+2005-04-09 reinelt
+
+ * [r529]
+ [lcd4linux @ 2005-04-09 07:36:42 by reinelt]
+ updated LCD-Linux driver to version 0.8.8
+
+2005-04-05 reinelt
+
+ * [r528]
+ [lcd4linux @ 2005-04-05 06:57:39 by reinelt]
+ AC_CHECK_HEADERS corrected
+
+ * [r527]
+ [lcd4linux @ 2005-04-05 05:12:48 by reinelt]
+ i2c patch from Paul (still does not work here :-(
+
+ * [r526]
+ [lcd4linux @ 2005-04-05 04:46:06 by reinelt]
+ ceil/floor patch from Maxime
+
+2005-04-04 nicowallmeier
+
+ * [r525]
+ [lcd4linux @ 2005-04-04 20:11:14 by nicowallmeier]
+ to be compatible with gcc 2.95
+
+2005-04-03 reinelt
+
+ * [r524]
+ [lcd4linux @ 2005-04-03 07:07:43 by reinelt]
+ added statfs plugin
+
+2005-04-02 reinelt
+
+ * [r523]
+ [lcd4linux @ 2005-04-02 05:28:58 by reinelt]
+ fixed gcc4 warnings about signed/unsigned mismatches
+
+2005-04-01 reinelt
+
+ * [r522]
+ [lcd4linux @ 2005-04-01 05:16:04 by reinelt]
+ moved plugin init stuff to a seperate function called on first
+ use
+
+2005-03-30 reinelt
+
+ * [r521]
+ [lcd4linux @ 2005-03-30 04:57:50 by reinelt]
+ Evaluator speedup: use bsearch for finding functions and
+ variables
+
+2005-03-28 reinelt
+
+ * [r520]
+ [lcd4linux @ 2005-03-28 22:29:23 by reinelt]
+ HD44780 multiple displays patch from geronet
+
+ * [r519]
+ [lcd4linux @ 2005-03-28 19:39:14 by reinelt]
+ HD44780/I2C patch from Luis merged (still does not work for me)
+
+2005-03-25 reinelt
+
+ * [r518]
+ [lcd4linux @ 2005-03-25 15:44:43 by reinelt]
+ HD44780 Backlight fixed (thanks to geronet)
+
+2005-03-23 reinelt
+
+ * [r517]
+ [lcd4linux @ 2005-03-23 12:23:35 by reinelt]
+ fixed some signed/unsigned char mismatches in the Crystalfontz
+ driver (ticket #12)
+
+2005-02-24 reinelt
+
+ * [r516]
+ [lcd4linux @ 2005-02-24 07:07:55 by reinelt]
+ ChangeLog
+
+ * [r515]
+ [lcd4linux @ 2005-02-24 07:06:45 by reinelt]
+ SimpleLCD driver added
+
+ * [r514]
+ [lcd4linux @ 2005-02-24 06:51:40 by reinelt]
+ LCD-Linux driver GOTO_COST corrected
+
+2005-01-30 reinelt
+
+ * [r513]
+ [lcd4linux @ 2005-01-30 06:43:22 by reinelt]
+ driver for LCD-Linux finished
+
+2005-01-29 reinelt
+
+ * [r512]
+ [lcd4linux @ 2005-01-29 09:30:56 by reinelt]
+ minor HD44780 cleanups
+
+2005-01-22 reinelt
+
+ * [r511]
+ [lcd4linux @ 2005-01-22 22:57:57 by reinelt]
+ LCD-Linux driver added
+
+ * [r510]
+ [lcd4linux @ 2005-01-22 12:44:41 by reinelt]
+ MatrixOrbital backlight micro-fix
+
+2005-01-18 reinelt
+
+ * [r509]
+ [lcd4linux @ 2005-01-18 06:30:21 by reinelt]
+ added (C) to all copyright statements
+
+2005-01-17 reinelt
+
+ * [r508]
+ [lcd4linux @ 2005-01-17 06:38:48 by reinelt]
+ info about backlight and brightness
+
+ * [r507]
+ [lcd4linux @ 2005-01-17 06:29:24 by reinelt]
+ added software-controlled backlight support to HD44780
+
+2005-01-15 reinelt
+
+ * [r506]
+ [lcd4linux @ 2005-01-15 13:13:57 by reinelt]
+ LCDTerm driver added, take 2
+
+ * [r505]
+ [lcd4linux @ 2005-01-15 13:13:21 by reinelt]
+ LCDTerm section added to lcd4linux.conf.sample
+
+ * [r504]
+ [lcd4linux @ 2005-01-15 13:10:13 by reinelt]
+ LCDTerm driver added
+
+2005-01-11 reinelt
+
+ * [r503]
+ [lcd4linux @ 2005-01-11 10:25:26 by reinelt]
+ further changes to lcd4linux.conf.sample
+
+ * [r502]
+ [lcd4linux @ 2005-01-11 10:19:33 by reinelt]
+ changes to lcd4linux.conf.sample
+
+2005-01-09 reinelt
+
+ * [r501]
+ [lcd4linux @ 2005-01-09 10:57:25 by reinelt]
+ ChangeLog updated
+
+ * [r500]
+ [lcd4linux @ 2005-01-09 10:53:22 by reinelt]
+ small type in plugin_uname fixed
+ new homepage lcd4linux.bulix.org
+
+2005-01-06 reinelt
+
+ * [r499]
+ [lcd4linux @ 2005-01-06 16:54:53 by reinelt]
+ M50530 fixes
+
+2004-12-22 reinelt
+
+ * [r498]
+ [lcd4linux @ 2004-12-22 20:24:00 by reinelt]
+ T6963 fix for displays > 8 rows
+
+2004-11-30 reinelt
+
+ * [r497]
+ [lcd4linux @ 2004-11-30 05:01:25 by reinelt]
+ removed compiler warnings for deactivated i2c bus
+
+2004-11-29 reinelt
+
+ * [r496]
+ [lcd4linux @ 2004-11-29 04:42:06 by reinelt]
+ removed the 99999 msec limit on widget update time (thanks to
+ Petri Damsten)
+
+2004-11-28 reinelt
+
+ * [r495]
+ [lcd4linux @ 2004-11-28 15:50:24 by reinelt]
+ Cwlinux fixes (invalidation of user-defined chars)
+
+2004-10-17 reinelt
+
+ * [r494]
+ [lcd4linux @ 2004-10-17 09:24:31 by reinelt]
+ I2C support for HD44780 displays by Luis (does not work by now)
+
+2004-10-02 reinelt
+
+ * [r493]
+ [lcd4linux @ 2004-10-02 09:31:55 by reinelt]
+ USBLCD driver modified to use libusb
+
+2004-09-24 reinelt
+
+ * [r492]
+ [lcd4linux @ 2004-09-24 21:40:52 by reinelt]
+ new driver for the BWCT USB LCD interface board.
+
+2004-09-19 reinelt
+
+ * [r491]
+ [lcd4linux @ 2004-09-19 09:31:19 by reinelt]
+ HD44780 busy flag checking improved: fall back to busy-waiting if
+ too many errors occur
+
+2004-09-18 reinelt
+
+ * [r490]
+ [lcd4linux @ 2004-09-18 15:58:57 by reinelt]
+ even more HD44780 cleanups, hardwiring for LCM-162
+
+ * [r489]
+ [lcd4linux @ 2004-09-18 10:57:29 by reinelt]
+ more parport/i2c cleanups
+
+ * [r488]
+ [lcd4linux @ 2004-09-18 09:48:29 by reinelt]
+ HD44780 cleanup and prepararation for I2C backend
+ LCM-162 submodel framework
+
+ * [r487]
+ [lcd4linux @ 2004-09-18 08:22:59 by reinelt]
+ drv_generic_parport_status() to read status lines
+
+2004-08-30 rjoco77
+
+ * [r486]
+ [lcd4linux @ 2004-08-30 12:48:52 by rjoco77]
+ * Added backlight update immediatelly
+
+2004-08-29 reinelt
+
+ * [r485]
+ [lcd4linux @ 2004-08-29 20:07:55 by reinelt]
+ Patch from Joco: Make RouterBoard Backlight configurable
+
+ * [r484]
+ [lcd4linux @ 2004-08-29 13:03:40 by reinelt]
+ added RouterBoard driver
+
+2004-07-14 reinelt
+
+ * [r483]
+ [lcd4linux @ 2004-07-14 04:44:44 by reinelt]
+ Beckmann+Egle fix
+ added smaple widget for the PPP plugin
+
+2004-06-29 reinelt
+
+ * [r482]
+ [lcd4linux @ 2004-06-29 04:49:30 by reinelt]
+ B+E enhanced port detection
+
+2004-06-26 reinelt
+
+ * [r481]
+ [lcd4linux @ 2004-06-26 12:04:59 by reinelt]
+ uh-oh... the last CVS log message messed up things a lot...
+
+ * [r480]
+ [lcd4linux @ 2004-06-26 09:27:20 by reinelt]
+ added '-W' to CFLAGS
+ changed all C++ comments to C ones ('//' => '/* */')
+ cleaned up a lot of signed/unsigned mistakes
+
+ * [r479]
+ [lcd4linux @ 2004-06-26 06:12:14 by reinelt]
+ support for Beckmann+Egle Compact Terminals
+ some mostly cosmetic changes in the MatrixOrbital and USBLCD
+ driver
+ added debugging to the generic serial driver
+ fixed a bug in the generic text driver where icons could be drawn
+ outside
+ the display bounds
+
+2004-06-24 nicowallmeier
+
+ * [r478]
+ [lcd4linux @ 2004-06-24 20:18:08 by nicowallmeier]
+ minor bugfix
+
+2004-06-20 reinelt
+
+ * [r477]
+ [lcd4linux @ 2004-06-20 10:12:27 by reinelt]
+ ChangeLog updated
+
+ * [r476]
+ [lcd4linux @ 2004-06-20 10:09:52 by reinelt]
+ 'const'ified the whole source
+
+2004-06-19 reinelt
+
+ * [r475]
+ [lcd4linux @ 2004-06-19 08:20:19 by reinelt]
+ compiler warning in image driver fixed
+ bar bug in USBLCD driver fixed
+
+2004-06-17 reinelt
+
+ * [r474]
+ [lcd4linux @ 2004-06-17 10:58:57 by reinelt]
+ changed plugin_netdev to use the new fast hash model
+
+ * [r473]
+ [lcd4linux @ 2004-06-17 06:23:39 by reinelt]
+ hash handling rewritten to solve performance issues
+
+2004-06-13 reinelt
+
+ * [r472]
+ [lcd4linux @ 2004-06-13 01:12:52 by reinelt]
+ debug widgets changed (thanks to Andy Baxter)
+
+2004-06-09 reinelt
+
+ * [r471]
+ [lcd4linux @ 2004-06-09 06:40:29 by reinelt]
+ splash screen for T6963 driver
+
+2004-06-08 reinelt
+
+ * [r470]
+ [lcd4linux @ 2004-06-08 21:46:38 by reinelt]
+ splash screen for X11 driver (and generic graphic driver)
+
+ * [r469]
+ [lcd4linux @ 2004-06-08 12:35:24 by reinelt]
+ autoconf/automake updates
+
+2004-06-07 reinelt
+
+ * [r468]
+ [lcd4linux @ 2004-06-07 07:02:13 by reinelt]
+ sample debugging widgets added
+
+ * [r467]
+ [lcd4linux @ 2004-06-07 06:56:55 by reinelt]
+ added test plugin from Andy Baxter
+
+2004-06-06 reinelt
+
+ * [r466]
+ [lcd4linux @ 2004-06-06 06:51:59 by reinelt]
+ do not display end splash screen if quiet=1
+
+2004-06-05 reinelt
+
+ * [r465]
+ [lcd4linux @ 2004-06-05 14:56:48 by reinelt]
+ Cwlinux splash screen fixed
+ USBLCD splash screen fixed
+ plugin_i2c qprintf("%f") replaced with snprintf()
+
+ * [r464]
+ [lcd4linux @ 2004-06-05 06:41:39 by reinelt]
+ chancged splash screen again
+
+ * [r463]
+ [lcd4linux @ 2004-06-05 06:13:11 by reinelt]
+ splash screen for all text-based display drivers
+
+2004-06-02 reinelt
+
+ * [r462]
+ [lcd4linux @ 2004-06-02 10:09:22 by reinelt]
+ splash screen for HD44780
+
+ * [r461]
+ [lcd4linux @ 2004-06-02 09:41:19 by reinelt]
+ prepared support for startup splash screen
+
+ * [r460]
+ [lcd4linux @ 2004-06-02 05:56:25 by reinelt]
+ extended contrast range for Crystalfontz
+
+ * [r459]
+ [lcd4linux @ 2004-06-02 05:35:55 by reinelt]
+ added i2c_sensors example to lcd4linux.conf.sample
+
+ * [r458]
+ [lcd4linux @ 2004-06-02 05:27:59 by reinelt]
+ added documentation tree
+
+ * [r457]
+ [lcd4linux @ 2004-06-02 05:14:16 by reinelt]
+ fixed models listing for Beckmann+Egle driver
+ some cosmetic changes
+
+2004-06-01 reinelt
+
+ * [r456]
+ [lcd4linux @ 2004-06-01 06:45:28 by reinelt]
+ some Fixme's processed
+ documented some code
+
+ * [r455]
+ [lcd4linux @ 2004-06-01 06:04:25 by reinelt]
+ made README.Plugins and plugin_sample up to date.
+
+2004-05-31 reinelt
+
+ * [r454]
+ [lcd4linux @ 2004-05-31 21:23:16 by reinelt]
+ some cleanups in the MatrixOrbital driver
+
+ * [r453]
+ [lcd4linux @ 2004-05-31 21:05:13 by reinelt]
+ fixed lots of bugs in the Cwlinux driver
+ do not emit EAGAIN error on the first retry
+ made plugin_i2c_sensors a bit less 'chatty'
+ moved init and exit functions to the bottom of plugin_pop3
+
+ * [r452]
+ [lcd4linux @ 2004-05-31 16:39:05 by reinelt]
+ added NULL display driver (for debugging/profiling purposes)
+ added backlight/contrast initialisation for matrixOrbital
+ added Backlight initialisation for Cwlinux
+
+ * [r451]
+ [lcd4linux @ 2004-05-31 06:27:34 by reinelt]
+ ChangeLog update
+
+ * [r450]
+ [lcd4linux @ 2004-05-31 06:24:42 by reinelt]
+ fixed symlink security issue with the image driver
+
+ * [r449]
+ [lcd4linux @ 2004-05-31 05:38:02 by reinelt]
+ fixed possible bugs with user-defined chars (clear high bits)
+ thanks to Andy Baxter for debugging the MilfordInstruments
+ driver!
+
+2004-05-31 andy-b
+
+ * [r448]
+ [lcd4linux @ 2004-05-31 01:31:01 by andy-b]
+ fixed bug in Milford Instruments driver which drew extra graphics
+ chars in
+ odd places when drawing double bars. (the display doesn't like it
+ if you put
+ the escape character 0xfe inside a define char sequence).
+
+2004-05-30 reinelt
+
+ * [r447]
+ [lcd4linux @ 2004-05-30 08:25:50 by reinelt]
+ Crystalfontz 631 driver finished
+
+2004-05-29 reinelt
+
+ * [r446]
+ [lcd4linux @ 2004-05-29 23:30:20 by reinelt]
+ fixed a compiler issue with drv_Image.c (thanks to Frank
+ Stratmann)
+
+ * [r445]
+ [lcd4linux @ 2004-05-29 15:53:28 by reinelt]
+ M50530: reset parport signals on exit
+ plugin_ppp: ppp() has two parameters, not three
+ lcd4linux.conf.sample: diskstats() corrected
+
+ * [r444]
+ [lcd4linux @ 2004-05-29 01:07:56 by reinelt]
+ bug in plugin_diskstats fixed
+
+ * [r443]
+ [lcd4linux @ 2004-05-29 00:27:14 by reinelt]
+ added plugin_diskstats.c
+
+2004-05-28 reinelt
+
+ * [r442]
+ [lcd4linux @ 2004-05-28 14:38:10 by reinelt]
+ Status and Changelog Update
+
+ * [r441]
+ [lcd4linux @ 2004-05-28 14:36:10 by reinelt]
+ added drv_BeckmannEgle.c (forgotten at first check in :-)
+
+ * [r440]
+ [lcd4linux @ 2004-05-28 13:51:41 by reinelt]
+ ported driver for Beckmann+Egle Mini-Terminals
+ added 'flags' parameter to serial_init()
+
+2004-05-27 nicowallmeier
+
+ * [r439]
+ [lcd4linux @ 2004-05-27 06:29:29 by nicowallmeier]
+ Moved variables to Plugin:imon / Plugin:telmon
+
+2004-05-27 reinelt
+
+ * [r438]
+ [lcd4linux @ 2004-05-27 03:49:41 by reinelt]
+ Status update
+
+ * [r437]
+ [lcd4linux @ 2004-05-27 03:39:47 by reinelt]
+ changed function naming scheme to plugin::function
+
+2004-05-26 reinelt
+
+ * [r436]
+ [lcd4linux @ 2004-05-26 11:37:35 by reinelt]
+ Curses driver ported.
+
+ * [r435]
+ [lcd4linux @ 2004-05-26 05:03:24 by reinelt]
+ MilfordInstruments driver ported
+
+2004-05-25 reinelt
+
+ * [r434]
+ [lcd4linux @ 2004-05-25 19:54:11 by reinelt]
+ 'make distcheck' bugs fixed
+ release number changed to 0.10.0-RC1
+
+ * [r433]
+ [lcd4linux @ 2004-05-25 19:47:11 by reinelt]
+ Status updated
+ obsolete files removed
+
+ * [r432]
+ [lcd4linux @ 2004-05-25 14:28:46 by reinelt]
+ Changelog updated
+
+ * [r431]
+ [lcd4linux @ 2004-05-25 14:27:21 by reinelt]
+ added drv_Image.c (this time really!)
+
+ * [r430]
+ [lcd4linux @ 2004-05-25 14:26:28 by reinelt]
+ added "Image" driver (was: Raster.c) for PPM and PNG creation
+ fixed some glitches in the X11 driver
+
+ * [r429]
+ [lcd4linux @ 2004-05-25 06:42:31 by reinelt]
+ removed old sample config lcd4linux.conf.sample.old from CVS
+
+2004-05-23 reinelt
+
+ * [r428]
+ [lcd4linux @ 2004-05-23 08:58:30 by reinelt]
+ icon bug with USBLCD fixed
+
+2004-05-22 reinelt
+
+ * [r427]
+ [lcd4linux @ 2004-05-22 18:30:01 by reinelt]
+ added plugin 'uptime'
+
+ * [r426]
+ [lcd4linux @ 2004-05-22 04:23:49 by reinelt]
+ removed 16*x fix again (next time think before commit :-)
+
+ * [r425]
+ [lcd4linux @ 2004-05-22 04:21:02 by reinelt]
+ fix for display RAM layout on 16x4 displays (thanks to
+ toxicated101)
+
+2004-05-20 reinelt
+
+ * [r424]
+ [lcd4linux @ 2004-05-20 07:47:51 by reinelt]
+ added plugin_time
+
+ * [r423]
+ [lcd4linux @ 2004-05-20 07:14:35 by reinelt]
+ made all local functions static
+
+2004-05-19 reinelt
+
+ * [r422]
+ [lcd4linux @ 2004-05-19 05:38:25 by reinelt]
+ removed AC_PROG_CXX (C++-Compiler) from configure
+
+ * [r421]
+ [lcd4linux @ 2004-05-19 05:23:25 by reinelt]
+ plugin_isdn.c added (sorry, I forgot...)
+
+2004-05-09 reinelt
+
+ * [r420]
+ [lcd4linux @ 2004-05-09 05:41:41 by reinelt]
+ i2c fix for kernel 2.6.5 (temp_input1 vs. temp1_input) from
+ Xavier
+
+2004-04-17 nicowallmeier
+
+ * [r419]
+ [lcd4linux @ 2004-04-17 13:03:34 by nicowallmeier]
+ minor bugfix
+
+2004-04-12 reinelt
+
+ * [r418]
+ [lcd4linux @ 2004-04-12 11:12:24 by reinelt]
+ added plugin_isdn, removed old ISDN client
+ fixed some real bad bugs in the evaluator
+
+ * [r417]
+ [lcd4linux @ 2004-04-12 05:59:24 by reinelt]
+ Status update
+
+ * [r416]
+ [lcd4linux @ 2004-04-12 05:14:42 by reinelt]
+ another BIG FAT WARNING on the use of raw ports instead of ppdev
+
+ * [r415]
+ [lcd4linux @ 2004-04-12 04:55:59 by reinelt]
+ emitted a BIG FAT WARNING if msr.h could not be found (and
+ therefore
+ the gettimeofday() delay loop would be used)
+
+2004-04-11 reinelt
+
+ * [r414]
+ [lcd4linux @ 2004-04-11 17:37:09 by reinelt]
+ forgot these files at last checkin... sorry!
+
+2004-04-09 reinelt
+
+ * [r413]
+ [lcd4linux @ 2004-04-09 06:23:28 by reinelt]
+ removed old exec stuff
+
+ * [r412]
+ [lcd4linux @ 2004-04-09 06:09:54 by reinelt]
+ big configure rework from Xavier
+
+2004-04-08 reinelt
+
+ * [r411]
+ [lcd4linux @ 2004-04-08 11:59:26 by reinelt]
+ added plugin_pop3 from Javi
+
+ * [r410]
+ [lcd4linux @ 2004-04-08 10:48:23 by reinelt]
+ finished plugin_exec
+ modified thread handling
+ added '%x' format to qprintf (hexadecimal)
+
+2004-04-07 hejl
+
+ * [r409]
+ [lcd4linux @ 2004-04-07 08:29:05 by hejl]
+ New plugin for wireless info
+
+2004-03-21 reinelt
+
+ * [r408]
+ [lcd4linux @ 2004-03-21 22:05:53 by reinelt]
+ MySQL plugin fixes from Javi
+
+2004-03-20 reinelt
+
+ * [r407]
+ [lcd4linux @ 2004-03-20 23:09:01 by reinelt]
+ MySQL plugin fixes from Javi
+
+ * [r406]
+ [lcd4linux @ 2004-03-20 11:49:40 by reinelt]
+ forgot to add plugin_exec.c ...
+
+ * [r405]
+ [lcd4linux @ 2004-03-20 07:31:32 by reinelt]
+ support for HD66712 (which has a different RAM layout)
+ further threading development
+
+2004-03-19 reinelt
+
+ * [r404]
+ [lcd4linux @ 2004-03-19 09:17:46 by reinelt]
+ removed the extra 'goto' function, row and col are additional
+ parameters
+ of the write() function now.
+
+ * [r403]
+ [lcd4linux @ 2004-03-19 06:37:47 by reinelt]
+ asynchronous thread handling started
+
+2004-03-14 reinelt
+
+ * [r402]
+ [lcd4linux @ 2004-03-14 07:14:05 by reinelt]
+ old battery.[ch] files removed
+
+ * [r401]
+ [lcd4linux @ 2004-03-14 07:11:42 by reinelt]
+ parameter count fixed for plugin_dvb()
+ plugin_APM (battery status) ported
+
+ * [r400]
+ [lcd4linux @ 2004-03-14 06:07:33 by reinelt]
+ Status update.
+ Fixed bug in configure.in with X11 disabled (thanks to Kevin Liu)
+
+2004-03-13 reinelt
+
+ * [r399]
+ [lcd4linux @ 2004-03-13 19:06:01 by reinelt]
+ ChangeLog and Status update; small glitch in plugin_seti fixed.
+
+2004-03-13 nicowallmeier
+
+ * [r398]
+ [lcd4linux @ 2004-03-13 14:58:15 by nicowallmeier]
+ Added clean termination of imond-connection (now correctly)
+
+ * [r397]
+ [lcd4linux @ 2004-03-13 14:55:14 by nicowallmeier]
+ Added clean termination of imond-connection
+
+2004-03-13 reinelt
+
+ * [r396]
+ [lcd4linux @ 2004-03-13 06:55:29 by reinelt]
+ (unnecessary) imon.h removed
+
+ * [r395]
+ [lcd4linux @ 2004-03-13 06:49:20 by reinelt]
+ seti@home plugin ported to NextGeneration
+
+2004-03-12 reinelt
+
+ * [r394]
+ [lcd4linux @ 2004-03-12 13:58:14 by reinelt]
+ removed imon.c (has been replaced by plugin_imon.c)
+
+2004-03-11 reinelt
+
+ * [r393]
+ [lcd4linux @ 2004-03-11 06:39:58 by reinelt]
+ big patch from Martin:
+ - reuse filehandles
+ - memory leaks fixed
+ - earlier busy-flag checking with HD44780
+ - reuse memory for strings in RESULT and hash
+ - netdev_fast to wavid time-consuming regex
+
+2004-03-10 reinelt
+
+ * [r392]
+ [lcd4linux @ 2004-03-10 07:16:15 by reinelt]
+ MySQL plugin from Javier added
+
+2004-03-08 hejl
+
+ * [r391]
+ [lcd4linux @ 2004-03-08 18:46:21 by hejl]
+ Fixed bug introduced with "caching" the loadavg values
+
+ * [r390]
+ [lcd4linux @ 2004-03-08 18:45:52 by hejl]
+ fixed segfault when using string concatenation
+
+2004-03-08 reinelt
+
+ * [r389]
+ [lcd4linux @ 2004-03-08 16:26:26 by reinelt]
+ re-introduced \nnn (octal) characters in strings
+ text widgets can have a 'update' speed of 0 which means 'never'
+ (may be used for static content)
+
+ * [r388]
+ [lcd4linux @ 2004-03-08 04:33:08 by reinelt]
+ string concatenation fixed
+
+2004-03-06 reinelt
+
+ * [r387]
+ [lcd4linux @ 2004-03-06 20:31:16 by reinelt]
+ Complete rewrite of the evaluator to get rid of the code
+ from mark Morley (because of license issues).
+ The new Evaluator does a pre-compile of expressions, and
+ stores them in trees. Therefore it should be reasonable faster...
+
+2004-03-03 hejl
+
+ * [r386]
+ [lcd4linux @ 2004-03-03 08:40:07 by hejl]
+ Fixed memory leak in hash_get_regex
+
+2004-03-03 reinelt
+
+ * [r385]
+ [lcd4linux @ 2004-03-03 04:44:16 by reinelt]
+ changes (cosmetics?) to the big patch from Martin
+ hash patch un-applied
+
+ * [r384]
+ [lcd4linux @ 2004-03-03 03:47:04 by reinelt]
+ big patch from Martin Hejl:
+ - use qprintf() where appropriate
+ - save CPU cycles on gettimeofday()
+ - add quit() functions to free allocated memory
+ - fixed lots of memory leaks
+
+ * [r383]
+ [lcd4linux @ 2004-03-03 03:41:02 by reinelt]
+ Crystalfontz Contrast issue fixed
+
+2004-03-01 reinelt
+
+ * [r382]
+ [lcd4linux @ 2004-03-01 04:29:51 by reinelt]
+ cfg_number() returns -1 on error, 0 if value not found (but
+ default val used),
+ and 1 if value was used from the configuration.
+ HD44780 driver adopted to new cfg_number()
+ Crystalfontz 631 driver nearly finished
+
+2004-02-29 reinelt
+
+ * [r381]
+ [lcd4linux @ 2004-02-29 17:09:53 by reinelt]
+ ChangeLog updated
+ Version number bumped to 0.10.0
+
+ * [r380]
+ [lcd4linux @ 2004-02-29 14:30:59 by reinelt]
+ icon visibility fix for generic graphics from Xavier
+
+2004-02-27 reinelt
+
+ * [r379]
+ [lcd4linux @ 2004-02-27 07:06:24 by reinelt]
+ new function 'qprintf()' (simple but quick snprintf()
+ replacement)
+
+ * [r378]
+ [lcd4linux @ 2004-02-27 06:07:55 by reinelt]
+ hash improvements from Martin
+
+2004-02-26 reinelt
+
+ * [r377]
+ [lcd4linux @ 2004-02-26 21:42:45 by reinelt]
+ memory leak fixes from Martin
+
+2004-02-24 reinelt
+
+ * [r376]
+ [lcd4linux @ 2004-02-24 06:00:22 by reinelt]
+ Status and Todo list from Xavier
+
+ * [r375]
+ [lcd4linux @ 2004-02-24 05:54:57 by reinelt]
+ X11 driver ported
+
+2004-02-23 reinelt
+
+ * [r374]
+ [lcd4linux @ 2004-02-23 06:44:27 by reinelt]
+ "Lightning" widget from Xavier (lcd4linux.conf.sample)
+ removed obsolete Docs.
+
+2004-02-22 reinelt
+
+ * [r373]
+ [lcd4linux @ 2004-02-22 17:35:41 by reinelt]
+ some fixes for generic graphic driver and T6963
+ removed ^M from plugin_imon (Nico, are you editing under
+ Windows?)
+
+2004-02-18 nicowallmeier
+
+ * [r372]
+ [lcd4linux @ 2004-02-18 14:45:42 by nicowallmeier]
+ Imon/Telmon plugin ported
+
+2004-02-18 reinelt
+
+ * [r371]
+ [lcd4linux @ 2004-02-18 06:39:20 by reinelt]
+ T6963 driver for graphic displays finished
+
+2004-02-17 reinelt
+
+ * [r370]
+ [lcd4linux @ 2004-02-17 05:37:20 by reinelt]
+ Namespace clash between Curses driver and general text driver
+ resolved
+ (thanks to Martin Hejl)
+
+2004-02-16 reinelt
+
+ * [r369]
+ [lcd4linux @ 2004-02-16 13:03:37 by reinelt]
+ compile problem with missing frontend.h fixed
+
+ * [r368]
+ [lcd4linux @ 2004-02-16 08:19:44 by reinelt]
+ i2c_sensors patch from Xavier
+
+2004-02-15 reinelt
+
+ * [r367]
+ [lcd4linux @ 2004-02-15 21:43:43 by reinelt]
+ T6963 driver nearly finished
+ framework for graphic displays done
+ i2c_sensors patch from Xavier
+ some more old generation files removed
+
+ * [r366]
+ [lcd4linux @ 2004-02-15 08:22:47 by reinelt]
+ ported USBLCD driver to NextGeneration
+ added drv_M50530.c (I forgot yesterday, sorry)
+ removed old drivers M50530.c and USBLCD.c
+
+ * [r365]
+ [lcd4linux @ 2004-02-15 07:23:04 by reinelt]
+ bug in netdev parsing fixed
+
+2004-02-14 nicowallmeier
+
+ * [r364]
+ [lcd4linux @ 2004-02-14 12:07:27 by nicowallmeier]
+ minor bugfix
+
+2004-02-14 reinelt
+
+ * [r363]
+ [lcd4linux @ 2004-02-14 11:56:11 by reinelt]
+ M50530 driver ported
+ changed lots of 'char' to 'unsigned char'
+
+ * [r362]
+ [lcd4linux @ 2004-02-14 10:09:50 by reinelt]
+ I2C Sensors for 2.4 kernels (/proc instead of /sysfs)
+
+2004-02-10 reinelt
+
+ * [r361]
+ [lcd4linux @ 2004-02-10 07:42:35 by reinelt]
+ cut off all old-style files which are no longer used with
+ NextGeneration
+
+ * [r360]
+ [lcd4linux @ 2004-02-10 06:54:38 by reinelt]
+ DVB plugin ported
+
+2004-02-09 nicowallmeier
+
+ * [r359]
+ [lcd4linux @ 2004-02-09 19:49:38 by nicowallmeier]
+ Minor bugfix
+
+2004-02-07 reinelt
+
+ * [r358]
+ [lcd4linux @ 2004-02-07 13:45:23 by reinelt]
+ icon visibility patch #2 from Xavier
+
+2004-02-05 mkeil
+
+ * [r357]
+ [lcd4linux @ 2004-02-05 23:58:18 by mkeil]
+ Fixed/Optimized Hashage-timings
+
+2004-02-05 reinelt
+
+ * [r356]
+ [lcd4linux @ 2004-02-05 07:10:23 by reinelt]
+ evaluator function names are no longer case-sensitive
+ Crystalfontz Fan PWM control, Fan RPM monitoring, temperature
+ monitoring
+
+2004-02-04 reinelt
+
+ * [r355]
+ [lcd4linux @ 2004-02-04 19:11:44 by reinelt]
+ icon visibility patch from Xavier
+
+ * [r354]
+ [lcd4linux @ 2004-02-04 19:10:51 by reinelt]
+ Crystalfontz driver nearly finished
+
+2004-02-02 reinelt
+
+ * [r353]
+ [lcd4linux @ 2004-02-02 05:22:16 by reinelt]
+ Brightness fpr Noritake Displays avaliable as a plugin
+
+2004-02-01 reinelt
+
+ * [r352]
+ [lcd4linux @ 2004-02-01 19:37:40 by reinelt]
+ got rid of every strtok() incarnation.
+
+ * [r351]
+ [lcd4linux @ 2004-02-01 18:08:50 by reinelt]
+ removed strtok() from layout processing (took me hours to find
+ this bug)
+ further strtok() removind should be done!
+
+2004-02-01 hejl
+
+ * [r350]
+ [lcd4linux @ 2004-02-01 11:51:22 by hejl]
+ Fixes for busy flag
+
+2004-02-01 reinelt
+
+ * [r349]
+ [lcd4linux @ 2004-02-01 08:05:12 by reinelt]
+ Crystalfontz 633 extensions (CRC checking and stuff)
+ Models table for HD44780
+ Noritake VFD BVrightness patch from Bill Paxton
+
+2004-01-30 reinelt
+
+ * [r348]
+ [lcd4linux @ 2004-01-30 20:57:55 by reinelt]
+ HD44780 patch from Martin Hejl
+ dmalloc integrated
+
+ * [r347]
+ [lcd4linux @ 2004-01-30 07:12:35 by reinelt]
+ HD44780 busy-flag support from Martin Hejl
+ loadavg() uClibc replacement from Martin Heyl
+ round() uClibc replacement from Martin Hejl
+ warning in i2c_sensors fixed
+ [
+
+2004-01-29 reinelt
+
+ * [r346]
+ [lcd4linux @ 2004-01-29 05:55:30 by reinelt]
+ check for /sys mounted
+
+ * [r345]
+ [lcd4linux @ 2004-01-29 05:53:47 by reinelt]
+ uClibc compatibility issues from Martin Hejl
+
+ * [r344]
+ [lcd4linux @ 2004-01-29 04:40:02 by reinelt]
+ every .c file includes "config.h" now
+
+2004-01-28 reinelt
+
+ * [r343]
+ [lcd4linux @ 2004-01-28 06:43:31 by reinelt]
+ plugin_ppp finished.
+
+2004-01-27 reinelt
+
+ * [r342]
+ [lcd4linux @ 2004-01-27 08:13:39 by reinelt]
+ ported PPP token to plugin_ppp
+
+ * [r341]
+ [lcd4linux @ 2004-01-27 06:34:14 by reinelt]
+ Cwlinux driver portet to NextGeneration (compiles, but not
+ tested!)
+
+ * [r340]
+ [lcd4linux @ 2004-01-27 05:06:10 by reinelt]
+ i2c update from Xavier
+
+ * [r339]
+ [lcd4linux @ 2004-01-27 04:48:57 by reinelt]
+ bug with hash_age() fixed (thanks to Markus Keil for pointing
+ this out)
+
+2004-01-25 reinelt
+
+ * [r338]
+ [lcd4linux @ 2004-01-25 05:30:08 by reinelt]
+ plugin_netdev for parsing /proc/net/dev added
+
+2004-01-23 reinelt
+
+ * [r337]
+ [lcd4linux @ 2004-01-23 07:04:03 by reinelt]
+ icons finished!
+
+ * [r336]
+ [lcd4linux @ 2004-01-23 04:53:23 by reinelt]
+ icon widget added (not finished yet!)
+
+2004-01-22 reinelt
+
+ * [r335]
+ [lcd4linux @ 2004-01-22 08:55:30 by reinelt]
+ fixed unhandled kernel-2.6 entries in /prco/stat
+
+ * [r334]
+ [lcd4linux @ 2004-01-22 07:57:45 by reinelt]
+ several bugs fixed where segfaulting on layout>display
+ Crystalfontz driver optimized, 632 display already works
+
+2004-01-21 reinelt
+
+ * [r333]
+ [lcd4linux @ 2004-01-21 14:29:03 by reinelt]
+ new helper 'hash_get_regex' which delivers the sum over regex
+ matched items
+ new function 'disk()' which uses this regex matching
+
+ * [r332]
+ [lcd4linux @ 2004-01-21 12:36:19 by reinelt]
+ Crystalfontz NextGeneration driver added
+
+ * [r331]
+ [lcd4linux @ 2004-01-21 11:32:48 by reinelt]
+ changelog commited
+
+ * [r330]
+ [lcd4linux @ 2004-01-21 11:31:23 by reinelt]
+ two bugs with hash_age() ixed
+
+ * [r329]
+ [lcd4linux @ 2004-01-21 10:48:17 by reinelt]
+ hash_age function added
+
+ * [r328]
+ [lcd4linux @ 2004-01-21 06:39:27 by reinelt]
+ HD44780 missed the "clear display' sequence
+ asc255bug handling added
+ HD44780 tested, works here!
+
+2004-01-20 reinelt
+
+ * [r327]
+ [lcd4linux @ 2004-01-20 15:32:48 by reinelt]
+ first version of Next Generation HD44780 (untested! but it
+ compiles...)
+ some cleanup in the other drivers
+
+ * [r326]
+ [lcd4linux @ 2004-01-20 14:35:38 by reinelt]
+ drv_generic_parport added, code from parport.c
+
+ * [r325]
+ [lcd4linux @ 2004-01-20 14:26:09 by reinelt]
+ moved drv_generic to drv_generic_serial
+
+ * [r324]
+ [lcd4linux @ 2004-01-20 14:25:12 by reinelt]
+ some reorganization
+ moved drv_generic to drv_generic_serial
+ moved port locking stuff to drv_generic_serial
+
+ * [r323]
+ [lcd4linux @ 2004-01-20 12:45:47 by reinelt]
+ "Default screen" working with MatrixOrbital
+
+ * [r322]
+ [lcd4linux @ 2004-01-20 05:36:59 by reinelt]
+ moved text-display-specific stuff to drv_generic_text
+ moved all the bar stuff from drv_generic_bar to generic_text
+
+ * [r321]
+ [lcd4linux @ 2004-01-20 04:51:39 by reinelt]
+ moved generic stuff from drv_MatrixOrbital to drv_generic
+ implemented new-stylish bars which are nearly finished
+
+2004-01-18 reinelt
+
+ * [r320]
+ [lcd4linux @ 2004-01-18 21:25:16 by reinelt]
+ Framework for bar widget opened
+
+ * [r319]
+ [lcd4linux @ 2004-01-18 09:01:45 by reinelt]
+ /proc/stat parsing finished
+
+ * [r318]
+ [lcd4linux @ 2004-01-18 06:54:08 by reinelt]
+ bug in expr.c fixed (thanks to Xavier)
+ some progress with /proc/stat parsing
+
+2004-01-16 reinelt
+
+ * [r317]
+ [lcd4linux @ 2004-01-16 11:12:26 by reinelt]
+ some bugs in plugin_xmms fixed, parsing moved to own function
+ plugin_proc_stat nearly finished
+
+2004-01-16 mkeil
+
+ * [r316]
+ [lcd4linux @ 2004-01-16 10:09:49 by mkeil]
+ -include caching for values
+
+2004-01-16 reinelt
+
+ * [r315]
+ [lcd4linux @ 2004-01-16 07:26:25 by reinelt]
+ moved various /proc parsing to own functions
+ made some progress with /proc/stat parsing
+
+ * [r314]
+ [lcd4linux @ 2004-01-16 05:04:53 by reinelt]
+ started plugin proc_stat which should parse /proc/stat
+ which again is a paint in the a**
+ thinking over implementation methods of delta functions
+ (CPU load, ...)
+
+2004-01-15 reinelt
+
+ * [r313]
+ [lcd4linux @ 2004-01-15 07:47:02 by reinelt]
+ debian/ postinst and watch added (did CVS forget about them?)
+ evaluator: conditional expressions (a?b:c) added
+ text widget nearly finished
+
+ * [r312]
+ [lcd4linux @ 2004-01-15 04:32:14 by reinelt]
+
+ * [r311]
+ [lcd4linux @ 2004-01-15 04:29:45 by reinelt]
+ moved lcd4linux.conf.sample to *.old
+ lcd4linux.conf.sample with new layout
+ new plugins 'loadavg' and 'meminfo'
+ text widget have pre- and postfix
+
+2004-01-14 reinelt
+
+ * [r310]
+ [lcd4linux @ 2004-01-14 11:33:00 by reinelt]
+ new plugin 'uname' which does what it's called
+ text widget nearly finished
+ first results displayed on MatrixOrbital
+
+2004-01-13 reinelt
+
+ * [r309]
+ [lcd4linux @ 2004-01-13 10:03:01 by reinelt]
+ new util 'hash' for associative arrays
+ new plugin 'cpuinfo'
+
+ * [r308]
+ [lcd4linux @ 2004-01-13 08:18:07 by reinelt]
+ timer queues added
+ liblcd4linux deactivated turing transformation to new layout
+
+2004-01-12 reinelt
+
+ * [r307]
+ [lcd4linux @ 2004-01-12 03:51:01 by reinelt]
+ evaluating the 'Variables' section in the config file
+
+2004-01-11 reinelt
+
+ * [r306]
+ [lcd4linux @ 2004-01-11 18:26:02 by reinelt]
+ further widget and layout processing
+
+ * [r305]
+ [lcd4linux @ 2004-01-11 09:26:15 by reinelt]
+ layout starts to exist...
+
+2004-01-10 reinelt
+
+ * [r304]
+ [lcd4linux @ 2004-01-10 20:22:33 by reinelt]
+ added new function 'cfg_list()' (not finished yet)
+ added layout.c (will replace processor.c someday)
+ added widget_text.c (will be the first and most important widget)
+ modified lcd4linux.c so that old-style configs should work, too
+
+ * [r303]
+ [lcd4linux @ 2004-01-10 17:45:26 by reinelt]
+ changed initialization order so cfg() gets initialized before
+ plugins.
+ This way a plugin's init() can use cfg_get().
+ Thanks to Xavier for reporting this one!
+
+ * [r302]
+ [lcd4linux @ 2004-01-10 17:36:56 by reinelt]
+ I2C Sensors plugin from Xavier added
+
+ * [r301]
+ [lcd4linux @ 2004-01-10 17:34:40 by reinelt]
+ further matrixOrbital changes
+ widgets initialized
+
+ * [r300]
+ [lcd4linux @ 2004-01-10 10:20:22 by reinelt]
+ new MatrixOrbital changes
+
+2004-01-09 reinelt
+
+ * [r299]
+ [lcd4linux @ 2004-01-09 17:03:06 by reinelt]
+ initiated transfer to new driver architecture
+ new file 'drv.c' will someday replace 'display.c'
+ new file 'drv_MatrixOrbital.c' will replace 'MatrixOrbital.c'
+ due to this 'soft' transfer lcd4linux should stay usable during
+ the switch
+ (at least I hope so)
+
+ * [r298]
+ [lcd4linux @ 2004-01-09 04:16:06 by reinelt]
+ added 'section' argument to cfg_get(), but NULLed it on all calls
+ by now.
+
+2004-01-08 reinelt
+
+ * [r297]
+ [lcd4linux @ 2004-01-08 06:00:28 by reinelt]
+ allowed '.' in key names
+ allowed empty group keys (not only "group anything {", but
+ "anything {")
+
+ * [r296]
+ [lcd4linux @ 2004-01-08 05:28:12 by reinelt]
+ Luk Claes added to AUTHORS
+ cfg: group handling ('{}') added
+
+2004-01-07 reinelt
+
+ * [r295]
+ [lcd4linux @ 2004-01-07 10:15:41 by reinelt]
+ small glitch in evaluator fixed
+ made config table sorted and access with bsearch(),
+ which should be much faster
+
+2004-01-06 reinelt
+
+ * [r294]
+ [lcd4linux @ 2004-01-06 23:01:37 by reinelt]
+ more copyright issues
+
+ * [r293]
+ [lcd4linux @ 2004-01-06 22:33:13 by reinelt]
+ Copyright statements cleaned up
+
+ * [r292]
+ [lcd4linux @ 2004-01-06 21:14:51 by reinelt]
+ more debianizing
+
+ * [r291]
+ [lcd4linux @ 2004-01-06 18:22:41 by reinelt]
+ debian updates
+
+ * [r290]
+ [lcd4linux @ 2004-01-06 17:56:43 by reinelt]
+ autotools update
+
+ * [r289]
+ [lcd4linux @ 2004-01-06 17:37:00 by reinelt]
+
+ * [r288]
+ [lcd4linux @ 2004-01-06 17:33:45 by reinelt]
+ Evaluator: functions with variable argument lists
+ Evaluator: plugin_sample.c and README.Plugins added
+
+ * [r287]
+ [lcd4linux @ 2004-01-06 15:19:12 by reinelt]
+ Evaluator rearrangements...
+
+2004-01-05 reinelt
+
+ * [r286]
+ [lcd4linux @ 2004-01-05 11:57:38 by reinelt]
+ added %y tokens to make the Evaluator useable
+
+2004-01-02 reinelt
+
+ * [r285]
+ [lcd4linux @ 2004-01-02 14:20:15 by reinelt]
+ debianization added
+
+ * [r284]
+ [lcd4linux @ 2004-01-02 14:18:54 by reinelt]
+ Changelog, TODO updated
+
+2003-12-19 reinelt
+
+ * [r283]
+ [lcd4linux @ 2003-12-19 06:27:33 by reinelt]
+ added XMMS plugin from Markus Keil
+
+ * [r282]
+ [lcd4linux @ 2003-12-19 05:56:13 by reinelt]
+ added .cvsignore containing '*.lo'
+
+ * [r281]
+ [lcd4linux @ 2003-12-19 05:50:34 by reinelt]
+ added plugin_math.c and plugin_string.c
+
+ * [r280]
+ [lcd4linux @ 2003-12-19 05:49:23 by reinelt]
+ extracted plugin_math and plugin_string into extra files
+
+ * [r279]
+ [lcd4linux @ 2003-12-19 05:35:13 by reinelt]
+ renamed 'client' to 'plugin'
+
+2003-12-01 reinelt
+
+ * [r278]
+ [lcd4linux @ 2003-12-01 07:08:50 by reinelt]
+ Patches from Xavier:
+ - WiFi: make interface configurable
+ - "quiet" as an option from the config file
+ - ignore missing "MemShared" on Linux 2.6
+
+2003-11-30 reinelt
+
+ * [r277]
+ [lcd4linux @ 2003-11-30 16:18:36 by reinelt]
+ Cwlinux: invalidate Framebuffer in case a char got redefined
+
+2003-11-28 nicowallmeier
+
+ * [r276]
+ [lcd4linux @ 2003-11-28 18:34:55 by nicowallmeier]
+ Minor bugfixes
+
+2003-11-24 reinelt
+
+ * [r275]
+ [lcd4linux @ 2003-11-24 11:34:54 by reinelt]
+ 'Fixed' Rows which do not scroll by Lars Kempe
+ temporary workaround for debian kernel-header bug
+
+2003-11-16 reinelt
+
+ * [r274]
+ [lcd4linux @ 2003-11-16 09:45:49 by reinelt]
+ Crystalfontz changes, small glitch in getopt() fixed
+
+2003-11-14 reinelt
+
+ * [r273]
+ [lcd4linux @ 2003-11-14 05:59:37 by reinelt]
+ added wifi.c wifi.h which have been forgotten at the last checkin
+
+2003-11-12 reinelt
+
+ * [r272]
+ [lcd4linux @ 2003-11-12 05:42:35 by reinelt]
+ small changes to the 16x4 handling
+
+2003-11-11 reinelt
+
+ * [r271]
+ [lcd4linux @ 2003-11-11 04:40:20 by reinelt]
+ WIFI patch from Xavier Vello
+
+ * [r270]
+ [lcd4linux @ 2003-11-11 04:30:41 by reinelt]
+ very minor changes
+
+2003-10-27 reinelt
+
+ * [r269]
+ [lcd4linux @ 2003-10-27 09:05:42 by reinelt]
+ README.Rows, README.Tokens, lcd4linux.conf.sample from Thomas
+ Siedentopf
+
+2003-10-22 reinelt
+
+ * [r268]
+ [lcd4linux @ 2003-10-22 04:32:25 by reinelt]
+ fixed icon bug found by Rob van Nieuwkerk
+
+ * [r267]
+ [lcd4linux @ 2003-10-22 04:19:16 by reinelt]
+ Makefile.in for imon.c/.h, some MatrixOrbital clients
+
+2003-10-12 nicowallmeier
+
+ * [r266]
+ [lcd4linux @ 2003-10-12 06:08:28 by nicowallmeier]
+ imond/telmond support
+
+2003-10-12 reinelt
+
+ * [r265]
+ [lcd4linux @ 2003-10-12 04:46:19 by reinelt]
+ first try to integrate the Evaluator into a display driver
+ (MatrixOrbital here)
+ small warning in processor.c fixed (thanks to Zachary Giles)
+ workaround for udelay() on alpha (no msr.h avaliable) (thanks to
+ Zachary Giles)
+
+2003-10-11 reinelt
+
+ * [r264]
+ [lcd4linux @ 2003-10-11 06:01:52 by reinelt]
+ renamed expression.{c,h} to client.{c,h}
+ added config file client
+ new functions 'AddNumericVariable()' and 'AddStringVariable()'
+ new parameter '-i' for interactive mode
+
+2003-10-08 reinelt
+
+ * [r263]
+ [lcd4linux @ 2003-10-08 14:21:10 by reinelt]
+ Changelog; small type in parport.c
+
+2003-10-08 andy-b
+
+ * [r262]
+ [lcd4linux @ 2003-10-08 13:39:53 by andy-b]
+ Cleaned up code in MilfordInstruments.c, and added descriptions
+ for other display sizes (untested)
+
+2003-10-08 nicowallmeier
+
+ * [r261]
+ [lcd4linux @ 2003-10-08 06:48:47 by nicowallmeier]
+ special handling for 16x4 displays
+
+ * [r260]
+ [lcd4linux @ 2003-10-08 06:45:00 by nicowallmeier]
+ Support of two displays of the same size
+
+2003-10-07 reinelt
+
+ * [r259]
+ [lcd4linux @ 2003-10-07 04:12:38 by reinelt]
+ AM_PROG_LIBTOOL removed
+
+2003-10-06 reinelt
+
+ * [r258]
+ [lcd4linux @ 2003-10-06 05:51:15 by reinelt]
+ functions: min(), max()
+
+ * [r257]
+ [lcd4linux @ 2003-10-06 05:47:27 by reinelt]
+ operators: ==, \!=, <=, >=
+
+ * [r256]
+ [lcd4linux @ 2003-10-06 04:34:06 by reinelt]
+ expression evaluator added
+
+ * [r255]
+ [lcd4linux @ 2003-10-06 04:33:06 by reinelt]
+ files 'libtool' and 'bootstrap' added
+
+ * [r254]
+ [lcd4linux @ 2003-10-06 04:30:43 by reinelt]
+ libtool stuff again...
+
+2003-10-05 reinelt
+
+ * [r253]
+ [lcd4linux @ 2003-10-05 17:58:50 by reinelt]
+ libtool junk; copyright messages cleaned up
+
+2003-10-04 reinelt
+
+ * [r252]
+ [lcd4linux @ 2003-10-04 07:54:17 by reinelt]
+ autoconf/automake/libtool fixes from Ronald Landheer-Cieslak
+
+2003-10-03 reinelt
+
+ * [r251]
+ [lcd4linux @ 2003-10-03 03:53:12 by reinelt]
+ compile error in parport fixed (thanks to Andrew from FilmCan)
+
+ * [r250]
+ [lcd4linux @ 2003-10-03 03:51:14 by reinelt]
+ start support for new MatrixOrbital MX2 displays
+
+2003-09-29 reinelt
+
+ * [r249]
+ [lcd4linux @ 2003-09-29 06:58:36 by reinelt]
+ new driver for Milford Instruments MI420 by Andy Baxter
+
+ * [r248]
+ [lcd4linux @ 2003-09-29 06:12:56 by reinelt]
+ changed default HD44780 wiring: unused signals are GND
+
+2003-09-21 reinelt
+
+ * [r247]
+ [lcd4linux @ 2003-09-21 06:43:02 by reinelt]
+ MatrixOrbital: bidirectional communication
+ HD44780: special handling for 16x1 displays (thanks to anonymous
+ bug report on sf.net)
+
+2003-09-19 reinelt
+
+ * [r246]
+ [lcd4linux @ 2003-09-19 08:40:32 by reinelt]
+ increased version number to 0.9.12
+ port locking is done as /var/lock/LCK..usb_tts_0 for
+ /dev/usb/tts/0
+
+ * [r245]
+ [lcd4linux @ 2003-09-19 03:51:29 by reinelt]
+ minor fixes, widget.c added
+
+2003-09-13 reinelt
+
+ * [r244]
+ [lcd4linux @ 2003-09-13 07:20:51 by reinelt]
+ Changelog
+
+ * [r243]
+ [lcd4linux @ 2003-09-13 06:45:43 by reinelt]
+ icons for all remaining drivers
+
+ * [r242]
+ [lcd4linux @ 2003-09-13 06:20:39 by reinelt]
+ HD44780 timings changed; deactivated libtool
+
+2003-09-11 reinelt
+
+ * [r241]
+ [lcd4linux @ 2003-09-11 15:05:24 by reinelt]
+ missing files for autoconf/automake/libtool
+
+ * [r240]
+ [lcd4linux @ 2003-09-11 04:09:52 by reinelt]
+ minor cleanups
+
+2003-09-10 reinelt
+
+ * [r239]
+ [lcd4linux @ 2003-09-10 15:59:39 by reinelt]
+ minor cleanups
+
+ * [r238]
+ [lcd4linux @ 2003-09-10 15:09:21 by reinelt]
+ ChangeLog
+
+ * [r237]
+ [lcd4linux @ 2003-09-10 14:01:52 by reinelt]
+ icons nearly finished\!
+
+ * [r236]
+ [lcd4linux @ 2003-09-10 08:37:09 by reinelt]
+ icons: reorganized tick_* again...
+
+ * [r235]
+ [lcd4linux @ 2003-09-10 03:48:22 by reinelt]
+ Icons for M50530, new processing scheme (Ticks.Text...)
+
+2003-09-09 reinelt
+
+ * [r234]
+ [lcd4linux @ 2003-09-09 11:47:47 by reinelt]
+ basic icon support for HD44780
+
+ * [r233]
+ [lcd4linux @ 2003-09-09 06:54:43 by reinelt]
+ new function 'cfg_number()'
+
+ * [r232]
+ [lcd4linux @ 2003-09-09 05:30:33 by reinelt]
+ even more icons stuff
+
+2003-09-01 reinelt
+
+ * [r231]
+ [lcd4linux @ 2003-09-01 07:07:03 by reinelt]
+ shared liblcd4linux
+
+ * [r230]
+ [lcd4linux @ 2003-09-01 04:09:34 by reinelt]
+ icons nearly finished, but MatrixOrbital only
+
+2003-08-24 reinelt
+
+ * [r229]
+ [lcd4linux @ 2003-08-24 05:28:31 by reinelt]
+ ChangeLog
+
+ * [r228]
+ [lcd4linux @ 2003-08-24 05:17:58 by reinelt]
+ liblcd4linux patch from Patrick Schemitz
+
+ * [r227]
+ [lcd4linux @ 2003-08-24 04:31:56 by reinelt]
+ icon.c icon.h added
+
+2003-08-22 reinelt
+
+ * [r226]
+ [lcd4linux @ 2003-08-22 03:45:08 by reinelt]
+ bug in parallel port code fixed, more icons stuff
+
+2003-08-20 reinelt
+
+ * [r225]
+ [lcd4linux @ 2003-08-20 05:26:43 by reinelt]
+ small bug in bar compaction fixed
+
+2003-08-19 reinelt
+
+ * [r224]
+ [lcd4linux @ 2003-08-19 05:23:55 by reinelt]
+ HD44780 dual-controller patch from Jesse Brook Kovach
+
+ * [r223]
+ [lcd4linux @ 2003-08-19 04:28:41 by reinelt]
+ more Icon stuff, minor glitches fixed
+
+2003-08-17 reinelt
+
+ * [r222]
+ [lcd4linux @ 2003-08-17 16:37:39 by reinelt]
+ more icon framework
+
+ * [r221]
+ [lcd4linux @ 2003-08-17 12:11:58 by reinelt]
+ framework for icons prepared
+
+ * [r220]
+ [lcd4linux @ 2003-08-17 08:25:30 by reinelt]
+ preparations for liblcd4linux; minor bugs in SIN.c and Skeleton.c
+
+ * [r219]
+ [lcd4linux @ 2003-08-17 06:57:04 by reinelt]
+ complete rewrite of the Crystalfontz driver
+
+ * [r218]
+ [lcd4linux @ 2003-08-17 04:38:57 by reinelt]
+ added config.guess
+
+2003-08-16 reinelt
+
+ * [r217]
+ [lcd4linux @ 2003-08-16 07:31:35 by reinelt]
+ double buffering in all drivers
+
+2003-08-15 reinelt
+
+ * [r216]
+ [lcd4linux @ 2003-08-15 07:54:07 by reinelt]
+ HD44780 4 bit mode implemented
+
+2003-08-14 reinelt
+
+ * [r215]
+ [lcd4linux @ 2003-08-14 04:59:30 by reinelt]
+ changed version to 0.9.11, added curses.m4 to Makefile.am
+
+ * [r214]
+ [lcd4linux @ 2003-08-14 03:48:54 by reinelt]
+ ChangeLog
+
+ * [r213]
+ [lcd4linux @ 2003-08-14 03:47:40 by reinelt]
+ remove PID file if driver initialisation fails
+
+2003-08-12 reinelt
+
+ * [r212]
+ [lcd4linux @ 2003-08-12 05:10:31 by reinelt]
+ first version of HD44780 4Bit-Mode patch
+
+2003-08-11 reinelt
+
+ * [r211]
+ [lcd4linux @ 2003-08-11 04:51:28 by reinelt]
+ another uClibc issue: realloc
+
+2003-08-08 reinelt
+
+ * [r210]
+ [lcd4linux @ 2003-08-08 23:11:34 by reinelt]
+
+ * [r209]
+ [lcd4linux @ 2003-08-08 23:08:38 by reinelt]
+ CVS Id and Log missing from dvb.{c,h}
+
+ * [r208]
+ [lcd4linux @ 2003-08-08 08:05:23 by reinelt]
+ added PID file handling
+
+ * [r207]
+ [lcd4linux @ 2003-08-08 06:58:06 by reinelt]
+ improved forking
+
+ * [r206]
+ [lcd4linux @ 2003-08-08 05:42:51 by reinelt]
+ uClibc compatibility issue; small glitch in dvb.c
+
+2003-08-01 reinelt
+
+ * [r205]
+ [lcd4linux @ 2003-08-01 05:15:42 by reinelt]
+ last cleanups for 0.9.9
+
+2003-07-29 reinelt
+
+ * [r204]
+ [lcd4linux @ 2003-07-29 04:56:13 by reinelt]
+ disable Raster driver automagically if gd.h not found
+
+2003-07-28 reinelt
+
+ * [r203]
+ [lcd4linux @ 2003-07-28 08:22:17 by reinelt]
+ several README's moved to web page
+
+2003-07-24 reinelt
+
+ * [r202]
+ [lcd4linux @ 2003-07-24 04:48:09 by reinelt]
+ 'soft clear' needed for virtual rows
+
+2003-07-21 reinelt
+
+ * [r201]
+ [lcd4linux @ 2003-07-21 06:34:14 by reinelt]
+ bars on virtual rows fixed
+
+ * [r200]
+ [lcd4linux @ 2003-07-21 06:10:11 by reinelt]
+ removed maxlen parameter from process_row()
+
+ * [r199]
+ [lcd4linux @ 2003-07-21 05:56:48 by reinelt]
+ check for HAVE_LINUX_DVB_FRONTEND_H needs config.h
+
+2003-07-19 reinelt
+
+ * [r198]
+ [lcd4linux @ 2003-07-19 09:42:42 by reinelt]
+ check for dvb/frontend.h and disable DVB client if not found.
+
+2003-07-18 reinelt
+
+ * [r197]
+ [lcd4linux @ 2003-07-18 04:43:14 by reinelt]
+ udelay: unnecessary sanity check removed
+
+2003-06-26 reinelt
+
+ * [r196]
+ [lcd4linux @ 2003-06-26 05:31:16 by reinelt]
+ bug in /proc/net/dev parsing fixed
+
+2003-06-22 reinelt
+
+ * [r195]
+ [lcd4linux @ 2003-06-22 19:31:24 by reinelt]
+ added dvb.c dvb.h
+
+2003-06-21 reinelt
+
+ * [r194]
+ [lcd4linux @ 2003-06-21 05:46:18 by reinelt]
+ DVB client integrated
+
+2003-06-13 reinelt
+
+ * [r193]
+ [lcd4linux @ 2003-06-13 06:35:56 by reinelt]
+ added scrolling capability
+
+ * [r192]
+ [lcd4linux @ 2003-06-13 05:11:10 by reinelt]
+ error message cosmetics
+
+2003-05-19 reinelt
+
+ * [r191]
+ [lcd4linux @ 2003-05-19 05:55:17 by reinelt]
+ Cwlinux sleep optimization
+
+2003-05-14 reinelt
+
+ * [r190]
+ [lcd4linux @ 2003-05-14 06:17:39 by reinelt]
+ added support for CW1602
+
+2003-04-12 reinelt
+
+ * [r189]
+ [lcd4linux @ 2003-04-12 16:23:10 by reinelt]
+ small glitch in XWindow.c (thanks to Moe Wibble)
+
+2003-04-07 reinelt
+
+ * [r188]
+ [lcd4linux @ 2003-04-07 06:02:58 by reinelt]
+ further parallel port abstraction
+
+2003-04-04 reinelt
+
+ * [r187]
+ [lcd4linux @ 2003-04-04 06:01:59 by reinelt]
+ new parallel port abstraction scheme
+
+2003-02-27 reinelt
+
+ * [r186]
+ [lcd4linux @ 2003-02-27 07:48:57 by reinelt]
+ changed versioning scheme from 0.99 to 0.9.9
+
+ * [r185]
+ [lcd4linux @ 2003-02-27 07:43:10 by reinelt]
+ asm/msr.h: included hard-coded definition of rdtscl() if msr.h
+ cannot be found.
+
+ autoconf/automake/autoanything: switched back to 1.4. Hope it
+ works again.
+
+2003-02-24 reinelt
+
+ * [r184]
+ [lcd4linux @ 2003-02-24 04:50:57 by reinelt]
+ cwlinux fixes
+
+2003-02-22 reinelt
+
+ * [r183]
+ [lcd4linux @ 2003-02-22 07:53:09 by reinelt]
+ cfg_get(key,defval)
+
+ * [r182]
+ [lcd4linux @ 2003-02-22 07:23:24 by reinelt]
+ Cwlinux fixes
+
+2003-02-18 reinelt
+
+ * [r181]
+ [lcd4linux @ 2003-02-18 06:13:44 by reinelt]
+ X11 driver fixes and cleanup
+
+2003-02-17 reinelt
+
+ * [r180]
+ [lcd4linux @ 2003-02-17 06:06:12 by reinelt]
+ small bug in X11 driver: omit pixel gap between cahracters
+
+ * [r179]
+ [lcd4linux @ 2003-02-17 04:27:58 by reinelt]
+ Text (curses) driver: cosmetic changes
+
+2003-02-13 reinelt
+
+ * [r178]
+ [lcd4linux @ 2003-02-13 10:40:17 by reinelt]
+ changed "copyright" to "2003"
+ added slightly different protocol for MatrixOrbital "LK202"
+ displays
+
+2003-02-05 reinelt
+
+ * [r177]
+ [lcd4linux @ 2003-02-05 04:31:38 by reinelt]
+ T_EXEC: remove trailing CR/LF
+ T_EXEC: deactivated maxlen calculation (for I don't understand
+ what it is for :-)
+
+2003-01-12 reinelt
+
+ * [r176]
+ [lcd4linux @ 2003-01-12 06:51:27 by reinelt]
+ fixed bug in bar compaction
+
+2002-12-08 reinelt
+
+ * [r175]
+ [lcd4linux @ 2002-12-08 07:36:06 by reinelt]
+ autoconf/automake cleanup
+
+2002-12-06 reinelt
+
+ * [r174]
+ [lcd4linux @ 2002-12-06 07:38:43 by reinelt]
+ libgd/libpng bugfix: removed '-lpng -lz' from LDFLAGS
+
+2002-12-05 reinelt
+
+ * [r173]
+ [lcd4linux @ 2002-12-05 19:23:01 by reinelt]
+ fixed undefined operations found by gcc3
+
+ * [r172]
+ [lcd4linux @ 2002-12-05 19:12:47 by reinelt]
+ sensors factor and offset patch from Petri Damsten
+ <petri.damsten@raketti.net>
+
+ * [r171]
+ [lcd4linux @ 2002-12-05 19:09:57 by reinelt]
+ patches for gcc-3.2
+
+2002-09-12 reinelt
+
+ * [r170]
+ [lcd4linux @ 2002-09-12 05:24:54 by reinelt]
+ code cleanup, character defining for bars
+
+2002-09-11 reinelt
+
+ * [r169]
+ [lcd4linux @ 2002-09-11 05:32:35 by reinelt]
+ changed to use new bar functions
+
+ * [r168]
+ [lcd4linux @ 2002-09-11 05:16:32 by reinelt]
+ added Cwlinux driver
+
+2002-08-30 reinelt
+
+ * [r167]
+ [lcd4linux @ 2002-08-30 03:54:01 by reinelt]
+ bug in curses driver fixed
+
+2002-08-22 reinelt
+
+ * [r166]
+ [lcd4linux @ 2002-08-22 05:51:36 by reinelt]
+ cosmetic changes
+
+2002-08-21 reinelt
+
+ * [r165]
+ [lcd4linux @ 2002-08-21 06:09:53 by reinelt]
+ some T6963 fixes, ndelay wrap
+
+2002-08-19 reinelt
+
+ * [r164]
+ [lcd4linux @ 2002-08-19 10:51:06 by reinelt]
+ M50530 driver using new generic bar functions
+
+ * [r163]
+ [lcd4linux @ 2002-08-19 09:43:43 by reinelt]
+ BeckmannEgle using new generic bar functions
+
+ * [r162]
+ [lcd4linux @ 2002-08-19 09:30:18 by reinelt]
+ MatrixOrbital uses generic bar funnctions
+
+ * [r161]
+ [lcd4linux @ 2002-08-19 09:11:34 by reinelt]
+ changed HD44780 to use generic bar functions
+
+ * [r160]
+ [lcd4linux @ 2002-08-19 07:52:19 by reinelt]
+ corrected type declaration of (*defchar)()
+
+ * [r159]
+ [lcd4linux @ 2002-08-19 07:36:29 by reinelt]
+ finished bar.c, USBLCD is the first driver that uses the generic
+ bar functions
+
+ * [r158]
+ [lcd4linux @ 2002-08-19 04:41:20 by reinelt]
+ introduced bar.c, moved bar stuff from display.h to bar.h
+
+2002-08-18 reinelt
+
+ * [r157]
+ [lcd4linux @ 2002-08-18 08:11:11 by reinelt]
+ USBLCD buffered I/O
+
+2002-08-17 reinelt
+
+ * [r156]
+ [lcd4linux @ 2002-08-17 14:14:21 by reinelt]
+ USBLCD fixes
+
+ * [r155]
+ [lcd4linux @ 2002-08-17 13:10:22 by reinelt]
+ USBLCD driver added
+
+ * [r154]
+ [lcd4linux @ 2002-08-17 12:54:08 by reinelt]
+ minor T6963 changes
+
+2002-04-30 reinelt
+
+ * [r153]
+ [lcd4linux @ 2002-04-30 07:20:15 by reinelt]
+ implemented the new ndelay(nanoseconds) in all parallel port
+ drivers
+
+2002-04-29 reinelt
+
+ * [r152]
+ [lcd4linux @ 2002-04-29 11:00:25 by reinelt]
+ added Toshiba T6963 driver
+ added ndelay() with nanosecond resolution
+
+2001-09-14 reinelt
+
+ * [r151]
+ [lcd4linux @ 2001-09-14 05:57:06 by reinelt]
+
+2001-09-13 reinelt
+
+ * [r150]
+ [lcd4linux @ 2001-09-13 07:40:57 by reinelt]
+ TODO update
+
+2001-09-12 reinelt
+
+ * [r149]
+ [lcd4linux @ 2001-09-12 06:17:22 by reinelt]
+
+ * [r148]
+ [lcd4linux @ 2001-09-12 05:58:16 by reinelt]
+ fixed bug in mail2.c
+
+ * [r147]
+ [lcd4linux @ 2001-09-12 05:37:22 by reinelt]
+ fixed a bug in seti.c (file was never closed, lcd4linux run out
+ of fd's
+
+ improved socket debugging
+
+2001-09-11 reinelt
+
+ * [r146]
+ [lcd4linux @ 2001-09-11 06:43:43 by reinelt]
+ TODO items
+
+ * [r145]
+ [lcd4linux @ 2001-09-11 05:31:37 by reinelt]
+ M50530 driver
+
+2001-09-10 reinelt
+
+ * [r144]
+ [lcd4linux @ 2001-09-10 13:55:53 by reinelt]
+ M50530 driver
+
+2001-09-09 reinelt
+
+ * [r143]
+ [lcd4linux @ 2001-09-09 12:26:03 by reinelt]
+ GPO bug: INIT is _not_ inverted
+
+2001-09-07 reinelt
+
+ * [r142]
+ [lcd4linux @ 2001-09-07 05:58:44 by reinelt]
+ wrong Pin numbers
+
+2001-09-05 reinelt
+
+ * [r141]
+ [lcd4linux @ 2001-09-05 09:38:52 by reinelt]
+
+2001-08-08 reinelt
+
+ * [r140]
+ [lcd4linux @ 2001-08-08 05:40:24 by reinelt]
+ renamed CLK_TCK to CLOCKS_PER_SEC
+
+2001-08-05 reinelt
+
+ * [r139]
+ [lcd4linux @ 2001-08-05 17:13:29 by reinelt]
+ cleaned up inlude of sys/time.h and time.h
+
+2001-06-04 reinelt
+
+ * [r138]
+ [lcd4linux @ 2001-06-04 07:49:58 by reinelt]
+ configure for X11 modified
+
+2001-05-31 ltoetsch
+
+ * [r137]
+ [lcd4linux @ 2001-05-31 10:26:41 by ltoetsch]
+ added tests for X and ncurses
+
+2001-05-27 reinelt
+
+ * [r136]
+ [lcd4linux @ 2001-05-27 17:32:35 by reinelt]
+ updated README with the seti@home client stuff
+
+ * [r135]
+ [lcd4linux @ 2001-05-27 07:19:28 by reinelt]
+ fixed a warning in pixmap.c
+ temporarily fixed a bug in isdn.c (ISDN_MAX_CHANNELS is no longer
+ defined?)
+ fixed a bug in configure.in (--with-drivers=xyz did not work)
+
+2001-05-26 reinelt
+
+ * [r134]
+ [lcd4linux @ 2001-05-26 06:51:28 by reinelt]
+ added TODO entry
+
+2001-05-06 reinelt
+
+ * [r133]
+ [lcd4linux @ 2001-05-06 10:01:27 by reinelt]
+ fixed a bug which prevented extendet tokens to be used for GPO's
+ many thanks to Carsten Nau!
+
+2001-04-27 reinelt
+
+ * [r132]
+ [lcd4linux @ 2001-04-27 05:04:57 by reinelt]
+ replaced OPEN_MAX with sysconf()
+ replaced mktemp() with mkstemp()
+ unlock serial port if open() fails
+
+2001-03-24 reinelt
+
+ * [r131]
+ [lcd4linux @ 2001-03-24 09:26:25 by reinelt]
+ new TODO item
+
+ * [r130]
+ [lcd4linux @ 2001-03-24 09:04:19 by reinelt]
+ new TODO item
+
+2001-03-17 ltoetsch
+
+ * [r129]
+ [lcd4linux @ 2001-03-17 11:44:10 by ltoetsch]
+ allow more then 1 BAR_T
+
+ * [r128]
+ [lcd4linux @ 2001-03-17 11:11:31 by ltoetsch]
+ bugfix: max for BAR_T
+
+2001-03-16 ltoetsch
+
+ * [r127]
+ [lcd4linux @ 2001-03-16 16:40:17 by ltoetsch]
+ implemented time bar
+
+ * [r126]
+ [lcd4linux @ 2001-03-16 09:28:08 by ltoetsch]
+ bugfixes
+
+2001-03-15 ltoetsch
+
+ * [r125]
+ [lcd4linux @ 2001-03-15 15:49:22 by ltoetsch]
+ fixed compile HD44780.c, cosmetics
+
+ * [r124]
+ [lcd4linux @ 2001-03-15 14:25:05 by ltoetsch]
+ added unread/total news
+
+ * [r123]
+ [lcd4linux @ 2001-03-15 11:10:53 by ltoetsch]
+ added quit/logout to pop/imap
+
+2001-03-15 reinelt
+
+ * [r122]
+ [lcd4linux @ 2001-03-15 09:47:13 by reinelt]
+ some fixes to ppdef
+ off-by-one bug in processor.c fixed
+
+2001-03-15 ltoetsch
+
+ * [r121]
+ [lcd4linux @ 2001-03-15 09:13:22 by ltoetsch]
+ delay first exec for faster start
+
+2001-03-14 reinelt
+
+ * [r120]
+ [lcd4linux @ 2001-03-14 16:47:41 by reinelt]
+ minor cleanups
+
+ * [r119]
+ [lcd4linux @ 2001-03-14 15:30:53 by reinelt]
+ make ppdev compatible to earlier kernels
+
+ * [r118]
+ [lcd4linux @ 2001-03-14 15:14:59 by reinelt]
+ added ppdev parallel port access
+
+2001-03-14 ltoetsch
+
+ * [r117]
+ [lcd4linux @ 2001-03-14 13:19:29 by ltoetsch]
+ Added pop3/imap4 mail support
+
+2001-03-13 reinelt
+
+ * [r116]
+ [lcd4linux @ 2001-03-13 08:34:15 by reinelt]
+ corrected a off-by-one bug with sensors
+
+ * [r115]
+ [lcd4linux @ 2001-03-13 08:03:41 by reinelt]
+ added missing autoheader files
+
+ * [r114]
+ [lcd4linux @ 2001-03-13 07:53:00 by reinelt]
+ added several files for the distribution
+
+ * [r113]
+ [lcd4linux @ 2001-03-13 07:41:22 by reinelt]
+ added NEWS file
+
+2001-03-12 reinelt
+
+ * [r112]
+ [lcd4linux @ 2001-03-12 13:44:58 by reinelt]
+ new udelay() using Time Stamp Counters
+
+ * [r111]
+ [lcd4linux @ 2001-03-12 12:49:24 by reinelt]
+ even better configure handling...
+
+ * [r110]
+ [lcd4linux @ 2001-03-12 12:39:36 by reinelt]
+ reworked autoconf a lot: drivers may be excluded, #define's went
+ to config.h
+
+2001-03-09 ltoetsch
+
+ * [r109]
+ [lcd4linux @ 2001-03-09 16:24:30 by ltoetsch]
+ disable driver in configure
+
+2001-03-09 reinelt
+
+ * [r108]
+ [lcd4linux @ 2001-03-09 15:04:53 by reinelt]
+ rename 'raster' to 'Text in Text.c
+ added TOTO item
+
+ * [r107]
+ [lcd4linux @ 2001-03-09 14:30:01 by reinelt]
+ new ideas for TODO
+
+2001-03-09 ltoetsch
+
+ * [r106]
+ [lcd4linux @ 2001-03-09 14:24:49 by ltoetsch]
+ exec: Scale_x ->Min/Max_x
+
+ * [r105]
+ [lcd4linux @ 2001-03-09 13:08:11 by ltoetsch]
+ Added Text driver
+
+2001-03-09 reinelt
+
+ * [r104]
+ [lcd4linux @ 2001-03-09 12:14:24 by reinelt]
+ minor cleanups
+
+2001-03-08 ltoetsch
+
+ * [r103]
+ [lcd4linux @ 2001-03-08 15:25:38 by ltoetsch]
+ improved exec
+
+2001-03-08 reinelt
+
+ * [r102]
+ [lcd4linux @ 2001-03-08 09:02:04 by reinelt]
+ seti client cleanup
+
+ * [r101]
+ [lcd4linux @ 2001-03-08 08:39:54 by reinelt]
+ fixed two typos
+
+2001-03-07 ltoetsch
+
+ * [r100]
+ [lcd4linux @ 2001-03-07 18:10:21 by ltoetsch]
+ added e(x)ec commands
+
+2001-03-05 reinelt
+
+ * [r99]
+ [lcd4linux @ 2001-03-05 18:20:21 by reinelt]
+ TOTO list update
+
+2001-03-04 ltoetsch
+
+ * [r98]
+ [lcd4linux @ 2001-03-04 15:01:12 by ltoetsch]
+ Added PNG
+
+2001-03-02 reinelt
+
+ * [r97]
+ [lcd4linux @ 2001-03-02 20:18:12 by reinelt]
+ allow compile on systems without net/if_ppp.h
+
+ * [r96]
+ [lcd4linux @ 2001-03-02 18:06:18 by reinelt]
+ README for PNG added
+
+ * [r95]
+ [lcd4linux @ 2001-03-02 17:18:52 by reinelt]
+ let configure find gd.h
+
+ * [r94]
+ [lcd4linux @ 2001-03-02 11:04:08 by reinelt]
+ cosmetic cleanups (comment headers)
+
+2001-03-02 ltoetsch
+
+ * [r93]
+ [lcd4linux @ 2001-03-02 10:18:03 by ltoetsch]
+ added /proc/apm battery stat
+
+2001-03-01 reinelt
+
+ * [r92]
+ [lcd4linux @ 2001-03-01 22:33:50 by reinelt]
+ renamed Raster_flush() to PPM_flush()
+
+2001-03-01 ltoetsch
+
+ * [r91]
+ [lcd4linux @ 2001-03-01 15:11:30 by ltoetsch]
+ added PNG,Webinterface
+
+2001-03-01 reinelt
+
+ * [r90]
+ [lcd4linux @ 2001-03-01 11:08:16 by reinelt]
+ reworked configure to allow selection of drivers
+
+2001-02-26 herp
+
+ * [r89]
+ [lcd4linux @ 2001-02-26 00:33:37 by herp]
+ fixed X11 signal handler
+
+2001-02-21 reinelt
+
+ * [r88]
+ [lcd4linux @ 2001-02-21 04:48:13 by reinelt]
+ big mailbox patch from Axel Ehnert
+ thanks to herp for his idea to check mtime of mailbox
+
+2001-02-19 reinelt
+
+ * [r87]
+ [lcd4linux @ 2001-02-19 00:15:46 by reinelt]
+ integrated mail and seti client
+ major rewrite of parser and tokenizer to support double-byte
+ tokens
+
+2001-02-18 reinelt
+
+ * [r86]
+ [lcd4linux @ 2001-02-18 22:11:34 by reinelt]
+
+ * [r85]
+ [lcd4linux @ 2001-02-18 21:16:06 by reinelt]
+
+ * [r84]
+ [lcd4linux @ 2001-02-18 21:15:15 by reinelt]
+ added setiathome client
+
+ * [r83]
+ [lcd4linux @ 2001-02-18 20:16:13 by reinelt]
+
+2001-02-16 reinelt
+
+ * [r82]
+ [lcd4linux @ 2001-02-16 14:15:11 by reinelt]
+ fixed type in processor.c
+ GPO documentation update from Carsten
+
+ * [r81]
+ [lcd4linux @ 2001-02-16 08:23:09 by reinelt]
+ new token 'ic' (ISDN connected) by Carsten Nau <info@cnau.de>
+
+2001-02-14 reinelt
+
+ * [r80]
+ [lcd4linux @ 2001-02-14 07:40:16 by reinelt]
+ first (incomplete) GPO implementation
+
+ * [r79]
+ [lcd4linux @ 2001-02-14 05:22:42 by reinelt]
+ added README from Carsten Nau
+
+2001-02-13 reinelt
+
+ * [r78]
+ [lcd4linux @ 2001-02-13 12:43:24 by reinelt]
+ HD_gpo() was missing
+
+ * [r77]
+ [lcd4linux @ 2001-02-13 09:00:13 by reinelt]
+ prepared framework for GPO's (general purpose outputs)
+
+2001-02-11 reinelt
+
+ * [r76]
+ [lcd4linux @ 2001-02-11 23:34:07 by reinelt]
+ fixed a small bug where the throughput of an offline ISDN
+ connection is displayed as '----', but the
+ online value is 5 chars long. corrected to ' ----'.
+ thanks to Carsten Nau <info@cnau.de>
+
+2000-12-07 reinelt
+
+ * [r75]
+ [lcd4linux @ 2000-12-07 20:47:54 by reinelt]
+ first try for SIN bars
+
+2000-12-01 reinelt
+
+ * [r74]
+ [lcd4linux @ 2000-12-01 20:42:37 by reinelt]
+ added debugging of SIN driver output, probably found the
+ positioning bug (format %02x instead of %2x)
+
+ * [r73]
+ [lcd4linux @ 2000-12-01 07:20:26 by reinelt]
+ modified text positioning: row starts with 0, column is
+ hexadecimal
+
+2000-11-28 reinelt
+
+ * [r72]
+ [lcd4linux @ 2000-11-28 20:20:38 by reinelt]
+ added debug.c
+ things like that should not hapen. debug.c exists for a few
+ months now, but was never added to CVS. Shit happens....
+
+ * [r71]
+ [lcd4linux @ 2000-11-28 17:27:19 by reinelt]
+ changed decimal values for screen, row, column to ascii values
+ (shame on you!)
+
+ * [r70]
+ [lcd4linux @ 2000-11-28 16:46:11 by reinelt]
+ first try to support display of SIN router
+
+2000-11-17 reinelt
+
+ * [r69]
+ [lcd4linux @ 2000-11-17 10:36:23 by reinelt]
+ fixed parsing of /proc/net/dev for 2.0 kernels
+
+2000-10-25 reinelt
+
+ * [r68]
+ [lcd4linux @ 2000-10-25 08:10:48 by reinelt]
+ added restart funnctionality
+ (lots of this code was stolen from sendmail.c)
+
+2000-10-20 reinelt
+
+ * [r67]
+ [lcd4linux @ 2000-10-20 07:17:07 by reinelt]
+ corrected a bug in HD_goto()
+ Thanks to Gregor Szaktilla <gregor@szaktilla.de>
+
+2000-10-08 reinelt
+
+ * [r66]
+ [lcd4linux @ 2000-10-08 09:16:40 by reinelt]
+ Linux-2.4.0-test9 changed the layout of /proc/stat (especially
+ the disk_io line)
+ rearranged parsing of some /proc files and (hopefully) made it
+ more robust in concerns of format changes
+
+2000-08-10 reinelt
+
+ * [r65]
+ [lcd4linux @ 2000-08-10 18:42:20 by reinelt]
+ fixed some bugs with the new syslog code
+
+ * [r64]
+ [lcd4linux @ 2000-08-10 09:44:09 by reinelt]
+ new debugging scheme: error(), info(), debug()
+ uses syslog if in daemon mode
+
+2000-08-09 reinelt
+
+ * [r63]
+ [lcd4linux @ 2000-08-09 14:14:11 by reinelt]
+ new switch -F (do not fork)
+ added automatic forking if -F not specified
+
+ * [r62]
+ [lcd4linux @ 2000-08-09 11:03:07 by reinelt]
+ fixed a bug in system.c where the format of /proc/net/dev was not
+ correctly
+ detected and parsed with different kernels
+
+ * [r61]
+ [lcd4linux @ 2000-08-09 09:50:29 by reinelt]
+ opened 0.98 development
+ removed driver-specific signal-handlers
+ added 'quit'-function to driver structure
+ added global signal-handler
+
+2000-07-31 reinelt
+
+ * [r60]
+ [lcd4linux @ 2000-07-31 10:43:44 by reinelt]
+ some changes to support kernel-2.4 (different layout of various
+ files in /proc)
+
+ * [r59]
+ [lcd4linux @ 2000-07-31 06:46:35 by reinelt]
+ eliminated some compiler warnings with glibc
+
+2000-06-04 herp
+
+ * [r58]
+ [lcd4linux @ 2000-06-04 21:43:50 by herp]
+ minor bugfix (zero length)
+
+2000-05-21 reinelt
+
+ * [r57]
+ [lcd4linux @ 2000-05-21 06:20:35 by reinelt]
+ added ppp throughput
+ token is '%t[iomt]' at the moment, but this will change in the
+ near future
+
+2000-05-03 herp
+
+ * [r56]
+ [lcd4linux @ 2000-05-03 17:14:51 by herp]
+
+ * [r55]
+ [lcd4linux @ 2000-05-03 09:37:32 by herp]
+
+2000-05-02 herp
+
+ * [r54]
+ [lcd4linux @ 2000-05-02 23:07:48 by herp]
+ Crystalfontz initial coding
+
+2000-05-02 reinelt
+
+ * [r53]
+ [lcd4linux @ 2000-05-02 06:05:00 by reinelt]
+ driver for 3Com Palm Pilot added
+
+2000-04-30 reinelt
+
+ * [r52]
+ [lcd4linux @ 2000-04-30 06:40:42 by reinelt]
+ bars for Beckmann+Egle driver
+
+2000-04-28 reinelt
+
+ * [r51]
+ [lcd4linux @ 2000-04-28 05:19:55 by reinelt]
+ first release of the Beckmann+Egle driver
+
+2000-04-20 reinelt
+
+ * [r50]
+ [lcd4linux @ 2000-04-20 05:48:42 by reinelt]
+ added documentation to EXTRA_DIST so that they go into the
+ tarball
+
+2000-04-19 reinelt
+
+ * [r49]
+ [lcd4linux @ 2000-04-19 04:44:20 by reinelt]
+ README for HD44780 driver
+
+2000-04-17 reinelt
+
+ * [r48]
+ [lcd4linux @ 2000-04-17 05:14:27 by reinelt]
+ added README.44780
+
+2000-04-15 reinelt
+
+ * [r47]
+ [lcd4linux @ 2000-04-15 16:56:52 by reinelt]
+ moved delay loops to udelay.c
+ renamed -d (debugging) switch to -v (verbose)
+ new switch -d to calibrate delay loop
+ 'Delay' entry for HD44780 back again
+ delay loops will not calibrate automatically, because this will
+ fail with hich CPU load
+
+ * [r46]
+ [lcd4linux @ 2000-04-15 11:56:35 by reinelt]
+ more debug messages
+
+ * [r45]
+ [lcd4linux @ 2000-04-15 11:13:54 by reinelt]
+ added '-d' (debugging) switch
+ added several debugging messages
+ removed config entry 'Delay' for HD44780 driver
+ delay loop for HD44780 will be calibrated automatically
+
+2000-04-13 reinelt
+
+ * [r44]
+ [lcd4linux @ 2000-04-13 06:09:52 by reinelt]
+ added BogoMips() to system.c (not used by now, maybe sometimes we
+ can
+ calibrate our delay loop with this value)
+
+ added delay loop to HD44780 driver. It seems to be quite fast
+ now. Hopefully
+ no compiler will optimize away the delay loop!
+
+2000-04-12 reinelt
+
+ * [r43]
+ [lcd4linux @ 2000-04-12 08:05:45 by reinelt]
+ first version of the HD44780 driver
+
+2000-04-10 reinelt
+
+ * [r42]
+ [lcd4linux @ 2000-04-10 04:40:53 by reinelt]
+ minor changes and cleanups
+
+2000-04-07 reinelt
+
+ * [r41]
+ [lcd4linux @ 2000-04-07 05:42:20 by reinelt]
+ UUCP style lockfiles for the serial port
+
+2000-04-05 reinelt
+
+ * [r40]
+ [lcd4linux @ 2000-04-05 05:58:36 by reinelt]
+ fixed bug in XWindow.c: union semun isn't defined with glibc-2.1
+
+ * [r39]
+ [lcd4linux @ 2000-04-05 04:12:00 by reinelt]
+ TODO added
+
+2000-04-03 herp
+
+ * [r38]
+ [lcd4linux @ 2000-04-03 23:53:23 by herp]
+ fixed a bug that caused pixel-errors ("fliegendreck") under high
+ load
+
+2000-04-03 reinelt
+
+ * [r37]
+ [lcd4linux @ 2000-04-03 17:31:52 by reinelt]
+ suppress welcome message if display is smaller than 20x2
+ change lcd4linux.ppm to 32 pixel high so KDE won't stretch the
+ icon
+
+ * [r36]
+ [lcd4linux @ 2000-04-03 06:54:03 by reinelt]
+ KDE application link
+
+ * [r35]
+ [lcd4linux @ 2000-04-03 06:53:09 by reinelt]
+ releasing 0.96
+ annoying X11 bugs hopefully fixed
+ KDE integration
+
+ * [r34]
+ [lcd4linux @ 2000-04-03 04:46:38 by reinelt]
+ added '-c key=val' option
+
+ * [r33]
+ [lcd4linux @ 2000-04-03 04:01:31 by reinelt]
+ if 'gap' is specified as -1, a gap of (pixelsize+pixelgap) is
+ selected automatically
+
+2000-04-02 herp
+
+ * [r32]
+ [lcd4linux @ 2000-04-02 22:07:10 by herp]
+ fixded a bug that occasionally caused Xlib errors
+
+2000-04-01 herp
+
+ * [r31]
+ [lcd4linux @ 2000-04-01 22:40:42 by herp]
+ geometric correction (too many pixelgaps)
+ lcd4linux main should return int, not void
+
+ * [r30]
+ [lcd4linux @ 2000-04-01 19:33:45 by herp]
+ colors in format \#RRGGBB in config-file now understood
+
+2000-04-01 reinelt
+
+ * [r29]
+ [lcd4linux @ 2000-04-01 16:22:38 by reinelt]
+ bug that caused a segfault in processor.c fixed (thanks to herp)
+
+2000-03-31 reinelt
+
+ * [r28]
+ [lcd4linux @ 2000-03-31 04:41:22 by reinelt]
+ X11 driver: semaphore bug fixed
+
+2000-03-30 reinelt
+
+ * [r27]
+ [lcd4linux @ 2000-03-30 16:46:57 by reinelt]
+ configure now handles '--with-x' and '--without-x' correct
+
+2000-03-28 reinelt
+
+ * [r26]
+ [lcd4linux @ 2000-03-28 08:48:33 by reinelt]
+ README.X11 added
+
+ * [r25]
+ [lcd4linux @ 2000-03-28 07:22:15 by reinelt]
+ version 0.95 released
+ X11 driver up and running
+ minor bugs fixed
+
+2000-03-26 reinelt
+
+ * [r24]
+ [lcd4linux @ 2000-03-26 20:00:44 by reinelt]
+ README.Raster added
+
+ * [r23]
+ [lcd4linux @ 2000-03-26 19:03:52 by reinelt]
+ more Pixmap renaming
+ quoting of '#' in config file
+
+ * [r22]
+ [lcd4linux @ 2000-03-26 18:46:28 by reinelt]
+ bug in pixmap.c that leaded to empty bars fixed
+ name conflicts with X11 resolved
+
+ * [r21]
+ [lcd4linux @ 2000-03-26 12:55:03 by reinelt]
+ enhancements to the PPM driver
+
+2000-03-25 reinelt
+
+ * [r20]
+ [lcd4linux @ 2000-03-25 05:50:43 by reinelt]
+ memory leak in Raster_flush closed
+ driver family logic changed
+
+2000-03-24 reinelt
+
+ * [r19]
+ [lcd4linux @ 2000-03-24 11:37:43 by reinelt]
+ fontmap.h added
+
+ * [r18]
+ [lcd4linux @ 2000-03-24 11:36:56 by reinelt]
+ new syntax for raster configuration
+ changed XRES and YRES to be configurable
+ PPM driver works nice
+
+2000-03-23 reinelt
+
+ * [r17]
+ [lcd4linux @ 2000-03-23 07:24:48 by reinelt]
+ PPM driver up and running (but slow!)
+
+2000-03-22 reinelt
+
+ * [r16]
+ [lcd4linux @ 2000-03-22 15:36:21 by reinelt]
+ added '-l' switch (list drivers)
+ generic pixmap driver added
+ X11 Framework done
+
+ * [r15]
+ [lcd4linux @ 2000-03-22 07:33:50 by reinelt]
+ FAQ added
+ new modules 'processor.c' contains all data processing
+
+2000-03-19 reinelt
+
+ * [r14]
+ [lcd4linux @ 2000-03-19 08:41:28 by reinelt]
+ documentation available! README, README.MatrixOrbital,
+ README.Drivers
+ added Skeleton.c as a starting point for new drivers
+
+2000-03-18 reinelt
+
+ * [r13]
+ [lcd4linux @ 2000-03-18 10:31:06 by reinelt]
+ added sensor handling (for temperature etc.)
+ made data collecting happen only if data is used
+ (reading /proc/meminfo takes a lot of CPU!)
+ released lcd4linux-0.92
+
+ * [r12]
+ [lcd4linux @ 2000-03-18 08:07:04 by reinelt]
+ vertical bars implemented
+ bar compaction improved
+ memory information implemented
+
+2000-03-17 reinelt
+
+ * [r11]
+ [lcd4linux @ 2000-03-17 09:21:42 by reinelt]
+ various memory statistics added
+
+2000-03-13 reinelt
+
+ * [r10]
+ [lcd4linux @ 2000-03-13 15:58:24 by reinelt]
+ release 0.9
+ moved row parsing to parser.c
+ all basic work finished
+
+2000-03-10 reinelt
+
+ * [r9]
+ [lcd4linux @ 2000-03-10 17:36:02 by reinelt]
+ first unstable but running release
+
+ * [r8]
+ [lcd4linux @ 2000-03-10 12:02:43 by reinelt]
+ autoconf/automake
+
+ * [r7]
+ [lcd4linux @ 2000-03-10 11:40:47 by reinelt]
+
+ * [r6]
+ [lcd4linux @ 2000-03-10 10:49:53 by reinelt]
+ MatrixOrbital driver finished
+
+2000-03-07 reinelt
+
+ * [r5]
+ [lcd4linux @ 2000-03-07 11:01:34 by reinelt]
+ system.c cleanup
+
+2000-03-06 reinelt
+
+ * [r4]
+ [lcd4linux @ 2000-03-06 06:04:06 by reinelt]
+ minor cleanups
+
+2000-01-16 reinelt
+
+ * [r3]
+ [lcd4linux @ 2000-01-16 16:58:50 by reinelt]
+
+ * [r2]
+ [lcd4linux @ 2000-01-16 12:17:59 by reinelt]
+ Initial revision
+
+2000-01-16 root
+
+ * [r1]
+ initial import
+
diff --git a/CodingStyle b/CodingStyle
new file mode 100644
index 0000000..c59d91e
--- /dev/null
+++ b/CodingStyle
@@ -0,0 +1,25 @@
+$Id: CodingStyle 730 2007-01-14 13:50:28Z michael $
+$URL: https://ssl.bulix.org/svn/lcd4linux/trunk/CodingStyle $
+
+
+LCD4Linux Coding Style
+
+We decided to use a common coding style to make patches and diffs
+easier to read and apply.
+
+The style we use is based on Kernighan & Ritchie and the coding style
+of the linux kernel (see /usr/src/linux/Documentation/CodingStyle),
+with some differences:
+
+- we use a indentation level of 4 spaces (Linus prefers 8)
+- we allow lines up to 150 chars (Linus uses 80)
+
+The resulting indent command is:
+indent -kr -l150
+
+There's a script called 'indent.sh' that comes with the LCD4Linux
+source package; all it does is call indent with all .c and .h files.
+
+It is always a good idea to call 'indent.sh' before any SVN operation,
+this ensures that diffs and updates won't get mixed up because of
+cosmetic changes.
diff --git a/INSTALL b/INSTALL
new file mode 100644
index 0000000..d3c5b40
--- /dev/null
+++ b/INSTALL
@@ -0,0 +1,237 @@
+Installation Instructions
+*************************
+
+Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
+2006, 2007 Free Software Foundation, Inc.
+
+This file is free documentation; the Free Software Foundation gives
+unlimited permission to copy, distribute and modify it.
+
+Basic Installation
+==================
+
+Briefly, the shell commands `./configure; make; make install' should
+configure, build, and install this package. The following
+more-detailed instructions are generic; see the `README' file for
+instructions specific to this package.
+
+ The `configure' shell script attempts to guess correct values for
+various system-dependent variables used during compilation. It uses
+those values to create a `Makefile' in each directory of the package.
+It may also create one or more `.h' files containing system-dependent
+definitions. Finally, it creates a shell script `config.status' that
+you can run in the future to recreate the current configuration, and a
+file `config.log' containing compiler output (useful mainly for
+debugging `configure').
+
+ It can also use an optional file (typically called `config.cache'
+and enabled with `--cache-file=config.cache' or simply `-C') that saves
+the results of its tests to speed up reconfiguring. Caching is
+disabled by default to prevent problems with accidental use of stale
+cache files.
+
+ If you need to do unusual things to compile the package, please try
+to figure out how `configure' could check whether to do them, and mail
+diffs or instructions to the address given in the `README' so they can
+be considered for the next release. If you are using the cache, and at
+some point `config.cache' contains results you don't want to keep, you
+may remove or edit it.
+
+ The file `configure.ac' (or `configure.in') is used to create
+`configure' by a program called `autoconf'. You need `configure.ac' if
+you want to change it or regenerate `configure' using a newer version
+of `autoconf'.
+
+The simplest way to compile this package is:
+
+ 1. `cd' to the directory containing the package's source code and type
+ `./configure' to configure the package for your system.
+
+ Running `configure' might take a while. While running, it prints
+ some messages telling which features it is checking for.
+
+ 2. Type `make' to compile the package.
+
+ 3. Optionally, type `make check' to run any self-tests that come with
+ the package.
+
+ 4. Type `make install' to install the programs and any data files and
+ documentation.
+
+ 5. You can remove the program binaries and object files from the
+ source code directory by typing `make clean'. To also remove the
+ files that `configure' created (so you can compile the package for
+ a different kind of computer), type `make distclean'. There is
+ also a `make maintainer-clean' target, but that is intended mainly
+ for the package's developers. If you use it, you may have to get
+ all sorts of other programs in order to regenerate files that came
+ with the distribution.
+
+ 6. Often, you can also type `make uninstall' to remove the installed
+ files again.
+
+Compilers and Options
+=====================
+
+Some systems require unusual options for compilation or linking that the
+`configure' script does not know about. Run `./configure --help' for
+details on some of the pertinent environment variables.
+
+ You can give `configure' initial values for configuration parameters
+by setting variables in the command line or in the environment. Here
+is an example:
+
+ ./configure CC=c99 CFLAGS=-g LIBS=-lposix
+
+ *Note Defining Variables::, for more details.
+
+Compiling For Multiple Architectures
+====================================
+
+You can compile the package for more than one kind of computer at the
+same time, by placing the object files for each architecture in their
+own directory. To do this, you can use GNU `make'. `cd' to the
+directory where you want the object files and executables to go and run
+the `configure' script. `configure' automatically checks for the
+source code in the directory that `configure' is in and in `..'.
+
+ With a non-GNU `make', it is safer to compile the package for one
+architecture at a time in the source code directory. After you have
+installed the package for one architecture, use `make distclean' before
+reconfiguring for another architecture.
+
+Installation Names
+==================
+
+By default, `make install' installs the package's commands under
+`/usr/local/bin', include files under `/usr/local/include', etc. You
+can specify an installation prefix other than `/usr/local' by giving
+`configure' the option `--prefix=PREFIX'.
+
+ You can specify separate installation prefixes for
+architecture-specific files and architecture-independent files. If you
+pass the option `--exec-prefix=PREFIX' to `configure', the package uses
+PREFIX as the prefix for installing programs and libraries.
+Documentation and other data files still use the regular prefix.
+
+ In addition, if you use an unusual directory layout you can give
+options like `--bindir=DIR' to specify different values for particular
+kinds of files. Run `configure --help' for a list of the directories
+you can set and what kinds of files go in them.
+
+ If the package supports it, you can cause programs to be installed
+with an extra prefix or suffix on their names by giving `configure' the
+option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
+
+Optional Features
+=================
+
+Some packages pay attention to `--enable-FEATURE' options to
+`configure', where FEATURE indicates an optional part of the package.
+They may also pay attention to `--with-PACKAGE' options, where PACKAGE
+is something like `gnu-as' or `x' (for the X Window System). The
+`README' should mention any `--enable-' and `--with-' options that the
+package recognizes.
+
+ For packages that use the X Window System, `configure' can usually
+find the X include and library files automatically, but if it doesn't,
+you can use the `configure' options `--x-includes=DIR' and
+`--x-libraries=DIR' to specify their locations.
+
+Specifying the System Type
+==========================
+
+There may be some features `configure' cannot figure out automatically,
+but needs to determine by the type of machine the package will run on.
+Usually, assuming the package is built to be run on the _same_
+architectures, `configure' can figure that out, but if it prints a
+message saying it cannot guess the machine type, give it the
+`--build=TYPE' option. TYPE can either be a short name for the system
+type, such as `sun4', or a canonical name which has the form:
+
+ CPU-COMPANY-SYSTEM
+
+where SYSTEM can have one of these forms:
+
+ OS KERNEL-OS
+
+ See the file `config.sub' for the possible values of each field. If
+`config.sub' isn't included in this package, then this package doesn't
+need to know the machine type.
+
+ If you are _building_ compiler tools for cross-compiling, you should
+use the option `--target=TYPE' to select the type of system they will
+produce code for.
+
+ If you want to _use_ a cross compiler, that generates code for a
+platform different from the build platform, you should specify the
+"host" platform (i.e., that on which the generated programs will
+eventually be run) with `--host=TYPE'.
+
+Sharing Defaults
+================
+
+If you want to set default values for `configure' scripts to share, you
+can create a site shell script called `config.site' that gives default
+values for variables like `CC', `cache_file', and `prefix'.
+`configure' looks for `PREFIX/share/config.site' if it exists, then
+`PREFIX/etc/config.site' if it exists. Or, you can set the
+`CONFIG_SITE' environment variable to the location of the site script.
+A warning: not all `configure' scripts look for a site script.
+
+Defining Variables
+==================
+
+Variables not defined in a site shell script can be set in the
+environment passed to `configure'. However, some packages may run
+configure again during the build, and the customized values of these
+variables may be lost. In order to avoid this problem, you should set
+them in the `configure' command line, using `VAR=value'. For example:
+
+ ./configure CC=/usr/local2/bin/gcc
+
+causes the specified `gcc' to be used as the C compiler (unless it is
+overridden in the site shell script).
+
+Unfortunately, this technique does not work for `CONFIG_SHELL' due to
+an Autoconf bug. Until the bug is fixed you can use this workaround:
+
+ CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
+
+`configure' Invocation
+======================
+
+`configure' recognizes the following options to control how it operates.
+
+`--help'
+`-h'
+ Print a summary of the options to `configure', and exit.
+
+`--version'
+`-V'
+ Print the version of Autoconf used to generate the `configure'
+ script, and exit.
+
+`--cache-file=FILE'
+ Enable the cache: use and save the results of the tests in FILE,
+ traditionally `config.cache'. FILE defaults to `/dev/null' to
+ disable caching.
+
+`--config-cache'
+`-C'
+ Alias for `--cache-file=config.cache'.
+
+`--quiet'
+`--silent'
+`-q'
+ Do not print messages saying which checks are being made. To
+ suppress all normal output, redirect it to `/dev/null' (any error
+ messages will still be shown).
+
+`--srcdir=DIR'
+ Look for the package's source code in directory DIR. Usually
+ `configure' can determine that directory automatically.
+
+`configure' also accepts some other, not widely useful, options. Run
+`configure --help' for more details.
+
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 0000000..0f9c9db
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,201 @@
+# $Id: Makefile.am 1195 2013-02-19 23:17:43Z volker $
+# $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/Makefile.am $
+
+# Process this file with automake to produce Makefile.in
+
+AUTOMAKE_OPTIONS = gnu
+CLEANFILES = *~
+DRIVERS=@DRIVERS@
+PLUGINS=@PLUGINS@
+
+bin_PROGRAMS = lcd4linux
+
+# Fixme: -W should be renamed to -Wextra someday...
+AM_CFLAGS = -D_GNU_SOURCE -Wall -Wextra -fno-strict-aliasing
+
+LIBTOOL=libtool
+ACLOCAL_AMFLAGS=-I m4
+# use this for lots of warnings
+#AM_CFLAGS = -D_GNU_SOURCE -std=c99 -m64 -Wall -W -pedantic -Wno-variadic-macros -fno-strict-aliasing
+
+lcd4linux_LDFLAGS ="-Wl,--as-needed"
+lcd4linux_LDADD = @DRIVERS@ @PLUGINS@ @DRVLIBS@ @PLUGINLIBS@
+lcd4linux_DEPENDENCIES = @DRIVERS@ @PLUGINS@
+
+lcd4linux_SOURCES = \
+lcd4linux.c svn_version.h \
+cfg.c cfg.h \
+debug.c debug.h \
+drv.c drv.h \
+drv_generic.c drv_generic.h \
+evaluator.c evaluator.h \
+property.c property.h \
+hash.c hash.h \
+layout.c layout.h \
+pid.c pid.h \
+timer.c timer.h \
+timer_group.c timer_group.h \
+thread.c thread.h \
+udelay.c udelay.h \
+qprintf.c qprintf.h \
+rgb.c rgb.h \
+event.c event.h \
+ \
+widget.c widget.h \
+widget_text.c widget_text.h \
+widget_bar.c widget_bar.h \
+widget_icon.c widget_icon.h \
+widget_keypad.c widget_keypad.h \
+widget_timer.c widget_timer.h \
+widget_gpo.c widget_gpo.h \
+ \
+plugin.c plugin.h \
+plugin_cfg.c \
+plugin_math.c \
+plugin_string.c \
+plugin_test.c \
+plugin_time.c
+
+EXTRA_lcd4linux_SOURCES= \
+drv_generic_text.c \
+drv_generic_text.h \
+drv_generic_graphic.c \
+drv_generic_graphic.h \
+drv_generic_gpio.c \
+drv_generic_gpio.h \
+drv_generic_serial.c \
+drv_generic_serial.h \
+drv_generic_parport.c \
+drv_generic_parport.h \
+drv_generic_i2c.c \
+drv_generic_i2c.h \
+drv_generic_keypad.c \
+drv_generic_keypad.h \
+drv_ASTUSB.c \
+drv_BeckmannEgle.c \
+drv_BWCT.c \
+drv_Crystalfontz.c \
+drv_Curses.c \
+drv_Cwlinux.c \
+drv_D4D.c \
+drv_dpf.c \
+drv_EA232graphic.c \
+drv_EFN.c \
+drv_FutabaVFD.c \
+drv_FW8888.c \
+drv_G15.c \
+drv_GLCD2USB.c glcd2usb.h \
+drv_HD44780.c \
+drv_Image.c \
+drv_IRLCD.c \
+drv_LCD2USB.c \
+drv_LCDLinux.c \
+drv_LCDTerm.c \
+drv_LEDMatrix.c \
+drv_LPH7508.c \
+drv_LUIse.c \
+drv_LW_ABP.c \
+drv_M50530.c \
+drv_MatrixOrbital.c \
+drv_MatrixOrbitalGX.c \
+drv_mdm166a.c \
+drv_MilfordInstruments.c \
+drv_Newhaven.c \
+drv_Noritake.c \
+drv_NULL.c \
+drv_Pertelian.c \
+drv_PHAnderson.c \
+drv_PICGraphic.c \
+drv_picoLCD.c \
+drv_picoLCDGraphic.c \
+drv_RouterBoard.c \
+drv_Sample.c \
+drv_SamsungSPF.c \
+drv_st2205.c \
+drv_serdisplib.c \
+drv_ShuttleVFD.c \
+drv_SimpleLCD.c \
+drv_T6963.c \
+drv_TeakLCM.c \
+drv_Trefon.c \
+drv_ula200.c \
+drv_USBHUB.c \
+drv_USBLCD.c \
+drv_vnc.c \
+drv_WincorNixdorf.c \
+drv_X11.c \
+ \
+font_6x8.h \
+font_6x8_bold.h \
+widget_image.c widget_image.h \
+ \
+lcd4linux_i2c.h \
+ \
+plugin_apm.c \
+plugin_asterisk.c \
+plugin_button_exec.c \
+plugin_cpuinfo.c \
+plugin_dbus.c \
+plugin_diskstats.c \
+plugin_dvb.c \
+plugin_exec.c \
+plugin_fifo.c \
+plugin_file.c \
+plugin_gps.c \
+plugin_hddtemp.c \
+plugin_huawei.c \
+plugin_i2c_sensors.c \
+plugin_iconv.c \
+plugin_imon.c \
+plugin_isdn.c \
+plugin_kvv.c \
+plugin_loadavg.c \
+plugin_meminfo.c \
+plugin_mpd.c \
+plugin_mpris_dbus.c \
+plugin_mysql.c \
+plugin_netdev.c \
+plugin_netinfo.c \
+plugin_pop3.c \
+plugin_ppp.c \
+plugin_proc_stat.c \
+plugin_python.c \
+plugin_qnaplog.c \
+plugin_raspi.c \
+plugin_sample.c \
+plugin_seti.c \
+plugin_statfs.c \
+plugin_uname.c \
+plugin_uptime.c \
+plugin_w1retap.c \
+plugin_wireless.c \
+plugin_xmms.c
+
+
+EXTRA_DIST = \
+svn_version.sh \
+lcd4linux.conf.sample \
+lcd4kde.conf \
+lcd4linux.kdelnk \
+lcd4linux.xpm \
+lcd4linux.lsm \
+ax_python_devel.m4 \
+curses.m4 \
+drivers.m4 \
+plugins.m4 \
+AUTHORS \
+CREDITS \
+NEWS \
+TODO \
+README \
+plugin_sample.c
+
+
+
+# create subversion version
+
+.PHONY: svn_version
+
+svn_version:
+ svn_version.sh
+
diff --git a/Makefile.in b/Makefile.in
new file mode 100644
index 0000000..756f361
--- /dev/null
+++ b/Makefile.in
@@ -0,0 +1,1166 @@
+# Makefile.in generated by automake 1.14.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2013 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# $Id: Makefile.in 1201 2014-09-06 02:44:21Z michael $
+# $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/Makefile.in $
+
+# Process this file with automake to produce Makefile.in
+
+VPATH = @srcdir@
+am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
+ esac; \
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
+ esac; \
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
+ esac; \
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+bin_PROGRAMS = lcd4linux$(EXEEXT)
+subdir = .
+DIST_COMMON = INSTALL NEWS README AUTHORS ChangeLog \
+ $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
+ $(top_srcdir)/configure $(am__configure_deps) \
+ $(srcdir)/config.h.in mkinstalldirs depcomp COPYING TODO \
+ compile config.guess config.rpath config.sub install-sh \
+ missing ltmain.sh
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
+ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
+ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
+ $(top_srcdir)/curses.m4 $(top_srcdir)/ax_python_devel.m4 \
+ $(top_srcdir)/drivers.m4 $(top_srcdir)/plugins.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
+ configure.lineno config.status.lineno
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)"
+PROGRAMS = $(bin_PROGRAMS)
+am_lcd4linux_OBJECTS = lcd4linux.$(OBJEXT) cfg.$(OBJEXT) \
+ debug.$(OBJEXT) drv.$(OBJEXT) drv_generic.$(OBJEXT) \
+ evaluator.$(OBJEXT) property.$(OBJEXT) hash.$(OBJEXT) \
+ layout.$(OBJEXT) pid.$(OBJEXT) timer.$(OBJEXT) \
+ timer_group.$(OBJEXT) thread.$(OBJEXT) udelay.$(OBJEXT) \
+ qprintf.$(OBJEXT) rgb.$(OBJEXT) event.$(OBJEXT) \
+ widget.$(OBJEXT) widget_text.$(OBJEXT) widget_bar.$(OBJEXT) \
+ widget_icon.$(OBJEXT) widget_keypad.$(OBJEXT) \
+ widget_timer.$(OBJEXT) widget_gpo.$(OBJEXT) plugin.$(OBJEXT) \
+ plugin_cfg.$(OBJEXT) plugin_math.$(OBJEXT) \
+ plugin_string.$(OBJEXT) plugin_test.$(OBJEXT) \
+ plugin_time.$(OBJEXT)
+lcd4linux_OBJECTS = $(am_lcd4linux_OBJECTS)
+AM_V_lt = $(am__v_lt_@AM_V@)
+am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
+am__v_lt_0 = --silent
+am__v_lt_1 =
+lcd4linux_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(lcd4linux_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 =
+DEFAULT_INCLUDES = -I.@am__isrc@
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+AM_V_CC = $(am__v_CC_@AM_V@)
+am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
+am__v_CC_0 = @echo " CC " $@;
+am__v_CC_1 =
+CCLD = $(CC)
+LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CCLD = $(am__v_CCLD_@AM_V@)
+am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
+am__v_CCLD_0 = @echo " CCLD " $@;
+am__v_CCLD_1 =
+SOURCES = $(lcd4linux_SOURCES) $(EXTRA_lcd4linux_SOURCES)
+DIST_SOURCES = $(lcd4linux_SOURCES) $(EXTRA_lcd4linux_SOURCES)
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \
+ $(LISP)config.h.in
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates. Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+ BEGIN { nonempty = 0; } \
+ { items[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique. This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+ list='$(am__tagged_files)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | $(am__uniquify_input)`
+ETAGS = etags
+CTAGS = ctags
+CSCOPE = cscope
+AM_RECURSIVE_TARGETS = cscope
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+distdir = $(PACKAGE)-$(VERSION)
+top_distdir = $(distdir)
+am__remove_distdir = \
+ if test -d "$(distdir)"; then \
+ find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
+ && rm -rf "$(distdir)" \
+ || { sleep 5 && rm -rf "$(distdir)"; }; \
+ else :; fi
+am__post_remove_distdir = $(am__remove_distdir)
+DIST_ARCHIVES = $(distdir).tar.gz
+GZIP_ENV = --best
+DIST_TARGETS = dist-gzip
+distuninstallcheck_listfiles = find . -type f -print
+am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
+ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
+distcleancheck_listfiles = find . -type f -print
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CURSES_INCLUDEDIR = @CURSES_INCLUDEDIR@
+CURSES_LIBS = @CURSES_LIBS@
+CYGPATH_W = @CYGPATH_W@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DRIVERS = @DRIVERS@
+DRVLIBS = @DRVLIBS@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBICONV = @LIBICONV@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = libtool
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBICONV = @LTLIBICONV@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+PLUGINLIBS = @PLUGINLIBS@
+PLUGINS = @PLUGINS@
+POW_LIB = @POW_LIB@
+PYTHON = @PYTHON@
+PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@
+PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@
+PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@
+PYTHON_LDFLAGS = @PYTHON_LDFLAGS@
+PYTHON_SITE_PKG = @PYTHON_SITE_PKG@
+PYTHON_VERSION = @PYTHON_VERSION@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+XMKMF = @XMKMF@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AUTOMAKE_OPTIONS = gnu
+CLEANFILES = *~
+
+# Fixme: -W should be renamed to -Wextra someday...
+AM_CFLAGS = -D_GNU_SOURCE -Wall -Wextra -fno-strict-aliasing
+ACLOCAL_AMFLAGS = -I m4
+# use this for lots of warnings
+#AM_CFLAGS = -D_GNU_SOURCE -std=c99 -m64 -Wall -W -pedantic -Wno-variadic-macros -fno-strict-aliasing
+lcd4linux_LDFLAGS = "-Wl,--as-needed"
+lcd4linux_LDADD = @DRIVERS@ @PLUGINS@ @DRVLIBS@ @PLUGINLIBS@
+lcd4linux_DEPENDENCIES = @DRIVERS@ @PLUGINS@
+lcd4linux_SOURCES = \
+lcd4linux.c svn_version.h \
+cfg.c cfg.h \
+debug.c debug.h \
+drv.c drv.h \
+drv_generic.c drv_generic.h \
+evaluator.c evaluator.h \
+property.c property.h \
+hash.c hash.h \
+layout.c layout.h \
+pid.c pid.h \
+timer.c timer.h \
+timer_group.c timer_group.h \
+thread.c thread.h \
+udelay.c udelay.h \
+qprintf.c qprintf.h \
+rgb.c rgb.h \
+event.c event.h \
+ \
+widget.c widget.h \
+widget_text.c widget_text.h \
+widget_bar.c widget_bar.h \
+widget_icon.c widget_icon.h \
+widget_keypad.c widget_keypad.h \
+widget_timer.c widget_timer.h \
+widget_gpo.c widget_gpo.h \
+ \
+plugin.c plugin.h \
+plugin_cfg.c \
+plugin_math.c \
+plugin_string.c \
+plugin_test.c \
+plugin_time.c
+
+EXTRA_lcd4linux_SOURCES = \
+drv_generic_text.c \
+drv_generic_text.h \
+drv_generic_graphic.c \
+drv_generic_graphic.h \
+drv_generic_gpio.c \
+drv_generic_gpio.h \
+drv_generic_serial.c \
+drv_generic_serial.h \
+drv_generic_parport.c \
+drv_generic_parport.h \
+drv_generic_i2c.c \
+drv_generic_i2c.h \
+drv_generic_keypad.c \
+drv_generic_keypad.h \
+drv_ASTUSB.c \
+drv_BeckmannEgle.c \
+drv_BWCT.c \
+drv_Crystalfontz.c \
+drv_Curses.c \
+drv_Cwlinux.c \
+drv_D4D.c \
+drv_dpf.c \
+drv_EA232graphic.c \
+drv_EFN.c \
+drv_FutabaVFD.c \
+drv_FW8888.c \
+drv_G15.c \
+drv_GLCD2USB.c glcd2usb.h \
+drv_HD44780.c \
+drv_Image.c \
+drv_IRLCD.c \
+drv_LCD2USB.c \
+drv_LCDLinux.c \
+drv_LCDTerm.c \
+drv_LEDMatrix.c \
+drv_LPH7508.c \
+drv_LUIse.c \
+drv_LW_ABP.c \
+drv_M50530.c \
+drv_MatrixOrbital.c \
+drv_MatrixOrbitalGX.c \
+drv_mdm166a.c \
+drv_MilfordInstruments.c \
+drv_Newhaven.c \
+drv_Noritake.c \
+drv_NULL.c \
+drv_Pertelian.c \
+drv_PHAnderson.c \
+drv_PICGraphic.c \
+drv_picoLCD.c \
+drv_picoLCDGraphic.c \
+drv_RouterBoard.c \
+drv_Sample.c \
+drv_SamsungSPF.c \
+drv_st2205.c \
+drv_serdisplib.c \
+drv_ShuttleVFD.c \
+drv_SimpleLCD.c \
+drv_T6963.c \
+drv_TeakLCM.c \
+drv_Trefon.c \
+drv_ula200.c \
+drv_USBHUB.c \
+drv_USBLCD.c \
+drv_vnc.c \
+drv_WincorNixdorf.c \
+drv_X11.c \
+ \
+font_6x8.h \
+font_6x8_bold.h \
+widget_image.c widget_image.h \
+ \
+lcd4linux_i2c.h \
+ \
+plugin_apm.c \
+plugin_asterisk.c \
+plugin_button_exec.c \
+plugin_cpuinfo.c \
+plugin_dbus.c \
+plugin_diskstats.c \
+plugin_dvb.c \
+plugin_exec.c \
+plugin_fifo.c \
+plugin_file.c \
+plugin_gps.c \
+plugin_hddtemp.c \
+plugin_huawei.c \
+plugin_i2c_sensors.c \
+plugin_iconv.c \
+plugin_imon.c \
+plugin_isdn.c \
+plugin_kvv.c \
+plugin_loadavg.c \
+plugin_meminfo.c \
+plugin_mpd.c \
+plugin_mpris_dbus.c \
+plugin_mysql.c \
+plugin_netdev.c \
+plugin_netinfo.c \
+plugin_pop3.c \
+plugin_ppp.c \
+plugin_proc_stat.c \
+plugin_python.c \
+plugin_qnaplog.c \
+plugin_raspi.c \
+plugin_sample.c \
+plugin_seti.c \
+plugin_statfs.c \
+plugin_uname.c \
+plugin_uptime.c \
+plugin_w1retap.c \
+plugin_wireless.c \
+plugin_xmms.c
+
+EXTRA_DIST = \
+svn_version.sh \
+lcd4linux.conf.sample \
+lcd4kde.conf \
+lcd4linux.kdelnk \
+lcd4linux.xpm \
+lcd4linux.lsm \
+ax_python_devel.m4 \
+curses.m4 \
+drivers.m4 \
+plugins.m4 \
+AUTHORS \
+CREDITS \
+NEWS \
+TODO \
+README \
+plugin_sample.c
+
+all: config.h
+ $(MAKE) $(AM_MAKEFLAGS) all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+am--refresh: Makefile
+ @:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \
+ $(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ echo ' $(SHELL) ./config.status'; \
+ $(SHELL) ./config.status;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ $(SHELL) ./config.status --recheck
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ $(am__cd) $(srcdir) && $(AUTOCONF)
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
+$(am__aclocal_m4_deps):
+
+config.h: stamp-h1
+ @test -f $@ || rm -f stamp-h1
+ @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1
+
+stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
+ @rm -f stamp-h1
+ cd $(top_builddir) && $(SHELL) ./config.status config.h
+$(srcdir)/config.h.in: $(am__configure_deps)
+ ($(am__cd) $(top_srcdir) && $(AUTOHEADER))
+ rm -f stamp-h1
+ touch $@
+
+distclean-hdr:
+ -rm -f config.h stamp-h1
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \
+ fi; \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed 's/$(EXEEXT)$$//' | \
+ while read p p1; do if test -f $$p \
+ || test -f $$p1 \
+ ; then echo "$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n;h' \
+ -e 's|.*|.|' \
+ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+ sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) files[d] = files[d] " " $$1; \
+ else { print "f", $$3 "/" $$4, $$1; } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+ -e 's/$$/$(EXEEXT)/' \
+ `; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(bindir)" && rm -f $$files
+
+clean-binPROGRAMS:
+ @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \
+ echo " rm -f" $$list; \
+ rm -f $$list || exit $$?; \
+ test -n "$(EXEEXT)" || exit 0; \
+ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f" $$list; \
+ rm -f $$list
+
+lcd4linux$(EXEEXT): $(lcd4linux_OBJECTS) $(lcd4linux_DEPENDENCIES) $(EXTRA_lcd4linux_DEPENDENCIES)
+ @rm -f lcd4linux$(EXEEXT)
+ $(AM_V_CCLD)$(lcd4linux_LINK) $(lcd4linux_OBJECTS) $(lcd4linux_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cfg.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/debug.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_ASTUSB.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_BWCT.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_BeckmannEgle.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_Crystalfontz.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_Curses.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_Cwlinux.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_D4D.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_EA232graphic.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_EFN.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_FW8888.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_FutabaVFD.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_G15.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_GLCD2USB.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_HD44780.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_IRLCD.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_Image.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_LCD2USB.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_LCDLinux.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_LCDTerm.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_LEDMatrix.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_LPH7508.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_LUIse.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_LW_ABP.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_M50530.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_MatrixOrbital.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_MatrixOrbitalGX.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_MilfordInstruments.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_NULL.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_Newhaven.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_Noritake.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_PHAnderson.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_PICGraphic.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_Pertelian.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_RouterBoard.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_Sample.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_SamsungSPF.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_ShuttleVFD.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_SimpleLCD.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_T6963.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_TeakLCM.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_Trefon.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_USBHUB.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_USBLCD.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_WincorNixdorf.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_X11.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_dpf.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_generic.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_generic_gpio.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_generic_graphic.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_generic_i2c.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_generic_keypad.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_generic_parport.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_generic_serial.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_generic_text.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_mdm166a.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_picoLCD.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_picoLCDGraphic.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_serdisplib.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_st2205.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_ula200.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_vnc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/evaluator.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/event.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hash.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/layout.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lcd4linux.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pid.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin_apm.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin_asterisk.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin_button_exec.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin_cfg.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin_cpuinfo.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin_dbus.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin_diskstats.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin_dvb.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin_exec.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin_fifo.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin_file.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin_gps.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin_hddtemp.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin_huawei.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin_i2c_sensors.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin_iconv.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin_imon.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin_isdn.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin_kvv.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin_loadavg.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin_math.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin_meminfo.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin_mpd.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin_mpris_dbus.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin_mysql.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin_netdev.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin_netinfo.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin_pop3.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin_ppp.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin_proc_stat.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin_python.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin_qnaplog.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin_raspi.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin_sample.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin_seti.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin_statfs.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin_string.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin_test.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin_time.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin_uname.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin_uptime.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin_w1retap.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin_wireless.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin_xmms.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/property.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/qprintf.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rgb.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/thread.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/timer.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/timer_group.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/udelay.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/widget.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/widget_bar.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/widget_gpo.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/widget_icon.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/widget_image.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/widget_keypad.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/widget_text.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/widget_timer.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool config.lt
+
+ID: $(am__tagged_files)
+ $(am__define_uniq_tagged_files); mkid -fID $$unique
+tags: tags-am
+TAGS: tags
+
+tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ set x; \
+ here=`pwd`; \
+ $(am__define_uniq_tagged_files); \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: ctags-am
+
+CTAGS: ctags
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ $(am__define_uniq_tagged_files); \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+cscope: cscope.files
+ test ! -s cscope.files \
+ || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS)
+clean-cscope:
+ -rm -f cscope.files
+cscope.files: clean-cscope cscopelist
+cscopelist: cscopelist-am
+
+cscopelist-am: $(am__tagged_files)
+ list='$(am__tagged_files)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+ -rm -f cscope.out cscope.in.out cscope.po.out cscope.files
+
+distdir: $(DISTFILES)
+ $(am__remove_distdir)
+ test -d "$(distdir)" || mkdir "$(distdir)"
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+ -test -n "$(am__skip_mode_fix)" \
+ || find "$(distdir)" -type d ! -perm -755 \
+ -exec chmod u+rwx,go+rx {} \; -o \
+ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
+ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
+ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
+ || chmod -R a+r "$(distdir)"
+dist-gzip: distdir
+ tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+ $(am__post_remove_distdir)
+
+dist-bzip2: distdir
+ tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
+ $(am__post_remove_distdir)
+
+dist-lzip: distdir
+ tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz
+ $(am__post_remove_distdir)
+
+dist-xz: distdir
+ tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
+ $(am__post_remove_distdir)
+
+dist-tarZ: distdir
+ @echo WARNING: "Support for shar distribution archives is" \
+ "deprecated." >&2
+ @echo WARNING: "It will be removed altogether in Automake 2.0" >&2
+ tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
+ $(am__post_remove_distdir)
+
+dist-shar: distdir
+ @echo WARNING: "Support for distribution archives compressed with" \
+ "legacy program 'compress' is deprecated." >&2
+ @echo WARNING: "It will be removed altogether in Automake 2.0" >&2
+ shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
+ $(am__post_remove_distdir)
+
+dist-zip: distdir
+ -rm -f $(distdir).zip
+ zip -rq $(distdir).zip $(distdir)
+ $(am__post_remove_distdir)
+
+dist dist-all:
+ $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:'
+ $(am__post_remove_distdir)
+
+# This target untars the dist file and tries a VPATH configuration. Then
+# it guarantees that the distribution is self-contained by making another
+# tarfile.
+distcheck: dist
+ case '$(DIST_ARCHIVES)' in \
+ *.tar.gz*) \
+ GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
+ *.tar.bz2*) \
+ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
+ *.tar.lz*) \
+ lzip -dc $(distdir).tar.lz | $(am__untar) ;;\
+ *.tar.xz*) \
+ xz -dc $(distdir).tar.xz | $(am__untar) ;;\
+ *.tar.Z*) \
+ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
+ *.shar.gz*) \
+ GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
+ *.zip*) \
+ unzip $(distdir).zip ;;\
+ esac
+ chmod -R a-w $(distdir)
+ chmod u+w $(distdir)
+ mkdir $(distdir)/_build $(distdir)/_inst
+ chmod a-w $(distdir)
+ test -d $(distdir)/_build || exit 0; \
+ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
+ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
+ && am__cwd=`pwd` \
+ && $(am__cd) $(distdir)/_build \
+ && ../configure \
+ $(AM_DISTCHECK_CONFIGURE_FLAGS) \
+ $(DISTCHECK_CONFIGURE_FLAGS) \
+ --srcdir=.. --prefix="$$dc_install_base" \
+ && $(MAKE) $(AM_MAKEFLAGS) \
+ && $(MAKE) $(AM_MAKEFLAGS) dvi \
+ && $(MAKE) $(AM_MAKEFLAGS) check \
+ && $(MAKE) $(AM_MAKEFLAGS) install \
+ && $(MAKE) $(AM_MAKEFLAGS) installcheck \
+ && $(MAKE) $(AM_MAKEFLAGS) uninstall \
+ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
+ distuninstallcheck \
+ && chmod -R a-w "$$dc_install_base" \
+ && ({ \
+ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
+ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
+ } || { rm -rf "$$dc_destdir"; exit 1; }) \
+ && rm -rf "$$dc_destdir" \
+ && $(MAKE) $(AM_MAKEFLAGS) dist \
+ && rm -rf $(DIST_ARCHIVES) \
+ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \
+ && cd "$$am__cwd" \
+ || exit 1
+ $(am__post_remove_distdir)
+ @(echo "$(distdir) archives ready for distribution: "; \
+ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
+ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
+distuninstallcheck:
+ @test -n '$(distuninstallcheck_dir)' || { \
+ echo 'ERROR: trying to run $@ with an empty' \
+ '$$(distuninstallcheck_dir)' >&2; \
+ exit 1; \
+ }; \
+ $(am__cd) '$(distuninstallcheck_dir)' || { \
+ echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \
+ exit 1; \
+ }; \
+ test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \
+ || { echo "ERROR: files left after uninstall:" ; \
+ if test -n "$(DESTDIR)"; then \
+ echo " (check DESTDIR support)"; \
+ fi ; \
+ $(distuninstallcheck_listfiles) ; \
+ exit 1; } >&2
+distcleancheck: distclean
+ @if test '$(srcdir)' = . ; then \
+ echo "ERROR: distcleancheck can only run from a VPATH build" ; \
+ exit 1 ; \
+ fi
+ @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
+ || { echo "ERROR: files left in build directory after distclean:" ; \
+ $(distcleancheck_listfiles) ; \
+ exit 1; } >&2
+check-am: all-am
+check: check-am
+all-am: Makefile $(PROGRAMS) config.h
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-hdr distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+ -rm -rf $(top_srcdir)/autom4te.cache
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS
+
+.MAKE: all install-am install-strip
+
+.PHONY: CTAGS GTAGS TAGS all all-am am--refresh check check-am clean \
+ clean-binPROGRAMS clean-cscope clean-generic clean-libtool \
+ cscope cscopelist-am ctags ctags-am dist dist-all dist-bzip2 \
+ dist-gzip dist-lzip dist-shar dist-tarZ dist-xz dist-zip \
+ distcheck distclean distclean-compile distclean-generic \
+ distclean-hdr distclean-libtool distclean-tags distcleancheck \
+ distdir distuninstallcheck dvi dvi-am html html-am info \
+ info-am install install-am install-binPROGRAMS install-data \
+ install-data-am install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-man install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags tags-am uninstall uninstall-am uninstall-binPROGRAMS
+
+
+# create subversion version
+
+.PHONY: svn_version
+
+svn_version:
+ svn_version.sh
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/NEWS b/NEWS
new file mode 100644
index 0000000..f64cf35
--- /dev/null
+++ b/NEWS
@@ -0,0 +1,5 @@
+# $Id: NEWS 730 2007-01-14 13:50:28Z michael $
+# $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/NEWS $
+
+Sorry, there is no NEWS anymore.
+Go to http://lcd4linux.bulix.org for all the documentation.
diff --git a/README b/README
new file mode 100644
index 0000000..ef8c5f3
--- /dev/null
+++ b/README
@@ -0,0 +1,5 @@
+# $Id: README 730 2007-01-14 13:50:28Z michael $
+# $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/README $
+
+Sorry, there is no README anymore.
+Go to http://lcd4linux.bulix.org for all the documentation.
diff --git a/TODO b/TODO
new file mode 100644
index 0000000..9e29a1c
--- /dev/null
+++ b/TODO
@@ -0,0 +1,5 @@
+# $Id: TODO 730 2007-01-14 13:50:28Z michael $
+# $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/TODO $
+
+Sorry, there is no TODO anymore.
+Go to http://lcd4linux.bulix.org for all the documentation.
diff --git a/aclocal.m4 b/aclocal.m4
new file mode 100644
index 0000000..4bf8515
--- /dev/null
+++ b/aclocal.m4
@@ -0,0 +1,2814 @@
+# generated automatically by aclocal 1.14.1 -*- Autoconf -*-
+
+# Copyright (C) 1996-2013 Free Software Foundation, Inc.
+
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
+m4_ifndef([AC_AUTOCONF_VERSION],
+ [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
+m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
+[m4_warning([this file was generated for autoconf 2.69.
+You have another version of autoconf. It may work, but is not guaranteed to.
+If you have problems, you may need to regenerate the build system entirely.
+To do so, use the procedure documented by the package, typically 'autoreconf'.])])
+
+# iconv.m4 serial 18 (gettext-0.18.2)
+dnl Copyright (C) 2000-2002, 2007-2014 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Bruno Haible.
+
+AC_DEFUN([AM_ICONV_LINKFLAGS_BODY],
+[
+ dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
+ AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
+ AC_REQUIRE([AC_LIB_RPATH])
+
+ dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
+ dnl accordingly.
+ AC_LIB_LINKFLAGS_BODY([iconv])
+])
+
+AC_DEFUN([AM_ICONV_LINK],
+[
+ dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
+ dnl those with the standalone portable GNU libiconv installed).
+ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+
+ dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
+ dnl accordingly.
+ AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
+
+ dnl Add $INCICONV to CPPFLAGS before performing the following checks,
+ dnl because if the user has installed libiconv and not disabled its use
+ dnl via --without-libiconv-prefix, he wants to use it. The first
+ dnl AC_LINK_IFELSE will then fail, the second AC_LINK_IFELSE will succeed.
+ am_save_CPPFLAGS="$CPPFLAGS"
+ AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV])
+
+ AC_CACHE_CHECK([for iconv], [am_cv_func_iconv], [
+ am_cv_func_iconv="no, consider installing GNU libiconv"
+ am_cv_lib_iconv=no
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[
+#include <stdlib.h>
+#include <iconv.h>
+ ]],
+ [[iconv_t cd = iconv_open("","");
+ iconv(cd,NULL,NULL,NULL,NULL);
+ iconv_close(cd);]])],
+ [am_cv_func_iconv=yes])
+ if test "$am_cv_func_iconv" != yes; then
+ am_save_LIBS="$LIBS"
+ LIBS="$LIBS $LIBICONV"
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[
+#include <stdlib.h>
+#include <iconv.h>
+ ]],
+ [[iconv_t cd = iconv_open("","");
+ iconv(cd,NULL,NULL,NULL,NULL);
+ iconv_close(cd);]])],
+ [am_cv_lib_iconv=yes]
+ [am_cv_func_iconv=yes])
+ LIBS="$am_save_LIBS"
+ fi
+ ])
+ if test "$am_cv_func_iconv" = yes; then
+ AC_CACHE_CHECK([for working iconv], [am_cv_func_iconv_works], [
+ dnl This tests against bugs in AIX 5.1, AIX 6.1..7.1, HP-UX 11.11,
+ dnl Solaris 10.
+ am_save_LIBS="$LIBS"
+ if test $am_cv_lib_iconv = yes; then
+ LIBS="$LIBS $LIBICONV"
+ fi
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
+#include <iconv.h>
+#include <string.h>
+int main ()
+{
+ int result = 0;
+ /* Test against AIX 5.1 bug: Failures are not distinguishable from successful
+ returns. */
+ {
+ iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8");
+ if (cd_utf8_to_88591 != (iconv_t)(-1))
+ {
+ static const char input[] = "\342\202\254"; /* EURO SIGN */
+ char buf[10];
+ const char *inptr = input;
+ size_t inbytesleft = strlen (input);
+ char *outptr = buf;
+ size_t outbytesleft = sizeof (buf);
+ size_t res = iconv (cd_utf8_to_88591,
+ (char **) &inptr, &inbytesleft,
+ &outptr, &outbytesleft);
+ if (res == 0)
+ result |= 1;
+ iconv_close (cd_utf8_to_88591);
+ }
+ }
+ /* Test against Solaris 10 bug: Failures are not distinguishable from
+ successful returns. */
+ {
+ iconv_t cd_ascii_to_88591 = iconv_open ("ISO8859-1", "646");
+ if (cd_ascii_to_88591 != (iconv_t)(-1))
+ {
+ static const char input[] = "\263";
+ char buf[10];
+ const char *inptr = input;
+ size_t inbytesleft = strlen (input);
+ char *outptr = buf;
+ size_t outbytesleft = sizeof (buf);
+ size_t res = iconv (cd_ascii_to_88591,
+ (char **) &inptr, &inbytesleft,
+ &outptr, &outbytesleft);
+ if (res == 0)
+ result |= 2;
+ iconv_close (cd_ascii_to_88591);
+ }
+ }
+ /* Test against AIX 6.1..7.1 bug: Buffer overrun. */
+ {
+ iconv_t cd_88591_to_utf8 = iconv_open ("UTF-8", "ISO-8859-1");
+ if (cd_88591_to_utf8 != (iconv_t)(-1))
+ {
+ static const char input[] = "\304";
+ static char buf[2] = { (char)0xDE, (char)0xAD };
+ const char *inptr = input;
+ size_t inbytesleft = 1;
+ char *outptr = buf;
+ size_t outbytesleft = 1;
+ size_t res = iconv (cd_88591_to_utf8,
+ (char **) &inptr, &inbytesleft,
+ &outptr, &outbytesleft);
+ if (res != (size_t)(-1) || outptr - buf > 1 || buf[1] != (char)0xAD)
+ result |= 4;
+ iconv_close (cd_88591_to_utf8);
+ }
+ }
+#if 0 /* This bug could be worked around by the caller. */
+ /* Test against HP-UX 11.11 bug: Positive return value instead of 0. */
+ {
+ iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591");
+ if (cd_88591_to_utf8 != (iconv_t)(-1))
+ {
+ static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
+ char buf[50];
+ const char *inptr = input;
+ size_t inbytesleft = strlen (input);
+ char *outptr = buf;
+ size_t outbytesleft = sizeof (buf);
+ size_t res = iconv (cd_88591_to_utf8,
+ (char **) &inptr, &inbytesleft,
+ &outptr, &outbytesleft);
+ if ((int)res > 0)
+ result |= 8;
+ iconv_close (cd_88591_to_utf8);
+ }
+ }
+#endif
+ /* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is
+ provided. */
+ if (/* Try standardized names. */
+ iconv_open ("UTF-8", "EUC-JP") == (iconv_t)(-1)
+ /* Try IRIX, OSF/1 names. */
+ && iconv_open ("UTF-8", "eucJP") == (iconv_t)(-1)
+ /* Try AIX names. */
+ && iconv_open ("UTF-8", "IBM-eucJP") == (iconv_t)(-1)
+ /* Try HP-UX names. */
+ && iconv_open ("utf8", "eucJP") == (iconv_t)(-1))
+ result |= 16;
+ return result;
+}]])],
+ [am_cv_func_iconv_works=yes],
+ [am_cv_func_iconv_works=no],
+ [
+changequote(,)dnl
+ case "$host_os" in
+ aix* | hpux*) am_cv_func_iconv_works="guessing no" ;;
+ *) am_cv_func_iconv_works="guessing yes" ;;
+ esac
+changequote([,])dnl
+ ])
+ LIBS="$am_save_LIBS"
+ ])
+ case "$am_cv_func_iconv_works" in
+ *no) am_func_iconv=no am_cv_lib_iconv=no ;;
+ *) am_func_iconv=yes ;;
+ esac
+ else
+ am_func_iconv=no am_cv_lib_iconv=no
+ fi
+ if test "$am_func_iconv" = yes; then
+ AC_DEFINE([HAVE_ICONV], [1],
+ [Define if you have the iconv() function and it works.])
+ fi
+ if test "$am_cv_lib_iconv" = yes; then
+ AC_MSG_CHECKING([how to link with libiconv])
+ AC_MSG_RESULT([$LIBICONV])
+ else
+ dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV
+ dnl either.
+ CPPFLAGS="$am_save_CPPFLAGS"
+ LIBICONV=
+ LTLIBICONV=
+ fi
+ AC_SUBST([LIBICONV])
+ AC_SUBST([LTLIBICONV])
+])
+
+dnl Define AM_ICONV using AC_DEFUN_ONCE for Autoconf >= 2.64, in order to
+dnl avoid warnings like
+dnl "warning: AC_REQUIRE: `AM_ICONV' was expanded before it was required".
+dnl This is tricky because of the way 'aclocal' is implemented:
+dnl - It requires defining an auxiliary macro whose name ends in AC_DEFUN.
+dnl Otherwise aclocal's initial scan pass would miss the macro definition.
+dnl - It requires a line break inside the AC_DEFUN_ONCE and AC_DEFUN expansions.
+dnl Otherwise aclocal would emit many "Use of uninitialized value $1"
+dnl warnings.
+m4_define([gl_iconv_AC_DEFUN],
+ m4_version_prereq([2.64],
+ [[AC_DEFUN_ONCE(
+ [$1], [$2])]],
+ [m4_ifdef([gl_00GNULIB],
+ [[AC_DEFUN_ONCE(
+ [$1], [$2])]],
+ [[AC_DEFUN(
+ [$1], [$2])]])]))
+gl_iconv_AC_DEFUN([AM_ICONV],
+[
+ AM_ICONV_LINK
+ if test "$am_cv_func_iconv" = yes; then
+ AC_MSG_CHECKING([for iconv declaration])
+ AC_CACHE_VAL([am_cv_proto_iconv], [
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[
+#include <stdlib.h>
+#include <iconv.h>
+extern
+#ifdef __cplusplus
+"C"
+#endif
+#if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus)
+size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
+#else
+size_t iconv();
+#endif
+ ]],
+ [[]])],
+ [am_cv_proto_iconv_arg1=""],
+ [am_cv_proto_iconv_arg1="const"])
+ am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"])
+ am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
+ AC_MSG_RESULT([
+ $am_cv_proto_iconv])
+ AC_DEFINE_UNQUOTED([ICONV_CONST], [$am_cv_proto_iconv_arg1],
+ [Define as const if the declaration of iconv() needs const.])
+ dnl Also substitute ICONV_CONST in the gnulib generated <iconv.h>.
+ m4_ifdef([gl_ICONV_H_DEFAULTS],
+ [AC_REQUIRE([gl_ICONV_H_DEFAULTS])
+ if test -n "$am_cv_proto_iconv_arg1"; then
+ ICONV_CONST="const"
+ fi
+ ])
+ fi
+])
+
+# lib-ld.m4 serial 6
+dnl Copyright (C) 1996-2003, 2009-2014 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl Subroutines of libtool.m4,
+dnl with replacements s/_*LT_PATH/AC_LIB_PROG/ and s/lt_/acl_/ to avoid
+dnl collision with libtool.m4.
+
+dnl From libtool-2.4. Sets the variable with_gnu_ld to yes or no.
+AC_DEFUN([AC_LIB_PROG_LD_GNU],
+[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], [acl_cv_prog_gnu_ld],
+[# I'd rather use --version here, but apparently some GNU lds only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+ acl_cv_prog_gnu_ld=yes
+ ;;
+*)
+ acl_cv_prog_gnu_ld=no
+ ;;
+esac])
+with_gnu_ld=$acl_cv_prog_gnu_ld
+])
+
+dnl From libtool-2.4. Sets the variable LD.
+AC_DEFUN([AC_LIB_PROG_LD],
+[AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+
+AC_ARG_WITH([gnu-ld],
+ [AS_HELP_STRING([--with-gnu-ld],
+ [assume the C compiler uses GNU ld [default=no]])],
+ [test "$withval" = no || with_gnu_ld=yes],
+ [with_gnu_ld=no])dnl
+
+# Prepare PATH_SEPARATOR.
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which
+ # contains only /bin. Note that ksh looks also at the FPATH variable,
+ # so we have to set that as well for the test.
+ PATH_SEPARATOR=:
+ (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
+ && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
+ || PATH_SEPARATOR=';'
+ }
+fi
+
+ac_prog=ld
+if test "$GCC" = yes; then
+ # Check if gcc -print-prog-name=ld gives a path.
+ AC_MSG_CHECKING([for ld used by $CC])
+ case $host in
+ *-*-mingw*)
+ # gcc leaves a trailing carriage return which upsets mingw
+ ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+ *)
+ ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+ esac
+ case $ac_prog in
+ # Accept absolute paths.
+ [[\\/]]* | ?:[[\\/]]*)
+ re_direlt='/[[^/]][[^/]]*/\.\./'
+ # Canonicalize the pathname of ld
+ ac_prog=`echo "$ac_prog"| sed 's%\\\\%/%g'`
+ while echo "$ac_prog" | grep "$re_direlt" > /dev/null 2>&1; do
+ ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
+ done
+ test -z "$LD" && LD="$ac_prog"
+ ;;
+ "")
+ # If it fails, then pretend we aren't using GCC.
+ ac_prog=ld
+ ;;
+ *)
+ # If it is relative, then search for the first ld in PATH.
+ with_gnu_ld=unknown
+ ;;
+ esac
+elif test "$with_gnu_ld" = yes; then
+ AC_MSG_CHECKING([for GNU ld])
+else
+ AC_MSG_CHECKING([for non-GNU ld])
+fi
+AC_CACHE_VAL([acl_cv_path_LD],
+[if test -z "$LD"; then
+ acl_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for ac_dir in $PATH; do
+ IFS="$acl_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+ acl_cv_path_LD="$ac_dir/$ac_prog"
+ # Check to see if the program is GNU ld. I'd rather use --version,
+ # but apparently some variants of GNU ld only accept -v.
+ # Break only if it was the GNU/non-GNU ld that we prefer.
+ case `"$acl_cv_path_LD" -v 2>&1 </dev/null` in
+ *GNU* | *'with BFD'*)
+ test "$with_gnu_ld" != no && break
+ ;;
+ *)
+ test "$with_gnu_ld" != yes && break
+ ;;
+ esac
+ fi
+ done
+ IFS="$acl_save_ifs"
+else
+ acl_cv_path_LD="$LD" # Let the user override the test with a path.
+fi])
+LD="$acl_cv_path_LD"
+if test -n "$LD"; then
+ AC_MSG_RESULT([$LD])
+else
+ AC_MSG_RESULT([no])
+fi
+test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
+AC_LIB_PROG_LD_GNU
+])
+
+# lib-link.m4 serial 26 (gettext-0.18.2)
+dnl Copyright (C) 2001-2014 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Bruno Haible.
+
+AC_PREREQ([2.54])
+
+dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
+dnl the libraries corresponding to explicit and implicit dependencies.
+dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and
+dnl augments the CPPFLAGS variable.
+dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname
+dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
+AC_DEFUN([AC_LIB_LINKFLAGS],
+[
+ AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
+ AC_REQUIRE([AC_LIB_RPATH])
+ pushdef([Name],[m4_translit([$1],[./+-], [____])])
+ pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-],
+ [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
+ AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [
+ AC_LIB_LINKFLAGS_BODY([$1], [$2])
+ ac_cv_lib[]Name[]_libs="$LIB[]NAME"
+ ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME"
+ ac_cv_lib[]Name[]_cppflags="$INC[]NAME"
+ ac_cv_lib[]Name[]_prefix="$LIB[]NAME[]_PREFIX"
+ ])
+ LIB[]NAME="$ac_cv_lib[]Name[]_libs"
+ LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs"
+ INC[]NAME="$ac_cv_lib[]Name[]_cppflags"
+ LIB[]NAME[]_PREFIX="$ac_cv_lib[]Name[]_prefix"
+ AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
+ AC_SUBST([LIB]NAME)
+ AC_SUBST([LTLIB]NAME)
+ AC_SUBST([LIB]NAME[_PREFIX])
+ dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
+ dnl results of this search when this library appears as a dependency.
+ HAVE_LIB[]NAME=yes
+ popdef([NAME])
+ popdef([Name])
+])
+
+dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode, [missing-message])
+dnl searches for libname and the libraries corresponding to explicit and
+dnl implicit dependencies, together with the specified include files and
+dnl the ability to compile and link the specified testcode. The missing-message
+dnl defaults to 'no' and may contain additional hints for the user.
+dnl If found, it sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME}
+dnl and LTLIB${NAME} variables and augments the CPPFLAGS variable, and
+dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
+dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
+dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname
+dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
+AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
+[
+ AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
+ AC_REQUIRE([AC_LIB_RPATH])
+ pushdef([Name],[m4_translit([$1],[./+-], [____])])
+ pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-],
+ [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
+
+ dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME
+ dnl accordingly.
+ AC_LIB_LINKFLAGS_BODY([$1], [$2])
+
+ dnl Add $INC[]NAME to CPPFLAGS before performing the following checks,
+ dnl because if the user has installed lib[]Name and not disabled its use
+ dnl via --without-lib[]Name-prefix, he wants to use it.
+ ac_save_CPPFLAGS="$CPPFLAGS"
+ AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
+
+ AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
+ ac_save_LIBS="$LIBS"
+ dnl If $LIB[]NAME contains some -l options, add it to the end of LIBS,
+ dnl because these -l options might require -L options that are present in
+ dnl LIBS. -l options benefit only from the -L options listed before it.
+ dnl Otherwise, add it to the front of LIBS, because it may be a static
+ dnl library that depends on another static library that is present in LIBS.
+ dnl Static libraries benefit only from the static libraries listed after
+ dnl it.
+ case " $LIB[]NAME" in
+ *" -l"*) LIBS="$LIBS $LIB[]NAME" ;;
+ *) LIBS="$LIB[]NAME $LIBS" ;;
+ esac
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM([[$3]], [[$4]])],
+ [ac_cv_lib[]Name=yes],
+ [ac_cv_lib[]Name='m4_if([$5], [], [no], [[$5]])'])
+ LIBS="$ac_save_LIBS"
+ ])
+ if test "$ac_cv_lib[]Name" = yes; then
+ HAVE_LIB[]NAME=yes
+ AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the lib][$1 library.])
+ AC_MSG_CHECKING([how to link with lib[]$1])
+ AC_MSG_RESULT([$LIB[]NAME])
+ else
+ HAVE_LIB[]NAME=no
+ dnl If $LIB[]NAME didn't lead to a usable library, we don't need
+ dnl $INC[]NAME either.
+ CPPFLAGS="$ac_save_CPPFLAGS"
+ LIB[]NAME=
+ LTLIB[]NAME=
+ LIB[]NAME[]_PREFIX=
+ fi
+ AC_SUBST([HAVE_LIB]NAME)
+ AC_SUBST([LIB]NAME)
+ AC_SUBST([LTLIB]NAME)
+ AC_SUBST([LIB]NAME[_PREFIX])
+ popdef([NAME])
+ popdef([Name])
+])
+
+dnl Determine the platform dependent parameters needed to use rpath:
+dnl acl_libext,
+dnl acl_shlibext,
+dnl acl_libname_spec,
+dnl acl_library_names_spec,
+dnl acl_hardcode_libdir_flag_spec,
+dnl acl_hardcode_libdir_separator,
+dnl acl_hardcode_direct,
+dnl acl_hardcode_minus_L.
+AC_DEFUN([AC_LIB_RPATH],
+[
+ dnl Tell automake >= 1.10 to complain if config.rpath is missing.
+ m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([config.rpath])])
+ AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS
+ AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld
+ AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host
+ AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir
+ AC_CACHE_CHECK([for shared library run path origin], [acl_cv_rpath], [
+ CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
+ ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
+ . ./conftest.sh
+ rm -f ./conftest.sh
+ acl_cv_rpath=done
+ ])
+ wl="$acl_cv_wl"
+ acl_libext="$acl_cv_libext"
+ acl_shlibext="$acl_cv_shlibext"
+ acl_libname_spec="$acl_cv_libname_spec"
+ acl_library_names_spec="$acl_cv_library_names_spec"
+ acl_hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
+ acl_hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
+ acl_hardcode_direct="$acl_cv_hardcode_direct"
+ acl_hardcode_minus_L="$acl_cv_hardcode_minus_L"
+ dnl Determine whether the user wants rpath handling at all.
+ AC_ARG_ENABLE([rpath],
+ [ --disable-rpath do not hardcode runtime library paths],
+ :, enable_rpath=yes)
+])
+
+dnl AC_LIB_FROMPACKAGE(name, package)
+dnl declares that libname comes from the given package. The configure file
+dnl will then not have a --with-libname-prefix option but a
+dnl --with-package-prefix option. Several libraries can come from the same
+dnl package. This declaration must occur before an AC_LIB_LINKFLAGS or similar
+dnl macro call that searches for libname.
+AC_DEFUN([AC_LIB_FROMPACKAGE],
+[
+ pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-],
+ [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
+ define([acl_frompackage_]NAME, [$2])
+ popdef([NAME])
+ pushdef([PACK],[$2])
+ pushdef([PACKUP],[m4_translit(PACK,[abcdefghijklmnopqrstuvwxyz./+-],
+ [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
+ define([acl_libsinpackage_]PACKUP,
+ m4_ifdef([acl_libsinpackage_]PACKUP, [m4_defn([acl_libsinpackage_]PACKUP)[, ]],)[lib$1])
+ popdef([PACKUP])
+ popdef([PACK])
+])
+
+dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
+dnl the libraries corresponding to explicit and implicit dependencies.
+dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
+dnl Also, sets the LIB${NAME}_PREFIX variable to nonempty if libname was found
+dnl in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
+AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
+[
+ AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
+ pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-],
+ [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
+ pushdef([PACK],[m4_ifdef([acl_frompackage_]NAME, [acl_frompackage_]NAME, lib[$1])])
+ pushdef([PACKUP],[m4_translit(PACK,[abcdefghijklmnopqrstuvwxyz./+-],
+ [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
+ pushdef([PACKLIBS],[m4_ifdef([acl_frompackage_]NAME, [acl_libsinpackage_]PACKUP, lib[$1])])
+ dnl Autoconf >= 2.61 supports dots in --with options.
+ pushdef([P_A_C_K],[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.61]),[-1],[m4_translit(PACK,[.],[_])],PACK)])
+ dnl By default, look in $includedir and $libdir.
+ use_additional=yes
+ AC_LIB_WITH_FINAL_PREFIX([
+ eval additional_includedir=\"$includedir\"
+ eval additional_libdir=\"$libdir\"
+ ])
+ AC_ARG_WITH(P_A_C_K[-prefix],
+[[ --with-]]P_A_C_K[[-prefix[=DIR] search for ]PACKLIBS[ in DIR/include and DIR/lib
+ --without-]]P_A_C_K[[-prefix don't search for ]PACKLIBS[ in includedir and libdir]],
+[
+ if test "X$withval" = "Xno"; then
+ use_additional=no
+ else
+ if test "X$withval" = "X"; then
+ AC_LIB_WITH_FINAL_PREFIX([
+ eval additional_includedir=\"$includedir\"
+ eval additional_libdir=\"$libdir\"
+ ])
+ else
+ additional_includedir="$withval/include"
+ additional_libdir="$withval/$acl_libdirstem"
+ if test "$acl_libdirstem2" != "$acl_libdirstem" \
+ && ! test -d "$withval/$acl_libdirstem"; then
+ additional_libdir="$withval/$acl_libdirstem2"
+ fi
+ fi
+ fi
+])
+ dnl Search the library and its dependencies in $additional_libdir and
+ dnl $LDFLAGS. Using breadth-first-seach.
+ LIB[]NAME=
+ LTLIB[]NAME=
+ INC[]NAME=
+ LIB[]NAME[]_PREFIX=
+ dnl HAVE_LIB${NAME} is an indicator that LIB${NAME}, LTLIB${NAME} have been
+ dnl computed. So it has to be reset here.
+ HAVE_LIB[]NAME=
+ rpathdirs=
+ ltrpathdirs=
+ names_already_handled=
+ names_next_round='$1 $2'
+ while test -n "$names_next_round"; do
+ names_this_round="$names_next_round"
+ names_next_round=
+ for name in $names_this_round; do
+ already_handled=
+ for n in $names_already_handled; do
+ if test "$n" = "$name"; then
+ already_handled=yes
+ break
+ fi
+ done
+ if test -z "$already_handled"; then
+ names_already_handled="$names_already_handled $name"
+ dnl See if it was already located by an earlier AC_LIB_LINKFLAGS
+ dnl or AC_LIB_HAVE_LINKFLAGS call.
+ uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./+-|ABCDEFGHIJKLMNOPQRSTUVWXYZ____|'`
+ eval value=\"\$HAVE_LIB$uppername\"
+ if test -n "$value"; then
+ if test "$value" = yes; then
+ eval value=\"\$LIB$uppername\"
+ test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value"
+ eval value=\"\$LTLIB$uppername\"
+ test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value"
+ else
+ dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined
+ dnl that this library doesn't exist. So just drop it.
+ :
+ fi
+ else
+ dnl Search the library lib$name in $additional_libdir and $LDFLAGS
+ dnl and the already constructed $LIBNAME/$LTLIBNAME.
+ found_dir=
+ found_la=
+ found_so=
+ found_a=
+ eval libname=\"$acl_libname_spec\" # typically: libname=lib$name
+ if test -n "$acl_shlibext"; then
+ shrext=".$acl_shlibext" # typically: shrext=.so
+ else
+ shrext=
+ fi
+ if test $use_additional = yes; then
+ dir="$additional_libdir"
+ dnl The same code as in the loop below:
+ dnl First look for a shared library.
+ if test -n "$acl_shlibext"; then
+ if test -f "$dir/$libname$shrext"; then
+ found_dir="$dir"
+ found_so="$dir/$libname$shrext"
+ else
+ if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
+ ver=`(cd "$dir" && \
+ for f in "$libname$shrext".*; do echo "$f"; done \
+ | sed -e "s,^$libname$shrext\\\\.,," \
+ | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
+ | sed 1q ) 2>/dev/null`
+ if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then
+ found_dir="$dir"
+ found_so="$dir/$libname$shrext.$ver"
+ fi
+ else
+ eval library_names=\"$acl_library_names_spec\"
+ for f in $library_names; do
+ if test -f "$dir/$f"; then
+ found_dir="$dir"
+ found_so="$dir/$f"
+ break
+ fi
+ done
+ fi
+ fi
+ fi
+ dnl Then look for a static library.
+ if test "X$found_dir" = "X"; then
+ if test -f "$dir/$libname.$acl_libext"; then
+ found_dir="$dir"
+ found_a="$dir/$libname.$acl_libext"
+ fi
+ fi
+ if test "X$found_dir" != "X"; then
+ if test -f "$dir/$libname.la"; then
+ found_la="$dir/$libname.la"
+ fi
+ fi
+ fi
+ if test "X$found_dir" = "X"; then
+ for x in $LDFLAGS $LTLIB[]NAME; do
+ AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+ case "$x" in
+ -L*)
+ dir=`echo "X$x" | sed -e 's/^X-L//'`
+ dnl First look for a shared library.
+ if test -n "$acl_shlibext"; then
+ if test -f "$dir/$libname$shrext"; then
+ found_dir="$dir"
+ found_so="$dir/$libname$shrext"
+ else
+ if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
+ ver=`(cd "$dir" && \
+ for f in "$libname$shrext".*; do echo "$f"; done \
+ | sed -e "s,^$libname$shrext\\\\.,," \
+ | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
+ | sed 1q ) 2>/dev/null`
+ if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then
+ found_dir="$dir"
+ found_so="$dir/$libname$shrext.$ver"
+ fi
+ else
+ eval library_names=\"$acl_library_names_spec\"
+ for f in $library_names; do
+ if test -f "$dir/$f"; then
+ found_dir="$dir"
+ found_so="$dir/$f"
+ break
+ fi
+ done
+ fi
+ fi
+ fi
+ dnl Then look for a static library.
+ if test "X$found_dir" = "X"; then
+ if test -f "$dir/$libname.$acl_libext"; then
+ found_dir="$dir"
+ found_a="$dir/$libname.$acl_libext"
+ fi
+ fi
+ if test "X$found_dir" != "X"; then
+ if test -f "$dir/$libname.la"; then
+ found_la="$dir/$libname.la"
+ fi
+ fi
+ ;;
+ esac
+ if test "X$found_dir" != "X"; then
+ break
+ fi
+ done
+ fi
+ if test "X$found_dir" != "X"; then
+ dnl Found the library.
+ LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name"
+ if test "X$found_so" != "X"; then
+ dnl Linking with a shared library. We attempt to hardcode its
+ dnl directory into the executable's runpath, unless it's the
+ dnl standard /usr/lib.
+ if test "$enable_rpath" = no \
+ || test "X$found_dir" = "X/usr/$acl_libdirstem" \
+ || test "X$found_dir" = "X/usr/$acl_libdirstem2"; then
+ dnl No hardcoding is needed.
+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
+ else
+ dnl Use an explicit option to hardcode DIR into the resulting
+ dnl binary.
+ dnl Potentially add DIR to ltrpathdirs.
+ dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
+ haveit=
+ for x in $ltrpathdirs; do
+ if test "X$x" = "X$found_dir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ ltrpathdirs="$ltrpathdirs $found_dir"
+ fi
+ dnl The hardcoding into $LIBNAME is system dependent.
+ if test "$acl_hardcode_direct" = yes; then
+ dnl Using DIR/libNAME.so during linking hardcodes DIR into the
+ dnl resulting binary.
+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
+ else
+ if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then
+ dnl Use an explicit option to hardcode DIR into the resulting
+ dnl binary.
+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
+ dnl Potentially add DIR to rpathdirs.
+ dnl The rpathdirs will be appended to $LIBNAME at the end.
+ haveit=
+ for x in $rpathdirs; do
+ if test "X$x" = "X$found_dir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ rpathdirs="$rpathdirs $found_dir"
+ fi
+ else
+ dnl Rely on "-L$found_dir".
+ dnl But don't add it if it's already contained in the LDFLAGS
+ dnl or the already constructed $LIBNAME
+ haveit=
+ for x in $LDFLAGS $LIB[]NAME; do
+ AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+ if test "X$x" = "X-L$found_dir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
+ fi
+ if test "$acl_hardcode_minus_L" != no; then
+ dnl FIXME: Not sure whether we should use
+ dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
+ dnl here.
+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
+ else
+ dnl We cannot use $acl_hardcode_runpath_var and LD_RUN_PATH
+ dnl here, because this doesn't fit in flags passed to the
+ dnl compiler. So give up. No hardcoding. This affects only
+ dnl very old systems.
+ dnl FIXME: Not sure whether we should use
+ dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
+ dnl here.
+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
+ fi
+ fi
+ fi
+ fi
+ else
+ if test "X$found_a" != "X"; then
+ dnl Linking with a static library.
+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a"
+ else
+ dnl We shouldn't come here, but anyway it's good to have a
+ dnl fallback.
+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name"
+ fi
+ fi
+ dnl Assume the include files are nearby.
+ additional_includedir=
+ case "$found_dir" in
+ */$acl_libdirstem | */$acl_libdirstem/)
+ basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'`
+ if test "$name" = '$1'; then
+ LIB[]NAME[]_PREFIX="$basedir"
+ fi
+ additional_includedir="$basedir/include"
+ ;;
+ */$acl_libdirstem2 | */$acl_libdirstem2/)
+ basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'`
+ if test "$name" = '$1'; then
+ LIB[]NAME[]_PREFIX="$basedir"
+ fi
+ additional_includedir="$basedir/include"
+ ;;
+ esac
+ if test "X$additional_includedir" != "X"; then
+ dnl Potentially add $additional_includedir to $INCNAME.
+ dnl But don't add it
+ dnl 1. if it's the standard /usr/include,
+ dnl 2. if it's /usr/local/include and we are using GCC on Linux,
+ dnl 3. if it's already present in $CPPFLAGS or the already
+ dnl constructed $INCNAME,
+ dnl 4. if it doesn't exist as a directory.
+ if test "X$additional_includedir" != "X/usr/include"; then
+ haveit=
+ if test "X$additional_includedir" = "X/usr/local/include"; then
+ if test -n "$GCC"; then
+ case $host_os in
+ linux* | gnu* | k*bsd*-gnu) haveit=yes;;
+ esac
+ fi
+ fi
+ if test -z "$haveit"; then
+ for x in $CPPFLAGS $INC[]NAME; do
+ AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+ if test "X$x" = "X-I$additional_includedir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ if test -d "$additional_includedir"; then
+ dnl Really add $additional_includedir to $INCNAME.
+ INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir"
+ fi
+ fi
+ fi
+ fi
+ fi
+ dnl Look for dependencies.
+ if test -n "$found_la"; then
+ dnl Read the .la file. It defines the variables
+ dnl dlname, library_names, old_library, dependency_libs, current,
+ dnl age, revision, installed, dlopen, dlpreopen, libdir.
+ save_libdir="$libdir"
+ case "$found_la" in
+ */* | *\\*) . "$found_la" ;;
+ *) . "./$found_la" ;;
+ esac
+ libdir="$save_libdir"
+ dnl We use only dependency_libs.
+ for dep in $dependency_libs; do
+ case "$dep" in
+ -L*)
+ additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
+ dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME.
+ dnl But don't add it
+ dnl 1. if it's the standard /usr/lib,
+ dnl 2. if it's /usr/local/lib and we are using GCC on Linux,
+ dnl 3. if it's already present in $LDFLAGS or the already
+ dnl constructed $LIBNAME,
+ dnl 4. if it doesn't exist as a directory.
+ if test "X$additional_libdir" != "X/usr/$acl_libdirstem" \
+ && test "X$additional_libdir" != "X/usr/$acl_libdirstem2"; then
+ haveit=
+ if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem" \
+ || test "X$additional_libdir" = "X/usr/local/$acl_libdirstem2"; then
+ if test -n "$GCC"; then
+ case $host_os in
+ linux* | gnu* | k*bsd*-gnu) haveit=yes;;
+ esac
+ fi
+ fi
+ if test -z "$haveit"; then
+ haveit=
+ for x in $LDFLAGS $LIB[]NAME; do
+ AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+ if test "X$x" = "X-L$additional_libdir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ if test -d "$additional_libdir"; then
+ dnl Really add $additional_libdir to $LIBNAME.
+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir"
+ fi
+ fi
+ haveit=
+ for x in $LDFLAGS $LTLIB[]NAME; do
+ AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+ if test "X$x" = "X-L$additional_libdir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ if test -d "$additional_libdir"; then
+ dnl Really add $additional_libdir to $LTLIBNAME.
+ LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir"
+ fi
+ fi
+ fi
+ fi
+ ;;
+ -R*)
+ dir=`echo "X$dep" | sed -e 's/^X-R//'`
+ if test "$enable_rpath" != no; then
+ dnl Potentially add DIR to rpathdirs.
+ dnl The rpathdirs will be appended to $LIBNAME at the end.
+ haveit=
+ for x in $rpathdirs; do
+ if test "X$x" = "X$dir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ rpathdirs="$rpathdirs $dir"
+ fi
+ dnl Potentially add DIR to ltrpathdirs.
+ dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
+ haveit=
+ for x in $ltrpathdirs; do
+ if test "X$x" = "X$dir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ ltrpathdirs="$ltrpathdirs $dir"
+ fi
+ fi
+ ;;
+ -l*)
+ dnl Handle this in the next round.
+ names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
+ ;;
+ *.la)
+ dnl Handle this in the next round. Throw away the .la's
+ dnl directory; it is already contained in a preceding -L
+ dnl option.
+ names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
+ ;;
+ *)
+ dnl Most likely an immediate library name.
+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep"
+ LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep"
+ ;;
+ esac
+ done
+ fi
+ else
+ dnl Didn't find the library; assume it is in the system directories
+ dnl known to the linker and runtime loader. (All the system
+ dnl directories known to the linker should also be known to the
+ dnl runtime loader, otherwise the system is severely misconfigured.)
+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
+ LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name"
+ fi
+ fi
+ fi
+ done
+ done
+ if test "X$rpathdirs" != "X"; then
+ if test -n "$acl_hardcode_libdir_separator"; then
+ dnl Weird platform: only the last -rpath option counts, the user must
+ dnl pass all path elements in one option. We can arrange that for a
+ dnl single library, but not when more than one $LIBNAMEs are used.
+ alldirs=
+ for found_dir in $rpathdirs; do
+ alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir"
+ done
+ dnl Note: acl_hardcode_libdir_flag_spec uses $libdir and $wl.
+ acl_save_libdir="$libdir"
+ libdir="$alldirs"
+ eval flag=\"$acl_hardcode_libdir_flag_spec\"
+ libdir="$acl_save_libdir"
+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
+ else
+ dnl The -rpath options are cumulative.
+ for found_dir in $rpathdirs; do
+ acl_save_libdir="$libdir"
+ libdir="$found_dir"
+ eval flag=\"$acl_hardcode_libdir_flag_spec\"
+ libdir="$acl_save_libdir"
+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
+ done
+ fi
+ fi
+ if test "X$ltrpathdirs" != "X"; then
+ dnl When using libtool, the option that works for both libraries and
+ dnl executables is -R. The -R options are cumulative.
+ for found_dir in $ltrpathdirs; do
+ LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir"
+ done
+ fi
+ popdef([P_A_C_K])
+ popdef([PACKLIBS])
+ popdef([PACKUP])
+ popdef([PACK])
+ popdef([NAME])
+])
+
+dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR,
+dnl unless already present in VAR.
+dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes
+dnl contains two or three consecutive elements that belong together.
+AC_DEFUN([AC_LIB_APPENDTOVAR],
+[
+ for element in [$2]; do
+ haveit=
+ for x in $[$1]; do
+ AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+ if test "X$x" = "X$element"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ [$1]="${[$1]}${[$1]:+ }$element"
+ fi
+ done
+])
+
+dnl For those cases where a variable contains several -L and -l options
+dnl referring to unknown libraries and directories, this macro determines the
+dnl necessary additional linker options for the runtime path.
+dnl AC_LIB_LINKFLAGS_FROM_LIBS([LDADDVAR], [LIBSVALUE], [USE-LIBTOOL])
+dnl sets LDADDVAR to linker options needed together with LIBSVALUE.
+dnl If USE-LIBTOOL evaluates to non-empty, linking with libtool is assumed,
+dnl otherwise linking without libtool is assumed.
+AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS],
+[
+ AC_REQUIRE([AC_LIB_RPATH])
+ AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
+ $1=
+ if test "$enable_rpath" != no; then
+ if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then
+ dnl Use an explicit option to hardcode directories into the resulting
+ dnl binary.
+ rpathdirs=
+ next=
+ for opt in $2; do
+ if test -n "$next"; then
+ dir="$next"
+ dnl No need to hardcode the standard /usr/lib.
+ if test "X$dir" != "X/usr/$acl_libdirstem" \
+ && test "X$dir" != "X/usr/$acl_libdirstem2"; then
+ rpathdirs="$rpathdirs $dir"
+ fi
+ next=
+ else
+ case $opt in
+ -L) next=yes ;;
+ -L*) dir=`echo "X$opt" | sed -e 's,^X-L,,'`
+ dnl No need to hardcode the standard /usr/lib.
+ if test "X$dir" != "X/usr/$acl_libdirstem" \
+ && test "X$dir" != "X/usr/$acl_libdirstem2"; then
+ rpathdirs="$rpathdirs $dir"
+ fi
+ next= ;;
+ *) next= ;;
+ esac
+ fi
+ done
+ if test "X$rpathdirs" != "X"; then
+ if test -n ""$3""; then
+ dnl libtool is used for linking. Use -R options.
+ for dir in $rpathdirs; do
+ $1="${$1}${$1:+ }-R$dir"
+ done
+ else
+ dnl The linker is used for linking directly.
+ if test -n "$acl_hardcode_libdir_separator"; then
+ dnl Weird platform: only the last -rpath option counts, the user
+ dnl must pass all path elements in one option.
+ alldirs=
+ for dir in $rpathdirs; do
+ alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$dir"
+ done
+ acl_save_libdir="$libdir"
+ libdir="$alldirs"
+ eval flag=\"$acl_hardcode_libdir_flag_spec\"
+ libdir="$acl_save_libdir"
+ $1="$flag"
+ else
+ dnl The -rpath options are cumulative.
+ for dir in $rpathdirs; do
+ acl_save_libdir="$libdir"
+ libdir="$dir"
+ eval flag=\"$acl_hardcode_libdir_flag_spec\"
+ libdir="$acl_save_libdir"
+ $1="${$1}${$1:+ }$flag"
+ done
+ fi
+ fi
+ fi
+ fi
+ fi
+ AC_SUBST([$1])
+])
+
+# lib-prefix.m4 serial 7 (gettext-0.18)
+dnl Copyright (C) 2001-2005, 2008-2014 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Bruno Haible.
+
+dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and
+dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't
+dnl require excessive bracketing.
+ifdef([AC_HELP_STRING],
+[AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])],
+[AC_DEFUN([AC_][LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])])
+
+dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed
+dnl to access previously installed libraries. The basic assumption is that
+dnl a user will want packages to use other packages he previously installed
+dnl with the same --prefix option.
+dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate
+dnl libraries, but is otherwise very convenient.
+AC_DEFUN([AC_LIB_PREFIX],
+[
+ AC_BEFORE([$0], [AC_LIB_LINKFLAGS])
+ AC_REQUIRE([AC_PROG_CC])
+ AC_REQUIRE([AC_CANONICAL_HOST])
+ AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
+ AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
+ dnl By default, look in $includedir and $libdir.
+ use_additional=yes
+ AC_LIB_WITH_FINAL_PREFIX([
+ eval additional_includedir=\"$includedir\"
+ eval additional_libdir=\"$libdir\"
+ ])
+ AC_LIB_ARG_WITH([lib-prefix],
+[ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib
+ --without-lib-prefix don't search for libraries in includedir and libdir],
+[
+ if test "X$withval" = "Xno"; then
+ use_additional=no
+ else
+ if test "X$withval" = "X"; then
+ AC_LIB_WITH_FINAL_PREFIX([
+ eval additional_includedir=\"$includedir\"
+ eval additional_libdir=\"$libdir\"
+ ])
+ else
+ additional_includedir="$withval/include"
+ additional_libdir="$withval/$acl_libdirstem"
+ fi
+ fi
+])
+ if test $use_additional = yes; then
+ dnl Potentially add $additional_includedir to $CPPFLAGS.
+ dnl But don't add it
+ dnl 1. if it's the standard /usr/include,
+ dnl 2. if it's already present in $CPPFLAGS,
+ dnl 3. if it's /usr/local/include and we are using GCC on Linux,
+ dnl 4. if it doesn't exist as a directory.
+ if test "X$additional_includedir" != "X/usr/include"; then
+ haveit=
+ for x in $CPPFLAGS; do
+ AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+ if test "X$x" = "X-I$additional_includedir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ if test "X$additional_includedir" = "X/usr/local/include"; then
+ if test -n "$GCC"; then
+ case $host_os in
+ linux* | gnu* | k*bsd*-gnu) haveit=yes;;
+ esac
+ fi
+ fi
+ if test -z "$haveit"; then
+ if test -d "$additional_includedir"; then
+ dnl Really add $additional_includedir to $CPPFLAGS.
+ CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir"
+ fi
+ fi
+ fi
+ fi
+ dnl Potentially add $additional_libdir to $LDFLAGS.
+ dnl But don't add it
+ dnl 1. if it's the standard /usr/lib,
+ dnl 2. if it's already present in $LDFLAGS,
+ dnl 3. if it's /usr/local/lib and we are using GCC on Linux,
+ dnl 4. if it doesn't exist as a directory.
+ if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then
+ haveit=
+ for x in $LDFLAGS; do
+ AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+ if test "X$x" = "X-L$additional_libdir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then
+ if test -n "$GCC"; then
+ case $host_os in
+ linux*) haveit=yes;;
+ esac
+ fi
+ fi
+ if test -z "$haveit"; then
+ if test -d "$additional_libdir"; then
+ dnl Really add $additional_libdir to $LDFLAGS.
+ LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir"
+ fi
+ fi
+ fi
+ fi
+ fi
+])
+
+dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix,
+dnl acl_final_exec_prefix, containing the values to which $prefix and
+dnl $exec_prefix will expand at the end of the configure script.
+AC_DEFUN([AC_LIB_PREPARE_PREFIX],
+[
+ dnl Unfortunately, prefix and exec_prefix get only finally determined
+ dnl at the end of configure.
+ if test "X$prefix" = "XNONE"; then
+ acl_final_prefix="$ac_default_prefix"
+ else
+ acl_final_prefix="$prefix"
+ fi
+ if test "X$exec_prefix" = "XNONE"; then
+ acl_final_exec_prefix='${prefix}'
+ else
+ acl_final_exec_prefix="$exec_prefix"
+ fi
+ acl_save_prefix="$prefix"
+ prefix="$acl_final_prefix"
+ eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
+ prefix="$acl_save_prefix"
+])
+
+dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the
+dnl variables prefix and exec_prefix bound to the values they will have
+dnl at the end of the configure script.
+AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX],
+[
+ acl_save_prefix="$prefix"
+ prefix="$acl_final_prefix"
+ acl_save_exec_prefix="$exec_prefix"
+ exec_prefix="$acl_final_exec_prefix"
+ $1
+ exec_prefix="$acl_save_exec_prefix"
+ prefix="$acl_save_prefix"
+])
+
+dnl AC_LIB_PREPARE_MULTILIB creates
+dnl - a variable acl_libdirstem, containing the basename of the libdir, either
+dnl "lib" or "lib64" or "lib/64",
+dnl - a variable acl_libdirstem2, as a secondary possible value for
+dnl acl_libdirstem, either the same as acl_libdirstem or "lib/sparcv9" or
+dnl "lib/amd64".
+AC_DEFUN([AC_LIB_PREPARE_MULTILIB],
+[
+ dnl There is no formal standard regarding lib and lib64.
+ dnl On glibc systems, the current practice is that on a system supporting
+ dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under
+ dnl $prefix/lib64 and 32-bit libraries go under $prefix/lib. We determine
+ dnl the compiler's default mode by looking at the compiler's library search
+ dnl path. If at least one of its elements ends in /lib64 or points to a
+ dnl directory whose absolute pathname ends in /lib64, we assume a 64-bit ABI.
+ dnl Otherwise we use the default, namely "lib".
+ dnl On Solaris systems, the current practice is that on a system supporting
+ dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under
+ dnl $prefix/lib/64 (which is a symlink to either $prefix/lib/sparcv9 or
+ dnl $prefix/lib/amd64) and 32-bit libraries go under $prefix/lib.
+ AC_REQUIRE([AC_CANONICAL_HOST])
+ acl_libdirstem=lib
+ acl_libdirstem2=
+ case "$host_os" in
+ solaris*)
+ dnl See Solaris 10 Software Developer Collection > Solaris 64-bit Developer's Guide > The Development Environment
+ dnl <http://docs.sun.com/app/docs/doc/816-5138/dev-env?l=en&a=view>.
+ dnl "Portable Makefiles should refer to any library directories using the 64 symbolic link."
+ dnl But we want to recognize the sparcv9 or amd64 subdirectory also if the
+ dnl symlink is missing, so we set acl_libdirstem2 too.
+ AC_CACHE_CHECK([for 64-bit host], [gl_cv_solaris_64bit],
+ [AC_EGREP_CPP([sixtyfour bits], [
+#ifdef _LP64
+sixtyfour bits
+#endif
+ ], [gl_cv_solaris_64bit=yes], [gl_cv_solaris_64bit=no])
+ ])
+ if test $gl_cv_solaris_64bit = yes; then
+ acl_libdirstem=lib/64
+ case "$host_cpu" in
+ sparc*) acl_libdirstem2=lib/sparcv9 ;;
+ i*86 | x86_64) acl_libdirstem2=lib/amd64 ;;
+ esac
+ fi
+ ;;
+ *)
+ searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'`
+ if test -n "$searchpath"; then
+ acl_save_IFS="${IFS= }"; IFS=":"
+ for searchdir in $searchpath; do
+ if test -d "$searchdir"; then
+ case "$searchdir" in
+ */lib64/ | */lib64 ) acl_libdirstem=lib64 ;;
+ */../ | */.. )
+ # Better ignore directories of this form. They are misleading.
+ ;;
+ *) searchdir=`cd "$searchdir" && pwd`
+ case "$searchdir" in
+ */lib64 ) acl_libdirstem=lib64 ;;
+ esac ;;
+ esac
+ fi
+ done
+ IFS="$acl_save_IFS"
+ fi
+ ;;
+ esac
+ test -n "$acl_libdirstem2" || acl_libdirstem2="$acl_libdirstem"
+])
+
+# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
+# serial 1 (pkg-config-0.24)
+#
+# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# PKG_PROG_PKG_CONFIG([MIN-VERSION])
+# ----------------------------------
+AC_DEFUN([PKG_PROG_PKG_CONFIG],
+[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
+m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
+m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
+AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
+AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
+AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
+
+if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
+ AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
+fi
+if test -n "$PKG_CONFIG"; then
+ _pkg_min_version=m4_default([$1], [0.9.0])
+ AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
+ if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+ PKG_CONFIG=""
+ fi
+fi[]dnl
+])# PKG_PROG_PKG_CONFIG
+
+# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+#
+# Check to see whether a particular set of modules exists. Similar
+# to PKG_CHECK_MODULES(), but does not set variables or print errors.
+#
+# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
+# only at the first occurence in configure.ac, so if the first place
+# it's called might be skipped (such as if it is within an "if", you
+# have to call PKG_CHECK_EXISTS manually
+# --------------------------------------------------------------
+AC_DEFUN([PKG_CHECK_EXISTS],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+if test -n "$PKG_CONFIG" && \
+ AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
+ m4_default([$2], [:])
+m4_ifvaln([$3], [else
+ $3])dnl
+fi])
+
+# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
+# ---------------------------------------------
+m4_define([_PKG_CONFIG],
+[if test -n "$$1"; then
+ pkg_cv_[]$1="$$1"
+ elif test -n "$PKG_CONFIG"; then
+ PKG_CHECK_EXISTS([$3],
+ [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
+ test "x$?" != "x0" && pkg_failed=yes ],
+ [pkg_failed=yes])
+ else
+ pkg_failed=untried
+fi[]dnl
+])# _PKG_CONFIG
+
+# _PKG_SHORT_ERRORS_SUPPORTED
+# -----------------------------
+AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+ _pkg_short_errors_supported=yes
+else
+ _pkg_short_errors_supported=no
+fi[]dnl
+])# _PKG_SHORT_ERRORS_SUPPORTED
+
+
+# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
+# [ACTION-IF-NOT-FOUND])
+#
+#
+# Note that if there is a possibility the first call to
+# PKG_CHECK_MODULES might not happen, you should be sure to include an
+# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
+#
+#
+# --------------------------------------------------------------
+AC_DEFUN([PKG_CHECK_MODULES],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
+AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
+
+pkg_failed=no
+AC_MSG_CHECKING([for $1])
+
+_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
+_PKG_CONFIG([$1][_LIBS], [libs], [$2])
+
+m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
+and $1[]_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.])
+
+if test $pkg_failed = yes; then
+ AC_MSG_RESULT([no])
+ _PKG_SHORT_ERRORS_SUPPORTED
+ if test $_pkg_short_errors_supported = yes; then
+ $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
+ else
+ $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
+ fi
+ # Put the nasty error message in config.log where it belongs
+ echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
+
+ m4_default([$4], [AC_MSG_ERROR(
+[Package requirements ($2) were not met:
+
+$$1_PKG_ERRORS
+
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
+
+_PKG_TEXT])[]dnl
+ ])
+elif test $pkg_failed = untried; then
+ AC_MSG_RESULT([no])
+ m4_default([$4], [AC_MSG_FAILURE(
+[The pkg-config script could not be found or is too old. Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
+
+_PKG_TEXT
+
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
+ ])
+else
+ $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
+ $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
+ AC_MSG_RESULT([yes])
+ $3
+fi[]dnl
+])# PKG_CHECK_MODULES
+
+
+# PKG_INSTALLDIR(DIRECTORY)
+# -------------------------
+# Substitutes the variable pkgconfigdir as the location where a module
+# should install pkg-config .pc files. By default the directory is
+# $libdir/pkgconfig, but the default can be changed by passing
+# DIRECTORY. The user can override through the --with-pkgconfigdir
+# parameter.
+AC_DEFUN([PKG_INSTALLDIR],
+[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
+m4_pushdef([pkg_description],
+ [pkg-config installation directory @<:@]pkg_default[@:>@])
+AC_ARG_WITH([pkgconfigdir],
+ [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
+ [with_pkgconfigdir=]pkg_default)
+AC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
+m4_popdef([pkg_default])
+m4_popdef([pkg_description])
+]) dnl PKG_INSTALLDIR
+
+
+# PKG_NOARCH_INSTALLDIR(DIRECTORY)
+# -------------------------
+# Substitutes the variable noarch_pkgconfigdir as the location where a
+# module should install arch-independent pkg-config .pc files. By
+# default the directory is $datadir/pkgconfig, but the default can be
+# changed by passing DIRECTORY. The user can override through the
+# --with-noarch-pkgconfigdir parameter.
+AC_DEFUN([PKG_NOARCH_INSTALLDIR],
+[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
+m4_pushdef([pkg_description],
+ [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
+AC_ARG_WITH([noarch-pkgconfigdir],
+ [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
+ [with_noarch_pkgconfigdir=]pkg_default)
+AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
+m4_popdef([pkg_default])
+m4_popdef([pkg_description])
+]) dnl PKG_NOARCH_INSTALLDIR
+
+
+# PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
+# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+# -------------------------------------------
+# Retrieves the value of the pkg-config variable for the given module.
+AC_DEFUN([PKG_CHECK_VAR],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
+
+_PKG_CONFIG([$1], [variable="][$3]["], [$2])
+AS_VAR_COPY([$1], [pkg_cv_][$1])
+
+AS_VAR_IF([$1], [""], [$5], [$4])dnl
+])# PKG_CHECK_VAR
+
+# Copyright (C) 2002-2013 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_AUTOMAKE_VERSION(VERSION)
+# ----------------------------
+# Automake X.Y traces this macro to ensure aclocal.m4 has been
+# generated from the m4 files accompanying Automake X.Y.
+# (This private macro should not be called outside this file.)
+AC_DEFUN([AM_AUTOMAKE_VERSION],
+[am__api_version='1.14'
+dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
+dnl require some minimum version. Point them to the right macro.
+m4_if([$1], [1.14.1], [],
+ [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
+])
+
+# _AM_AUTOCONF_VERSION(VERSION)
+# -----------------------------
+# aclocal traces this macro to find the Autoconf version.
+# This is a private macro too. Using m4_define simplifies
+# the logic in aclocal, which can simply ignore this definition.
+m4_define([_AM_AUTOCONF_VERSION], [])
+
+# AM_SET_CURRENT_AUTOMAKE_VERSION
+# -------------------------------
+# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
+# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
+AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
+[AM_AUTOMAKE_VERSION([1.14.1])dnl
+m4_ifndef([AC_AUTOCONF_VERSION],
+ [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
+_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
+
+# AM_AUX_DIR_EXPAND -*- Autoconf -*-
+
+# Copyright (C) 2001-2013 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
+# $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to
+# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
+#
+# Of course, Automake must honor this variable whenever it calls a
+# tool from the auxiliary directory. The problem is that $srcdir (and
+# therefore $ac_aux_dir as well) can be either absolute or relative,
+# depending on how configure is run. This is pretty annoying, since
+# it makes $ac_aux_dir quite unusable in subdirectories: in the top
+# source directory, any form will work fine, but in subdirectories a
+# relative path needs to be adjusted first.
+#
+# $ac_aux_dir/missing
+# fails when called from a subdirectory if $ac_aux_dir is relative
+# $top_srcdir/$ac_aux_dir/missing
+# fails if $ac_aux_dir is absolute,
+# fails when called from a subdirectory in a VPATH build with
+# a relative $ac_aux_dir
+#
+# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
+# are both prefixed by $srcdir. In an in-source build this is usually
+# harmless because $srcdir is '.', but things will broke when you
+# start a VPATH build or use an absolute $srcdir.
+#
+# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
+# iff we strip the leading $srcdir from $ac_aux_dir. That would be:
+# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
+# and then we would define $MISSING as
+# MISSING="\${SHELL} $am_aux_dir/missing"
+# This will work as long as MISSING is not called from configure, because
+# unfortunately $(top_srcdir) has no meaning in configure.
+# However there are other variables, like CC, which are often used in
+# configure, and could therefore not use this "fixed" $ac_aux_dir.
+#
+# Another solution, used here, is to always expand $ac_aux_dir to an
+# absolute PATH. The drawback is that using absolute paths prevent a
+# configured tree to be moved without reconfiguration.
+
+AC_DEFUN([AM_AUX_DIR_EXPAND],
+[dnl Rely on autoconf to set up CDPATH properly.
+AC_PREREQ([2.50])dnl
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+])
+
+# AM_CONDITIONAL -*- Autoconf -*-
+
+# Copyright (C) 1997-2013 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_CONDITIONAL(NAME, SHELL-CONDITION)
+# -------------------------------------
+# Define a conditional.
+AC_DEFUN([AM_CONDITIONAL],
+[AC_PREREQ([2.52])dnl
+ m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
+ [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
+AC_SUBST([$1_TRUE])dnl
+AC_SUBST([$1_FALSE])dnl
+_AM_SUBST_NOTMAKE([$1_TRUE])dnl
+_AM_SUBST_NOTMAKE([$1_FALSE])dnl
+m4_define([_AM_COND_VALUE_$1], [$2])dnl
+if $2; then
+ $1_TRUE=
+ $1_FALSE='#'
+else
+ $1_TRUE='#'
+ $1_FALSE=
+fi
+AC_CONFIG_COMMANDS_PRE(
+[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
+ AC_MSG_ERROR([[conditional "$1" was never defined.
+Usually this means the macro was only invoked conditionally.]])
+fi])])
+
+# Copyright (C) 1999-2013 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+
+# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
+# written in clear, in which case automake, when reading aclocal.m4,
+# will think it sees a *use*, and therefore will trigger all it's
+# C support machinery. Also note that it means that autoscan, seeing
+# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
+
+
+# _AM_DEPENDENCIES(NAME)
+# ----------------------
+# See how the compiler implements dependency checking.
+# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
+# We try a few techniques and use that to set a single cache variable.
+#
+# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
+# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
+# dependency, and given that the user is not expected to run this macro,
+# just rely on AC_PROG_CC.
+AC_DEFUN([_AM_DEPENDENCIES],
+[AC_REQUIRE([AM_SET_DEPDIR])dnl
+AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
+AC_REQUIRE([AM_MAKE_INCLUDE])dnl
+AC_REQUIRE([AM_DEP_TRACK])dnl
+
+m4_if([$1], [CC], [depcc="$CC" am_compiler_list=],
+ [$1], [CXX], [depcc="$CXX" am_compiler_list=],
+ [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
+ [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
+ [$1], [UPC], [depcc="$UPC" am_compiler_list=],
+ [$1], [GCJ], [depcc="$GCJ" am_compiler_list='gcc3 gcc'],
+ [depcc="$$1" am_compiler_list=])
+
+AC_CACHE_CHECK([dependency style of $depcc],
+ [am_cv_$1_dependencies_compiler_type],
+[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+ # We make a subdir and do the tests there. Otherwise we can end up
+ # making bogus files that we don't know about and never remove. For
+ # instance it was reported that on HP-UX the gcc test will end up
+ # making a dummy file named 'D' -- because '-MD' means "put the output
+ # in D".
+ rm -rf conftest.dir
+ mkdir conftest.dir
+ # Copy depcomp to subdir because otherwise we won't find it if we're
+ # using a relative directory.
+ cp "$am_depcomp" conftest.dir
+ cd conftest.dir
+ # We will build objects and dependencies in a subdirectory because
+ # it helps to detect inapplicable dependency modes. For instance
+ # both Tru64's cc and ICC support -MD to output dependencies as a
+ # side effect of compilation, but ICC will put the dependencies in
+ # the current directory while Tru64 will put them in the object
+ # directory.
+ mkdir sub
+
+ am_cv_$1_dependencies_compiler_type=none
+ if test "$am_compiler_list" = ""; then
+ am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
+ fi
+ am__universal=false
+ m4_case([$1], [CC],
+ [case " $depcc " in #(
+ *\ -arch\ *\ -arch\ *) am__universal=true ;;
+ esac],
+ [CXX],
+ [case " $depcc " in #(
+ *\ -arch\ *\ -arch\ *) am__universal=true ;;
+ esac])
+
+ for depmode in $am_compiler_list; do
+ # Setup a source with many dependencies, because some compilers
+ # like to wrap large dependency lists on column 80 (with \), and
+ # we should not choose a depcomp mode which is confused by this.
+ #
+ # We need to recreate these files for each test, as the compiler may
+ # overwrite some of them when testing with obscure command lines.
+ # This happens at least with the AIX C compiler.
+ : > sub/conftest.c
+ for i in 1 2 3 4 5 6; do
+ echo '#include "conftst'$i'.h"' >> sub/conftest.c
+ # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
+ # Solaris 10 /bin/sh.
+ echo '/* dummy */' > sub/conftst$i.h
+ done
+ echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+ # We check with '-c' and '-o' for the sake of the "dashmstdout"
+ # mode. It turns out that the SunPro C++ compiler does not properly
+ # handle '-M -o', and we need to detect this. Also, some Intel
+ # versions had trouble with output in subdirs.
+ am__obj=sub/conftest.${OBJEXT-o}
+ am__minus_obj="-o $am__obj"
+ case $depmode in
+ gcc)
+ # This depmode causes a compiler race in universal mode.
+ test "$am__universal" = false || continue
+ ;;
+ nosideeffect)
+ # After this tag, mechanisms are not by side-effect, so they'll
+ # only be used when explicitly requested.
+ if test "x$enable_dependency_tracking" = xyes; then
+ continue
+ else
+ break
+ fi
+ ;;
+ msvc7 | msvc7msys | msvisualcpp | msvcmsys)
+ # This compiler won't grok '-c -o', but also, the minuso test has
+ # not run yet. These depmodes are late enough in the game, and
+ # so weak that their functioning should not be impacted.
+ am__obj=conftest.${OBJEXT-o}
+ am__minus_obj=
+ ;;
+ none) break ;;
+ esac
+ if depmode=$depmode \
+ source=sub/conftest.c object=$am__obj \
+ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
+ >/dev/null 2>conftest.err &&
+ grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
+ ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+ # icc doesn't choke on unknown options, it will just issue warnings
+ # or remarks (even with -Werror). So we grep stderr for any message
+ # that says an option was ignored or not supported.
+ # When given -MP, icc 7.0 and 7.1 complain thusly:
+ # icc: Command line warning: ignoring option '-M'; no argument required
+ # The diagnosis changed in icc 8.0:
+ # icc: Command line remark: option '-MP' not supported
+ if (grep 'ignoring option' conftest.err ||
+ grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+ am_cv_$1_dependencies_compiler_type=$depmode
+ break
+ fi
+ fi
+ done
+
+ cd ..
+ rm -rf conftest.dir
+else
+ am_cv_$1_dependencies_compiler_type=none
+fi
+])
+AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
+AM_CONDITIONAL([am__fastdep$1], [
+ test "x$enable_dependency_tracking" != xno \
+ && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
+])
+
+
+# AM_SET_DEPDIR
+# -------------
+# Choose a directory name for dependency files.
+# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
+AC_DEFUN([AM_SET_DEPDIR],
+[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
+])
+
+
+# AM_DEP_TRACK
+# ------------
+AC_DEFUN([AM_DEP_TRACK],
+[AC_ARG_ENABLE([dependency-tracking], [dnl
+AS_HELP_STRING(
+ [--enable-dependency-tracking],
+ [do not reject slow dependency extractors])
+AS_HELP_STRING(
+ [--disable-dependency-tracking],
+ [speeds up one-time build])])
+if test "x$enable_dependency_tracking" != xno; then
+ am_depcomp="$ac_aux_dir/depcomp"
+ AMDEPBACKSLASH='\'
+ am__nodep='_no'
+fi
+AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
+AC_SUBST([AMDEPBACKSLASH])dnl
+_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
+AC_SUBST([am__nodep])dnl
+_AM_SUBST_NOTMAKE([am__nodep])dnl
+])
+
+# Generate code to set up dependency tracking. -*- Autoconf -*-
+
+# Copyright (C) 1999-2013 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+
+# _AM_OUTPUT_DEPENDENCY_COMMANDS
+# ------------------------------
+AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
+[{
+ # Older Autoconf quotes --file arguments for eval, but not when files
+ # are listed without --file. Let's play safe and only enable the eval
+ # if we detect the quoting.
+ case $CONFIG_FILES in
+ *\'*) eval set x "$CONFIG_FILES" ;;
+ *) set x $CONFIG_FILES ;;
+ esac
+ shift
+ for mf
+ do
+ # Strip MF so we end up with the name of the file.
+ mf=`echo "$mf" | sed -e 's/:.*$//'`
+ # Check whether this is an Automake generated Makefile or not.
+ # We used to match only the files named 'Makefile.in', but
+ # some people rename them; so instead we look at the file content.
+ # Grep'ing the first line is not enough: some people post-process
+ # each Makefile.in and add a new line on top of each file to say so.
+ # Grep'ing the whole file is not good either: AIX grep has a line
+ # limit of 2048, but all sed's we know have understand at least 4000.
+ if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
+ dirpart=`AS_DIRNAME("$mf")`
+ else
+ continue
+ fi
+ # Extract the definition of DEPDIR, am__include, and am__quote
+ # from the Makefile without running 'make'.
+ DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+ test -z "$DEPDIR" && continue
+ am__include=`sed -n 's/^am__include = //p' < "$mf"`
+ test -z "$am__include" && continue
+ am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+ # Find all dependency output files, they are included files with
+ # $(DEPDIR) in their names. We invoke sed twice because it is the
+ # simplest approach to changing $(DEPDIR) to its actual value in the
+ # expansion.
+ for file in `sed -n "
+ s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
+ # Make sure the directory exists.
+ test -f "$dirpart/$file" && continue
+ fdir=`AS_DIRNAME(["$file"])`
+ AS_MKDIR_P([$dirpart/$fdir])
+ # echo "creating $dirpart/$file"
+ echo '# dummy' > "$dirpart/$file"
+ done
+ done
+}
+])# _AM_OUTPUT_DEPENDENCY_COMMANDS
+
+
+# AM_OUTPUT_DEPENDENCY_COMMANDS
+# -----------------------------
+# This macro should only be invoked once -- use via AC_REQUIRE.
+#
+# This code is only required when automatic dependency tracking
+# is enabled. FIXME. This creates each '.P' file that we will
+# need in order to bootstrap the dependency handling code.
+AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
+[AC_CONFIG_COMMANDS([depfiles],
+ [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
+ [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
+])
+
+
+# Copyright (C) 1996-2013 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([AM_WITH_DMALLOC],
+[AC_MSG_CHECKING([if malloc debugging is wanted])
+AC_ARG_WITH([dmalloc],
+[AS_HELP_STRING([--with-dmalloc],
+ [use dmalloc, as in http://www.dmalloc.com])],
+[if test "$withval" = yes; then
+ AC_MSG_RESULT([yes])
+ AC_DEFINE([WITH_DMALLOC], [1],
+ [Define if using the dmalloc debugging malloc package])
+ LIBS="$LIBS -ldmalloc"
+ LDFLAGS="$LDFLAGS -g"
+else
+ AC_MSG_RESULT([no])
+fi], [AC_MSG_RESULT([no])])
+])
+
+# Do all the work for Automake. -*- Autoconf -*-
+
+# Copyright (C) 1996-2013 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This macro actually does too much. Some checks are only needed if
+# your package does certain things. But this isn't really a big deal.
+
+dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
+m4_define([AC_PROG_CC],
+m4_defn([AC_PROG_CC])
+[_AM_PROG_CC_C_O
+])
+
+# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
+# AM_INIT_AUTOMAKE([OPTIONS])
+# -----------------------------------------------
+# The call with PACKAGE and VERSION arguments is the old style
+# call (pre autoconf-2.50), which is being phased out. PACKAGE
+# and VERSION should now be passed to AC_INIT and removed from
+# the call to AM_INIT_AUTOMAKE.
+# We support both call styles for the transition. After
+# the next Automake release, Autoconf can make the AC_INIT
+# arguments mandatory, and then we can depend on a new Autoconf
+# release and drop the old call support.
+AC_DEFUN([AM_INIT_AUTOMAKE],
+[AC_PREREQ([2.65])dnl
+dnl Autoconf wants to disallow AM_ names. We explicitly allow
+dnl the ones we care about.
+m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
+AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
+AC_REQUIRE([AC_PROG_INSTALL])dnl
+if test "`cd $srcdir && pwd`" != "`pwd`"; then
+ # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
+ # is not polluted with repeated "-I."
+ AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
+ # test to see if srcdir already configured
+ if test -f $srcdir/config.status; then
+ AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
+ fi
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+ if (cygpath --version) >/dev/null 2>/dev/null; then
+ CYGPATH_W='cygpath -w'
+ else
+ CYGPATH_W=echo
+ fi
+fi
+AC_SUBST([CYGPATH_W])
+
+# Define the identity of the package.
+dnl Distinguish between old-style and new-style calls.
+m4_ifval([$2],
+[AC_DIAGNOSE([obsolete],
+ [$0: two- and three-arguments forms are deprecated.])
+m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
+ AC_SUBST([PACKAGE], [$1])dnl
+ AC_SUBST([VERSION], [$2])],
+[_AM_SET_OPTIONS([$1])dnl
+dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
+m4_if(
+ m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
+ [ok:ok],,
+ [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
+ AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
+ AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
+
+_AM_IF_OPTION([no-define],,
+[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
+ AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
+
+# Some tools Automake needs.
+AC_REQUIRE([AM_SANITY_CHECK])dnl
+AC_REQUIRE([AC_ARG_PROGRAM])dnl
+AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
+AM_MISSING_PROG([AUTOCONF], [autoconf])
+AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
+AM_MISSING_PROG([AUTOHEADER], [autoheader])
+AM_MISSING_PROG([MAKEINFO], [makeinfo])
+AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
+AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
+AC_REQUIRE([AC_PROG_MKDIR_P])dnl
+# For better backward compatibility. To be removed once Automake 1.9.x
+# dies out for good. For more background, see:
+# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
+# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
+AC_SUBST([mkdir_p], ['$(MKDIR_P)'])
+# We need awk for the "check" target. The system "awk" is bad on
+# some platforms.
+AC_REQUIRE([AC_PROG_AWK])dnl
+AC_REQUIRE([AC_PROG_MAKE_SET])dnl
+AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
+ [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
+ [_AM_PROG_TAR([v7])])])
+_AM_IF_OPTION([no-dependencies],,
+[AC_PROVIDE_IFELSE([AC_PROG_CC],
+ [_AM_DEPENDENCIES([CC])],
+ [m4_define([AC_PROG_CC],
+ m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_CXX],
+ [_AM_DEPENDENCIES([CXX])],
+ [m4_define([AC_PROG_CXX],
+ m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_OBJC],
+ [_AM_DEPENDENCIES([OBJC])],
+ [m4_define([AC_PROG_OBJC],
+ m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
+ [_AM_DEPENDENCIES([OBJCXX])],
+ [m4_define([AC_PROG_OBJCXX],
+ m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
+])
+AC_REQUIRE([AM_SILENT_RULES])dnl
+dnl The testsuite driver may need to know about EXEEXT, so add the
+dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This
+dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
+AC_CONFIG_COMMANDS_PRE(dnl
+[m4_provide_if([_AM_COMPILER_EXEEXT],
+ [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
+
+# POSIX will say in a future version that running "rm -f" with no argument
+# is OK; and we want to be able to make that assumption in our Makefile
+# recipes. So use an aggressive probe to check that the usage we want is
+# actually supported "in the wild" to an acceptable degree.
+# See automake bug#10828.
+# To make any issue more visible, cause the running configure to be aborted
+# by default if the 'rm' program in use doesn't match our expectations; the
+# user can still override this though.
+if rm -f && rm -fr && rm -rf; then : OK; else
+ cat >&2 <<'END'
+Oops!
+
+Your 'rm' program seems unable to run without file operands specified
+on the command line, even when the '-f' option is present. This is contrary
+to the behaviour of most rm programs out there, and not conforming with
+the upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
+
+Please tell bug-automake@gnu.org about your system, including the value
+of your $PATH and any error possibly output before this message. This
+can help us improve future automake versions.
+
+END
+ if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
+ echo 'Configuration will proceed anyway, since you have set the' >&2
+ echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
+ echo >&2
+ else
+ cat >&2 <<'END'
+Aborting the configuration process, to ensure you take notice of the issue.
+
+You can download and install GNU coreutils to get an 'rm' implementation
+that behaves properly: <http://www.gnu.org/software/coreutils/>.
+
+If you want to complete the configuration process using your problematic
+'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
+to "yes", and re-run configure.
+
+END
+ AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
+ fi
+fi
+])
+
+dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not
+dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
+dnl mangled by Autoconf and run in a shell conditional statement.
+m4_define([_AC_COMPILER_EXEEXT],
+m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
+
+# When config.status generates a header, we must update the stamp-h file.
+# This file resides in the same directory as the config header
+# that is generated. The stamp files are numbered to have different names.
+
+# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
+# loop where config.status creates the headers, so we can generate
+# our stamp files there.
+AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
+[# Compute $1's index in $config_headers.
+_am_arg=$1
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+ case $_am_header in
+ $_am_arg | $_am_arg:* )
+ break ;;
+ * )
+ _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+ esac
+done
+echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
+
+# Copyright (C) 2001-2013 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_INSTALL_SH
+# ------------------
+# Define $install_sh.
+AC_DEFUN([AM_PROG_INSTALL_SH],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+if test x"${install_sh}" != xset; then
+ case $am_aux_dir in
+ *\ * | *\ *)
+ install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
+ *)
+ install_sh="\${SHELL} $am_aux_dir/install-sh"
+ esac
+fi
+AC_SUBST([install_sh])])
+
+# Copyright (C) 2003-2013 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# Check whether the underlying file-system supports filenames
+# with a leading dot. For instance MS-DOS doesn't.
+AC_DEFUN([AM_SET_LEADING_DOT],
+[rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+ am__leading_dot=.
+else
+ am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+AC_SUBST([am__leading_dot])])
+
+# Check to see how 'make' treats includes. -*- Autoconf -*-
+
+# Copyright (C) 2001-2013 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_MAKE_INCLUDE()
+# -----------------
+# Check to see how make treats includes.
+AC_DEFUN([AM_MAKE_INCLUDE],
+[am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+ @echo this is the am__doit target
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+AC_MSG_CHECKING([for style of include used by $am_make])
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# Ignore all kinds of additional output from 'make'.
+case `$am_make -s -f confmf 2> /dev/null` in #(
+*the\ am__doit\ target*)
+ am__include=include
+ am__quote=
+ _am_result=GNU
+ ;;
+esac
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+ echo '.include "confinc"' > confmf
+ case `$am_make -s -f confmf 2> /dev/null` in #(
+ *the\ am__doit\ target*)
+ am__include=.include
+ am__quote="\""
+ _am_result=BSD
+ ;;
+ esac
+fi
+AC_SUBST([am__include])
+AC_SUBST([am__quote])
+AC_MSG_RESULT([$_am_result])
+rm -f confinc confmf
+])
+
+# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
+
+# Copyright (C) 1997-2013 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_MISSING_PROG(NAME, PROGRAM)
+# ------------------------------
+AC_DEFUN([AM_MISSING_PROG],
+[AC_REQUIRE([AM_MISSING_HAS_RUN])
+$1=${$1-"${am_missing_run}$2"}
+AC_SUBST($1)])
+
+# AM_MISSING_HAS_RUN
+# ------------------
+# Define MISSING if not defined so far and test if it is modern enough.
+# If it is, set am_missing_run to use it, otherwise, to nothing.
+AC_DEFUN([AM_MISSING_HAS_RUN],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+AC_REQUIRE_AUX_FILE([missing])dnl
+if test x"${MISSING+set}" != xset; then
+ case $am_aux_dir in
+ *\ * | *\ *)
+ MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
+ *)
+ MISSING="\${SHELL} $am_aux_dir/missing" ;;
+ esac
+fi
+# Use eval to expand $SHELL
+if eval "$MISSING --is-lightweight"; then
+ am_missing_run="$MISSING "
+else
+ am_missing_run=
+ AC_MSG_WARN(['missing' script is too old or missing])
+fi
+])
+
+# -*- Autoconf -*-
+# Obsolete and "removed" macros, that must however still report explicit
+# error messages when used, to smooth transition.
+#
+# Copyright (C) 1996-2013 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([AM_CONFIG_HEADER],
+[AC_DIAGNOSE([obsolete],
+['$0': this macro is obsolete.
+You should use the 'AC][_CONFIG_HEADERS' macro instead.])dnl
+AC_CONFIG_HEADERS($@)])
+
+AC_DEFUN([AM_PROG_CC_STDC],
+[AC_PROG_CC
+am_cv_prog_cc_stdc=$ac_cv_prog_cc_stdc
+AC_DIAGNOSE([obsolete],
+['$0': this macro is obsolete.
+You should simply use the 'AC][_PROG_CC' macro instead.
+Also, your code should no longer depend upon 'am_cv_prog_cc_stdc',
+but upon 'ac_cv_prog_cc_stdc'.])])
+
+AC_DEFUN([AM_C_PROTOTYPES],
+ [AC_FATAL([automatic de-ANSI-fication support has been removed])])
+AU_DEFUN([fp_C_PROTOTYPES], [AM_C_PROTOTYPES])
+
+# Helper functions for option handling. -*- Autoconf -*-
+
+# Copyright (C) 2001-2013 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# _AM_MANGLE_OPTION(NAME)
+# -----------------------
+AC_DEFUN([_AM_MANGLE_OPTION],
+[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
+
+# _AM_SET_OPTION(NAME)
+# --------------------
+# Set option NAME. Presently that only means defining a flag for this option.
+AC_DEFUN([_AM_SET_OPTION],
+[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
+
+# _AM_SET_OPTIONS(OPTIONS)
+# ------------------------
+# OPTIONS is a space-separated list of Automake options.
+AC_DEFUN([_AM_SET_OPTIONS],
+[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
+
+# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
+# -------------------------------------------
+# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
+AC_DEFUN([_AM_IF_OPTION],
+[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
+
+# Copyright (C) 1999-2013 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# _AM_PROG_CC_C_O
+# ---------------
+# Like AC_PROG_CC_C_O, but changed for automake. We rewrite AC_PROG_CC
+# to automatically call this.
+AC_DEFUN([_AM_PROG_CC_C_O],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+AC_REQUIRE_AUX_FILE([compile])dnl
+AC_LANG_PUSH([C])dnl
+AC_CACHE_CHECK(
+ [whether $CC understands -c and -o together],
+ [am_cv_prog_cc_c_o],
+ [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
+ # Make sure it works both with $CC and with simple cc.
+ # Following AC_PROG_CC_C_O, we do the test twice because some
+ # compilers refuse to overwrite an existing .o file with -o,
+ # though they will create one.
+ am_cv_prog_cc_c_o=yes
+ for am_i in 1 2; do
+ if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
+ && test -f conftest2.$ac_objext; then
+ : OK
+ else
+ am_cv_prog_cc_c_o=no
+ break
+ fi
+ done
+ rm -f core conftest*
+ unset am_i])
+if test "$am_cv_prog_cc_c_o" != yes; then
+ # Losing compiler, so override with the script.
+ # FIXME: It is wrong to rewrite CC.
+ # But if we don't then we get into trouble of one sort or another.
+ # A longer-term fix would be to have automake use am__CC in this case,
+ # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
+ CC="$am_aux_dir/compile $CC"
+fi
+AC_LANG_POP([C])])
+
+# For backward compatibility.
+AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
+
+# Copyright (C) 2001-2013 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_RUN_LOG(COMMAND)
+# -------------------
+# Run COMMAND, save the exit status in ac_status, and log it.
+# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
+AC_DEFUN([AM_RUN_LOG],
+[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
+ ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+ (exit $ac_status); }])
+
+# Check to make sure that the build environment is sane. -*- Autoconf -*-
+
+# Copyright (C) 1996-2013 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_SANITY_CHECK
+# ---------------
+AC_DEFUN([AM_SANITY_CHECK],
+[AC_MSG_CHECKING([whether build environment is sane])
+# Reject unsafe characters in $srcdir or the absolute working directory
+# name. Accept space and tab only in the latter.
+am_lf='
+'
+case `pwd` in
+ *[[\\\"\#\$\&\'\`$am_lf]]*)
+ AC_MSG_ERROR([unsafe absolute working directory name]);;
+esac
+case $srcdir in
+ *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*)
+ AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
+esac
+
+# Do 'set' in a subshell so we don't clobber the current shell's
+# arguments. Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+ am_has_slept=no
+ for am_try in 1 2; do
+ echo "timestamp, slept: $am_has_slept" > conftest.file
+ set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
+ if test "$[*]" = "X"; then
+ # -L didn't work.
+ set X `ls -t "$srcdir/configure" conftest.file`
+ fi
+ if test "$[*]" != "X $srcdir/configure conftest.file" \
+ && test "$[*]" != "X conftest.file $srcdir/configure"; then
+
+ # If neither matched, then we have a broken ls. This can happen
+ # if, for instance, CONFIG_SHELL is bash and it inherits a
+ # broken ls alias from the environment. This has actually
+ # happened. Such a system could not be considered "sane".
+ AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
+ alias in your environment])
+ fi
+ if test "$[2]" = conftest.file || test $am_try -eq 2; then
+ break
+ fi
+ # Just in case.
+ sleep 1
+ am_has_slept=yes
+ done
+ test "$[2]" = conftest.file
+ )
+then
+ # Ok.
+ :
+else
+ AC_MSG_ERROR([newly created file is older than distributed files!
+Check your system clock])
+fi
+AC_MSG_RESULT([yes])
+# If we didn't sleep, we still need to ensure time stamps of config.status and
+# generated files are strictly newer.
+am_sleep_pid=
+if grep 'slept: no' conftest.file >/dev/null 2>&1; then
+ ( sleep 1 ) &
+ am_sleep_pid=$!
+fi
+AC_CONFIG_COMMANDS_PRE(
+ [AC_MSG_CHECKING([that generated files are newer than configure])
+ if test -n "$am_sleep_pid"; then
+ # Hide warnings about reused PIDs.
+ wait $am_sleep_pid 2>/dev/null
+ fi
+ AC_MSG_RESULT([done])])
+rm -f conftest.file
+])
+
+# Copyright (C) 2009-2013 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_SILENT_RULES([DEFAULT])
+# --------------------------
+# Enable less verbose build rules; with the default set to DEFAULT
+# ("yes" being less verbose, "no" or empty being verbose).
+AC_DEFUN([AM_SILENT_RULES],
+[AC_ARG_ENABLE([silent-rules], [dnl
+AS_HELP_STRING(
+ [--enable-silent-rules],
+ [less verbose build output (undo: "make V=1")])
+AS_HELP_STRING(
+ [--disable-silent-rules],
+ [verbose build output (undo: "make V=0")])dnl
+])
+case $enable_silent_rules in @%:@ (((
+ yes) AM_DEFAULT_VERBOSITY=0;;
+ no) AM_DEFAULT_VERBOSITY=1;;
+ *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
+esac
+dnl
+dnl A few 'make' implementations (e.g., NonStop OS and NextStep)
+dnl do not support nested variable expansions.
+dnl See automake bug#9928 and bug#10237.
+am_make=${MAKE-make}
+AC_CACHE_CHECK([whether $am_make supports nested variables],
+ [am_cv_make_support_nested_variables],
+ [if AS_ECHO([['TRUE=$(BAR$(V))
+BAR0=false
+BAR1=true
+V=1
+am__doit:
+ @$(TRUE)
+.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
+ am_cv_make_support_nested_variables=yes
+else
+ am_cv_make_support_nested_variables=no
+fi])
+if test $am_cv_make_support_nested_variables = yes; then
+ dnl Using '$V' instead of '$(V)' breaks IRIX make.
+ AM_V='$(V)'
+ AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
+else
+ AM_V=$AM_DEFAULT_VERBOSITY
+ AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
+fi
+AC_SUBST([AM_V])dnl
+AM_SUBST_NOTMAKE([AM_V])dnl
+AC_SUBST([AM_DEFAULT_V])dnl
+AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
+AC_SUBST([AM_DEFAULT_VERBOSITY])dnl
+AM_BACKSLASH='\'
+AC_SUBST([AM_BACKSLASH])dnl
+_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
+])
+
+# Copyright (C) 2001-2013 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_INSTALL_STRIP
+# ---------------------
+# One issue with vendor 'install' (even GNU) is that you can't
+# specify the program used to strip binaries. This is especially
+# annoying in cross-compiling environments, where the build's strip
+# is unlikely to handle the host's binaries.
+# Fortunately install-sh will honor a STRIPPROG variable, so we
+# always use install-sh in "make install-strip", and initialize
+# STRIPPROG with the value of the STRIP variable (set by the user).
+AC_DEFUN([AM_PROG_INSTALL_STRIP],
+[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
+# Installed binaries are usually stripped using 'strip' when the user
+# run "make install-strip". However 'strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the 'STRIP' environment variable to overrule this program.
+dnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
+if test "$cross_compiling" != no; then
+ AC_CHECK_TOOL([STRIP], [strip], :)
+fi
+INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
+AC_SUBST([INSTALL_STRIP_PROGRAM])])
+
+# Copyright (C) 2006-2013 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# _AM_SUBST_NOTMAKE(VARIABLE)
+# ---------------------------
+# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
+# This macro is traced by Automake.
+AC_DEFUN([_AM_SUBST_NOTMAKE])
+
+# AM_SUBST_NOTMAKE(VARIABLE)
+# --------------------------
+# Public sister of _AM_SUBST_NOTMAKE.
+AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
+
+# Check how to create a tarball. -*- Autoconf -*-
+
+# Copyright (C) 2004-2013 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# _AM_PROG_TAR(FORMAT)
+# --------------------
+# Check how to create a tarball in format FORMAT.
+# FORMAT should be one of 'v7', 'ustar', or 'pax'.
+#
+# Substitute a variable $(am__tar) that is a command
+# writing to stdout a FORMAT-tarball containing the directory
+# $tardir.
+# tardir=directory && $(am__tar) > result.tar
+#
+# Substitute a variable $(am__untar) that extract such
+# a tarball read from stdin.
+# $(am__untar) < result.tar
+#
+AC_DEFUN([_AM_PROG_TAR],
+[# Always define AMTAR for backward compatibility. Yes, it's still used
+# in the wild :-( We should find a proper way to deprecate it ...
+AC_SUBST([AMTAR], ['$${TAR-tar}'])
+
+# We'll loop over all known methods to create a tar archive until one works.
+_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
+
+m4_if([$1], [v7],
+ [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
+
+ [m4_case([$1],
+ [ustar],
+ [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
+ # There is notably a 21 bits limit for the UID and the GID. In fact,
+ # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
+ # and bug#13588).
+ am_max_uid=2097151 # 2^21 - 1
+ am_max_gid=$am_max_uid
+ # The $UID and $GID variables are not portable, so we need to resort
+ # to the POSIX-mandated id(1) utility. Errors in the 'id' calls
+ # below are definitely unexpected, so allow the users to see them
+ # (that is, avoid stderr redirection).
+ am_uid=`id -u || echo unknown`
+ am_gid=`id -g || echo unknown`
+ AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
+ if test $am_uid -le $am_max_uid; then
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+ _am_tools=none
+ fi
+ AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
+ if test $am_gid -le $am_max_gid; then
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+ _am_tools=none
+ fi],
+
+ [pax],
+ [],
+
+ [m4_fatal([Unknown tar format])])
+
+ AC_MSG_CHECKING([how to create a $1 tar archive])
+
+ # Go ahead even if we have the value already cached. We do so because we
+ # need to set the values for the 'am__tar' and 'am__untar' variables.
+ _am_tools=${am_cv_prog_tar_$1-$_am_tools}
+
+ for _am_tool in $_am_tools; do
+ case $_am_tool in
+ gnutar)
+ for _am_tar in tar gnutar gtar; do
+ AM_RUN_LOG([$_am_tar --version]) && break
+ done
+ am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
+ am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
+ am__untar="$_am_tar -xf -"
+ ;;
+ plaintar)
+ # Must skip GNU tar: if it does not support --format= it doesn't create
+ # ustar tarball either.
+ (tar --version) >/dev/null 2>&1 && continue
+ am__tar='tar chf - "$$tardir"'
+ am__tar_='tar chf - "$tardir"'
+ am__untar='tar xf -'
+ ;;
+ pax)
+ am__tar='pax -L -x $1 -w "$$tardir"'
+ am__tar_='pax -L -x $1 -w "$tardir"'
+ am__untar='pax -r'
+ ;;
+ cpio)
+ am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
+ am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
+ am__untar='cpio -i -H $1 -d'
+ ;;
+ none)
+ am__tar=false
+ am__tar_=false
+ am__untar=false
+ ;;
+ esac
+
+ # If the value was cached, stop now. We just wanted to have am__tar
+ # and am__untar set.
+ test -n "${am_cv_prog_tar_$1}" && break
+
+ # tar/untar a dummy directory, and stop if the command works.
+ rm -rf conftest.dir
+ mkdir conftest.dir
+ echo GrepMe > conftest.dir/file
+ AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
+ rm -rf conftest.dir
+ if test -s conftest.tar; then
+ AM_RUN_LOG([$am__untar <conftest.tar])
+ AM_RUN_LOG([cat conftest.dir/file])
+ grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
+ fi
+ done
+ rm -rf conftest.dir
+
+ AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
+ AC_MSG_RESULT([$am_cv_prog_tar_$1])])
+
+AC_SUBST([am__tar])
+AC_SUBST([am__untar])
+]) # _AM_PROG_TAR
+
+m4_include([m4/libtool.m4])
+m4_include([m4/ltoptions.m4])
+m4_include([m4/ltsugar.m4])
+m4_include([m4/ltversion.m4])
+m4_include([m4/lt~obsolete.m4])
diff --git a/ax_python_devel.m4 b/ax_python_devel.m4
new file mode 100644
index 0000000..0740c64
--- /dev/null
+++ b/ax_python_devel.m4
@@ -0,0 +1,323 @@
+# ===========================================================================
+# http://www.nongnu.org/autoconf-archive/ax_python_devel.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+# AX_PYTHON_DEVEL([version])
+#
+# DESCRIPTION
+#
+# Note: Defines as a precious variable "PYTHON_VERSION". Don't override it
+# in your configure.ac.
+#
+# This macro checks for Python and tries to get the include path to
+# 'Python.h'. It provides the $(PYTHON_CPPFLAGS) and $(PYTHON_LDFLAGS)
+# output variables. It also exports $(PYTHON_EXTRA_LIBS) and
+# $(PYTHON_EXTRA_LDFLAGS) for embedding Python in your code.
+#
+# You can search for some particular version of Python by passing a
+# parameter to this macro, for example ">= '2.3.1'", or "== '2.4'". Please
+# note that you *have* to pass also an operator along with the version to
+# match, and pay special attention to the single quotes surrounding the
+# version number. Don't use "PYTHON_VERSION" for this: that environment
+# variable is declared as precious and thus reserved for the end-user.
+#
+# This macro should work for all versions of Python >= 2.1.0. As an end
+# user, you can disable the check for the python version by setting the
+# PYTHON_NOVERSIONCHECK environment variable to something else than the
+# empty string.
+#
+# If you need to use this macro for an older Python version, please
+# contact the authors. We're always open for feedback.
+#
+# LICENSE
+#
+# Copyright (c) 2009 Sebastian Huber <sebastian-huber@web.de>
+# Copyright (c) 2009 Alan W. Irwin <irwin@beluga.phys.uvic.ca>
+# Copyright (c) 2009 Rafael Laboissiere <rafael@laboissiere.net>
+# Copyright (c) 2009 Andrew Collier <colliera@ukzn.ac.za>
+# Copyright (c) 2009 Matteo Settenvini <matteo@member.fsf.org>
+# Copyright (c) 2009 Horst Knorr <hk_classes@knoda.org>
+#
+# This program is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation, either version 3 of the License, or (at your
+# option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+# Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# As a special exception, the respective Autoconf Macro's copyright owner
+# gives unlimited permission to copy, distribute and modify the configure
+# scripts that are the output of Autoconf when processing the Macro. You
+# need not follow the terms of the GNU General Public License when using
+# or distributing such scripts, even though portions of the text of the
+# Macro appear in them. The GNU General Public License (GPL) does govern
+# all other use of the material that constitutes the Autoconf Macro.
+#
+# This special exception to the GPL applies to versions of the Autoconf
+# Macro released by the Autoconf Archive. When you make and distribute a
+# modified version of the Autoconf Macro, you may extend this special
+# exception to the GPL to apply to your modified version as well.
+
+AU_ALIAS([AC_PYTHON_DEVEL], [AX_PYTHON_DEVEL])
+AC_DEFUN([AX_PYTHON_DEVEL],[
+ #
+ # Allow the use of a (user set) custom python version
+ #
+ AC_ARG_VAR([PYTHON_VERSION],[The installed Python
+ version to use, for example '2.3'. This string
+ will be appended to the Python interpreter
+ canonical name.])
+
+ AC_PATH_PROG([PYTHON],[python[$PYTHON_VERSION]])
+ if test -z "$PYTHON"; then
+ AC_MSG_ERROR([Cannot find python$PYTHON_VERSION in your system path])
+ PYTHON_VERSION=""
+ fi
+
+ #
+ # Check for a version of Python >= 2.1.0
+ #
+ AC_MSG_CHECKING([for a version of Python >= '2.1.0'])
+ ac_supports_python_ver=`$PYTHON -c "import sys; \
+ ver = sys.version.split ()[[0]]; \
+ print (ver >= '2.1.0')"`
+ if test "$ac_supports_python_ver" != "True"; then
+ if test -z "$PYTHON_NOVERSIONCHECK"; then
+ AC_MSG_RESULT([no])
+ AC_MSG_FAILURE([
+This version of the AC@&t@_PYTHON_DEVEL macro
+doesn't work properly with versions of Python before
+2.1.0. You may need to re-run configure, setting the
+variables PYTHON_CPPFLAGS, PYTHON_LDFLAGS, PYTHON_SITE_PKG,
+PYTHON_EXTRA_LIBS and PYTHON_EXTRA_LDFLAGS by hand.
+Moreover, to disable this check, set PYTHON_NOVERSIONCHECK
+to something else than an empty string.
+])
+ else
+ AC_MSG_RESULT([skip at user request])
+ fi
+ else
+ AC_MSG_RESULT([yes])
+ fi
+
+ #
+ # if the macro parameter ``version'' is set, honour it
+ #
+ if test -n "$1"; then
+ AC_MSG_CHECKING([for a version of Python $1])
+ ac_supports_python_ver=`$PYTHON -c "import sys; \
+ ver = sys.version.split ()[[0]]; \
+ print (ver $1)"`
+ if test "$ac_supports_python_ver" = "True"; then
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+ AC_MSG_ERROR([this package requires Python $1.
+If you have it installed, but it isn't the default Python
+interpreter in your system path, please pass the PYTHON_VERSION
+variable to configure. See ``configure --help'' for reference.
+])
+ PYTHON_VERSION=""
+ fi
+ fi
+
+ #
+ # Check if you have distutils, else fail
+ #
+ AC_MSG_CHECKING([for the distutils Python package])
+ ac_distutils_result=`$PYTHON -c "import distutils" 2>&1`
+ if test -z "$ac_distutils_result"; then
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+ AC_MSG_ERROR([cannot import Python module "distutils".
+Please check your Python installation. The error was:
+$ac_distutils_result])
+ PYTHON_VERSION=""
+ fi
+
+ #
+ # Check for Python include path
+ #
+ AC_MSG_CHECKING([for Python include path])
+ if test -z "$PYTHON_CPPFLAGS"; then
+ python_path=`$PYTHON -c "import distutils.sysconfig; \
+ print (distutils.sysconfig.get_python_inc ());"`
+ if test -n "${python_path}"; then
+ python_path="-I$python_path"
+ fi
+ PYTHON_CPPFLAGS=$python_path
+ fi
+ AC_MSG_RESULT([$PYTHON_CPPFLAGS])
+ AC_SUBST([PYTHON_CPPFLAGS])
+
+ #
+ # Check for Python library path
+ #
+ AC_MSG_CHECKING([for Python library path])
+ if test -z "$PYTHON_LDFLAGS"; then
+ # (makes two attempts to ensure we've got a version number
+ # from the interpreter)
+ ac_python_version=`cat<<EOD | $PYTHON -
+
+# join all versioning strings, on some systems
+# major/minor numbers could be in different list elements
+from distutils.sysconfig import *
+ret = ''
+for e in get_config_vars ('VERSION'):
+ if (e != None):
+ ret += e
+print (ret)
+EOD`
+
+ if test -z "$ac_python_version"; then
+ if test -n "$PYTHON_VERSION"; then
+ ac_python_version=$PYTHON_VERSION
+ else
+ ac_python_version=`$PYTHON -c "import sys; \
+ print (sys.version[[:3]])"`
+ fi
+ fi
+
+ # Make the versioning information available to the compiler
+ AC_DEFINE_UNQUOTED([HAVE_PYTHON], ["$ac_python_version"],
+ [If available, contains the Python version number currently in use.])
+
+ # First, the library directory:
+ ac_python_libdir=`cat<<EOD | $PYTHON -
+
+# There should be only one
+import distutils.sysconfig
+for e in distutils.sysconfig.get_config_vars ('LIBDIR'):
+ if e != None:
+ print (e)
+ break
+EOD`
+
+ # Before checking for libpythonX.Y, we need to know
+ # the extension the OS we're on uses for libraries
+ # (we take the first one, if there's more than one fix me!):
+ ac_python_soext=`$PYTHON -c \
+ "import distutils.sysconfig; \
+ print (distutils.sysconfig.get_config_vars('SO')[[0]])"`
+
+ # Now, for the library:
+ ac_python_soname=`$PYTHON -c \
+ "import distutils.sysconfig; \
+ print (distutils.sysconfig.get_config_vars('LDLIBRARY')[[0]])"`
+
+ # Strip away extension from the end to canonicalize its name:
+ ac_python_library=`echo "$ac_python_soname" | sed "s/${ac_python_soext}$//"`
+
+ # This small piece shamelessly adapted from PostgreSQL python macro;
+ # credits goes to momjian, I think. I'd like to put the right name
+ # in the credits, if someone can point me in the right direction... ?
+ #
+ if test -n "$ac_python_libdir" -a -n "$ac_python_library" \
+ -a x"$ac_python_library" != x"$ac_python_soname"
+ then
+ # use the official shared library
+ ac_python_library=`echo "$ac_python_library" | sed "s/^lib//"`
+ PYTHON_LDFLAGS="-L$ac_python_libdir -l$ac_python_library"
+ else
+ # old way: use libpython from python_configdir
+ ac_python_libdir=`$PYTHON -c \
+ "from distutils.sysconfig import get_python_lib as f; \
+ import os; \
+ print (os.path.join(f(plat_specific=1, standard_lib=1), 'config'));"`
+ PYTHON_LDFLAGS="-L$ac_python_libdir -lpython$ac_python_version"
+ fi
+
+ if test -z "PYTHON_LDFLAGS"; then
+ AC_MSG_ERROR([
+ Cannot determine location of your Python DSO. Please check it was installed with
+ dynamic libraries enabled, or try setting PYTHON_LDFLAGS by hand.
+ ])
+ fi
+ fi
+ AC_MSG_RESULT([$PYTHON_LDFLAGS])
+ AC_SUBST([PYTHON_LDFLAGS])
+
+ #
+ # Check for site packages
+ #
+ AC_MSG_CHECKING([for Python site-packages path])
+ if test -z "$PYTHON_SITE_PKG"; then
+ PYTHON_SITE_PKG=`$PYTHON -c "import distutils.sysconfig; \
+ print (distutils.sysconfig.get_python_lib(0,0));"`
+ fi
+ AC_MSG_RESULT([$PYTHON_SITE_PKG])
+ AC_SUBST([PYTHON_SITE_PKG])
+
+ #
+ # libraries which must be linked in when embedding
+ #
+ AC_MSG_CHECKING(python extra libraries)
+ if test -z "$PYTHON_EXTRA_LIBS"; then
+ PYTHON_EXTRA_LIBS=`$PYTHON -c "import distutils.sysconfig; \
+ conf = distutils.sysconfig.get_config_var; \
+ print (conf('LOCALMODLIBS') + ' ' + conf('LIBS'))"`
+ fi
+ AC_MSG_RESULT([$PYTHON_EXTRA_LIBS])
+ AC_SUBST(PYTHON_EXTRA_LIBS)
+
+ #
+ # linking flags needed when embedding
+ #
+ AC_MSG_CHECKING(python extra linking flags)
+ if test -z "$PYTHON_EXTRA_LDFLAGS"; then
+ PYTHON_EXTRA_LDFLAGS=`$PYTHON -c "import distutils.sysconfig; \
+ conf = distutils.sysconfig.get_config_var; \
+ print (conf('LINKFORSHARED'))"`
+ fi
+ AC_MSG_RESULT([$PYTHON_EXTRA_LDFLAGS])
+ AC_SUBST(PYTHON_EXTRA_LDFLAGS)
+
+ #
+ # final check to see if everything compiles alright
+ #
+ AC_MSG_CHECKING([consistency of all components of python development environment])
+ # save current global flags
+ ac_save_LIBS="$LIBS"
+ ac_save_CPPFLAGS="$CPPFLAGS"
+ LIBS="$ac_save_LIBS $PYTHON_LDFLAGS $PYTHON_EXTRA_LDFLAGS $PYTHON_EXTRA_LIBS"
+ CPPFLAGS="$ac_save_CPPFLAGS $PYTHON_CPPFLAGS"
+ AC_LANG_PUSH([C])
+ AC_LINK_IFELSE([
+ AC_LANG_PROGRAM([[#include <Python.h>]],
+ [[Py_Initialize();]])
+ ],[pythonexists=yes],[pythonexists=no])
+ AC_LANG_POP([C])
+ # turn back to default flags
+ CPPFLAGS="$ac_save_CPPFLAGS"
+ LIBS="$ac_save_LIBS"
+
+ AC_MSG_RESULT([$pythonexists])
+
+ if test ! "x$pythonexists" = "xyes"; then
+ AC_MSG_FAILURE([
+ Could not link test program to Python. Maybe the main Python library has been
+ installed in some non-standard library path. If so, pass it to configure,
+ via the LDFLAGS environment variable.
+ Example: ./configure LDFLAGS="-L/usr/non-standard-path/python/lib"
+ ============================================================================
+ ERROR!
+ You probably have to install the development version of the Python package
+ for your distribution. The exact name of this package varies among them.
+ ============================================================================
+ ])
+ PYTHON_VERSION=""
+ fi
+
+ #
+ # all done!
+ #
+])
diff --git a/bootstrap b/bootstrap
new file mode 100755
index 0000000..93723b7
--- /dev/null
+++ b/bootstrap
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+# $Id: bootstrap 1044 2009-09-23 04:34:38Z michael $
+# $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/bootstrap $
+
+# exit on errors
+set -e
+
+# set nicer prompt for tracing
+PS4="$0:\$LINENO> "
+set -x
+
+aclocal
+libtoolize --copy --force
+autoheader
+automake --add-missing --copy --foreign
+autoconf
+
diff --git a/cfg.c b/cfg.c
new file mode 100644
index 0000000..45892fd
--- /dev/null
+++ b/cfg.c
@@ -0,0 +1,714 @@
+/* $Id: cfg.c 1109 2010-02-12 13:16:27Z mjona $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/cfg.c $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/cfg.c $
+ *
+ * config file stuff
+ *
+ * Copyright (C) 1999, 2000 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2004, 2009 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ * exported functions:
+ *
+ * cfg_init (source)
+ * read configuration from source
+ * returns 0 if successful
+ * returns -1 in case of an error
+ *
+ * cfg_source (void)
+ * returns the file the configuration was read from
+ *
+ * cfg_cmd (arg)
+ * allows us to overwrite entries in the
+ * config-file from the command line.
+ * arg is 'key=value'
+ * cfg_cmd can be called _before_ cfg_read()
+ * returns 0 if ok, -1 if arg cannot be parsed
+ *
+ * cfg_list (section)
+ * returns a list of all keys in the specified section
+ * This list was allocated be cfg_list() and must be
+ * freed by the caller!
+ *
+ * cfg_rename (section, old, new)
+ * changes the key of a existing entry
+ *
+ * cfg_get_raw (section, key, defval)
+ * return the a value for a given key in a given section
+ * or <defval> if key does not exist. Does NOT evaluate
+ * the expression. Therefore used to get the expression
+ * itself!
+ *
+ * cfg_get (section, key, defval)
+ * return the a value for a given key in a given section
+ * or <defval> if key does not exist. The specified
+ * value in the config is treated as a expression and
+ * is evaluated!
+ *
+ * cfg_number (section, key, defval, min, int max, *value)
+ * return the a value for a given key in a given section
+ * convert it into a number with syntax checking
+ * check if its in a given range. As it uses cfg_get()
+ * internally, the evaluator is used here, too.
+ *
+ */
+
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+#include <errno.h>
+
+#include <unistd.h>
+#include <sys/stat.h>
+
+#include "debug.h"
+#include "evaluator.h"
+#include "cfg.h"
+
+#ifdef WITH_DMALLOC
+#include <dmalloc.h>
+#endif
+
+typedef struct {
+ char *key;
+ char *val;
+ int lock;
+} ENTRY;
+
+
+static char *Config_File = NULL;
+static ENTRY *Config = NULL;
+static int nConfig = 0;
+
+
+/* bsearch compare function for config entries */
+static int c_lookup(const void *a, const void *b)
+{
+ char *key = (char *) a;
+ ENTRY *entry = (ENTRY *) b;
+
+ return strcasecmp(key, entry->key);
+}
+
+
+/* qsort compare function for variables */
+static int c_sort(const void *a, const void *b)
+{
+ ENTRY *ea = (ENTRY *) a;
+ ENTRY *eb = (ENTRY *) b;
+
+ return strcasecmp(ea->key, eb->key);
+}
+
+
+/* remove leading and trailing whitespace */
+static char *strip(char *s, const int strip_comments)
+{
+ char *p;
+
+ while (isblank(*s))
+ s++;
+
+ for (p = s; *p; p++) {
+ if (*p == '"')
+ do
+ p++;
+ while (*p && *p != '\n' && *p != '\r' && *p != '"');
+ if (*p == '\'')
+ do
+ p++;
+ while (*p && *p != '\n' && *p != '\r' && *p != '\'');
+ if (*p == '\n' || (strip_comments && *p == '#' && (p == s || *(p - 1) != '\\'))) {
+ *p = '\0';
+ break;
+ }
+ if (*p == '\r' && *(p + 1) == '\n') {
+ /* replace <CR> from DOS <CR><LF> with blank */
+ *p = ' ';
+ }
+ }
+
+ for (p--; p > s && isblank(*p); p--)
+ *p = '\0';
+
+ return s;
+}
+
+
+/* which if a string contains only valid chars */
+/* i.e. start with a char and contains chars and nums */
+static int validchars(const char *string, const int numstart)
+{
+ const char *c;
+
+ for (c = string; *c; c++) {
+ /* first and following chars */
+ if ((*c >= 'A' && *c <= 'Z') || (*c >= 'a' && *c <= 'z') || (*c == '_'))
+ continue;
+ /* number as first or following char */
+ if ((numstart || c > string) && *c >= '0' && *c <= '9')
+ continue;
+ /* only following chars */
+ if ((c > string) && ((*c == '.') || (*c == '-')))
+ continue;
+ return 0;
+ }
+ return 1;
+}
+
+
+static void cfg_add(const char *section, const char *key, const char *val, const int lock)
+{
+ char *buffer;
+ ENTRY *entry;
+
+ /* allocate buffer */
+ buffer = malloc(strlen(section) + strlen(key) + 2);
+ *buffer = '\0';
+
+ /* prepare section.key */
+ if (section != NULL && *section != '\0') {
+ strcpy(buffer, section);
+ strcat(buffer, ".");
+ }
+ strcat(buffer, key);
+
+ /* does the key already exist? */
+ entry = bsearch(buffer, Config, nConfig, sizeof(ENTRY), c_lookup);
+
+ if (entry != NULL) {
+ if (entry->lock > lock)
+ return;
+ debug("Warning: key <%s>: value <%s> overwritten with <%s>", buffer, entry->val, val);
+ free(buffer);
+ if (entry->val)
+ free(entry->val);
+ entry->val = strdup(val);
+ return;
+ }
+
+ nConfig++;
+ Config = realloc(Config, nConfig * sizeof(ENTRY));
+ Config[nConfig - 1].key = buffer;
+ Config[nConfig - 1].val = strdup(val);
+ Config[nConfig - 1].lock = lock;
+
+ qsort(Config, nConfig, sizeof(ENTRY), c_sort);
+
+}
+
+
+int cfg_cmd(const char *arg)
+{
+ char *key, *val;
+ char *buffer;
+
+ buffer = strdup(arg);
+ key = strip(buffer, 0);
+ for (val = key; *val; val++) {
+ if (*val == '=') {
+ *val++ = '\0';
+ break;
+ }
+ }
+ if (*key == '\0' || *val == '\0') {
+ free(buffer);
+ return -1;
+ }
+
+ if (!validchars(key, 0)) {
+ free(buffer);
+ return -1;
+ }
+
+ cfg_add("", key, val, 1);
+
+ free(buffer);
+ return 0;
+}
+
+
+char *cfg_list(const char *section)
+{
+ int i, len;
+ char *key, *list;
+
+ /* calculate key length */
+ len = strlen(section) + 1;
+
+ /* prepare search key */
+ key = malloc(len + 1);
+ strcpy(key, section);
+ strcat(key, ".");
+
+ /* start with empty string */
+ list = malloc(1);
+ *list = '\0';
+
+ /* search matching entries */
+ for (i = 0; i < nConfig; i++) {
+ if (strncasecmp(Config[i].key, key, len) == 0) {
+ list = realloc(list, strlen(list) + strlen(Config[i].key) - len + 2);
+ if (*list != '\0')
+ strcat(list, "|");
+ strcat(list, Config[i].key + len);
+ }
+ }
+
+ free(key);
+ return list;
+}
+
+
+int cfg_rename(const char *section, const char *old, const char *new)
+{
+ char *buffer;
+ ENTRY *old_entry, *new_entry;
+
+ /* prepare old section.key */
+ buffer = malloc(strlen(section) + strlen(old) + 2);
+ *buffer = '\0';
+ if (section != NULL && *section != '\0') {
+ strcpy(buffer, section);
+ strcat(buffer, ".");
+ }
+ strcat(buffer, old);
+
+ /* lookup old entry */
+ old_entry = bsearch(buffer, Config, nConfig, sizeof(ENTRY), c_lookup);
+ free(buffer);
+
+ if (old_entry == NULL) {
+ error("internal error: cfg_rename(%s, %s, %s) failed: entry not found!", section, old, new);
+ return -1;
+ }
+
+ /* prepare new section.key */
+ buffer = malloc(strlen(section) + strlen(new) + 2);
+ *buffer = '\0';
+ if (section != NULL && *section != '\0') {
+ strcpy(buffer, section);
+ strcat(buffer, ".");
+ }
+ strcat(buffer, new);
+
+ /* lookup new entry */
+ new_entry = bsearch(buffer, Config, nConfig, sizeof(ENTRY), c_lookup);
+
+ if (new_entry != NULL) {
+ info("cfg_rename(%s, %s, %s) failed: entry already exists!", section, old, new);
+ free(buffer);
+ return -1;
+ }
+
+ /* replace key */
+ free(old_entry->key);
+ old_entry->key = buffer;
+
+ /* sort table again */
+ qsort(Config, nConfig, sizeof(ENTRY), c_sort);
+
+ return 0;
+}
+
+
+static char *cfg_lookup(const char *section, const char *key)
+{
+ int len;
+ char *buffer;
+ ENTRY *entry;
+
+ /* calculate key length */
+ len = strlen(key) + 1;
+ if (section != NULL)
+ len += strlen(section) + 1;
+
+ /* allocate buffer */
+ buffer = malloc(len);
+ *buffer = '\0';
+
+ /* prepare section:key */
+ if (section != NULL && *section != '\0') {
+ strcpy(buffer, section);
+ strcat(buffer, ".");
+ }
+ strcat(buffer, key);
+
+ /* search entry */
+ entry = bsearch(buffer, Config, nConfig, sizeof(ENTRY), c_lookup);
+
+ /* free buffer again */
+ free(buffer);
+
+ if (entry != NULL)
+ return entry->val;
+
+ return NULL;
+}
+
+
+char *cfg_get_raw(const char *section, const char *key, const char *defval)
+{
+ char *val = cfg_lookup(section, key);
+
+ if (val != NULL)
+ return val;
+
+ return (char *) defval;
+}
+
+
+char *cfg_get(const char *section, const char *key, const char *defval)
+{
+ char *expression;
+ char *retval;
+ void *tree = NULL;
+ RESULT result = { 0, 0, 0, NULL };
+
+ expression = cfg_lookup(section, key);
+
+ if (expression != NULL) {
+ if (*expression == '\0')
+ return strdup("");
+ if (Compile(expression, &tree) == 0 && Eval(tree, &result) == 0) {
+ retval = strdup(R2S(&result));
+ DelTree(tree);
+ DelResult(&result);
+ return (retval);
+ }
+ DelTree(tree);
+ DelResult(&result);
+ }
+ if (defval)
+ return strdup(defval);
+ return NULL;
+}
+
+
+int cfg_number(const char *section, const char *key, const int defval, const int min, const int max, int *value)
+{
+ char *expression;
+ void *tree = NULL;
+ RESULT result = { 0, 0, 0, NULL };
+
+ /* start with default value */
+ /* in case of an (uncatched) error, you have the */
+ /* default value set, which may be handy... */
+ *value = defval;
+
+ expression = cfg_get_raw(section, key, NULL);
+ if (expression == NULL || *expression == '\0') {
+ return 0;
+ }
+
+ if (Compile(expression, &tree) != 0) {
+ DelTree(tree);
+ return -1;
+ }
+ if (Eval(tree, &result) != 0) {
+ DelTree(tree);
+ DelResult(&result);
+ return -1;
+ }
+ *value = R2N(&result);
+ DelTree(tree);
+ DelResult(&result);
+
+ if (*value < min) {
+ error("bad '%s.%s' value '%d' in %s, minimum is %d", section, key, *value, cfg_source(), min);
+ *value = min;
+ return -1;
+ }
+
+ if (max > min && max != -1 && *value > max) {
+ error("bad '%s.%s' value '%d' in %s, maximum is %d", section, key, *value, cfg_source(), max);
+ *value = max;
+ return -1;
+ }
+
+ return 1;
+}
+
+
+static int cfg_check_source(const char *file)
+{
+ /* as passwords and commands are stored in the config file,
+ * we will check that:
+ * - file is a normal file (or /dev/null)
+ * - file owner is owner of program
+ * - file is not accessible by group
+ * - file is not accessible by other
+ */
+
+ struct stat stbuf;
+ uid_t uid, gid;
+ int error;
+
+ uid = geteuid();
+ gid = getegid();
+
+ if (stat(file, &stbuf) == -1) {
+ error("stat(%s) failed: %s", file, strerror(errno));
+ return -1;
+ }
+ if (S_ISCHR(stbuf.st_mode) && strcmp(file, "/dev/null") == 0)
+ return 0;
+
+ error = 0;
+ if (!S_ISREG(stbuf.st_mode)) {
+ error("security error: '%s' is not a regular file", file);
+ error = -1;
+ }
+ if (stbuf.st_uid != uid || stbuf.st_gid != gid) {
+ error("security error: owner and/or group of '%s' don't match", file);
+ error = -1;
+ }
+#if ! defined(__CYGWIN__)
+ if (stbuf.st_mode & S_IRWXG || stbuf.st_mode & S_IRWXO) {
+ error("security error: group or other have access to '%s'", file);
+ error = -1;
+ }
+#endif
+ return error;
+}
+
+
+static int cfg_read(const char *file)
+{
+ FILE *stream;
+ char buffer[256];
+ char section[256];
+ char *line, *key, *val, *end;
+ int section_open, section_close;
+ int error, lineno;
+
+ stream = fopen(file, "r");
+ if (stream == NULL) {
+ error("open(%s) failed: %s", file, strerror(errno));
+ return -1;
+ }
+
+ /* start with empty section */
+ strcpy(section, "");
+
+ error = 0;
+ lineno = 0;
+ while ((line = fgets(buffer, 256, stream)) != NULL) {
+
+ /* increment line number */
+ lineno++;
+
+ /* skip empty lines */
+ if (*(line = strip(line, 1)) == '\0')
+ continue;
+
+ /* reset section flags */
+ section_open = 0;
+ section_close = 0;
+
+ /* key is first word */
+ key = line;
+
+ /* search first blank between key and value */
+ for (val = line; *val; val++) {
+ if (isblank(*val)) {
+ *val++ = '\0';
+ break;
+ }
+ }
+
+ /* strip value */
+ val = strip(val, 1);
+
+ /* search end of value */
+ if (*val)
+ for (end = val; *(end + 1); end++);
+ else
+ end = val;
+
+ /* if last char is '{', a section has been opened */
+ if (*end == '{') {
+ section_open = 1;
+ *end = '\0';
+ val = strip(val, 0);
+ }
+
+ /* provess "value" in double-quotes */
+ if (*val == '"' && *end == '"') {
+ *end = '\0';
+ val++;
+ }
+
+ /* if key is '}', a section has been closed */
+ if (strcmp(key, "}") == 0) {
+ section_close = 1;
+ *key = '\0';
+ }
+
+ /* sanity check: '}' should be the only char in a line */
+ if (section_close && (section_open || *val != '\0')) {
+ error("error in config file '%s' line %d: garbage after '}'", file, lineno);
+ error = 1;
+ break;
+ }
+
+ /* check key for valid chars */
+ if (!validchars(key, 0)) {
+ error("error in config file '%s' line %d: key '%s' is invalid", file, lineno, key);
+ error = 1;
+ break;
+ }
+
+ /* on section-open, check value for valid chars */
+ if (section_open && !validchars(val, 1)) {
+ error("error in config file '%s' line %d: section '%s' is invalid", file, lineno, val);
+ error = 1;
+ break;
+ }
+
+ /* on section-open, append new section name */
+ if (section_open) {
+ /* is the section[] array big enough? */
+ if (strlen(section) + strlen(key) + 3 > sizeof(section)) {
+ error("error in config file '%s' line %d: section buffer overflow", file, lineno);
+ error = 1;
+ break;
+ }
+ if (*section != '\0')
+ strcat(section, ".");
+ strcat(section, key);
+ if (*val != '\0') {
+ strcat(section, ":");
+ strcat(section, val);
+ }
+ continue;
+ }
+
+ /* on section-close, remove last section name */
+ if (section_close) {
+ /* sanity check: section already empty? */
+ if (*section == '\0') {
+ error("error in config file '%s' line %d: unmatched closing brace", file, lineno);
+ error = 1;
+ break;
+ }
+
+ end = strrchr(section, '.');
+ if (end == NULL)
+ *section = '\0';
+ else
+ *end = '\0';
+ continue;
+ }
+
+ /* finally: add key */
+ cfg_add(section, key, val, 0);
+
+ }
+
+ /* sanity check: are the braces balanced? */
+ if (!error && *section != '\0') {
+ error("error in config file '%s' line %d: unbalanced braces", file, lineno);
+ error = 1;
+ }
+
+ fclose(stream);
+
+ return -error;
+}
+
+
+static void cfg_dump(void)
+{
+ int i, len;
+
+ /* find longest key for pretty output */
+ len = 1;
+ for (i = 0; i < nConfig; i++) {
+ int l = strlen(Config[i].key);
+ if (l > len)
+ len = l;
+ }
+
+ info("Dump of %s:", Config_File);
+ for (i = 0; i < nConfig; i++) {
+ info(" %-*s %s", len, Config[i].key, Config[i].val);
+ }
+ info(" ");
+}
+
+
+int cfg_init(const char *file)
+{
+ if (cfg_check_source(file) == -1) {
+ return -1;
+ }
+
+ if (cfg_read(file) < 0)
+ return -1;
+
+ if (Config_File)
+ free(Config_File);
+
+ Config_File = strdup(file);
+
+ if (verbose_level > 1)
+ cfg_dump();
+
+ return 0;
+}
+
+
+char *cfg_source(void)
+{
+ if (Config_File)
+ return Config_File;
+ else
+ return "";
+}
+
+
+int cfg_exit(void)
+{
+ int i;
+ for (i = 0; i < nConfig; i++) {
+ if (Config[i].key)
+ free(Config[i].key);
+ if (Config[i].val)
+ free(Config[i].val);
+ }
+
+ if (Config) {
+ free(Config);
+ Config = NULL;
+ }
+
+ if (Config_File) {
+ free(Config_File);
+ Config_File = NULL;
+ }
+
+ return 0;
+}
diff --git a/cfg.h b/cfg.h
new file mode 100644
index 0000000..ccaddf2
--- /dev/null
+++ b/cfg.h
@@ -0,0 +1,40 @@
+/* $Id: cfg.h 967 2009-01-15 15:15:24Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/cfg.h $
+ *
+ * config file stuff
+ *
+ * Copyright (C) 1999, 2000 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2004, 2009 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+#ifndef _CFG_H_
+#define _CFG_H_
+
+int cfg_init(const char *file);
+char *cfg_source(void);
+int cfg_cmd(const char *arg);
+char *cfg_list(const char *section);
+int cfg_rename(const char *section, const char *old, const char *new);
+char *cfg_get_raw(const char *section, const char *key, const char *defval);
+char *cfg_get(const char *section, const char *key, const char *defval);
+int cfg_number(const char *section, const char *key, const int defval, const int min, const int max, int *value);
+int cfg_exit(void);
+
+#endif
diff --git a/config.guess b/config.guess
new file mode 100755
index 0000000..f32079a
--- /dev/null
+++ b/config.guess
@@ -0,0 +1,1526 @@
+#! /bin/sh
+# Attempt to guess a canonical system name.
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
+# Free Software Foundation, Inc.
+
+timestamp='2008-01-23'
+
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+# 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+
+# Originally written by Per Bothner <per@bothner.com>.
+# Please send patches to <config-patches@gnu.org>. Submit a context
+# diff and a properly formatted ChangeLog entry.
+#
+# This script attempts to guess a canonical system name similar to
+# config.sub. If it succeeds, it prints the system name on stdout, and
+# exits with 0. Otherwise, it exits with 1.
+#
+# The plan is that this can be called by configure scripts if you
+# don't specify an explicit build system type.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION]
+
+Output the configuration name of the system \`$me' is run on.
+
+Operation modes:
+ -h, --help print this help, then exit
+ -t, --time-stamp print date of last modification, then exit
+ -v, --version print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.guess ($timestamp)
+
+Originally written by Per Bothner.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
+2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions. There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+ case $1 in
+ --time-stamp | --time* | -t )
+ echo "$timestamp" ; exit ;;
+ --version | -v )
+ echo "$version" ; exit ;;
+ --help | --h* | -h )
+ echo "$usage"; exit ;;
+ -- ) # Stop option processing
+ shift; break ;;
+ - ) # Use stdin as input.
+ break ;;
+ -* )
+ echo "$me: invalid option $1$help" >&2
+ exit 1 ;;
+ * )
+ break ;;
+ esac
+done
+
+if test $# != 0; then
+ echo "$me: too many arguments$help" >&2
+ exit 1
+fi
+
+trap 'exit 1' 1 2 15
+
+# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
+# compiler to aid in system detection is discouraged as it requires
+# temporary files to be created and, as you can see below, it is a
+# headache to deal with in a portable fashion.
+
+# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
+# use `HOST_CC' if defined, but it is deprecated.
+
+# Portable tmp directory creation inspired by the Autoconf team.
+
+set_cc_for_build='
+trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
+trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
+: ${TMPDIR=/tmp} ;
+ { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
+ { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
+ { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
+ { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
+dummy=$tmp/dummy ;
+tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
+case $CC_FOR_BUILD,$HOST_CC,$CC in
+ ,,) echo "int x;" > $dummy.c ;
+ for c in cc gcc c89 c99 ; do
+ if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
+ CC_FOR_BUILD="$c"; break ;
+ fi ;
+ done ;
+ if test x"$CC_FOR_BUILD" = x ; then
+ CC_FOR_BUILD=no_compiler_found ;
+ fi
+ ;;
+ ,,*) CC_FOR_BUILD=$CC ;;
+ ,*,*) CC_FOR_BUILD=$HOST_CC ;;
+esac ; set_cc_for_build= ;'
+
+# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
+# (ghazi@noc.rutgers.edu 1994-08-24)
+if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
+ PATH=$PATH:/.attbin ; export PATH
+fi
+
+UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
+UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
+UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
+
+# Note: order is significant - the case branches are not exclusive.
+
+case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+ *:NetBSD:*:*)
+ # NetBSD (nbsd) targets should (where applicable) match one or
+ # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
+ # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
+ # switched to ELF, *-*-netbsd* would select the old
+ # object file format. This provides both forward
+ # compatibility and a consistent mechanism for selecting the
+ # object file format.
+ #
+ # Note: NetBSD doesn't particularly care about the vendor
+ # portion of the name. We always set it to "unknown".
+ sysctl="sysctl -n hw.machine_arch"
+ UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
+ /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
+ case "${UNAME_MACHINE_ARCH}" in
+ armeb) machine=armeb-unknown ;;
+ arm*) machine=arm-unknown ;;
+ sh3el) machine=shl-unknown ;;
+ sh3eb) machine=sh-unknown ;;
+ sh5el) machine=sh5le-unknown ;;
+ *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
+ esac
+ # The Operating System including object format, if it has switched
+ # to ELF recently, or will in the future.
+ case "${UNAME_MACHINE_ARCH}" in
+ arm*|i386|m68k|ns32k|sh3*|sparc|vax)
+ eval $set_cc_for_build
+ if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
+ | grep __ELF__ >/dev/null
+ then
+ # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
+ # Return netbsd for either. FIX?
+ os=netbsd
+ else
+ os=netbsdelf
+ fi
+ ;;
+ *)
+ os=netbsd
+ ;;
+ esac
+ # The OS release
+ # Debian GNU/NetBSD machines have a different userland, and
+ # thus, need a distinct triplet. However, they do not need
+ # kernel version information, so it can be replaced with a
+ # suitable tag, in the style of linux-gnu.
+ case "${UNAME_VERSION}" in
+ Debian*)
+ release='-gnu'
+ ;;
+ *)
+ release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+ ;;
+ esac
+ # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
+ # contains redundant information, the shorter form:
+ # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
+ echo "${machine}-${os}${release}"
+ exit ;;
+ *:OpenBSD:*:*)
+ UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
+ echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
+ exit ;;
+ *:ekkoBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
+ exit ;;
+ *:SolidBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
+ exit ;;
+ macppc:MirBSD:*:*)
+ echo powerpc-unknown-mirbsd${UNAME_RELEASE}
+ exit ;;
+ *:MirBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
+ exit ;;
+ alpha:OSF1:*:*)
+ case $UNAME_RELEASE in
+ *4.0)
+ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
+ ;;
+ *5.*)
+ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
+ ;;
+ esac
+ # According to Compaq, /usr/sbin/psrinfo has been available on
+ # OSF/1 and Tru64 systems produced since 1995. I hope that
+ # covers most systems running today. This code pipes the CPU
+ # types through head -n 1, so we only detect the type of CPU 0.
+ ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1`
+ case "$ALPHA_CPU_TYPE" in
+ "EV4 (21064)")
+ UNAME_MACHINE="alpha" ;;
+ "EV4.5 (21064)")
+ UNAME_MACHINE="alpha" ;;
+ "LCA4 (21066/21068)")
+ UNAME_MACHINE="alpha" ;;
+ "EV5 (21164)")
+ UNAME_MACHINE="alphaev5" ;;
+ "EV5.6 (21164A)")
+ UNAME_MACHINE="alphaev56" ;;
+ "EV5.6 (21164PC)")
+ UNAME_MACHINE="alphapca56" ;;
+ "EV5.7 (21164PC)")
+ UNAME_MACHINE="alphapca57" ;;
+ "EV6 (21264)")
+ UNAME_MACHINE="alphaev6" ;;
+ "EV6.7 (21264A)")
+ UNAME_MACHINE="alphaev67" ;;
+ "EV6.8CB (21264C)")
+ UNAME_MACHINE="alphaev68" ;;
+ "EV6.8AL (21264B)")
+ UNAME_MACHINE="alphaev68" ;;
+ "EV6.8CX (21264D)")
+ UNAME_MACHINE="alphaev68" ;;
+ "EV6.9A (21264/EV69A)")
+ UNAME_MACHINE="alphaev69" ;;
+ "EV7 (21364)")
+ UNAME_MACHINE="alphaev7" ;;
+ "EV7.9 (21364A)")
+ UNAME_MACHINE="alphaev79" ;;
+ esac
+ # A Pn.n version is a patched version.
+ # A Vn.n version is a released version.
+ # A Tn.n version is a released field test version.
+ # A Xn.n version is an unreleased experimental baselevel.
+ # 1.2 uses "1.2" for uname -r.
+ echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ exit ;;
+ Alpha\ *:Windows_NT*:*)
+ # How do we know it's Interix rather than the generic POSIX subsystem?
+ # Should we change UNAME_MACHINE based on the output of uname instead
+ # of the specific Alpha model?
+ echo alpha-pc-interix
+ exit ;;
+ 21064:Windows_NT:50:3)
+ echo alpha-dec-winnt3.5
+ exit ;;
+ Amiga*:UNIX_System_V:4.0:*)
+ echo m68k-unknown-sysv4
+ exit ;;
+ *:[Aa]miga[Oo][Ss]:*:*)
+ echo ${UNAME_MACHINE}-unknown-amigaos
+ exit ;;
+ *:[Mm]orph[Oo][Ss]:*:*)
+ echo ${UNAME_MACHINE}-unknown-morphos
+ exit ;;
+ *:OS/390:*:*)
+ echo i370-ibm-openedition
+ exit ;;
+ *:z/VM:*:*)
+ echo s390-ibm-zvmoe
+ exit ;;
+ *:OS400:*:*)
+ echo powerpc-ibm-os400
+ exit ;;
+ arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+ echo arm-acorn-riscix${UNAME_RELEASE}
+ exit ;;
+ arm:riscos:*:*|arm:RISCOS:*:*)
+ echo arm-unknown-riscos
+ exit ;;
+ SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
+ echo hppa1.1-hitachi-hiuxmpp
+ exit ;;
+ Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
+ # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
+ if test "`(/bin/universe) 2>/dev/null`" = att ; then
+ echo pyramid-pyramid-sysv3
+ else
+ echo pyramid-pyramid-bsd
+ fi
+ exit ;;
+ NILE*:*:*:dcosx)
+ echo pyramid-pyramid-svr4
+ exit ;;
+ DRS?6000:unix:4.0:6*)
+ echo sparc-icl-nx6
+ exit ;;
+ DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
+ case `/usr/bin/uname -p` in
+ sparc) echo sparc-icl-nx7; exit ;;
+ esac ;;
+ sun4H:SunOS:5.*:*)
+ echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
+ echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
+ echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ sun4*:SunOS:6*:*)
+ # According to config.sub, this is the proper way to canonicalize
+ # SunOS6. Hard to guess exactly what SunOS6 will be like, but
+ # it's likely to be more like Solaris than SunOS4.
+ echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ sun4*:SunOS:*:*)
+ case "`/usr/bin/arch -k`" in
+ Series*|S4*)
+ UNAME_RELEASE=`uname -v`
+ ;;
+ esac
+ # Japanese Language versions have a version number like `4.1.3-JL'.
+ echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
+ exit ;;
+ sun3*:SunOS:*:*)
+ echo m68k-sun-sunos${UNAME_RELEASE}
+ exit ;;
+ sun*:*:4.2BSD:*)
+ UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
+ test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
+ case "`/bin/arch`" in
+ sun3)
+ echo m68k-sun-sunos${UNAME_RELEASE}
+ ;;
+ sun4)
+ echo sparc-sun-sunos${UNAME_RELEASE}
+ ;;
+ esac
+ exit ;;
+ aushp:SunOS:*:*)
+ echo sparc-auspex-sunos${UNAME_RELEASE}
+ exit ;;
+ # The situation for MiNT is a little confusing. The machine name
+ # can be virtually everything (everything which is not
+ # "atarist" or "atariste" at least should have a processor
+ # > m68000). The system name ranges from "MiNT" over "FreeMiNT"
+ # to the lowercase version "mint" (or "freemint"). Finally
+ # the system name "TOS" denotes a system which is actually not
+ # MiNT. But MiNT is downward compatible to TOS, so this should
+ # be no problem.
+ atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit ;;
+ atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit ;;
+ *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit ;;
+ milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
+ echo m68k-milan-mint${UNAME_RELEASE}
+ exit ;;
+ hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
+ echo m68k-hades-mint${UNAME_RELEASE}
+ exit ;;
+ *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
+ echo m68k-unknown-mint${UNAME_RELEASE}
+ exit ;;
+ m68k:machten:*:*)
+ echo m68k-apple-machten${UNAME_RELEASE}
+ exit ;;
+ powerpc:machten:*:*)
+ echo powerpc-apple-machten${UNAME_RELEASE}
+ exit ;;
+ RISC*:Mach:*:*)
+ echo mips-dec-mach_bsd4.3
+ exit ;;
+ RISC*:ULTRIX:*:*)
+ echo mips-dec-ultrix${UNAME_RELEASE}
+ exit ;;
+ VAX*:ULTRIX*:*:*)
+ echo vax-dec-ultrix${UNAME_RELEASE}
+ exit ;;
+ 2020:CLIX:*:* | 2430:CLIX:*:*)
+ echo clipper-intergraph-clix${UNAME_RELEASE}
+ exit ;;
+ mips:*:*:UMIPS | mips:*:*:RISCos)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+#ifdef __cplusplus
+#include <stdio.h> /* for printf() prototype */
+ int main (int argc, char *argv[]) {
+#else
+ int main (argc, argv) int argc; char *argv[]; {
+#endif
+ #if defined (host_mips) && defined (MIPSEB)
+ #if defined (SYSTYPE_SYSV)
+ printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
+ #endif
+ #if defined (SYSTYPE_SVR4)
+ printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
+ #endif
+ #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
+ printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
+ #endif
+ #endif
+ exit (-1);
+ }
+EOF
+ $CC_FOR_BUILD -o $dummy $dummy.c &&
+ dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
+ SYSTEM_NAME=`$dummy $dummyarg` &&
+ { echo "$SYSTEM_NAME"; exit; }
+ echo mips-mips-riscos${UNAME_RELEASE}
+ exit ;;
+ Motorola:PowerMAX_OS:*:*)
+ echo powerpc-motorola-powermax
+ exit ;;
+ Motorola:*:4.3:PL8-*)
+ echo powerpc-harris-powermax
+ exit ;;
+ Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
+ echo powerpc-harris-powermax
+ exit ;;
+ Night_Hawk:Power_UNIX:*:*)
+ echo powerpc-harris-powerunix
+ exit ;;
+ m88k:CX/UX:7*:*)
+ echo m88k-harris-cxux7
+ exit ;;
+ m88k:*:4*:R4*)
+ echo m88k-motorola-sysv4
+ exit ;;
+ m88k:*:3*:R3*)
+ echo m88k-motorola-sysv3
+ exit ;;
+ AViiON:dgux:*:*)
+ # DG/UX returns AViiON for all architectures
+ UNAME_PROCESSOR=`/usr/bin/uname -p`
+ if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
+ then
+ if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
+ [ ${TARGET_BINARY_INTERFACE}x = x ]
+ then
+ echo m88k-dg-dgux${UNAME_RELEASE}
+ else
+ echo m88k-dg-dguxbcs${UNAME_RELEASE}
+ fi
+ else
+ echo i586-dg-dgux${UNAME_RELEASE}
+ fi
+ exit ;;
+ M88*:DolphinOS:*:*) # DolphinOS (SVR3)
+ echo m88k-dolphin-sysv3
+ exit ;;
+ M88*:*:R3*:*)
+ # Delta 88k system running SVR3
+ echo m88k-motorola-sysv3
+ exit ;;
+ XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
+ echo m88k-tektronix-sysv3
+ exit ;;
+ Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
+ echo m68k-tektronix-bsd
+ exit ;;
+ *:IRIX*:*:*)
+ echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
+ exit ;;
+ ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
+ echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
+ exit ;; # Note that: echo "'`uname -s`'" gives 'AIX '
+ i*86:AIX:*:*)
+ echo i386-ibm-aix
+ exit ;;
+ ia64:AIX:*:*)
+ if [ -x /usr/bin/oslevel ] ; then
+ IBM_REV=`/usr/bin/oslevel`
+ else
+ IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+ fi
+ echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
+ exit ;;
+ *:AIX:2:3)
+ if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #include <sys/systemcfg.h>
+
+ main()
+ {
+ if (!__power_pc())
+ exit(1);
+ puts("powerpc-ibm-aix3.2.5");
+ exit(0);
+ }
+EOF
+ if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
+ then
+ echo "$SYSTEM_NAME"
+ else
+ echo rs6000-ibm-aix3.2.5
+ fi
+ elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
+ echo rs6000-ibm-aix3.2.4
+ else
+ echo rs6000-ibm-aix3.2
+ fi
+ exit ;;
+ *:AIX:*:[456])
+ IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
+ if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
+ IBM_ARCH=rs6000
+ else
+ IBM_ARCH=powerpc
+ fi
+ if [ -x /usr/bin/oslevel ] ; then
+ IBM_REV=`/usr/bin/oslevel`
+ else
+ IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+ fi
+ echo ${IBM_ARCH}-ibm-aix${IBM_REV}
+ exit ;;
+ *:AIX:*:*)
+ echo rs6000-ibm-aix
+ exit ;;
+ ibmrt:4.4BSD:*|romp-ibm:BSD:*)
+ echo romp-ibm-bsd4.4
+ exit ;;
+ ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
+ echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
+ exit ;; # report: romp-ibm BSD 4.3
+ *:BOSX:*:*)
+ echo rs6000-bull-bosx
+ exit ;;
+ DPX/2?00:B.O.S.:*:*)
+ echo m68k-bull-sysv3
+ exit ;;
+ 9000/[34]??:4.3bsd:1.*:*)
+ echo m68k-hp-bsd
+ exit ;;
+ hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
+ echo m68k-hp-bsd4.4
+ exit ;;
+ 9000/[34678]??:HP-UX:*:*)
+ HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+ case "${UNAME_MACHINE}" in
+ 9000/31? ) HP_ARCH=m68000 ;;
+ 9000/[34]?? ) HP_ARCH=m68k ;;
+ 9000/[678][0-9][0-9])
+ if [ -x /usr/bin/getconf ]; then
+ sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
+ sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+ case "${sc_cpu_version}" in
+ 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
+ 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+ 532) # CPU_PA_RISC2_0
+ case "${sc_kernel_bits}" in
+ 32) HP_ARCH="hppa2.0n" ;;
+ 64) HP_ARCH="hppa2.0w" ;;
+ '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20
+ esac ;;
+ esac
+ fi
+ if [ "${HP_ARCH}" = "" ]; then
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+
+ #define _HPUX_SOURCE
+ #include <stdlib.h>
+ #include <unistd.h>
+
+ int main ()
+ {
+ #if defined(_SC_KERNEL_BITS)
+ long bits = sysconf(_SC_KERNEL_BITS);
+ #endif
+ long cpu = sysconf (_SC_CPU_VERSION);
+
+ switch (cpu)
+ {
+ case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+ case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+ case CPU_PA_RISC2_0:
+ #if defined(_SC_KERNEL_BITS)
+ switch (bits)
+ {
+ case 64: puts ("hppa2.0w"); break;
+ case 32: puts ("hppa2.0n"); break;
+ default: puts ("hppa2.0"); break;
+ } break;
+ #else /* !defined(_SC_KERNEL_BITS) */
+ puts ("hppa2.0"); break;
+ #endif
+ default: puts ("hppa1.0"); break;
+ }
+ exit (0);
+ }
+EOF
+ (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
+ test -z "$HP_ARCH" && HP_ARCH=hppa
+ fi ;;
+ esac
+ if [ ${HP_ARCH} = "hppa2.0w" ]
+ then
+ eval $set_cc_for_build
+
+ # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
+ # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler
+ # generating 64-bit code. GNU and HP use different nomenclature:
+ #
+ # $ CC_FOR_BUILD=cc ./config.guess
+ # => hppa2.0w-hp-hpux11.23
+ # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
+ # => hppa64-hp-hpux11.23
+
+ if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
+ grep __LP64__ >/dev/null
+ then
+ HP_ARCH="hppa2.0w"
+ else
+ HP_ARCH="hppa64"
+ fi
+ fi
+ echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+ exit ;;
+ ia64:HP-UX:*:*)
+ HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+ echo ia64-hp-hpux${HPUX_REV}
+ exit ;;
+ 3050*:HI-UX:*:*)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #include <unistd.h>
+ int
+ main ()
+ {
+ long cpu = sysconf (_SC_CPU_VERSION);
+ /* The order matters, because CPU_IS_HP_MC68K erroneously returns
+ true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
+ results, however. */
+ if (CPU_IS_PA_RISC (cpu))
+ {
+ switch (cpu)
+ {
+ case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
+ case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
+ case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
+ default: puts ("hppa-hitachi-hiuxwe2"); break;
+ }
+ }
+ else if (CPU_IS_HP_MC68K (cpu))
+ puts ("m68k-hitachi-hiuxwe2");
+ else puts ("unknown-hitachi-hiuxwe2");
+ exit (0);
+ }
+EOF
+ $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
+ { echo "$SYSTEM_NAME"; exit; }
+ echo unknown-hitachi-hiuxwe2
+ exit ;;
+ 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
+ echo hppa1.1-hp-bsd
+ exit ;;
+ 9000/8??:4.3bsd:*:*)
+ echo hppa1.0-hp-bsd
+ exit ;;
+ *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
+ echo hppa1.0-hp-mpeix
+ exit ;;
+ hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
+ echo hppa1.1-hp-osf
+ exit ;;
+ hp8??:OSF1:*:*)
+ echo hppa1.0-hp-osf
+ exit ;;
+ i*86:OSF1:*:*)
+ if [ -x /usr/sbin/sysversion ] ; then
+ echo ${UNAME_MACHINE}-unknown-osf1mk
+ else
+ echo ${UNAME_MACHINE}-unknown-osf1
+ fi
+ exit ;;
+ parisc*:Lites*:*:*)
+ echo hppa1.1-hp-lites
+ exit ;;
+ C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
+ echo c1-convex-bsd
+ exit ;;
+ C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
+ if getsysinfo -f scalar_acc
+ then echo c32-convex-bsd
+ else echo c2-convex-bsd
+ fi
+ exit ;;
+ C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
+ echo c34-convex-bsd
+ exit ;;
+ C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
+ echo c38-convex-bsd
+ exit ;;
+ C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
+ echo c4-convex-bsd
+ exit ;;
+ CRAY*Y-MP:*:*:*)
+ echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
+ CRAY*[A-Z]90:*:*:*)
+ echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
+ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
+ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
+ -e 's/\.[^.]*$/.X/'
+ exit ;;
+ CRAY*TS:*:*:*)
+ echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
+ CRAY*T3E:*:*:*)
+ echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
+ CRAY*SV1:*:*:*)
+ echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
+ *:UNICOS/mp:*:*)
+ echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
+ F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
+ FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+ FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+ echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+ exit ;;
+ 5000:UNIX_System_V:4.*:*)
+ FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+ FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
+ echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+ exit ;;
+ i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
+ echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+ exit ;;
+ sparc*:BSD/OS:*:*)
+ echo sparc-unknown-bsdi${UNAME_RELEASE}
+ exit ;;
+ *:BSD/OS:*:*)
+ echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+ exit ;;
+ *:FreeBSD:*:*)
+ case ${UNAME_MACHINE} in
+ pc98)
+ echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+ amd64)
+ echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+ *)
+ echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+ esac
+ exit ;;
+ i*:CYGWIN*:*)
+ echo ${UNAME_MACHINE}-pc-cygwin
+ exit ;;
+ *:MINGW*:*)
+ echo ${UNAME_MACHINE}-pc-mingw32
+ exit ;;
+ i*:windows32*:*)
+ # uname -m includes "-pc" on this system.
+ echo ${UNAME_MACHINE}-mingw32
+ exit ;;
+ i*:PW*:*)
+ echo ${UNAME_MACHINE}-pc-pw32
+ exit ;;
+ *:Interix*:[3456]*)
+ case ${UNAME_MACHINE} in
+ x86)
+ echo i586-pc-interix${UNAME_RELEASE}
+ exit ;;
+ EM64T | authenticamd)
+ echo x86_64-unknown-interix${UNAME_RELEASE}
+ exit ;;
+ IA64)
+ echo ia64-unknown-interix${UNAME_RELEASE}
+ exit ;;
+ esac ;;
+ [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
+ echo i${UNAME_MACHINE}-pc-mks
+ exit ;;
+ i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
+ # How do we know it's Interix rather than the generic POSIX subsystem?
+ # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
+ # UNAME_MACHINE based on the output of uname instead of i386?
+ echo i586-pc-interix
+ exit ;;
+ i*:UWIN*:*)
+ echo ${UNAME_MACHINE}-pc-uwin
+ exit ;;
+ amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
+ echo x86_64-unknown-cygwin
+ exit ;;
+ p*:CYGWIN*:*)
+ echo powerpcle-unknown-cygwin
+ exit ;;
+ prep*:SunOS:5.*:*)
+ echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ *:GNU:*:*)
+ # the GNU system
+ echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+ exit ;;
+ *:GNU/*:*:*)
+ # other systems with GNU libc and userland
+ echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
+ exit ;;
+ i*86:Minix:*:*)
+ echo ${UNAME_MACHINE}-pc-minix
+ exit ;;
+ arm*:Linux:*:*)
+ eval $set_cc_for_build
+ if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
+ | grep -q __ARM_EABI__
+ then
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ else
+ echo ${UNAME_MACHINE}-unknown-linux-gnueabi
+ fi
+ exit ;;
+ avr32*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ cris:Linux:*:*)
+ echo cris-axis-linux-gnu
+ exit ;;
+ crisv32:Linux:*:*)
+ echo crisv32-axis-linux-gnu
+ exit ;;
+ frv:Linux:*:*)
+ echo frv-unknown-linux-gnu
+ exit ;;
+ ia64:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ m32r*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ m68*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ mips:Linux:*:*)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #undef CPU
+ #undef mips
+ #undef mipsel
+ #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+ CPU=mipsel
+ #else
+ #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+ CPU=mips
+ #else
+ CPU=
+ #endif
+ #endif
+EOF
+ eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+ /^CPU/{
+ s: ::g
+ p
+ }'`"
+ test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+ ;;
+ mips64:Linux:*:*)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #undef CPU
+ #undef mips64
+ #undef mips64el
+ #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+ CPU=mips64el
+ #else
+ #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+ CPU=mips64
+ #else
+ CPU=
+ #endif
+ #endif
+EOF
+ eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+ /^CPU/{
+ s: ::g
+ p
+ }'`"
+ test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+ ;;
+ or32:Linux:*:*)
+ echo or32-unknown-linux-gnu
+ exit ;;
+ ppc:Linux:*:*)
+ echo powerpc-unknown-linux-gnu
+ exit ;;
+ ppc64:Linux:*:*)
+ echo powerpc64-unknown-linux-gnu
+ exit ;;
+ alpha:Linux:*:*)
+ case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+ EV5) UNAME_MACHINE=alphaev5 ;;
+ EV56) UNAME_MACHINE=alphaev56 ;;
+ PCA56) UNAME_MACHINE=alphapca56 ;;
+ PCA57) UNAME_MACHINE=alphapca56 ;;
+ EV6) UNAME_MACHINE=alphaev6 ;;
+ EV67) UNAME_MACHINE=alphaev67 ;;
+ EV68*) UNAME_MACHINE=alphaev68 ;;
+ esac
+ objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
+ if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
+ echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+ exit ;;
+ parisc:Linux:*:* | hppa:Linux:*:*)
+ # Look for CPU level
+ case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
+ PA7*) echo hppa1.1-unknown-linux-gnu ;;
+ PA8*) echo hppa2.0-unknown-linux-gnu ;;
+ *) echo hppa-unknown-linux-gnu ;;
+ esac
+ exit ;;
+ parisc64:Linux:*:* | hppa64:Linux:*:*)
+ echo hppa64-unknown-linux-gnu
+ exit ;;
+ s390:Linux:*:* | s390x:Linux:*:*)
+ echo ${UNAME_MACHINE}-ibm-linux
+ exit ;;
+ sh64*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ sh*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ sparc:Linux:*:* | sparc64:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ vax:Linux:*:*)
+ echo ${UNAME_MACHINE}-dec-linux-gnu
+ exit ;;
+ x86_64:Linux:*:*)
+ echo x86_64-unknown-linux-gnu
+ exit ;;
+ xtensa*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ i*86:Linux:*:*)
+ # The BFD linker knows what the default object file format is, so
+ # first see if it will tell us. cd to the root directory to prevent
+ # problems with other programs or directories called `ld' in the path.
+ # Set LC_ALL=C to ensure ld outputs messages in English.
+ ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
+ | sed -ne '/supported targets:/!d
+ s/[ ][ ]*/ /g
+ s/.*supported targets: *//
+ s/ .*//
+ p'`
+ case "$ld_supported_targets" in
+ elf32-i386)
+ TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
+ ;;
+ a.out-i386-linux)
+ echo "${UNAME_MACHINE}-pc-linux-gnuaout"
+ exit ;;
+ coff-i386)
+ echo "${UNAME_MACHINE}-pc-linux-gnucoff"
+ exit ;;
+ "")
+ # Either a pre-BFD a.out linker (linux-gnuoldld) or
+ # one that does not give us useful --help.
+ echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
+ exit ;;
+ esac
+ # Determine whether the default compiler is a.out or elf
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #include <features.h>
+ #ifdef __ELF__
+ # ifdef __GLIBC__
+ # if __GLIBC__ >= 2
+ LIBC=gnu
+ # else
+ LIBC=gnulibc1
+ # endif
+ # else
+ LIBC=gnulibc1
+ # endif
+ #else
+ #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
+ LIBC=gnu
+ #else
+ LIBC=gnuaout
+ #endif
+ #endif
+ #ifdef __dietlibc__
+ LIBC=dietlibc
+ #endif
+EOF
+ eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+ /^LIBC/{
+ s: ::g
+ p
+ }'`"
+ test x"${LIBC}" != x && {
+ echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
+ exit
+ }
+ test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
+ ;;
+ i*86:DYNIX/ptx:4*:*)
+ # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
+ # earlier versions are messed up and put the nodename in both
+ # sysname and nodename.
+ echo i386-sequent-sysv4
+ exit ;;
+ i*86:UNIX_SV:4.2MP:2.*)
+ # Unixware is an offshoot of SVR4, but it has its own version
+ # number series starting with 2...
+ # I am not positive that other SVR4 systems won't match this,
+ # I just have to hope. -- rms.
+ # Use sysv4.2uw... so that sysv4* matches it.
+ echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
+ exit ;;
+ i*86:OS/2:*:*)
+ # If we were able to find `uname', then EMX Unix compatibility
+ # is probably installed.
+ echo ${UNAME_MACHINE}-pc-os2-emx
+ exit ;;
+ i*86:XTS-300:*:STOP)
+ echo ${UNAME_MACHINE}-unknown-stop
+ exit ;;
+ i*86:atheos:*:*)
+ echo ${UNAME_MACHINE}-unknown-atheos
+ exit ;;
+ i*86:syllable:*:*)
+ echo ${UNAME_MACHINE}-pc-syllable
+ exit ;;
+ i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
+ echo i386-unknown-lynxos${UNAME_RELEASE}
+ exit ;;
+ i*86:*DOS:*:*)
+ echo ${UNAME_MACHINE}-pc-msdosdjgpp
+ exit ;;
+ i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
+ UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
+ if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
+ echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
+ else
+ echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
+ fi
+ exit ;;
+ i*86:*:5:[678]*)
+ # UnixWare 7.x, OpenUNIX and OpenServer 6.
+ case `/bin/uname -X | grep "^Machine"` in
+ *486*) UNAME_MACHINE=i486 ;;
+ *Pentium) UNAME_MACHINE=i586 ;;
+ *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
+ esac
+ echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
+ exit ;;
+ i*86:*:3.2:*)
+ if test -f /usr/options/cb.name; then
+ UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
+ echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
+ elif /bin/uname -X 2>/dev/null >/dev/null ; then
+ UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
+ (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
+ (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
+ && UNAME_MACHINE=i586
+ (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
+ && UNAME_MACHINE=i686
+ (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
+ && UNAME_MACHINE=i686
+ echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
+ else
+ echo ${UNAME_MACHINE}-pc-sysv32
+ fi
+ exit ;;
+ pc:*:*:*)
+ # Left here for compatibility:
+ # uname -m prints for DJGPP always 'pc', but it prints nothing about
+ # the processor, so we play safe by assuming i386.
+ echo i386-pc-msdosdjgpp
+ exit ;;
+ Intel:Mach:3*:*)
+ echo i386-pc-mach3
+ exit ;;
+ paragon:*:*:*)
+ echo i860-intel-osf1
+ exit ;;
+ i860:*:4.*:*) # i860-SVR4
+ if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
+ echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
+ else # Add other i860-SVR4 vendors below as they are discovered.
+ echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
+ fi
+ exit ;;
+ mini*:CTIX:SYS*5:*)
+ # "miniframe"
+ echo m68010-convergent-sysv
+ exit ;;
+ mc68k:UNIX:SYSTEM5:3.51m)
+ echo m68k-convergent-sysv
+ exit ;;
+ M680?0:D-NIX:5.3:*)
+ echo m68k-diab-dnix
+ exit ;;
+ M68*:*:R3V[5678]*:*)
+ test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
+ 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
+ OS_REL=''
+ test -r /etc/.relid \
+ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+ /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
+ 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && { echo i486-ncr-sysv4; exit; } ;;
+ m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
+ echo m68k-unknown-lynxos${UNAME_RELEASE}
+ exit ;;
+ mc68030:UNIX_System_V:4.*:*)
+ echo m68k-atari-sysv4
+ exit ;;
+ TSUNAMI:LynxOS:2.*:*)
+ echo sparc-unknown-lynxos${UNAME_RELEASE}
+ exit ;;
+ rs6000:LynxOS:2.*:*)
+ echo rs6000-unknown-lynxos${UNAME_RELEASE}
+ exit ;;
+ PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
+ echo powerpc-unknown-lynxos${UNAME_RELEASE}
+ exit ;;
+ SM[BE]S:UNIX_SV:*:*)
+ echo mips-dde-sysv${UNAME_RELEASE}
+ exit ;;
+ RM*:ReliantUNIX-*:*:*)
+ echo mips-sni-sysv4
+ exit ;;
+ RM*:SINIX-*:*:*)
+ echo mips-sni-sysv4
+ exit ;;
+ *:SINIX-*:*:*)
+ if uname -p 2>/dev/null >/dev/null ; then
+ UNAME_MACHINE=`(uname -p) 2>/dev/null`
+ echo ${UNAME_MACHINE}-sni-sysv4
+ else
+ echo ns32k-sni-sysv
+ fi
+ exit ;;
+ PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+ # says <Richard.M.Bartel@ccMail.Census.GOV>
+ echo i586-unisys-sysv4
+ exit ;;
+ *:UNIX_System_V:4*:FTX*)
+ # From Gerald Hewes <hewes@openmarket.com>.
+ # How about differentiating between stratus architectures? -djm
+ echo hppa1.1-stratus-sysv4
+ exit ;;
+ *:*:*:FTX*)
+ # From seanf@swdc.stratus.com.
+ echo i860-stratus-sysv4
+ exit ;;
+ i*86:VOS:*:*)
+ # From Paul.Green@stratus.com.
+ echo ${UNAME_MACHINE}-stratus-vos
+ exit ;;
+ *:VOS:*:*)
+ # From Paul.Green@stratus.com.
+ echo hppa1.1-stratus-vos
+ exit ;;
+ mc68*:A/UX:*:*)
+ echo m68k-apple-aux${UNAME_RELEASE}
+ exit ;;
+ news*:NEWS-OS:6*:*)
+ echo mips-sony-newsos6
+ exit ;;
+ R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
+ if [ -d /usr/nec ]; then
+ echo mips-nec-sysv${UNAME_RELEASE}
+ else
+ echo mips-unknown-sysv${UNAME_RELEASE}
+ fi
+ exit ;;
+ BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
+ echo powerpc-be-beos
+ exit ;;
+ BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
+ echo powerpc-apple-beos
+ exit ;;
+ BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
+ echo i586-pc-beos
+ exit ;;
+ SX-4:SUPER-UX:*:*)
+ echo sx4-nec-superux${UNAME_RELEASE}
+ exit ;;
+ SX-5:SUPER-UX:*:*)
+ echo sx5-nec-superux${UNAME_RELEASE}
+ exit ;;
+ SX-6:SUPER-UX:*:*)
+ echo sx6-nec-superux${UNAME_RELEASE}
+ exit ;;
+ SX-7:SUPER-UX:*:*)
+ echo sx7-nec-superux${UNAME_RELEASE}
+ exit ;;
+ SX-8:SUPER-UX:*:*)
+ echo sx8-nec-superux${UNAME_RELEASE}
+ exit ;;
+ SX-8R:SUPER-UX:*:*)
+ echo sx8r-nec-superux${UNAME_RELEASE}
+ exit ;;
+ Power*:Rhapsody:*:*)
+ echo powerpc-apple-rhapsody${UNAME_RELEASE}
+ exit ;;
+ *:Rhapsody:*:*)
+ echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
+ exit ;;
+ *:Darwin:*:*)
+ UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
+ case $UNAME_PROCESSOR in
+ unknown) UNAME_PROCESSOR=powerpc ;;
+ esac
+ echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
+ exit ;;
+ *:procnto*:*:* | *:QNX:[0123456789]*:*)
+ UNAME_PROCESSOR=`uname -p`
+ if test "$UNAME_PROCESSOR" = "x86"; then
+ UNAME_PROCESSOR=i386
+ UNAME_MACHINE=pc
+ fi
+ echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
+ exit ;;
+ *:QNX:*:4*)
+ echo i386-pc-qnx
+ exit ;;
+ NSE-?:NONSTOP_KERNEL:*:*)
+ echo nse-tandem-nsk${UNAME_RELEASE}
+ exit ;;
+ NSR-?:NONSTOP_KERNEL:*:*)
+ echo nsr-tandem-nsk${UNAME_RELEASE}
+ exit ;;
+ *:NonStop-UX:*:*)
+ echo mips-compaq-nonstopux
+ exit ;;
+ BS2000:POSIX*:*:*)
+ echo bs2000-siemens-sysv
+ exit ;;
+ DS/*:UNIX_System_V:*:*)
+ echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
+ exit ;;
+ *:Plan9:*:*)
+ # "uname -m" is not consistent, so use $cputype instead. 386
+ # is converted to i386 for consistency with other x86
+ # operating systems.
+ if test "$cputype" = "386"; then
+ UNAME_MACHINE=i386
+ else
+ UNAME_MACHINE="$cputype"
+ fi
+ echo ${UNAME_MACHINE}-unknown-plan9
+ exit ;;
+ *:TOPS-10:*:*)
+ echo pdp10-unknown-tops10
+ exit ;;
+ *:TENEX:*:*)
+ echo pdp10-unknown-tenex
+ exit ;;
+ KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
+ echo pdp10-dec-tops20
+ exit ;;
+ XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
+ echo pdp10-xkl-tops20
+ exit ;;
+ *:TOPS-20:*:*)
+ echo pdp10-unknown-tops20
+ exit ;;
+ *:ITS:*:*)
+ echo pdp10-unknown-its
+ exit ;;
+ SEI:*:*:SEIUX)
+ echo mips-sei-seiux${UNAME_RELEASE}
+ exit ;;
+ *:DragonFly:*:*)
+ echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+ exit ;;
+ *:*VMS:*:*)
+ UNAME_MACHINE=`(uname -p) 2>/dev/null`
+ case "${UNAME_MACHINE}" in
+ A*) echo alpha-dec-vms ; exit ;;
+ I*) echo ia64-dec-vms ; exit ;;
+ V*) echo vax-dec-vms ; exit ;;
+ esac ;;
+ *:XENIX:*:SysV)
+ echo i386-pc-xenix
+ exit ;;
+ i*86:skyos:*:*)
+ echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
+ exit ;;
+ i*86:rdos:*:*)
+ echo ${UNAME_MACHINE}-pc-rdos
+ exit ;;
+esac
+
+#echo '(No uname command or uname output not recognized.)' 1>&2
+#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
+
+eval $set_cc_for_build
+cat >$dummy.c <<EOF
+#ifdef _SEQUENT_
+# include <sys/types.h>
+# include <sys/utsname.h>
+#endif
+main ()
+{
+#if defined (sony)
+#if defined (MIPSEB)
+ /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
+ I don't know.... */
+ printf ("mips-sony-bsd\n"); exit (0);
+#else
+#include <sys/param.h>
+ printf ("m68k-sony-newsos%s\n",
+#ifdef NEWSOS4
+ "4"
+#else
+ ""
+#endif
+ ); exit (0);
+#endif
+#endif
+
+#if defined (__arm) && defined (__acorn) && defined (__unix)
+ printf ("arm-acorn-riscix\n"); exit (0);
+#endif
+
+#if defined (hp300) && !defined (hpux)
+ printf ("m68k-hp-bsd\n"); exit (0);
+#endif
+
+#if defined (NeXT)
+#if !defined (__ARCHITECTURE__)
+#define __ARCHITECTURE__ "m68k"
+#endif
+ int version;
+ version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
+ if (version < 4)
+ printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
+ else
+ printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
+ exit (0);
+#endif
+
+#if defined (MULTIMAX) || defined (n16)
+#if defined (UMAXV)
+ printf ("ns32k-encore-sysv\n"); exit (0);
+#else
+#if defined (CMU)
+ printf ("ns32k-encore-mach\n"); exit (0);
+#else
+ printf ("ns32k-encore-bsd\n"); exit (0);
+#endif
+#endif
+#endif
+
+#if defined (__386BSD__)
+ printf ("i386-pc-bsd\n"); exit (0);
+#endif
+
+#if defined (sequent)
+#if defined (i386)
+ printf ("i386-sequent-dynix\n"); exit (0);
+#endif
+#if defined (ns32000)
+ printf ("ns32k-sequent-dynix\n"); exit (0);
+#endif
+#endif
+
+#if defined (_SEQUENT_)
+ struct utsname un;
+
+ uname(&un);
+
+ if (strncmp(un.version, "V2", 2) == 0) {
+ printf ("i386-sequent-ptx2\n"); exit (0);
+ }
+ if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
+ printf ("i386-sequent-ptx1\n"); exit (0);
+ }
+ printf ("i386-sequent-ptx\n"); exit (0);
+
+#endif
+
+#if defined (vax)
+# if !defined (ultrix)
+# include <sys/param.h>
+# if defined (BSD)
+# if BSD == 43
+ printf ("vax-dec-bsd4.3\n"); exit (0);
+# else
+# if BSD == 199006
+ printf ("vax-dec-bsd4.3reno\n"); exit (0);
+# else
+ printf ("vax-dec-bsd\n"); exit (0);
+# endif
+# endif
+# else
+ printf ("vax-dec-bsd\n"); exit (0);
+# endif
+# else
+ printf ("vax-dec-ultrix\n"); exit (0);
+# endif
+#endif
+
+#if defined (alliant) && defined (i860)
+ printf ("i860-alliant-bsd\n"); exit (0);
+#endif
+
+ exit (1);
+}
+EOF
+
+$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
+ { echo "$SYSTEM_NAME"; exit; }
+
+# Apollos put the system type in the environment.
+
+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
+
+# Convex versions that predate uname can use getsysinfo(1)
+
+if [ -x /usr/convex/getsysinfo ]
+then
+ case `getsysinfo -f cpu_type` in
+ c1*)
+ echo c1-convex-bsd
+ exit ;;
+ c2*)
+ if getsysinfo -f scalar_acc
+ then echo c32-convex-bsd
+ else echo c2-convex-bsd
+ fi
+ exit ;;
+ c34*)
+ echo c34-convex-bsd
+ exit ;;
+ c38*)
+ echo c38-convex-bsd
+ exit ;;
+ c4*)
+ echo c4-convex-bsd
+ exit ;;
+ esac
+fi
+
+cat >&2 <<EOF
+$0: unable to guess system type
+
+This script, last modified $timestamp, has failed to recognize
+the operating system you are using. It is advised that you
+download the most up to date version of the config scripts from
+
+ http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
+and
+ http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
+
+If the version you run ($0) is already up to date, please
+send the following data and any information you think might be
+pertinent to <config-patches@gnu.org> in order to provide the needed
+information to handle your system.
+
+config.guess timestamp = $timestamp
+
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
+/bin/uname -X = `(/bin/uname -X) 2>/dev/null`
+
+hostinfo = `(hostinfo) 2>/dev/null`
+/bin/universe = `(/bin/universe) 2>/dev/null`
+/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null`
+/bin/arch = `(/bin/arch) 2>/dev/null`
+/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
+
+UNAME_MACHINE = ${UNAME_MACHINE}
+UNAME_RELEASE = ${UNAME_RELEASE}
+UNAME_SYSTEM = ${UNAME_SYSTEM}
+UNAME_VERSION = ${UNAME_VERSION}
+EOF
+
+exit 1
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/config.h.in b/config.h.in
new file mode 100644
index 0000000..1d19266
--- /dev/null
+++ b/config.h.in
@@ -0,0 +1,688 @@
+/* config.h.in. Generated from configure.ac by autoheader. */
+
+/* Define to 1 if the `closedir' function returns void instead of `int'. */
+#undef CLOSEDIR_VOID
+
+/* DBus Major Version */
+#undef DBUS_VERSION_MAJOR
+
+/* DBus Micro Version */
+#undef DBUS_VERSION_MICRO
+
+/* DBus Minor Version */
+#undef DBUS_VERSION_MINOR
+
+/* Found some version of curses that we're going to use */
+#undef HAS_CURSES
+
+/* Define to 1 if you have the <arpa/inet.h> header file. */
+#undef HAVE_ARPA_INET_H
+
+/* Define to 1 if you have the <asm/io.h> header file. */
+#undef HAVE_ASM_IO_H
+
+/* Define to 1 if you have the <asm/types.h> header file. */
+#undef HAVE_ASM_TYPES_H
+
+/* Define to 1 if you have the <dbus/dbus.h> header file. */
+#undef HAVE_DBUS_DBUS_H
+
+/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
+ */
+#undef HAVE_DIRENT_H
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#undef HAVE_DLFCN_H
+
+/* Define to 1 if you have the `dup2' function. */
+#undef HAVE_DUP2
+
+/* Define to 1 if you have the <fcntl.h> header file. */
+#undef HAVE_FCNTL_H
+
+/* Define to 1 if you have the `floor' function. */
+#undef HAVE_FLOOR
+
+/* Define to 1 if you have the `fork' function. */
+#undef HAVE_FORK
+
+/* Define to 1 if you have the <ftdi.h> header file. */
+#undef HAVE_FTDI_H
+
+/* Define to 1 if you have the <gd/gd.h> header file. */
+#undef HAVE_GD_GD_H
+
+/* Define to 1 if you have the <gd.h> header file. */
+#undef HAVE_GD_H
+
+/* Define to 1 if you have the `gethostbyname' function. */
+#undef HAVE_GETHOSTBYNAME
+
+/* Define to 1 if you have the `gettimeofday' function. */
+#undef HAVE_GETTIMEOFDAY
+
+/* Define if you have the iconv() function and it works. */
+#undef HAVE_ICONV
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
+
+/* Define to 1 if you have the <jpeglib.h> header file. */
+#undef HAVE_JPEGLIB_H
+
+/* Define to 1 if you have the `m' library (-lm). */
+#undef HAVE_LIBM
+
+/* Define to 1 if you have the <libusb-1.0/libusb.h> header file. */
+#undef HAVE_LIBUSB_1_0_LIBUSB_H
+
+/* Define to 1 if you have the <linux/dvb/frontend.h> header file. */
+#undef HAVE_LINUX_DVB_FRONTEND_H
+
+/* Define to 1 if you have the <linux/errno.h> header file. */
+#undef HAVE_LINUX_ERRNO_H
+
+/* Define to 1 if you have the <linux/hd44780.h> header file. */
+#undef HAVE_LINUX_HD44780_H
+
+/* Define to 1 if you have the <linux/isdn.h> header file. */
+#undef HAVE_LINUX_ISDN_H
+
+/* Define to 1 if you have the <linux/lcd-linux.h> header file. */
+#undef HAVE_LINUX_LCD_LINUX_H
+
+/* Define to 1 if you have the <linux/parport.h> header file. */
+#undef HAVE_LINUX_PARPORT_H
+
+/* Define to 1 if you have the <linux/ppdev.h> header file. */
+#undef HAVE_LINUX_PPDEV_H
+
+/* Define to 1 if you have the <linux/wireless.h> header file. */
+#undef HAVE_LINUX_WIRELESS_H
+
+/* Define to 1 if you have the <luise.h> header file. */
+#undef HAVE_LUISE_H
+
+/* Define to 1 if you have the `memmove' function. */
+#undef HAVE_MEMMOVE
+
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* Define to 1 if you have the `memset' function. */
+#undef HAVE_MEMSET
+
+/* Define to 1 if you have the <mysql/mysql.h> header file. */
+#undef HAVE_MYSQL_MYSQL_H
+
+/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
+#undef HAVE_NDIR_H
+
+/* Define to 1 if you have the <netdb.h> header file. */
+#undef HAVE_NETDB_H
+
+/* Define to 1 if you have the <netinet/in.h> header file. */
+#undef HAVE_NETINET_IN_H
+
+/* Define to 1 if you have the <net/if_ppp.h> header file. */
+#undef HAVE_NET_IF_PPP_H
+
+/* Define to 1 if you have the <nmeap.h> header file. */
+#undef HAVE_NMEAP_H
+
+/* Define to 1 if you have the `pow' function. */
+#undef HAVE_POW
+
+/* Define to 1 if you have the `putenv' function. */
+#undef HAVE_PUTENV
+
+/* If available, contains the Python version number currently in use. */
+#undef HAVE_PYTHON
+
+/* Define to 1 if you have the `regcomp' function. */
+#undef HAVE_REGCOMP
+
+/* Define to 1 if you have the <rfb/rfb.h> header file. */
+#undef HAVE_RFB_RFB_H
+
+/* Define to 1 if you have the `select' function. */
+#undef HAVE_SELECT
+
+/* Define to 1 if you have the <serdisplib/serdisp.h> header file. */
+#undef HAVE_SERDISPLIB_SERDISP_H
+
+/* Define to 1 if you have the `socket' function. */
+#undef HAVE_SOCKET
+
+/* Define to 1 if you have the <sqlite3.h> header file. */
+#undef HAVE_SQLITE3_H
+
+/* Define to 1 if you have the `sqrt' function. */
+#undef HAVE_SQRT
+
+/* Define to 1 if you have the <st2205.h> header file. */
+#undef HAVE_ST2205_H
+
+/* Define to 1 if `stat' has the bug that it succeeds when given the
+ zero-length file name argument. */
+#undef HAVE_STAT_EMPTY_STRING_BUG
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
+/* Define to 1 if you have the `strcasecmp' function. */
+#undef HAVE_STRCASECMP
+
+/* Define to 1 if you have the `strchr' function. */
+#undef HAVE_STRCHR
+
+/* Define to 1 if you have the `strcspn' function. */
+#undef HAVE_STRCSPN
+
+/* Define to 1 if you have the `strdup' function. */
+#undef HAVE_STRDUP
+
+/* Define to 1 if you have the `strerror' function. */
+#undef HAVE_STRERROR
+
+/* Define to 1 if you have the `strftime' function. */
+#undef HAVE_STRFTIME
+
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+
+/* Define to 1 if you have the `strncasecmp' function. */
+#undef HAVE_STRNCASECMP
+
+/* Define to 1 if you have the `strndup' function. */
+#undef HAVE_STRNDUP
+
+/* Define to 1 if you have the `strpbrk' function. */
+#undef HAVE_STRPBRK
+
+/* Define to 1 if you have the `strrchr' function. */
+#undef HAVE_STRRCHR
+
+/* Define to 1 if you have the `strstr' function. */
+#undef HAVE_STRSTR
+
+/* Define to 1 if you have the `strtol' function. */
+#undef HAVE_STRTOL
+
+/* Define to 1 if you have the `strtoul' function. */
+#undef HAVE_STRTOUL
+
+/* Define to 1 if you have the <syslog.h> header file. */
+#undef HAVE_SYSLOG_H
+
+/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
+ */
+#undef HAVE_SYS_DIR_H
+
+/* Define to 1 if you have the <sys/ioctl.h> header file. */
+#undef HAVE_SYS_IOCTL_H
+
+/* Define to 1 if you have the <sys/io.h> header file. */
+#undef HAVE_SYS_IO_H
+
+/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
+ */
+#undef HAVE_SYS_NDIR_H
+
+/* Define to 1 if you have the <sys/select.h> header file. */
+#undef HAVE_SYS_SELECT_H
+
+/* Define to 1 if you have the <sys/socket.h> header file. */
+#undef HAVE_SYS_SOCKET_H
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+#undef HAVE_SYS_TIME_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have the <sys/vfs.h> header file. */
+#undef HAVE_SYS_VFS_H
+
+/* Define to 1 if you have the <termios.h> header file. */
+#undef HAVE_TERMIOS_H
+
+/* Define to 1 if you have the `uname' function. */
+#undef HAVE_UNAME
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Define to 1 if you have the <usb.h> header file. */
+#undef HAVE_USB_H
+
+/* Define to 1 if you have the `vfork' function. */
+#undef HAVE_VFORK
+
+/* Define to 1 if you have the <vfork.h> header file. */
+#undef HAVE_VFORK_H
+
+/* Define to 1 if `fork' works. */
+#undef HAVE_WORKING_FORK
+
+/* Define to 1 if `vfork' works. */
+#undef HAVE_WORKING_VFORK
+
+/* Define to 1 if you have the <X11/Xlib.h> header file. */
+#undef HAVE_X11_XLIB_H
+
+/* Define to 1 if you have the <X11/Xutil.h> header file. */
+#undef HAVE_X11_XUTIL_H
+
+/* Define as const if the declaration of iconv() needs const. */
+#undef ICONV_CONST
+
+/* Define to 1 if `lstat' dereferences a symlink specified with a trailing
+ slash. */
+#undef LSTAT_FOLLOWS_SLASHED_SYMLINK
+
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+ */
+#undef LT_OBJDIR
+
+/* Set to reflect version of ncurses */
+#undef NCURSES_970530
+
+/* If you Curses does not have color define this one */
+#undef NO_COLOR_CURSES
+
+/* Name of package */
+#undef PACKAGE
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the home page for this package. */
+#undef PACKAGE_URL
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* apm plugin */
+#undef PLUGIN_APM
+
+/* asterisk plugin */
+#undef PLUGIN_ASTERISK
+
+/* button_exec plugin */
+#undef PLUGIN_BUTTON_EXEC
+
+/* cpuinfo plugin */
+#undef PLUGIN_CPUINFO
+
+/* dbus plugin */
+#undef PLUGIN_DBUS
+
+/* diskstats plugin */
+#undef PLUGIN_DISKSTATS
+
+/* dvb plugin */
+#undef PLUGIN_DVB
+
+/* event plugin */
+#undef PLUGIN_EVENT
+
+/* exec plugin */
+#undef PLUGIN_EXEC
+
+/* fifo plugin */
+#undef PLUGIN_FIFO
+
+/* file plugin */
+#undef PLUGIN_FILE
+
+/* gps plugin */
+#undef PLUGIN_GPS
+
+/* hddtemp plugin */
+#undef PLUGIN_HDDTEMP
+
+/* huawei plugin */
+#undef PLUGIN_HUAWEI
+
+/* i2c sensors plugin */
+#undef PLUGIN_I2C_SENSORS
+
+/* iconv charset converter plugin */
+#undef PLUGIN_ICONV
+
+/* imon plugin */
+#undef PLUGIN_IMON
+
+/* ISDN plugin */
+#undef PLUGIN_ISDN
+
+/* kvv plugin */
+#undef PLUGIN_KVV
+
+/* loadavg plugin */
+#undef PLUGIN_LOADAVG
+
+/* meminfo plugin */
+#undef PLUGIN_MEMINFO
+
+/* mpd plugin */
+#undef PLUGIN_MPD
+
+/* mpris_dbus plugin */
+#undef PLUGIN_MPRIS_DBUS
+
+/* mysql plugin */
+#undef PLUGIN_MYSQL
+
+/* netdev plugin */
+#undef PLUGIN_NETDEV
+
+/* netinfo plugin */
+#undef PLUGIN_NETINFO
+
+/* POP3 plugin */
+#undef PLUGIN_POP3
+
+/* ppp plugin */
+#undef PLUGIN_PPP
+
+/* proc_stat plugin */
+#undef PLUGIN_PROC_STAT
+
+/* python plugin */
+#undef PLUGIN_PYTHON
+
+/* qnaplog plugin */
+#undef PLUGIN_QNAPLOG
+
+/* raspi plugin */
+#undef PLUGIN_RASPI
+
+/* sample plugin */
+#undef PLUGIN_SAMPLE
+
+/* seti plugin */
+#undef PLUGIN_SETI
+
+/* statfs plugin */
+#undef PLUGIN_STATFS
+
+/* uname plugin */
+#undef PLUGIN_UNAME
+
+/* uptime plugin */
+#undef PLUGIN_UPTIME
+
+/* w1retap plugin */
+#undef PLUGIN_W1RETAP
+
+/* wireless plugin */
+#undef PLUGIN_WIRELESS
+
+/* xmms plugin */
+#undef PLUGIN_XMMS
+
+/* Define as the return type of signal handlers (`int' or `void'). */
+#undef RETSIGTYPE
+
+/* Define if you want to turn on SCO-specific code */
+#undef SCO_FLAVOR
+
+/* Define to the type of arg 1 for `select'. */
+#undef SELECT_TYPE_ARG1
+
+/* Define to the type of args 2, 3 and 4 for `select'. */
+#undef SELECT_TYPE_ARG234
+
+/* Define to the type of arg 5 for `select'. */
+#undef SELECT_TYPE_ARG5
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
+#undef TIME_WITH_SYS_TIME
+
+/* Use Ncurses? */
+#undef USE_NCURSES
+
+/* Use SunOS SysV curses? */
+#undef USE_SUNOS_CURSES
+
+/* Use SystemV curses? */
+#undef USE_SYSV_CURSES
+
+/* Version number of package */
+#undef VERSION
+
+/* ASTUSB driver */
+#undef WITH_ASTUSB
+
+/* Beckmann&Egle driver */
+#undef WITH_BECKMANNEGLE
+
+/* BWCT driver */
+#undef WITH_BWCT
+
+/* Crystalfontz driver */
+#undef WITH_CRYSTALFONTZ
+
+/* Curses driver */
+#undef WITH_CURSES
+
+/* CwLinux driver */
+#undef WITH_CWLINUX
+
+/* D4D driver */
+#undef WITH_D4D
+
+/* Define if using the dmalloc debugging malloc package */
+#undef WITH_DMALLOC
+
+/* DPF driver */
+#undef WITH_DPF
+
+/* Electronic Assembly RS232 graphic driver */
+#undef WITH_EA232graphic
+
+/* Driver for EFN LED modules and EUG 100 ethernet to serial converter */
+#undef WITH_EFN
+
+/* FutabaVFD driver */
+#undef WITH_FUTABAVFD
+
+/* Allnet FW8888 driver */
+#undef WITH_FW8888
+
+/* G-15 driver */
+#undef WITH_G15
+
+/* GD library */
+#undef WITH_GD
+
+/* GLCD2USB driver */
+#undef WITH_GLCD2USB
+
+/* HD44780 driver */
+#undef WITH_HD44780
+
+/* I2C bus driver */
+#undef WITH_I2C
+
+/* image widget */
+#undef WITH_IMAGE
+
+/* IRLCD driver */
+#undef WITH_IRLCD
+
+/* LCD2USB driver */
+#undef WITH_LCD2USB
+
+/* LCD-Linux driver */
+#undef WITH_LCDLINUX
+
+/* LCDTerm driver */
+#undef WITH_LCDTERM
+
+/* LEDMatrix driver */
+#undef WITH_LEDMATRIX
+
+/* LPH7508 driver */
+#undef WITH_LPH7508
+
+/* LUIse driver */
+#undef WITH_LUISE
+
+/* LW ABP driver */
+#undef WITH_LW_ABP
+
+/* M50530 driver */
+#undef WITH_M50530
+
+/* MatrixOrbital driver */
+#undef WITH_MATRIXORBITAL
+
+/* MatrixOrbitalGX driver */
+#undef WITH_MATRIXORBITALGX
+
+/* MDM166A driver */
+#undef WITH_MDM166A
+
+/* Milford Instruments driver */
+#undef WITH_MILINST
+
+/* Newhaven driver */
+#undef WITH_NEWHAVEN
+
+/* Noritake driver */
+#undef WITH_NORITAKE
+
+/* NULL driver */
+#undef WITH_NULL
+
+/* parport bus driver */
+#undef WITH_PARPORT
+
+/* Pertelian driver */
+#undef WITH_PERTELIAN
+
+/* PHAnderson driver */
+#undef WITH_PHANDERSON
+
+/* PICGraphic driver */
+#undef WITH_PICGRAPHIC
+
+/* picoLCD driver */
+#undef WITH_PICOLCD
+
+/* picoLCDGraphic driver */
+#undef WITH_PICOLCDGRAPHIC
+
+/* PNG driver */
+#undef WITH_PNG
+
+/* PPM driver */
+#undef WITH_PPM
+
+/* RouterBoard driver */
+#undef WITH_ROUTERBOARD
+
+/* Sample driver */
+#undef WITH_SAMPLE
+
+/* SamsungSPF driver */
+#undef WITH_SAMSUNGSPF
+
+/* serdisplib driver */
+#undef WITH_SERDISPLIB
+
+/* serial bus driver */
+#undef WITH_SERIAL
+
+/* ShuttleVFD driver */
+#undef WITH_SHUTTLEVFD
+
+/* SimpleLCD driver */
+#undef WITH_SIMPLELCD
+
+/* st2205 driver */
+#undef WITH_ST2205
+
+/* T6963 driver */
+#undef WITH_T6963
+
+/* TeakLCM driver */
+#undef WITH_TEAK_LCM
+
+/* TREFON driver */
+#undef WITH_TREFON
+
+/* ULA200 driver */
+#undef WITH_ULA200
+
+/* USBHUB driver */
+#undef WITH_USBHUB
+
+/* USBLCD driver */
+#undef WITH_USBLCD
+
+/* vnc driver */
+#undef WITH_VNC
+
+/* WincorNixdorf driver */
+#undef WITH_WINCORNIXDORF
+
+/* X11 driver */
+#undef WITH_X11
+
+/* Define to 1 if the X Window System is missing or not being used. */
+#undef X_DISPLAY_MISSING
+
+/* Define to empty if `const' does not conform to ANSI C. */
+#undef const
+
+/* Define to `int' if <sys/types.h> doesn't define. */
+#undef gid_t
+
+/* Define to `__inline__' or `__inline' if that's what the C compiler
+ calls it, or to nothing if 'inline' is not supported under any name. */
+#ifndef __cplusplus
+#undef inline
+#endif
+
+/* Define to `long int' if <sys/types.h> does not define. */
+#undef off_t
+
+/* Define to `int' if <sys/types.h> does not define. */
+#undef pid_t
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+#undef size_t
+
+/* Define to `int' if <sys/types.h> does not define. */
+#undef ssize_t
+
+/* Define to `int' if <sys/types.h> doesn't define. */
+#undef uid_t
+
+/* Define as `fork' if `vfork' does not work. */
+#undef vfork
diff --git a/config.rpath b/config.rpath
new file mode 100644
index 0000000..c547c68
--- /dev/null
+++ b/config.rpath
@@ -0,0 +1,666 @@
+#! /bin/sh
+# Output a system dependent set of variables, describing how to set the
+# run time search path of shared libraries in an executable.
+#
+# Copyright 1996-2007 Free Software Foundation, Inc.
+# Taken from GNU libtool, 2001
+# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+#
+# The first argument passed to this file is the canonical host specification,
+# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or
+# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+# The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld
+# should be set by the caller.
+#
+# The set of defined variables is at the end of this script.
+
+# Known limitations:
+# - On IRIX 6.5 with CC="cc", the run time search patch must not be longer
+# than 256 bytes, otherwise the compiler driver will dump core. The only
+# known workaround is to choose shorter directory names for the build
+# directory and/or the installation directory.
+
+# All known linkers require a `.a' archive for static linking (except MSVC,
+# which needs '.lib').
+libext=a
+shrext=.so
+
+host="$1"
+host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+
+# Code taken from libtool.m4's _LT_CC_BASENAME.
+
+for cc_temp in $CC""; do
+ case $cc_temp in
+ compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+ distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+ \-*) ;;
+ *) break;;
+ esac
+done
+cc_basename=`echo "$cc_temp" | sed -e 's%^.*/%%'`
+
+# Code taken from libtool.m4's AC_LIBTOOL_PROG_COMPILER_PIC.
+
+wl=
+if test "$GCC" = yes; then
+ wl='-Wl,'
+else
+ case "$host_os" in
+ aix*)
+ wl='-Wl,'
+ ;;
+ darwin*)
+ case $cc_basename in
+ xlc*)
+ wl='-Wl,'
+ ;;
+ esac
+ ;;
+ mingw* | cygwin* | pw32* | os2*)
+ ;;
+ hpux9* | hpux10* | hpux11*)
+ wl='-Wl,'
+ ;;
+ irix5* | irix6* | nonstopux*)
+ wl='-Wl,'
+ ;;
+ newsos6)
+ ;;
+ linux* | k*bsd*-gnu)
+ case $cc_basename in
+ icc* | ecc*)
+ wl='-Wl,'
+ ;;
+ pgcc | pgf77 | pgf90)
+ wl='-Wl,'
+ ;;
+ ccc*)
+ wl='-Wl,'
+ ;;
+ como)
+ wl='-lopt='
+ ;;
+ *)
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ C*)
+ wl='-Wl,'
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+ osf3* | osf4* | osf5*)
+ wl='-Wl,'
+ ;;
+ rdos*)
+ ;;
+ solaris*)
+ wl='-Wl,'
+ ;;
+ sunos4*)
+ wl='-Qoption ld '
+ ;;
+ sysv4 | sysv4.2uw2* | sysv4.3*)
+ wl='-Wl,'
+ ;;
+ sysv4*MP*)
+ ;;
+ sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+ wl='-Wl,'
+ ;;
+ unicos*)
+ wl='-Wl,'
+ ;;
+ uts4*)
+ ;;
+ esac
+fi
+
+# Code taken from libtool.m4's AC_LIBTOOL_PROG_LD_SHLIBS.
+
+hardcode_libdir_flag_spec=
+hardcode_libdir_separator=
+hardcode_direct=no
+hardcode_minus_L=no
+
+case "$host_os" in
+ cygwin* | mingw* | pw32*)
+ # FIXME: the MSVC++ port hasn't been tested in a loooong time
+ # When not using gcc, we currently assume that we are using
+ # Microsoft Visual C++.
+ if test "$GCC" != yes; then
+ with_gnu_ld=no
+ fi
+ ;;
+ interix*)
+ # we just hope/assume this is gcc and not c89 (= MSVC++)
+ with_gnu_ld=yes
+ ;;
+ openbsd*)
+ with_gnu_ld=no
+ ;;
+esac
+
+ld_shlibs=yes
+if test "$with_gnu_ld" = yes; then
+ # Set some defaults for GNU ld with shared library support. These
+ # are reset later if shared libraries are not supported. Putting them
+ # here allows them to be overridden if necessary.
+ # Unlike libtool, we use -rpath here, not --rpath, since the documented
+ # option of GNU ld is called -rpath, not --rpath.
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ case "$host_os" in
+ aix3* | aix4* | aix5*)
+ # On AIX/PPC, the GNU linker is very broken
+ if test "$host_cpu" != ia64; then
+ ld_shlibs=no
+ fi
+ ;;
+ amigaos*)
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+ # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
+ # that the semantics of dynamic libraries on AmigaOS, at least up
+ # to version 4, is to share data among multiple programs linked
+ # with the same dynamic library. Since this doesn't match the
+ # behavior of shared libraries on other platforms, we cannot use
+ # them.
+ ld_shlibs=no
+ ;;
+ beos*)
+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ :
+ else
+ ld_shlibs=no
+ fi
+ ;;
+ cygwin* | mingw* | pw32*)
+ # hardcode_libdir_flag_spec is actually meaningless, as there is
+ # no search path for DLLs.
+ hardcode_libdir_flag_spec='-L$libdir'
+ if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
+ :
+ else
+ ld_shlibs=no
+ fi
+ ;;
+ interix[3-9]*)
+ hardcode_direct=no
+ hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+ ;;
+ gnu* | linux* | k*bsd*-gnu)
+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ :
+ else
+ ld_shlibs=no
+ fi
+ ;;
+ netbsd*)
+ ;;
+ solaris*)
+ if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
+ ld_shlibs=no
+ elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ :
+ else
+ ld_shlibs=no
+ fi
+ ;;
+ sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
+ case `$LD -v 2>&1` in
+ *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
+ ld_shlibs=no
+ ;;
+ *)
+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+ esac
+ ;;
+ sunos4*)
+ hardcode_direct=yes
+ ;;
+ *)
+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ :
+ else
+ ld_shlibs=no
+ fi
+ ;;
+ esac
+ if test "$ld_shlibs" = no; then
+ hardcode_libdir_flag_spec=
+ fi
+else
+ case "$host_os" in
+ aix3*)
+ # Note: this linker hardcodes the directories in LIBPATH if there
+ # are no directories specified by -L.
+ hardcode_minus_L=yes
+ if test "$GCC" = yes; then
+ # Neither direct hardcoding nor static linking is supported with a
+ # broken collect2.
+ hardcode_direct=unsupported
+ fi
+ ;;
+ aix4* | aix5*)
+ if test "$host_cpu" = ia64; then
+ # On IA64, the linker does run time linking by default, so we don't
+ # have to do anything special.
+ aix_use_runtimelinking=no
+ else
+ aix_use_runtimelinking=no
+ # Test if we are trying to use run time linking or normal
+ # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+ # need to do runtime linking.
+ case $host_os in aix4.[23]|aix4.[23].*|aix5*)
+ for ld_flag in $LDFLAGS; do
+ if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+ aix_use_runtimelinking=yes
+ break
+ fi
+ done
+ ;;
+ esac
+ fi
+ hardcode_direct=yes
+ hardcode_libdir_separator=':'
+ if test "$GCC" = yes; then
+ case $host_os in aix4.[012]|aix4.[012].*)
+ collect2name=`${CC} -print-prog-name=collect2`
+ if test -f "$collect2name" && \
+ strings "$collect2name" | grep resolve_lib_name >/dev/null
+ then
+ # We have reworked collect2
+ :
+ else
+ # We have old collect2
+ hardcode_direct=unsupported
+ hardcode_minus_L=yes
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_libdir_separator=
+ fi
+ ;;
+ esac
+ fi
+ # Begin _LT_AC_SYS_LIBPATH_AIX.
+ echo 'int main () { return 0; }' > conftest.c
+ ${CC} ${LDFLAGS} conftest.c -o conftest
+ aix_libpath=`dump -H conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
+}'`
+ if test -z "$aix_libpath"; then
+ aix_libpath=`dump -HX64 conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
+}'`
+ fi
+ if test -z "$aix_libpath"; then
+ aix_libpath="/usr/lib:/lib"
+ fi
+ rm -f conftest.c conftest
+ # End _LT_AC_SYS_LIBPATH_AIX.
+ if test "$aix_use_runtimelinking" = yes; then
+ hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+ else
+ if test "$host_cpu" = ia64; then
+ hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
+ else
+ hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+ fi
+ fi
+ ;;
+ amigaos*)
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+ # see comment about different semantics on the GNU ld section
+ ld_shlibs=no
+ ;;
+ bsdi[45]*)
+ ;;
+ cygwin* | mingw* | pw32*)
+ # When not using gcc, we currently assume that we are using
+ # Microsoft Visual C++.
+ # hardcode_libdir_flag_spec is actually meaningless, as there is
+ # no search path for DLLs.
+ hardcode_libdir_flag_spec=' '
+ libext=lib
+ ;;
+ darwin* | rhapsody*)
+ hardcode_direct=no
+ if test "$GCC" = yes ; then
+ :
+ else
+ case $cc_basename in
+ xlc*)
+ ;;
+ *)
+ ld_shlibs=no
+ ;;
+ esac
+ fi
+ ;;
+ dgux*)
+ hardcode_libdir_flag_spec='-L$libdir'
+ ;;
+ freebsd1*)
+ ld_shlibs=no
+ ;;
+ freebsd2.2*)
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ ;;
+ freebsd2*)
+ hardcode_direct=yes
+ hardcode_minus_L=yes
+ ;;
+ freebsd* | dragonfly*)
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ ;;
+ hpux9*)
+ hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator=:
+ hardcode_direct=yes
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ hardcode_minus_L=yes
+ ;;
+ hpux10*)
+ if test "$with_gnu_ld" = no; then
+ hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator=:
+ hardcode_direct=yes
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ hardcode_minus_L=yes
+ fi
+ ;;
+ hpux11*)
+ if test "$with_gnu_ld" = no; then
+ hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator=:
+ case $host_cpu in
+ hppa*64*|ia64*)
+ hardcode_direct=no
+ ;;
+ *)
+ hardcode_direct=yes
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ hardcode_minus_L=yes
+ ;;
+ esac
+ fi
+ ;;
+ irix5* | irix6* | nonstopux*)
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator=:
+ ;;
+ netbsd*)
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ ;;
+ newsos6)
+ hardcode_direct=yes
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator=:
+ ;;
+ openbsd*)
+ if test -f /usr/libexec/ld.so; then
+ hardcode_direct=yes
+ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+ else
+ case "$host_os" in
+ openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
+ hardcode_libdir_flag_spec='-R$libdir'
+ ;;
+ *)
+ hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+ ;;
+ esac
+ fi
+ else
+ ld_shlibs=no
+ fi
+ ;;
+ os2*)
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+ ;;
+ osf3*)
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator=:
+ ;;
+ osf4* | osf5*)
+ if test "$GCC" = yes; then
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ else
+ # Both cc and cxx compiler support -rpath directly
+ hardcode_libdir_flag_spec='-rpath $libdir'
+ fi
+ hardcode_libdir_separator=:
+ ;;
+ solaris*)
+ hardcode_libdir_flag_spec='-R$libdir'
+ ;;
+ sunos4*)
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_direct=yes
+ hardcode_minus_L=yes
+ ;;
+ sysv4)
+ case $host_vendor in
+ sni)
+ hardcode_direct=yes # is this really true???
+ ;;
+ siemens)
+ hardcode_direct=no
+ ;;
+ motorola)
+ hardcode_direct=no #Motorola manual says yes, but my tests say they lie
+ ;;
+ esac
+ ;;
+ sysv4.3*)
+ ;;
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ ld_shlibs=yes
+ fi
+ ;;
+ sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
+ ;;
+ sysv5* | sco3.2v5* | sco5v6*)
+ hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
+ hardcode_libdir_separator=':'
+ ;;
+ uts4*)
+ hardcode_libdir_flag_spec='-L$libdir'
+ ;;
+ *)
+ ld_shlibs=no
+ ;;
+ esac
+fi
+
+# Check dynamic linker characteristics
+# Code taken from libtool.m4's AC_LIBTOOL_SYS_DYNAMIC_LINKER.
+# Unlike libtool.m4, here we don't care about _all_ names of the library, but
+# only about the one the linker finds when passed -lNAME. This is the last
+# element of library_names_spec in libtool.m4, or possibly two of them if the
+# linker has special search rules.
+library_names_spec= # the last element of library_names_spec in libtool.m4
+libname_spec='lib$name'
+case "$host_os" in
+ aix3*)
+ library_names_spec='$libname.a'
+ ;;
+ aix4* | aix5*)
+ library_names_spec='$libname$shrext'
+ ;;
+ amigaos*)
+ library_names_spec='$libname.a'
+ ;;
+ beos*)
+ library_names_spec='$libname$shrext'
+ ;;
+ bsdi[45]*)
+ library_names_spec='$libname$shrext'
+ ;;
+ cygwin* | mingw* | pw32*)
+ shrext=.dll
+ library_names_spec='$libname.dll.a $libname.lib'
+ ;;
+ darwin* | rhapsody*)
+ shrext=.dylib
+ library_names_spec='$libname$shrext'
+ ;;
+ dgux*)
+ library_names_spec='$libname$shrext'
+ ;;
+ freebsd1*)
+ ;;
+ freebsd* | dragonfly*)
+ case "$host_os" in
+ freebsd[123]*)
+ library_names_spec='$libname$shrext$versuffix' ;;
+ *)
+ library_names_spec='$libname$shrext' ;;
+ esac
+ ;;
+ gnu*)
+ library_names_spec='$libname$shrext'
+ ;;
+ hpux9* | hpux10* | hpux11*)
+ case $host_cpu in
+ ia64*)
+ shrext=.so
+ ;;
+ hppa*64*)
+ shrext=.sl
+ ;;
+ *)
+ shrext=.sl
+ ;;
+ esac
+ library_names_spec='$libname$shrext'
+ ;;
+ interix[3-9]*)
+ library_names_spec='$libname$shrext'
+ ;;
+ irix5* | irix6* | nonstopux*)
+ library_names_spec='$libname$shrext'
+ case "$host_os" in
+ irix5* | nonstopux*)
+ libsuff= shlibsuff=
+ ;;
+ *)
+ case $LD in
+ *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= ;;
+ *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 ;;
+ *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 ;;
+ *) libsuff= shlibsuff= ;;
+ esac
+ ;;
+ esac
+ ;;
+ linux*oldld* | linux*aout* | linux*coff*)
+ ;;
+ linux* | k*bsd*-gnu)
+ library_names_spec='$libname$shrext'
+ ;;
+ knetbsd*-gnu)
+ library_names_spec='$libname$shrext'
+ ;;
+ netbsd*)
+ library_names_spec='$libname$shrext'
+ ;;
+ newsos6)
+ library_names_spec='$libname$shrext'
+ ;;
+ nto-qnx*)
+ library_names_spec='$libname$shrext'
+ ;;
+ openbsd*)
+ library_names_spec='$libname$shrext$versuffix'
+ ;;
+ os2*)
+ libname_spec='$name'
+ shrext=.dll
+ library_names_spec='$libname.a'
+ ;;
+ osf3* | osf4* | osf5*)
+ library_names_spec='$libname$shrext'
+ ;;
+ rdos*)
+ ;;
+ solaris*)
+ library_names_spec='$libname$shrext'
+ ;;
+ sunos4*)
+ library_names_spec='$libname$shrext$versuffix'
+ ;;
+ sysv4 | sysv4.3*)
+ library_names_spec='$libname$shrext'
+ ;;
+ sysv4*MP*)
+ library_names_spec='$libname$shrext'
+ ;;
+ sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+ library_names_spec='$libname$shrext'
+ ;;
+ uts4*)
+ library_names_spec='$libname$shrext'
+ ;;
+esac
+
+sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
+escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"`
+shlibext=`echo "$shrext" | sed -e 's,^\.,,'`
+escaped_libname_spec=`echo "X$libname_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
+escaped_library_names_spec=`echo "X$library_names_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
+escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
+
+LC_ALL=C sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <<EOF
+
+# How to pass a linker flag through the compiler.
+wl="$escaped_wl"
+
+# Static library suffix (normally "a").
+libext="$libext"
+
+# Shared library suffix (normally "so").
+shlibext="$shlibext"
+
+# Format of library name prefix.
+libname_spec="$escaped_libname_spec"
+
+# Library names that the linker finds when passed -lNAME.
+library_names_spec="$escaped_library_names_spec"
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec="$escaped_hardcode_libdir_flag_spec"
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator="$hardcode_libdir_separator"
+
+# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct="$hardcode_direct"
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L="$hardcode_minus_L"
+
+EOF
diff --git a/config.sub b/config.sub
new file mode 100755
index 0000000..6759825
--- /dev/null
+++ b/config.sub
@@ -0,0 +1,1658 @@
+#! /bin/sh
+# Configuration validation subroutine script.
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
+# Free Software Foundation, Inc.
+
+timestamp='2008-01-16'
+
+# This file is (in principle) common to ALL GNU software.
+# The presence of a machine in this file suggests that SOME GNU software
+# can handle that machine. It does not imply ALL GNU software can.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+# 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+
+# Please send patches to <config-patches@gnu.org>. Submit a context
+# diff and a properly formatted ChangeLog entry.
+#
+# Configuration subroutine to validate and canonicalize a configuration type.
+# Supply the specified configuration type as an argument.
+# If it is invalid, we print an error message on stderr and exit with code 1.
+# Otherwise, we print the canonical config type on stdout and succeed.
+
+# This file is supposed to be the same for all GNU packages
+# and recognize all the CPU types, system types and aliases
+# that are meaningful with *any* GNU software.
+# Each package is responsible for reporting which valid configurations
+# it does not support. The user should be able to distinguish
+# a failure to support a valid configuration from a meaningless
+# configuration.
+
+# The goal of this file is to map all the various variations of a given
+# machine specification into a single specification in the form:
+# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or in some cases, the newer four-part form:
+# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+# It is wrong to echo any other type of specification.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION] CPU-MFR-OPSYS
+ $0 [OPTION] ALIAS
+
+Canonicalize a configuration name.
+
+Operation modes:
+ -h, --help print this help, then exit
+ -t, --time-stamp print date of last modification, then exit
+ -v, --version print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.sub ($timestamp)
+
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
+2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions. There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+ case $1 in
+ --time-stamp | --time* | -t )
+ echo "$timestamp" ; exit ;;
+ --version | -v )
+ echo "$version" ; exit ;;
+ --help | --h* | -h )
+ echo "$usage"; exit ;;
+ -- ) # Stop option processing
+ shift; break ;;
+ - ) # Use stdin as input.
+ break ;;
+ -* )
+ echo "$me: invalid option $1$help"
+ exit 1 ;;
+
+ *local*)
+ # First pass through any local machine types.
+ echo $1
+ exit ;;
+
+ * )
+ break ;;
+ esac
+done
+
+case $# in
+ 0) echo "$me: missing argument$help" >&2
+ exit 1;;
+ 1) ;;
+ *) echo "$me: too many arguments$help" >&2
+ exit 1;;
+esac
+
+# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
+# Here we must recognize all the valid KERNEL-OS combinations.
+maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+case $maybe_os in
+ nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
+ uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
+ storm-chaos* | os2-emx* | rtmk-nova*)
+ os=-$maybe_os
+ basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+ ;;
+ *)
+ basic_machine=`echo $1 | sed 's/-[^-]*$//'`
+ if [ $basic_machine != $1 ]
+ then os=`echo $1 | sed 's/.*-/-/'`
+ else os=; fi
+ ;;
+esac
+
+### Let's recognize common machines as not being operating systems so
+### that things like config.sub decstation-3100 work. We also
+### recognize some manufacturers as not being operating systems, so we
+### can provide default operating systems below.
+case $os in
+ -sun*os*)
+ # Prevent following clause from handling this invalid input.
+ ;;
+ -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
+ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
+ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
+ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
+ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
+ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
+ -apple | -axis | -knuth | -cray)
+ os=
+ basic_machine=$1
+ ;;
+ -sim | -cisco | -oki | -wec | -winbond)
+ os=
+ basic_machine=$1
+ ;;
+ -scout)
+ ;;
+ -wrs)
+ os=-vxworks
+ basic_machine=$1
+ ;;
+ -chorusos*)
+ os=-chorusos
+ basic_machine=$1
+ ;;
+ -chorusrdb)
+ os=-chorusrdb
+ basic_machine=$1
+ ;;
+ -hiux*)
+ os=-hiuxwe2
+ ;;
+ -sco6)
+ os=-sco5v6
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco5)
+ os=-sco3.2v5
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco4)
+ os=-sco3.2v4
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco3.2.[4-9]*)
+ os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco3.2v[4-9]*)
+ # Don't forget version if it is 3.2v4 or newer.
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco5v6*)
+ # Don't forget version if it is 3.2v4 or newer.
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco*)
+ os=-sco3.2v2
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -udk*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -isc)
+ os=-isc2.2
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -clix*)
+ basic_machine=clipper-intergraph
+ ;;
+ -isc*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -lynx*)
+ os=-lynxos
+ ;;
+ -ptx*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
+ ;;
+ -windowsnt*)
+ os=`echo $os | sed -e 's/windowsnt/winnt/'`
+ ;;
+ -psos*)
+ os=-psos
+ ;;
+ -mint | -mint[0-9]*)
+ basic_machine=m68k-atari
+ os=-mint
+ ;;
+esac
+
+# Decode aliases for certain CPU-COMPANY combinations.
+case $basic_machine in
+ # Recognize the basic CPU types without company name.
+ # Some are omitted here because they have special meanings below.
+ 1750a | 580 \
+ | a29k \
+ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
+ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
+ | am33_2.0 \
+ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
+ | bfin \
+ | c4x | clipper \
+ | d10v | d30v | dlx | dsp16xx \
+ | fido | fr30 | frv \
+ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+ | i370 | i860 | i960 | ia64 \
+ | ip2k | iq2000 \
+ | m32c | m32r | m32rle | m68000 | m68k | m88k \
+ | maxq | mb | microblaze | mcore | mep \
+ | mips | mipsbe | mipseb | mipsel | mipsle \
+ | mips16 \
+ | mips64 | mips64el \
+ | mips64vr | mips64vrel \
+ | mips64orion | mips64orionel \
+ | mips64vr4100 | mips64vr4100el \
+ | mips64vr4300 | mips64vr4300el \
+ | mips64vr5000 | mips64vr5000el \
+ | mips64vr5900 | mips64vr5900el \
+ | mipsisa32 | mipsisa32el \
+ | mipsisa32r2 | mipsisa32r2el \
+ | mipsisa64 | mipsisa64el \
+ | mipsisa64r2 | mipsisa64r2el \
+ | mipsisa64sb1 | mipsisa64sb1el \
+ | mipsisa64sr71k | mipsisa64sr71kel \
+ | mipstx39 | mipstx39el \
+ | mn10200 | mn10300 \
+ | mt \
+ | msp430 \
+ | nios | nios2 \
+ | ns16k | ns32k \
+ | or32 \
+ | pdp10 | pdp11 | pj | pjl \
+ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
+ | pyramid \
+ | score \
+ | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
+ | sh64 | sh64le \
+ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
+ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \
+ | spu | strongarm \
+ | tahoe | thumb | tic4x | tic80 | tron \
+ | v850 | v850e \
+ | we32k \
+ | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
+ | z8k)
+ basic_machine=$basic_machine-unknown
+ ;;
+ m6811 | m68hc11 | m6812 | m68hc12)
+ # Motorola 68HC11/12.
+ basic_machine=$basic_machine-unknown
+ os=-none
+ ;;
+ m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
+ ;;
+ ms1)
+ basic_machine=mt-unknown
+ ;;
+
+ # We use `pc' rather than `unknown'
+ # because (1) that's what they normally are, and
+ # (2) the word "unknown" tends to confuse beginning users.
+ i*86 | x86_64)
+ basic_machine=$basic_machine-pc
+ ;;
+ # Object if more than one company name word.
+ *-*-*)
+ echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+ exit 1
+ ;;
+ # Recognize the basic CPU types with company name.
+ 580-* \
+ | a29k-* \
+ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
+ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
+ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
+ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \
+ | avr-* | avr32-* \
+ | bfin-* | bs2000-* \
+ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
+ | clipper-* | craynv-* | cydra-* \
+ | d10v-* | d30v-* | dlx-* \
+ | elxsi-* \
+ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
+ | h8300-* | h8500-* \
+ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
+ | i*86-* | i860-* | i960-* | ia64-* \
+ | ip2k-* | iq2000-* \
+ | m32c-* | m32r-* | m32rle-* \
+ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
+ | m88110-* | m88k-* | maxq-* | mcore-* \
+ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
+ | mips16-* \
+ | mips64-* | mips64el-* \
+ | mips64vr-* | mips64vrel-* \
+ | mips64orion-* | mips64orionel-* \
+ | mips64vr4100-* | mips64vr4100el-* \
+ | mips64vr4300-* | mips64vr4300el-* \
+ | mips64vr5000-* | mips64vr5000el-* \
+ | mips64vr5900-* | mips64vr5900el-* \
+ | mipsisa32-* | mipsisa32el-* \
+ | mipsisa32r2-* | mipsisa32r2el-* \
+ | mipsisa64-* | mipsisa64el-* \
+ | mipsisa64r2-* | mipsisa64r2el-* \
+ | mipsisa64sb1-* | mipsisa64sb1el-* \
+ | mipsisa64sr71k-* | mipsisa64sr71kel-* \
+ | mipstx39-* | mipstx39el-* \
+ | mmix-* \
+ | mt-* \
+ | msp430-* \
+ | nios-* | nios2-* \
+ | none-* | np1-* | ns16k-* | ns32k-* \
+ | orion-* \
+ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
+ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
+ | pyramid-* \
+ | romp-* | rs6000-* \
+ | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
+ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
+ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
+ | sparclite-* \
+ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
+ | tahoe-* | thumb-* \
+ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
+ | tron-* \
+ | v850-* | v850e-* | vax-* \
+ | we32k-* \
+ | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
+ | xstormy16-* | xtensa*-* \
+ | ymp-* \
+ | z8k-*)
+ ;;
+ # Recognize the basic CPU types without company name, with glob match.
+ xtensa*)
+ basic_machine=$basic_machine-unknown
+ ;;
+ # Recognize the various machine names and aliases which stand
+ # for a CPU type and a company and sometimes even an OS.
+ 386bsd)
+ basic_machine=i386-unknown
+ os=-bsd
+ ;;
+ 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
+ basic_machine=m68000-att
+ ;;
+ 3b*)
+ basic_machine=we32k-att
+ ;;
+ a29khif)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ abacus)
+ basic_machine=abacus-unknown
+ ;;
+ adobe68k)
+ basic_machine=m68010-adobe
+ os=-scout
+ ;;
+ alliant | fx80)
+ basic_machine=fx80-alliant
+ ;;
+ altos | altos3068)
+ basic_machine=m68k-altos
+ ;;
+ am29k)
+ basic_machine=a29k-none
+ os=-bsd
+ ;;
+ amd64)
+ basic_machine=x86_64-pc
+ ;;
+ amd64-*)
+ basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ amdahl)
+ basic_machine=580-amdahl
+ os=-sysv
+ ;;
+ amiga | amiga-*)
+ basic_machine=m68k-unknown
+ ;;
+ amigaos | amigados)
+ basic_machine=m68k-unknown
+ os=-amigaos
+ ;;
+ amigaunix | amix)
+ basic_machine=m68k-unknown
+ os=-sysv4
+ ;;
+ apollo68)
+ basic_machine=m68k-apollo
+ os=-sysv
+ ;;
+ apollo68bsd)
+ basic_machine=m68k-apollo
+ os=-bsd
+ ;;
+ aux)
+ basic_machine=m68k-apple
+ os=-aux
+ ;;
+ balance)
+ basic_machine=ns32k-sequent
+ os=-dynix
+ ;;
+ blackfin)
+ basic_machine=bfin-unknown
+ os=-linux
+ ;;
+ blackfin-*)
+ basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
+ os=-linux
+ ;;
+ c90)
+ basic_machine=c90-cray
+ os=-unicos
+ ;;
+ convex-c1)
+ basic_machine=c1-convex
+ os=-bsd
+ ;;
+ convex-c2)
+ basic_machine=c2-convex
+ os=-bsd
+ ;;
+ convex-c32)
+ basic_machine=c32-convex
+ os=-bsd
+ ;;
+ convex-c34)
+ basic_machine=c34-convex
+ os=-bsd
+ ;;
+ convex-c38)
+ basic_machine=c38-convex
+ os=-bsd
+ ;;
+ cray | j90)
+ basic_machine=j90-cray
+ os=-unicos
+ ;;
+ craynv)
+ basic_machine=craynv-cray
+ os=-unicosmp
+ ;;
+ cr16)
+ basic_machine=cr16-unknown
+ os=-elf
+ ;;
+ crds | unos)
+ basic_machine=m68k-crds
+ ;;
+ crisv32 | crisv32-* | etraxfs*)
+ basic_machine=crisv32-axis
+ ;;
+ cris | cris-* | etrax*)
+ basic_machine=cris-axis
+ ;;
+ crx)
+ basic_machine=crx-unknown
+ os=-elf
+ ;;
+ da30 | da30-*)
+ basic_machine=m68k-da30
+ ;;
+ decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
+ basic_machine=mips-dec
+ ;;
+ decsystem10* | dec10*)
+ basic_machine=pdp10-dec
+ os=-tops10
+ ;;
+ decsystem20* | dec20*)
+ basic_machine=pdp10-dec
+ os=-tops20
+ ;;
+ delta | 3300 | motorola-3300 | motorola-delta \
+ | 3300-motorola | delta-motorola)
+ basic_machine=m68k-motorola
+ ;;
+ delta88)
+ basic_machine=m88k-motorola
+ os=-sysv3
+ ;;
+ djgpp)
+ basic_machine=i586-pc
+ os=-msdosdjgpp
+ ;;
+ dpx20 | dpx20-*)
+ basic_machine=rs6000-bull
+ os=-bosx
+ ;;
+ dpx2* | dpx2*-bull)
+ basic_machine=m68k-bull
+ os=-sysv3
+ ;;
+ ebmon29k)
+ basic_machine=a29k-amd
+ os=-ebmon
+ ;;
+ elxsi)
+ basic_machine=elxsi-elxsi
+ os=-bsd
+ ;;
+ encore | umax | mmax)
+ basic_machine=ns32k-encore
+ ;;
+ es1800 | OSE68k | ose68k | ose | OSE)
+ basic_machine=m68k-ericsson
+ os=-ose
+ ;;
+ fx2800)
+ basic_machine=i860-alliant
+ ;;
+ genix)
+ basic_machine=ns32k-ns
+ ;;
+ gmicro)
+ basic_machine=tron-gmicro
+ os=-sysv
+ ;;
+ go32)
+ basic_machine=i386-pc
+ os=-go32
+ ;;
+ h3050r* | hiux*)
+ basic_machine=hppa1.1-hitachi
+ os=-hiuxwe2
+ ;;
+ h8300hms)
+ basic_machine=h8300-hitachi
+ os=-hms
+ ;;
+ h8300xray)
+ basic_machine=h8300-hitachi
+ os=-xray
+ ;;
+ h8500hms)
+ basic_machine=h8500-hitachi
+ os=-hms
+ ;;
+ harris)
+ basic_machine=m88k-harris
+ os=-sysv3
+ ;;
+ hp300-*)
+ basic_machine=m68k-hp
+ ;;
+ hp300bsd)
+ basic_machine=m68k-hp
+ os=-bsd
+ ;;
+ hp300hpux)
+ basic_machine=m68k-hp
+ os=-hpux
+ ;;
+ hp3k9[0-9][0-9] | hp9[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ hp9k2[0-9][0-9] | hp9k31[0-9])
+ basic_machine=m68000-hp
+ ;;
+ hp9k3[2-9][0-9])
+ basic_machine=m68k-hp
+ ;;
+ hp9k6[0-9][0-9] | hp6[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ hp9k7[0-79][0-9] | hp7[0-79][0-9])
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k78[0-9] | hp78[0-9])
+ # FIXME: really hppa2.0-hp
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
+ # FIXME: really hppa2.0-hp
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[0-9][13679] | hp8[0-9][13679])
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[0-9][0-9] | hp8[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ hppa-next)
+ os=-nextstep3
+ ;;
+ hppaosf)
+ basic_machine=hppa1.1-hp
+ os=-osf
+ ;;
+ hppro)
+ basic_machine=hppa1.1-hp
+ os=-proelf
+ ;;
+ i370-ibm* | ibm*)
+ basic_machine=i370-ibm
+ ;;
+# I'm not sure what "Sysv32" means. Should this be sysv3.2?
+ i*86v32)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv32
+ ;;
+ i*86v4*)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv4
+ ;;
+ i*86v)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv
+ ;;
+ i*86sol2)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-solaris2
+ ;;
+ i386mach)
+ basic_machine=i386-mach
+ os=-mach
+ ;;
+ i386-vsta | vsta)
+ basic_machine=i386-unknown
+ os=-vsta
+ ;;
+ iris | iris4d)
+ basic_machine=mips-sgi
+ case $os in
+ -irix*)
+ ;;
+ *)
+ os=-irix4
+ ;;
+ esac
+ ;;
+ isi68 | isi)
+ basic_machine=m68k-isi
+ os=-sysv
+ ;;
+ m68knommu)
+ basic_machine=m68k-unknown
+ os=-linux
+ ;;
+ m68knommu-*)
+ basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
+ os=-linux
+ ;;
+ m88k-omron*)
+ basic_machine=m88k-omron
+ ;;
+ magnum | m3230)
+ basic_machine=mips-mips
+ os=-sysv
+ ;;
+ merlin)
+ basic_machine=ns32k-utek
+ os=-sysv
+ ;;
+ mingw32)
+ basic_machine=i386-pc
+ os=-mingw32
+ ;;
+ mingw32ce)
+ basic_machine=arm-unknown
+ os=-mingw32ce
+ ;;
+ miniframe)
+ basic_machine=m68000-convergent
+ ;;
+ *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
+ basic_machine=m68k-atari
+ os=-mint
+ ;;
+ mips3*-*)
+ basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
+ ;;
+ mips3*)
+ basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
+ ;;
+ monitor)
+ basic_machine=m68k-rom68k
+ os=-coff
+ ;;
+ morphos)
+ basic_machine=powerpc-unknown
+ os=-morphos
+ ;;
+ msdos)
+ basic_machine=i386-pc
+ os=-msdos
+ ;;
+ ms1-*)
+ basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
+ ;;
+ mvs)
+ basic_machine=i370-ibm
+ os=-mvs
+ ;;
+ ncr3000)
+ basic_machine=i486-ncr
+ os=-sysv4
+ ;;
+ netbsd386)
+ basic_machine=i386-unknown
+ os=-netbsd
+ ;;
+ netwinder)
+ basic_machine=armv4l-rebel
+ os=-linux
+ ;;
+ news | news700 | news800 | news900)
+ basic_machine=m68k-sony
+ os=-newsos
+ ;;
+ news1000)
+ basic_machine=m68030-sony
+ os=-newsos
+ ;;
+ news-3600 | risc-news)
+ basic_machine=mips-sony
+ os=-newsos
+ ;;
+ necv70)
+ basic_machine=v70-nec
+ os=-sysv
+ ;;
+ next | m*-next )
+ basic_machine=m68k-next
+ case $os in
+ -nextstep* )
+ ;;
+ -ns2*)
+ os=-nextstep2
+ ;;
+ *)
+ os=-nextstep3
+ ;;
+ esac
+ ;;
+ nh3000)
+ basic_machine=m68k-harris
+ os=-cxux
+ ;;
+ nh[45]000)
+ basic_machine=m88k-harris
+ os=-cxux
+ ;;
+ nindy960)
+ basic_machine=i960-intel
+ os=-nindy
+ ;;
+ mon960)
+ basic_machine=i960-intel
+ os=-mon960
+ ;;
+ nonstopux)
+ basic_machine=mips-compaq
+ os=-nonstopux
+ ;;
+ np1)
+ basic_machine=np1-gould
+ ;;
+ nsr-tandem)
+ basic_machine=nsr-tandem
+ ;;
+ op50n-* | op60c-*)
+ basic_machine=hppa1.1-oki
+ os=-proelf
+ ;;
+ openrisc | openrisc-*)
+ basic_machine=or32-unknown
+ ;;
+ os400)
+ basic_machine=powerpc-ibm
+ os=-os400
+ ;;
+ OSE68000 | ose68000)
+ basic_machine=m68000-ericsson
+ os=-ose
+ ;;
+ os68k)
+ basic_machine=m68k-none
+ os=-os68k
+ ;;
+ pa-hitachi)
+ basic_machine=hppa1.1-hitachi
+ os=-hiuxwe2
+ ;;
+ paragon)
+ basic_machine=i860-intel
+ os=-osf
+ ;;
+ parisc)
+ basic_machine=hppa-unknown
+ os=-linux
+ ;;
+ parisc-*)
+ basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
+ os=-linux
+ ;;
+ pbd)
+ basic_machine=sparc-tti
+ ;;
+ pbb)
+ basic_machine=m68k-tti
+ ;;
+ pc532 | pc532-*)
+ basic_machine=ns32k-pc532
+ ;;
+ pc98)
+ basic_machine=i386-pc
+ ;;
+ pc98-*)
+ basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentium | p5 | k5 | k6 | nexgen | viac3)
+ basic_machine=i586-pc
+ ;;
+ pentiumpro | p6 | 6x86 | athlon | athlon_*)
+ basic_machine=i686-pc
+ ;;
+ pentiumii | pentium2 | pentiumiii | pentium3)
+ basic_machine=i686-pc
+ ;;
+ pentium4)
+ basic_machine=i786-pc
+ ;;
+ pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
+ basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentiumpro-* | p6-* | 6x86-* | athlon-*)
+ basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
+ basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentium4-*)
+ basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pn)
+ basic_machine=pn-gould
+ ;;
+ power) basic_machine=power-ibm
+ ;;
+ ppc) basic_machine=powerpc-unknown
+ ;;
+ ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ppcle | powerpclittle | ppc-le | powerpc-little)
+ basic_machine=powerpcle-unknown
+ ;;
+ ppcle-* | powerpclittle-*)
+ basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ppc64) basic_machine=powerpc64-unknown
+ ;;
+ ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ppc64le | powerpc64little | ppc64-le | powerpc64-little)
+ basic_machine=powerpc64le-unknown
+ ;;
+ ppc64le-* | powerpc64little-*)
+ basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ps2)
+ basic_machine=i386-ibm
+ ;;
+ pw32)
+ basic_machine=i586-unknown
+ os=-pw32
+ ;;
+ rdos)
+ basic_machine=i386-pc
+ os=-rdos
+ ;;
+ rom68k)
+ basic_machine=m68k-rom68k
+ os=-coff
+ ;;
+ rm[46]00)
+ basic_machine=mips-siemens
+ ;;
+ rtpc | rtpc-*)
+ basic_machine=romp-ibm
+ ;;
+ s390 | s390-*)
+ basic_machine=s390-ibm
+ ;;
+ s390x | s390x-*)
+ basic_machine=s390x-ibm
+ ;;
+ sa29200)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ sb1)
+ basic_machine=mipsisa64sb1-unknown
+ ;;
+ sb1el)
+ basic_machine=mipsisa64sb1el-unknown
+ ;;
+ sde)
+ basic_machine=mipsisa32-sde
+ os=-elf
+ ;;
+ sei)
+ basic_machine=mips-sei
+ os=-seiux
+ ;;
+ sequent)
+ basic_machine=i386-sequent
+ ;;
+ sh)
+ basic_machine=sh-hitachi
+ os=-hms
+ ;;
+ sh5el)
+ basic_machine=sh5le-unknown
+ ;;
+ sh64)
+ basic_machine=sh64-unknown
+ ;;
+ sparclite-wrs | simso-wrs)
+ basic_machine=sparclite-wrs
+ os=-vxworks
+ ;;
+ sps7)
+ basic_machine=m68k-bull
+ os=-sysv2
+ ;;
+ spur)
+ basic_machine=spur-unknown
+ ;;
+ st2000)
+ basic_machine=m68k-tandem
+ ;;
+ stratus)
+ basic_machine=i860-stratus
+ os=-sysv4
+ ;;
+ sun2)
+ basic_machine=m68000-sun
+ ;;
+ sun2os3)
+ basic_machine=m68000-sun
+ os=-sunos3
+ ;;
+ sun2os4)
+ basic_machine=m68000-sun
+ os=-sunos4
+ ;;
+ sun3os3)
+ basic_machine=m68k-sun
+ os=-sunos3
+ ;;
+ sun3os4)
+ basic_machine=m68k-sun
+ os=-sunos4
+ ;;
+ sun4os3)
+ basic_machine=sparc-sun
+ os=-sunos3
+ ;;
+ sun4os4)
+ basic_machine=sparc-sun
+ os=-sunos4
+ ;;
+ sun4sol2)
+ basic_machine=sparc-sun
+ os=-solaris2
+ ;;
+ sun3 | sun3-*)
+ basic_machine=m68k-sun
+ ;;
+ sun4)
+ basic_machine=sparc-sun
+ ;;
+ sun386 | sun386i | roadrunner)
+ basic_machine=i386-sun
+ ;;
+ sv1)
+ basic_machine=sv1-cray
+ os=-unicos
+ ;;
+ symmetry)
+ basic_machine=i386-sequent
+ os=-dynix
+ ;;
+ t3e)
+ basic_machine=alphaev5-cray
+ os=-unicos
+ ;;
+ t90)
+ basic_machine=t90-cray
+ os=-unicos
+ ;;
+ tic54x | c54x*)
+ basic_machine=tic54x-unknown
+ os=-coff
+ ;;
+ tic55x | c55x*)
+ basic_machine=tic55x-unknown
+ os=-coff
+ ;;
+ tic6x | c6x*)
+ basic_machine=tic6x-unknown
+ os=-coff
+ ;;
+ tile*)
+ basic_machine=tile-unknown
+ os=-linux-gnu
+ ;;
+ tx39)
+ basic_machine=mipstx39-unknown
+ ;;
+ tx39el)
+ basic_machine=mipstx39el-unknown
+ ;;
+ toad1)
+ basic_machine=pdp10-xkl
+ os=-tops20
+ ;;
+ tower | tower-32)
+ basic_machine=m68k-ncr
+ ;;
+ tpf)
+ basic_machine=s390x-ibm
+ os=-tpf
+ ;;
+ udi29k)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ ultra3)
+ basic_machine=a29k-nyu
+ os=-sym1
+ ;;
+ v810 | necv810)
+ basic_machine=v810-nec
+ os=-none
+ ;;
+ vaxv)
+ basic_machine=vax-dec
+ os=-sysv
+ ;;
+ vms)
+ basic_machine=vax-dec
+ os=-vms
+ ;;
+ vpp*|vx|vx-*)
+ basic_machine=f301-fujitsu
+ ;;
+ vxworks960)
+ basic_machine=i960-wrs
+ os=-vxworks
+ ;;
+ vxworks68)
+ basic_machine=m68k-wrs
+ os=-vxworks
+ ;;
+ vxworks29k)
+ basic_machine=a29k-wrs
+ os=-vxworks
+ ;;
+ w65*)
+ basic_machine=w65-wdc
+ os=-none
+ ;;
+ w89k-*)
+ basic_machine=hppa1.1-winbond
+ os=-proelf
+ ;;
+ xbox)
+ basic_machine=i686-pc
+ os=-mingw32
+ ;;
+ xps | xps100)
+ basic_machine=xps100-honeywell
+ ;;
+ ymp)
+ basic_machine=ymp-cray
+ os=-unicos
+ ;;
+ z8k-*-coff)
+ basic_machine=z8k-unknown
+ os=-sim
+ ;;
+ none)
+ basic_machine=none-none
+ os=-none
+ ;;
+
+# Here we handle the default manufacturer of certain CPU types. It is in
+# some cases the only manufacturer, in others, it is the most popular.
+ w89k)
+ basic_machine=hppa1.1-winbond
+ ;;
+ op50n)
+ basic_machine=hppa1.1-oki
+ ;;
+ op60c)
+ basic_machine=hppa1.1-oki
+ ;;
+ romp)
+ basic_machine=romp-ibm
+ ;;
+ mmix)
+ basic_machine=mmix-knuth
+ ;;
+ rs6000)
+ basic_machine=rs6000-ibm
+ ;;
+ vax)
+ basic_machine=vax-dec
+ ;;
+ pdp10)
+ # there are many clones, so DEC is not a safe bet
+ basic_machine=pdp10-unknown
+ ;;
+ pdp11)
+ basic_machine=pdp11-dec
+ ;;
+ we32k)
+ basic_machine=we32k-att
+ ;;
+ sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
+ basic_machine=sh-unknown
+ ;;
+ sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
+ basic_machine=sparc-sun
+ ;;
+ cydra)
+ basic_machine=cydra-cydrome
+ ;;
+ orion)
+ basic_machine=orion-highlevel
+ ;;
+ orion105)
+ basic_machine=clipper-highlevel
+ ;;
+ mac | mpw | mac-mpw)
+ basic_machine=m68k-apple
+ ;;
+ pmac | pmac-mpw)
+ basic_machine=powerpc-apple
+ ;;
+ *-unknown)
+ # Make sure to match an already-canonicalized machine name.
+ ;;
+ *)
+ echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+ exit 1
+ ;;
+esac
+
+# Here we canonicalize certain aliases for manufacturers.
+case $basic_machine in
+ *-digital*)
+ basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
+ ;;
+ *-commodore*)
+ basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
+ ;;
+ *)
+ ;;
+esac
+
+# Decode manufacturer-specific aliases for certain operating systems.
+
+if [ x"$os" != x"" ]
+then
+case $os in
+ # First match some system type aliases
+ # that might get confused with valid system types.
+ # -solaris* is a basic system type, with this one exception.
+ -solaris1 | -solaris1.*)
+ os=`echo $os | sed -e 's|solaris1|sunos4|'`
+ ;;
+ -solaris)
+ os=-solaris2
+ ;;
+ -svr4*)
+ os=-sysv4
+ ;;
+ -unixware*)
+ os=-sysv4.2uw
+ ;;
+ -gnu/linux*)
+ os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
+ ;;
+ # First accept the basic system types.
+ # The portable systems comes first.
+ # Each alternative MUST END IN A *, to match a version number.
+ # -sysv* is not here because it comes later, after sysvr4.
+ -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
+ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
+ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
+ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
+ | -aos* \
+ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
+ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
+ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
+ | -openbsd* | -solidbsd* \
+ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
+ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
+ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
+ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+ | -chorusos* | -chorusrdb* \
+ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+ | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
+ | -uxpv* | -beos* | -mpeix* | -udk* \
+ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
+ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
+ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
+ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
+ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
+ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
+ | -skyos* | -haiku* | -rdos* | -toppers* | -drops*)
+ # Remember, each alternative MUST END IN *, to match a version number.
+ ;;
+ -qnx*)
+ case $basic_machine in
+ x86-* | i*86-*)
+ ;;
+ *)
+ os=-nto$os
+ ;;
+ esac
+ ;;
+ -nto-qnx*)
+ ;;
+ -nto*)
+ os=`echo $os | sed -e 's|nto|nto-qnx|'`
+ ;;
+ -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
+ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
+ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
+ ;;
+ -mac*)
+ os=`echo $os | sed -e 's|mac|macos|'`
+ ;;
+ -linux-dietlibc)
+ os=-linux-dietlibc
+ ;;
+ -linux*)
+ os=`echo $os | sed -e 's|linux|linux-gnu|'`
+ ;;
+ -sunos5*)
+ os=`echo $os | sed -e 's|sunos5|solaris2|'`
+ ;;
+ -sunos6*)
+ os=`echo $os | sed -e 's|sunos6|solaris3|'`
+ ;;
+ -opened*)
+ os=-openedition
+ ;;
+ -os400*)
+ os=-os400
+ ;;
+ -wince*)
+ os=-wince
+ ;;
+ -osfrose*)
+ os=-osfrose
+ ;;
+ -osf*)
+ os=-osf
+ ;;
+ -utek*)
+ os=-bsd
+ ;;
+ -dynix*)
+ os=-bsd
+ ;;
+ -acis*)
+ os=-aos
+ ;;
+ -atheos*)
+ os=-atheos
+ ;;
+ -syllable*)
+ os=-syllable
+ ;;
+ -386bsd)
+ os=-bsd
+ ;;
+ -ctix* | -uts*)
+ os=-sysv
+ ;;
+ -nova*)
+ os=-rtmk-nova
+ ;;
+ -ns2 )
+ os=-nextstep2
+ ;;
+ -nsk*)
+ os=-nsk
+ ;;
+ # Preserve the version number of sinix5.
+ -sinix5.*)
+ os=`echo $os | sed -e 's|sinix|sysv|'`
+ ;;
+ -sinix*)
+ os=-sysv4
+ ;;
+ -tpf*)
+ os=-tpf
+ ;;
+ -triton*)
+ os=-sysv3
+ ;;
+ -oss*)
+ os=-sysv3
+ ;;
+ -svr4)
+ os=-sysv4
+ ;;
+ -svr3)
+ os=-sysv3
+ ;;
+ -sysvr4)
+ os=-sysv4
+ ;;
+ # This must come after -sysvr4.
+ -sysv*)
+ ;;
+ -ose*)
+ os=-ose
+ ;;
+ -es1800*)
+ os=-ose
+ ;;
+ -xenix)
+ os=-xenix
+ ;;
+ -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+ os=-mint
+ ;;
+ -aros*)
+ os=-aros
+ ;;
+ -kaos*)
+ os=-kaos
+ ;;
+ -zvmoe)
+ os=-zvmoe
+ ;;
+ -none)
+ ;;
+ *)
+ # Get rid of the `-' at the beginning of $os.
+ os=`echo $os | sed 's/[^-]*-//'`
+ echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
+ exit 1
+ ;;
+esac
+else
+
+# Here we handle the default operating systems that come with various machines.
+# The value should be what the vendor currently ships out the door with their
+# machine or put another way, the most popular os provided with the machine.
+
+# Note that if you're going to try to match "-MANUFACTURER" here (say,
+# "-sun"), then you have to tell the case statement up towards the top
+# that MANUFACTURER isn't an operating system. Otherwise, code above
+# will signal an error saying that MANUFACTURER isn't an operating
+# system, and we'll never get to this point.
+
+case $basic_machine in
+ score-*)
+ os=-elf
+ ;;
+ spu-*)
+ os=-elf
+ ;;
+ *-acorn)
+ os=-riscix1.2
+ ;;
+ arm*-rebel)
+ os=-linux
+ ;;
+ arm*-semi)
+ os=-aout
+ ;;
+ c4x-* | tic4x-*)
+ os=-coff
+ ;;
+ # This must come before the *-dec entry.
+ pdp10-*)
+ os=-tops20
+ ;;
+ pdp11-*)
+ os=-none
+ ;;
+ *-dec | vax-*)
+ os=-ultrix4.2
+ ;;
+ m68*-apollo)
+ os=-domain
+ ;;
+ i386-sun)
+ os=-sunos4.0.2
+ ;;
+ m68000-sun)
+ os=-sunos3
+ # This also exists in the configure program, but was not the
+ # default.
+ # os=-sunos4
+ ;;
+ m68*-cisco)
+ os=-aout
+ ;;
+ mep-*)
+ os=-elf
+ ;;
+ mips*-cisco)
+ os=-elf
+ ;;
+ mips*-*)
+ os=-elf
+ ;;
+ or32-*)
+ os=-coff
+ ;;
+ *-tti) # must be before sparc entry or we get the wrong os.
+ os=-sysv3
+ ;;
+ sparc-* | *-sun)
+ os=-sunos4.1.1
+ ;;
+ *-be)
+ os=-beos
+ ;;
+ *-haiku)
+ os=-haiku
+ ;;
+ *-ibm)
+ os=-aix
+ ;;
+ *-knuth)
+ os=-mmixware
+ ;;
+ *-wec)
+ os=-proelf
+ ;;
+ *-winbond)
+ os=-proelf
+ ;;
+ *-oki)
+ os=-proelf
+ ;;
+ *-hp)
+ os=-hpux
+ ;;
+ *-hitachi)
+ os=-hiux
+ ;;
+ i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
+ os=-sysv
+ ;;
+ *-cbm)
+ os=-amigaos
+ ;;
+ *-dg)
+ os=-dgux
+ ;;
+ *-dolphin)
+ os=-sysv3
+ ;;
+ m68k-ccur)
+ os=-rtu
+ ;;
+ m88k-omron*)
+ os=-luna
+ ;;
+ *-next )
+ os=-nextstep
+ ;;
+ *-sequent)
+ os=-ptx
+ ;;
+ *-crds)
+ os=-unos
+ ;;
+ *-ns)
+ os=-genix
+ ;;
+ i370-*)
+ os=-mvs
+ ;;
+ *-next)
+ os=-nextstep3
+ ;;
+ *-gould)
+ os=-sysv
+ ;;
+ *-highlevel)
+ os=-bsd
+ ;;
+ *-encore)
+ os=-bsd
+ ;;
+ *-sgi)
+ os=-irix
+ ;;
+ *-siemens)
+ os=-sysv4
+ ;;
+ *-masscomp)
+ os=-rtu
+ ;;
+ f30[01]-fujitsu | f700-fujitsu)
+ os=-uxpv
+ ;;
+ *-rom68k)
+ os=-coff
+ ;;
+ *-*bug)
+ os=-coff
+ ;;
+ *-apple)
+ os=-macos
+ ;;
+ *-atari*)
+ os=-mint
+ ;;
+ *)
+ os=-none
+ ;;
+esac
+fi
+
+# Here we handle the case where we know the os, and the CPU type, but not the
+# manufacturer. We pick the logical manufacturer.
+vendor=unknown
+case $basic_machine in
+ *-unknown)
+ case $os in
+ -riscix*)
+ vendor=acorn
+ ;;
+ -sunos*)
+ vendor=sun
+ ;;
+ -aix*)
+ vendor=ibm
+ ;;
+ -beos*)
+ vendor=be
+ ;;
+ -hpux*)
+ vendor=hp
+ ;;
+ -mpeix*)
+ vendor=hp
+ ;;
+ -hiux*)
+ vendor=hitachi
+ ;;
+ -unos*)
+ vendor=crds
+ ;;
+ -dgux*)
+ vendor=dg
+ ;;
+ -luna*)
+ vendor=omron
+ ;;
+ -genix*)
+ vendor=ns
+ ;;
+ -mvs* | -opened*)
+ vendor=ibm
+ ;;
+ -os400*)
+ vendor=ibm
+ ;;
+ -ptx*)
+ vendor=sequent
+ ;;
+ -tpf*)
+ vendor=ibm
+ ;;
+ -vxsim* | -vxworks* | -windiss*)
+ vendor=wrs
+ ;;
+ -aux*)
+ vendor=apple
+ ;;
+ -hms*)
+ vendor=hitachi
+ ;;
+ -mpw* | -macos*)
+ vendor=apple
+ ;;
+ -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+ vendor=atari
+ ;;
+ -vos*)
+ vendor=stratus
+ ;;
+ esac
+ basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
+ ;;
+esac
+
+echo $basic_machine$os
+exit
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/configure b/configure
new file mode 100755
index 0000000..698ff44
--- /dev/null
+++ b/configure
@@ -0,0 +1,19607 @@
+#! /bin/sh
+# Guess values for system-dependent variables and create Makefiles.
+# Generated by GNU Autoconf 2.69 for LCD4Linux 0.11.0-SVN.
+#
+# Report bugs to <lcd4linux-users@lists.sourceforge.net>.
+#
+#
+# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
+#
+#
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+## -------------------- ##
+## M4sh Initialization. ##
+## -------------------- ##
+
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
+ emulate sh
+ NULLCMD=:
+ # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in #(
+ *posix*) :
+ set -o posix ;; #(
+ *) :
+ ;;
+esac
+fi
+
+
+as_nl='
+'
+export as_nl
+# Printing a long string crashes Solaris 7 /usr/bin/printf.
+as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
+# Prefer a ksh shell builtin over an external printf program on Solaris,
+# but without wasting forks for bash or zsh.
+if test -z "$BASH_VERSION$ZSH_VERSION" \
+ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='print -r --'
+ as_echo_n='print -rn --'
+elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='printf %s\n'
+ as_echo_n='printf %s'
+else
+ if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
+ as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
+ as_echo_n='/usr/ucb/echo -n'
+ else
+ as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
+ as_echo_n_body='eval
+ arg=$1;
+ case $arg in #(
+ *"$as_nl"*)
+ expr "X$arg" : "X\\(.*\\)$as_nl";
+ arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
+ esac;
+ expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
+ '
+ export as_echo_n_body
+ as_echo_n='sh -c $as_echo_n_body as_echo'
+ fi
+ export as_echo_body
+ as_echo='sh -c $as_echo_body as_echo'
+fi
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ PATH_SEPARATOR=:
+ (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
+ (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
+ PATH_SEPARATOR=';'
+ }
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order. Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+IFS=" "" $as_nl"
+
+# Find who we are. Look in the path if we contain no directory separator.
+as_myself=
+case $0 in #((
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+ as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+ $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+ exit 1
+fi
+
+# Unset variables that we do not need and which cause bugs (e.g. in
+# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1"
+# suppresses any "Segmentation fault" message there. '((' could
+# trigger a bug in pdksh 5.2.14.
+for as_var in BASH_ENV ENV MAIL MAILPATH
+do eval test x\${$as_var+set} = xset \
+ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
+
+# CDPATH.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+# Use a proper internal environment variable to ensure we don't fall
+ # into an infinite loop, continuously re-executing ourselves.
+ if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then
+ _as_can_reexec=no; export _as_can_reexec;
+ # We cannot yet assume a decent shell, so we have to provide a
+# neutralization value for shells without unset; and this also
+# works around shells that cannot unset nonexistent variables.
+# Preserve -v and -x to the replacement shell.
+BASH_ENV=/dev/null
+ENV=/dev/null
+(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+case $- in # ((((
+ *v*x* | *x*v* ) as_opts=-vx ;;
+ *v* ) as_opts=-v ;;
+ *x* ) as_opts=-x ;;
+ * ) as_opts= ;;
+esac
+exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
+# Admittedly, this is quite paranoid, since all the known shells bail
+# out after a failed `exec'.
+$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
+as_fn_exit 255
+ fi
+ # We don't want this to propagate to other subprocesses.
+ { _as_can_reexec=; unset _as_can_reexec;}
+if test "x$CONFIG_SHELL" = x; then
+ as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
+ emulate sh
+ NULLCMD=:
+ # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '\${1+\"\$@\"}'='\"\$@\"'
+ setopt NO_GLOB_SUBST
+else
+ case \`(set -o) 2>/dev/null\` in #(
+ *posix*) :
+ set -o posix ;; #(
+ *) :
+ ;;
+esac
+fi
+"
+ as_required="as_fn_return () { (exit \$1); }
+as_fn_success () { as_fn_return 0; }
+as_fn_failure () { as_fn_return 1; }
+as_fn_ret_success () { return 0; }
+as_fn_ret_failure () { return 1; }
+
+exitcode=0
+as_fn_success || { exitcode=1; echo as_fn_success failed.; }
+as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; }
+as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; }
+as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; }
+if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :
+
+else
+ exitcode=1; echo positional parameters were not saved.
+fi
+test x\$exitcode = x0 || exit 1
+test -x / || exit 1"
+ as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
+ as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
+ eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
+ test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1
+test \$(( 1 + 1 )) = 2 || exit 1
+
+ test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || (
+ ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+ ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO
+ ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO
+ PATH=/empty FPATH=/empty; export PATH FPATH
+ test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\
+ || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1"
+ if (eval "$as_required") 2>/dev/null; then :
+ as_have_required=yes
+else
+ as_have_required=no
+fi
+ if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then :
+
+else
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+as_found=false
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ as_found=:
+ case $as_dir in #(
+ /*)
+ for as_base in sh bash ksh sh5; do
+ # Try only shells that exist, to save several forks.
+ as_shell=$as_dir/$as_base
+ if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
+ { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then :
+ CONFIG_SHELL=$as_shell as_have_required=yes
+ if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then :
+ break 2
+fi
+fi
+ done;;
+ esac
+ as_found=false
+done
+$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } &&
+ { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then :
+ CONFIG_SHELL=$SHELL as_have_required=yes
+fi; }
+IFS=$as_save_IFS
+
+
+ if test "x$CONFIG_SHELL" != x; then :
+ export CONFIG_SHELL
+ # We cannot yet assume a decent shell, so we have to provide a
+# neutralization value for shells without unset; and this also
+# works around shells that cannot unset nonexistent variables.
+# Preserve -v and -x to the replacement shell.
+BASH_ENV=/dev/null
+ENV=/dev/null
+(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+case $- in # ((((
+ *v*x* | *x*v* ) as_opts=-vx ;;
+ *v* ) as_opts=-v ;;
+ *x* ) as_opts=-x ;;
+ * ) as_opts= ;;
+esac
+exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
+# Admittedly, this is quite paranoid, since all the known shells bail
+# out after a failed `exec'.
+$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
+exit 255
+fi
+
+ if test x$as_have_required = xno; then :
+ $as_echo "$0: This script requires a shell more modern than all"
+ $as_echo "$0: the shells that I found on your system."
+ if test x${ZSH_VERSION+set} = xset ; then
+ $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should"
+ $as_echo "$0: be upgraded to zsh 4.3.4 or later."
+ else
+ $as_echo "$0: Please tell bug-autoconf@gnu.org and
+$0: lcd4linux-users@lists.sourceforge.net about your
+$0: system, including any error possibly output before this
+$0: message. Then install a modern shell, or manually run
+$0: the script under such a shell if you do have one."
+ fi
+ exit 1
+fi
+fi
+fi
+SHELL=${CONFIG_SHELL-/bin/sh}
+export SHELL
+# Unset more variables known to interfere with behavior of common tools.
+CLICOLOR_FORCE= GREP_OPTIONS=
+unset CLICOLOR_FORCE GREP_OPTIONS
+
+## --------------------- ##
+## M4sh Shell Functions. ##
+## --------------------- ##
+# as_fn_unset VAR
+# ---------------
+# Portably unset VAR.
+as_fn_unset ()
+{
+ { eval $1=; unset $1;}
+}
+as_unset=as_fn_unset
+
+# as_fn_set_status STATUS
+# -----------------------
+# Set $? to STATUS, without forking.
+as_fn_set_status ()
+{
+ return $1
+} # as_fn_set_status
+
+# as_fn_exit STATUS
+# -----------------
+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
+as_fn_exit ()
+{
+ set +e
+ as_fn_set_status $1
+ exit $1
+} # as_fn_exit
+
+# as_fn_mkdir_p
+# -------------
+# Create "$as_dir" as a directory, including parents if necessary.
+as_fn_mkdir_p ()
+{
+
+ case $as_dir in #(
+ -*) as_dir=./$as_dir;;
+ esac
+ test -d "$as_dir" || eval $as_mkdir_p || {
+ as_dirs=
+ while :; do
+ case $as_dir in #(
+ *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+ *) as_qdir=$as_dir;;
+ esac
+ as_dirs="'$as_qdir' $as_dirs"
+ as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ test -d "$as_dir" && break
+ done
+ test -z "$as_dirs" || eval "mkdir $as_dirs"
+ } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
+
+
+} # as_fn_mkdir_p
+
+# as_fn_executable_p FILE
+# -----------------------
+# Test if FILE is an executable regular file.
+as_fn_executable_p ()
+{
+ test -f "$1" && test -x "$1"
+} # as_fn_executable_p
+# as_fn_append VAR VALUE
+# ----------------------
+# Append the text in VALUE to the end of the definition contained in VAR. Take
+# advantage of any shell optimizations that allow amortized linear growth over
+# repeated appends, instead of the typical quadratic growth present in naive
+# implementations.
+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
+ eval 'as_fn_append ()
+ {
+ eval $1+=\$2
+ }'
+else
+ as_fn_append ()
+ {
+ eval $1=\$$1\$2
+ }
+fi # as_fn_append
+
+# as_fn_arith ARG...
+# ------------------
+# Perform arithmetic evaluation on the ARGs, and store the result in the
+# global $as_val. Take advantage of shells that can avoid forks. The arguments
+# must be portable across $(()) and expr.
+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
+ eval 'as_fn_arith ()
+ {
+ as_val=$(( $* ))
+ }'
+else
+ as_fn_arith ()
+ {
+ as_val=`expr "$@" || test $? -eq 1`
+ }
+fi # as_fn_arith
+
+
+# as_fn_error STATUS ERROR [LINENO LOG_FD]
+# ----------------------------------------
+# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
+# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
+# script with STATUS, using 1 if that was 0.
+as_fn_error ()
+{
+ as_status=$1; test $as_status -eq 0 && as_status=1
+ if test "$4"; then
+ as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
+ fi
+ $as_echo "$as_me: error: $2" >&2
+ as_fn_exit $as_status
+} # as_fn_error
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+ as_dirname=dirname
+else
+ as_dirname=false
+fi
+
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+
+ as_lineno_1=$LINENO as_lineno_1a=$LINENO
+ as_lineno_2=$LINENO as_lineno_2a=$LINENO
+ eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" &&
+ test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || {
+ # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-)
+ sed -n '
+ p
+ /[$]LINENO/=
+ ' <$as_myself |
+ sed '
+ s/[$]LINENO.*/&-/
+ t lineno
+ b
+ :lineno
+ N
+ :loop
+ s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
+ t loop
+ s/-\n.*//
+ ' >$as_me.lineno &&
+ chmod +x "$as_me.lineno" ||
+ { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
+
+ # If we had to re-execute with $CONFIG_SHELL, we're ensured to have
+ # already done that, so ensure we don't try to do so again and fall
+ # in an infinite loop. This has already happened in practice.
+ _as_can_reexec=no; export _as_can_reexec
+ # Don't try to exec as it changes $[0], causing all sort of problems
+ # (the dirname of $[0] is not the place where we might find the
+ # original and so on. Autoconf is especially sensitive to this).
+ . "./$as_me.lineno"
+ # Exit status is that of the last command.
+ exit
+}
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in #(((((
+-n*)
+ case `echo 'xy\c'` in
+ *c*) ECHO_T=' ';; # ECHO_T is single tab character.
+ xy) ECHO_C='\c';;
+ *) echo `echo ksh88 bug on AIX 6.1` > /dev/null
+ ECHO_T=' ';;
+ esac;;
+*)
+ ECHO_N='-n';;
+esac
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+ rm -f conf$$.dir/conf$$.file
+else
+ rm -f conf$$.dir
+ mkdir conf$$.dir 2>/dev/null
+fi
+if (echo >conf$$.file) 2>/dev/null; then
+ if ln -s conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s='ln -s'
+ # ... but there are two gotchas:
+ # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+ # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+ # In both cases, we have to default to `cp -pR'.
+ ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+ as_ln_s='cp -pR'
+ elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+ else
+ as_ln_s='cp -pR'
+ fi
+else
+ as_ln_s='cp -pR'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p='mkdir -p "$as_dir"'
+else
+ test -d ./-p && rmdir ./-p
+ as_mkdir_p=false
+fi
+
+as_test_x='test -x'
+as_executable_p=as_fn_executable_p
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+
+test -n "$DJDIR" || exec 7<&0 </dev/null
+exec 6>&1
+
+# Name of the host.
+# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status,
+# so uname gets run too.
+ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
+
+#
+# Initializations.
+#
+ac_default_prefix=/usr/local
+ac_clean_files=
+ac_config_libobj_dir=.
+LIBOBJS=
+cross_compiling=no
+subdirs=
+MFLAGS=
+MAKEFLAGS=
+
+# Identity of this package.
+PACKAGE_NAME='LCD4Linux'
+PACKAGE_TARNAME='lcd4linux'
+PACKAGE_VERSION='0.11.0-SVN'
+PACKAGE_STRING='LCD4Linux 0.11.0-SVN'
+PACKAGE_BUGREPORT='lcd4linux-users@lists.sourceforge.net'
+PACKAGE_URL=''
+
+ac_unique_file="lcd4linux.c"
+# Factoring default headers for most tests.
+ac_includes_default="\
+#include <stdio.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#ifdef STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# ifdef HAVE_STDLIB_H
+# include <stdlib.h>
+# endif
+#endif
+#ifdef HAVE_STRING_H
+# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
+# include <memory.h>
+# endif
+# include <string.h>
+#endif
+#ifdef HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#ifdef HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
+#ifdef HAVE_STDINT_H
+# include <stdint.h>
+#endif
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif"
+
+ac_subst_vars='OTOOL64
+OTOOL
+LIPO
+NMEDIT
+DSYMUTIL
+MANIFEST_TOOL
+RANLIB
+ac_ct_AR
+AR
+DLLTOOL
+OBJDUMP
+NM
+ac_ct_DUMPBIN
+DUMPBIN
+LD
+FGREP
+SED
+LIBTOOL
+am__EXEEXT_FALSE
+am__EXEEXT_TRUE
+LTLIBOBJS
+POW_LIB
+LIBOBJS
+PLUGINLIBS
+PLUGINS
+LTLIBICONV
+LIBICONV
+host_os
+host_vendor
+host_cpu
+host
+build_os
+build_vendor
+build_cpu
+build
+DBUS_LIBS
+DBUS_CFLAGS
+DRVLIBS
+DRIVERS
+PYTHON_EXTRA_LDFLAGS
+PYTHON_EXTRA_LIBS
+PYTHON_SITE_PKG
+PYTHON_LDFLAGS
+PYTHON_CPPFLAGS
+PYTHON
+PYTHON_VERSION
+X_EXTRA_LIBS
+X_LIBS
+X_PRE_LIBS
+X_CFLAGS
+XMKMF
+EGREP
+GREP
+CURSES_INCLUDEDIR
+CURSES_LIBS
+PKG_CONFIG_LIBDIR
+PKG_CONFIG_PATH
+PKG_CONFIG
+LN_S
+CPP
+am__fastdepCC_FALSE
+am__fastdepCC_TRUE
+CCDEPMODE
+am__nodep
+AMDEPBACKSLASH
+AMDEP_FALSE
+AMDEP_TRUE
+am__quote
+am__include
+DEPDIR
+OBJEXT
+EXEEXT
+ac_ct_CC
+CPPFLAGS
+LDFLAGS
+CFLAGS
+CC
+AM_BACKSLASH
+AM_DEFAULT_VERBOSITY
+AM_DEFAULT_V
+AM_V
+am__untar
+am__tar
+AMTAR
+am__leading_dot
+SET_MAKE
+AWK
+mkdir_p
+MKDIR_P
+INSTALL_STRIP_PROGRAM
+STRIP
+install_sh
+MAKEINFO
+AUTOHEADER
+AUTOMAKE
+AUTOCONF
+ACLOCAL
+VERSION
+PACKAGE
+CYGPATH_W
+am__isrc
+INSTALL_DATA
+INSTALL_SCRIPT
+INSTALL_PROGRAM
+target_alias
+host_alias
+build_alias
+LIBS
+ECHO_T
+ECHO_N
+ECHO_C
+DEFS
+mandir
+localedir
+libdir
+psdir
+pdfdir
+dvidir
+htmldir
+infodir
+docdir
+oldincludedir
+includedir
+localstatedir
+sharedstatedir
+sysconfdir
+datadir
+datarootdir
+libexecdir
+sbindir
+bindir
+program_transform_name
+prefix
+exec_prefix
+PACKAGE_URL
+PACKAGE_BUGREPORT
+PACKAGE_STRING
+PACKAGE_VERSION
+PACKAGE_TARNAME
+PACKAGE_NAME
+PATH_SEPARATOR
+SHELL'
+ac_subst_files=''
+ac_user_opts='
+enable_option_checking
+enable_silent_rules
+enable_dependency_tracking
+with_dmalloc
+with_sco
+with_sunos_curses
+with_osf1_curses
+with_vcurses
+with_ncurses
+with_x
+with_python
+with_outb
+with_drivers
+with_plugins
+with_gnu_ld
+enable_rpath
+with_libiconv_prefix
+enable_shared
+enable_static
+with_pic
+enable_fast_install
+with_sysroot
+enable_libtool_lock
+'
+ ac_precious_vars='build_alias
+host_alias
+target_alias
+CC
+CFLAGS
+LDFLAGS
+LIBS
+CPPFLAGS
+CPP
+PKG_CONFIG
+PKG_CONFIG_PATH
+PKG_CONFIG_LIBDIR
+XMKMF
+PYTHON_VERSION
+DBUS_CFLAGS
+DBUS_LIBS'
+
+
+# Initialize some variables set by options.
+ac_init_help=
+ac_init_version=false
+ac_unrecognized_opts=
+ac_unrecognized_sep=
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+cache_file=/dev/null
+exec_prefix=NONE
+no_create=
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+verbose=
+x_includes=NONE
+x_libraries=NONE
+
+# Installation directory options.
+# These are left unexpanded so users can "make install exec_prefix=/foo"
+# and all the variables that are supposed to be based on exec_prefix
+# by default will actually change.
+# Use braces instead of parens because sh, perl, etc. also accept them.
+# (The list follows the same order as the GNU Coding Standards.)
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datarootdir='${prefix}/share'
+datadir='${datarootdir}'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
+infodir='${datarootdir}/info'
+htmldir='${docdir}'
+dvidir='${docdir}'
+pdfdir='${docdir}'
+psdir='${docdir}'
+libdir='${exec_prefix}/lib'
+localedir='${datarootdir}/locale'
+mandir='${datarootdir}/man'
+
+ac_prev=
+ac_dashdash=
+for ac_option
+do
+ # If the previous option needs an argument, assign it.
+ if test -n "$ac_prev"; then
+ eval $ac_prev=\$ac_option
+ ac_prev=
+ continue
+ fi
+
+ case $ac_option in
+ *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
+ *=) ac_optarg= ;;
+ *) ac_optarg=yes ;;
+ esac
+
+ # Accept the important Cygnus configure options, so we can diagnose typos.
+
+ case $ac_dashdash$ac_option in
+ --)
+ ac_dashdash=yes ;;
+
+ -bindir | --bindir | --bindi | --bind | --bin | --bi)
+ ac_prev=bindir ;;
+ -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+ bindir=$ac_optarg ;;
+
+ -build | --build | --buil | --bui | --bu)
+ ac_prev=build_alias ;;
+ -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+ build_alias=$ac_optarg ;;
+
+ -cache-file | --cache-file | --cache-fil | --cache-fi \
+ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+ ac_prev=cache_file ;;
+ -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+ cache_file=$ac_optarg ;;
+
+ --config-cache | -C)
+ cache_file=config.cache ;;
+
+ -datadir | --datadir | --datadi | --datad)
+ ac_prev=datadir ;;
+ -datadir=* | --datadir=* | --datadi=* | --datad=*)
+ datadir=$ac_optarg ;;
+
+ -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
+ | --dataroo | --dataro | --datar)
+ ac_prev=datarootdir ;;
+ -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
+ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
+ datarootdir=$ac_optarg ;;
+
+ -disable-* | --disable-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error $? "invalid feature name: $ac_useropt"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"enable_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval enable_$ac_useropt=no ;;
+
+ -docdir | --docdir | --docdi | --doc | --do)
+ ac_prev=docdir ;;
+ -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)
+ docdir=$ac_optarg ;;
+
+ -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)
+ ac_prev=dvidir ;;
+ -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
+ dvidir=$ac_optarg ;;
+
+ -enable-* | --enable-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error $? "invalid feature name: $ac_useropt"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"enable_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval enable_$ac_useropt=\$ac_optarg ;;
+
+ -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+ | --exec | --exe | --ex)
+ ac_prev=exec_prefix ;;
+ -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+ | --exec=* | --exe=* | --ex=*)
+ exec_prefix=$ac_optarg ;;
+
+ -gas | --gas | --ga | --g)
+ # Obsolete; use --with-gas.
+ with_gas=yes ;;
+
+ -help | --help | --hel | --he | -h)
+ ac_init_help=long ;;
+ -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
+ ac_init_help=recursive ;;
+ -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
+ ac_init_help=short ;;
+
+ -host | --host | --hos | --ho)
+ ac_prev=host_alias ;;
+ -host=* | --host=* | --hos=* | --ho=*)
+ host_alias=$ac_optarg ;;
+
+ -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)
+ ac_prev=htmldir ;;
+ -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \
+ | --ht=*)
+ htmldir=$ac_optarg ;;
+
+ -includedir | --includedir | --includedi | --included | --include \
+ | --includ | --inclu | --incl | --inc)
+ ac_prev=includedir ;;
+ -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+ | --includ=* | --inclu=* | --incl=* | --inc=*)
+ includedir=$ac_optarg ;;
+
+ -infodir | --infodir | --infodi | --infod | --info | --inf)
+ ac_prev=infodir ;;
+ -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+ infodir=$ac_optarg ;;
+
+ -libdir | --libdir | --libdi | --libd)
+ ac_prev=libdir ;;
+ -libdir=* | --libdir=* | --libdi=* | --libd=*)
+ libdir=$ac_optarg ;;
+
+ -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+ | --libexe | --libex | --libe)
+ ac_prev=libexecdir ;;
+ -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+ | --libexe=* | --libex=* | --libe=*)
+ libexecdir=$ac_optarg ;;
+
+ -localedir | --localedir | --localedi | --localed | --locale)
+ ac_prev=localedir ;;
+ -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)
+ localedir=$ac_optarg ;;
+
+ -localstatedir | --localstatedir | --localstatedi | --localstated \
+ | --localstate | --localstat | --localsta | --localst | --locals)
+ ac_prev=localstatedir ;;
+ -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)
+ localstatedir=$ac_optarg ;;
+
+ -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+ ac_prev=mandir ;;
+ -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+ mandir=$ac_optarg ;;
+
+ -nfp | --nfp | --nf)
+ # Obsolete; use --without-fp.
+ with_fp=no ;;
+
+ -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+ | --no-cr | --no-c | -n)
+ no_create=yes ;;
+
+ -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+ no_recursion=yes ;;
+
+ -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+ | --oldin | --oldi | --old | --ol | --o)
+ ac_prev=oldincludedir ;;
+ -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+ oldincludedir=$ac_optarg ;;
+
+ -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+ ac_prev=prefix ;;
+ -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+ prefix=$ac_optarg ;;
+
+ -program-prefix | --program-prefix | --program-prefi | --program-pref \
+ | --program-pre | --program-pr | --program-p)
+ ac_prev=program_prefix ;;
+ -program-prefix=* | --program-prefix=* | --program-prefi=* \
+ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+ program_prefix=$ac_optarg ;;
+
+ -program-suffix | --program-suffix | --program-suffi | --program-suff \
+ | --program-suf | --program-su | --program-s)
+ ac_prev=program_suffix ;;
+ -program-suffix=* | --program-suffix=* | --program-suffi=* \
+ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+ program_suffix=$ac_optarg ;;
+
+ -program-transform-name | --program-transform-name \
+ | --program-transform-nam | --program-transform-na \
+ | --program-transform-n | --program-transform- \
+ | --program-transform | --program-transfor \
+ | --program-transfo | --program-transf \
+ | --program-trans | --program-tran \
+ | --progr-tra | --program-tr | --program-t)
+ ac_prev=program_transform_name ;;
+ -program-transform-name=* | --program-transform-name=* \
+ | --program-transform-nam=* | --program-transform-na=* \
+ | --program-transform-n=* | --program-transform-=* \
+ | --program-transform=* | --program-transfor=* \
+ | --program-transfo=* | --program-transf=* \
+ | --program-trans=* | --program-tran=* \
+ | --progr-tra=* | --program-tr=* | --program-t=*)
+ program_transform_name=$ac_optarg ;;
+
+ -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)
+ ac_prev=pdfdir ;;
+ -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)
+ pdfdir=$ac_optarg ;;
+
+ -psdir | --psdir | --psdi | --psd | --ps)
+ ac_prev=psdir ;;
+ -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)
+ psdir=$ac_optarg ;;
+
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ silent=yes ;;
+
+ -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+ ac_prev=sbindir ;;
+ -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+ | --sbi=* | --sb=*)
+ sbindir=$ac_optarg ;;
+
+ -sharedstatedir | --sharedstatedir | --sharedstatedi \
+ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+ | --sharedst | --shareds | --shared | --share | --shar \
+ | --sha | --sh)
+ ac_prev=sharedstatedir ;;
+ -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+ | --sha=* | --sh=*)
+ sharedstatedir=$ac_optarg ;;
+
+ -site | --site | --sit)
+ ac_prev=site ;;
+ -site=* | --site=* | --sit=*)
+ site=$ac_optarg ;;
+
+ -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+ ac_prev=srcdir ;;
+ -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+ srcdir=$ac_optarg ;;
+
+ -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+ | --syscon | --sysco | --sysc | --sys | --sy)
+ ac_prev=sysconfdir ;;
+ -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+ sysconfdir=$ac_optarg ;;
+
+ -target | --target | --targe | --targ | --tar | --ta | --t)
+ ac_prev=target_alias ;;
+ -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+ target_alias=$ac_optarg ;;
+
+ -v | -verbose | --verbose | --verbos | --verbo | --verb)
+ verbose=yes ;;
+
+ -version | --version | --versio | --versi | --vers | -V)
+ ac_init_version=: ;;
+
+ -with-* | --with-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error $? "invalid package name: $ac_useropt"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"with_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval with_$ac_useropt=\$ac_optarg ;;
+
+ -without-* | --without-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error $? "invalid package name: $ac_useropt"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"with_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval with_$ac_useropt=no ;;
+
+ --x)
+ # Obsolete; use --with-x.
+ with_x=yes ;;
+
+ -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+ | --x-incl | --x-inc | --x-in | --x-i)
+ ac_prev=x_includes ;;
+ -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+ x_includes=$ac_optarg ;;
+
+ -x-libraries | --x-libraries | --x-librarie | --x-librari \
+ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+ ac_prev=x_libraries ;;
+ -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+ x_libraries=$ac_optarg ;;
+
+ -*) as_fn_error $? "unrecognized option: \`$ac_option'
+Try \`$0 --help' for more information"
+ ;;
+
+ *=*)
+ ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
+ # Reject names that are not valid shell variable names.
+ case $ac_envvar in #(
+ '' | [0-9]* | *[!_$as_cr_alnum]* )
+ as_fn_error $? "invalid variable name: \`$ac_envvar'" ;;
+ esac
+ eval $ac_envvar=\$ac_optarg
+ export $ac_envvar ;;
+
+ *)
+ # FIXME: should be removed in autoconf 3.0.
+ $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+ expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+ $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2
+ : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}"
+ ;;
+
+ esac
+done
+
+if test -n "$ac_prev"; then
+ ac_option=--`echo $ac_prev | sed 's/_/-/g'`
+ as_fn_error $? "missing argument to $ac_option"
+fi
+
+if test -n "$ac_unrecognized_opts"; then
+ case $enable_option_checking in
+ no) ;;
+ fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;;
+ *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
+ esac
+fi
+
+# Check all directory arguments for consistency.
+for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
+ datadir sysconfdir sharedstatedir localstatedir includedir \
+ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
+ libdir localedir mandir
+do
+ eval ac_val=\$$ac_var
+ # Remove trailing slashes.
+ case $ac_val in
+ */ )
+ ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'`
+ eval $ac_var=\$ac_val;;
+ esac
+ # Be sure to have absolute directory names.
+ case $ac_val in
+ [\\/$]* | ?:[\\/]* ) continue;;
+ NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
+ esac
+ as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val"
+done
+
+# There might be people who depend on the old broken behavior: `$host'
+# used to hold the argument of --host etc.
+# FIXME: To remove some day.
+build=$build_alias
+host=$host_alias
+target=$target_alias
+
+# FIXME: To remove some day.
+if test "x$host_alias" != x; then
+ if test "x$build_alias" = x; then
+ cross_compiling=maybe
+ elif test "x$build_alias" != "x$host_alias"; then
+ cross_compiling=yes
+ fi
+fi
+
+ac_tool_prefix=
+test -n "$host_alias" && ac_tool_prefix=$host_alias-
+
+test "$silent" = yes && exec 6>/dev/null
+
+
+ac_pwd=`pwd` && test -n "$ac_pwd" &&
+ac_ls_di=`ls -di .` &&
+ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
+ as_fn_error $? "working directory cannot be determined"
+test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
+ as_fn_error $? "pwd does not report name of working directory"
+
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+ ac_srcdir_defaulted=yes
+ # Try the directory containing this script, then the parent directory.
+ ac_confdir=`$as_dirname -- "$as_myself" ||
+$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_myself" : 'X\(//\)[^/]' \| \
+ X"$as_myself" : 'X\(//\)$' \| \
+ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_myself" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ srcdir=$ac_confdir
+ if test ! -r "$srcdir/$ac_unique_file"; then
+ srcdir=..
+ fi
+else
+ ac_srcdir_defaulted=no
+fi
+if test ! -r "$srcdir/$ac_unique_file"; then
+ test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
+ as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir"
+fi
+ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
+ac_abs_confdir=`(
+ cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg"
+ pwd)`
+# When building in place, set srcdir=.
+if test "$ac_abs_confdir" = "$ac_pwd"; then
+ srcdir=.
+fi
+# Remove unnecessary trailing slashes from srcdir.
+# Double slashes in file names in object file debugging info
+# mess up M-x gdb in Emacs.
+case $srcdir in
+*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;
+esac
+for ac_var in $ac_precious_vars; do
+ eval ac_env_${ac_var}_set=\${${ac_var}+set}
+ eval ac_env_${ac_var}_value=\$${ac_var}
+ eval ac_cv_env_${ac_var}_set=\${${ac_var}+set}
+ eval ac_cv_env_${ac_var}_value=\$${ac_var}
+done
+
+#
+# Report the --help message.
+#
+if test "$ac_init_help" = "long"; then
+ # Omit some internal or obsolete options to make the list less imposing.
+ # This message is too long to be a string in the A/UX 3.1 sh.
+ cat <<_ACEOF
+\`configure' configures LCD4Linux 0.11.0-SVN to adapt to many kinds of systems.
+
+Usage: $0 [OPTION]... [VAR=VALUE]...
+
+To assign environment variables (e.g., CC, CFLAGS...), specify them as
+VAR=VALUE. See below for descriptions of some of the useful variables.
+
+Defaults for the options are specified in brackets.
+
+Configuration:
+ -h, --help display this help and exit
+ --help=short display options specific to this package
+ --help=recursive display the short help of all the included packages
+ -V, --version display version information and exit
+ -q, --quiet, --silent do not print \`checking ...' messages
+ --cache-file=FILE cache test results in FILE [disabled]
+ -C, --config-cache alias for \`--cache-file=config.cache'
+ -n, --no-create do not create output files
+ --srcdir=DIR find the sources in DIR [configure dir or \`..']
+
+Installation directories:
+ --prefix=PREFIX install architecture-independent files in PREFIX
+ [$ac_default_prefix]
+ --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
+ [PREFIX]
+
+By default, \`make install' will install all the files in
+\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify
+an installation prefix other than \`$ac_default_prefix' using \`--prefix',
+for instance \`--prefix=\$HOME'.
+
+For better control, use the options below.
+
+Fine tuning of the installation directories:
+ --bindir=DIR user executables [EPREFIX/bin]
+ --sbindir=DIR system admin executables [EPREFIX/sbin]
+ --libexecdir=DIR program executables [EPREFIX/libexec]
+ --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
+ --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
+ --localstatedir=DIR modifiable single-machine data [PREFIX/var]
+ --libdir=DIR object code libraries [EPREFIX/lib]
+ --includedir=DIR C header files [PREFIX/include]
+ --oldincludedir=DIR C header files for non-gcc [/usr/include]
+ --datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
+ --datadir=DIR read-only architecture-independent data [DATAROOTDIR]
+ --infodir=DIR info documentation [DATAROOTDIR/info]
+ --localedir=DIR locale-dependent data [DATAROOTDIR/locale]
+ --mandir=DIR man documentation [DATAROOTDIR/man]
+ --docdir=DIR documentation root [DATAROOTDIR/doc/lcd4linux]
+ --htmldir=DIR html documentation [DOCDIR]
+ --dvidir=DIR dvi documentation [DOCDIR]
+ --pdfdir=DIR pdf documentation [DOCDIR]
+ --psdir=DIR ps documentation [DOCDIR]
+_ACEOF
+
+ cat <<\_ACEOF
+
+Program names:
+ --program-prefix=PREFIX prepend PREFIX to installed program names
+ --program-suffix=SUFFIX append SUFFIX to installed program names
+ --program-transform-name=PROGRAM run sed PROGRAM on installed program names
+
+X features:
+ --x-includes=DIR X include files are in DIR
+ --x-libraries=DIR X library files are in DIR
+
+System types:
+ --build=BUILD configure for building on BUILD [guessed]
+ --host=HOST cross-compile to build programs to run on HOST [BUILD]
+_ACEOF
+fi
+
+if test -n "$ac_init_help"; then
+ case $ac_init_help in
+ short | recursive ) echo "Configuration of LCD4Linux 0.11.0-SVN:";;
+ esac
+ cat <<\_ACEOF
+
+Optional Features:
+ --disable-option-checking ignore unrecognized --enable/--with options
+ --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
+ --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
+ --enable-silent-rules less verbose build output (undo: "make V=1")
+ --disable-silent-rules verbose build output (undo: "make V=0")
+ --enable-dependency-tracking
+ do not reject slow dependency extractors
+ --disable-dependency-tracking
+ speeds up one-time build
+ --disable-rpath do not hardcode runtime library paths
+ --enable-shared[=PKGS] build shared libraries [default=yes]
+ --enable-static[=PKGS] build static libraries [default=yes]
+ --enable-fast-install[=PKGS]
+ optimize for fast installation [default=yes]
+ --disable-libtool-lock avoid locking (might break parallel builds)
+
+Optional Packages:
+ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
+ --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
+ --with-dmalloc use dmalloc, as in http://www.dmalloc.com
+ --with-sco Use this to turn on SCO-specific code
+ --with-sunos-curses Used to force SunOS 4.x curses
+ --with-osf1-curses Used to force OSF/1 curses
+ --with-vcurses=incdir Used to force SysV curses
+ --with-ncurses=dir Compile with ncurses/locate base dir
+ --with-x use the X Window System
+ --with-python enable python support [default=no]
+ --with-outb enable raw port I/O support [default=no]
+ --with-drivers=<list> compile driver for displays in <list>,
+ drivers may be separated with commas,
+ 'all' (default) compiles all available drivers,
+ drivers may be excluded with 'all,!<driver>',
+ (try 'all,\!<driver>' if your shell complains...)
+ possible drivers are:
+ ASTUSB, BeckmannEgle, BWCT, CrystalFontz, Curses, Cwlinux, D4D, DPF
+ EA232graphic, EFN, FutabaVFD, FW8888, G15, GLCD2USB, HD44780, HD44780-I2C,
+ IRLCD, LCD2USB, LCDLinux, LEDMatrix, LCDTerm, LPH7508, LUIse,
+ LW_ABP, M50530, MatrixOrbital, MatrixOrbitalGX, MilfordInstruments, MDM166A,
+ Newhaven, Noritake, NULL, Pertelian, PHAnderson,
+ PICGraphic, picoLCD, picoLCDGraphic, PNG, PPM, RouterBoard,
+ Sample, SamsungSPF, serdisplib, ShuttleVFD, SimpleLCD, st2205, T6963,
+ TeakLCM, Trefon, ULA200, USBHUB, USBLCD, VNC, WincorNixdorf, X11
+ --with-plugins=<list> choose which plugins to compile.
+ type --with-plugins=list for a list
+ of avaible plugins
+ plugins may be excluded with 'all,!<plugin>',
+ (try 'all,\!<plugin>' if your shell complains...)
+ --with-gnu-ld assume the C compiler uses GNU ld [default=no]
+ --with-libiconv-prefix[=DIR] search for libiconv in DIR/include and DIR/lib
+ --without-libiconv-prefix don't search for libiconv in includedir and libdir
+ --with-pic[=PKGS] try to use only PIC/non-PIC objects [default=use
+ both]
+ --with-gnu-ld assume the C compiler uses GNU ld [default=no]
+ --with-sysroot=DIR Search for dependent libraries within DIR
+ (or the compiler's sysroot if not specified).
+
+Some influential environment variables:
+ CC C compiler command
+ CFLAGS C compiler flags
+ LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
+ nonstandard directory <lib dir>
+ LIBS libraries to pass to the linker, e.g. -l<library>
+ CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
+ you have headers in a nonstandard directory <include dir>
+ CPP C preprocessor
+ PKG_CONFIG path to pkg-config utility
+ PKG_CONFIG_PATH
+ directories to add to pkg-config's search path
+ PKG_CONFIG_LIBDIR
+ path overriding pkg-config's built-in search path
+ XMKMF Path to xmkmf, Makefile generator for X Window System
+ PYTHON_VERSION
+ The installed Python version to use, for example '2.3'. This
+ string will be appended to the Python interpreter canonical
+ name.
+ DBUS_CFLAGS C compiler flags for DBUS, overriding pkg-config
+ DBUS_LIBS linker flags for DBUS, overriding pkg-config
+
+Use these variables to override the choices made by `configure' or to help
+it to find libraries and programs with nonstandard names/locations.
+
+Report bugs to <lcd4linux-users@lists.sourceforge.net>.
+_ACEOF
+ac_status=$?
+fi
+
+if test "$ac_init_help" = "recursive"; then
+ # If there are subdirs, report their specific --help.
+ for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
+ test -d "$ac_dir" ||
+ { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } ||
+ continue
+ ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+ ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
+ # A ".." for each directory in $ac_dir_suffix.
+ ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
+ case $ac_top_builddir_sub in
+ "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+ *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+ esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+ .) # We are building in place.
+ ac_srcdir=.
+ ac_top_srcdir=$ac_top_builddir_sub
+ ac_abs_top_srcdir=$ac_pwd ;;
+ [\\/]* | ?:[\\/]* ) # Absolute name.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir
+ ac_abs_top_srcdir=$srcdir ;;
+ *) # Relative name.
+ ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_build_prefix$srcdir
+ ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+ cd "$ac_dir" || { ac_status=$?; continue; }
+ # Check for guested configure.
+ if test -f "$ac_srcdir/configure.gnu"; then
+ echo &&
+ $SHELL "$ac_srcdir/configure.gnu" --help=recursive
+ elif test -f "$ac_srcdir/configure"; then
+ echo &&
+ $SHELL "$ac_srcdir/configure" --help=recursive
+ else
+ $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+ fi || ac_status=$?
+ cd "$ac_pwd" || { ac_status=$?; break; }
+ done
+fi
+
+test -n "$ac_init_help" && exit $ac_status
+if $ac_init_version; then
+ cat <<\_ACEOF
+LCD4Linux configure 0.11.0-SVN
+generated by GNU Autoconf 2.69
+
+Copyright (C) 2012 Free Software Foundation, Inc.
+This configure script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it.
+_ACEOF
+ exit
+fi
+
+## ------------------------ ##
+## Autoconf initialization. ##
+## ------------------------ ##
+
+# ac_fn_c_try_compile LINENO
+# --------------------------
+# Try to compile conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_compile ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ rm -f conftest.$ac_objext
+ if { { ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_compile") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ grep -v '^ *+' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ mv -f conftest.er1 conftest.err
+ fi
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=1
+fi
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_compile
+
+# ac_fn_c_try_cpp LINENO
+# ----------------------
+# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_cpp ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ if { { ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ grep -v '^ *+' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ mv -f conftest.er1 conftest.err
+ fi
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } > conftest.i && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=1
+fi
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_cpp
+
+# ac_fn_c_try_link LINENO
+# -----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_link ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ rm -f conftest.$ac_objext conftest$ac_exeext
+ if { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ grep -v '^ *+' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ mv -f conftest.er1 conftest.err
+ fi
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ test -x conftest$ac_exeext
+ }; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=1
+fi
+ # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
+ # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
+ # interfere with the next link command; also delete a directory that is
+ # left behind by Apple's compiler. We do this before executing the actions.
+ rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_link
+
+# ac_fn_c_check_func LINENO FUNC VAR
+# ----------------------------------
+# Tests whether FUNC exists, setting the cache variable VAR accordingly
+ac_fn_c_check_func ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+/* Define $2 to an innocuous variant, in case <limits.h> declares $2.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $2 innocuous_$2
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $2 (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $2
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char $2 ();
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined __stub_$2 || defined __stub___$2
+choke me
+#endif
+
+int
+main ()
+{
+return $2 ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ eval "$3=yes"
+else
+ eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_func
+
+# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES
+# -------------------------------------------------------
+# Tests whether HEADER exists, giving a warning if it cannot be compiled using
+# the include files in INCLUDES and setting the cache variable VAR
+# accordingly.
+ac_fn_c_check_header_mongrel ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ if eval \${$3+:} false; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+ $as_echo_n "(cached) " >&6
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+else
+ # Is the header compilable?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5
+$as_echo_n "checking $2 usability... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+#include <$2>
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_header_compiler=yes
+else
+ ac_header_compiler=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5
+$as_echo "$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5
+$as_echo_n "checking $2 presence... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <$2>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+ ac_header_preproc=yes
+else
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #((
+ yes:no: )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+ ;;
+ no:yes:* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+( $as_echo "## ---------------------------------------------------- ##
+## Report this to lcd4linux-users@lists.sourceforge.net ##
+## ---------------------------------------------------- ##"
+ ) | sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ eval "$3=\$ac_header_compiler"
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+fi
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_header_mongrel
+
+# ac_fn_c_try_run LINENO
+# ----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes
+# that executables *can* be run.
+ac_fn_c_try_run ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ if { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'
+ { { case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; }; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: program exited with status $ac_status" >&5
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=$ac_status
+fi
+ rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_run
+
+# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES
+# -------------------------------------------------------
+# Tests whether HEADER exists and can be compiled using the include files in
+# INCLUDES, setting the cache variable VAR accordingly.
+ac_fn_c_check_header_compile ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+#include <$2>
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ eval "$3=yes"
+else
+ eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_header_compile
+
+# ac_fn_c_check_type LINENO TYPE VAR INCLUDES
+# -------------------------------------------
+# Tests whether TYPE exists after having included INCLUDES, setting cache
+# variable VAR accordingly.
+ac_fn_c_check_type ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ eval "$3=no"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main ()
+{
+if (sizeof ($2))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main ()
+{
+if (sizeof (($2)))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+else
+ eval "$3=yes"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_type
+cat >config.log <<_ACEOF
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+
+It was created by LCD4Linux $as_me 0.11.0-SVN, which was
+generated by GNU Autoconf 2.69. Invocation command line was
+
+ $ $0 $@
+
+_ACEOF
+exec 5>>config.log
+{
+cat <<_ASUNAME
+## --------- ##
+## Platform. ##
+## --------- ##
+
+hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
+/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown`
+
+/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`
+/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
+/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown`
+/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`
+/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`
+/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`
+
+_ASUNAME
+
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ $as_echo "PATH: $as_dir"
+ done
+IFS=$as_save_IFS
+
+} >&5
+
+cat >&5 <<_ACEOF
+
+
+## ----------- ##
+## Core tests. ##
+## ----------- ##
+
+_ACEOF
+
+
+# Keep a trace of the command line.
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Strip out --silent because we don't want to record it for future runs.
+# Also quote any args containing shell meta-characters.
+# Make two passes to allow for proper duplicate-argument suppression.
+ac_configure_args=
+ac_configure_args0=
+ac_configure_args1=
+ac_must_keep_next=false
+for ac_pass in 1 2
+do
+ for ac_arg
+ do
+ case $ac_arg in
+ -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ continue ;;
+ *\'*)
+ ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ esac
+ case $ac_pass in
+ 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;;
+ 2)
+ as_fn_append ac_configure_args1 " '$ac_arg'"
+ if test $ac_must_keep_next = true; then
+ ac_must_keep_next=false # Got value, back to normal.
+ else
+ case $ac_arg in
+ *=* | --config-cache | -C | -disable-* | --disable-* \
+ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
+ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
+ | -with-* | --with-* | -without-* | --without-* | --x)
+ case "$ac_configure_args0 " in
+ "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
+ esac
+ ;;
+ -* ) ac_must_keep_next=true ;;
+ esac
+ fi
+ as_fn_append ac_configure_args " '$ac_arg'"
+ ;;
+ esac
+ done
+done
+{ ac_configure_args0=; unset ac_configure_args0;}
+{ ac_configure_args1=; unset ac_configure_args1;}
+
+# When interrupted or exit'd, cleanup temporary files, and complete
+# config.log. We remove comments because anyway the quotes in there
+# would cause problems or look ugly.
+# WARNING: Use '\'' to represent an apostrophe within the trap.
+# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
+trap 'exit_status=$?
+ # Save into config.log some information that might help in debugging.
+ {
+ echo
+
+ $as_echo "## ---------------- ##
+## Cache variables. ##
+## ---------------- ##"
+ echo
+ # The following way of writing the cache mishandles newlines in values,
+(
+ for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
+ eval ac_val=\$$ac_var
+ case $ac_val in #(
+ *${as_nl}*)
+ case $ac_var in #(
+ *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
+$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
+ esac
+ case $ac_var in #(
+ _ | IFS | as_nl) ;; #(
+ BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+ *) { eval $ac_var=; unset $ac_var;} ;;
+ esac ;;
+ esac
+ done
+ (set) 2>&1 |
+ case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
+ *${as_nl}ac_space=\ *)
+ sed -n \
+ "s/'\''/'\''\\\\'\'''\''/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
+ ;; #(
+ *)
+ sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+ ;;
+ esac |
+ sort
+)
+ echo
+
+ $as_echo "## ----------------- ##
+## Output variables. ##
+## ----------------- ##"
+ echo
+ for ac_var in $ac_subst_vars
+ do
+ eval ac_val=\$$ac_var
+ case $ac_val in
+ *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+ esac
+ $as_echo "$ac_var='\''$ac_val'\''"
+ done | sort
+ echo
+
+ if test -n "$ac_subst_files"; then
+ $as_echo "## ------------------- ##
+## File substitutions. ##
+## ------------------- ##"
+ echo
+ for ac_var in $ac_subst_files
+ do
+ eval ac_val=\$$ac_var
+ case $ac_val in
+ *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+ esac
+ $as_echo "$ac_var='\''$ac_val'\''"
+ done | sort
+ echo
+ fi
+
+ if test -s confdefs.h; then
+ $as_echo "## ----------- ##
+## confdefs.h. ##
+## ----------- ##"
+ echo
+ cat confdefs.h
+ echo
+ fi
+ test "$ac_signal" != 0 &&
+ $as_echo "$as_me: caught signal $ac_signal"
+ $as_echo "$as_me: exit $exit_status"
+ } >&5
+ rm -f core *.core core.conftest.* &&
+ rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
+ exit $exit_status
+' 0
+for ac_signal in 1 2 13 15; do
+ trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal
+done
+ac_signal=0
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -f -r conftest* confdefs.h
+
+$as_echo "/* confdefs.h */" > confdefs.h
+
+# Predefined preprocessor variables.
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_NAME "$PACKAGE_NAME"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_VERSION "$PACKAGE_VERSION"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_STRING "$PACKAGE_STRING"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_URL "$PACKAGE_URL"
+_ACEOF
+
+
+# Let the site file select an alternate cache file if it wants to.
+# Prefer an explicitly selected file to automatically selected ones.
+ac_site_file1=NONE
+ac_site_file2=NONE
+if test -n "$CONFIG_SITE"; then
+ # We do not want a PATH search for config.site.
+ case $CONFIG_SITE in #((
+ -*) ac_site_file1=./$CONFIG_SITE;;
+ */*) ac_site_file1=$CONFIG_SITE;;
+ *) ac_site_file1=./$CONFIG_SITE;;
+ esac
+elif test "x$prefix" != xNONE; then
+ ac_site_file1=$prefix/share/config.site
+ ac_site_file2=$prefix/etc/config.site
+else
+ ac_site_file1=$ac_default_prefix/share/config.site
+ ac_site_file2=$ac_default_prefix/etc/config.site
+fi
+for ac_site_file in "$ac_site_file1" "$ac_site_file2"
+do
+ test "x$ac_site_file" = xNONE && continue
+ if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5
+$as_echo "$as_me: loading site script $ac_site_file" >&6;}
+ sed 's/^/| /' "$ac_site_file" >&5
+ . "$ac_site_file" \
+ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "failed to load site script $ac_site_file
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+done
+
+if test -r "$cache_file"; then
+ # Some versions of bash will fail to source /dev/null (special files
+ # actually), so we avoid doing that. DJGPP emulates it as a regular file.
+ if test /dev/null != "$cache_file" && test -f "$cache_file"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5
+$as_echo "$as_me: loading cache $cache_file" >&6;}
+ case $cache_file in
+ [\\/]* | ?:[\\/]* ) . "$cache_file";;
+ *) . "./$cache_file";;
+ esac
+ fi
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5
+$as_echo "$as_me: creating cache $cache_file" >&6;}
+ >$cache_file
+fi
+
+# Check that the precious variables saved in the cache have kept the same
+# value.
+ac_cache_corrupted=false
+for ac_var in $ac_precious_vars; do
+ eval ac_old_set=\$ac_cv_env_${ac_var}_set
+ eval ac_new_set=\$ac_env_${ac_var}_set
+ eval ac_old_val=\$ac_cv_env_${ac_var}_value
+ eval ac_new_val=\$ac_env_${ac_var}_value
+ case $ac_old_set,$ac_new_set in
+ set,)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,set)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5
+$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,);;
+ *)
+ if test "x$ac_old_val" != "x$ac_new_val"; then
+ # differences in whitespace do not lead to failure.
+ ac_old_val_w=`echo x $ac_old_val`
+ ac_new_val_w=`echo x $ac_new_val`
+ if test "$ac_old_val_w" != "$ac_new_val_w"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5
+$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+ ac_cache_corrupted=:
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5
+$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;}
+ eval $ac_var=\$ac_old_val
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5
+$as_echo "$as_me: former value: \`$ac_old_val'" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5
+$as_echo "$as_me: current value: \`$ac_new_val'" >&2;}
+ fi;;
+ esac
+ # Pass precious variables to config.status.
+ if test "$ac_new_set" = set; then
+ case $ac_new_val in
+ *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+ *) ac_arg=$ac_var=$ac_new_val ;;
+ esac
+ case " $ac_configure_args " in
+ *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.
+ *) as_fn_append ac_configure_args " '$ac_arg'" ;;
+ esac
+ fi
+done
+if $ac_cache_corrupted; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5
+$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+ as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5
+fi
+## -------------------- ##
+## Main body of script. ##
+## -------------------- ##
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+am__api_version='1.14'
+
+ac_aux_dir=
+for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
+ if test -f "$ac_dir/install-sh"; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install-sh -c"
+ break
+ elif test -f "$ac_dir/install.sh"; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install.sh -c"
+ break
+ elif test -f "$ac_dir/shtool"; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/shtool install -c"
+ break
+ fi
+done
+if test -z "$ac_aux_dir"; then
+ as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5
+fi
+
+# These three variables are undocumented and unsupported,
+# and are intended to be withdrawn in a future Autoconf release.
+# They can cause serious problems if a builder's source tree is in a directory
+# whose full name contains unusual characters.
+ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var.
+ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var.
+ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
+
+
+# Find a good install program. We prefer a C program (faster),
+# so one script is as good as another. But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AmigaOS /C/install, which installs bootblocks on floppy discs
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# OS/2's system install, which has a completely different semantic
+# ./install, which can be erroneously created by make from ./install.sh.
+# Reject install programs that cannot install multiple files.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5
+$as_echo_n "checking for a BSD-compatible install... " >&6; }
+if test -z "$INSTALL"; then
+if ${ac_cv_path_install+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in #((
+ ./ | .// | /[cC]/* | \
+ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \
+ /usr/ucb/* ) ;;
+ *)
+ # OSF1 and SCO ODT 3.0 have their own names for install.
+ # Don't use installbsd from OSF since it installs stuff as root
+ # by default.
+ for ac_prog in ginstall scoinst install; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
+ if test $ac_prog = install &&
+ grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ # AIX install. It has an incompatible calling convention.
+ :
+ elif test $ac_prog = install &&
+ grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ # program-specific install script used by HP pwplus--don't use.
+ :
+ else
+ rm -rf conftest.one conftest.two conftest.dir
+ echo one > conftest.one
+ echo two > conftest.two
+ mkdir conftest.dir
+ if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" &&
+ test -s conftest.one && test -s conftest.two &&
+ test -s conftest.dir/conftest.one &&
+ test -s conftest.dir/conftest.two
+ then
+ ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+ break 3
+ fi
+ fi
+ fi
+ done
+ done
+ ;;
+esac
+
+ done
+IFS=$as_save_IFS
+
+rm -rf conftest.one conftest.two conftest.dir
+
+fi
+ if test "${ac_cv_path_install+set}" = set; then
+ INSTALL=$ac_cv_path_install
+ else
+ # As a last resort, use the slow shell script. Don't cache a
+ # value for INSTALL within a source directory, because that will
+ # break other packages using the cache if that directory is
+ # removed, or if the value is a relative name.
+ INSTALL=$ac_install_sh
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5
+$as_echo "$INSTALL" >&6; }
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5
+$as_echo_n "checking whether build environment is sane... " >&6; }
+# Reject unsafe characters in $srcdir or the absolute working directory
+# name. Accept space and tab only in the latter.
+am_lf='
+'
+case `pwd` in
+ *[\\\"\#\$\&\'\`$am_lf]*)
+ as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;;
+esac
+case $srcdir in
+ *[\\\"\#\$\&\'\`$am_lf\ \ ]*)
+ as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;;
+esac
+
+# Do 'set' in a subshell so we don't clobber the current shell's
+# arguments. Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+ am_has_slept=no
+ for am_try in 1 2; do
+ echo "timestamp, slept: $am_has_slept" > conftest.file
+ set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
+ if test "$*" = "X"; then
+ # -L didn't work.
+ set X `ls -t "$srcdir/configure" conftest.file`
+ fi
+ if test "$*" != "X $srcdir/configure conftest.file" \
+ && test "$*" != "X conftest.file $srcdir/configure"; then
+
+ # If neither matched, then we have a broken ls. This can happen
+ # if, for instance, CONFIG_SHELL is bash and it inherits a
+ # broken ls alias from the environment. This has actually
+ # happened. Such a system could not be considered "sane".
+ as_fn_error $? "ls -t appears to fail. Make sure there is not a broken
+ alias in your environment" "$LINENO" 5
+ fi
+ if test "$2" = conftest.file || test $am_try -eq 2; then
+ break
+ fi
+ # Just in case.
+ sleep 1
+ am_has_slept=yes
+ done
+ test "$2" = conftest.file
+ )
+then
+ # Ok.
+ :
+else
+ as_fn_error $? "newly created file is older than distributed files!
+Check your system clock" "$LINENO" 5
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+# If we didn't sleep, we still need to ensure time stamps of config.status and
+# generated files are strictly newer.
+am_sleep_pid=
+if grep 'slept: no' conftest.file >/dev/null 2>&1; then
+ ( sleep 1 ) &
+ am_sleep_pid=$!
+fi
+
+rm -f conftest.file
+
+test "$program_prefix" != NONE &&
+ program_transform_name="s&^&$program_prefix&;$program_transform_name"
+# Use a double $ so make ignores it.
+test "$program_suffix" != NONE &&
+ program_transform_name="s&\$&$program_suffix&;$program_transform_name"
+# Double any \ or $.
+# By default was `s,x,x', remove it if useless.
+ac_script='s/[\\$]/&&/g;s/;s,x,x,$//'
+program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"`
+
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+
+if test x"${MISSING+set}" != xset; then
+ case $am_aux_dir in
+ *\ * | *\ *)
+ MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
+ *)
+ MISSING="\${SHELL} $am_aux_dir/missing" ;;
+ esac
+fi
+# Use eval to expand $SHELL
+if eval "$MISSING --is-lightweight"; then
+ am_missing_run="$MISSING "
+else
+ am_missing_run=
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5
+$as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;}
+fi
+
+if test x"${install_sh}" != xset; then
+ case $am_aux_dir in
+ *\ * | *\ *)
+ install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
+ *)
+ install_sh="\${SHELL} $am_aux_dir/install-sh"
+ esac
+fi
+
+# Installed binaries are usually stripped using 'strip' when the user
+# run "make install-strip". However 'strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the 'STRIP' environment variable to overrule this program.
+if test "$cross_compiling" != no; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_STRIP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$STRIP"; then
+ ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5
+$as_echo "$STRIP" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_STRIP"; then
+ ac_ct_STRIP=$STRIP
+ # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_STRIP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_STRIP"; then
+ ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_STRIP="strip"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5
+$as_echo "$ac_ct_STRIP" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_STRIP" = x; then
+ STRIP=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ STRIP=$ac_ct_STRIP
+ fi
+else
+ STRIP="$ac_cv_prog_STRIP"
+fi
+
+fi
+INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5
+$as_echo_n "checking for a thread-safe mkdir -p... " >&6; }
+if test -z "$MKDIR_P"; then
+ if ${ac_cv_path_mkdir+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in mkdir gmkdir; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue
+ case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #(
+ 'mkdir (GNU coreutils) '* | \
+ 'mkdir (coreutils) '* | \
+ 'mkdir (fileutils) '4.1*)
+ ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext
+ break 3;;
+ esac
+ done
+ done
+ done
+IFS=$as_save_IFS
+
+fi
+
+ test -d ./--version && rmdir ./--version
+ if test "${ac_cv_path_mkdir+set}" = set; then
+ MKDIR_P="$ac_cv_path_mkdir -p"
+ else
+ # As a last resort, use the slow shell script. Don't cache a
+ # value for MKDIR_P within a source directory, because that will
+ # break other packages using the cache if that directory is
+ # removed, or if the value is a relative name.
+ MKDIR_P="$ac_install_sh -d"
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5
+$as_echo "$MKDIR_P" >&6; }
+
+for ac_prog in gawk mawk nawk awk
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_AWK+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$AWK"; then
+ ac_cv_prog_AWK="$AWK" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_AWK="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+AWK=$ac_cv_prog_AWK
+if test -n "$AWK"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5
+$as_echo "$AWK" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$AWK" && break
+done
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
+set x ${MAKE-make}
+ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
+if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.make <<\_ACEOF
+SHELL = /bin/sh
+all:
+ @echo '@@@%%%=$(MAKE)=@@@%%%'
+_ACEOF
+# GNU make sometimes prints "make[1]: Entering ...", which would confuse us.
+case `${MAKE-make} -f conftest.make 2>/dev/null` in
+ *@@@%%%=?*=@@@%%%*)
+ eval ac_cv_prog_make_${ac_make}_set=yes;;
+ *)
+ eval ac_cv_prog_make_${ac_make}_set=no;;
+esac
+rm -f conftest.make
+fi
+if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ SET_MAKE=
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+ am__leading_dot=.
+else
+ am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+
+# Check whether --enable-silent-rules was given.
+if test "${enable_silent_rules+set}" = set; then :
+ enableval=$enable_silent_rules;
+fi
+
+case $enable_silent_rules in # (((
+ yes) AM_DEFAULT_VERBOSITY=0;;
+ no) AM_DEFAULT_VERBOSITY=1;;
+ *) AM_DEFAULT_VERBOSITY=1;;
+esac
+am_make=${MAKE-make}
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5
+$as_echo_n "checking whether $am_make supports nested variables... " >&6; }
+if ${am_cv_make_support_nested_variables+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if $as_echo 'TRUE=$(BAR$(V))
+BAR0=false
+BAR1=true
+V=1
+am__doit:
+ @$(TRUE)
+.PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then
+ am_cv_make_support_nested_variables=yes
+else
+ am_cv_make_support_nested_variables=no
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5
+$as_echo "$am_cv_make_support_nested_variables" >&6; }
+if test $am_cv_make_support_nested_variables = yes; then
+ AM_V='$(V)'
+ AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
+else
+ AM_V=$AM_DEFAULT_VERBOSITY
+ AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
+fi
+AM_BACKSLASH='\'
+
+if test "`cd $srcdir && pwd`" != "`pwd`"; then
+ # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
+ # is not polluted with repeated "-I."
+ am__isrc=' -I$(srcdir)'
+ # test to see if srcdir already configured
+ if test -f $srcdir/config.status; then
+ as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5
+ fi
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+ if (cygpath --version) >/dev/null 2>/dev/null; then
+ CYGPATH_W='cygpath -w'
+ else
+ CYGPATH_W=echo
+ fi
+fi
+
+
+# Define the identity of the package.
+ PACKAGE='lcd4linux'
+ VERSION='0.11.0-SVN'
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE "$PACKAGE"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define VERSION "$VERSION"
+_ACEOF
+
+# Some tools Automake needs.
+
+ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"}
+
+
+AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"}
+
+
+AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"}
+
+
+AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
+
+
+MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
+
+# For better backward compatibility. To be removed once Automake 1.9.x
+# dies out for good. For more background, see:
+# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
+# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
+mkdir_p='$(MKDIR_P)'
+
+# We need awk for the "check" target. The system "awk" is bad on
+# some platforms.
+# Always define AMTAR for backward compatibility. Yes, it's still used
+# in the wild :-( We should find a proper way to deprecate it ...
+AMTAR='$${TAR-tar}'
+
+
+# We'll loop over all known methods to create a tar archive until one works.
+_am_tools='gnutar pax cpio none'
+
+am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'
+
+
+
+
+
+
+# POSIX will say in a future version that running "rm -f" with no argument
+# is OK; and we want to be able to make that assumption in our Makefile
+# recipes. So use an aggressive probe to check that the usage we want is
+# actually supported "in the wild" to an acceptable degree.
+# See automake bug#10828.
+# To make any issue more visible, cause the running configure to be aborted
+# by default if the 'rm' program in use doesn't match our expectations; the
+# user can still override this though.
+if rm -f && rm -fr && rm -rf; then : OK; else
+ cat >&2 <<'END'
+Oops!
+
+Your 'rm' program seems unable to run without file operands specified
+on the command line, even when the '-f' option is present. This is contrary
+to the behaviour of most rm programs out there, and not conforming with
+the upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
+
+Please tell bug-automake@gnu.org about your system, including the value
+of your $PATH and any error possibly output before this message. This
+can help us improve future automake versions.
+
+END
+ if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
+ echo 'Configuration will proceed anyway, since you have set the' >&2
+ echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
+ echo >&2
+ else
+ cat >&2 <<'END'
+Aborting the configuration process, to ensure you take notice of the issue.
+
+You can download and install GNU coreutils to get an 'rm' implementation
+that behaves properly: <http://www.gnu.org/software/coreutils/>.
+
+If you want to complete the configuration process using your problematic
+'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
+to "yes", and re-run configure.
+
+END
+ as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5
+ fi
+fi
+
+ac_config_headers="$ac_config_headers config.h"
+
+
+# Checks for programs.
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="${ac_tool_prefix}gcc"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+ ac_ct_CC=$CC
+ # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CC="gcc"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_CC" = x; then
+ CC=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ CC=$ac_ct_CC
+ fi
+else
+ CC="$ac_cv_prog_CC"
+fi
+
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="${ac_tool_prefix}cc"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ fi
+fi
+if test -z "$CC"; then
+ # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ ac_prog_rejected=no
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+ ac_prog_rejected=yes
+ continue
+ fi
+ ac_cv_prog_CC="cc"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+if test $ac_prog_rejected = yes; then
+ # We found a bogon in the path, so make sure we never use it.
+ set dummy $ac_cv_prog_CC
+ shift
+ if test $# != 0; then
+ # We chose a different compiler from the bogus one.
+ # However, it has the same basename, so the bogon will be chosen
+ # first if we set CC to just the basename; use the full file name.
+ shift
+ ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+ fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ for ac_prog in cl.exe
+ do
+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$CC" && break
+ done
+fi
+if test -z "$CC"; then
+ ac_ct_CC=$CC
+ for ac_prog in cl.exe
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CC="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$ac_ct_CC" && break
+done
+
+ if test "x$ac_ct_CC" = x; then
+ CC=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ CC=$ac_ct_CC
+ fi
+fi
+
+fi
+
+
+test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "no acceptable C compiler found in \$PATH
+See \`config.log' for more details" "$LINENO" 5; }
+
+# Provide some information about the compiler.
+$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
+set X $ac_compile
+ac_compiler=$2
+for ac_option in --version -v -V -qversion; do
+ { { ac_try="$ac_compiler $ac_option >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_compiler $ac_option >&5") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ sed '10a\
+... rest of stderr output deleted ...
+ 10q' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ fi
+ rm -f conftest.er1 conftest.err
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+done
+
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out"
+# Try to create an executable without -o first, disregard a.out.
+# It will help us diagnose broken compilers, and finding out an intuition
+# of exeext.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5
+$as_echo_n "checking whether the C compiler works... " >&6; }
+ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+
+# The possible output files:
+ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*"
+
+ac_rmfiles=
+for ac_file in $ac_files
+do
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
+ * ) ac_rmfiles="$ac_rmfiles $ac_file";;
+ esac
+done
+rm -f $ac_rmfiles
+
+if { { ac_try="$ac_link_default"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link_default") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then :
+ # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
+# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
+# in a Makefile. We should not override ac_cv_exeext if it was cached,
+# so that the user can short-circuit this test for compilers unknown to
+# Autoconf.
+for ac_file in $ac_files ''
+do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj )
+ ;;
+ [ab].out )
+ # We found the default executable, but exeext='' is most
+ # certainly right.
+ break;;
+ *.* )
+ if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
+ then :; else
+ ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ fi
+ # We set ac_cv_exeext here because the later test for it is not
+ # safe: cross compilers may not add the suffix if given an `-o'
+ # argument, so we may need to know it at that point already.
+ # Even if this section looks crufty: it has the advantage of
+ # actually working.
+ break;;
+ * )
+ break;;
+ esac
+done
+test "$ac_cv_exeext" = no && ac_cv_exeext=
+
+else
+ ac_file=''
+fi
+if test -z "$ac_file"; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+$as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error 77 "C compiler cannot create executables
+See \`config.log' for more details" "$LINENO" 5; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5
+$as_echo_n "checking for C compiler default output file name... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5
+$as_echo "$ac_file" >&6; }
+ac_exeext=$ac_cv_exeext
+
+rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out
+ac_clean_files=$ac_clean_files_save
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5
+$as_echo_n "checking for suffix of executables... " >&6; }
+if { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then :
+ # If both `conftest.exe' and `conftest' are `present' (well, observable)
+# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will
+# work properly (i.e., refer to `conftest.exe'), while it won't with
+# `rm'.
+for ac_file in conftest.exe conftest conftest.*; do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
+ *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ break;;
+ * ) break;;
+ esac
+done
+else
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details" "$LINENO" 5; }
+fi
+rm -f conftest conftest$ac_cv_exeext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
+$as_echo "$ac_cv_exeext" >&6; }
+
+rm -f conftest.$ac_ext
+EXEEXT=$ac_cv_exeext
+ac_exeext=$EXEEXT
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdio.h>
+int
+main ()
+{
+FILE *f = fopen ("conftest.out", "w");
+ return ferror (f) || fclose (f) != 0;
+
+ ;
+ return 0;
+}
+_ACEOF
+ac_clean_files="$ac_clean_files conftest.out"
+# Check that the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5
+$as_echo_n "checking whether we are cross compiling... " >&6; }
+if test "$cross_compiling" != yes; then
+ { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+ if { ac_try='./conftest$ac_cv_exeext'
+ { { case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; }; then
+ cross_compiling=no
+ else
+ if test "$cross_compiling" = maybe; then
+ cross_compiling=yes
+ else
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5
+$as_echo "$cross_compiling" >&6; }
+
+rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out
+ac_clean_files=$ac_clean_files_save
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
+$as_echo_n "checking for suffix of object files... " >&6; }
+if ${ac_cv_objext+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.o conftest.obj
+if { { ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_compile") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then :
+ for ac_file in conftest.o conftest.obj conftest.*; do
+ test -f "$ac_file" || continue;
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;;
+ *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+ break;;
+ esac
+done
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot compute suffix of object files: cannot compile
+See \`config.log' for more details" "$LINENO" 5; }
+fi
+rm -f conftest.$ac_cv_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5
+$as_echo "$ac_cv_objext" >&6; }
+OBJEXT=$ac_cv_objext
+ac_objext=$OBJEXT
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
+$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
+if ${ac_cv_c_compiler_gnu+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+#ifndef __GNUC__
+ choke me
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_compiler_gnu=yes
+else
+ ac_compiler_gnu=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5
+$as_echo "$ac_cv_c_compiler_gnu" >&6; }
+if test $ac_compiler_gnu = yes; then
+ GCC=yes
+else
+ GCC=
+fi
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
+$as_echo_n "checking whether $CC accepts -g... " >&6; }
+if ${ac_cv_prog_cc_g+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_save_c_werror_flag=$ac_c_werror_flag
+ ac_c_werror_flag=yes
+ ac_cv_prog_cc_g=no
+ CFLAGS="-g"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_prog_cc_g=yes
+else
+ CFLAGS=""
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+else
+ ac_c_werror_flag=$ac_save_c_werror_flag
+ CFLAGS="-g"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_prog_cc_g=yes
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ac_c_werror_flag=$ac_save_c_werror_flag
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5
+$as_echo "$ac_cv_prog_cc_g" >&6; }
+if test "$ac_test_CFLAGS" = set; then
+ CFLAGS=$ac_save_CFLAGS
+elif test $ac_cv_prog_cc_g = yes; then
+ if test "$GCC" = yes; then
+ CFLAGS="-g -O2"
+ else
+ CFLAGS="-g"
+ fi
+else
+ if test "$GCC" = yes; then
+ CFLAGS="-O2"
+ else
+ CFLAGS=
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
+$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
+if ${ac_cv_prog_cc_c89+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_prog_cc_c89=no
+ac_save_CC=$CC
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdarg.h>
+#include <stdio.h>
+struct stat;
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+ char **p;
+ int i;
+{
+ return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+ char *s;
+ va_list v;
+ va_start (v,p);
+ s = g (p, va_arg (v,int));
+ va_end (v);
+ return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
+ function prototypes and stuff, but not '\xHH' hex character constants.
+ These don't provoke an error unfortunately, instead are silently treated
+ as 'x'. The following induces an error, until -std is added to get
+ proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
+ array size at least. It's necessary to write '\x00'==0 to get something
+ that's true only with -std. */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
+ inside strings and character constants. */
+#define FOO(x) 'x'
+int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
+ ;
+ return 0;
+}
+_ACEOF
+for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
+ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+ CC="$ac_save_CC $ac_arg"
+ if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_prog_cc_c89=$ac_arg
+fi
+rm -f core conftest.err conftest.$ac_objext
+ test "x$ac_cv_prog_cc_c89" != "xno" && break
+done
+rm -f conftest.$ac_ext
+CC=$ac_save_CC
+
+fi
+# AC_CACHE_VAL
+case "x$ac_cv_prog_cc_c89" in
+ x)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
+$as_echo "none needed" >&6; } ;;
+ xno)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
+$as_echo "unsupported" >&6; } ;;
+ *)
+ CC="$CC $ac_cv_prog_cc_c89"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
+$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
+esac
+if test "x$ac_cv_prog_cc_c89" != xno; then :
+
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5
+$as_echo_n "checking whether $CC understands -c and -o together... " >&6; }
+if ${am_cv_prog_cc_c_o+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+ # Make sure it works both with $CC and with simple cc.
+ # Following AC_PROG_CC_C_O, we do the test twice because some
+ # compilers refuse to overwrite an existing .o file with -o,
+ # though they will create one.
+ am_cv_prog_cc_c_o=yes
+ for am_i in 1 2; do
+ if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5
+ ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } \
+ && test -f conftest2.$ac_objext; then
+ : OK
+ else
+ am_cv_prog_cc_c_o=no
+ break
+ fi
+ done
+ rm -f core conftest*
+ unset am_i
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5
+$as_echo "$am_cv_prog_cc_c_o" >&6; }
+if test "$am_cv_prog_cc_c_o" != yes; then
+ # Losing compiler, so override with the script.
+ # FIXME: It is wrong to rewrite CC.
+ # But if we don't then we get into trouble of one sort or another.
+ # A longer-term fix would be to have automake use am__CC in this case,
+ # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
+ CC="$am_aux_dir/compile $CC"
+fi
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+DEPDIR="${am__leading_dot}deps"
+
+ac_config_commands="$ac_config_commands depfiles"
+
+
+am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+ @echo this is the am__doit target
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5
+$as_echo_n "checking for style of include used by $am_make... " >&6; }
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# Ignore all kinds of additional output from 'make'.
+case `$am_make -s -f confmf 2> /dev/null` in #(
+*the\ am__doit\ target*)
+ am__include=include
+ am__quote=
+ _am_result=GNU
+ ;;
+esac
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+ echo '.include "confinc"' > confmf
+ case `$am_make -s -f confmf 2> /dev/null` in #(
+ *the\ am__doit\ target*)
+ am__include=.include
+ am__quote="\""
+ _am_result=BSD
+ ;;
+ esac
+fi
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5
+$as_echo "$_am_result" >&6; }
+rm -f confinc confmf
+
+# Check whether --enable-dependency-tracking was given.
+if test "${enable_dependency_tracking+set}" = set; then :
+ enableval=$enable_dependency_tracking;
+fi
+
+if test "x$enable_dependency_tracking" != xno; then
+ am_depcomp="$ac_aux_dir/depcomp"
+ AMDEPBACKSLASH='\'
+ am__nodep='_no'
+fi
+ if test "x$enable_dependency_tracking" != xno; then
+ AMDEP_TRUE=
+ AMDEP_FALSE='#'
+else
+ AMDEP_TRUE='#'
+ AMDEP_FALSE=
+fi
+
+
+
+depcc="$CC" am_compiler_list=
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5
+$as_echo_n "checking dependency style of $depcc... " >&6; }
+if ${am_cv_CC_dependencies_compiler_type+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+ # We make a subdir and do the tests there. Otherwise we can end up
+ # making bogus files that we don't know about and never remove. For
+ # instance it was reported that on HP-UX the gcc test will end up
+ # making a dummy file named 'D' -- because '-MD' means "put the output
+ # in D".
+ rm -rf conftest.dir
+ mkdir conftest.dir
+ # Copy depcomp to subdir because otherwise we won't find it if we're
+ # using a relative directory.
+ cp "$am_depcomp" conftest.dir
+ cd conftest.dir
+ # We will build objects and dependencies in a subdirectory because
+ # it helps to detect inapplicable dependency modes. For instance
+ # both Tru64's cc and ICC support -MD to output dependencies as a
+ # side effect of compilation, but ICC will put the dependencies in
+ # the current directory while Tru64 will put them in the object
+ # directory.
+ mkdir sub
+
+ am_cv_CC_dependencies_compiler_type=none
+ if test "$am_compiler_list" = ""; then
+ am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+ fi
+ am__universal=false
+ case " $depcc " in #(
+ *\ -arch\ *\ -arch\ *) am__universal=true ;;
+ esac
+
+ for depmode in $am_compiler_list; do
+ # Setup a source with many dependencies, because some compilers
+ # like to wrap large dependency lists on column 80 (with \), and
+ # we should not choose a depcomp mode which is confused by this.
+ #
+ # We need to recreate these files for each test, as the compiler may
+ # overwrite some of them when testing with obscure command lines.
+ # This happens at least with the AIX C compiler.
+ : > sub/conftest.c
+ for i in 1 2 3 4 5 6; do
+ echo '#include "conftst'$i'.h"' >> sub/conftest.c
+ # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
+ # Solaris 10 /bin/sh.
+ echo '/* dummy */' > sub/conftst$i.h
+ done
+ echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+ # We check with '-c' and '-o' for the sake of the "dashmstdout"
+ # mode. It turns out that the SunPro C++ compiler does not properly
+ # handle '-M -o', and we need to detect this. Also, some Intel
+ # versions had trouble with output in subdirs.
+ am__obj=sub/conftest.${OBJEXT-o}
+ am__minus_obj="-o $am__obj"
+ case $depmode in
+ gcc)
+ # This depmode causes a compiler race in universal mode.
+ test "$am__universal" = false || continue
+ ;;
+ nosideeffect)
+ # After this tag, mechanisms are not by side-effect, so they'll
+ # only be used when explicitly requested.
+ if test "x$enable_dependency_tracking" = xyes; then
+ continue
+ else
+ break
+ fi
+ ;;
+ msvc7 | msvc7msys | msvisualcpp | msvcmsys)
+ # This compiler won't grok '-c -o', but also, the minuso test has
+ # not run yet. These depmodes are late enough in the game, and
+ # so weak that their functioning should not be impacted.
+ am__obj=conftest.${OBJEXT-o}
+ am__minus_obj=
+ ;;
+ none) break ;;
+ esac
+ if depmode=$depmode \
+ source=sub/conftest.c object=$am__obj \
+ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
+ >/dev/null 2>conftest.err &&
+ grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
+ ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+ # icc doesn't choke on unknown options, it will just issue warnings
+ # or remarks (even with -Werror). So we grep stderr for any message
+ # that says an option was ignored or not supported.
+ # When given -MP, icc 7.0 and 7.1 complain thusly:
+ # icc: Command line warning: ignoring option '-M'; no argument required
+ # The diagnosis changed in icc 8.0:
+ # icc: Command line remark: option '-MP' not supported
+ if (grep 'ignoring option' conftest.err ||
+ grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+ am_cv_CC_dependencies_compiler_type=$depmode
+ break
+ fi
+ fi
+ done
+
+ cd ..
+ rm -rf conftest.dir
+else
+ am_cv_CC_dependencies_compiler_type=none
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5
+$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; }
+CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
+
+ if
+ test "x$enable_dependency_tracking" != xno \
+ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then
+ am__fastdepCC_TRUE=
+ am__fastdepCC_FALSE='#'
+else
+ am__fastdepCC_TRUE='#'
+ am__fastdepCC_FALSE=
+fi
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5
+$as_echo_n "checking how to run the C preprocessor... " >&6; }
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+ CPP=
+fi
+if test -z "$CPP"; then
+ if ${ac_cv_prog_CPP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ # Double quotes because CPP needs to be expanded
+ for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
+ do
+ ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+
+else
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether nonexistent headers
+ # can be detected and how.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+ # Broken: success on invalid input.
+continue
+else
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+ break
+fi
+
+ done
+ ac_cv_prog_CPP=$CPP
+
+fi
+ CPP=$ac_cv_prog_CPP
+else
+ ac_cv_prog_CPP=$CPP
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5
+$as_echo "$CPP" >&6; }
+ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+
+else
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether nonexistent headers
+ # can be detected and how.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+ # Broken: success on invalid input.
+continue
+else
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+
+else
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details" "$LINENO" 5; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5
+$as_echo_n "checking whether ln -s works... " >&6; }
+LN_S=$as_ln_s
+if test "$LN_S" = "ln -s"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5
+$as_echo "no, using $LN_S" >&6; }
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
+set x ${MAKE-make}
+ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
+if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.make <<\_ACEOF
+SHELL = /bin/sh
+all:
+ @echo '@@@%%%=$(MAKE)=@@@%%%'
+_ACEOF
+# GNU make sometimes prints "make[1]: Entering ...", which would confuse us.
+case `${MAKE-make} -f conftest.make 2>/dev/null` in
+ *@@@%%%=?*=@@@%%%*)
+ eval ac_cv_prog_make_${ac_make}_set=yes;;
+ *)
+ eval ac_cv_prog_make_${ac_make}_set=no;;
+esac
+rm -f conftest.make
+fi
+if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ SET_MAKE=
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+
+
+
+
+
+
+
+if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
+set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_PKG_CONFIG+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $PKG_CONFIG in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+PKG_CONFIG=$ac_cv_path_PKG_CONFIG
+if test -n "$PKG_CONFIG"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
+$as_echo "$PKG_CONFIG" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_path_PKG_CONFIG"; then
+ ac_pt_PKG_CONFIG=$PKG_CONFIG
+ # Extract the first word of "pkg-config", so it can be a program name with args.
+set dummy pkg-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $ac_pt_PKG_CONFIG in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG
+if test -n "$ac_pt_PKG_CONFIG"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5
+$as_echo "$ac_pt_PKG_CONFIG" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_pt_PKG_CONFIG" = x; then
+ PKG_CONFIG=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ PKG_CONFIG=$ac_pt_PKG_CONFIG
+ fi
+else
+ PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
+fi
+
+fi
+if test -n "$PKG_CONFIG"; then
+ _pkg_min_version=0.9.0
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5
+$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; }
+ if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ PKG_CONFIG=""
+ fi
+fi
+
+# dmalloc
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if malloc debugging is wanted" >&5
+$as_echo_n "checking if malloc debugging is wanted... " >&6; }
+
+# Check whether --with-dmalloc was given.
+if test "${with_dmalloc+set}" = set; then :
+ withval=$with_dmalloc; if test "$withval" = yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+$as_echo "#define WITH_DMALLOC 1" >>confdefs.h
+
+ LIBS="$LIBS -ldmalloc"
+ LDFLAGS="$LDFLAGS -g"
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+
+# Checks for libraries.
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for log in -lm" >&5
+$as_echo_n "checking for log in -lm... " >&6; }
+if ${ac_cv_lib_m_log+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lm $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char log ();
+int
+main ()
+{
+return log ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_m_log=yes
+else
+ ac_cv_lib_m_log=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_log" >&5
+$as_echo "$ac_cv_lib_m_log" >&6; }
+if test "x$ac_cv_lib_m_log" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBM 1
+_ACEOF
+
+ LIBS="-lm $LIBS"
+
+fi
+
+
+# curses
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
+$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
+if ${ac_cv_path_GREP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -z "$GREP"; then
+ ac_path_GREP_found=false
+ # Loop through the user's path and test for each of PROGNAME-LIST
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in grep ggrep; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
+ as_fn_executable_p "$ac_path_GREP" || continue
+# Check for GNU ac_path_GREP and select it if it is found.
+ # Check for GNU $ac_path_GREP
+case `"$ac_path_GREP" --version 2>&1` in
+*GNU*)
+ ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
+*)
+ ac_count=0
+ $as_echo_n 0123456789 >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ $as_echo 'GREP' >> "conftest.nl"
+ "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ as_fn_arith $ac_count + 1 && ac_count=$as_val
+ if test $ac_count -gt ${ac_path_GREP_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_GREP="$ac_path_GREP"
+ ac_path_GREP_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+ $ac_path_GREP_found && break 3
+ done
+ done
+ done
+IFS=$as_save_IFS
+ if test -z "$ac_cv_path_GREP"; then
+ as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+ fi
+else
+ ac_cv_path_GREP=$GREP
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
+$as_echo "$ac_cv_path_GREP" >&6; }
+ GREP="$ac_cv_path_GREP"
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
+$as_echo_n "checking for egrep... " >&6; }
+if ${ac_cv_path_EGREP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
+ then ac_cv_path_EGREP="$GREP -E"
+ else
+ if test -z "$EGREP"; then
+ ac_path_EGREP_found=false
+ # Loop through the user's path and test for each of PROGNAME-LIST
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in egrep; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
+ as_fn_executable_p "$ac_path_EGREP" || continue
+# Check for GNU ac_path_EGREP and select it if it is found.
+ # Check for GNU $ac_path_EGREP
+case `"$ac_path_EGREP" --version 2>&1` in
+*GNU*)
+ ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
+*)
+ ac_count=0
+ $as_echo_n 0123456789 >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ $as_echo 'EGREP' >> "conftest.nl"
+ "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ as_fn_arith $ac_count + 1 && ac_count=$as_val
+ if test $ac_count -gt ${ac_path_EGREP_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_EGREP="$ac_path_EGREP"
+ ac_path_EGREP_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+ $ac_path_EGREP_found && break 3
+ done
+ done
+ done
+IFS=$as_save_IFS
+ if test -z "$ac_cv_path_EGREP"; then
+ as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+ fi
+else
+ ac_cv_path_EGREP=$EGREP
+fi
+
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
+$as_echo "$ac_cv_path_EGREP" >&6; }
+ EGREP="$ac_cv_path_EGREP"
+
+
+
+ search_ncurses=true
+ screen_manager=""
+ has_curses=false
+
+ CFLAGS=${CFLAGS--O}
+
+
+
+
+
+# Check whether --with-sco was given.
+if test "${with_sco+set}" = set; then :
+ withval=$with_sco;
+ if test x$withval = xyes; then
+
+$as_echo "#define SCO_FLAVOR 1" >>confdefs.h
+
+ CFLAGS="$CFLAGS -D_SVID3"
+ fi
+
+fi
+
+
+
+# Check whether --with-sunos-curses was given.
+if test "${with_sunos_curses+set}" = set; then :
+ withval=$with_sunos_curses;
+ if test x$withval = xyes; then
+
+ search_ncurses=false
+ screen_manager="SunOS 4.x /usr/5include curses"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: Using SunOS 4.x /usr/5include curses" >&5
+$as_echo "Using SunOS 4.x /usr/5include curses" >&6; }
+
+$as_echo "#define USE_SUNOS_CURSES 1" >>confdefs.h
+
+
+$as_echo "#define HAS_CURSES 1" >>confdefs.h
+
+ has_curses=true
+
+$as_echo "#define NO_COLOR_CURSES 1" >>confdefs.h
+
+
+$as_echo "#define USE_SYSV_CURSES 1" >>confdefs.h
+
+ CURSES_INCLUDEDIR="-I/usr/5include"
+ CURSES_LIBS="/usr/5lib/libcurses.a /usr/5lib/libtermcap.a"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: Please note that some screen refreshs may fail" >&5
+$as_echo "Please note that some screen refreshs may fail" >&6; }
+
+ fi
+
+fi
+
+
+
+# Check whether --with-osf1-curses was given.
+if test "${with_osf1_curses+set}" = set; then :
+ withval=$with_osf1_curses;
+ if test x$withval = xyes; then
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: Using OSF1 curses" >&5
+$as_echo "Using OSF1 curses" >&6; }
+ search_ncurses=false
+ screen_manager="OSF1 curses"
+
+$as_echo "#define HAS_CURSES 1" >>confdefs.h
+
+ has_curses=true
+
+$as_echo "#define NO_COLOR_CURSES 1" >>confdefs.h
+
+
+$as_echo "#define USE_SYSV_CURSES 1" >>confdefs.h
+
+ CURSES_LIBS="-lcurses"
+
+ fi
+
+fi
+
+
+
+# Check whether --with-vcurses was given.
+if test "${with_vcurses+set}" = set; then :
+ withval=$with_vcurses; if test x$withval != xyes; then
+ CURSES_INCLUDEDIR="-I$withval"
+ fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: Using SysV curses" >&5
+$as_echo "Using SysV curses" >&6; }
+
+$as_echo "#define HAS_CURSES 1" >>confdefs.h
+
+ has_curses=true
+
+$as_echo "#define USE_SYSV_CURSES 1" >>confdefs.h
+
+ search_ncurses=false
+ screen_manager="SysV/curses"
+ CURSES_LIBS="-lcurses"
+
+
+fi
+
+
+
+# Check whether --with-ncurses was given.
+if test "${with_ncurses+set}" = set; then :
+ withval=$with_ncurses; if test x$withval = xno ; then
+ search_ncurses=false
+ elif test x$withval != xyes ; then
+ CURSES_LIBS="$LIBS -L$withval/lib -lncurses"
+ CURSES_INCLUDEDIR="-I$withval/include"
+ search_ncurses=false
+ screen_manager="ncurses"
+
+$as_echo "#define USE_NCURSES 1" >>confdefs.h
+
+
+$as_echo "#define HAS_CURSES 1" >>confdefs.h
+
+ has_curses=true
+ fi
+
+fi
+
+
+ if $search_ncurses
+ then
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking location of ncurses.h file..." >&5
+$as_echo "$as_me: checking location of ncurses.h file..." >&6;}
+
+
+ if $search_ncurses
+ then
+ if test -f /usr/include/ncurses.h
+ then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: Found ncurses on /usr/include/ncurses.h" >&5
+$as_echo "Found ncurses on /usr/include/ncurses.h" >&6; }
+ CURSES_LIBS="-lncurses"
+ CURSES_INCLUDEDIR=""
+ search_ncurses=false
+ screen_manager="ncurses on /usr/include"
+
+$as_echo "#define HAS_CURSES 1" >>confdefs.h
+
+ has_curses=true
+
+$as_echo "#define USE_NCURSES 1" >>confdefs.h
+
+ fi
+ fi
+
+
+ if $search_ncurses
+ then
+ if test -f /usr/include/ncurses/ncurses.h
+ then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: Found ncurses on /usr/include/ncurses/ncurses.h" >&5
+$as_echo "Found ncurses on /usr/include/ncurses/ncurses.h" >&6; }
+ CURSES_LIBS="-lncurses"
+ CURSES_INCLUDEDIR="-I/usr/include/ncurses"
+ search_ncurses=false
+ screen_manager="ncurses on /usr/include/ncurses"
+
+$as_echo "#define HAS_CURSES 1" >>confdefs.h
+
+ has_curses=true
+
+$as_echo "#define USE_NCURSES 1" >>confdefs.h
+
+ fi
+ fi
+
+
+ if $search_ncurses
+ then
+ if test -f /usr/local/include/ncurses.h
+ then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: Found ncurses on /usr/local/include/ncurses.h" >&5
+$as_echo "Found ncurses on /usr/local/include/ncurses.h" >&6; }
+ CURSES_LIBS="-L/usr/local/lib -lncurses"
+ CURSES_INCLUDEDIR="-I/usr/local/include"
+ search_ncurses=false
+ screen_manager="ncurses on /usr/local"
+
+$as_echo "#define HAS_CURSES 1" >>confdefs.h
+
+ has_curses=true
+
+$as_echo "#define USE_NCURSES 1" >>confdefs.h
+
+ fi
+ fi
+
+
+ if $search_ncurses
+ then
+ if test -f /usr/local/include/ncurses/ncurses.h
+ then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: Found ncurses on /usr/local/include/ncurses/ncurses.h" >&5
+$as_echo "Found ncurses on /usr/local/include/ncurses/ncurses.h" >&6; }
+ CURSES_LIBS="-L/usr/local/lib -L/usr/local/lib/ncurses -lncurses"
+ CURSES_INCLUDEDIR="-I/usr/local/include/ncurses"
+ search_ncurses=false
+ screen_manager="ncurses on /usr/local/include/ncurses"
+
+$as_echo "#define HAS_CURSES 1" >>confdefs.h
+
+ has_curses=true
+
+$as_echo "#define USE_NCURSES 1" >>confdefs.h
+
+ fi
+ fi
+
+
+
+ if $search_ncurses
+ then
+ if test -f /usr/local/include/ncurses/curses.h
+ then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: Found ncurses on /usr/local/include/ncurses/curses.h" >&5
+$as_echo "Found ncurses on /usr/local/include/ncurses/curses.h" >&6; }
+ CURSES_LIBS="-L/usr/local/lib -lncurses"
+ CURSES_INCLUDEDIR="-I/usr/local/include/ncurses -DRENAMED_NCURSES"
+ search_ncurses=false
+ screen_manager="renamed ncurses on /usr/local/.../ncurses"
+
+$as_echo "#define HAS_CURSES 1" >>confdefs.h
+
+ has_curses=true
+
+$as_echo "#define USE_NCURSES 1" >>confdefs.h
+
+ fi
+ fi
+
+
+
+ if $search_ncurses
+ then
+ if test -f /usr/include/ncurses/curses.h
+ then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: Found ncurses on /usr/include/ncurses/curses.h" >&5
+$as_echo "Found ncurses on /usr/include/ncurses/curses.h" >&6; }
+ CURSES_LIBS="-lncurses"
+ CURSES_INCLUDEDIR="-I/usr/include/ncurses -DRENAMED_NCURSES"
+ search_ncurses=false
+ screen_manager="renamed ncurses on /usr/include/ncurses"
+
+$as_echo "#define HAS_CURSES 1" >>confdefs.h
+
+ has_curses=true
+
+$as_echo "#define USE_NCURSES 1" >>confdefs.h
+
+ fi
+ fi
+
+
+ if $search_ncurses
+ then
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include </usr/include/curses.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "init_color" >/dev/null 2>&1; then :
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: Using SysV curses" >&5
+$as_echo "Using SysV curses" >&6; }
+
+$as_echo "#define HAS_CURSES 1" >>confdefs.h
+
+ has_curses=true
+
+$as_echo "#define USE_SYSV_CURSES 1" >>confdefs.h
+
+ search_ncurses=false
+ screen_manager="SysV/curses"
+ CURSES_LIBS="-lcurses"
+
+fi
+rm -f conftest*
+
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+#include <curses.h>
+#ifdef __NCURSES_H
+#undef USE_NCURSES
+USE_NCURSES
+#endif
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "USE_NCURSES" >/dev/null 2>&1; then :
+
+ CURSES_INCLUDEDIR="$CURSES_INCLUDEDIR -DRENAMED_NCURSES"
+
+$as_echo "#define HAS_CURSES 1" >>confdefs.h
+
+ has_curses=true
+
+$as_echo "#define USE_NCURSES 1" >>confdefs.h
+
+ search_ncurses=false
+ screen_manager="ncurses installed as curses"
+
+fi
+rm -f conftest*
+
+ fi
+
+ if $search_ncurses
+ then
+ if test -f /usr/5include/curses.h
+ then
+
+ search_ncurses=false
+ screen_manager="SunOS 4.x /usr/5include curses"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: Using SunOS 4.x /usr/5include curses" >&5
+$as_echo "Using SunOS 4.x /usr/5include curses" >&6; }
+
+$as_echo "#define USE_SUNOS_CURSES 1" >>confdefs.h
+
+
+$as_echo "#define HAS_CURSES 1" >>confdefs.h
+
+ has_curses=true
+
+$as_echo "#define NO_COLOR_CURSES 1" >>confdefs.h
+
+
+$as_echo "#define USE_SYSV_CURSES 1" >>confdefs.h
+
+ CURSES_INCLUDEDIR="-I/usr/5include"
+ CURSES_LIBS="/usr/5lib/libcurses.a /usr/5lib/libtermcap.a"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: Please note that some screen refreshs may fail" >&5
+$as_echo "Please note that some screen refreshs may fail" >&6; }
+
+ fi
+ else
+ # check for ncurses version, to properly ifdef mouse-fix
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ncurses version" >&5
+$as_echo_n "checking for ncurses version... " >&6; }
+ ncurses_version=unknown
+cat > conftest.$ac_ext <<EOF
+#line 4889 "configure"
+#include "confdefs.h"
+#ifdef RENAMED_NCURSES
+#include <curses.h>
+#else
+#include <ncurses.h>
+#endif
+#undef VERSION
+VERSION:NCURSES_VERSION
+EOF
+ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "VERSION:" >conftest.out 2>&1; then
+ ncurses_version=`cat conftest.out|sed -e 's/^[^"]*"//' -e 's/".*//'`
+ fi
+ rm -rf conftest*
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ncurses_version" >&5
+$as_echo "$ncurses_version" >&6; }
+ case "$ncurses_version" in
+ 4.[01])
+
+$as_echo "#define NCURSES_970530 2" >>confdefs.h
+
+ ;;
+ 1.9.9g)
+
+$as_echo "#define NCURSES_970530 1" >>confdefs.h
+
+ ;;
+ 1*)
+
+$as_echo "#define NCURSES_970530 0" >>confdefs.h
+
+ ;;
+ esac
+ fi
+
+ fi
+
+
+
+
+# Checks for X11
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for X" >&5
+$as_echo_n "checking for X... " >&6; }
+
+
+# Check whether --with-x was given.
+if test "${with_x+set}" = set; then :
+ withval=$with_x;
+fi
+
+# $have_x is `yes', `no', `disabled', or empty when we do not yet know.
+if test "x$with_x" = xno; then
+ # The user explicitly disabled X.
+ have_x=disabled
+else
+ case $x_includes,$x_libraries in #(
+ *\'*) as_fn_error $? "cannot use X directory names containing '" "$LINENO" 5;; #(
+ *,NONE | NONE,*) if ${ac_cv_have_x+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ # One or both of the vars are not set, and there is no cached value.
+ac_x_includes=no ac_x_libraries=no
+rm -f -r conftest.dir
+if mkdir conftest.dir; then
+ cd conftest.dir
+ cat >Imakefile <<'_ACEOF'
+incroot:
+ @echo incroot='${INCROOT}'
+usrlibdir:
+ @echo usrlibdir='${USRLIBDIR}'
+libdir:
+ @echo libdir='${LIBDIR}'
+_ACEOF
+ if (export CC; ${XMKMF-xmkmf}) >/dev/null 2>/dev/null && test -f Makefile; then
+ # GNU make sometimes prints "make[1]: Entering ...", which would confuse us.
+ for ac_var in incroot usrlibdir libdir; do
+ eval "ac_im_$ac_var=\`\${MAKE-make} $ac_var 2>/dev/null | sed -n 's/^$ac_var=//p'\`"
+ done
+ # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR.
+ for ac_extension in a so sl dylib la dll; do
+ if test ! -f "$ac_im_usrlibdir/libX11.$ac_extension" &&
+ test -f "$ac_im_libdir/libX11.$ac_extension"; then
+ ac_im_usrlibdir=$ac_im_libdir; break
+ fi
+ done
+ # Screen out bogus values from the imake configuration. They are
+ # bogus both because they are the default anyway, and because
+ # using them would break gcc on systems where it needs fixed includes.
+ case $ac_im_incroot in
+ /usr/include) ac_x_includes= ;;
+ *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes=$ac_im_incroot;;
+ esac
+ case $ac_im_usrlibdir in
+ /usr/lib | /usr/lib64 | /lib | /lib64) ;;
+ *) test -d "$ac_im_usrlibdir" && ac_x_libraries=$ac_im_usrlibdir ;;
+ esac
+ fi
+ cd ..
+ rm -f -r conftest.dir
+fi
+
+# Standard set of common directories for X headers.
+# Check X11 before X11Rn because it is often a symlink to the current release.
+ac_x_header_dirs='
+/usr/X11/include
+/usr/X11R7/include
+/usr/X11R6/include
+/usr/X11R5/include
+/usr/X11R4/include
+
+/usr/include/X11
+/usr/include/X11R7
+/usr/include/X11R6
+/usr/include/X11R5
+/usr/include/X11R4
+
+/usr/local/X11/include
+/usr/local/X11R7/include
+/usr/local/X11R6/include
+/usr/local/X11R5/include
+/usr/local/X11R4/include
+
+/usr/local/include/X11
+/usr/local/include/X11R7
+/usr/local/include/X11R6
+/usr/local/include/X11R5
+/usr/local/include/X11R4
+
+/usr/X386/include
+/usr/x386/include
+/usr/XFree86/include/X11
+
+/usr/include
+/usr/local/include
+/usr/unsupported/include
+/usr/athena/include
+/usr/local/x11r5/include
+/usr/lpp/Xamples/include
+
+/usr/openwin/include
+/usr/openwin/share/include'
+
+if test "$ac_x_includes" = no; then
+ # Guess where to find include files, by looking for Xlib.h.
+ # First, try using that file with no special directory specified.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <X11/Xlib.h>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+ # We can compile using X headers with no special include directory.
+ac_x_includes=
+else
+ for ac_dir in $ac_x_header_dirs; do
+ if test -r "$ac_dir/X11/Xlib.h"; then
+ ac_x_includes=$ac_dir
+ break
+ fi
+done
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+fi # $ac_x_includes = no
+
+if test "$ac_x_libraries" = no; then
+ # Check for the libraries.
+ # See if we find them without any special options.
+ # Don't add to $LIBS permanently.
+ ac_save_LIBS=$LIBS
+ LIBS="-lX11 $LIBS"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <X11/Xlib.h>
+int
+main ()
+{
+XrmInitialize ()
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ LIBS=$ac_save_LIBS
+# We can link X programs with no special library path.
+ac_x_libraries=
+else
+ LIBS=$ac_save_LIBS
+for ac_dir in `$as_echo "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g`
+do
+ # Don't even attempt the hair of trying to link an X program!
+ for ac_extension in a so sl dylib la dll; do
+ if test -r "$ac_dir/libX11.$ac_extension"; then
+ ac_x_libraries=$ac_dir
+ break 2
+ fi
+ done
+done
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi # $ac_x_libraries = no
+
+case $ac_x_includes,$ac_x_libraries in #(
+ no,* | *,no | *\'*)
+ # Didn't find X, or a directory has "'" in its name.
+ ac_cv_have_x="have_x=no";; #(
+ *)
+ # Record where we found X for the cache.
+ ac_cv_have_x="have_x=yes\
+ ac_x_includes='$ac_x_includes'\
+ ac_x_libraries='$ac_x_libraries'"
+esac
+fi
+;; #(
+ *) have_x=yes;;
+ esac
+ eval "$ac_cv_have_x"
+fi # $with_x != no
+
+if test "$have_x" != yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_x" >&5
+$as_echo "$have_x" >&6; }
+ no_x=yes
+else
+ # If each of the values was on the command line, it overrides each guess.
+ test "x$x_includes" = xNONE && x_includes=$ac_x_includes
+ test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries
+ # Update the cache value to reflect the command line values.
+ ac_cv_have_x="have_x=yes\
+ ac_x_includes='$x_includes'\
+ ac_x_libraries='$x_libraries'"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: libraries $x_libraries, headers $x_includes" >&5
+$as_echo "libraries $x_libraries, headers $x_includes" >&6; }
+fi
+
+if test "$no_x" = yes; then
+ # Not all programs may use this symbol, but it does not hurt to define it.
+
+$as_echo "#define X_DISPLAY_MISSING 1" >>confdefs.h
+
+ X_CFLAGS= X_PRE_LIBS= X_LIBS= X_EXTRA_LIBS=
+else
+ if test -n "$x_includes"; then
+ X_CFLAGS="$X_CFLAGS -I$x_includes"
+ fi
+
+ # It would also be nice to do this for all -L options, not just this one.
+ if test -n "$x_libraries"; then
+ X_LIBS="$X_LIBS -L$x_libraries"
+ # For Solaris; some versions of Sun CC require a space after -R and
+ # others require no space. Words are not sufficient . . . .
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -R must be followed by a space" >&5
+$as_echo_n "checking whether -R must be followed by a space... " >&6; }
+ ac_xsave_LIBS=$LIBS; LIBS="$LIBS -R$x_libraries"
+ ac_xsave_c_werror_flag=$ac_c_werror_flag
+ ac_c_werror_flag=yes
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ X_LIBS="$X_LIBS -R$x_libraries"
+else
+ LIBS="$ac_xsave_LIBS -R $x_libraries"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ X_LIBS="$X_LIBS -R $x_libraries"
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: neither works" >&5
+$as_echo "neither works" >&6; }
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ ac_c_werror_flag=$ac_xsave_c_werror_flag
+ LIBS=$ac_xsave_LIBS
+ fi
+
+ # Check for system-dependent libraries X programs must link with.
+ # Do this before checking for the system-independent R6 libraries
+ # (-lICE), since we may need -lsocket or whatever for X linking.
+
+ if test "$ISC" = yes; then
+ X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl_s -linet"
+ else
+ # Martyn Johnson says this is needed for Ultrix, if the X
+ # libraries were built with DECnet support. And Karl Berry says
+ # the Alpha needs dnet_stub (dnet does not exist).
+ ac_xsave_LIBS="$LIBS"; LIBS="$LIBS $X_LIBS -lX11"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char XOpenDisplay ();
+int
+main ()
+{
+return XOpenDisplay ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dnet_ntoa in -ldnet" >&5
+$as_echo_n "checking for dnet_ntoa in -ldnet... " >&6; }
+if ${ac_cv_lib_dnet_dnet_ntoa+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldnet $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dnet_ntoa ();
+int
+main ()
+{
+return dnet_ntoa ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_dnet_dnet_ntoa=yes
+else
+ ac_cv_lib_dnet_dnet_ntoa=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dnet_dnet_ntoa" >&5
+$as_echo "$ac_cv_lib_dnet_dnet_ntoa" >&6; }
+if test "x$ac_cv_lib_dnet_dnet_ntoa" = xyes; then :
+ X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet"
+fi
+
+ if test $ac_cv_lib_dnet_dnet_ntoa = no; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dnet_ntoa in -ldnet_stub" >&5
+$as_echo_n "checking for dnet_ntoa in -ldnet_stub... " >&6; }
+if ${ac_cv_lib_dnet_stub_dnet_ntoa+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldnet_stub $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dnet_ntoa ();
+int
+main ()
+{
+return dnet_ntoa ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_dnet_stub_dnet_ntoa=yes
+else
+ ac_cv_lib_dnet_stub_dnet_ntoa=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dnet_stub_dnet_ntoa" >&5
+$as_echo "$ac_cv_lib_dnet_stub_dnet_ntoa" >&6; }
+if test "x$ac_cv_lib_dnet_stub_dnet_ntoa" = xyes; then :
+ X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub"
+fi
+
+ fi
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ LIBS="$ac_xsave_LIBS"
+
+ # msh@cis.ufl.edu says -lnsl (and -lsocket) are needed for his 386/AT,
+ # to get the SysV transport functions.
+ # Chad R. Larson says the Pyramis MIS-ES running DC/OSx (SVR4)
+ # needs -lnsl.
+ # The nsl library prevents programs from opening the X display
+ # on Irix 5.2, according to T.E. Dickey.
+ # The functions gethostbyname, getservbyname, and inet_addr are
+ # in -lbsd on LynxOS 3.0.1/i386, according to Lars Hecking.
+ ac_fn_c_check_func "$LINENO" "gethostbyname" "ac_cv_func_gethostbyname"
+if test "x$ac_cv_func_gethostbyname" = xyes; then :
+
+fi
+
+ if test $ac_cv_func_gethostbyname = no; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -lnsl" >&5
+$as_echo_n "checking for gethostbyname in -lnsl... " >&6; }
+if ${ac_cv_lib_nsl_gethostbyname+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lnsl $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char gethostbyname ();
+int
+main ()
+{
+return gethostbyname ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_nsl_gethostbyname=yes
+else
+ ac_cv_lib_nsl_gethostbyname=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nsl_gethostbyname" >&5
+$as_echo "$ac_cv_lib_nsl_gethostbyname" >&6; }
+if test "x$ac_cv_lib_nsl_gethostbyname" = xyes; then :
+ X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl"
+fi
+
+ if test $ac_cv_lib_nsl_gethostbyname = no; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -lbsd" >&5
+$as_echo_n "checking for gethostbyname in -lbsd... " >&6; }
+if ${ac_cv_lib_bsd_gethostbyname+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lbsd $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char gethostbyname ();
+int
+main ()
+{
+return gethostbyname ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_bsd_gethostbyname=yes
+else
+ ac_cv_lib_bsd_gethostbyname=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bsd_gethostbyname" >&5
+$as_echo "$ac_cv_lib_bsd_gethostbyname" >&6; }
+if test "x$ac_cv_lib_bsd_gethostbyname" = xyes; then :
+ X_EXTRA_LIBS="$X_EXTRA_LIBS -lbsd"
+fi
+
+ fi
+ fi
+
+ # lieder@skyler.mavd.honeywell.com says without -lsocket,
+ # socket/setsockopt and other routines are undefined under SCO ODT
+ # 2.0. But -lsocket is broken on IRIX 5.2 (and is not necessary
+ # on later versions), says Simon Leinen: it contains gethostby*
+ # variants that don't use the name server (or something). -lsocket
+ # must be given before -lnsl if both are needed. We assume that
+ # if connect needs -lnsl, so does gethostbyname.
+ ac_fn_c_check_func "$LINENO" "connect" "ac_cv_func_connect"
+if test "x$ac_cv_func_connect" = xyes; then :
+
+fi
+
+ if test $ac_cv_func_connect = no; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for connect in -lsocket" >&5
+$as_echo_n "checking for connect in -lsocket... " >&6; }
+if ${ac_cv_lib_socket_connect+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lsocket $X_EXTRA_LIBS $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char connect ();
+int
+main ()
+{
+return connect ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_socket_connect=yes
+else
+ ac_cv_lib_socket_connect=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_connect" >&5
+$as_echo "$ac_cv_lib_socket_connect" >&6; }
+if test "x$ac_cv_lib_socket_connect" = xyes; then :
+ X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS"
+fi
+
+ fi
+
+ # Guillermo Gomez says -lposix is necessary on A/UX.
+ ac_fn_c_check_func "$LINENO" "remove" "ac_cv_func_remove"
+if test "x$ac_cv_func_remove" = xyes; then :
+
+fi
+
+ if test $ac_cv_func_remove = no; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for remove in -lposix" >&5
+$as_echo_n "checking for remove in -lposix... " >&6; }
+if ${ac_cv_lib_posix_remove+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lposix $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char remove ();
+int
+main ()
+{
+return remove ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_posix_remove=yes
+else
+ ac_cv_lib_posix_remove=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_posix_remove" >&5
+$as_echo "$ac_cv_lib_posix_remove" >&6; }
+if test "x$ac_cv_lib_posix_remove" = xyes; then :
+ X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix"
+fi
+
+ fi
+
+ # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay.
+ ac_fn_c_check_func "$LINENO" "shmat" "ac_cv_func_shmat"
+if test "x$ac_cv_func_shmat" = xyes; then :
+
+fi
+
+ if test $ac_cv_func_shmat = no; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shmat in -lipc" >&5
+$as_echo_n "checking for shmat in -lipc... " >&6; }
+if ${ac_cv_lib_ipc_shmat+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lipc $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char shmat ();
+int
+main ()
+{
+return shmat ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_ipc_shmat=yes
+else
+ ac_cv_lib_ipc_shmat=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ipc_shmat" >&5
+$as_echo "$ac_cv_lib_ipc_shmat" >&6; }
+if test "x$ac_cv_lib_ipc_shmat" = xyes; then :
+ X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc"
+fi
+
+ fi
+ fi
+
+ # Check for libraries that X11R6 Xt/Xaw programs need.
+ ac_save_LDFLAGS=$LDFLAGS
+ test -n "$x_libraries" && LDFLAGS="$LDFLAGS -L$x_libraries"
+ # SM needs ICE to (dynamically) link under SunOS 4.x (so we have to
+ # check for ICE first), but we must link in the order -lSM -lICE or
+ # we get undefined symbols. So assume we have SM if we have ICE.
+ # These have to be linked with before -lX11, unlike the other
+ # libraries we check for below, so use a different variable.
+ # John Interrante, Karl Berry
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for IceConnectionNumber in -lICE" >&5
+$as_echo_n "checking for IceConnectionNumber in -lICE... " >&6; }
+if ${ac_cv_lib_ICE_IceConnectionNumber+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lICE $X_EXTRA_LIBS $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char IceConnectionNumber ();
+int
+main ()
+{
+return IceConnectionNumber ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_ICE_IceConnectionNumber=yes
+else
+ ac_cv_lib_ICE_IceConnectionNumber=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ICE_IceConnectionNumber" >&5
+$as_echo "$ac_cv_lib_ICE_IceConnectionNumber" >&6; }
+if test "x$ac_cv_lib_ICE_IceConnectionNumber" = xyes; then :
+ X_PRE_LIBS="$X_PRE_LIBS -lSM -lICE"
+fi
+
+ LDFLAGS=$ac_save_LDFLAGS
+
+fi
+
+# double-check for X11
+if test "$no_x" != "yes"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
+$as_echo_n "checking for ANSI C header files... " >&6; }
+if ${ac_cv_header_stdc+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_header_stdc=yes
+else
+ ac_cv_header_stdc=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+ # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "memchr" >/dev/null 2>&1; then :
+
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "free" >/dev/null 2>&1; then :
+
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+ if test "$cross_compiling" = yes; then :
+ :
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <ctype.h>
+#include <stdlib.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+ (('a' <= (c) && (c) <= 'i') \
+ || ('j' <= (c) && (c) <= 'r') \
+ || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+ int i;
+ for (i = 0; i < 256; i++)
+ if (XOR (islower (i), ISLOWER (i))
+ || toupper (i) != TOUPPER (i))
+ return 2;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+
+else
+ ac_cv_header_stdc=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
+$as_echo "$ac_cv_header_stdc" >&6; }
+if test $ac_cv_header_stdc = yes; then
+
+$as_echo "#define STDC_HEADERS 1" >>confdefs.h
+
+fi
+
+# On IRIX 5.3, sys/types and inttypes.h are conflicting.
+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+ inttypes.h stdint.h unistd.h
+do :
+ as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
+"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+for ac_header in X11/Xlib.h X11/Xutil.h
+do :
+ as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+ no_x="$no_x"
+else
+ no_x="yes"
+fi
+
+done
+
+ if test "$no_x" = "yes"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: configure thinks X11 is available while it is *not*" >&5
+$as_echo "$as_me: WARNING: configure thinks X11 is available while it is *not*" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: maybe someone wants to fix autoconf's AC PATH XTRA" >&5
+$as_echo "$as_me: WARNING: maybe someone wants to fix autoconf's AC PATH XTRA" >&2;}
+ fi
+fi
+
+# check for gd.h
+for ac_header in gd/gd.h gd.h
+do :
+ as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+ has_gd="true"; break
+else
+ has_gd="false"
+fi
+
+done
+
+
+# check for jpeglib.h
+for ac_header in jpeglib.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "jpeglib.h" "ac_cv_header_jpeglib_h" "$ac_includes_default"
+if test "x$ac_cv_header_jpeglib_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_JPEGLIB_H 1
+_ACEOF
+ has_jpeglib="true"
+else
+ has_jpeglib="false"
+fi
+
+done
+
+
+# check for sys/io.h (RouterBoard driver)
+for ac_header in sys/io.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "sys/io.h" "ac_cv_header_sys_io_h" "$ac_includes_default"
+if test "x$ac_cv_header_sys_io_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_SYS_IO_H 1
+_ACEOF
+ has_io_h="true"
+else
+ has_io_h="false"
+fi
+
+done
+
+
+# check for usb.h
+for ac_header in usb.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "usb.h" "ac_cv_header_usb_h" "$ac_includes_default"
+if test "x$ac_cv_header_usb_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_USB_H 1
+_ACEOF
+ has_usb="true"
+else
+ has_usb="false"
+fi
+
+done
+
+
+# check for libusb-1.0/libusb.h
+for ac_header in libusb-1.0/libusb.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "libusb-1.0/libusb.h" "ac_cv_header_libusb_1_0_libusb_h" "$ac_includes_default"
+if test "x$ac_cv_header_libusb_1_0_libusb_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBUSB_1_0_LIBUSB_H 1
+_ACEOF
+ has_usb10="true"
+else
+ has_usb10="false"
+fi
+
+done
+
+
+# check for luise.h
+for ac_header in luise.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "luise.h" "ac_cv_header_luise_h" "$ac_includes_default"
+if test "x$ac_cv_header_luise_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LUISE_H 1
+_ACEOF
+ has_luise="true"
+else
+ has_luise="false"
+fi
+
+done
+
+
+# check for serdisplib
+for ac_header in serdisplib/serdisp.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "serdisplib/serdisp.h" "ac_cv_header_serdisplib_serdisp_h" "$ac_includes_default"
+if test "x$ac_cv_header_serdisplib_serdisp_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_SERDISPLIB_SERDISP_H 1
+_ACEOF
+ has_serdisplib="true"
+else
+ has_serdisplib="false"
+fi
+
+done
+
+
+# check for st2205 libs
+for ac_header in st2205.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "st2205.h" "ac_cv_header_st2205_h" "$ac_includes_default"
+if test "x$ac_cv_header_st2205_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_ST2205_H 1
+_ACEOF
+ has_st2205="true"
+else
+ has_st2205="false"
+fi
+
+done
+
+
+# check for vncserver libs
+for ac_header in rfb/rfb.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "rfb/rfb.h" "ac_cv_header_rfb_rfb_h" "$ac_includes_default"
+if test "x$ac_cv_header_rfb_rfb_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_RFB_RFB_H 1
+_ACEOF
+ has_vncserverlib="true"
+else
+ has_vncserverlib="false"
+fi
+
+done
+
+
+# check for LCD-Linux
+for ac_header in linux/lcd-linux.h linux/hd44780.h
+do :
+ as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+ has_lcd_linux="true"
+else
+ has_lcd_linux="false"; break
+fi
+
+done
+
+
+# check for ftdi.h (ULA200)
+for ac_header in ftdi.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "ftdi.h" "ac_cv_header_ftdi_h" "$ac_includes_default"
+if test "x$ac_cv_header_ftdi_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_FTDI_H 1
+_ACEOF
+ has_ftdi="true"
+else
+ has_ftdi="false"; break
+fi
+
+done
+
+
+# check for python
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if python support is wanted" >&5
+$as_echo_n "checking if python support is wanted... " >&6; }
+
+# Check whether --with-python was given.
+if test "${with_python+set}" = set; then :
+ withval=$with_python; { $as_echo "$as_me:${as_lineno-$LINENO}: result: $withval" >&5
+$as_echo "$withval" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+if test "$with_python" = "yes"; then
+ # ===========================================================================
+# http://www.nongnu.org/autoconf-archive/ax_python_devel.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+# AX_PYTHON_DEVEL([version])
+#
+# DESCRIPTION
+#
+# Note: Defines as a precious variable "PYTHON_VERSION". Don't override it
+# in your configure.ac.
+#
+# This macro checks for Python and tries to get the include path to
+# 'Python.h'. It provides the $(PYTHON_CPPFLAGS) and $(PYTHON_LDFLAGS)
+# output variables. It also exports $(PYTHON_EXTRA_LIBS) and
+# $(PYTHON_EXTRA_LDFLAGS) for embedding Python in your code.
+#
+# You can search for some particular version of Python by passing a
+# parameter to this macro, for example ">= '2.3.1'", or "== '2.4'". Please
+# note that you *have* to pass also an operator along with the version to
+# match, and pay special attention to the single quotes surrounding the
+# version number. Don't use "PYTHON_VERSION" for this: that environment
+# variable is declared as precious and thus reserved for the end-user.
+#
+# This macro should work for all versions of Python >= 2.1.0. As an end
+# user, you can disable the check for the python version by setting the
+# PYTHON_NOVERSIONCHECK environment variable to something else than the
+# empty string.
+#
+# If you need to use this macro for an older Python version, please
+# contact the authors. We're always open for feedback.
+#
+# LICENSE
+#
+# Copyright (c) 2009 Sebastian Huber <sebastian-huber@web.de>
+# Copyright (c) 2009 Alan W. Irwin <irwin@beluga.phys.uvic.ca>
+# Copyright (c) 2009 Rafael Laboissiere <rafael@laboissiere.net>
+# Copyright (c) 2009 Andrew Collier <colliera@ukzn.ac.za>
+# Copyright (c) 2009 Matteo Settenvini <matteo@member.fsf.org>
+# Copyright (c) 2009 Horst Knorr <hk_classes@knoda.org>
+#
+# This program is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation, either version 3 of the License, or (at your
+# option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+# Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# As a special exception, the respective Autoconf Macro's copyright owner
+# gives unlimited permission to copy, distribute and modify the configure
+# scripts that are the output of Autoconf when processing the Macro. You
+# need not follow the terms of the GNU General Public License when using
+# or distributing such scripts, even though portions of the text of the
+# Macro appear in them. The GNU General Public License (GPL) does govern
+# all other use of the material that constitutes the Autoconf Macro.
+#
+# This special exception to the GPL applies to versions of the Autoconf
+# Macro released by the Autoconf Archive. When you make and distribute a
+# modified version of the Autoconf Macro, you may extend this special
+# exception to the GPL to apply to your modified version as well.
+
+# This is what autoupdate's m4 run will expand. It fires
+# the warning (with _au_warn_XXX), outputs it into the
+# updated configure.ac (with AC_DIAGNOSE), and then outputs
+# the replacement expansion.
+
+
+# This is an auxiliary macro that is also run when
+# autoupdate runs m4. It simply calls m4_warning, but
+# we need a wrapper so that each warning is emitted only
+# once. We break the quoting in m4_warning's argument in
+# order to expand this macro's arguments, not AU_DEFUN's.
+
+
+# Finally, this is the expansion that is picked up by
+# autoconf. It tells the user to run autoupdate, and
+# then outputs the replacement expansion. We do not care
+# about autoupdate's warning because that contains
+# information on what to do *after* running autoupdate.
+
+
+
+
+ #
+ # Allow the use of a (user set) custom python version
+ #
+
+
+ # Extract the first word of "python[$PYTHON_VERSION]", so it can be a program name with args.
+set dummy python$PYTHON_VERSION; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_PYTHON+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $PYTHON in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_PYTHON="$PYTHON" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_PYTHON="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+PYTHON=$ac_cv_path_PYTHON
+if test -n "$PYTHON"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON" >&5
+$as_echo "$PYTHON" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ if test -z "$PYTHON"; then
+ as_fn_error $? "Cannot find python$PYTHON_VERSION in your system path" "$LINENO" 5
+ PYTHON_VERSION=""
+ fi
+
+ #
+ # Check for a version of Python >= 2.1.0
+ #
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a version of Python >= '2.1.0'" >&5
+$as_echo_n "checking for a version of Python >= '2.1.0'... " >&6; }
+ ac_supports_python_ver=`$PYTHON -c "import sys; \
+ ver = sys.version.split ()[0]; \
+ print (ver >= '2.1.0')"`
+ if test "$ac_supports_python_ver" != "True"; then
+ if test -z "$PYTHON_NOVERSIONCHECK"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "
+This version of the AC_PYTHON_DEVEL macro
+doesn't work properly with versions of Python before
+2.1.0. You may need to re-run configure, setting the
+variables PYTHON_CPPFLAGS, PYTHON_LDFLAGS, PYTHON_SITE_PKG,
+PYTHON_EXTRA_LIBS and PYTHON_EXTRA_LDFLAGS by hand.
+Moreover, to disable this check, set PYTHON_NOVERSIONCHECK
+to something else than an empty string.
+
+See \`config.log' for more details" "$LINENO" 5; }
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: skip at user request" >&5
+$as_echo "skip at user request" >&6; }
+ fi
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ fi
+
+ #
+ # if the macro parameter ``version'' is set, honour it
+ #
+ if test -n ""; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a version of Python " >&5
+$as_echo_n "checking for a version of Python ... " >&6; }
+ ac_supports_python_ver=`$PYTHON -c "import sys; \
+ ver = sys.version.split ()[0]; \
+ print (ver )"`
+ if test "$ac_supports_python_ver" = "True"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ as_fn_error $? "this package requires Python .
+If you have it installed, but it isn't the default Python
+interpreter in your system path, please pass the PYTHON_VERSION
+variable to configure. See \`\`configure --help'' for reference.
+" "$LINENO" 5
+ PYTHON_VERSION=""
+ fi
+ fi
+
+ #
+ # Check if you have distutils, else fail
+ #
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the distutils Python package" >&5
+$as_echo_n "checking for the distutils Python package... " >&6; }
+ ac_distutils_result=`$PYTHON -c "import distutils" 2>&1`
+ if test -z "$ac_distutils_result"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ as_fn_error $? "cannot import Python module \"distutils\".
+Please check your Python installation. The error was:
+$ac_distutils_result" "$LINENO" 5
+ PYTHON_VERSION=""
+ fi
+
+ #
+ # Check for Python include path
+ #
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python include path" >&5
+$as_echo_n "checking for Python include path... " >&6; }
+ if test -z "$PYTHON_CPPFLAGS"; then
+ python_path=`$PYTHON -c "import distutils.sysconfig; \
+ print (distutils.sysconfig.get_python_inc ());"`
+ if test -n "${python_path}"; then
+ python_path="-I$python_path"
+ fi
+ PYTHON_CPPFLAGS=$python_path
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_CPPFLAGS" >&5
+$as_echo "$PYTHON_CPPFLAGS" >&6; }
+
+
+ #
+ # Check for Python library path
+ #
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python library path" >&5
+$as_echo_n "checking for Python library path... " >&6; }
+ if test -z "$PYTHON_LDFLAGS"; then
+ # (makes two attempts to ensure we've got a version number
+ # from the interpreter)
+ ac_python_version=`cat<<EOD | $PYTHON -
+
+# join all versioning strings, on some systems
+# major/minor numbers could be in different list elements
+from distutils.sysconfig import *
+ret = ''
+for e in get_config_vars ('VERSION'):
+ if (e != None):
+ ret += e
+print (ret)
+EOD`
+
+ if test -z "$ac_python_version"; then
+ if test -n "$PYTHON_VERSION"; then
+ ac_python_version=$PYTHON_VERSION
+ else
+ ac_python_version=`$PYTHON -c "import sys; \
+ print (sys.version[:3])"`
+ fi
+ fi
+
+ # Make the versioning information available to the compiler
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_PYTHON "$ac_python_version"
+_ACEOF
+
+
+ # First, the library directory:
+ ac_python_libdir=`cat<<EOD | $PYTHON -
+
+# There should be only one
+import distutils.sysconfig
+for e in distutils.sysconfig.get_config_vars ('LIBDIR'):
+ if e != None:
+ print (e)
+ break
+EOD`
+
+ # Before checking for libpythonX.Y, we need to know
+ # the extension the OS we're on uses for libraries
+ # (we take the first one, if there's more than one fix me!):
+ ac_python_soext=`$PYTHON -c \
+ "import distutils.sysconfig; \
+ print (distutils.sysconfig.get_config_vars('SO')[0])"`
+
+ # Now, for the library:
+ ac_python_soname=`$PYTHON -c \
+ "import distutils.sysconfig; \
+ print (distutils.sysconfig.get_config_vars('LDLIBRARY')[0])"`
+
+ # Strip away extension from the end to canonicalize its name:
+ ac_python_library=`echo "$ac_python_soname" | sed "s/${ac_python_soext}$//"`
+
+ # This small piece shamelessly adapted from PostgreSQL python macro;
+ # credits goes to momjian, I think. I'd like to put the right name
+ # in the credits, if someone can point me in the right direction... ?
+ #
+ if test -n "$ac_python_libdir" -a -n "$ac_python_library" \
+ -a x"$ac_python_library" != x"$ac_python_soname"
+ then
+ # use the official shared library
+ ac_python_library=`echo "$ac_python_library" | sed "s/^lib//"`
+ PYTHON_LDFLAGS="-L$ac_python_libdir -l$ac_python_library"
+ else
+ # old way: use libpython from python_configdir
+ ac_python_libdir=`$PYTHON -c \
+ "from distutils.sysconfig import get_python_lib as f; \
+ import os; \
+ print (os.path.join(f(plat_specific=1, standard_lib=1), 'config'));"`
+ PYTHON_LDFLAGS="-L$ac_python_libdir -lpython$ac_python_version"
+ fi
+
+ if test -z "PYTHON_LDFLAGS"; then
+ as_fn_error $? "
+ Cannot determine location of your Python DSO. Please check it was installed with
+ dynamic libraries enabled, or try setting PYTHON_LDFLAGS by hand.
+ " "$LINENO" 5
+ fi
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_LDFLAGS" >&5
+$as_echo "$PYTHON_LDFLAGS" >&6; }
+
+
+ #
+ # Check for site packages
+ #
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python site-packages path" >&5
+$as_echo_n "checking for Python site-packages path... " >&6; }
+ if test -z "$PYTHON_SITE_PKG"; then
+ PYTHON_SITE_PKG=`$PYTHON -c "import distutils.sysconfig; \
+ print (distutils.sysconfig.get_python_lib(0,0));"`
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_SITE_PKG" >&5
+$as_echo "$PYTHON_SITE_PKG" >&6; }
+
+
+ #
+ # libraries which must be linked in when embedding
+ #
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking python extra libraries" >&5
+$as_echo_n "checking python extra libraries... " >&6; }
+ if test -z "$PYTHON_EXTRA_LIBS"; then
+ PYTHON_EXTRA_LIBS=`$PYTHON -c "import distutils.sysconfig; \
+ conf = distutils.sysconfig.get_config_var; \
+ print (conf('LOCALMODLIBS') + ' ' + conf('LIBS'))"`
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_EXTRA_LIBS" >&5
+$as_echo "$PYTHON_EXTRA_LIBS" >&6; }
+
+
+ #
+ # linking flags needed when embedding
+ #
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking python extra linking flags" >&5
+$as_echo_n "checking python extra linking flags... " >&6; }
+ if test -z "$PYTHON_EXTRA_LDFLAGS"; then
+ PYTHON_EXTRA_LDFLAGS=`$PYTHON -c "import distutils.sysconfig; \
+ conf = distutils.sysconfig.get_config_var; \
+ print (conf('LINKFORSHARED'))"`
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_EXTRA_LDFLAGS" >&5
+$as_echo "$PYTHON_EXTRA_LDFLAGS" >&6; }
+
+
+ #
+ # final check to see if everything compiles alright
+ #
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking consistency of all components of python development environment" >&5
+$as_echo_n "checking consistency of all components of python development environment... " >&6; }
+ # save current global flags
+ ac_save_LIBS="$LIBS"
+ ac_save_CPPFLAGS="$CPPFLAGS"
+ LIBS="$ac_save_LIBS $PYTHON_LDFLAGS $PYTHON_EXTRA_LDFLAGS $PYTHON_EXTRA_LIBS"
+ CPPFLAGS="$ac_save_CPPFLAGS $PYTHON_CPPFLAGS"
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+ #include <Python.h>
+int
+main ()
+{
+Py_Initialize();
+ ;
+ return 0;
+}
+
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ pythonexists=yes
+else
+ pythonexists=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+ # turn back to default flags
+ CPPFLAGS="$ac_save_CPPFLAGS"
+ LIBS="$ac_save_LIBS"
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $pythonexists" >&5
+$as_echo "$pythonexists" >&6; }
+
+ if test ! "x$pythonexists" = "xyes"; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "
+ Could not link test program to Python. Maybe the main Python library has been
+ installed in some non-standard library path. If so, pass it to configure,
+ via the LDFLAGS environment variable.
+ Example: ./configure LDFLAGS=\"-L/usr/non-standard-path/python/lib\"
+ ============================================================================
+ ERROR!
+ You probably have to install the development version of the Python package
+ for your distribution. The exact name of this package varies among them.
+ ============================================================================
+
+See \`config.log' for more details" "$LINENO" 5; }
+ PYTHON_VERSION=""
+ fi
+
+ #
+ # all done!
+ #
+
+fi
+
+# check for parport
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if raw port I/O is wanted" >&5
+$as_echo_n "checking if raw port I/O is wanted... " >&6; }
+
+# Check whether --with-outb was given.
+if test "${with_outb+set}" = set; then :
+ withval=$with_outb; { $as_echo "$as_me:${as_lineno-$LINENO}: result: $withval" >&5
+$as_echo "$withval" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+for ac_header in asm/io.h linux/parport.h linux/ppdev.h
+do :
+ as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+ has_parport="true"
+else
+ has_parport="false"
+fi
+
+done
+
+
+# drivers
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking which drivers to compile" >&5
+$as_echo_n "checking which drivers to compile... " >&6; }
+
+# Check whether --with-drivers was given.
+if test "${with_drivers+set}" = set; then :
+ withval=$with_drivers; drivers=$withval
+else
+ drivers=all
+
+fi
+
+
+drivers=`echo $drivers|sed 's/,/ /g'`
+
+for driver in $drivers; do
+
+ case $driver in
+ !*)
+ val="no"
+ driver=`echo $driver|cut -c 2-`
+ ;;
+ *)
+ val="yes"
+ ;;
+ esac
+
+ case "$driver" in
+ all)
+ ASTUSB="yes"
+ BECKMANNEGLE="yes"
+ BWCT="yes"
+ CRYSTALFONTZ="yes"
+ CURSES="yes"
+ CWLINUX="yes"
+ D4D="yes"
+ DPF="yes"
+ EA232graphic="yes"
+ EFN="yes"
+ FUTABAVFD="yes"
+ FW8888="yes"
+ G15="yes"
+ GLCD2USB="yes"
+ HD44780="yes"
+ HD44780_I2C="yes"
+ IRLCD="yes"
+ LCD2USB="yes"
+ LCDLINUX="yes"
+ LCDTERM="yes"
+ LEDMATRIX="yes"
+ LPH7508="yes"
+ LUISE="yes"
+ LW_ABP="yes"
+ M50530="yes"
+ MATRIXORBITAL="yes"
+ MATRIXORBITALGX="yes"
+ MDM166A="yes"
+ MILINST="yes"
+ NEWHAVEN="yes"
+ NORITAKE="yes"
+ NULL="yes"
+ PERTELIAN="yes"
+ PHANDERSON="yes"
+ PICGRAPHIC="yes"
+ PICOLCD="yes"
+ PICOLCDGRAPHIC="yes"
+ PNG="yes"
+ PPM="yes"
+ ROUTERBOARD="yes"
+ SAMPLE="yes"
+ SAMSUNGSPF="yes"
+ ST2205="yes"
+ SERDISPLIB="yes"
+ SHUTTLEVFD="yes"
+ SIMPLELCD="yes"
+ T6963="yes"
+ TeakLCM="yes"
+ Trefon="yes"
+ ULA200="yes"
+ USBHUB="yes"
+ USBLCD="yes"
+ VNC="yes"
+ WINCORNIXDORF="yes"
+ X11="yes"
+ ;;
+ ASTUSB)
+ ASTUSB=$val
+ ;;
+ BeckmannEgle)
+ BECKMANNEGLE=$val
+ ;;
+ BWCT)
+ BWCT=$val
+ ;;
+ CrystalFontz)
+ CRYSTALFONTZ=$val
+ ;;
+ Curses)
+ CURSES=$val
+ ;;
+ Cwlinux)
+ CWLINUX=$val
+ ;;
+ D4D)
+ D4D=$val
+ ;;
+ DPF)
+ DPF=$val
+ ;;
+ EA232graphic)
+ EA232graphic=$val
+ ;;
+ EFN)
+ EFN=$val
+ ;;
+ FutabaVFD)
+ FUTABAVFD=$val
+ ;;
+ FW8888)
+ FW8888=$val
+ ;;
+ G15)
+ G15=$val
+ ;;
+ GLCD2USB)
+ GLCD2USB=$val
+ ;;
+ HD44780)
+ HD44780=$val
+ ;;
+ HD44780-I2C)
+ HD44780_I2C=$val
+ ;;
+ IRLCD)
+ IRLCD=$val
+ ;;
+ LCD2USB)
+ LCD2USB=$val
+ ;;
+ LCDLinux)
+ LCDLINUX=$val
+ ;;
+ LCDTerm)
+ LCDTERM=$val
+ ;;
+ LEDMatrix)
+ LEDMATRIX=$val
+ ;;
+ LPH7508)
+ LPH7508=$val
+ ;;
+ LUIse)
+ LUISE=$val
+ ;;
+ LW_ABP)
+ LW_ABP=$val
+ ;;
+ M50530)
+ M50530=$val
+ ;;
+ MatrixOrbital)
+ MATRIXORBITAL=$val
+ ;;
+ MatrixOrbitalGX)
+ MATRIXORBITALGX=$val
+ ;;
+ MDM166A)
+ MDM166A=$val
+ ;;
+ MilfordInstruments)
+ MILINST=$val
+ ;;
+ Newhaven)
+ NEWHAVEN=$val
+ ;;
+ Noritake)
+ NORITAKE=$val;
+ ;;
+ NULL)
+ NULL=$val;
+ ;;
+ Pertelian)
+ PERTELIAN=$val
+ ;;
+ PHAnderson)
+ PHANDERSON=$val
+ ;;
+ PICGraphic)
+ PICGRAPHIC=$val
+ ;;
+ picoLCD)
+ PICOLCD=$val
+ ;;
+ picoLCDGraphic)
+ PICOLCDGRAPHIC=$val
+ ;;
+ PNG)
+ PNG=$val
+ ;;
+ PPM)
+ PPM=$val
+ ;;
+ RouterBoard)
+ ROUTERBOARD=$val
+ ;;
+ Sample)
+ SAMPLE=$val
+ ;;
+ SamsungSPF)
+ SAMSUNGSPF=$val
+ ;;
+ serdisplib)
+ SERDISPLIB=$val;
+ ;;
+ ShuttleVFD)
+ SHUTTLEVFD=$val
+ ;;
+ SimpleLCD)
+ SIMPLELCD=$val
+ ;;
+ st2205)
+ ST2205=$val
+ ;;
+ T6963)
+ T6963=$val
+ ;;
+ TeakLCM)
+ TeakLCM=$val
+ ;;
+ Trefon)
+ Trefon=$val
+ ;;
+ ULA200)
+ ULA200=$val
+ ;;
+ USBHUB)
+ USBHUB=$val
+ ;;
+ USBLCD)
+ USBLCD=$val
+ ;;
+ VNC)
+ VNC=$val
+ ;;
+ WincorNixdorf)
+ WINCORNIXDORF=$val
+ ;;
+ X11)
+ X11=$val
+ ;;
+ *)
+ as_fn_error $? "Unknown driver '$driver'" "$LINENO" 5
+ ;;
+ esac
+done
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5
+$as_echo "done" >&6; }
+
+
+# generic display drivers
+TEXT="no"
+GRAPHIC="no"
+IMAGE="no"
+GPIO="no"
+
+# generiv I/O drivers
+PARPORT="no"
+SERIAL="no"
+I2C="no"
+KEYPAD="no"
+
+# generic libraries
+LIBUSB="no"
+LIBUSB10="no"
+LIBFTDI="no"
+
+if test "$ASTUSB" = "yes"; then
+ if test "$has_usb" = "true"; then
+ TEXT="yes"
+ SERIAL="yes"
+ DRIVERS="$DRIVERS drv_ASTUSB.o"
+ LIBUSB="yes"
+
+$as_echo "#define WITH_ASTUSB 1" >>confdefs.h
+
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: usb.h not found: ASTUSB driver disabled" >&5
+$as_echo "$as_me: WARNING: usb.h not found: ASTUSB driver disabled" >&2;}
+ fi
+fi
+
+if test "$BECKMANNEGLE" = "yes"; then
+ TEXT="yes"
+ GPIO="yes"
+ SERIAL="yes"
+ DRIVERS="$DRIVERS drv_BeckmannEgle.o"
+
+$as_echo "#define WITH_BECKMANNEGLE 1" >>confdefs.h
+
+fi
+
+if test "$BWCT" = "yes"; then
+ if test "$has_usb" = "true"; then
+ TEXT="yes"
+ DRIVERS="$DRIVERS drv_BWCT.o"
+ LIBUSB="yes"
+
+$as_echo "#define WITH_BWCT 1" >>confdefs.h
+
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: usb.h not found: BWCT driver disabled" >&5
+$as_echo "$as_me: WARNING: usb.h not found: BWCT driver disabled" >&2;}
+ fi
+fi
+
+if test "$CRYSTALFONTZ" = "yes"; then
+ TEXT="yes"
+ GPIO="yes"
+ SERIAL="yes"
+ KEYPAD="yes"
+ DRIVERS="$DRIVERS drv_Crystalfontz.o"
+
+$as_echo "#define WITH_CRYSTALFONTZ 1" >>confdefs.h
+
+fi
+
+if test "$CURSES" = "yes"; then
+ if test "$has_curses" = true; then
+ TEXT="yes"
+ KEYPAD="yes"
+ DRIVERS="$DRIVERS drv_Curses.o"
+ DRVLIBS="$DRVLIBS $CURSES_LIBS"
+ CPPFLAGS="$CPPFLAGS $CURSES_INCLUDES"
+
+$as_echo "#define WITH_CURSES 1" >>confdefs.h
+
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: curses not found: Curses driver disabled" >&5
+$as_echo "$as_me: WARNING: curses not found: Curses driver disabled" >&2;}
+ fi
+fi
+
+if test "$CWLINUX" = "yes"; then
+ TEXT="yes"
+ GPIO="yes"
+ SERIAL="yes"
+ KEYPAD="yes"
+ DRIVERS="$DRIVERS drv_Cwlinux.o"
+
+$as_echo "#define WITH_CWLINUX 1" >>confdefs.h
+
+fi
+
+if test "$D4D" = "yes"; then
+ TEXT="yes"
+ GRAPHIC="yes"
+ SERIAL="yes"
+ DRIVERS="$DRIVERS drv_D4D.o"
+
+$as_echo "#define WITH_D4D 1" >>confdefs.h
+
+fi
+
+if test "$DPF" = "yes"; then
+ GRAPHIC="yes"
+ DRIVERS="$DRIVERS drv_dpf.o"
+ LIBUSB="yes"
+
+$as_echo "#define WITH_DPF 1" >>confdefs.h
+
+fi
+
+if test "$EA232graphic" = "yes"; then
+ GRAPHIC="yes"
+ SERIAL="yes"
+ GPIO="yes"
+ DRIVERS="$DRIVERS drv_EA232graphic.o"
+
+$as_echo "#define WITH_EA232graphic 1" >>confdefs.h
+
+fi
+
+if test "$EFN" = "yes"; then
+ TEXT="yes"
+ DRIVERS="$DRIVERS drv_EFN.o"
+
+$as_echo "#define WITH_EFN 1" >>confdefs.h
+
+fi
+
+if test "$FUTABAVFD" = "yes"; then
+ if test "$has_parport" = "true"; then
+ TEXT="yes"
+ # select bus: serial (including USB), parallel or i2c
+ PARPORT="yes"
+ DRIVERS="$DRIVERS drv_FutabaVFD.o"
+
+$as_echo "#define WITH_FUTABAVFD 1" >>confdefs.h
+
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: asm/io.h or {linux/parport.h and linux/ppdev.h} not found: FutabaVFD driver disabled" >&5
+$as_echo "$as_me: WARNING: asm/io.h or {linux/parport.h and linux/ppdev.h} not found: FutabaVFD driver disabled" >&2;}
+ fi
+fi
+
+
+
+if test "$FW8888" = "yes"; then
+ TEXT="yes"
+ SERIAL="yes"
+ DRIVERS="$DRIVERS drv_FW8888.o"
+
+$as_echo "#define WITH_FW8888 1" >>confdefs.h
+
+fi
+
+if test "$G15" = "yes"; then
+ if test "$has_usb" = "true"; then
+ GRAPHIC="yes"
+ LIBUSB="yes"
+ DRIVERS="$DRIVERS drv_G15.o"
+
+$as_echo "#define WITH_G15 1" >>confdefs.h
+
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: usb.h not found: G15 driver disabled" >&5
+$as_echo "$as_me: WARNING: usb.h not found: G15 driver disabled" >&2;}
+ fi
+fi
+
+if test "$GLCD2USB" = "yes"; then
+ if test "$has_usb" = "true"; then
+ GRAPHIC="yes"
+ KEYPAD="yes"
+ DRIVERS="$DRIVERS drv_GLCD2USB.o"
+ LIBUSB="yes"
+
+$as_echo "#define WITH_GLCD2USB 1" >>confdefs.h
+
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: usb.h not found: GLCD2USB driver disabled" >&5
+$as_echo "$as_me: WARNING: usb.h not found: GLCD2USB driver disabled" >&2;}
+ fi
+fi
+
+if test "$HD44780_I2C" = "yes"; then
+ TEXT="yes"
+ I2C="yes"
+ GPIO="yes"
+ DRIVERS="$DRIVERS drv_HD44780.o"
+
+$as_echo "#define WITH_HD44780 1" >>confdefs.h
+
+fi
+
+if test "$HD44780" = "yes"; then
+ if test "$HD44780_I2C" != "yes"; then
+ if test "$has_parport" = "true"; then
+ TEXT="yes"
+ PARPORT="yes"
+ I2C="yes"
+ GPIO="yes"
+ KEYPAD="yes"
+ DRIVERS="$DRIVERS drv_HD44780.o"
+
+$as_echo "#define WITH_HD44780 1" >>confdefs.h
+
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: asm/io.h or {linux/parport.h and linux/ppdev.h} not found: HD44780 driver disabled" >&5
+$as_echo "$as_me: WARNING: asm/io.h or {linux/parport.h and linux/ppdev.h} not found: HD44780 driver disabled" >&2;}
+ fi
+ else
+ HD44780="no"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: HD44780-i2c enabled disabling HD44780" >&5
+$as_echo "$as_me: WARNING: HD44780-i2c enabled disabling HD44780" >&2;}
+ fi
+fi
+
+if test "$IRLCD" = "yes"; then
+ if test "$has_usb" = "true"; then
+ TEXT="yes"
+ SERIAL="yes"
+ DRIVERS="$DRIVERS drv_IRLCD.o"
+ LIBUSB="yes"
+
+$as_echo "#define WITH_IRLCD 1" >>confdefs.h
+
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: usb.h not found: IRLCD driver disabled" >&5
+$as_echo "$as_me: WARNING: usb.h not found: IRLCD driver disabled" >&2;}
+ fi
+fi
+
+if test "$LCD2USB" = "yes"; then
+ if test "$has_usb" = "true"; then
+ TEXT="yes"
+ SERIAL="yes"
+ KEYPAD="yes"
+ DRIVERS="$DRIVERS drv_LCD2USB.o"
+ LIBUSB="yes"
+
+$as_echo "#define WITH_LCD2USB 1" >>confdefs.h
+
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: usb.h not found: LCD2USB driver disabled" >&5
+$as_echo "$as_me: WARNING: usb.h not found: LCD2USB driver disabled" >&2;}
+ fi
+fi
+
+if test "$LCDLINUX" = "yes"; then
+ if test "$has_lcd_linux" = true; then
+ TEXT="yes"
+ DRIVERS="$DRIVERS drv_LCDLinux.o"
+
+$as_echo "#define WITH_LCDLINUX 1" >>confdefs.h
+
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: linux/lcd-linux.h or linux/hd44780.h not found: LCD-Linux driver disabled" >&5
+$as_echo "$as_me: WARNING: linux/lcd-linux.h or linux/hd44780.h not found: LCD-Linux driver disabled" >&2;}
+ fi
+fi
+
+if test "$LCDTERM" = "yes"; then
+ TEXT="yes"
+ SERIAL="yes"
+ DRIVERS="$DRIVERS drv_LCDTerm.o"
+
+$as_echo "#define WITH_LCDTERM 1" >>confdefs.h
+
+fi
+
+if test "$LEDMATRIX" = "yes"; then
+ GRAPHIC="yes"
+ DRIVERS="$DRIVERS drv_LEDMatrix.o"
+
+$as_echo "#define WITH_LEDMATRIX 1" >>confdefs.h
+
+fi
+
+if test "$LPH7508" = "yes"; then
+ if test "$has_parport" = "true"; then
+ GRAPHIC="yes"
+ GPIO="yes"
+ PARPORT="yes"
+ DRIVERS="$DRIVERS drv_LPH7508.o"
+
+$as_echo "#define WITH_LPH7508 1" >>confdefs.h
+
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: asm/io.h or {linux/parport.h and linux/ppdev.h} not found: LPH7508 driver disabled" >&5
+$as_echo "$as_me: WARNING: asm/io.h or {linux/parport.h and linux/ppdev.h} not found: LPH7508 driver disabled" >&2;}
+ fi
+fi
+
+if test "$LUISE" = "yes"; then
+ if test "$has_luise" = "true"; then
+ GRAPHIC="yes"
+ DRIVERS="$DRIVERS drv_LUIse.o"
+ DRVLIBS="$DRVLIBS -L/usr/local/lib -lluise"
+
+$as_echo "#define WITH_LUISE 1" >>confdefs.h
+
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: luise.h not found: LUIse driver disabled" >&5
+$as_echo "$as_me: WARNING: luise.h not found: LUIse driver disabled" >&2;}
+ fi
+fi
+
+if test "$LW_ABP" = "yes"; then
+ TEXT="yes"
+ SERIAL="yes"
+ KEYPAD="yes"
+ DRIVERS="$DRIVERS drv_LW_ABP.o"
+
+$as_echo "#define WITH_LW_ABP 1" >>confdefs.h
+
+fi
+
+if test "$M50530" = "yes"; then
+ if test "$has_parport" = "true"; then
+ TEXT="yes"
+ GPIO="yes"
+ PARPORT="yes"
+ DRIVERS="$DRIVERS drv_M50530.o"
+
+$as_echo "#define WITH_M50530 1" >>confdefs.h
+
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: asm/io.h or {linux/parport.h and linux/ppdev.h} not found: M50530 driver disabled" >&5
+$as_echo "$as_me: WARNING: asm/io.h or {linux/parport.h and linux/ppdev.h} not found: M50530 driver disabled" >&2;}
+ fi
+fi
+
+if test "$MATRIXORBITAL" = "yes"; then
+ TEXT="yes"
+ GPIO="yes"
+ SERIAL="yes"
+ DRIVERS="$DRIVERS drv_MatrixOrbital.o"
+
+$as_echo "#define WITH_MATRIXORBITAL 1" >>confdefs.h
+
+fi
+
+if test "$MATRIXORBITALGX" = "yes"; then
+ if test "$has_usb" = "true"; then
+ GRAPHIC="yes"
+ SERIAL="yes"
+ LIBUSB="yes"
+ DRIVERS="$DRIVERS drv_MatrixOrbitalGX.o"
+
+$as_echo "#define WITH_MATRIXORBITALGX 1" >>confdefs.h
+
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: usb.h not found: MatrixOrbitalGX driver disabled" >&5
+$as_echo "$as_me: WARNING: usb.h not found: MatrixOrbitalGX driver disabled" >&2;}
+ fi
+fi
+
+if test "$MDM166A" = "yes"; then
+ if test "$has_usb10" = "true"; then
+ GRAPHIC="yes"
+ DRIVERS="$DRIVERS drv_mdm166a.o"
+ GPIO="yes"
+ LIBUSB10="yes"
+
+$as_echo "#define WITH_MDM166A 1" >>confdefs.h
+
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: libusb-1.0/libusb.h not found: MDM166A driver disabled" >&5
+$as_echo "$as_me: WARNING: libusb-1.0/libusb.h not found: MDM166A driver disabled" >&2;}
+ fi
+fi
+
+if test "$MILINST" = "yes"; then
+ TEXT="yes"
+ SERIAL="yes"
+ DRIVERS="$DRIVERS drv_MilfordInstruments.o"
+
+$as_echo "#define WITH_MILINST 1" >>confdefs.h
+
+fi
+
+if test "$NEWHAVEN" = "yes"; then
+ TEXT="yes"
+ I2C="yes"
+ DRIVERS="$DRIVERS drv_Newhaven.o"
+
+$as_echo "#define WITH_NEWHAVEN 1" >>confdefs.h
+
+fi
+
+if test "$NORITAKE" = "yes"; then
+ if test "$has_parport" = "true"; then
+ TEXT="yes"
+ GRAPHIC="yes"
+ PARPORT="yes"
+ DRIVERS="$DRIVERS drv_Noritake.o"
+
+$as_echo "#define WITH_NORITAKE 1" >>confdefs.h
+
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: asm/io.h or {linux/parport.h and linux/ppdev.h} not found: NORITAKE driver disabled" >&5
+$as_echo "$as_me: WARNING: asm/io.h or {linux/parport.h and linux/ppdev.h} not found: NORITAKE driver disabled" >&2;}
+ fi
+fi
+
+if test "$NULL" = "yes"; then
+ TEXT="yes"
+ DRIVERS="$DRIVERS drv_NULL.o"
+
+$as_echo "#define WITH_NULL 1" >>confdefs.h
+
+fi
+
+if test "$PERTELIAN" = "yes"; then
+ TEXT="yes"
+ SERIAL="yes"
+ DRIVERS="$DRIVERS drv_Pertelian.o"
+
+$as_echo "#define WITH_PERTELIAN 1" >>confdefs.h
+
+fi
+
+if test "$PHANDERSON" = "yes"; then
+ TEXT="yes"
+ SERIAL="yes"
+ DRIVERS="$DRIVERS drv_PHAnderson.o"
+
+$as_echo "#define WITH_PHANDERSON 1" >>confdefs.h
+
+fi
+
+if test "$PICGRAPHIC" = "yes"; then
+ GRAPHIC="yes"
+ GPIO="yes"
+ SERIAL="yes"
+ DRIVERS="$DRIVERS drv_PICGraphic.o"
+
+$as_echo "#define WITH_PICGRAPHIC 1" >>confdefs.h
+
+fi
+
+if test "$PICOLCD" = "yes"; then
+ if test "$has_usb" = "true"; then
+ TEXT="yes"
+ GPIO="yes"
+ SERIAL="yes"
+ LIBUSB="yes"
+ DRIVERS="$DRIVERS drv_picoLCD.o"
+
+$as_echo "#define WITH_PICOLCD 1" >>confdefs.h
+
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: usb.h not found: picoLCD driver disabled" >&5
+$as_echo "$as_me: WARNING: usb.h not found: picoLCD driver disabled" >&2;}
+ fi
+fi
+
+if test "$PICOLCDGRAPHIC" = "yes"; then
+ if test "$has_usb" = "true"; then
+ TEXT="yes"
+ GRAPHIC="yes"
+ KEYPAD="yes"
+ GPIO="yes"
+ SERIAL="yes"
+ LIBUSB="yes"
+ DRIVERS="$DRIVERS drv_picoLCDGraphic.o"
+
+$as_echo "#define WITH_PICOLCDGRAPHIC 1" >>confdefs.h
+
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: usb.h not found: picoLCDGraphic driver disabled" >&5
+$as_echo "$as_me: WARNING: usb.h not found: picoLCDGraphic driver disabled" >&2;}
+ fi
+fi
+
+if test "$PNG" = "yes"; then
+ if test "$has_gd" = "true"; then
+ IMAGE="yes"
+
+$as_echo "#define WITH_PNG 1" >>confdefs.h
+
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: gd.h not found: PNG driver disabled" >&5
+$as_echo "$as_me: WARNING: gd.h not found: PNG driver disabled" >&2;}
+ fi
+fi
+
+if test "$PPM" = "yes"; then
+ IMAGE="yes"
+
+$as_echo "#define WITH_PPM 1" >>confdefs.h
+
+fi
+
+if test "$ROUTERBOARD" = "yes"; then
+ if test "$has_io_h" = "true"; then
+ TEXT="yes"
+ GPIO="yes"
+ DRIVERS="$DRIVERS drv_RouterBoard.o"
+
+$as_echo "#define WITH_ROUTERBOARD 1" >>confdefs.h
+
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: sys/io.h not found: RouterBoard driver disabled" >&5
+$as_echo "$as_me: WARNING: sys/io.h not found: RouterBoard driver disabled" >&2;}
+ fi
+fi
+
+if test "$SAMPLE" = "yes"; then
+ if test "$has_parport" = "true"; then
+ # select either text or graphics mode
+ TEXT="yes"
+ GRAPHIC="yes"
+ # support for GPIO's
+ GPIO="yes"
+ # select bus: serial (including USB), parallel or i2c
+ SERIAL="yes"
+ PARPORT="yes"
+ #I2C="yes"
+ DRIVERS="$DRIVERS drv_Sample.o"
+
+$as_echo "#define WITH_SAMPLE 1" >>confdefs.h
+
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: asm/io.h or {linux/parport.h and linux/ppdev.h} not found: SAMPLE driver disabled" >&5
+$as_echo "$as_me: WARNING: asm/io.h or {linux/parport.h and linux/ppdev.h} not found: SAMPLE driver disabled" >&2;}
+ fi
+fi
+
+if test "$SAMSUNGSPF" = "yes"; then
+ if test "$has_usb" = "true"; then
+ if test "$has_jpeglib" = "true"; then
+ GRAPHIC="yes"
+ DRIVERS="$DRIVERS drv_SamsungSPF.o"
+ LIBUSB="yes"
+ LIBJPEG="yes"
+
+$as_echo "#define WITH_SAMSUNGSPF 1" >>confdefs.h
+
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: jpeglib.h not found: SamsungSPF driver disabled" >&5
+$as_echo "$as_me: WARNING: jpeglib.h not found: SamsungSPF driver disabled" >&2;}
+ fi
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: usb.h not found: SamsungSPF driver disabled" >&5
+$as_echo "$as_me: WARNING: usb.h not found: SamsungSPF driver disabled" >&2;}
+ fi
+fi
+
+if test "$SERDISPLIB" = "yes"; then
+ if test "$has_serdisplib" = "true"; then
+ GRAPHIC="yes"
+ DRIVERS="$DRIVERS drv_serdisplib.o"
+ DRVLIBS="$DRVLIBS -L/usr/local/lib -lserdisp"
+
+$as_echo "#define WITH_SERDISPLIB 1" >>confdefs.h
+
+ if test "$has_usb" = "true"; then
+ LIBUSB="yes"
+ fi
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: serdisp.h not found: serdisplib driver disabled" >&5
+$as_echo "$as_me: WARNING: serdisp.h not found: serdisplib driver disabled" >&2;}
+ fi
+fi
+
+if test "$SHUTTLEVFD" = "yes"; then
+ if test "$has_usb" = "true"; then
+ TEXT="yes"
+ GPIO="yes"
+ DRIVERS="$DRIVERS drv_ShuttleVFD.o"
+ LIBUSB="yes"
+
+$as_echo "#define WITH_SHUTTLEVFD 1" >>confdefs.h
+
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: usb.h not found: ShuttleVFD driver disabled" >&5
+$as_echo "$as_me: WARNING: usb.h not found: ShuttleVFD driver disabled" >&2;}
+ fi
+fi
+
+if test "$SIMPLELCD" = "yes"; then
+ TEXT="yes"
+ SERIAL="yes"
+ DRIVERS="$DRIVERS drv_SimpleLCD.o"
+
+$as_echo "#define WITH_SIMPLELCD 1" >>confdefs.h
+
+fi
+
+if test "$ST2205" = "yes"; then
+ if test "$has_st2205" = "true"; then
+ GRAPHIC="yes"
+ DRIVERS="$DRIVERS drv_st2205.o"
+ DRVLIBS="$DRVLIBS -L/usr/local/lib -lst2205"
+
+$as_echo "#define WITH_ST2205 1" >>confdefs.h
+
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: st2205.h not found: st2205 driver disabled" >&5
+$as_echo "$as_me: WARNING: st2205.h not found: st2205 driver disabled" >&2;}
+ fi
+fi
+
+
+if test "$T6963" = "yes"; then
+ if test "$has_parport" = "true"; then
+ GRAPHIC="yes"
+ PARPORT="yes"
+ DRIVERS="$DRIVERS drv_T6963.o"
+
+$as_echo "#define WITH_T6963 1" >>confdefs.h
+
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: asm/io.h or {linux/parport.h and linux/ppdev.h} not found: T6963 driver disabled" >&5
+$as_echo "$as_me: WARNING: asm/io.h or {linux/parport.h and linux/ppdev.h} not found: T6963 driver disabled" >&2;}
+ fi
+fi
+
+if test "$TeakLCM" = "yes"; then
+ TEXT="yes"
+ SERIAL="yes"
+ DRIVERS="$DRIVERS drv_TeakLCM.o"
+
+$as_echo "#define WITH_TEAK_LCM 1" >>confdefs.h
+
+fi
+
+if test "$Trefon" = "yes"; then
+ if test "$has_usb" = "true"; then
+ TEXT="yes"
+ DRIVERS="$DRIVERS drv_Trefon.o"
+ LIBUSB="yes"
+
+$as_echo "#define WITH_TREFON 1" >>confdefs.h
+
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: usb.h not found: Trefon driver disabled" >&5
+$as_echo "$as_me: WARNING: usb.h not found: Trefon driver disabled" >&2;}
+ fi
+fi
+
+if test "$ULA200" = "yes"; then
+ if test "$has_ftdi" = "true"; then
+ TEXT="yes"
+ LIBUSB="yes"
+ LIBFTDI="yes"
+ DRIVERS="$DRIVERS drv_ula200.o"
+
+$as_echo "#define WITH_ULA200 1" >>confdefs.h
+
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: ftdi.h not found: ULA200 driver disabled" >&5
+$as_echo "$as_me: WARNING: ftdi.h not found: ULA200 driver disabled" >&2;}
+ fi
+fi
+
+if test "$USBHUB" = "yes"; then
+ if test "$has_usb" = "true"; then
+ GPIO="yes"
+ DRIVERS="$DRIVERS drv_USBHUB.o"
+ LIBUSB="yes"
+
+$as_echo "#define WITH_USBHUB 1" >>confdefs.h
+
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: usb.h not found: USB-Hub driver disabled" >&5
+$as_echo "$as_me: WARNING: usb.h not found: USB-Hub driver disabled" >&2;}
+ fi
+fi
+
+if test "$USBLCD" = "yes"; then
+ TEXT="yes"
+ SERIAL="yes"
+ DRIVERS="$DRIVERS drv_USBLCD.o"
+ if test "$has_usb" = "true"; then
+ LIBUSB="yes"
+ fi
+
+$as_echo "#define WITH_USBLCD 1" >>confdefs.h
+
+fi
+
+if test "$VNC" = "yes"; then
+ if test "$has_vncserverlib" = "true"; then
+ GRAPHIC="yes"
+ KEYPAD="yes"
+ DRIVERS="$DRIVERS drv_vnc.o"
+ DRVLIBS="$DRVLIBS -L/usr/local/lib -lvncserver -lz"
+
+$as_echo "#define WITH_VNC 1" >>confdefs.h
+
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: libvncserver not found: vnc driver disabled" >&5
+$as_echo "$as_me: WARNING: libvncserver not found: vnc driver disabled" >&2;}
+ fi
+fi
+
+if test "$WINCORNIXDORF" = "yes"; then
+ TEXT="yes"
+ SERIAL="yes"
+ DRIVERS="$DRIVERS drv_WincorNixdorf.o"
+
+$as_echo "#define WITH_WINCORNIXDORF 1" >>confdefs.h
+
+fi
+
+if test "$X11" = "yes"; then
+ if test "$no_x" = "yes"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: X11 headers or libraries not available: X11 driver disabled" >&5
+$as_echo "$as_me: WARNING: X11 headers or libraries not available: X11 driver disabled" >&2;}
+ else
+ GRAPHIC="yes"
+ KEYPAD="yes"
+ DRIVERS="$DRIVERS drv_X11.o"
+ if test "x$ac_x_libraries" = "x"; then
+ DRVLIBS="$DRVLIBS -lX11"
+ else
+ DRVLIBS="$DRVLIBS -L$ac_x_libraries -lX11"
+ fi
+ CPP_FLAGS="$CPPFLAGS $X_CFLAGS"
+
+$as_echo "#define WITH_X11 1" >>confdefs.h
+
+ fi
+fi
+
+
+# Image driver
+if test "$IMAGE" = "yes"; then
+ GRAPHIC="yes"
+ DRIVERS="$DRIVERS drv_Image.o"
+fi
+
+if test "$DRIVERS" = ""; then
+ as_fn_error $? "You should activate at least one driver..." "$LINENO" 5
+fi
+
+# generic text driver
+if test "$TEXT" = "yes"; then
+ DRIVERS="$DRIVERS drv_generic_text.o"
+fi
+
+# generic graphic driver
+if test "$GRAPHIC" = "yes"; then
+ DRIVERS="$DRIVERS drv_generic_graphic.o"
+ if test "$has_gd" = "true"; then
+ DRIVERS="$DRIVERS widget_image.o"
+ DRVLIBS="$DRVLIBS -lgd"
+
+$as_echo "#define WITH_GD 1" >>confdefs.h
+
+
+$as_echo "#define WITH_IMAGE 1" >>confdefs.h
+
+ fi
+fi
+
+# generic GPIO driver
+if test "$GPIO" = "yes"; then
+ DRIVERS="$DRIVERS drv_generic_gpio.o"
+fi
+
+# generic parport driver
+if test "$PARPORT" = "yes"; then
+ DRIVERS="$DRIVERS drv_generic_parport.o"
+
+$as_echo "#define WITH_PARPORT 1" >>confdefs.h
+
+fi
+
+# generic serial driver
+if test "$SERIAL" = "yes"; then
+ DRIVERS="$DRIVERS drv_generic_serial.o"
+
+$as_echo "#define WITH_SERIAL 1" >>confdefs.h
+
+fi
+
+# generic i2c driver
+if test "$I2C" = "yes"; then
+ DRIVERS="$DRIVERS drv_generic_i2c.o"
+
+$as_echo "#define WITH_I2C 1" >>confdefs.h
+
+fi
+
+# generic keypad driver
+if test "$KEYPAD" = "yes"; then
+ DRIVERS="$DRIVERS drv_generic_keypad.o"
+fi
+
+# libjpeg
+if test "$LIBJPEG" = "yes"; then
+ DRVLIBS="$DRVLIBS -ljpeg"
+fi
+
+# libusb
+if test "$LIBUSB" = "yes"; then
+ DRVLIBS="$DRVLIBS -lusb"
+fi
+
+# libusb-1.0
+if test "$LIBUSB10" = "yes"; then
+ DRVLIBS="$DRVLIBS -lusb-1.0"
+fi
+
+# libftdi
+if test "$LIBFTDI" = "yes"; then
+ DRVLIBS="$DRVLIBS -lftdi"
+fi
+
+if test "$DRIVERS" = ""; then
+ as_fn_error $? "You should include at least one driver..." "$LINENO" 5
+fi
+
+
+
+
+
+# plugins
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking which plugins to compile" >&5
+$as_echo_n "checking which plugins to compile... " >&6; }
+
+# Check whether --with-plugins was given.
+if test "${with_plugins+set}" = set; then :
+ withval=$with_plugins; plugins=$withval
+else
+ plugins=all
+
+fi
+
+
+plugins=`echo $plugins|sed 's/,/ /g'`
+
+for plugin in $plugins; do
+
+ case $plugin in
+ !*)
+ val="no"
+ plugin=`echo $plugin|cut -c 2-`
+ ;;
+ *)
+ val="yes"
+ ;;
+ esac
+
+ case "$plugin" in
+ list)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: available plugins:
+ apm,asterisk,button_exec,cpuinfo,dbus,diskstats,dvb,exec,event,
+ fifo,file,gps,hddtemp,huawei,i2c_sensors,iconv,imon,isdn,kvv,
+ loadavg,meminfo,mpd,mpris_dbus,mysql,netdev,netinfo,pop3,ppp,
+ proc_stat,python,qnaplog,raspi,sample,seti,statfs,uname,uptime,
+ w1retap,wireless,xmms" >&5
+$as_echo "available plugins:
+ apm,asterisk,button_exec,cpuinfo,dbus,diskstats,dvb,exec,event,
+ fifo,file,gps,hddtemp,huawei,i2c_sensors,iconv,imon,isdn,kvv,
+ loadavg,meminfo,mpd,mpris_dbus,mysql,netdev,netinfo,pop3,ppp,
+ proc_stat,python,qnaplog,raspi,sample,seti,statfs,uname,uptime,
+ w1retap,wireless,xmms" >&6; }
+ as_fn_error $? "run ./configure --with-plugins=..." "$LINENO" 5
+ ;;
+ all)
+ PLUGIN_APM="yes"
+ PLUGIN_ASTERISK="yes"
+ PLUGIN_BUTTON_EXEC="yes"
+ PLUGIN_CPUINFO="yes"
+ PLUGIN_DBUS="yes"
+ PLUGIN_DISKSTATS="yes"
+ PLUGIN_DVB="yes"
+ PLUGIN_EXEC="yes"
+ PLUGIN_EVENT="yes"
+ PLUGIN_FIFO="yes"
+ PLUGIN_FILE="yes"
+ PLUGIN_GPS="yes"
+ PLUGIN_HDDTEMP="yes"
+ PLUGIN_HUAWEI="yes"
+ PLUGIN_I2C_SENSORS="yes"
+ PLUGIN_ICONV="yes"
+ PLUGIN_IMON="yes"
+ PLUGIN_ISDN="yes"
+ PLUGIN_KVV="yes"
+ PLUGIN_LOADAVG="yes"
+ PLUGIN_MEMINFO="yes"
+ PLUGIN_MPD="yes"
+ PLUGIN_MPRIS_DBUS="yes"
+ PLUGIN_MYSQL="yes"
+ PLUGIN_NETDEV="yes"
+ PLUGIN_NETINFO="yes"
+ PLUGIN_POP3="yes"
+ PLUGIN_PPP="yes"
+ PLUGIN_PROC_STAT="yes"
+ PLUGIN_PYTHON=$with_python
+ PLUGIN_QNAPLOG="yes"
+ PLUGIN_RASPI="yes"
+ PLUGIN_SAMPLE="yes"
+ PLUGIN_SETI="yes"
+ PLUGIN_STATFS="yes"
+ PLUGIN_UNAME="yes"
+ PLUGIN_UPTIME="yes"
+ PLUGIN_W1RETAP="yes"
+ PLUGIN_WIRELESS="yes"
+ PLUGIN_XMMS="yes"
+ ;;
+ none)
+ PLUGIN_APM="no"
+ PLUGIN_ASTERISK="no"
+ PLUGIN_BUTTON_EXEC="no"
+ PLUGIN_CPUINFO="no"
+ PLUGIN_DBUS="no"
+ PLUGIN_DISKSTATS="no"
+ PLUGIN_DVB="no"
+ PLUGIN_EXEC="no"
+ PLUGIN_EVENT="no"
+ PLUGIN_FIFO="no"
+ PLUGIN_FILE="no"
+ PLUGIN_GPS="no"
+ PLUGIN_HDDTEMP="no"
+ PLUGIN_HUAWEI="no"
+ PLUGIN_I2C_SENSORS="no"
+ PLUGIN_ICONV="no"
+ PLUGIN_IMON="no"
+ PLUGIN_ISDN="no"
+ PLUGIN_KVV="no"
+ PLUGIN_LOADAVG="no"
+ PLUGIN_MEMINFO="no"
+ PLUGIN_MPD="no"
+ PLUGIN_MPRIS_DBUS="no"
+ PLUGIN_MYSQL="no"
+ PLUGIN_NETDEV="no"
+ PLUGIN_NETINFO="no"
+ PLUGIN_POP3="no"
+ PLUGIN_PPP="no"
+ PLUGIN_PROC_STAT="no"
+ PLUGIN_PYTHON="no"
+ PLUGIN_QNAPLOG="no"
+ PLUGIN_RASPI="no"
+ PLUGIN_SAMPLE="no"
+ PLUGIN_SETI="no"
+ PLUGIN_STATFS="no"
+ PLUGIN_UNAME="no"
+ PLUGIN_UPTIME="no"
+ PLUGIN_W1RETAP="no"
+ PLUGIN_WIRELESS="no"
+ PLUGIN_XMMS="no"
+ ;;
+ apm)
+ PLUGIN_APM=$val
+ ;;
+ button_exec)
+ PLUGIN_BUTTON_EXEC=$val
+ ;;
+ asterisk)
+ PLUGIN_ASTERISK=$val
+ ;;
+ cpuinfo)
+ PLUGIN_CPUINFO=$val
+ ;;
+ dbus)
+ PLUGIN_DBUS=$val
+ ;;
+ diskstats)
+ PLUGIN_DISKSTATS=$val
+ ;;
+ dvb)
+ PLUGIN_DVB=$val
+ ;;
+ exec)
+ PLUGIN_EXEC=$val
+ ;;
+ event)
+ PLUGIN_EVENT=$val
+ ;;
+ fifo)
+ PLUGIN_FIFO=$val
+ ;;
+ file)
+ PLUGIN_FILE=$val
+ ;;
+ gps)
+ PLUGIN_GPS=$val
+ ;;
+ hddtemp)
+ PLUGIN_HDDTEMP=$val
+ ;;
+ huawei)
+ PLUGIN_HUAWEI=$val
+ ;;
+ i2c_sensors)
+ PLUGIN_I2C_SENSORS=$val
+ ;;
+ iconv)
+ PLUGIN_ICONV=$val
+ ;;
+ imon)
+ PLUGIN_IMON=$val
+ ;;
+ isdn)
+ PLUGIN_ISDN=$val
+ ;;
+ kvv)
+ PLUGIN_KVV=$val
+ ;;
+ loadavg)
+ PLUGIN_LOADAVG=$val
+ ;;
+ meminfo)
+ PLUGIN_MEMINFO=$val
+ ;;
+ mpd)
+ PLUGIN_MPD=$val
+ ;;
+ mpris_dbus)
+ PLUGIN_MPRIS_DBUS=$val
+ ;;
+ mysql)
+ PLUGIN_MYSQL=$val
+ ;;
+ netdev)
+ PLUGIN_NETDEV=$val
+ ;;
+ netinfo)
+ PLUGIN_NETINFO=$val
+ ;;
+ pop3)
+ PLUGIN_POP3=$val
+ ;;
+ ppp)
+ PLUGIN_PPP=$val
+ ;;
+ proc_stat)
+ PLUGIN_PROC_STAT=$val
+ ;;
+ python)
+ PLUGIN_PYTHON=$val
+ ;;
+ qnaplog)
+ PLUGIN_QNAPLOG=$val
+ ;;
+ raspi)
+ PLUGIN_RASPI=$val
+ ;;
+ sample)
+ PLUGIN_SAMPLE=$val
+ ;;
+ seti)
+ PLUGIN_SETI=$val
+ ;;
+ statfs)
+ PLUGIN_STATFS=$val
+ ;;
+ uname)
+ PLUGIN_UNAME=$val
+ ;;
+ uptime)
+ PLUGIN_UPTIME=$val
+ ;;
+ w1retap)
+ PLUGIN_W1RETAP=$val
+ ;;
+ wireless)
+ PLUGIN_WIRELESS=$val
+ ;;
+ xmms)
+ PLUGIN_XMMS=$val
+ ;;
+ *)
+ as_fn_error $? "Unknown plugin '$plugin'" "$LINENO" 5
+ ;;
+ esac
+done
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5
+$as_echo "done" >&6; }
+
+# Advanced Power Management
+if test "$PLUGIN_APM" = "yes"; then
+ for ac_header in asm/types.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "asm/types.h" "ac_cv_header_asm_types_h" "$ac_includes_default"
+if test "x$ac_cv_header_asm_types_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_ASM_TYPES_H 1
+_ACEOF
+ has_asm_types="true"
+else
+ has_asm_types="false"
+fi
+
+done
+
+ if test "$has_asm_types" = "true"; then
+ PLUGINS="$PLUGINS plugin_apm.o"
+
+$as_echo "#define PLUGIN_APM 1" >>confdefs.h
+
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: asm/types.h header not found: apm plugin disabled" >&5
+$as_echo "$as_me: WARNING: asm/types.h header not found: apm plugin disabled" >&2;}
+ fi
+fi
+
+if test "$PLUGIN_BUTTON_EXEC" = "yes"; then
+ PLUGINS="$PLUGINS plugin_button_exec.o"
+
+$as_echo "#define PLUGIN_BUTTON_EXEC 1" >>confdefs.h
+
+fi
+
+if test "$PLUGIN_ASTERISK" = "yes"; then
+ PLUGINS="$PLUGINS plugin_asterisk.o"
+
+$as_echo "#define PLUGIN_ASTERISK 1" >>confdefs.h
+
+fi
+
+# /proc/cpuinfo
+if test "$PLUGIN_CPUINFO" = "yes"; then
+ PLUGINS="$PLUGINS plugin_cpuinfo.o"
+
+$as_echo "#define PLUGIN_CPUINFO 1" >>confdefs.h
+
+fi
+
+#DBus
+if test "$PLUGIN_DBUS" = "yes"; then
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for DBUS" >&5
+$as_echo_n "checking for DBUS... " >&6; }
+
+if test -n "$DBUS_CFLAGS"; then
+ pkg_cv_DBUS_CFLAGS="$DBUS_CFLAGS"
+ elif test -n "$PKG_CONFIG"; then
+ if test -n "$PKG_CONFIG" && \
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"dbus-1 >= 1.0.0\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "dbus-1 >= 1.0.0") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ pkg_cv_DBUS_CFLAGS=`$PKG_CONFIG --cflags "dbus-1 >= 1.0.0" 2>/dev/null`
+ test "x$?" != "x0" && pkg_failed=yes
+else
+ pkg_failed=yes
+fi
+ else
+ pkg_failed=untried
+fi
+if test -n "$DBUS_LIBS"; then
+ pkg_cv_DBUS_LIBS="$DBUS_LIBS"
+ elif test -n "$PKG_CONFIG"; then
+ if test -n "$PKG_CONFIG" && \
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"dbus-1 >= 1.0.0\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "dbus-1 >= 1.0.0") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ pkg_cv_DBUS_LIBS=`$PKG_CONFIG --libs "dbus-1 >= 1.0.0" 2>/dev/null`
+ test "x$?" != "x0" && pkg_failed=yes
+else
+ pkg_failed=yes
+fi
+ else
+ pkg_failed=untried
+fi
+
+
+
+if test $pkg_failed = yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+ _pkg_short_errors_supported=yes
+else
+ _pkg_short_errors_supported=no
+fi
+ if test $_pkg_short_errors_supported = yes; then
+ DBUS_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "dbus-1 >= 1.0.0" 2>&1`
+ else
+ DBUS_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "dbus-1 >= 1.0.0" 2>&1`
+ fi
+ # Put the nasty error message in config.log where it belongs
+ echo "$DBUS_PKG_ERRORS" >&5
+
+ HAVE_DBUS="no"
+elif test $pkg_failed = untried; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ HAVE_DBUS="no"
+else
+ DBUS_CFLAGS=$pkg_cv_DBUS_CFLAGS
+ DBUS_LIBS=$pkg_cv_DBUS_LIBS
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ HAVE_DBUS="yes"
+fi
+ if test "x$HAVE_DBUS" == "xyes"; then
+ PLUGINS="$PLUGINS plugin_dbus.o"
+ PLUGINLIBS="$PLUGINLIBS $DBUS_LIBS"
+ CPPFLAGS="$CPPFLAGS $DBUS_CFLAGS"
+
+$as_echo "#define PLUGIN_DBUS 1" >>confdefs.h
+
+
+ DBUS_VERSION=$($PKG_CONFIG --modversion dbus-1)
+ DBUS_VERSION_MAJOR=$(echo $DBUS_VERSION | cut -d . -f 1)
+ DBUS_VERSION_MINOR=$(echo $DBUS_VERSION | cut -d . -f 2)
+ DBUS_VERSION_MICRO=$(echo $DBUS_VERSION | cut -d . -f 3)
+
+
+cat >>confdefs.h <<_ACEOF
+#define DBUS_VERSION_MAJOR $DBUS_VERSION_MAJOR
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define DBUS_VERSION_MINOR $DBUS_VERSION_MINOR
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define DBUS_VERSION_MICRO $DBUS_VERSION_MICRO
+_ACEOF
+
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: dbus-1 not found check that PKG_CONFIG_PATH is set correctly: dbus plugin disabled" >&5
+$as_echo "$as_me: WARNING: dbus-1 not found check that PKG_CONFIG_PATH is set correctly: dbus plugin disabled" >&2;}
+ fi
+fi
+
+# /proc/diskstat
+if test "$PLUGIN_DISKSTATS" = "yes"; then
+ PLUGINS="$PLUGINS plugin_diskstats.o"
+
+$as_echo "#define PLUGIN_DISKSTATS 1" >>confdefs.h
+
+fi
+
+# Digital Video Broadcasting
+if test "$PLUGIN_DVB" = "yes"; then
+ for ac_header in asm/types.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "asm/types.h" "ac_cv_header_asm_types_h" "$ac_includes_default"
+if test "x$ac_cv_header_asm_types_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_ASM_TYPES_H 1
+_ACEOF
+ has_asm_types="true"
+else
+ has_asm_types="false"
+fi
+
+done
+
+ if test "$has_asm_types" = "true"; then
+ for ac_header in linux/dvb/frontend.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "linux/dvb/frontend.h" "ac_cv_header_linux_dvb_frontend_h" "$ac_includes_default"
+if test "x$ac_cv_header_linux_dvb_frontend_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LINUX_DVB_FRONTEND_H 1
+_ACEOF
+ has_dvb_header="true"
+else
+ has_dvb_header="false"
+fi
+
+done
+
+ if test "$has_dvb_header" = "true"; then
+ PLUGINS="$PLUGINS plugin_dvb.o"
+
+$as_echo "#define PLUGIN_DVB 1" >>confdefs.h
+
+ else
+ PLUGINS="$PLUGINS plugin_dvb.o"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: linux/dvb/frontend.h header not found: using ioctl" >&5
+$as_echo "$as_me: WARNING: linux/dvb/frontend.h header not found: using ioctl" >&2;}
+ fi
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: asm/types.h header not found: dvb plugin disabled" >&5
+$as_echo "$as_me: WARNING: asm/types.h header not found: dvb plugin disabled" >&2;}
+ fi
+fi
+
+# start external commands (exec)
+if test "$PLUGIN_EXEC" = "yes"; then
+ PLUGINS="$PLUGINS plugin_exec.o"
+
+$as_echo "#define PLUGIN_EXEC 1" >>confdefs.h
+
+fi
+
+# event
+if test "$PLUGIN_EVENT" = "yes"; then
+ PLUGINS="$PLUGINS plugin_event.o"
+
+$as_echo "#define PLUGIN_EVENT 1" >>confdefs.h
+
+fi
+
+# file
+if test "$PLUGIN_FILE" = "yes"; then
+ PLUGINS="$PLUGINS plugin_file.o"
+
+$as_echo "#define PLUGIN_FILE 1" >>confdefs.h
+
+fi
+
+# FIFO
+if test "$PLUGIN_FIFO" = "yes"; then
+ PLUGINS="$PLUGINS plugin_fifo.o"
+
+$as_echo "#define PLUGIN_FIFO 1" >>confdefs.h
+
+fi
+
+# GPS
+if test "$PLUGIN_GPS" = "yes"; then
+ for ac_header in nmeap.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "nmeap.h" "ac_cv_header_nmeap_h" "$ac_includes_default"
+if test "x$ac_cv_header_nmeap_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_NMEAP_H 1
+_ACEOF
+ has_nmeap_header="true"
+else
+ has_nmeap_header="false"
+fi
+
+done
+
+ if test "$has_nmeap_header" = "true"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for nmeap_init in -lnmeap" >&5
+$as_echo_n "checking for nmeap_init in -lnmeap... " >&6; }
+if ${ac_cv_lib_nmeap_nmeap_init+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lnmeap $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char nmeap_init ();
+int
+main ()
+{
+return nmeap_init ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_nmeap_nmeap_init=yes
+else
+ ac_cv_lib_nmeap_nmeap_init=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nmeap_nmeap_init" >&5
+$as_echo "$ac_cv_lib_nmeap_nmeap_init" >&6; }
+if test "x$ac_cv_lib_nmeap_nmeap_init" = xyes; then :
+ has_libnmeap_lib="true"
+else
+ has_libnmeap_lib="false"
+fi
+
+ if test "$has_libnmeap_lib" = "true"; then
+ PLUGINS="$PLUGINS plugin_gps.o"
+ PLUGINLIBS="$PLUGINLIBS -lnmeap"
+
+$as_echo "#define PLUGIN_GPS 1" >>confdefs.h
+
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: libnmeap lib not found: gps plugin disabled" >&5
+$as_echo "$as_me: WARNING: libnmeap lib not found: gps plugin disabled" >&2;}
+ fi
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: nmeap.h header not found: gps plugin disabled" >&5
+$as_echo "$as_me: WARNING: nmeap.h header not found: gps plugin disabled" >&2;}
+ fi
+fi
+
+# hddtemp
+if test "$PLUGIN_HDDTEMP" = "yes"; then
+ PLUGINS="$PLUGINS plugin_hddtemp.o"
+
+$as_echo "#define PLUGIN_HDDTEMP 1" >>confdefs.h
+
+fi
+
+# Huawei
+if test "$PLUGIN_HUAWEI" = "yes"; then
+ PLUGINS="$PLUGINS plugin_huawei.o"
+
+$as_echo "#define PLUGIN_HUAWEI 1" >>confdefs.h
+
+fi
+
+# I2C
+if test "$PLUGIN_I2C_SENSORS" = "yes"; then
+ PLUGINS="$PLUGINS plugin_i2c_sensors.o"
+
+$as_echo "#define PLUGIN_I2C_SENSORS 1" >>confdefs.h
+
+fi
+
+# IConv
+if test "$PLUGIN_ICONV" = "yes"; then
+ # Make sure we can run config.sub.
+$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
+ as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5
+$as_echo_n "checking build system type... " >&6; }
+if ${ac_cv_build+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_build_alias=$build_alias
+test "x$ac_build_alias" = x &&
+ ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
+test "x$ac_build_alias" = x &&
+ as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5
+ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
+ as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5
+$as_echo "$ac_cv_build" >&6; }
+case $ac_cv_build in
+*-*-*) ;;
+*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;;
+esac
+build=$ac_cv_build
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_build
+shift
+build_cpu=$1
+build_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+build_os=$*
+IFS=$ac_save_IFS
+case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5
+$as_echo_n "checking host system type... " >&6; }
+if ${ac_cv_host+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test "x$host_alias" = x; then
+ ac_cv_host=$ac_cv_build
+else
+ ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
+ as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5
+$as_echo "$ac_cv_host" >&6; }
+case $ac_cv_host in
+*-*-*) ;;
+*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;;
+esac
+host=$ac_cv_host
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_host
+shift
+host_cpu=$1
+host_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+host_os=$*
+IFS=$ac_save_IFS
+case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
+
+
+
+ if test "X$prefix" = "XNONE"; then
+ acl_final_prefix="$ac_default_prefix"
+ else
+ acl_final_prefix="$prefix"
+ fi
+ if test "X$exec_prefix" = "XNONE"; then
+ acl_final_exec_prefix='${prefix}'
+ else
+ acl_final_exec_prefix="$exec_prefix"
+ fi
+ acl_save_prefix="$prefix"
+ prefix="$acl_final_prefix"
+ eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
+ prefix="$acl_save_prefix"
+
+
+
+# Check whether --with-gnu-ld was given.
+if test "${with_gnu_ld+set}" = set; then :
+ withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes
+else
+ with_gnu_ld=no
+fi
+
+# Prepare PATH_SEPARATOR.
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which
+ # contains only /bin. Note that ksh looks also at the FPATH variable,
+ # so we have to set that as well for the test.
+ PATH_SEPARATOR=:
+ (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
+ && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
+ || PATH_SEPARATOR=';'
+ }
+fi
+
+ac_prog=ld
+if test "$GCC" = yes; then
+ # Check if gcc -print-prog-name=ld gives a path.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5
+$as_echo_n "checking for ld used by $CC... " >&6; }
+ case $host in
+ *-*-mingw*)
+ # gcc leaves a trailing carriage return which upsets mingw
+ ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+ *)
+ ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+ esac
+ case $ac_prog in
+ # Accept absolute paths.
+ [\\/]* | ?:[\\/]*)
+ re_direlt='/[^/][^/]*/\.\./'
+ # Canonicalize the pathname of ld
+ ac_prog=`echo "$ac_prog"| sed 's%\\\\%/%g'`
+ while echo "$ac_prog" | grep "$re_direlt" > /dev/null 2>&1; do
+ ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
+ done
+ test -z "$LD" && LD="$ac_prog"
+ ;;
+ "")
+ # If it fails, then pretend we aren't using GCC.
+ ac_prog=ld
+ ;;
+ *)
+ # If it is relative, then search for the first ld in PATH.
+ with_gnu_ld=unknown
+ ;;
+ esac
+elif test "$with_gnu_ld" = yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5
+$as_echo_n "checking for GNU ld... " >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5
+$as_echo_n "checking for non-GNU ld... " >&6; }
+fi
+if ${acl_cv_path_LD+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -z "$LD"; then
+ acl_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for ac_dir in $PATH; do
+ IFS="$acl_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+ acl_cv_path_LD="$ac_dir/$ac_prog"
+ # Check to see if the program is GNU ld. I'd rather use --version,
+ # but apparently some variants of GNU ld only accept -v.
+ # Break only if it was the GNU/non-GNU ld that we prefer.
+ case `"$acl_cv_path_LD" -v 2>&1 </dev/null` in
+ *GNU* | *'with BFD'*)
+ test "$with_gnu_ld" != no && break
+ ;;
+ *)
+ test "$with_gnu_ld" != yes && break
+ ;;
+ esac
+ fi
+ done
+ IFS="$acl_save_ifs"
+else
+ acl_cv_path_LD="$LD" # Let the user override the test with a path.
+fi
+fi
+
+LD="$acl_cv_path_LD"
+if test -n "$LD"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5
+$as_echo "$LD" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5
+$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; }
+if ${acl_cv_prog_gnu_ld+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ # I'd rather use --version here, but apparently some GNU lds only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+ acl_cv_prog_gnu_ld=yes
+ ;;
+*)
+ acl_cv_prog_gnu_ld=no
+ ;;
+esac
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acl_cv_prog_gnu_ld" >&5
+$as_echo "$acl_cv_prog_gnu_ld" >&6; }
+with_gnu_ld=$acl_cv_prog_gnu_ld
+
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shared library run path origin" >&5
+$as_echo_n "checking for shared library run path origin... " >&6; }
+if ${acl_cv_rpath+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
+ CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
+ ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
+ . ./conftest.sh
+ rm -f ./conftest.sh
+ acl_cv_rpath=done
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acl_cv_rpath" >&5
+$as_echo "$acl_cv_rpath" >&6; }
+ wl="$acl_cv_wl"
+ acl_libext="$acl_cv_libext"
+ acl_shlibext="$acl_cv_shlibext"
+ acl_libname_spec="$acl_cv_libname_spec"
+ acl_library_names_spec="$acl_cv_library_names_spec"
+ acl_hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
+ acl_hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
+ acl_hardcode_direct="$acl_cv_hardcode_direct"
+ acl_hardcode_minus_L="$acl_cv_hardcode_minus_L"
+ # Check whether --enable-rpath was given.
+if test "${enable_rpath+set}" = set; then :
+ enableval=$enable_rpath; :
+else
+ enable_rpath=yes
+fi
+
+
+
+
+ acl_libdirstem=lib
+ acl_libdirstem2=
+ case "$host_os" in
+ solaris*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for 64-bit host" >&5
+$as_echo_n "checking for 64-bit host... " >&6; }
+if ${gl_cv_solaris_64bit+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+#ifdef _LP64
+sixtyfour bits
+#endif
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "sixtyfour bits" >/dev/null 2>&1; then :
+ gl_cv_solaris_64bit=yes
+else
+ gl_cv_solaris_64bit=no
+fi
+rm -f conftest*
+
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_solaris_64bit" >&5
+$as_echo "$gl_cv_solaris_64bit" >&6; }
+ if test $gl_cv_solaris_64bit = yes; then
+ acl_libdirstem=lib/64
+ case "$host_cpu" in
+ sparc*) acl_libdirstem2=lib/sparcv9 ;;
+ i*86 | x86_64) acl_libdirstem2=lib/amd64 ;;
+ esac
+ fi
+ ;;
+ *)
+ searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'`
+ if test -n "$searchpath"; then
+ acl_save_IFS="${IFS= }"; IFS=":"
+ for searchdir in $searchpath; do
+ if test -d "$searchdir"; then
+ case "$searchdir" in
+ */lib64/ | */lib64 ) acl_libdirstem=lib64 ;;
+ */../ | */.. )
+ # Better ignore directories of this form. They are misleading.
+ ;;
+ *) searchdir=`cd "$searchdir" && pwd`
+ case "$searchdir" in
+ */lib64 ) acl_libdirstem=lib64 ;;
+ esac ;;
+ esac
+ fi
+ done
+ IFS="$acl_save_IFS"
+ fi
+ ;;
+ esac
+ test -n "$acl_libdirstem2" || acl_libdirstem2="$acl_libdirstem"
+
+
+
+
+
+
+
+
+
+
+
+
+ use_additional=yes
+
+ acl_save_prefix="$prefix"
+ prefix="$acl_final_prefix"
+ acl_save_exec_prefix="$exec_prefix"
+ exec_prefix="$acl_final_exec_prefix"
+
+ eval additional_includedir=\"$includedir\"
+ eval additional_libdir=\"$libdir\"
+
+ exec_prefix="$acl_save_exec_prefix"
+ prefix="$acl_save_prefix"
+
+
+# Check whether --with-libiconv-prefix was given.
+if test "${with_libiconv_prefix+set}" = set; then :
+ withval=$with_libiconv_prefix;
+ if test "X$withval" = "Xno"; then
+ use_additional=no
+ else
+ if test "X$withval" = "X"; then
+
+ acl_save_prefix="$prefix"
+ prefix="$acl_final_prefix"
+ acl_save_exec_prefix="$exec_prefix"
+ exec_prefix="$acl_final_exec_prefix"
+
+ eval additional_includedir=\"$includedir\"
+ eval additional_libdir=\"$libdir\"
+
+ exec_prefix="$acl_save_exec_prefix"
+ prefix="$acl_save_prefix"
+
+ else
+ additional_includedir="$withval/include"
+ additional_libdir="$withval/$acl_libdirstem"
+ if test "$acl_libdirstem2" != "$acl_libdirstem" \
+ && ! test -d "$withval/$acl_libdirstem"; then
+ additional_libdir="$withval/$acl_libdirstem2"
+ fi
+ fi
+ fi
+
+fi
+
+ LIBICONV=
+ LTLIBICONV=
+ INCICONV=
+ LIBICONV_PREFIX=
+ HAVE_LIBICONV=
+ rpathdirs=
+ ltrpathdirs=
+ names_already_handled=
+ names_next_round='iconv '
+ while test -n "$names_next_round"; do
+ names_this_round="$names_next_round"
+ names_next_round=
+ for name in $names_this_round; do
+ already_handled=
+ for n in $names_already_handled; do
+ if test "$n" = "$name"; then
+ already_handled=yes
+ break
+ fi
+ done
+ if test -z "$already_handled"; then
+ names_already_handled="$names_already_handled $name"
+ uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./+-|ABCDEFGHIJKLMNOPQRSTUVWXYZ____|'`
+ eval value=\"\$HAVE_LIB$uppername\"
+ if test -n "$value"; then
+ if test "$value" = yes; then
+ eval value=\"\$LIB$uppername\"
+ test -z "$value" || LIBICONV="${LIBICONV}${LIBICONV:+ }$value"
+ eval value=\"\$LTLIB$uppername\"
+ test -z "$value" || LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }$value"
+ else
+ :
+ fi
+ else
+ found_dir=
+ found_la=
+ found_so=
+ found_a=
+ eval libname=\"$acl_libname_spec\" # typically: libname=lib$name
+ if test -n "$acl_shlibext"; then
+ shrext=".$acl_shlibext" # typically: shrext=.so
+ else
+ shrext=
+ fi
+ if test $use_additional = yes; then
+ dir="$additional_libdir"
+ if test -n "$acl_shlibext"; then
+ if test -f "$dir/$libname$shrext"; then
+ found_dir="$dir"
+ found_so="$dir/$libname$shrext"
+ else
+ if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
+ ver=`(cd "$dir" && \
+ for f in "$libname$shrext".*; do echo "$f"; done \
+ | sed -e "s,^$libname$shrext\\\\.,," \
+ | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
+ | sed 1q ) 2>/dev/null`
+ if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then
+ found_dir="$dir"
+ found_so="$dir/$libname$shrext.$ver"
+ fi
+ else
+ eval library_names=\"$acl_library_names_spec\"
+ for f in $library_names; do
+ if test -f "$dir/$f"; then
+ found_dir="$dir"
+ found_so="$dir/$f"
+ break
+ fi
+ done
+ fi
+ fi
+ fi
+ if test "X$found_dir" = "X"; then
+ if test -f "$dir/$libname.$acl_libext"; then
+ found_dir="$dir"
+ found_a="$dir/$libname.$acl_libext"
+ fi
+ fi
+ if test "X$found_dir" != "X"; then
+ if test -f "$dir/$libname.la"; then
+ found_la="$dir/$libname.la"
+ fi
+ fi
+ fi
+ if test "X$found_dir" = "X"; then
+ for x in $LDFLAGS $LTLIBICONV; do
+
+ acl_save_prefix="$prefix"
+ prefix="$acl_final_prefix"
+ acl_save_exec_prefix="$exec_prefix"
+ exec_prefix="$acl_final_exec_prefix"
+ eval x=\"$x\"
+ exec_prefix="$acl_save_exec_prefix"
+ prefix="$acl_save_prefix"
+
+ case "$x" in
+ -L*)
+ dir=`echo "X$x" | sed -e 's/^X-L//'`
+ if test -n "$acl_shlibext"; then
+ if test -f "$dir/$libname$shrext"; then
+ found_dir="$dir"
+ found_so="$dir/$libname$shrext"
+ else
+ if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
+ ver=`(cd "$dir" && \
+ for f in "$libname$shrext".*; do echo "$f"; done \
+ | sed -e "s,^$libname$shrext\\\\.,," \
+ | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
+ | sed 1q ) 2>/dev/null`
+ if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then
+ found_dir="$dir"
+ found_so="$dir/$libname$shrext.$ver"
+ fi
+ else
+ eval library_names=\"$acl_library_names_spec\"
+ for f in $library_names; do
+ if test -f "$dir/$f"; then
+ found_dir="$dir"
+ found_so="$dir/$f"
+ break
+ fi
+ done
+ fi
+ fi
+ fi
+ if test "X$found_dir" = "X"; then
+ if test -f "$dir/$libname.$acl_libext"; then
+ found_dir="$dir"
+ found_a="$dir/$libname.$acl_libext"
+ fi
+ fi
+ if test "X$found_dir" != "X"; then
+ if test -f "$dir/$libname.la"; then
+ found_la="$dir/$libname.la"
+ fi
+ fi
+ ;;
+ esac
+ if test "X$found_dir" != "X"; then
+ break
+ fi
+ done
+ fi
+ if test "X$found_dir" != "X"; then
+ LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-L$found_dir -l$name"
+ if test "X$found_so" != "X"; then
+ if test "$enable_rpath" = no \
+ || test "X$found_dir" = "X/usr/$acl_libdirstem" \
+ || test "X$found_dir" = "X/usr/$acl_libdirstem2"; then
+ LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so"
+ else
+ haveit=
+ for x in $ltrpathdirs; do
+ if test "X$x" = "X$found_dir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ ltrpathdirs="$ltrpathdirs $found_dir"
+ fi
+ if test "$acl_hardcode_direct" = yes; then
+ LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so"
+ else
+ if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then
+ LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so"
+ haveit=
+ for x in $rpathdirs; do
+ if test "X$x" = "X$found_dir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ rpathdirs="$rpathdirs $found_dir"
+ fi
+ else
+ haveit=
+ for x in $LDFLAGS $LIBICONV; do
+
+ acl_save_prefix="$prefix"
+ prefix="$acl_final_prefix"
+ acl_save_exec_prefix="$exec_prefix"
+ exec_prefix="$acl_final_exec_prefix"
+ eval x=\"$x\"
+ exec_prefix="$acl_save_exec_prefix"
+ prefix="$acl_save_prefix"
+
+ if test "X$x" = "X-L$found_dir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ LIBICONV="${LIBICONV}${LIBICONV:+ }-L$found_dir"
+ fi
+ if test "$acl_hardcode_minus_L" != no; then
+ LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so"
+ else
+ LIBICONV="${LIBICONV}${LIBICONV:+ }-l$name"
+ fi
+ fi
+ fi
+ fi
+ else
+ if test "X$found_a" != "X"; then
+ LIBICONV="${LIBICONV}${LIBICONV:+ }$found_a"
+ else
+ LIBICONV="${LIBICONV}${LIBICONV:+ }-L$found_dir -l$name"
+ fi
+ fi
+ additional_includedir=
+ case "$found_dir" in
+ */$acl_libdirstem | */$acl_libdirstem/)
+ basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'`
+ if test "$name" = 'iconv'; then
+ LIBICONV_PREFIX="$basedir"
+ fi
+ additional_includedir="$basedir/include"
+ ;;
+ */$acl_libdirstem2 | */$acl_libdirstem2/)
+ basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'`
+ if test "$name" = 'iconv'; then
+ LIBICONV_PREFIX="$basedir"
+ fi
+ additional_includedir="$basedir/include"
+ ;;
+ esac
+ if test "X$additional_includedir" != "X"; then
+ if test "X$additional_includedir" != "X/usr/include"; then
+ haveit=
+ if test "X$additional_includedir" = "X/usr/local/include"; then
+ if test -n "$GCC"; then
+ case $host_os in
+ linux* | gnu* | k*bsd*-gnu) haveit=yes;;
+ esac
+ fi
+ fi
+ if test -z "$haveit"; then
+ for x in $CPPFLAGS $INCICONV; do
+
+ acl_save_prefix="$prefix"
+ prefix="$acl_final_prefix"
+ acl_save_exec_prefix="$exec_prefix"
+ exec_prefix="$acl_final_exec_prefix"
+ eval x=\"$x\"
+ exec_prefix="$acl_save_exec_prefix"
+ prefix="$acl_save_prefix"
+
+ if test "X$x" = "X-I$additional_includedir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ if test -d "$additional_includedir"; then
+ INCICONV="${INCICONV}${INCICONV:+ }-I$additional_includedir"
+ fi
+ fi
+ fi
+ fi
+ fi
+ if test -n "$found_la"; then
+ save_libdir="$libdir"
+ case "$found_la" in
+ */* | *\\*) . "$found_la" ;;
+ *) . "./$found_la" ;;
+ esac
+ libdir="$save_libdir"
+ for dep in $dependency_libs; do
+ case "$dep" in
+ -L*)
+ additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
+ if test "X$additional_libdir" != "X/usr/$acl_libdirstem" \
+ && test "X$additional_libdir" != "X/usr/$acl_libdirstem2"; then
+ haveit=
+ if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem" \
+ || test "X$additional_libdir" = "X/usr/local/$acl_libdirstem2"; then
+ if test -n "$GCC"; then
+ case $host_os in
+ linux* | gnu* | k*bsd*-gnu) haveit=yes;;
+ esac
+ fi
+ fi
+ if test -z "$haveit"; then
+ haveit=
+ for x in $LDFLAGS $LIBICONV; do
+
+ acl_save_prefix="$prefix"
+ prefix="$acl_final_prefix"
+ acl_save_exec_prefix="$exec_prefix"
+ exec_prefix="$acl_final_exec_prefix"
+ eval x=\"$x\"
+ exec_prefix="$acl_save_exec_prefix"
+ prefix="$acl_save_prefix"
+
+ if test "X$x" = "X-L$additional_libdir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ if test -d "$additional_libdir"; then
+ LIBICONV="${LIBICONV}${LIBICONV:+ }-L$additional_libdir"
+ fi
+ fi
+ haveit=
+ for x in $LDFLAGS $LTLIBICONV; do
+
+ acl_save_prefix="$prefix"
+ prefix="$acl_final_prefix"
+ acl_save_exec_prefix="$exec_prefix"
+ exec_prefix="$acl_final_exec_prefix"
+ eval x=\"$x\"
+ exec_prefix="$acl_save_exec_prefix"
+ prefix="$acl_save_prefix"
+
+ if test "X$x" = "X-L$additional_libdir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ if test -d "$additional_libdir"; then
+ LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-L$additional_libdir"
+ fi
+ fi
+ fi
+ fi
+ ;;
+ -R*)
+ dir=`echo "X$dep" | sed -e 's/^X-R//'`
+ if test "$enable_rpath" != no; then
+ haveit=
+ for x in $rpathdirs; do
+ if test "X$x" = "X$dir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ rpathdirs="$rpathdirs $dir"
+ fi
+ haveit=
+ for x in $ltrpathdirs; do
+ if test "X$x" = "X$dir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ ltrpathdirs="$ltrpathdirs $dir"
+ fi
+ fi
+ ;;
+ -l*)
+ names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
+ ;;
+ *.la)
+ names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
+ ;;
+ *)
+ LIBICONV="${LIBICONV}${LIBICONV:+ }$dep"
+ LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }$dep"
+ ;;
+ esac
+ done
+ fi
+ else
+ LIBICONV="${LIBICONV}${LIBICONV:+ }-l$name"
+ LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-l$name"
+ fi
+ fi
+ fi
+ done
+ done
+ if test "X$rpathdirs" != "X"; then
+ if test -n "$acl_hardcode_libdir_separator"; then
+ alldirs=
+ for found_dir in $rpathdirs; do
+ alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir"
+ done
+ acl_save_libdir="$libdir"
+ libdir="$alldirs"
+ eval flag=\"$acl_hardcode_libdir_flag_spec\"
+ libdir="$acl_save_libdir"
+ LIBICONV="${LIBICONV}${LIBICONV:+ }$flag"
+ else
+ for found_dir in $rpathdirs; do
+ acl_save_libdir="$libdir"
+ libdir="$found_dir"
+ eval flag=\"$acl_hardcode_libdir_flag_spec\"
+ libdir="$acl_save_libdir"
+ LIBICONV="${LIBICONV}${LIBICONV:+ }$flag"
+ done
+ fi
+ fi
+ if test "X$ltrpathdirs" != "X"; then
+ for found_dir in $ltrpathdirs; do
+ LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-R$found_dir"
+ done
+ fi
+
+
+
+
+
+
+
+
+
+
+
+
+ am_save_CPPFLAGS="$CPPFLAGS"
+
+ for element in $INCICONV; do
+ haveit=
+ for x in $CPPFLAGS; do
+
+ acl_save_prefix="$prefix"
+ prefix="$acl_final_prefix"
+ acl_save_exec_prefix="$exec_prefix"
+ exec_prefix="$acl_final_exec_prefix"
+ eval x=\"$x\"
+ exec_prefix="$acl_save_exec_prefix"
+ prefix="$acl_save_prefix"
+
+ if test "X$x" = "X$element"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element"
+ fi
+ done
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for iconv" >&5
+$as_echo_n "checking for iconv... " >&6; }
+if ${am_cv_func_iconv+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
+ am_cv_func_iconv="no, consider installing GNU libiconv"
+ am_cv_lib_iconv=no
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+#include <stdlib.h>
+#include <iconv.h>
+
+int
+main ()
+{
+iconv_t cd = iconv_open("","");
+ iconv(cd,NULL,NULL,NULL,NULL);
+ iconv_close(cd);
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ am_cv_func_iconv=yes
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ if test "$am_cv_func_iconv" != yes; then
+ am_save_LIBS="$LIBS"
+ LIBS="$LIBS $LIBICONV"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+#include <stdlib.h>
+#include <iconv.h>
+
+int
+main ()
+{
+iconv_t cd = iconv_open("","");
+ iconv(cd,NULL,NULL,NULL,NULL);
+ iconv_close(cd);
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ am_cv_lib_iconv=yes
+ am_cv_func_iconv=yes
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ LIBS="$am_save_LIBS"
+ fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_func_iconv" >&5
+$as_echo "$am_cv_func_iconv" >&6; }
+ if test "$am_cv_func_iconv" = yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working iconv" >&5
+$as_echo_n "checking for working iconv... " >&6; }
+if ${am_cv_func_iconv_works+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
+ am_save_LIBS="$LIBS"
+ if test $am_cv_lib_iconv = yes; then
+ LIBS="$LIBS $LIBICONV"
+ fi
+ if test "$cross_compiling" = yes; then :
+
+ case "$host_os" in
+ aix* | hpux*) am_cv_func_iconv_works="guessing no" ;;
+ *) am_cv_func_iconv_works="guessing yes" ;;
+ esac
+
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+#include <iconv.h>
+#include <string.h>
+int main ()
+{
+ int result = 0;
+ /* Test against AIX 5.1 bug: Failures are not distinguishable from successful
+ returns. */
+ {
+ iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8");
+ if (cd_utf8_to_88591 != (iconv_t)(-1))
+ {
+ static const char input[] = "\342\202\254"; /* EURO SIGN */
+ char buf[10];
+ const char *inptr = input;
+ size_t inbytesleft = strlen (input);
+ char *outptr = buf;
+ size_t outbytesleft = sizeof (buf);
+ size_t res = iconv (cd_utf8_to_88591,
+ (char **) &inptr, &inbytesleft,
+ &outptr, &outbytesleft);
+ if (res == 0)
+ result |= 1;
+ iconv_close (cd_utf8_to_88591);
+ }
+ }
+ /* Test against Solaris 10 bug: Failures are not distinguishable from
+ successful returns. */
+ {
+ iconv_t cd_ascii_to_88591 = iconv_open ("ISO8859-1", "646");
+ if (cd_ascii_to_88591 != (iconv_t)(-1))
+ {
+ static const char input[] = "\263";
+ char buf[10];
+ const char *inptr = input;
+ size_t inbytesleft = strlen (input);
+ char *outptr = buf;
+ size_t outbytesleft = sizeof (buf);
+ size_t res = iconv (cd_ascii_to_88591,
+ (char **) &inptr, &inbytesleft,
+ &outptr, &outbytesleft);
+ if (res == 0)
+ result |= 2;
+ iconv_close (cd_ascii_to_88591);
+ }
+ }
+ /* Test against AIX 6.1..7.1 bug: Buffer overrun. */
+ {
+ iconv_t cd_88591_to_utf8 = iconv_open ("UTF-8", "ISO-8859-1");
+ if (cd_88591_to_utf8 != (iconv_t)(-1))
+ {
+ static const char input[] = "\304";
+ static char buf[2] = { (char)0xDE, (char)0xAD };
+ const char *inptr = input;
+ size_t inbytesleft = 1;
+ char *outptr = buf;
+ size_t outbytesleft = 1;
+ size_t res = iconv (cd_88591_to_utf8,
+ (char **) &inptr, &inbytesleft,
+ &outptr, &outbytesleft);
+ if (res != (size_t)(-1) || outptr - buf > 1 || buf[1] != (char)0xAD)
+ result |= 4;
+ iconv_close (cd_88591_to_utf8);
+ }
+ }
+#if 0 /* This bug could be worked around by the caller. */
+ /* Test against HP-UX 11.11 bug: Positive return value instead of 0. */
+ {
+ iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591");
+ if (cd_88591_to_utf8 != (iconv_t)(-1))
+ {
+ static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
+ char buf[50];
+ const char *inptr = input;
+ size_t inbytesleft = strlen (input);
+ char *outptr = buf;
+ size_t outbytesleft = sizeof (buf);
+ size_t res = iconv (cd_88591_to_utf8,
+ (char **) &inptr, &inbytesleft,
+ &outptr, &outbytesleft);
+ if ((int)res > 0)
+ result |= 8;
+ iconv_close (cd_88591_to_utf8);
+ }
+ }
+#endif
+ /* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is
+ provided. */
+ if (/* Try standardized names. */
+ iconv_open ("UTF-8", "EUC-JP") == (iconv_t)(-1)
+ /* Try IRIX, OSF/1 names. */
+ && iconv_open ("UTF-8", "eucJP") == (iconv_t)(-1)
+ /* Try AIX names. */
+ && iconv_open ("UTF-8", "IBM-eucJP") == (iconv_t)(-1)
+ /* Try HP-UX names. */
+ && iconv_open ("utf8", "eucJP") == (iconv_t)(-1))
+ result |= 16;
+ return result;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ am_cv_func_iconv_works=yes
+else
+ am_cv_func_iconv_works=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+ LIBS="$am_save_LIBS"
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_func_iconv_works" >&5
+$as_echo "$am_cv_func_iconv_works" >&6; }
+ case "$am_cv_func_iconv_works" in
+ *no) am_func_iconv=no am_cv_lib_iconv=no ;;
+ *) am_func_iconv=yes ;;
+ esac
+ else
+ am_func_iconv=no am_cv_lib_iconv=no
+ fi
+ if test "$am_func_iconv" = yes; then
+
+$as_echo "#define HAVE_ICONV 1" >>confdefs.h
+
+ fi
+ if test "$am_cv_lib_iconv" = yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link with libiconv" >&5
+$as_echo_n "checking how to link with libiconv... " >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBICONV" >&5
+$as_echo "$LIBICONV" >&6; }
+ else
+ CPPFLAGS="$am_save_CPPFLAGS"
+ LIBICONV=
+ LTLIBICONV=
+ fi
+
+
+
+ if test "$am_cv_func_iconv" = yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for iconv declaration" >&5
+$as_echo_n "checking for iconv declaration... " >&6; }
+ if ${am_cv_proto_iconv+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+#include <stdlib.h>
+#include <iconv.h>
+extern
+#ifdef __cplusplus
+"C"
+#endif
+#if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus)
+size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
+#else
+size_t iconv();
+#endif
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ am_cv_proto_iconv_arg1=""
+else
+ am_cv_proto_iconv_arg1="const"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"
+fi
+
+ am_cv_proto_iconv=`echo "$am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result:
+ $am_cv_proto_iconv" >&5
+$as_echo "
+ $am_cv_proto_iconv" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define ICONV_CONST $am_cv_proto_iconv_arg1
+_ACEOF
+
+
+ fi
+
+ if test "$am_cv_func_iconv" = "yes"; then
+ PLUGINS="$PLUGINS plugin_iconv.o"
+ PLUGINLIBS="$PLUGINLIBS $LIBICONV"
+
+$as_echo "#define PLUGIN_ICONV 1" >>confdefs.h
+
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: iconv not found: iconv plugin disabled" >&5
+$as_echo "$as_me: WARNING: iconv not found: iconv plugin disabled" >&2;}
+ fi
+fi
+
+# ISDN monitor
+if test "$PLUGIN_IMON" = "yes"; then
+ for ac_header in linux/errno.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "linux/errno.h" "ac_cv_header_linux_errno_h" "$ac_includes_default"
+if test "x$ac_cv_header_linux_errno_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LINUX_ERRNO_H 1
+_ACEOF
+ has_linux_errno="true"
+else
+ has_linux_errno="false"
+fi
+
+done
+
+ if test "$has_linux_errno" = "true"; then
+ PLUGINS="$PLUGINS plugin_imon.o"
+
+$as_echo "#define PLUGIN_IMON 1" >>confdefs.h
+
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: linux/errno.h header not found: imon plugin disabled" >&5
+$as_echo "$as_me: WARNING: linux/errno.h header not found: imon plugin disabled" >&2;}
+ fi
+fi
+
+# ISDN
+if test "$PLUGIN_ISDN" = "yes"; then
+ for ac_header in linux/isdn.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "linux/isdn.h" "ac_cv_header_linux_isdn_h" "$ac_includes_default"
+if test "x$ac_cv_header_linux_isdn_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LINUX_ISDN_H 1
+_ACEOF
+ has_isdn_header="true"
+else
+ has_isdn_header="false"
+fi
+
+done
+
+ if test "$has_dvb_header" = "false"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: linux/isdn.h header not found: isdn plugin CPS disabled" >&5
+$as_echo "$as_me: WARNING: linux/isdn.h header not found: isdn plugin CPS disabled" >&2;}
+ fi
+ PLUGINS="$PLUGINS plugin_isdn.o"
+
+$as_echo "#define PLUGIN_ISDN 1" >>confdefs.h
+
+fi
+
+# Karlsruher Verkehrsverbund
+if test "$PLUGIN_KVV" = "yes"; then
+ PLUGINS="$PLUGINS plugin_kvv.o"
+
+$as_echo "#define PLUGIN_KVV 1" >>confdefs.h
+
+fi
+
+# load average
+if test "$PLUGIN_LOADAVG" = "yes"; then
+ PLUGINS="$PLUGINS plugin_loadavg.o"
+
+$as_echo "#define PLUGIN_LOADAVG 1" >>confdefs.h
+
+fi
+
+# meminfo
+if test "$PLUGIN_MEMINFO" = "yes"; then
+ PLUGINS="$PLUGINS plugin_meminfo.o"
+
+$as_echo "#define PLUGIN_MEMINFO 1" >>confdefs.h
+
+fi
+
+# MPD
+if test "$PLUGIN_MPD" = "yes"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for mpd_connection_new in -lmpdclient" >&5
+$as_echo_n "checking for mpd_connection_new in -lmpdclient... " >&6; }
+if ${ac_cv_lib_mpdclient_mpd_connection_new+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lmpdclient $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char mpd_connection_new ();
+int
+main ()
+{
+return mpd_connection_new ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_mpdclient_mpd_connection_new=yes
+else
+ ac_cv_lib_mpdclient_mpd_connection_new=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mpdclient_mpd_connection_new" >&5
+$as_echo "$ac_cv_lib_mpdclient_mpd_connection_new" >&6; }
+if test "x$ac_cv_lib_mpdclient_mpd_connection_new" = xyes; then :
+ has_mpd_header="true"
+else
+ has_mpd_header="false"
+fi
+
+ if test "$has_mpd_header" = "true"; then
+ PLUGINS="$PLUGINS plugin_mpd.o"
+ PLUGINLIBS="$PLUGINLIBS `pkg-config libmpdclient --libs`"
+ CPPFLAGS="$CPPFLAGS `pkg-config libmpdclient --cflags`"
+
+$as_echo "#define PLUGIN_MPD 1" >>confdefs.h
+
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: libmpdclient.h header not found: mpd plugin disabled" >&5
+$as_echo "$as_me: WARNING: libmpdclient.h header not found: mpd plugin disabled" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: get libmpdclient.h from http://www.musicpd.org/libmpdclient.shtml" >&5
+$as_echo "$as_me: WARNING: get libmpdclient.h from http://www.musicpd.org/libmpdclient.shtml" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: and copy those 2 files in the lcd4linux directory." >&5
+$as_echo "$as_me: WARNING: and copy those 2 files in the lcd4linux directory." >&2;}
+ fi
+fi
+
+# MPRIS D-Bus
+if test "$PLUGIN_MPRIS_DBUS" = "yes"; then
+ for ac_header in dbus/dbus.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "dbus/dbus.h" "ac_cv_header_dbus_dbus_h" "$ac_includes_default"
+if test "x$ac_cv_header_dbus_dbus_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_DBUS_DBUS_H 1
+_ACEOF
+ has_dbus_header="true"
+else
+ has_dbus_header="false"
+fi
+
+done
+
+ if test "$has_dbus_header" = "true"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dbus_bus_get in -ldbus-1" >&5
+$as_echo_n "checking for dbus_bus_get in -ldbus-1... " >&6; }
+if ${ac_cv_lib_dbus_1_dbus_bus_get+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldbus-1 $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dbus_bus_get ();
+int
+main ()
+{
+return dbus_bus_get ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_dbus_1_dbus_bus_get=yes
+else
+ ac_cv_lib_dbus_1_dbus_bus_get=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dbus_1_dbus_bus_get" >&5
+$as_echo "$ac_cv_lib_dbus_1_dbus_bus_get" >&6; }
+if test "x$ac_cv_lib_dbus_1_dbus_bus_get" = xyes; then :
+ has_libdbus1_lib="true"
+else
+ has_libdbus1_lib="false"
+fi
+
+ if test "$has_libdbus1_lib" = "true"; then
+ PLUGINS="$PLUGINS plugin_mpris_dbus.o"
+ PLUGINLIBS="$PLUGINLIBS -ldbus-1"
+
+$as_echo "#define PLUGIN_MPRIS_DBUS 1" >>confdefs.h
+
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: libdbus-1 lib not found: mpris_dbus plugin disabled" >&5
+$as_echo "$as_me: WARNING: libdbus-1 lib not found: mpris_dbus plugin disabled" >&2;}
+ fi
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: dbus/dbus.h header not found: mpris_dbus plugin disabled" >&5
+$as_echo "$as_me: WARNING: dbus/dbus.h header not found: mpris_dbus plugin disabled" >&2;}
+ fi
+fi
+
+
+# MySQL
+if test "$PLUGIN_MYSQL" = "yes"; then
+ for ac_header in mysql/mysql.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "mysql/mysql.h" "ac_cv_header_mysql_mysql_h" "$ac_includes_default"
+if test "x$ac_cv_header_mysql_mysql_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_MYSQL_MYSQL_H 1
+_ACEOF
+ has_mysql_header="true"
+else
+ has_mysql_header="false"
+fi
+
+done
+
+ if test "$has_mysql_header" = "true"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for mysql_init in -lmysqlclient" >&5
+$as_echo_n "checking for mysql_init in -lmysqlclient... " >&6; }
+if ${ac_cv_lib_mysqlclient_mysql_init+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lmysqlclient $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char mysql_init ();
+int
+main ()
+{
+return mysql_init ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_mysqlclient_mysql_init=yes
+else
+ ac_cv_lib_mysqlclient_mysql_init=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mysqlclient_mysql_init" >&5
+$as_echo "$ac_cv_lib_mysqlclient_mysql_init" >&6; }
+if test "x$ac_cv_lib_mysqlclient_mysql_init" = xyes; then :
+ has_mysql_lib="true"
+else
+ has_mysql_lib="false"
+fi
+
+ if test "$has_mysql_lib" = "true"; then
+ PLUGINS="$PLUGINS plugin_mysql.o"
+ PLUGINLIBS="$PLUGINLIBS -lmysqlclient"
+
+$as_echo "#define PLUGIN_MYSQL 1" >>confdefs.h
+
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: mysqlclient lib not found: mysql plugin disabled" >&5
+$as_echo "$as_me: WARNING: mysqlclient lib not found: mysql plugin disabled" >&2;}
+ fi
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: mysql/mysql.h header not found: mysql plugin disabled" >&5
+$as_echo "$as_me: WARNING: mysql/mysql.h header not found: mysql plugin disabled" >&2;}
+ fi
+fi
+
+# /proc/net/dev
+if test "$PLUGIN_NETDEV" = "yes"; then
+ PLUGINS="$PLUGINS plugin_netdev.o"
+
+$as_echo "#define PLUGIN_NETDEV 1" >>confdefs.h
+
+fi
+
+# configuration of network devices
+if test "$PLUGIN_NETINFO" = "yes"; then
+ PLUGINS="$PLUGINS plugin_netinfo.o"
+
+$as_echo "#define PLUGIN_NETINFO 1" >>confdefs.h
+
+fi
+
+# POP3
+if test "$PLUGIN_POP3" = "yes"; then
+ PLUGINS="$PLUGINS plugin_pop3.o"
+
+$as_echo "#define PLUGIN_POP3 1" >>confdefs.h
+
+fi
+
+# PPP
+if test "$PLUGIN_PPP" = "yes"; then
+ for ac_header in net/if_ppp.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "net/if_ppp.h" "ac_cv_header_net_if_ppp_h" "$ac_includes_default"
+if test "x$ac_cv_header_net_if_ppp_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_NET_IF_PPP_H 1
+_ACEOF
+ has_ppp_header="true"
+else
+ has_ppp_header="false"
+fi
+
+done
+
+ if test "$has_ppp_header" = "true"; then
+ PLUGINS="$PLUGINS plugin_ppp.o"
+
+$as_echo "#define PLUGIN_PPP 1" >>confdefs.h
+
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: net/if_ppp.h header not found: ppp plugin disabled" >&5
+$as_echo "$as_me: WARNING: net/if_ppp.h header not found: ppp plugin disabled" >&2;}
+ fi
+fi
+
+# /proc/stat
+if test "$PLUGIN_PROC_STAT" = "yes"; then
+ PLUGINS="$PLUGINS plugin_proc_stat.o"
+
+$as_echo "#define PLUGIN_PROC_STAT 1" >>confdefs.h
+
+fi
+
+# python
+if test "$PLUGIN_PYTHON" = "yes"; then
+ if test "$with_python" != "yes"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: python support not enabled: python plugin disabled (use --with-python to enable)" >&5
+$as_echo "$as_me: WARNING: python support not enabled: python plugin disabled (use --with-python to enable)" >&2;}
+ else
+ if test -z "$python_path"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: python headers not found: python plugin disabled" >&5
+$as_echo "$as_me: WARNING: python headers not found: python plugin disabled" >&2;}
+ else
+ PLUGINS="$PLUGINS plugin_python.o"
+ CPPFLAGS="$CPPFLAGS $PYTHON_CPPFLAGS"
+ PLUGINLIBS="$PLUGINLIBS $PYTHON_LDFLAGS $PYTHON_EXTRA_LIBS"
+
+$as_echo "#define PLUGIN_PYTHON 1" >>confdefs.h
+
+ fi
+ fi
+fi
+
+# Qnaplog
+if test "$PLUGIN_QNAPLOG" = "yes"; then
+ for ac_header in sqlite3.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "sqlite3.h" "ac_cv_header_sqlite3_h" "$ac_includes_default"
+if test "x$ac_cv_header_sqlite3_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_SQLITE3_H 1
+_ACEOF
+ has_sqlite3_header="true"
+else
+ has_sqlite3_header="false"
+fi
+
+done
+
+ if test "$has_sqlite3_header" = "true"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sqlite3_initialize in -lsqlite3" >&5
+$as_echo_n "checking for sqlite3_initialize in -lsqlite3... " >&6; }
+if ${ac_cv_lib_sqlite3_sqlite3_initialize+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lsqlite3 $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char sqlite3_initialize ();
+int
+main ()
+{
+return sqlite3_initialize ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_sqlite3_sqlite3_initialize=yes
+else
+ ac_cv_lib_sqlite3_sqlite3_initialize=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_sqlite3_sqlite3_initialize" >&5
+$as_echo "$ac_cv_lib_sqlite3_sqlite3_initialize" >&6; }
+if test "x$ac_cv_lib_sqlite3_sqlite3_initialize" = xyes; then :
+ has_sqlite3_lib="true"
+else
+ has_sqlite3_lib="false"
+fi
+
+ if test "$has_sqlite3_lib" = "true"; then
+ PLUGINS="$PLUGINS plugin_qnaplog.o"
+ PLUGINLIBS="$PLUGINLIBS -lsqlite3"
+
+$as_echo "#define PLUGIN_QNAPLOG 1" >>confdefs.h
+
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: sqlite3 lib not found: qnaplog plugin disabled" >&5
+$as_echo "$as_me: WARNING: sqlite3 lib not found: qnaplog plugin disabled" >&2;}
+ fi
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: sqlite3.h header not found: qnaplog plugin disabled" >&5
+$as_echo "$as_me: WARNING: sqlite3.h header not found: qnaplog plugin disabled" >&2;}
+ fi
+fi
+
+# raspi (Raspberry PI)
+if test "$PLUGIN_RASPI" = "yes"; then
+ PLUGINS="$PLUGINS plugin_raspi.o"
+
+$as_echo "#define PLUGIN_RASPI 1" >>confdefs.h
+
+fi
+
+# sample
+if test "$PLUGIN_SAMPLE" = "yes"; then
+ PLUGINS="$PLUGINS plugin_sample.o"
+
+$as_echo "#define PLUGIN_SAMPLE 1" >>confdefs.h
+
+fi
+
+# SETI
+if test "$PLUGIN_SETI" = "yes"; then
+ PLUGINS="$PLUGINS plugin_seti.o"
+
+$as_echo "#define PLUGIN_SETI 1" >>confdefs.h
+
+fi
+
+# statfs()
+if test "$PLUGIN_STATFS" = "yes"; then
+ for ac_header in sys/vfs.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "sys/vfs.h" "ac_cv_header_sys_vfs_h" "$ac_includes_default"
+if test "x$ac_cv_header_sys_vfs_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_SYS_VFS_H 1
+_ACEOF
+ has_vfs_header="true"
+else
+ has_vfs_header="false"
+fi
+
+done
+
+ if test "$has_vfs_header" = "true"; then
+ PLUGINS="$PLUGINS plugin_statfs.o"
+
+$as_echo "#define PLUGIN_STATFS 1" >>confdefs.h
+
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: sys/vfs.h header not found: statfs plugin disabled" >&5
+$as_echo "$as_me: WARNING: sys/vfs.h header not found: statfs plugin disabled" >&2;}
+ fi
+fi
+
+# uname
+if test "$PLUGIN_UNAME" = "yes"; then
+ PLUGINS="$PLUGINS plugin_uname.o"
+
+$as_echo "#define PLUGIN_UNAME 1" >>confdefs.h
+
+fi
+
+# uptime
+if test "$PLUGIN_UPTIME" = "yes"; then
+ PLUGINS="$PLUGINS plugin_uptime.o"
+
+$as_echo "#define PLUGIN_UPTIME 1" >>confdefs.h
+
+fi
+
+if test "$PLUGIN_W1RETAP" = "yes"; then
+ PLUGINS="$PLUGINS plugin_w1retap.o"
+
+$as_echo "#define PLUGIN_W1RETAP 1" >>confdefs.h
+
+fi
+
+# WLAN
+if test "$PLUGIN_WIRELESS" = "yes"; then
+ for ac_header in linux/wireless.h
+do :
+ ac_fn_c_check_header_compile "$LINENO" "linux/wireless.h" "ac_cv_header_linux_wireless_h" "#include <sys/socket.h>
+"
+if test "x$ac_cv_header_linux_wireless_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LINUX_WIRELESS_H 1
+_ACEOF
+ has_wireless_header="true"
+else
+ has_wireless_header="false"
+fi
+
+done
+
+ if test "$has_wireless_header" = "true"; then
+ PLUGINS="$PLUGINS plugin_wireless.o"
+
+$as_echo "#define PLUGIN_WIRELESS 1" >>confdefs.h
+
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: linux/wireless.h header not found: wireless plugin disabled" >&5
+$as_echo "$as_me: WARNING: linux/wireless.h header not found: wireless plugin disabled" >&2;}
+ fi
+fi
+
+# XMMS
+if test "$PLUGIN_XMMS" = "yes"; then
+ PLUGINS="$PLUGINS plugin_xmms.o"
+
+$as_echo "#define PLUGIN_XMMS 1" >>confdefs.h
+
+fi
+
+
+
+
+
+# Checks for header files.
+ac_header_dirent=no
+for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do
+ as_ac_Header=`$as_echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_hdr that defines DIR" >&5
+$as_echo_n "checking for $ac_hdr that defines DIR... " >&6; }
+if eval \${$as_ac_Header+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <sys/types.h>
+#include <$ac_hdr>
+
+int
+main ()
+{
+if ((DIR *) 0)
+return 0;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ eval "$as_ac_Header=yes"
+else
+ eval "$as_ac_Header=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$as_ac_Header
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_hdr" | $as_tr_cpp` 1
+_ACEOF
+
+ac_header_dirent=$ac_hdr; break
+fi
+
+done
+# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
+if test $ac_header_dirent = dirent.h; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5
+$as_echo_n "checking for library containing opendir... " >&6; }
+if ${ac_cv_search_opendir+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char opendir ();
+int
+main ()
+{
+return opendir ();
+ ;
+ return 0;
+}
+_ACEOF
+for ac_lib in '' dir; do
+ if test -z "$ac_lib"; then
+ ac_res="none required"
+ else
+ ac_res=-l$ac_lib
+ LIBS="-l$ac_lib $ac_func_search_save_LIBS"
+ fi
+ if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_search_opendir=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext
+ if ${ac_cv_search_opendir+:} false; then :
+ break
+fi
+done
+if ${ac_cv_search_opendir+:} false; then :
+
+else
+ ac_cv_search_opendir=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5
+$as_echo "$ac_cv_search_opendir" >&6; }
+ac_res=$ac_cv_search_opendir
+if test "$ac_res" != no; then :
+ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+fi
+
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5
+$as_echo_n "checking for library containing opendir... " >&6; }
+if ${ac_cv_search_opendir+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char opendir ();
+int
+main ()
+{
+return opendir ();
+ ;
+ return 0;
+}
+_ACEOF
+for ac_lib in '' x; do
+ if test -z "$ac_lib"; then
+ ac_res="none required"
+ else
+ ac_res=-l$ac_lib
+ LIBS="-l$ac_lib $ac_func_search_save_LIBS"
+ fi
+ if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_search_opendir=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext
+ if ${ac_cv_search_opendir+:} false; then :
+ break
+fi
+done
+if ${ac_cv_search_opendir+:} false; then :
+
+else
+ ac_cv_search_opendir=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5
+$as_echo "$ac_cv_search_opendir" >&6; }
+ac_res=$ac_cv_search_opendir
+if test "$ac_res" != no; then :
+ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+fi
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
+$as_echo_n "checking for ANSI C header files... " >&6; }
+if ${ac_cv_header_stdc+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_header_stdc=yes
+else
+ ac_cv_header_stdc=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+ # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "memchr" >/dev/null 2>&1; then :
+
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "free" >/dev/null 2>&1; then :
+
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+ if test "$cross_compiling" = yes; then :
+ :
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <ctype.h>
+#include <stdlib.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+ (('a' <= (c) && (c) <= 'i') \
+ || ('j' <= (c) && (c) <= 'r') \
+ || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+ int i;
+ for (i = 0; i < 256; i++)
+ if (XOR (islower (i), ISLOWER (i))
+ || toupper (i) != TOUPPER (i))
+ return 2;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+
+else
+ ac_cv_header_stdc=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
+$as_echo "$ac_cv_header_stdc" >&6; }
+if test $ac_cv_header_stdc = yes; then
+
+$as_echo "#define STDC_HEADERS 1" >>confdefs.h
+
+fi
+
+for ac_header in arpa/inet.h fcntl.h netdb.h netinet/in.h stdlib.h string.h sys/ioctl.h sys/socket.h sys/time.h sys/vfs.h syslog.h termios.h unistd.h
+do :
+ as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+# Checks for typedefs, structures, and compiler characteristics.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5
+$as_echo_n "checking for an ANSI C-conforming const... " >&6; }
+if ${ac_cv_c_const+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+#ifndef __cplusplus
+ /* Ultrix mips cc rejects this sort of thing. */
+ typedef int charset[2];
+ const charset cs = { 0, 0 };
+ /* SunOS 4.1.1 cc rejects this. */
+ char const *const *pcpcc;
+ char **ppc;
+ /* NEC SVR4.0.2 mips cc rejects this. */
+ struct point {int x, y;};
+ static struct point const zero = {0,0};
+ /* AIX XL C 1.02.0.0 rejects this.
+ It does not let you subtract one const X* pointer from another in
+ an arm of an if-expression whose if-part is not a constant
+ expression */
+ const char *g = "string";
+ pcpcc = &g + (g ? g-g : 0);
+ /* HPUX 7.0 cc rejects these. */
+ ++pcpcc;
+ ppc = (char**) pcpcc;
+ pcpcc = (char const *const *) ppc;
+ { /* SCO 3.2v4 cc rejects this sort of thing. */
+ char tx;
+ char *t = &tx;
+ char const *s = 0 ? (char *) 0 : (char const *) 0;
+
+ *t++ = 0;
+ if (s) return 0;
+ }
+ { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */
+ int x[] = {25, 17};
+ const int *foo = &x[0];
+ ++foo;
+ }
+ { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
+ typedef const int *iptr;
+ iptr p = 0;
+ ++p;
+ }
+ { /* AIX XL C 1.02.0.0 rejects this sort of thing, saying
+ "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
+ struct s { int j; const int *ap[3]; } bx;
+ struct s *b = &bx; b->j = 5;
+ }
+ { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
+ const int foo = 10;
+ if (!foo) return 0;
+ }
+ return !cs[0] && !zero.x;
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_c_const=yes
+else
+ ac_cv_c_const=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5
+$as_echo "$ac_cv_c_const" >&6; }
+if test $ac_cv_c_const = no; then
+
+$as_echo "#define const /**/" >>confdefs.h
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5
+$as_echo_n "checking for inline... " >&6; }
+if ${ac_cv_c_inline+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_c_inline=no
+for ac_kw in inline __inline__ __inline; do
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#ifndef __cplusplus
+typedef int foo_t;
+static $ac_kw foo_t static_foo () {return 0; }
+$ac_kw foo_t foo () {return 0; }
+#endif
+
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_c_inline=$ac_kw
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ test "$ac_cv_c_inline" != no && break
+done
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5
+$as_echo "$ac_cv_c_inline" >&6; }
+
+case $ac_cv_c_inline in
+ inline | yes) ;;
+ *)
+ case $ac_cv_c_inline in
+ no) ac_val=;;
+ *) ac_val=$ac_cv_c_inline;;
+ esac
+ cat >>confdefs.h <<_ACEOF
+#ifndef __cplusplus
+#define inline $ac_val
+#endif
+_ACEOF
+ ;;
+esac
+
+ac_fn_c_check_type "$LINENO" "off_t" "ac_cv_type_off_t" "$ac_includes_default"
+if test "x$ac_cv_type_off_t" = xyes; then :
+
+else
+
+cat >>confdefs.h <<_ACEOF
+#define off_t long int
+_ACEOF
+
+fi
+
+ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default"
+if test "x$ac_cv_type_pid_t" = xyes; then :
+
+else
+
+cat >>confdefs.h <<_ACEOF
+#define pid_t int
+_ACEOF
+
+fi
+
+ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default"
+if test "x$ac_cv_type_size_t" = xyes; then :
+
+else
+
+cat >>confdefs.h <<_ACEOF
+#define size_t unsigned int
+_ACEOF
+
+fi
+
+ac_fn_c_check_type "$LINENO" "ssize_t" "ac_cv_type_ssize_t" "$ac_includes_default"
+if test "x$ac_cv_type_ssize_t" = xyes; then :
+
+else
+
+cat >>confdefs.h <<_ACEOF
+#define ssize_t int
+_ACEOF
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5
+$as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; }
+if ${ac_cv_header_time+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <sys/types.h>
+#include <sys/time.h>
+#include <time.h>
+
+int
+main ()
+{
+if ((struct tm *) 0)
+return 0;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_header_time=yes
+else
+ ac_cv_header_time=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_time" >&5
+$as_echo "$ac_cv_header_time" >&6; }
+if test $ac_cv_header_time = yes; then
+
+$as_echo "#define TIME_WITH_SYS_TIME 1" >>confdefs.h
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for uid_t in sys/types.h" >&5
+$as_echo_n "checking for uid_t in sys/types.h... " >&6; }
+if ${ac_cv_type_uid_t+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <sys/types.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "uid_t" >/dev/null 2>&1; then :
+ ac_cv_type_uid_t=yes
+else
+ ac_cv_type_uid_t=no
+fi
+rm -f conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_uid_t" >&5
+$as_echo "$ac_cv_type_uid_t" >&6; }
+if test $ac_cv_type_uid_t = no; then
+
+$as_echo "#define uid_t int" >>confdefs.h
+
+
+$as_echo "#define gid_t int" >>confdefs.h
+
+fi
+
+
+
+# Checks for library functions.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether closedir returns void" >&5
+$as_echo_n "checking whether closedir returns void... " >&6; }
+if ${ac_cv_func_closedir_void+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test "$cross_compiling" = yes; then :
+ ac_cv_func_closedir_void=yes
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header_dirent>
+#ifndef __cplusplus
+int closedir ();
+#endif
+
+int
+main ()
+{
+return closedir (opendir (".")) != 0;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ ac_cv_func_closedir_void=no
+else
+ ac_cv_func_closedir_void=yes
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_closedir_void" >&5
+$as_echo "$ac_cv_func_closedir_void" >&6; }
+if test $ac_cv_func_closedir_void = yes; then
+
+$as_echo "#define CLOSEDIR_VOID 1" >>confdefs.h
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for error_at_line" >&5
+$as_echo_n "checking for error_at_line... " >&6; }
+if ${ac_cv_lib_error_at_line+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <error.h>
+int
+main ()
+{
+error_at_line (0, 0, "", 0, "an error occurred");
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_error_at_line=yes
+else
+ ac_cv_lib_error_at_line=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_error_at_line" >&5
+$as_echo "$ac_cv_lib_error_at_line" >&6; }
+if test $ac_cv_lib_error_at_line = no; then
+ case " $LIBOBJS " in
+ *" error.$ac_objext "* ) ;;
+ *) LIBOBJS="$LIBOBJS error.$ac_objext"
+ ;;
+esac
+
+fi
+
+for ac_header in vfork.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "vfork.h" "ac_cv_header_vfork_h" "$ac_includes_default"
+if test "x$ac_cv_header_vfork_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_VFORK_H 1
+_ACEOF
+
+fi
+
+done
+
+for ac_func in fork vfork
+do :
+ as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+if test "x$ac_cv_func_fork" = xyes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working fork" >&5
+$as_echo_n "checking for working fork... " >&6; }
+if ${ac_cv_func_fork_works+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test "$cross_compiling" = yes; then :
+ ac_cv_func_fork_works=cross
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+
+ /* By Ruediger Kuhlmann. */
+ return fork () < 0;
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ ac_cv_func_fork_works=yes
+else
+ ac_cv_func_fork_works=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_fork_works" >&5
+$as_echo "$ac_cv_func_fork_works" >&6; }
+
+else
+ ac_cv_func_fork_works=$ac_cv_func_fork
+fi
+if test "x$ac_cv_func_fork_works" = xcross; then
+ case $host in
+ *-*-amigaos* | *-*-msdosdjgpp*)
+ # Override, as these systems have only a dummy fork() stub
+ ac_cv_func_fork_works=no
+ ;;
+ *)
+ ac_cv_func_fork_works=yes
+ ;;
+ esac
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&5
+$as_echo "$as_me: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&2;}
+fi
+ac_cv_func_vfork_works=$ac_cv_func_vfork
+if test "x$ac_cv_func_vfork" = xyes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working vfork" >&5
+$as_echo_n "checking for working vfork... " >&6; }
+if ${ac_cv_func_vfork_works+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test "$cross_compiling" = yes; then :
+ ac_cv_func_vfork_works=cross
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+/* Thanks to Paul Eggert for this test. */
+$ac_includes_default
+#include <sys/wait.h>
+#ifdef HAVE_VFORK_H
+# include <vfork.h>
+#endif
+/* On some sparc systems, changes by the child to local and incoming
+ argument registers are propagated back to the parent. The compiler
+ is told about this with #include <vfork.h>, but some compilers
+ (e.g. gcc -O) don't grok <vfork.h>. Test for this by using a
+ static variable whose address is put into a register that is
+ clobbered by the vfork. */
+static void
+#ifdef __cplusplus
+sparc_address_test (int arg)
+# else
+sparc_address_test (arg) int arg;
+#endif
+{
+ static pid_t child;
+ if (!child) {
+ child = vfork ();
+ if (child < 0) {
+ perror ("vfork");
+ _exit(2);
+ }
+ if (!child) {
+ arg = getpid();
+ write(-1, "", 0);
+ _exit (arg);
+ }
+ }
+}
+
+int
+main ()
+{
+ pid_t parent = getpid ();
+ pid_t child;
+
+ sparc_address_test (0);
+
+ child = vfork ();
+
+ if (child == 0) {
+ /* Here is another test for sparc vfork register problems. This
+ test uses lots of local variables, at least as many local
+ variables as main has allocated so far including compiler
+ temporaries. 4 locals are enough for gcc 1.40.3 on a Solaris
+ 4.1.3 sparc, but we use 8 to be safe. A buggy compiler should
+ reuse the register of parent for one of the local variables,
+ since it will think that parent can't possibly be used any more
+ in this routine. Assigning to the local variable will thus
+ munge parent in the parent process. */
+ pid_t
+ p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(),
+ p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid();
+ /* Convince the compiler that p..p7 are live; otherwise, it might
+ use the same hardware register for all 8 local variables. */
+ if (p != p1 || p != p2 || p != p3 || p != p4
+ || p != p5 || p != p6 || p != p7)
+ _exit(1);
+
+ /* On some systems (e.g. IRIX 3.3), vfork doesn't separate parent
+ from child file descriptors. If the child closes a descriptor
+ before it execs or exits, this munges the parent's descriptor
+ as well. Test for this by closing stdout in the child. */
+ _exit(close(fileno(stdout)) != 0);
+ } else {
+ int status;
+ struct stat st;
+
+ while (wait(&status) != child)
+ ;
+ return (
+ /* Was there some problem with vforking? */
+ child < 0
+
+ /* Did the child fail? (This shouldn't happen.) */
+ || status
+
+ /* Did the vfork/compiler bug occur? */
+ || parent != getpid()
+
+ /* Did the file descriptor bug occur? */
+ || fstat(fileno(stdout), &st) != 0
+ );
+ }
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ ac_cv_func_vfork_works=yes
+else
+ ac_cv_func_vfork_works=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_vfork_works" >&5
+$as_echo "$ac_cv_func_vfork_works" >&6; }
+
+fi;
+if test "x$ac_cv_func_fork_works" = xcross; then
+ ac_cv_func_vfork_works=$ac_cv_func_vfork
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&5
+$as_echo "$as_me: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&2;}
+fi
+
+if test "x$ac_cv_func_vfork_works" = xyes; then
+
+$as_echo "#define HAVE_WORKING_VFORK 1" >>confdefs.h
+
+else
+
+$as_echo "#define vfork fork" >>confdefs.h
+
+fi
+if test "x$ac_cv_func_fork_works" = xyes; then
+
+$as_echo "#define HAVE_WORKING_FORK 1" >>confdefs.h
+
+fi
+
+
+# uClibc has no getloadavg()
+# AC_FUNC_GETLOADAVG sounds promising, but does not really work
+#AC_FUNC_GETLOADAVG
+
+if test $ac_cv_c_compiler_gnu = yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC needs -traditional" >&5
+$as_echo_n "checking whether $CC needs -traditional... " >&6; }
+if ${ac_cv_prog_gcc_traditional+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_pattern="Autoconf.*'x'"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <sgtty.h>
+Autoconf TIOCGETP
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "$ac_pattern" >/dev/null 2>&1; then :
+ ac_cv_prog_gcc_traditional=yes
+else
+ ac_cv_prog_gcc_traditional=no
+fi
+rm -f conftest*
+
+
+ if test $ac_cv_prog_gcc_traditional = no; then
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <termio.h>
+Autoconf TCGETA
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "$ac_pattern" >/dev/null 2>&1; then :
+ ac_cv_prog_gcc_traditional=yes
+fi
+rm -f conftest*
+
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_gcc_traditional" >&5
+$as_echo "$ac_cv_prog_gcc_traditional" >&6; }
+ if test $ac_cv_prog_gcc_traditional = yes; then
+ CC="$CC -traditional"
+ fi
+fi
+
+
+# removed for uClibc compatibility
+#AC_FUNC_MALLOC
+#AC_FUNC_REALLOC
+
+for ac_header in sys/select.h sys/socket.h
+do :
+ as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking types of arguments for select" >&5
+$as_echo_n "checking types of arguments for select... " >&6; }
+if ${ac_cv_func_select_args+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ for ac_arg234 in 'fd_set *' 'int *' 'void *'; do
+ for ac_arg1 in 'int' 'size_t' 'unsigned long int' 'unsigned int'; do
+ for ac_arg5 in 'struct timeval *' 'const struct timeval *'; do
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$ac_includes_default
+#ifdef HAVE_SYS_SELECT_H
+# include <sys/select.h>
+#endif
+#ifdef HAVE_SYS_SOCKET_H
+# include <sys/socket.h>
+#endif
+
+int
+main ()
+{
+extern int select ($ac_arg1,
+ $ac_arg234, $ac_arg234, $ac_arg234,
+ $ac_arg5);
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_func_select_args="$ac_arg1,$ac_arg234,$ac_arg5"; break 3
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ done
+ done
+done
+# Provide a safe default value.
+: "${ac_cv_func_select_args=int,int *,struct timeval *}"
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_select_args" >&5
+$as_echo "$ac_cv_func_select_args" >&6; }
+ac_save_IFS=$IFS; IFS=','
+set dummy `echo "$ac_cv_func_select_args" | sed 's/\*/\*/g'`
+IFS=$ac_save_IFS
+shift
+
+cat >>confdefs.h <<_ACEOF
+#define SELECT_TYPE_ARG1 $1
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define SELECT_TYPE_ARG234 ($2)
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define SELECT_TYPE_ARG5 ($3)
+_ACEOF
+
+rm -f conftest*
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking return type of signal handlers" >&5
+$as_echo_n "checking return type of signal handlers... " >&6; }
+if ${ac_cv_type_signal+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <sys/types.h>
+#include <signal.h>
+
+int
+main ()
+{
+return *(signal (0, 0)) (0) == 1;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_type_signal=int
+else
+ ac_cv_type_signal=void
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_signal" >&5
+$as_echo "$ac_cv_type_signal" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define RETSIGTYPE $ac_cv_type_signal
+_ACEOF
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether lstat correctly handles trailing slash" >&5
+$as_echo_n "checking whether lstat correctly handles trailing slash... " >&6; }
+if ${ac_cv_func_lstat_dereferences_slashed_symlink+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ rm -f conftest.sym conftest.file
+echo >conftest.file
+if test "$as_ln_s" = "ln -s" && ln -s conftest.file conftest.sym; then
+ if test "$cross_compiling" = yes; then :
+ ac_cv_func_lstat_dereferences_slashed_symlink=no
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+struct stat sbuf;
+ /* Linux will dereference the symlink and fail, as required by POSIX.
+ That is better in the sense that it means we will not
+ have to compile and use the lstat wrapper. */
+ return lstat ("conftest.sym/", &sbuf) == 0;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ ac_cv_func_lstat_dereferences_slashed_symlink=yes
+else
+ ac_cv_func_lstat_dereferences_slashed_symlink=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+else
+ # If the `ln -s' command failed, then we probably don't even
+ # have an lstat function.
+ ac_cv_func_lstat_dereferences_slashed_symlink=no
+fi
+rm -f conftest.sym conftest.file
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_lstat_dereferences_slashed_symlink" >&5
+$as_echo "$ac_cv_func_lstat_dereferences_slashed_symlink" >&6; }
+
+test $ac_cv_func_lstat_dereferences_slashed_symlink = yes &&
+
+cat >>confdefs.h <<_ACEOF
+#define LSTAT_FOLLOWS_SLASHED_SYMLINK 1
+_ACEOF
+
+
+if test "x$ac_cv_func_lstat_dereferences_slashed_symlink" = xno; then
+ case " $LIBOBJS " in
+ *" lstat.$ac_objext "* ) ;;
+ *) LIBOBJS="$LIBOBJS lstat.$ac_objext"
+ ;;
+esac
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stat accepts an empty string" >&5
+$as_echo_n "checking whether stat accepts an empty string... " >&6; }
+if ${ac_cv_func_stat_empty_string_bug+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test "$cross_compiling" = yes; then :
+ ac_cv_func_stat_empty_string_bug=yes
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+struct stat sbuf;
+ return stat ("", &sbuf) == 0;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ ac_cv_func_stat_empty_string_bug=no
+else
+ ac_cv_func_stat_empty_string_bug=yes
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_stat_empty_string_bug" >&5
+$as_echo "$ac_cv_func_stat_empty_string_bug" >&6; }
+if test $ac_cv_func_stat_empty_string_bug = yes; then
+ case " $LIBOBJS " in
+ *" stat.$ac_objext "* ) ;;
+ *) LIBOBJS="$LIBOBJS stat.$ac_objext"
+ ;;
+esac
+
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STAT_EMPTY_STRING_BUG 1
+_ACEOF
+
+fi
+
+for ac_func in strftime
+do :
+ ac_fn_c_check_func "$LINENO" "strftime" "ac_cv_func_strftime"
+if test "x$ac_cv_func_strftime" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_STRFTIME 1
+_ACEOF
+
+else
+ # strftime is in -lintl on SCO UNIX.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for strftime in -lintl" >&5
+$as_echo_n "checking for strftime in -lintl... " >&6; }
+if ${ac_cv_lib_intl_strftime+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lintl $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char strftime ();
+int
+main ()
+{
+return strftime ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_intl_strftime=yes
+else
+ ac_cv_lib_intl_strftime=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_intl_strftime" >&5
+$as_echo "$ac_cv_lib_intl_strftime" >&6; }
+if test "x$ac_cv_lib_intl_strftime" = xyes; then :
+ $as_echo "#define HAVE_STRFTIME 1" >>confdefs.h
+
+LIBS="-lintl $LIBS"
+fi
+
+fi
+done
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working strtod" >&5
+$as_echo_n "checking for working strtod... " >&6; }
+if ${ac_cv_func_strtod+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test "$cross_compiling" = yes; then :
+ ac_cv_func_strtod=no
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+$ac_includes_default
+#ifndef strtod
+double strtod ();
+#endif
+int
+main()
+{
+ {
+ /* Some versions of Linux strtod mis-parse strings with leading '+'. */
+ char *string = " +69";
+ char *term;
+ double value;
+ value = strtod (string, &term);
+ if (value != 69 || term != (string + 4))
+ return 1;
+ }
+
+ {
+ /* Under Solaris 2.4, strtod returns the wrong value for the
+ terminating character under some conditions. */
+ char *string = "NaN";
+ char *term;
+ strtod (string, &term);
+ if (term != string && *(term - 1) == 0)
+ return 1;
+ }
+ return 0;
+}
+
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ ac_cv_func_strtod=yes
+else
+ ac_cv_func_strtod=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_strtod" >&5
+$as_echo "$ac_cv_func_strtod" >&6; }
+if test $ac_cv_func_strtod = no; then
+ case " $LIBOBJS " in
+ *" strtod.$ac_objext "* ) ;;
+ *) LIBOBJS="$LIBOBJS strtod.$ac_objext"
+ ;;
+esac
+
+ac_fn_c_check_func "$LINENO" "pow" "ac_cv_func_pow"
+if test "x$ac_cv_func_pow" = xyes; then :
+
+fi
+
+if test $ac_cv_func_pow = no; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pow in -lm" >&5
+$as_echo_n "checking for pow in -lm... " >&6; }
+if ${ac_cv_lib_m_pow+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lm $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char pow ();
+int
+main ()
+{
+return pow ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_m_pow=yes
+else
+ ac_cv_lib_m_pow=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_pow" >&5
+$as_echo "$ac_cv_lib_m_pow" >&6; }
+if test "x$ac_cv_lib_m_pow" = xyes; then :
+ POW_LIB=-lm
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cannot find library containing definition of pow" >&5
+$as_echo "$as_me: WARNING: cannot find library containing definition of pow" >&2;}
+fi
+
+fi
+
+fi
+
+for ac_func in dup2 floor gethostbyname gettimeofday memmove memset pow putenv regcomp select socket sqrt strcasecmp strchr strcspn strdup strerror strncasecmp strndup strpbrk strrchr strstr strtol strtoul uname
+do :
+ as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+
+ac_config_files="$ac_config_files Makefile"
+
+cat >confcache <<\_ACEOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs, see configure's option --config-cache.
+# It is not useful on other systems. If it contains results you don't
+# want to keep, you may remove or edit it.
+#
+# config.status only pays attention to the cache file if you give it
+# the --recheck option to rerun configure.
+#
+# `ac_cv_env_foo' variables (set or unset) will be overridden when
+# loading this file, other *unset* `ac_cv_foo' will be assigned the
+# following values.
+
+_ACEOF
+
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, we kill variables containing newlines.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(
+ for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do
+ eval ac_val=\$$ac_var
+ case $ac_val in #(
+ *${as_nl}*)
+ case $ac_var in #(
+ *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
+$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
+ esac
+ case $ac_var in #(
+ _ | IFS | as_nl) ;; #(
+ BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+ *) { eval $ac_var=; unset $ac_var;} ;;
+ esac ;;
+ esac
+ done
+
+ (set) 2>&1 |
+ case $as_nl`(ac_space=' '; set) 2>&1` in #(
+ *${as_nl}ac_space=\ *)
+ # `set' does not quote correctly, so add quotes: double-quote
+ # substitution turns \\\\ into \\, and sed turns \\ into \.
+ sed -n \
+ "s/'/'\\\\''/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
+ ;; #(
+ *)
+ # `set' quotes correctly as required by POSIX, so do not add quotes.
+ sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+ ;;
+ esac |
+ sort
+) |
+ sed '
+ /^ac_cv_env_/b end
+ t clear
+ :clear
+ s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+ t end
+ s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+ :end' >>confcache
+if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
+ if test -w "$cache_file"; then
+ if test "x$cache_file" != "x/dev/null"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5
+$as_echo "$as_me: updating cache $cache_file" >&6;}
+ if test ! -f "$cache_file" || test -h "$cache_file"; then
+ cat confcache >"$cache_file"
+ else
+ case $cache_file in #(
+ */* | ?:*)
+ mv -f confcache "$cache_file"$$ &&
+ mv -f "$cache_file"$$ "$cache_file" ;; #(
+ *)
+ mv -f confcache "$cache_file" ;;
+ esac
+ fi
+ fi
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5
+$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;}
+ fi
+fi
+rm -f confcache
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+DEFS=-DHAVE_CONFIG_H
+
+ac_libobjs=
+ac_ltlibobjs=
+for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
+ # 1. Remove the extension, and $U if already installed.
+ ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
+ ac_i=`$as_echo "$ac_i" | sed "$ac_script"`
+ # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR
+ # will be set to the directory where LIBOBJS objects are built.
+ as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext"
+ as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo'
+done
+LIBOBJS=$ac_libobjs
+
+LTLIBOBJS=$ac_ltlibobjs
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5
+$as_echo_n "checking that generated files are newer than configure... " >&6; }
+ if test -n "$am_sleep_pid"; then
+ # Hide warnings about reused PIDs.
+ wait $am_sleep_pid 2>/dev/null
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5
+$as_echo "done" >&6; }
+ if test -n "$EXEEXT"; then
+ am__EXEEXT_TRUE=
+ am__EXEEXT_FALSE='#'
+else
+ am__EXEEXT_TRUE='#'
+ am__EXEEXT_FALSE=
+fi
+
+if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
+ as_fn_error $? "conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
+ as_fn_error $? "conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+
+: "${CONFIG_STATUS=./config.status}"
+ac_write_fail=0
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files $CONFIG_STATUS"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5
+$as_echo "$as_me: creating $CONFIG_STATUS" >&6;}
+as_write_fail=0
+cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1
+#! $SHELL
+# Generated by $as_me.
+# Run this file to recreate the current configuration.
+# Compiler output produced by configure, useful for debugging
+# configure, is in config.log if it exists.
+
+debug=false
+ac_cs_recheck=false
+ac_cs_silent=false
+
+SHELL=\${CONFIG_SHELL-$SHELL}
+export SHELL
+_ASEOF
+cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1
+## -------------------- ##
+## M4sh Initialization. ##
+## -------------------- ##
+
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
+ emulate sh
+ NULLCMD=:
+ # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in #(
+ *posix*) :
+ set -o posix ;; #(
+ *) :
+ ;;
+esac
+fi
+
+
+as_nl='
+'
+export as_nl
+# Printing a long string crashes Solaris 7 /usr/bin/printf.
+as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
+# Prefer a ksh shell builtin over an external printf program on Solaris,
+# but without wasting forks for bash or zsh.
+if test -z "$BASH_VERSION$ZSH_VERSION" \
+ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='print -r --'
+ as_echo_n='print -rn --'
+elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='printf %s\n'
+ as_echo_n='printf %s'
+else
+ if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
+ as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
+ as_echo_n='/usr/ucb/echo -n'
+ else
+ as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
+ as_echo_n_body='eval
+ arg=$1;
+ case $arg in #(
+ *"$as_nl"*)
+ expr "X$arg" : "X\\(.*\\)$as_nl";
+ arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
+ esac;
+ expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
+ '
+ export as_echo_n_body
+ as_echo_n='sh -c $as_echo_n_body as_echo'
+ fi
+ export as_echo_body
+ as_echo='sh -c $as_echo_body as_echo'
+fi
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ PATH_SEPARATOR=:
+ (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
+ (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
+ PATH_SEPARATOR=';'
+ }
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order. Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+IFS=" "" $as_nl"
+
+# Find who we are. Look in the path if we contain no directory separator.
+as_myself=
+case $0 in #((
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+ as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+ $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+ exit 1
+fi
+
+# Unset variables that we do not need and which cause bugs (e.g. in
+# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1"
+# suppresses any "Segmentation fault" message there. '((' could
+# trigger a bug in pdksh 5.2.14.
+for as_var in BASH_ENV ENV MAIL MAILPATH
+do eval test x\${$as_var+set} = xset \
+ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
+
+# CDPATH.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+
+# as_fn_error STATUS ERROR [LINENO LOG_FD]
+# ----------------------------------------
+# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
+# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
+# script with STATUS, using 1 if that was 0.
+as_fn_error ()
+{
+ as_status=$1; test $as_status -eq 0 && as_status=1
+ if test "$4"; then
+ as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
+ fi
+ $as_echo "$as_me: error: $2" >&2
+ as_fn_exit $as_status
+} # as_fn_error
+
+
+# as_fn_set_status STATUS
+# -----------------------
+# Set $? to STATUS, without forking.
+as_fn_set_status ()
+{
+ return $1
+} # as_fn_set_status
+
+# as_fn_exit STATUS
+# -----------------
+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
+as_fn_exit ()
+{
+ set +e
+ as_fn_set_status $1
+ exit $1
+} # as_fn_exit
+
+# as_fn_unset VAR
+# ---------------
+# Portably unset VAR.
+as_fn_unset ()
+{
+ { eval $1=; unset $1;}
+}
+as_unset=as_fn_unset
+# as_fn_append VAR VALUE
+# ----------------------
+# Append the text in VALUE to the end of the definition contained in VAR. Take
+# advantage of any shell optimizations that allow amortized linear growth over
+# repeated appends, instead of the typical quadratic growth present in naive
+# implementations.
+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
+ eval 'as_fn_append ()
+ {
+ eval $1+=\$2
+ }'
+else
+ as_fn_append ()
+ {
+ eval $1=\$$1\$2
+ }
+fi # as_fn_append
+
+# as_fn_arith ARG...
+# ------------------
+# Perform arithmetic evaluation on the ARGs, and store the result in the
+# global $as_val. Take advantage of shells that can avoid forks. The arguments
+# must be portable across $(()) and expr.
+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
+ eval 'as_fn_arith ()
+ {
+ as_val=$(( $* ))
+ }'
+else
+ as_fn_arith ()
+ {
+ as_val=`expr "$@" || test $? -eq 1`
+ }
+fi # as_fn_arith
+
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+ as_dirname=dirname
+else
+ as_dirname=false
+fi
+
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in #(((((
+-n*)
+ case `echo 'xy\c'` in
+ *c*) ECHO_T=' ';; # ECHO_T is single tab character.
+ xy) ECHO_C='\c';;
+ *) echo `echo ksh88 bug on AIX 6.1` > /dev/null
+ ECHO_T=' ';;
+ esac;;
+*)
+ ECHO_N='-n';;
+esac
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+ rm -f conf$$.dir/conf$$.file
+else
+ rm -f conf$$.dir
+ mkdir conf$$.dir 2>/dev/null
+fi
+if (echo >conf$$.file) 2>/dev/null; then
+ if ln -s conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s='ln -s'
+ # ... but there are two gotchas:
+ # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+ # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+ # In both cases, we have to default to `cp -pR'.
+ ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+ as_ln_s='cp -pR'
+ elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+ else
+ as_ln_s='cp -pR'
+ fi
+else
+ as_ln_s='cp -pR'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+
+# as_fn_mkdir_p
+# -------------
+# Create "$as_dir" as a directory, including parents if necessary.
+as_fn_mkdir_p ()
+{
+
+ case $as_dir in #(
+ -*) as_dir=./$as_dir;;
+ esac
+ test -d "$as_dir" || eval $as_mkdir_p || {
+ as_dirs=
+ while :; do
+ case $as_dir in #(
+ *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+ *) as_qdir=$as_dir;;
+ esac
+ as_dirs="'$as_qdir' $as_dirs"
+ as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ test -d "$as_dir" && break
+ done
+ test -z "$as_dirs" || eval "mkdir $as_dirs"
+ } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
+
+
+} # as_fn_mkdir_p
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p='mkdir -p "$as_dir"'
+else
+ test -d ./-p && rmdir ./-p
+ as_mkdir_p=false
+fi
+
+
+# as_fn_executable_p FILE
+# -----------------------
+# Test if FILE is an executable regular file.
+as_fn_executable_p ()
+{
+ test -f "$1" && test -x "$1"
+} # as_fn_executable_p
+as_test_x='test -x'
+as_executable_p=as_fn_executable_p
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+exec 6>&1
+## ----------------------------------- ##
+## Main body of $CONFIG_STATUS script. ##
+## ----------------------------------- ##
+_ASEOF
+test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# Save the log message, to keep $0 and so on meaningful, and to
+# report actual input values of CONFIG_FILES etc. instead of their
+# values after options handling.
+ac_log="
+This file was extended by LCD4Linux $as_me 0.11.0-SVN, which was
+generated by GNU Autoconf 2.69. Invocation command line was
+
+ CONFIG_FILES = $CONFIG_FILES
+ CONFIG_HEADERS = $CONFIG_HEADERS
+ CONFIG_LINKS = $CONFIG_LINKS
+ CONFIG_COMMANDS = $CONFIG_COMMANDS
+ $ $0 $@
+
+on `(hostname || uname -n) 2>/dev/null | sed 1q`
+"
+
+_ACEOF
+
+case $ac_config_files in *"
+"*) set x $ac_config_files; shift; ac_config_files=$*;;
+esac
+
+case $ac_config_headers in *"
+"*) set x $ac_config_headers; shift; ac_config_headers=$*;;
+esac
+
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+# Files that config.status was made for.
+config_files="$ac_config_files"
+config_headers="$ac_config_headers"
+config_commands="$ac_config_commands"
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+ac_cs_usage="\
+\`$as_me' instantiates files and other configuration actions
+from templates according to the current configuration. Unless the files
+and actions are specified as TAGs, all are instantiated by default.
+
+Usage: $0 [OPTION]... [TAG]...
+
+ -h, --help print this help, then exit
+ -V, --version print version number and configuration settings, then exit
+ --config print configuration, then exit
+ -q, --quiet, --silent
+ do not print progress messages
+ -d, --debug don't remove temporary files
+ --recheck update $as_me by reconfiguring in the same conditions
+ --file=FILE[:TEMPLATE]
+ instantiate the configuration file FILE
+ --header=FILE[:TEMPLATE]
+ instantiate the configuration header FILE
+
+Configuration files:
+$config_files
+
+Configuration headers:
+$config_headers
+
+Configuration commands:
+$config_commands
+
+Report bugs to <lcd4linux-users@lists.sourceforge.net>."
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
+ac_cs_version="\\
+LCD4Linux config.status 0.11.0-SVN
+configured by $0, generated by GNU Autoconf 2.69,
+ with options \\"\$ac_cs_config\\"
+
+Copyright (C) 2012 Free Software Foundation, Inc.
+This config.status script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it."
+
+ac_pwd='$ac_pwd'
+srcdir='$srcdir'
+INSTALL='$INSTALL'
+MKDIR_P='$MKDIR_P'
+AWK='$AWK'
+test -n "\$AWK" || AWK=awk
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# The default lists apply if the user does not specify any file.
+ac_need_defaults=:
+while test $# != 0
+do
+ case $1 in
+ --*=?*)
+ ac_option=`expr "X$1" : 'X\([^=]*\)='`
+ ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
+ ac_shift=:
+ ;;
+ --*=)
+ ac_option=`expr "X$1" : 'X\([^=]*\)='`
+ ac_optarg=
+ ac_shift=:
+ ;;
+ *)
+ ac_option=$1
+ ac_optarg=$2
+ ac_shift=shift
+ ;;
+ esac
+
+ case $ac_option in
+ # Handling of the options.
+ -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+ ac_cs_recheck=: ;;
+ --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
+ $as_echo "$ac_cs_version"; exit ;;
+ --config | --confi | --conf | --con | --co | --c )
+ $as_echo "$ac_cs_config"; exit ;;
+ --debug | --debu | --deb | --de | --d | -d )
+ debug=: ;;
+ --file | --fil | --fi | --f )
+ $ac_shift
+ case $ac_optarg in
+ *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ '') as_fn_error $? "missing file argument" ;;
+ esac
+ as_fn_append CONFIG_FILES " '$ac_optarg'"
+ ac_need_defaults=false;;
+ --header | --heade | --head | --hea )
+ $ac_shift
+ case $ac_optarg in
+ *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ esac
+ as_fn_append CONFIG_HEADERS " '$ac_optarg'"
+ ac_need_defaults=false;;
+ --he | --h)
+ # Conflict between --help and --header
+ as_fn_error $? "ambiguous option: \`$1'
+Try \`$0 --help' for more information.";;
+ --help | --hel | -h )
+ $as_echo "$ac_cs_usage"; exit ;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil | --si | --s)
+ ac_cs_silent=: ;;
+
+ # This is an error.
+ -*) as_fn_error $? "unrecognized option: \`$1'
+Try \`$0 --help' for more information." ;;
+
+ *) as_fn_append ac_config_targets " $1"
+ ac_need_defaults=false ;;
+
+ esac
+ shift
+done
+
+ac_configure_extra_args=
+
+if $ac_cs_silent; then
+ exec 6>/dev/null
+ ac_configure_extra_args="$ac_configure_extra_args --silent"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+if \$ac_cs_recheck; then
+ set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+ shift
+ \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
+ CONFIG_SHELL='$SHELL'
+ export CONFIG_SHELL
+ exec "\$@"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+exec 5>>config.log
+{
+ echo
+ sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+ $as_echo "$ac_log"
+} >&5
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+#
+# INIT-COMMANDS
+#
+AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+
+# Handling of arguments.
+for ac_config_target in $ac_config_targets
+do
+ case $ac_config_target in
+ "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
+ "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
+ "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+
+ *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
+ esac
+done
+
+
+# If the user did not use the arguments to specify the items to instantiate,
+# then the envvar interface is used. Set only those that are not.
+# We use the long form for the default assignment because of an extremely
+# bizarre bug on SunOS 4.1.3.
+if $ac_need_defaults; then
+ test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
+ test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
+ test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
+fi
+
+# Have a temporary directory for convenience. Make it in the build tree
+# simply because there is no reason against having it here, and in addition,
+# creating and moving files from /tmp can sometimes cause problems.
+# Hook for its removal unless debugging.
+# Note that there is a small window in which the directory will not be cleaned:
+# after its creation but before its name has been assigned to `$tmp'.
+$debug ||
+{
+ tmp= ac_tmp=
+ trap 'exit_status=$?
+ : "${ac_tmp:=$tmp}"
+ { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status
+' 0
+ trap 'as_fn_exit 1' 1 2 13 15
+}
+# Create a (secure) tmp directory for tmp files.
+
+{
+ tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
+ test -d "$tmp"
+} ||
+{
+ tmp=./conf$$-$RANDOM
+ (umask 077 && mkdir "$tmp")
+} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5
+ac_tmp=$tmp
+
+# Set up the scripts for CONFIG_FILES section.
+# No need to generate them if there are no CONFIG_FILES.
+# This happens for instance with `./config.status config.h'.
+if test -n "$CONFIG_FILES"; then
+
+
+ac_cr=`echo X | tr X '\015'`
+# On cygwin, bash can eat \r inside `` if the user requested igncr.
+# But we know of no other shell where ac_cr would be empty at this
+# point, so we can use a bashism as a fallback.
+if test "x$ac_cr" = x; then
+ eval ac_cr=\$\'\\r\'
+fi
+ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
+if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
+ ac_cs_awk_cr='\\r'
+else
+ ac_cs_awk_cr=$ac_cr
+fi
+
+echo 'BEGIN {' >"$ac_tmp/subs1.awk" &&
+_ACEOF
+
+
+{
+ echo "cat >conf$$subs.awk <<_ACEOF" &&
+ echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&
+ echo "_ACEOF"
+} >conf$$subs.sh ||
+ as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'`
+ac_delim='%!_!# '
+for ac_last_try in false false false false false :; do
+ . ./conf$$subs.sh ||
+ as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+
+ ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X`
+ if test $ac_delim_n = $ac_delim_num; then
+ break
+ elif $ac_last_try; then
+ as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+ else
+ ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+ fi
+done
+rm -f conf$$subs.sh
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK &&
+_ACEOF
+sed -n '
+h
+s/^/S["/; s/!.*/"]=/
+p
+g
+s/^[^!]*!//
+:repl
+t repl
+s/'"$ac_delim"'$//
+t delim
+:nl
+h
+s/\(.\{148\}\)..*/\1/
+t more1
+s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/
+p
+n
+b repl
+:more1
+s/["\\]/\\&/g; s/^/"/; s/$/"\\/
+p
+g
+s/.\{148\}//
+t nl
+:delim
+h
+s/\(.\{148\}\)..*/\1/
+t more2
+s/["\\]/\\&/g; s/^/"/; s/$/"/
+p
+b
+:more2
+s/["\\]/\\&/g; s/^/"/; s/$/"\\/
+p
+g
+s/.\{148\}//
+t delim
+' <conf$$subs.awk | sed '
+/^[^""]/{
+ N
+ s/\n//
+}
+' >>$CONFIG_STATUS || ac_write_fail=1
+rm -f conf$$subs.awk
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+_ACAWK
+cat >>"\$ac_tmp/subs1.awk" <<_ACAWK &&
+ for (key in S) S_is_set[key] = 1
+ FS = ""
+
+}
+{
+ line = $ 0
+ nfields = split(line, field, "@")
+ substed = 0
+ len = length(field[1])
+ for (i = 2; i < nfields; i++) {
+ key = field[i]
+ keylen = length(key)
+ if (S_is_set[key]) {
+ value = S[key]
+ line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3)
+ len += length(value) + length(field[++i])
+ substed = 1
+ } else
+ len += 1 + keylen
+ }
+
+ print line
+}
+
+_ACAWK
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
+ sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"
+else
+ cat
+fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \
+ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5
+_ACEOF
+
+# VPATH may cause trouble with some makes, so we remove sole $(srcdir),
+# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
+if test "x$srcdir" = x.; then
+ ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{
+h
+s///
+s/^/:/
+s/[ ]*$/:/
+s/:\$(srcdir):/:/g
+s/:\${srcdir}:/:/g
+s/:@srcdir@:/:/g
+s/^:*//
+s/:*$//
+x
+s/\(=[ ]*\).*/\1/
+G
+s/\n//
+s/^[^=]*=[ ]*$//
+}'
+fi
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+fi # test -n "$CONFIG_FILES"
+
+# Set up the scripts for CONFIG_HEADERS section.
+# No need to generate them if there are no CONFIG_HEADERS.
+# This happens for instance with `./config.status Makefile'.
+if test -n "$CONFIG_HEADERS"; then
+cat >"$ac_tmp/defines.awk" <<\_ACAWK ||
+BEGIN {
+_ACEOF
+
+# Transform confdefs.h into an awk script `defines.awk', embedded as
+# here-document in config.status, that substitutes the proper values into
+# config.h.in to produce config.h.
+
+# Create a delimiter string that does not exist in confdefs.h, to ease
+# handling of long lines.
+ac_delim='%!_!# '
+for ac_last_try in false false :; do
+ ac_tt=`sed -n "/$ac_delim/p" confdefs.h`
+ if test -z "$ac_tt"; then
+ break
+ elif $ac_last_try; then
+ as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5
+ else
+ ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+ fi
+done
+
+# For the awk script, D is an array of macro values keyed by name,
+# likewise P contains macro parameters if any. Preserve backslash
+# newline sequences.
+
+ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]*
+sed -n '
+s/.\{148\}/&'"$ac_delim"'/g
+t rset
+:rset
+s/^[ ]*#[ ]*define[ ][ ]*/ /
+t def
+d
+:def
+s/\\$//
+t bsnl
+s/["\\]/\\&/g
+s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\
+D["\1"]=" \3"/p
+s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p
+d
+:bsnl
+s/["\\]/\\&/g
+s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\
+D["\1"]=" \3\\\\\\n"\\/p
+t cont
+s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p
+t cont
+d
+:cont
+n
+s/.\{148\}/&'"$ac_delim"'/g
+t clear
+:clear
+s/\\$//
+t bsnlc
+s/["\\]/\\&/g; s/^/"/; s/$/"/p
+d
+:bsnlc
+s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p
+b cont
+' <confdefs.h | sed '
+s/'"$ac_delim"'/"\\\
+"/g' >>$CONFIG_STATUS || ac_write_fail=1
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ for (key in D) D_is_set[key] = 1
+ FS = ""
+}
+/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ {
+ line = \$ 0
+ split(line, arg, " ")
+ if (arg[1] == "#") {
+ defundef = arg[2]
+ mac1 = arg[3]
+ } else {
+ defundef = substr(arg[1], 2)
+ mac1 = arg[2]
+ }
+ split(mac1, mac2, "(") #)
+ macro = mac2[1]
+ prefix = substr(line, 1, index(line, defundef) - 1)
+ if (D_is_set[macro]) {
+ # Preserve the white space surrounding the "#".
+ print prefix "define", macro P[macro] D[macro]
+ next
+ } else {
+ # Replace #undef with comments. This is necessary, for example,
+ # in the case of _POSIX_SOURCE, which is predefined and required
+ # on some systems where configure will not decide to define it.
+ if (defundef == "undef") {
+ print "/*", prefix defundef, macro, "*/"
+ next
+ }
+ }
+}
+{ print }
+_ACAWK
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+ as_fn_error $? "could not setup config headers machinery" "$LINENO" 5
+fi # test -n "$CONFIG_HEADERS"
+
+
+eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS"
+shift
+for ac_tag
+do
+ case $ac_tag in
+ :[FHLC]) ac_mode=$ac_tag; continue;;
+ esac
+ case $ac_mode$ac_tag in
+ :[FHL]*:*);;
+ :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;;
+ :[FH]-) ac_tag=-:-;;
+ :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
+ esac
+ ac_save_IFS=$IFS
+ IFS=:
+ set x $ac_tag
+ IFS=$ac_save_IFS
+ shift
+ ac_file=$1
+ shift
+
+ case $ac_mode in
+ :L) ac_source=$1;;
+ :[FH])
+ ac_file_inputs=
+ for ac_f
+ do
+ case $ac_f in
+ -) ac_f="$ac_tmp/stdin";;
+ *) # Look for the file first in the build tree, then in the source tree
+ # (if the path is not absolute). The absolute path cannot be DOS-style,
+ # because $ac_f cannot contain `:'.
+ test -f "$ac_f" ||
+ case $ac_f in
+ [\\/$]*) false;;
+ *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
+ esac ||
+ as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;;
+ esac
+ case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
+ as_fn_append ac_file_inputs " '$ac_f'"
+ done
+
+ # Let's still pretend it is `configure' which instantiates (i.e., don't
+ # use $as_me), people would be surprised to read:
+ # /* config.h. Generated by config.status. */
+ configure_input='Generated from '`
+ $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g'
+ `' by configure.'
+ if test x"$ac_file" != x-; then
+ configure_input="$ac_file. $configure_input"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5
+$as_echo "$as_me: creating $ac_file" >&6;}
+ fi
+ # Neutralize special characters interpreted by sed in replacement strings.
+ case $configure_input in #(
+ *\&* | *\|* | *\\* )
+ ac_sed_conf_input=`$as_echo "$configure_input" |
+ sed 's/[\\\\&|]/\\\\&/g'`;; #(
+ *) ac_sed_conf_input=$configure_input;;
+ esac
+
+ case $ac_tag in
+ *:-:* | *:-) cat >"$ac_tmp/stdin" \
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;;
+ esac
+ ;;
+ esac
+
+ ac_dir=`$as_dirname -- "$ac_file" ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$ac_file" : 'X\(//\)[^/]' \| \
+ X"$ac_file" : 'X\(//\)$' \| \
+ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$ac_file" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ as_dir="$ac_dir"; as_fn_mkdir_p
+ ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+ ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
+ # A ".." for each directory in $ac_dir_suffix.
+ ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
+ case $ac_top_builddir_sub in
+ "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+ *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+ esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+ .) # We are building in place.
+ ac_srcdir=.
+ ac_top_srcdir=$ac_top_builddir_sub
+ ac_abs_top_srcdir=$ac_pwd ;;
+ [\\/]* | ?:[\\/]* ) # Absolute name.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir
+ ac_abs_top_srcdir=$srcdir ;;
+ *) # Relative name.
+ ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_build_prefix$srcdir
+ ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+
+ case $ac_mode in
+ :F)
+ #
+ # CONFIG_FILE
+ #
+
+ case $INSTALL in
+ [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
+ *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;;
+ esac
+ ac_MKDIR_P=$MKDIR_P
+ case $MKDIR_P in
+ [\\/$]* | ?:[\\/]* ) ;;
+ */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;;
+ esac
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# If the template does not know about datarootdir, expand it.
+# FIXME: This hack should be removed a few years after 2.60.
+ac_datarootdir_hack=; ac_datarootdir_seen=
+ac_sed_dataroot='
+/datarootdir/ {
+ p
+ q
+}
+/@datadir@/p
+/@docdir@/p
+/@infodir@/p
+/@localedir@/p
+/@mandir@/p'
+case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in
+*datarootdir*) ac_datarootdir_seen=yes;;
+*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
+$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ ac_datarootdir_hack='
+ s&@datadir@&$datadir&g
+ s&@docdir@&$docdir&g
+ s&@infodir@&$infodir&g
+ s&@localedir@&$localedir&g
+ s&@mandir@&$mandir&g
+ s&\\\${datarootdir}&$datarootdir&g' ;;
+esac
+_ACEOF
+
+# Neutralize VPATH when `$srcdir' = `.'.
+# Shell code in configure.ac might set extrasub.
+# FIXME: do we really want to maintain this feature?
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_sed_extra="$ac_vpsub
+$extrasub
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+:t
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+s|@configure_input@|$ac_sed_conf_input|;t t
+s&@top_builddir@&$ac_top_builddir_sub&;t t
+s&@top_build_prefix@&$ac_top_build_prefix&;t t
+s&@srcdir@&$ac_srcdir&;t t
+s&@abs_srcdir@&$ac_abs_srcdir&;t t
+s&@top_srcdir@&$ac_top_srcdir&;t t
+s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t
+s&@builddir@&$ac_builddir&;t t
+s&@abs_builddir@&$ac_abs_builddir&;t t
+s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
+s&@INSTALL@&$ac_INSTALL&;t t
+s&@MKDIR_P@&$ac_MKDIR_P&;t t
+$ac_datarootdir_hack
+"
+eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \
+ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+
+test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
+ { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } &&
+ { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \
+ "$ac_tmp/out"`; test -z "$ac_out"; } &&
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined. Please make sure it is defined" >&5
+$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined. Please make sure it is defined" >&2;}
+
+ rm -f "$ac_tmp/stdin"
+ case $ac_file in
+ -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";;
+ *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";;
+ esac \
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+ ;;
+ :H)
+ #
+ # CONFIG_HEADER
+ #
+ if test x"$ac_file" != x-; then
+ {
+ $as_echo "/* $configure_input */" \
+ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs"
+ } >"$ac_tmp/config.h" \
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+ if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5
+$as_echo "$as_me: $ac_file is unchanged" >&6;}
+ else
+ rm -f "$ac_file"
+ mv "$ac_tmp/config.h" "$ac_file" \
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+ fi
+ else
+ $as_echo "/* $configure_input */" \
+ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \
+ || as_fn_error $? "could not create -" "$LINENO" 5
+ fi
+# Compute "$ac_file"'s index in $config_headers.
+_am_arg="$ac_file"
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+ case $_am_header in
+ $_am_arg | $_am_arg:* )
+ break ;;
+ * )
+ _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+ esac
+done
+echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" ||
+$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$_am_arg" : 'X\(//\)[^/]' \| \
+ X"$_am_arg" : 'X\(//\)$' \| \
+ X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$_am_arg" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`/stamp-h$_am_stamp_count
+ ;;
+
+ :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5
+$as_echo "$as_me: executing $ac_file commands" >&6;}
+ ;;
+ esac
+
+
+ case $ac_file$ac_mode in
+ "depfiles":C) test x"$AMDEP_TRUE" != x"" || {
+ # Older Autoconf quotes --file arguments for eval, but not when files
+ # are listed without --file. Let's play safe and only enable the eval
+ # if we detect the quoting.
+ case $CONFIG_FILES in
+ *\'*) eval set x "$CONFIG_FILES" ;;
+ *) set x $CONFIG_FILES ;;
+ esac
+ shift
+ for mf
+ do
+ # Strip MF so we end up with the name of the file.
+ mf=`echo "$mf" | sed -e 's/:.*$//'`
+ # Check whether this is an Automake generated Makefile or not.
+ # We used to match only the files named 'Makefile.in', but
+ # some people rename them; so instead we look at the file content.
+ # Grep'ing the first line is not enough: some people post-process
+ # each Makefile.in and add a new line on top of each file to say so.
+ # Grep'ing the whole file is not good either: AIX grep has a line
+ # limit of 2048, but all sed's we know have understand at least 4000.
+ if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
+ dirpart=`$as_dirname -- "$mf" ||
+$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$mf" : 'X\(//\)[^/]' \| \
+ X"$mf" : 'X\(//\)$' \| \
+ X"$mf" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$mf" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ else
+ continue
+ fi
+ # Extract the definition of DEPDIR, am__include, and am__quote
+ # from the Makefile without running 'make'.
+ DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+ test -z "$DEPDIR" && continue
+ am__include=`sed -n 's/^am__include = //p' < "$mf"`
+ test -z "$am__include" && continue
+ am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+ # Find all dependency output files, they are included files with
+ # $(DEPDIR) in their names. We invoke sed twice because it is the
+ # simplest approach to changing $(DEPDIR) to its actual value in the
+ # expansion.
+ for file in `sed -n "
+ s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
+ # Make sure the directory exists.
+ test -f "$dirpart/$file" && continue
+ fdir=`$as_dirname -- "$file" ||
+$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$file" : 'X\(//\)[^/]' \| \
+ X"$file" : 'X\(//\)$' \| \
+ X"$file" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$file" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ as_dir=$dirpart/$fdir; as_fn_mkdir_p
+ # echo "creating $dirpart/$file"
+ echo '# dummy' > "$dirpart/$file"
+ done
+ done
+}
+ ;;
+
+ esac
+done # for ac_tag
+
+
+as_fn_exit 0
+_ACEOF
+ac_clean_files=$ac_clean_files_save
+
+test $ac_write_fail = 0 ||
+ as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5
+
+
+# configure is writing to config.log, and then calls config.status.
+# config.status does its own redirection, appending to config.log.
+# Unfortunately, on DOS this fails, as config.log is still kept open
+# by configure, so config.status won't be able to write to it; its
+# output is simply discarded. So we exec the FD to /dev/null,
+# effectively closing config.log, so it can be properly (re)opened and
+# appended to by config.status. When coming back to configure, we
+# need to make the FD available again.
+if test "$no_create" != yes; then
+ ac_cs_success=:
+ ac_config_status_args=
+ test "$silent" = yes &&
+ ac_config_status_args="$ac_config_status_args --quiet"
+ exec 5>/dev/null
+ $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
+ exec 5>>config.log
+ # Use ||, not &&, to avoid exiting from the if with $? = 1, which
+ # would make configure fail if this is the last instruction.
+ $ac_cs_success || as_fn_exit 1
+fi
+if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
+$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
+fi
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: -----------------------------------------
+included drivers:
+ $DRIVERS
+-----------------------------------------
+included plugins:
+ $PLUGINS
+-----------------------------------------
+" >&5
+$as_echo "-----------------------------------------
+included drivers:
+ $DRIVERS
+-----------------------------------------
+included plugins:
+ $PLUGINS
+-----------------------------------------
+" >&6; }
+
+
+case `pwd` in
+ *\ * | *\ *)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5
+$as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;;
+esac
+
+
+
+macro_version='2.4.2'
+macro_revision='1.3337'
+
+
+
+
+
+
+
+
+
+
+
+
+
+ltmain="$ac_aux_dir/ltmain.sh"
+
+# Backslashify metacharacters that are still active within
+# double-quoted strings.
+sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\(["`\\]\)/\\\1/g'
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# Sed substitution to delay expansion of an escaped single quote.
+delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
+
+# Sed substitution to avoid accidental globbing in evaled expressions
+no_glob_subst='s/\*/\\\*/g'
+
+ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5
+$as_echo_n "checking how to print strings... " >&6; }
+# Test print first, because it will be a builtin if present.
+if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \
+ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then
+ ECHO='print -r --'
+elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then
+ ECHO='printf %s\n'
+else
+ # Use this function as a fallback that always works.
+ func_fallback_echo ()
+ {
+ eval 'cat <<_LTECHO_EOF
+$1
+_LTECHO_EOF'
+ }
+ ECHO='func_fallback_echo'
+fi
+
+# func_echo_all arg...
+# Invoke $ECHO with all args, space-separated.
+func_echo_all ()
+{
+ $ECHO ""
+}
+
+case "$ECHO" in
+ printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5
+$as_echo "printf" >&6; } ;;
+ print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5
+$as_echo "print -r" >&6; } ;;
+ *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5
+$as_echo "cat" >&6; } ;;
+esac
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5
+$as_echo_n "checking for a sed that does not truncate output... " >&6; }
+if ${ac_cv_path_SED+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
+ for ac_i in 1 2 3 4 5 6 7; do
+ ac_script="$ac_script$as_nl$ac_script"
+ done
+ echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed
+ { ac_script=; unset ac_script;}
+ if test -z "$SED"; then
+ ac_path_SED_found=false
+ # Loop through the user's path and test for each of PROGNAME-LIST
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in sed gsed; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_SED="$as_dir/$ac_prog$ac_exec_ext"
+ as_fn_executable_p "$ac_path_SED" || continue
+# Check for GNU ac_path_SED and select it if it is found.
+ # Check for GNU $ac_path_SED
+case `"$ac_path_SED" --version 2>&1` in
+*GNU*)
+ ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;;
+*)
+ ac_count=0
+ $as_echo_n 0123456789 >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ $as_echo '' >> "conftest.nl"
+ "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ as_fn_arith $ac_count + 1 && ac_count=$as_val
+ if test $ac_count -gt ${ac_path_SED_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_SED="$ac_path_SED"
+ ac_path_SED_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+ $ac_path_SED_found && break 3
+ done
+ done
+ done
+IFS=$as_save_IFS
+ if test -z "$ac_cv_path_SED"; then
+ as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5
+ fi
+else
+ ac_cv_path_SED=$SED
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5
+$as_echo "$ac_cv_path_SED" >&6; }
+ SED="$ac_cv_path_SED"
+ rm -f conftest.sed
+
+test -z "$SED" && SED=sed
+Xsed="$SED -e 1s/^X//"
+
+
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5
+$as_echo_n "checking for fgrep... " >&6; }
+if ${ac_cv_path_FGREP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1
+ then ac_cv_path_FGREP="$GREP -F"
+ else
+ if test -z "$FGREP"; then
+ ac_path_FGREP_found=false
+ # Loop through the user's path and test for each of PROGNAME-LIST
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in fgrep; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext"
+ as_fn_executable_p "$ac_path_FGREP" || continue
+# Check for GNU ac_path_FGREP and select it if it is found.
+ # Check for GNU $ac_path_FGREP
+case `"$ac_path_FGREP" --version 2>&1` in
+*GNU*)
+ ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;;
+*)
+ ac_count=0
+ $as_echo_n 0123456789 >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ $as_echo 'FGREP' >> "conftest.nl"
+ "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ as_fn_arith $ac_count + 1 && ac_count=$as_val
+ if test $ac_count -gt ${ac_path_FGREP_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_FGREP="$ac_path_FGREP"
+ ac_path_FGREP_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+ $ac_path_FGREP_found && break 3
+ done
+ done
+ done
+IFS=$as_save_IFS
+ if test -z "$ac_cv_path_FGREP"; then
+ as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+ fi
+else
+ ac_cv_path_FGREP=$FGREP
+fi
+
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5
+$as_echo "$ac_cv_path_FGREP" >&6; }
+ FGREP="$ac_cv_path_FGREP"
+
+
+test -z "$GREP" && GREP=grep
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# Check whether --with-gnu-ld was given.
+if test "${with_gnu_ld+set}" = set; then :
+ withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes
+else
+ with_gnu_ld=no
+fi
+
+ac_prog=ld
+if test "$GCC" = yes; then
+ # Check if gcc -print-prog-name=ld gives a path.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5
+$as_echo_n "checking for ld used by $CC... " >&6; }
+ case $host in
+ *-*-mingw*)
+ # gcc leaves a trailing carriage return which upsets mingw
+ ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+ *)
+ ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+ esac
+ case $ac_prog in
+ # Accept absolute paths.
+ [\\/]* | ?:[\\/]*)
+ re_direlt='/[^/][^/]*/\.\./'
+ # Canonicalize the pathname of ld
+ ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'`
+ while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do
+ ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"`
+ done
+ test -z "$LD" && LD="$ac_prog"
+ ;;
+ "")
+ # If it fails, then pretend we aren't using GCC.
+ ac_prog=ld
+ ;;
+ *)
+ # If it is relative, then search for the first ld in PATH.
+ with_gnu_ld=unknown
+ ;;
+ esac
+elif test "$with_gnu_ld" = yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5
+$as_echo_n "checking for GNU ld... " >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5
+$as_echo_n "checking for non-GNU ld... " >&6; }
+fi
+if ${lt_cv_path_LD+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -z "$LD"; then
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for ac_dir in $PATH; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+ lt_cv_path_LD="$ac_dir/$ac_prog"
+ # Check to see if the program is GNU ld. I'd rather use --version,
+ # but apparently some variants of GNU ld only accept -v.
+ # Break only if it was the GNU/non-GNU ld that we prefer.
+ case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
+ *GNU* | *'with BFD'*)
+ test "$with_gnu_ld" != no && break
+ ;;
+ *)
+ test "$with_gnu_ld" != yes && break
+ ;;
+ esac
+ fi
+ done
+ IFS="$lt_save_ifs"
+else
+ lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi
+fi
+
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5
+$as_echo "$LD" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5
+$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; }
+if ${lt_cv_prog_gnu_ld+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ # I'd rather use --version here, but apparently some GNU lds only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+ lt_cv_prog_gnu_ld=yes
+ ;;
+*)
+ lt_cv_prog_gnu_ld=no
+ ;;
+esac
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_gnu_ld" >&5
+$as_echo "$lt_cv_prog_gnu_ld" >&6; }
+with_gnu_ld=$lt_cv_prog_gnu_ld
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5
+$as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; }
+if ${lt_cv_path_NM+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$NM"; then
+ # Let the user override the test.
+ lt_cv_path_NM="$NM"
+else
+ lt_nm_to_check="${ac_tool_prefix}nm"
+ if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
+ lt_nm_to_check="$lt_nm_to_check nm"
+ fi
+ for lt_tmp_nm in $lt_nm_to_check; do
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ tmp_nm="$ac_dir/$lt_tmp_nm"
+ if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
+ # Check to see if the nm accepts a BSD-compat flag.
+ # Adding the `sed 1q' prevents false positives on HP-UX, which says:
+ # nm: unknown option "B" ignored
+ # Tru64's nm complains that /dev/null is an invalid object file
+ case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
+ */dev/null* | *'Invalid file or object type'*)
+ lt_cv_path_NM="$tmp_nm -B"
+ break
+ ;;
+ *)
+ case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
+ */dev/null*)
+ lt_cv_path_NM="$tmp_nm -p"
+ break
+ ;;
+ *)
+ lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+ continue # so that we can try to find one that supports BSD flags
+ ;;
+ esac
+ ;;
+ esac
+ fi
+ done
+ IFS="$lt_save_ifs"
+ done
+ : ${lt_cv_path_NM=no}
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5
+$as_echo "$lt_cv_path_NM" >&6; }
+if test "$lt_cv_path_NM" != "no"; then
+ NM="$lt_cv_path_NM"
+else
+ # Didn't find any BSD compatible name lister, look for dumpbin.
+ if test -n "$DUMPBIN"; then :
+ # Let the user override the test.
+ else
+ if test -n "$ac_tool_prefix"; then
+ for ac_prog in dumpbin "link -dump"
+ do
+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_DUMPBIN+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$DUMPBIN"; then
+ ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+DUMPBIN=$ac_cv_prog_DUMPBIN
+if test -n "$DUMPBIN"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5
+$as_echo "$DUMPBIN" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$DUMPBIN" && break
+ done
+fi
+if test -z "$DUMPBIN"; then
+ ac_ct_DUMPBIN=$DUMPBIN
+ for ac_prog in dumpbin "link -dump"
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_DUMPBIN"; then
+ ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_DUMPBIN="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN
+if test -n "$ac_ct_DUMPBIN"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5
+$as_echo "$ac_ct_DUMPBIN" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$ac_ct_DUMPBIN" && break
+done
+
+ if test "x$ac_ct_DUMPBIN" = x; then
+ DUMPBIN=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ DUMPBIN=$ac_ct_DUMPBIN
+ fi
+fi
+
+ case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in
+ *COFF*)
+ DUMPBIN="$DUMPBIN -symbols"
+ ;;
+ *)
+ DUMPBIN=:
+ ;;
+ esac
+ fi
+
+ if test "$DUMPBIN" != ":"; then
+ NM="$DUMPBIN"
+ fi
+fi
+test -z "$NM" && NM=nm
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5
+$as_echo_n "checking the name lister ($NM) interface... " >&6; }
+if ${lt_cv_nm_interface+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_nm_interface="BSD nm"
+ echo "int some_variable = 0;" > conftest.$ac_ext
+ (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5)
+ (eval "$ac_compile" 2>conftest.err)
+ cat conftest.err >&5
+ (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
+ (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
+ cat conftest.err >&5
+ (eval echo "\"\$as_me:$LINENO: output\"" >&5)
+ cat conftest.out >&5
+ if $GREP 'External.*some_variable' conftest.out > /dev/null; then
+ lt_cv_nm_interface="MS dumpbin"
+ fi
+ rm -f conftest*
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5
+$as_echo "$lt_cv_nm_interface" >&6; }
+
+# find the maximum length of command line arguments
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5
+$as_echo_n "checking the maximum length of command line arguments... " >&6; }
+if ${lt_cv_sys_max_cmd_len+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ i=0
+ teststring="ABCD"
+
+ case $build_os in
+ msdosdjgpp*)
+ # On DJGPP, this test can blow up pretty badly due to problems in libc
+ # (any single argument exceeding 2000 bytes causes a buffer overrun
+ # during glob expansion). Even if it were fixed, the result of this
+ # check would be larger than it should be.
+ lt_cv_sys_max_cmd_len=12288; # 12K is about right
+ ;;
+
+ gnu*)
+ # Under GNU Hurd, this test is not required because there is
+ # no limit to the length of command line arguments.
+ # Libtool will interpret -1 as no limit whatsoever
+ lt_cv_sys_max_cmd_len=-1;
+ ;;
+
+ cygwin* | mingw* | cegcc*)
+ # On Win9x/ME, this test blows up -- it succeeds, but takes
+ # about 5 minutes as the teststring grows exponentially.
+ # Worse, since 9x/ME are not pre-emptively multitasking,
+ # you end up with a "frozen" computer, even though with patience
+ # the test eventually succeeds (with a max line length of 256k).
+ # Instead, let's just punt: use the minimum linelength reported by
+ # all of the supported platforms: 8192 (on NT/2K/XP).
+ lt_cv_sys_max_cmd_len=8192;
+ ;;
+
+ mint*)
+ # On MiNT this can take a long time and run out of memory.
+ lt_cv_sys_max_cmd_len=8192;
+ ;;
+
+ amigaos*)
+ # On AmigaOS with pdksh, this test takes hours, literally.
+ # So we just punt and use a minimum line length of 8192.
+ lt_cv_sys_max_cmd_len=8192;
+ ;;
+
+ netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
+ # This has been around since 386BSD, at least. Likely further.
+ if test -x /sbin/sysctl; then
+ lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
+ elif test -x /usr/sbin/sysctl; then
+ lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`
+ else
+ lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs
+ fi
+ # And add a safety zone
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+ ;;
+
+ interix*)
+ # We know the value 262144 and hardcode it with a safety zone (like BSD)
+ lt_cv_sys_max_cmd_len=196608
+ ;;
+
+ os2*)
+ # The test takes a long time on OS/2.
+ lt_cv_sys_max_cmd_len=8192
+ ;;
+
+ osf*)
+ # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
+ # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
+ # nice to cause kernel panics so lets avoid the loop below.
+ # First set a reasonable default.
+ lt_cv_sys_max_cmd_len=16384
+ #
+ if test -x /sbin/sysconfig; then
+ case `/sbin/sysconfig -q proc exec_disable_arg_limit` in
+ *1*) lt_cv_sys_max_cmd_len=-1 ;;
+ esac
+ fi
+ ;;
+ sco3.2v5*)
+ lt_cv_sys_max_cmd_len=102400
+ ;;
+ sysv5* | sco5v6* | sysv4.2uw2*)
+ kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`
+ if test -n "$kargmax"; then
+ lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'`
+ else
+ lt_cv_sys_max_cmd_len=32768
+ fi
+ ;;
+ *)
+ lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`
+ if test -n "$lt_cv_sys_max_cmd_len" && \
+ test undefined != "$lt_cv_sys_max_cmd_len"; then
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+ else
+ # Make teststring a little bigger before we do anything with it.
+ # a 1K string should be a reasonable start.
+ for i in 1 2 3 4 5 6 7 8 ; do
+ teststring=$teststring$teststring
+ done
+ SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
+ # If test is not a shell built-in, we'll probably end up computing a
+ # maximum length that is only half of the actual maximum length, but
+ # we can't tell.
+ while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \
+ = "X$teststring$teststring"; } >/dev/null 2>&1 &&
+ test $i != 17 # 1/2 MB should be enough
+ do
+ i=`expr $i + 1`
+ teststring=$teststring$teststring
+ done
+ # Only check the string length outside the loop.
+ lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1`
+ teststring=
+ # Add a significant safety factor because C++ compilers can tack on
+ # massive amounts of additional arguments before passing them to the
+ # linker. It appears as though 1/2 is a usable value.
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
+ fi
+ ;;
+ esac
+
+fi
+
+if test -n $lt_cv_sys_max_cmd_len ; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5
+$as_echo "$lt_cv_sys_max_cmd_len" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5
+$as_echo "none" >&6; }
+fi
+max_cmd_len=$lt_cv_sys_max_cmd_len
+
+
+
+
+
+
+: ${CP="cp -f"}
+: ${MV="mv -f"}
+: ${RM="rm -f"}
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands some XSI constructs" >&5
+$as_echo_n "checking whether the shell understands some XSI constructs... " >&6; }
+# Try some XSI features
+xsi_shell=no
+( _lt_dummy="a/b/c"
+ test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \
+ = c,a/b,b/c, \
+ && eval 'test $(( 1 + 1 )) -eq 2 \
+ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \
+ && xsi_shell=yes
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xsi_shell" >&5
+$as_echo "$xsi_shell" >&6; }
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands \"+=\"" >&5
+$as_echo_n "checking whether the shell understands \"+=\"... " >&6; }
+lt_shell_append=no
+( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \
+ >/dev/null 2>&1 \
+ && lt_shell_append=yes
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_shell_append" >&5
+$as_echo "$lt_shell_append" >&6; }
+
+
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+ lt_unset=unset
+else
+ lt_unset=false
+fi
+
+
+
+
+
+# test EBCDIC or ASCII
+case `echo X|tr X '\101'` in
+ A) # ASCII based system
+ # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
+ lt_SP2NL='tr \040 \012'
+ lt_NL2SP='tr \015\012 \040\040'
+ ;;
+ *) # EBCDIC based system
+ lt_SP2NL='tr \100 \n'
+ lt_NL2SP='tr \r\n \100\100'
+ ;;
+esac
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5
+$as_echo_n "checking how to convert $build file names to $host format... " >&6; }
+if ${lt_cv_to_host_file_cmd+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $host in
+ *-*-mingw* )
+ case $build in
+ *-*-mingw* ) # actually msys
+ lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32
+ ;;
+ *-*-cygwin* )
+ lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32
+ ;;
+ * ) # otherwise, assume *nix
+ lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32
+ ;;
+ esac
+ ;;
+ *-*-cygwin* )
+ case $build in
+ *-*-mingw* ) # actually msys
+ lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin
+ ;;
+ *-*-cygwin* )
+ lt_cv_to_host_file_cmd=func_convert_file_noop
+ ;;
+ * ) # otherwise, assume *nix
+ lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin
+ ;;
+ esac
+ ;;
+ * ) # unhandled hosts (and "normal" native builds)
+ lt_cv_to_host_file_cmd=func_convert_file_noop
+ ;;
+esac
+
+fi
+
+to_host_file_cmd=$lt_cv_to_host_file_cmd
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5
+$as_echo "$lt_cv_to_host_file_cmd" >&6; }
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5
+$as_echo_n "checking how to convert $build file names to toolchain format... " >&6; }
+if ${lt_cv_to_tool_file_cmd+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ #assume ordinary cross tools, or native build.
+lt_cv_to_tool_file_cmd=func_convert_file_noop
+case $host in
+ *-*-mingw* )
+ case $build in
+ *-*-mingw* ) # actually msys
+ lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32
+ ;;
+ esac
+ ;;
+esac
+
+fi
+
+to_tool_file_cmd=$lt_cv_to_tool_file_cmd
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5
+$as_echo "$lt_cv_to_tool_file_cmd" >&6; }
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5
+$as_echo_n "checking for $LD option to reload object files... " >&6; }
+if ${lt_cv_ld_reload_flag+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_ld_reload_flag='-r'
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5
+$as_echo "$lt_cv_ld_reload_flag" >&6; }
+reload_flag=$lt_cv_ld_reload_flag
+case $reload_flag in
+"" | " "*) ;;
+*) reload_flag=" $reload_flag" ;;
+esac
+reload_cmds='$LD$reload_flag -o $output$reload_objs'
+case $host_os in
+ cygwin* | mingw* | pw32* | cegcc*)
+ if test "$GCC" != yes; then
+ reload_cmds=false
+ fi
+ ;;
+ darwin*)
+ if test "$GCC" = yes; then
+ reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
+ else
+ reload_cmds='$LD$reload_flag -o $output$reload_objs'
+ fi
+ ;;
+esac
+
+
+
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args.
+set dummy ${ac_tool_prefix}objdump; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_OBJDUMP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$OBJDUMP"; then
+ ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+OBJDUMP=$ac_cv_prog_OBJDUMP
+if test -n "$OBJDUMP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5
+$as_echo "$OBJDUMP" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OBJDUMP"; then
+ ac_ct_OBJDUMP=$OBJDUMP
+ # Extract the first word of "objdump", so it can be a program name with args.
+set dummy objdump; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_OBJDUMP"; then
+ ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_OBJDUMP="objdump"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP
+if test -n "$ac_ct_OBJDUMP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5
+$as_echo "$ac_ct_OBJDUMP" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_OBJDUMP" = x; then
+ OBJDUMP="false"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ OBJDUMP=$ac_ct_OBJDUMP
+ fi
+else
+ OBJDUMP="$ac_cv_prog_OBJDUMP"
+fi
+
+test -z "$OBJDUMP" && OBJDUMP=objdump
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5
+$as_echo_n "checking how to recognize dependent libraries... " >&6; }
+if ${lt_cv_deplibs_check_method+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_file_magic_cmd='$MAGIC_CMD'
+lt_cv_file_magic_test_file=
+lt_cv_deplibs_check_method='unknown'
+# Need to set the preceding variable on all platforms that support
+# interlibrary dependencies.
+# 'none' -- dependencies not supported.
+# `unknown' -- same as none, but documents that we really don't know.
+# 'pass_all' -- all dependencies passed with no checks.
+# 'test_compile' -- check by making test program.
+# 'file_magic [[regex]]' -- check by looking for files in library path
+# which responds to the $file_magic_cmd with a given extended regex.
+# If you have `file' or equivalent on your system and you're not sure
+# whether `pass_all' will *always* work, you probably want this one.
+
+case $host_os in
+aix[4-9]*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+beos*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+bsdi[45]*)
+ lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)'
+ lt_cv_file_magic_cmd='/usr/bin/file -L'
+ lt_cv_file_magic_test_file=/shlib/libc.so
+ ;;
+
+cygwin*)
+ # func_win32_libid is a shell function defined in ltmain.sh
+ lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+ lt_cv_file_magic_cmd='func_win32_libid'
+ ;;
+
+mingw* | pw32*)
+ # Base MSYS/MinGW do not provide the 'file' command needed by
+ # func_win32_libid shell function, so use a weaker test based on 'objdump',
+ # unless we find 'file', for example because we are cross-compiling.
+ # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin.
+ if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then
+ lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+ lt_cv_file_magic_cmd='func_win32_libid'
+ else
+ # Keep this pattern in sync with the one in func_win32_libid.
+ lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)'
+ lt_cv_file_magic_cmd='$OBJDUMP -f'
+ fi
+ ;;
+
+cegcc*)
+ # use the weaker test based on 'objdump'. See mingw*.
+ lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?'
+ lt_cv_file_magic_cmd='$OBJDUMP -f'
+ ;;
+
+darwin* | rhapsody*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+freebsd* | dragonfly*)
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
+ case $host_cpu in
+ i*86 )
+ # Not sure whether the presence of OpenBSD here was a mistake.
+ # Let's accept both of them until this is cleared up.
+ lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library'
+ lt_cv_file_magic_cmd=/usr/bin/file
+ lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+ ;;
+ esac
+ else
+ lt_cv_deplibs_check_method=pass_all
+ fi
+ ;;
+
+haiku*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+hpux10.20* | hpux11*)
+ lt_cv_file_magic_cmd=/usr/bin/file
+ case $host_cpu in
+ ia64*)
+ lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64'
+ lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
+ ;;
+ hppa*64*)
+ lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]'
+ lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
+ ;;
+ *)
+ lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library'
+ lt_cv_file_magic_test_file=/usr/lib/libc.sl
+ ;;
+ esac
+ ;;
+
+interix[3-9]*)
+ # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here
+ lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$'
+ ;;
+
+irix5* | irix6* | nonstopux*)
+ case $LD in
+ *-32|*"-32 ") libmagic=32-bit;;
+ *-n32|*"-n32 ") libmagic=N32;;
+ *-64|*"-64 ") libmagic=64-bit;;
+ *) libmagic=never-match;;
+ esac
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+# This must be glibc/ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+netbsd* | netbsdelf*-gnu)
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
+ lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
+ else
+ lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$'
+ fi
+ ;;
+
+newos6*)
+ lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)'
+ lt_cv_file_magic_cmd=/usr/bin/file
+ lt_cv_file_magic_test_file=/usr/lib/libnls.so
+ ;;
+
+*nto* | *qnx*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+openbsd*)
+ if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$'
+ else
+ lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
+ fi
+ ;;
+
+osf3* | osf4* | osf5*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+rdos*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+solaris*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+sysv4 | sysv4.3*)
+ case $host_vendor in
+ motorola)
+ lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]'
+ lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+ ;;
+ ncr)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+ sequent)
+ lt_cv_file_magic_cmd='/bin/file'
+ lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )'
+ ;;
+ sni)
+ lt_cv_file_magic_cmd='/bin/file'
+ lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib"
+ lt_cv_file_magic_test_file=/lib/libc.so
+ ;;
+ siemens)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+ pc)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+ esac
+ ;;
+
+tpf*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+esac
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5
+$as_echo "$lt_cv_deplibs_check_method" >&6; }
+
+file_magic_glob=
+want_nocaseglob=no
+if test "$build" = "$host"; then
+ case $host_os in
+ mingw* | pw32*)
+ if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then
+ want_nocaseglob=yes
+ else
+ file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"`
+ fi
+ ;;
+ esac
+fi
+
+file_magic_cmd=$lt_cv_file_magic_cmd
+deplibs_check_method=$lt_cv_deplibs_check_method
+test -z "$deplibs_check_method" && deplibs_check_method=unknown
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args.
+set dummy ${ac_tool_prefix}dlltool; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_DLLTOOL+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$DLLTOOL"; then
+ ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+DLLTOOL=$ac_cv_prog_DLLTOOL
+if test -n "$DLLTOOL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5
+$as_echo "$DLLTOOL" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_DLLTOOL"; then
+ ac_ct_DLLTOOL=$DLLTOOL
+ # Extract the first word of "dlltool", so it can be a program name with args.
+set dummy dlltool; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_DLLTOOL"; then
+ ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_DLLTOOL="dlltool"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL
+if test -n "$ac_ct_DLLTOOL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5
+$as_echo "$ac_ct_DLLTOOL" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_DLLTOOL" = x; then
+ DLLTOOL="false"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ DLLTOOL=$ac_ct_DLLTOOL
+ fi
+else
+ DLLTOOL="$ac_cv_prog_DLLTOOL"
+fi
+
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5
+$as_echo_n "checking how to associate runtime and link libraries... " >&6; }
+if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_sharedlib_from_linklib_cmd='unknown'
+
+case $host_os in
+cygwin* | mingw* | pw32* | cegcc*)
+ # two different shell functions defined in ltmain.sh
+ # decide which to use based on capabilities of $DLLTOOL
+ case `$DLLTOOL --help 2>&1` in
+ *--identify-strict*)
+ lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib
+ ;;
+ *)
+ lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback
+ ;;
+ esac
+ ;;
+*)
+ # fallback: assume linklib IS sharedlib
+ lt_cv_sharedlib_from_linklib_cmd="$ECHO"
+ ;;
+esac
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5
+$as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; }
+sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd
+test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO
+
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+ for ac_prog in ar
+ do
+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_AR+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$AR"; then
+ ac_cv_prog_AR="$AR" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_AR="$ac_tool_prefix$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+AR=$ac_cv_prog_AR
+if test -n "$AR"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5
+$as_echo "$AR" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$AR" && break
+ done
+fi
+if test -z "$AR"; then
+ ac_ct_AR=$AR
+ for ac_prog in ar
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_AR+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_AR"; then
+ ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_AR="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_AR=$ac_cv_prog_ac_ct_AR
+if test -n "$ac_ct_AR"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5
+$as_echo "$ac_ct_AR" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$ac_ct_AR" && break
+done
+
+ if test "x$ac_ct_AR" = x; then
+ AR="false"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ AR=$ac_ct_AR
+ fi
+fi
+
+: ${AR=ar}
+: ${AR_FLAGS=cru}
+
+
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5
+$as_echo_n "checking for archiver @FILE support... " >&6; }
+if ${lt_cv_ar_at_file+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_ar_at_file=no
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ echo conftest.$ac_objext > conftest.lst
+ lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5'
+ { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5
+ (eval $lt_ar_try) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+ if test "$ac_status" -eq 0; then
+ # Ensure the archiver fails upon bogus file names.
+ rm -f conftest.$ac_objext libconftest.a
+ { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5
+ (eval $lt_ar_try) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+ if test "$ac_status" -ne 0; then
+ lt_cv_ar_at_file=@
+ fi
+ fi
+ rm -f conftest.* libconftest.a
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5
+$as_echo "$lt_cv_ar_at_file" >&6; }
+
+if test "x$lt_cv_ar_at_file" = xno; then
+ archiver_list_spec=
+else
+ archiver_list_spec=$lt_cv_ar_at_file
+fi
+
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_STRIP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$STRIP"; then
+ ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5
+$as_echo "$STRIP" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_STRIP"; then
+ ac_ct_STRIP=$STRIP
+ # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_STRIP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_STRIP"; then
+ ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_STRIP="strip"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5
+$as_echo "$ac_ct_STRIP" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_STRIP" = x; then
+ STRIP=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ STRIP=$ac_ct_STRIP
+ fi
+else
+ STRIP="$ac_cv_prog_STRIP"
+fi
+
+test -z "$STRIP" && STRIP=:
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ranlib; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_RANLIB+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$RANLIB"; then
+ ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+RANLIB=$ac_cv_prog_RANLIB
+if test -n "$RANLIB"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5
+$as_echo "$RANLIB" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_RANLIB"; then
+ ac_ct_RANLIB=$RANLIB
+ # Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_RANLIB+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_RANLIB"; then
+ ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_RANLIB="ranlib"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
+if test -n "$ac_ct_RANLIB"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5
+$as_echo "$ac_ct_RANLIB" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_RANLIB" = x; then
+ RANLIB=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ RANLIB=$ac_ct_RANLIB
+ fi
+else
+ RANLIB="$ac_cv_prog_RANLIB"
+fi
+
+test -z "$RANLIB" && RANLIB=:
+
+
+
+
+
+
+# Determine commands to create old-style static archives.
+old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'
+old_postinstall_cmds='chmod 644 $oldlib'
+old_postuninstall_cmds=
+
+if test -n "$RANLIB"; then
+ case $host_os in
+ openbsd*)
+ old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib"
+ ;;
+ *)
+ old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib"
+ ;;
+ esac
+ old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib"
+fi
+
+case $host_os in
+ darwin*)
+ lock_old_archive_extraction=yes ;;
+ *)
+ lock_old_archive_extraction=no ;;
+esac
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+
+# Check for command to grab the raw symbol name followed by C symbol from nm.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5
+$as_echo_n "checking command to parse $NM output from $compiler object... " >&6; }
+if ${lt_cv_sys_global_symbol_pipe+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
+# These are sane defaults that work on at least a few old systems.
+# [They come from Ultrix. What could be older than Ultrix?!! ;)]
+
+# Character class describing NM global symbol codes.
+symcode='[BCDEGRST]'
+
+# Regexp to match symbols that can be accessed directly from C.
+sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
+
+# Define system-specific variables.
+case $host_os in
+aix*)
+ symcode='[BCDT]'
+ ;;
+cygwin* | mingw* | pw32* | cegcc*)
+ symcode='[ABCDGISTW]'
+ ;;
+hpux*)
+ if test "$host_cpu" = ia64; then
+ symcode='[ABCDEGRST]'
+ fi
+ ;;
+irix* | nonstopux*)
+ symcode='[BCDEGRST]'
+ ;;
+osf*)
+ symcode='[BCDEGQRST]'
+ ;;
+solaris*)
+ symcode='[BDRT]'
+ ;;
+sco3.2v5*)
+ symcode='[DT]'
+ ;;
+sysv4.2uw2*)
+ symcode='[DT]'
+ ;;
+sysv5* | sco5v6* | unixware* | OpenUNIX*)
+ symcode='[ABDT]'
+ ;;
+sysv4)
+ symcode='[DFNSTU]'
+ ;;
+esac
+
+# If we're using GNU nm, then use its standard symbol codes.
+case `$NM -V 2>&1` in
+*GNU* | *'with BFD'*)
+ symcode='[ABCDGIRSTW]' ;;
+esac
+
+# Transform an extracted symbol line into a proper C declaration.
+# Some systems (esp. on ia64) link data and code symbols differently,
+# so use this general approach.
+lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+
+# Transform an extracted symbol line into symbol name and symbol address
+lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'"
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'"
+
+# Handle CRLF in mingw tool chain
+opt_cr=
+case $build_os in
+mingw*)
+ opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp
+ ;;
+esac
+
+# Try without a prefix underscore, then with it.
+for ac_symprfx in "" "_"; do
+
+ # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.
+ symxfrm="\\1 $ac_symprfx\\2 \\2"
+
+ # Write the raw and C identifiers.
+ if test "$lt_cv_nm_interface" = "MS dumpbin"; then
+ # Fake it for dumpbin and say T for any non-static function
+ # and D for any global variable.
+ # Also find C++ and __fastcall symbols from MSVC++,
+ # which start with @ or ?.
+ lt_cv_sys_global_symbol_pipe="$AWK '"\
+" {last_section=section; section=\$ 3};"\
+" /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\
+" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\
+" \$ 0!~/External *\|/{next};"\
+" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\
+" {if(hide[section]) next};"\
+" {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\
+" {split(\$ 0, a, /\||\r/); split(a[2], s)};"\
+" s[1]~/^[@?]/{print s[1], s[1]; next};"\
+" s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\
+" ' prfx=^$ac_symprfx"
+ else
+ lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
+ fi
+ lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'"
+
+ # Check to see that the pipe works correctly.
+ pipe_works=no
+
+ rm -f conftest*
+ cat > conftest.$ac_ext <<_LT_EOF
+#ifdef __cplusplus
+extern "C" {
+#endif
+char nm_test_var;
+void nm_test_func(void);
+void nm_test_func(void){}
+#ifdef __cplusplus
+}
+#endif
+int main(){nm_test_var='a';nm_test_func();return(0);}
+_LT_EOF
+
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ # Now try to grab the symbols.
+ nlist=conftest.nm
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5
+ (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && test -s "$nlist"; then
+ # Try sorting and uniquifying the output.
+ if sort "$nlist" | uniq > "$nlist"T; then
+ mv -f "$nlist"T "$nlist"
+ else
+ rm -f "$nlist"T
+ fi
+
+ # Make sure that we snagged all the symbols we need.
+ if $GREP ' nm_test_var$' "$nlist" >/dev/null; then
+ if $GREP ' nm_test_func$' "$nlist" >/dev/null; then
+ cat <<_LT_EOF > conftest.$ac_ext
+/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
+#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
+/* DATA imports from DLLs on WIN32 con't be const, because runtime
+ relocations are performed -- see ld's documentation on pseudo-relocs. */
+# define LT_DLSYM_CONST
+#elif defined(__osf__)
+/* This system does not cope well with relocations in const data. */
+# define LT_DLSYM_CONST
+#else
+# define LT_DLSYM_CONST const
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+_LT_EOF
+ # Now generate the symbol file.
+ eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext'
+
+ cat <<_LT_EOF >> conftest.$ac_ext
+
+/* The mapping between symbol names and symbols. */
+LT_DLSYM_CONST struct {
+ const char *name;
+ void *address;
+}
+lt__PROGRAM__LTX_preloaded_symbols[] =
+{
+ { "@PROGRAM@", (void *) 0 },
+_LT_EOF
+ $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext
+ cat <<\_LT_EOF >> conftest.$ac_ext
+ {0, (void *) 0}
+};
+
+/* This works around a problem in FreeBSD linker */
+#ifdef FREEBSD_WORKAROUND
+static const void *lt_preloaded_setup() {
+ return lt__PROGRAM__LTX_preloaded_symbols;
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+_LT_EOF
+ # Now try linking the two files.
+ mv conftest.$ac_objext conftstm.$ac_objext
+ lt_globsym_save_LIBS=$LIBS
+ lt_globsym_save_CFLAGS=$CFLAGS
+ LIBS="conftstm.$ac_objext"
+ CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag"
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && test -s conftest${ac_exeext}; then
+ pipe_works=yes
+ fi
+ LIBS=$lt_globsym_save_LIBS
+ CFLAGS=$lt_globsym_save_CFLAGS
+ else
+ echo "cannot find nm_test_func in $nlist" >&5
+ fi
+ else
+ echo "cannot find nm_test_var in $nlist" >&5
+ fi
+ else
+ echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5
+ fi
+ else
+ echo "$progname: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ fi
+ rm -rf conftest* conftst*
+
+ # Do not use the global_symbol_pipe unless it works.
+ if test "$pipe_works" = yes; then
+ break
+ else
+ lt_cv_sys_global_symbol_pipe=
+ fi
+done
+
+fi
+
+if test -z "$lt_cv_sys_global_symbol_pipe"; then
+ lt_cv_sys_global_symbol_to_cdecl=
+fi
+if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5
+$as_echo "failed" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
+$as_echo "ok" >&6; }
+fi
+
+# Response file support.
+if test "$lt_cv_nm_interface" = "MS dumpbin"; then
+ nm_file_list_spec='@'
+elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then
+ nm_file_list_spec='@'
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5
+$as_echo_n "checking for sysroot... " >&6; }
+
+# Check whether --with-sysroot was given.
+if test "${with_sysroot+set}" = set; then :
+ withval=$with_sysroot;
+else
+ with_sysroot=no
+fi
+
+
+lt_sysroot=
+case ${with_sysroot} in #(
+ yes)
+ if test "$GCC" = yes; then
+ lt_sysroot=`$CC --print-sysroot 2>/dev/null`
+ fi
+ ;; #(
+ /*)
+ lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"`
+ ;; #(
+ no|'')
+ ;; #(
+ *)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_sysroot}" >&5
+$as_echo "${with_sysroot}" >&6; }
+ as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5
+ ;;
+esac
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5
+$as_echo "${lt_sysroot:-no}" >&6; }
+
+
+
+
+
+# Check whether --enable-libtool-lock was given.
+if test "${enable_libtool_lock+set}" = set; then :
+ enableval=$enable_libtool_lock;
+fi
+
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case $host in
+ia64-*-hpux*)
+ # Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ case `/usr/bin/file conftest.$ac_objext` in
+ *ELF-32*)
+ HPUX_IA64_MODE="32"
+ ;;
+ *ELF-64*)
+ HPUX_IA64_MODE="64"
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+*-*-irix6*)
+ # Find out which ABI we are using.
+ echo '#line '$LINENO' "configure"' > conftest.$ac_ext
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ if test "$lt_cv_prog_gnu_ld" = yes; then
+ case `/usr/bin/file conftest.$ac_objext` in
+ *32-bit*)
+ LD="${LD-ld} -melf32bsmip"
+ ;;
+ *N32*)
+ LD="${LD-ld} -melf32bmipn32"
+ ;;
+ *64-bit*)
+ LD="${LD-ld} -melf64bmip"
+ ;;
+ esac
+ else
+ case `/usr/bin/file conftest.$ac_objext` in
+ *32-bit*)
+ LD="${LD-ld} -32"
+ ;;
+ *N32*)
+ LD="${LD-ld} -n32"
+ ;;
+ *64-bit*)
+ LD="${LD-ld} -64"
+ ;;
+ esac
+ fi
+ fi
+ rm -rf conftest*
+ ;;
+
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
+s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
+ # Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ case `/usr/bin/file conftest.o` in
+ *32-bit*)
+ case $host in
+ x86_64-*kfreebsd*-gnu)
+ LD="${LD-ld} -m elf_i386_fbsd"
+ ;;
+ x86_64-*linux*)
+ case `/usr/bin/file conftest.o` in
+ *x86-64*)
+ LD="${LD-ld} -m elf32_x86_64"
+ ;;
+ *)
+ LD="${LD-ld} -m elf_i386"
+ ;;
+ esac
+ ;;
+ powerpc64le-*)
+ LD="${LD-ld} -m elf32lppclinux"
+ ;;
+ powerpc64-*)
+ LD="${LD-ld} -m elf32ppclinux"
+ ;;
+ s390x-*linux*)
+ LD="${LD-ld} -m elf_s390"
+ ;;
+ sparc64-*linux*)
+ LD="${LD-ld} -m elf32_sparc"
+ ;;
+ esac
+ ;;
+ *64-bit*)
+ case $host in
+ x86_64-*kfreebsd*-gnu)
+ LD="${LD-ld} -m elf_x86_64_fbsd"
+ ;;
+ x86_64-*linux*)
+ LD="${LD-ld} -m elf_x86_64"
+ ;;
+ powerpcle-*)
+ LD="${LD-ld} -m elf64lppc"
+ ;;
+ powerpc-*)
+ LD="${LD-ld} -m elf64ppc"
+ ;;
+ s390*-*linux*|s390*-*tpf*)
+ LD="${LD-ld} -m elf64_s390"
+ ;;
+ sparc*-*linux*)
+ LD="${LD-ld} -m elf64_sparc"
+ ;;
+ esac
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+
+*-*-sco3.2v5*)
+ # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+ SAVE_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -belf"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5
+$as_echo_n "checking whether the C compiler needs -belf... " >&6; }
+if ${lt_cv_cc_needs_belf+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ lt_cv_cc_needs_belf=yes
+else
+ lt_cv_cc_needs_belf=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5
+$as_echo "$lt_cv_cc_needs_belf" >&6; }
+ if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+ # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+ CFLAGS="$SAVE_CFLAGS"
+ fi
+ ;;
+*-*solaris*)
+ # Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ case `/usr/bin/file conftest.o` in
+ *64-bit*)
+ case $lt_cv_prog_gnu_ld in
+ yes*)
+ case $host in
+ i?86-*-solaris*)
+ LD="${LD-ld} -m elf_x86_64"
+ ;;
+ sparc*-*-solaris*)
+ LD="${LD-ld} -m elf64_sparc"
+ ;;
+ esac
+ # GNU ld 2.21 introduced _sol2 emulations. Use them if available.
+ if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then
+ LD="${LD-ld}_sol2"
+ fi
+ ;;
+ *)
+ if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
+ LD="${LD-ld} -64"
+ fi
+ ;;
+ esac
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+esac
+
+need_locks="$enable_libtool_lock"
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args.
+set dummy ${ac_tool_prefix}mt; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_MANIFEST_TOOL+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$MANIFEST_TOOL"; then
+ ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL
+if test -n "$MANIFEST_TOOL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5
+$as_echo "$MANIFEST_TOOL" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_MANIFEST_TOOL"; then
+ ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL
+ # Extract the first word of "mt", so it can be a program name with args.
+set dummy mt; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_MANIFEST_TOOL"; then
+ ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_MANIFEST_TOOL="mt"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL
+if test -n "$ac_ct_MANIFEST_TOOL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5
+$as_echo "$ac_ct_MANIFEST_TOOL" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_MANIFEST_TOOL" = x; then
+ MANIFEST_TOOL=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL
+ fi
+else
+ MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL"
+fi
+
+test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5
+$as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; }
+if ${lt_cv_path_mainfest_tool+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_path_mainfest_tool=no
+ echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5
+ $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out
+ cat conftest.err >&5
+ if $GREP 'Manifest Tool' conftest.out > /dev/null; then
+ lt_cv_path_mainfest_tool=yes
+ fi
+ rm -f conftest*
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5
+$as_echo "$lt_cv_path_mainfest_tool" >&6; }
+if test "x$lt_cv_path_mainfest_tool" != xyes; then
+ MANIFEST_TOOL=:
+fi
+
+
+
+
+
+
+ case $host_os in
+ rhapsody* | darwin*)
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args.
+set dummy ${ac_tool_prefix}dsymutil; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_DSYMUTIL+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$DSYMUTIL"; then
+ ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+DSYMUTIL=$ac_cv_prog_DSYMUTIL
+if test -n "$DSYMUTIL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5
+$as_echo "$DSYMUTIL" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_DSYMUTIL"; then
+ ac_ct_DSYMUTIL=$DSYMUTIL
+ # Extract the first word of "dsymutil", so it can be a program name with args.
+set dummy dsymutil; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_DSYMUTIL"; then
+ ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_DSYMUTIL="dsymutil"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL
+if test -n "$ac_ct_DSYMUTIL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5
+$as_echo "$ac_ct_DSYMUTIL" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_DSYMUTIL" = x; then
+ DSYMUTIL=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ DSYMUTIL=$ac_ct_DSYMUTIL
+ fi
+else
+ DSYMUTIL="$ac_cv_prog_DSYMUTIL"
+fi
+
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args.
+set dummy ${ac_tool_prefix}nmedit; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_NMEDIT+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$NMEDIT"; then
+ ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+NMEDIT=$ac_cv_prog_NMEDIT
+if test -n "$NMEDIT"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5
+$as_echo "$NMEDIT" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_NMEDIT"; then
+ ac_ct_NMEDIT=$NMEDIT
+ # Extract the first word of "nmedit", so it can be a program name with args.
+set dummy nmedit; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_NMEDIT"; then
+ ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_NMEDIT="nmedit"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT
+if test -n "$ac_ct_NMEDIT"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5
+$as_echo "$ac_ct_NMEDIT" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_NMEDIT" = x; then
+ NMEDIT=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ NMEDIT=$ac_ct_NMEDIT
+ fi
+else
+ NMEDIT="$ac_cv_prog_NMEDIT"
+fi
+
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args.
+set dummy ${ac_tool_prefix}lipo; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_LIPO+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$LIPO"; then
+ ac_cv_prog_LIPO="$LIPO" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_LIPO="${ac_tool_prefix}lipo"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+LIPO=$ac_cv_prog_LIPO
+if test -n "$LIPO"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5
+$as_echo "$LIPO" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_LIPO"; then
+ ac_ct_LIPO=$LIPO
+ # Extract the first word of "lipo", so it can be a program name with args.
+set dummy lipo; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_LIPO+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_LIPO"; then
+ ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_LIPO="lipo"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO
+if test -n "$ac_ct_LIPO"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5
+$as_echo "$ac_ct_LIPO" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_LIPO" = x; then
+ LIPO=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ LIPO=$ac_ct_LIPO
+ fi
+else
+ LIPO="$ac_cv_prog_LIPO"
+fi
+
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args.
+set dummy ${ac_tool_prefix}otool; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_OTOOL+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$OTOOL"; then
+ ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_OTOOL="${ac_tool_prefix}otool"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+OTOOL=$ac_cv_prog_OTOOL
+if test -n "$OTOOL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5
+$as_echo "$OTOOL" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OTOOL"; then
+ ac_ct_OTOOL=$OTOOL
+ # Extract the first word of "otool", so it can be a program name with args.
+set dummy otool; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_OTOOL+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_OTOOL"; then
+ ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_OTOOL="otool"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL
+if test -n "$ac_ct_OTOOL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5
+$as_echo "$ac_ct_OTOOL" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_OTOOL" = x; then
+ OTOOL=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ OTOOL=$ac_ct_OTOOL
+ fi
+else
+ OTOOL="$ac_cv_prog_OTOOL"
+fi
+
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args.
+set dummy ${ac_tool_prefix}otool64; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_OTOOL64+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$OTOOL64"; then
+ ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+OTOOL64=$ac_cv_prog_OTOOL64
+if test -n "$OTOOL64"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5
+$as_echo "$OTOOL64" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OTOOL64"; then
+ ac_ct_OTOOL64=$OTOOL64
+ # Extract the first word of "otool64", so it can be a program name with args.
+set dummy otool64; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_OTOOL64"; then
+ ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_OTOOL64="otool64"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64
+if test -n "$ac_ct_OTOOL64"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5
+$as_echo "$ac_ct_OTOOL64" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_OTOOL64" = x; then
+ OTOOL64=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ OTOOL64=$ac_ct_OTOOL64
+ fi
+else
+ OTOOL64="$ac_cv_prog_OTOOL64"
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5
+$as_echo_n "checking for -single_module linker flag... " >&6; }
+if ${lt_cv_apple_cc_single_mod+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_apple_cc_single_mod=no
+ if test -z "${LT_MULTI_MODULE}"; then
+ # By default we will add the -single_module flag. You can override
+ # by either setting the environment variable LT_MULTI_MODULE
+ # non-empty at configure time, or by adding -multi_module to the
+ # link flags.
+ rm -rf libconftest.dylib*
+ echo "int foo(void){return 1;}" > conftest.c
+ echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+-dynamiclib -Wl,-single_module conftest.c" >&5
+ $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err
+ _lt_result=$?
+ # If there is a non-empty error log, and "single_module"
+ # appears in it, assume the flag caused a linker warning
+ if test -s conftest.err && $GREP single_module conftest.err; then
+ cat conftest.err >&5
+ # Otherwise, if the output was created with a 0 exit code from
+ # the compiler, it worked.
+ elif test -f libconftest.dylib && test $_lt_result -eq 0; then
+ lt_cv_apple_cc_single_mod=yes
+ else
+ cat conftest.err >&5
+ fi
+ rm -rf libconftest.dylib*
+ rm -f conftest.*
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5
+$as_echo "$lt_cv_apple_cc_single_mod" >&6; }
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5
+$as_echo_n "checking for -exported_symbols_list linker flag... " >&6; }
+if ${lt_cv_ld_exported_symbols_list+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_ld_exported_symbols_list=no
+ save_LDFLAGS=$LDFLAGS
+ echo "_main" > conftest.sym
+ LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ lt_cv_ld_exported_symbols_list=yes
+else
+ lt_cv_ld_exported_symbols_list=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ LDFLAGS="$save_LDFLAGS"
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5
+$as_echo "$lt_cv_ld_exported_symbols_list" >&6; }
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5
+$as_echo_n "checking for -force_load linker flag... " >&6; }
+if ${lt_cv_ld_force_load+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_ld_force_load=no
+ cat > conftest.c << _LT_EOF
+int forced_loaded() { return 2;}
+_LT_EOF
+ echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5
+ $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5
+ echo "$AR cru libconftest.a conftest.o" >&5
+ $AR cru libconftest.a conftest.o 2>&5
+ echo "$RANLIB libconftest.a" >&5
+ $RANLIB libconftest.a 2>&5
+ cat > conftest.c << _LT_EOF
+int main() { return 0;}
+_LT_EOF
+ echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5
+ $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err
+ _lt_result=$?
+ if test -s conftest.err && $GREP force_load conftest.err; then
+ cat conftest.err >&5
+ elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then
+ lt_cv_ld_force_load=yes
+ else
+ cat conftest.err >&5
+ fi
+ rm -f conftest.err libconftest.a conftest conftest.c
+ rm -rf conftest.dSYM
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5
+$as_echo "$lt_cv_ld_force_load" >&6; }
+ case $host_os in
+ rhapsody* | darwin1.[012])
+ _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
+ darwin1.*)
+ _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+ darwin*) # darwin 5.x on
+ # if running on 10.5 or later, the deployment target defaults
+ # to the OS version, if on x86, and 10.4, the deployment
+ # target defaults to 10.4. Don't you love it?
+ case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
+ 10.0,*86*-darwin8*|10.0,*-darwin[91]*)
+ _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+ 10.[012]*)
+ _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+ 10.*)
+ _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+ esac
+ ;;
+ esac
+ if test "$lt_cv_apple_cc_single_mod" = "yes"; then
+ _lt_dar_single_mod='$single_module'
+ fi
+ if test "$lt_cv_ld_exported_symbols_list" = "yes"; then
+ _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym'
+ else
+ _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ fi
+ if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then
+ _lt_dsymutil='~$DSYMUTIL $lib || :'
+ else
+ _lt_dsymutil=
+ fi
+ ;;
+ esac
+
+for ac_header in dlfcn.h
+do :
+ ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default
+"
+if test "x$ac_cv_header_dlfcn_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_DLFCN_H 1
+_ACEOF
+
+fi
+
+done
+
+
+
+
+
+# Set options
+
+
+
+ enable_dlopen=no
+
+
+ enable_win32_dll=no
+
+
+ # Check whether --enable-shared was given.
+if test "${enable_shared+set}" = set; then :
+ enableval=$enable_shared; p=${PACKAGE-default}
+ case $enableval in
+ yes) enable_shared=yes ;;
+ no) enable_shared=no ;;
+ *)
+ enable_shared=no
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for pkg in $enableval; do
+ IFS="$lt_save_ifs"
+ if test "X$pkg" = "X$p"; then
+ enable_shared=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac
+else
+ enable_shared=yes
+fi
+
+
+
+
+
+
+
+
+
+ # Check whether --enable-static was given.
+if test "${enable_static+set}" = set; then :
+ enableval=$enable_static; p=${PACKAGE-default}
+ case $enableval in
+ yes) enable_static=yes ;;
+ no) enable_static=no ;;
+ *)
+ enable_static=no
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for pkg in $enableval; do
+ IFS="$lt_save_ifs"
+ if test "X$pkg" = "X$p"; then
+ enable_static=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac
+else
+ enable_static=yes
+fi
+
+
+
+
+
+
+
+
+
+
+# Check whether --with-pic was given.
+if test "${with_pic+set}" = set; then :
+ withval=$with_pic; lt_p=${PACKAGE-default}
+ case $withval in
+ yes|no) pic_mode=$withval ;;
+ *)
+ pic_mode=default
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for lt_pkg in $withval; do
+ IFS="$lt_save_ifs"
+ if test "X$lt_pkg" = "X$lt_p"; then
+ pic_mode=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac
+else
+ pic_mode=default
+fi
+
+
+test -z "$pic_mode" && pic_mode=default
+
+
+
+
+
+
+
+ # Check whether --enable-fast-install was given.
+if test "${enable_fast_install+set}" = set; then :
+ enableval=$enable_fast_install; p=${PACKAGE-default}
+ case $enableval in
+ yes) enable_fast_install=yes ;;
+ no) enable_fast_install=no ;;
+ *)
+ enable_fast_install=no
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for pkg in $enableval; do
+ IFS="$lt_save_ifs"
+ if test "X$pkg" = "X$p"; then
+ enable_fast_install=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac
+else
+ enable_fast_install=yes
+fi
+
+
+
+
+
+
+
+
+
+
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ltmain"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+test -z "$LN_S" && LN_S="ln -s"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+if test -n "${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5
+$as_echo_n "checking for objdir... " >&6; }
+if ${lt_cv_objdir+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ rm -f .libs 2>/dev/null
+mkdir .libs 2>/dev/null
+if test -d .libs; then
+ lt_cv_objdir=.libs
+else
+ # MS-DOS does not allow filenames that begin with a dot.
+ lt_cv_objdir=_libs
+fi
+rmdir .libs 2>/dev/null
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5
+$as_echo "$lt_cv_objdir" >&6; }
+objdir=$lt_cv_objdir
+
+
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define LT_OBJDIR "$lt_cv_objdir/"
+_ACEOF
+
+
+
+
+case $host_os in
+aix3*)
+ # AIX sometimes has problems with the GCC collect2 program. For some
+ # reason, if we set the COLLECT_NAMES environment variable, the problems
+ # vanish in a puff of smoke.
+ if test "X${COLLECT_NAMES+set}" != Xset; then
+ COLLECT_NAMES=
+ export COLLECT_NAMES
+ fi
+ ;;
+esac
+
+# Global variables:
+ofile=libtool
+can_build_shared=yes
+
+# All known linkers require a `.a' archive for static linking (except MSVC,
+# which needs '.lib').
+libext=a
+
+with_gnu_ld="$lt_cv_prog_gnu_ld"
+
+old_CC="$CC"
+old_CFLAGS="$CFLAGS"
+
+# Set sane defaults for various variables
+test -z "$CC" && CC=cc
+test -z "$LTCC" && LTCC=$CC
+test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS
+test -z "$LD" && LD=ld
+test -z "$ac_objext" && ac_objext=o
+
+for cc_temp in $compiler""; do
+ case $cc_temp in
+ compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+ distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+ \-*) ;;
+ *) break;;
+ esac
+done
+cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
+
+
+# Only perform the check for file, if the check method requires it
+test -z "$MAGIC_CMD" && MAGIC_CMD=file
+case $deplibs_check_method in
+file_magic*)
+ if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5
+$as_echo_n "checking for ${ac_tool_prefix}file... " >&6; }
+if ${lt_cv_path_MAGIC_CMD+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $MAGIC_CMD in
+[\\/*] | ?:[\\/]*)
+ lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+ ;;
+*)
+ lt_save_MAGIC_CMD="$MAGIC_CMD"
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ ac_dummy="/usr/bin$PATH_SEPARATOR$PATH"
+ for ac_dir in $ac_dummy; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/${ac_tool_prefix}file; then
+ lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file"
+ if test -n "$file_magic_test_file"; then
+ case $deplibs_check_method in
+ "file_magic "*)
+ file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+ MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+ if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+ $EGREP "$file_magic_regex" > /dev/null; then
+ :
+ else
+ cat <<_LT_EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such. This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem. Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+_LT_EOF
+ fi ;;
+ esac
+ fi
+ break
+ fi
+ done
+ IFS="$lt_save_ifs"
+ MAGIC_CMD="$lt_save_MAGIC_CMD"
+ ;;
+esac
+fi
+
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5
+$as_echo "$MAGIC_CMD" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+
+
+
+if test -z "$lt_cv_path_MAGIC_CMD"; then
+ if test -n "$ac_tool_prefix"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5
+$as_echo_n "checking for file... " >&6; }
+if ${lt_cv_path_MAGIC_CMD+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $MAGIC_CMD in
+[\\/*] | ?:[\\/]*)
+ lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+ ;;
+*)
+ lt_save_MAGIC_CMD="$MAGIC_CMD"
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ ac_dummy="/usr/bin$PATH_SEPARATOR$PATH"
+ for ac_dir in $ac_dummy; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/file; then
+ lt_cv_path_MAGIC_CMD="$ac_dir/file"
+ if test -n "$file_magic_test_file"; then
+ case $deplibs_check_method in
+ "file_magic "*)
+ file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+ MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+ if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+ $EGREP "$file_magic_regex" > /dev/null; then
+ :
+ else
+ cat <<_LT_EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such. This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem. Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+_LT_EOF
+ fi ;;
+ esac
+ fi
+ break
+ fi
+ done
+ IFS="$lt_save_ifs"
+ MAGIC_CMD="$lt_save_MAGIC_CMD"
+ ;;
+esac
+fi
+
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5
+$as_echo "$MAGIC_CMD" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ else
+ MAGIC_CMD=:
+ fi
+fi
+
+ fi
+ ;;
+esac
+
+# Use C for the default configuration in the libtool script
+
+lt_save_CC="$CC"
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+# Source file extension for C test sources.
+ac_ext=c
+
+# Object file extension for compiled C test sources.
+objext=o
+objext=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(){return(0);}'
+
+
+
+
+
+
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+# Save the default compiler, since it gets overwritten when the other
+# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP.
+compiler_DEFAULT=$CC
+
+# save warnings/boilerplate of simple test code
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$RM conftest*
+
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$RM -r conftest*
+
+
+## CAVEAT EMPTOR:
+## There is no encapsulation within the following macros, do not change
+## the running order or otherwise move them around unless you know exactly
+## what you are doing...
+if test -n "$compiler"; then
+
+lt_prog_compiler_no_builtin_flag=
+
+if test "$GCC" = yes; then
+ case $cc_basename in
+ nvcc*)
+ lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;;
+ *)
+ lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;;
+ esac
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
+$as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; }
+if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler_rtti_exceptions=no
+ ac_outfile=conftest.$ac_objext
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+ lt_compiler_flag="-fno-rtti -fno-exceptions"
+ # Insert the option either (1) after the last *FLAGS variable, or
+ # (2) before a word containing "conftest.", or (3) at the end.
+ # Note that $ac_compile itself does not contain backslashes and begins
+ # with a dollar sign (not a hyphen), so the echo should work correctly.
+ # The option is referenced via a variable to avoid confusing sed.
+ lt_compile=`echo "$ac_compile" | $SED \
+ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>conftest.err)
+ ac_status=$?
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ if (exit $ac_status) && test -s "$ac_outfile"; then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings other than the usual output.
+ $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler_rtti_exceptions=yes
+ fi
+ fi
+ $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5
+$as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; }
+
+if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then
+ lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions"
+else
+ :
+fi
+
+fi
+
+
+
+
+
+
+ lt_prog_compiler_wl=
+lt_prog_compiler_pic=
+lt_prog_compiler_static=
+
+
+ if test "$GCC" = yes; then
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_static='-static'
+
+ case $host_os in
+ aix*)
+ # All AIX code is PIC.
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ lt_prog_compiler_static='-Bstatic'
+ fi
+ ;;
+
+ amigaos*)
+ case $host_cpu in
+ powerpc)
+ # see comment about AmigaOS4 .so support
+ lt_prog_compiler_pic='-fPIC'
+ ;;
+ m68k)
+ # FIXME: we need at least 68020 code to build shared libraries, but
+ # adding the `-m68020' flag to GCC prevents building anything better,
+ # like `-m68040'.
+ lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4'
+ ;;
+ esac
+ ;;
+
+ beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+ # PIC is the default for these OSes.
+ ;;
+
+ mingw* | cygwin* | pw32* | os2* | cegcc*)
+ # This hack is so that the source file can tell whether it is being
+ # built for inclusion in a dll (and should export symbols for example).
+ # Although the cygwin gcc ignores -fPIC, still need this for old-style
+ # (--disable-auto-import) libraries
+ lt_prog_compiler_pic='-DDLL_EXPORT'
+ ;;
+
+ darwin* | rhapsody*)
+ # PIC is the default on this platform
+ # Common symbols not allowed in MH_DYLIB files
+ lt_prog_compiler_pic='-fno-common'
+ ;;
+
+ haiku*)
+ # PIC is the default for Haiku.
+ # The "-static" flag exists, but is broken.
+ lt_prog_compiler_static=
+ ;;
+
+ hpux*)
+ # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
+ # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag
+ # sets the default TLS model and affects inlining.
+ case $host_cpu in
+ hppa*64*)
+ # +Z the default
+ ;;
+ *)
+ lt_prog_compiler_pic='-fPIC'
+ ;;
+ esac
+ ;;
+
+ interix[3-9]*)
+ # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+ # Instead, we relocate shared libraries at runtime.
+ ;;
+
+ msdosdjgpp*)
+ # Just because we use GCC doesn't mean we suddenly get shared libraries
+ # on systems that don't support them.
+ lt_prog_compiler_can_build_shared=no
+ enable_shared=no
+ ;;
+
+ *nto* | *qnx*)
+ # QNX uses GNU C++, but need to define -shared option too, otherwise
+ # it will coredump.
+ lt_prog_compiler_pic='-fPIC -shared'
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ lt_prog_compiler_pic=-Kconform_pic
+ fi
+ ;;
+
+ *)
+ lt_prog_compiler_pic='-fPIC'
+ ;;
+ esac
+
+ case $cc_basename in
+ nvcc*) # Cuda Compiler Driver 2.2
+ lt_prog_compiler_wl='-Xlinker '
+ if test -n "$lt_prog_compiler_pic"; then
+ lt_prog_compiler_pic="-Xcompiler $lt_prog_compiler_pic"
+ fi
+ ;;
+ esac
+ else
+ # PORTME Check for flag to pass linker flags through the system compiler.
+ case $host_os in
+ aix*)
+ lt_prog_compiler_wl='-Wl,'
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ lt_prog_compiler_static='-Bstatic'
+ else
+ lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp'
+ fi
+ ;;
+
+ mingw* | cygwin* | pw32* | os2* | cegcc*)
+ # This hack is so that the source file can tell whether it is being
+ # built for inclusion in a dll (and should export symbols for example).
+ lt_prog_compiler_pic='-DDLL_EXPORT'
+ ;;
+
+ hpux9* | hpux10* | hpux11*)
+ lt_prog_compiler_wl='-Wl,'
+ # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+ # not for PA HP-UX.
+ case $host_cpu in
+ hppa*64*|ia64*)
+ # +Z the default
+ ;;
+ *)
+ lt_prog_compiler_pic='+Z'
+ ;;
+ esac
+ # Is there a better lt_prog_compiler_static that works with the bundled CC?
+ lt_prog_compiler_static='${wl}-a ${wl}archive'
+ ;;
+
+ irix5* | irix6* | nonstopux*)
+ lt_prog_compiler_wl='-Wl,'
+ # PIC (with -KPIC) is the default.
+ lt_prog_compiler_static='-non_shared'
+ ;;
+
+ linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
+ case $cc_basename in
+ # old Intel for x86_64 which still supported -KPIC.
+ ecc*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-static'
+ ;;
+ # icc used to be incompatible with GCC.
+ # ICC 10 doesn't accept -KPIC any more.
+ icc* | ifort*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-fPIC'
+ lt_prog_compiler_static='-static'
+ ;;
+ # Lahey Fortran 8.1.
+ lf95*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='--shared'
+ lt_prog_compiler_static='--static'
+ ;;
+ nagfor*)
+ # NAG Fortran compiler
+ lt_prog_compiler_wl='-Wl,-Wl,,'
+ lt_prog_compiler_pic='-PIC'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+ pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
+ # Portland Group compilers (*not* the Pentium gcc compiler,
+ # which looks to be a dead project)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-fpic'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+ ccc*)
+ lt_prog_compiler_wl='-Wl,'
+ # All Alpha code is PIC.
+ lt_prog_compiler_static='-non_shared'
+ ;;
+ xl* | bgxl* | bgf* | mpixl*)
+ # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-qpic'
+ lt_prog_compiler_static='-qstaticlink'
+ ;;
+ *)
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*)
+ # Sun Fortran 8.3 passes all unrecognized flags to the linker
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ lt_prog_compiler_wl=''
+ ;;
+ *Sun\ F* | *Sun*Fortran*)
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ lt_prog_compiler_wl='-Qoption ld '
+ ;;
+ *Sun\ C*)
+ # Sun C 5.9
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ lt_prog_compiler_wl='-Wl,'
+ ;;
+ *Intel*\ [CF]*Compiler*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-fPIC'
+ lt_prog_compiler_static='-static'
+ ;;
+ *Portland\ Group*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-fpic'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+
+ newsos6)
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+
+ *nto* | *qnx*)
+ # QNX uses GNU C++, but need to define -shared option too, otherwise
+ # it will coredump.
+ lt_prog_compiler_pic='-fPIC -shared'
+ ;;
+
+ osf3* | osf4* | osf5*)
+ lt_prog_compiler_wl='-Wl,'
+ # All OSF/1 code is PIC.
+ lt_prog_compiler_static='-non_shared'
+ ;;
+
+ rdos*)
+ lt_prog_compiler_static='-non_shared'
+ ;;
+
+ solaris*)
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ case $cc_basename in
+ f77* | f90* | f95* | sunf77* | sunf90* | sunf95*)
+ lt_prog_compiler_wl='-Qoption ld ';;
+ *)
+ lt_prog_compiler_wl='-Wl,';;
+ esac
+ ;;
+
+ sunos4*)
+ lt_prog_compiler_wl='-Qoption ld '
+ lt_prog_compiler_pic='-PIC'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+
+ sysv4 | sysv4.2uw2* | sysv4.3*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec ;then
+ lt_prog_compiler_pic='-Kconform_pic'
+ lt_prog_compiler_static='-Bstatic'
+ fi
+ ;;
+
+ sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+
+ unicos*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_can_build_shared=no
+ ;;
+
+ uts4*)
+ lt_prog_compiler_pic='-pic'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+
+ *)
+ lt_prog_compiler_can_build_shared=no
+ ;;
+ esac
+ fi
+
+case $host_os in
+ # For platforms which do not support PIC, -DPIC is meaningless:
+ *djgpp*)
+ lt_prog_compiler_pic=
+ ;;
+ *)
+ lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC"
+ ;;
+esac
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5
+$as_echo_n "checking for $compiler option to produce PIC... " >&6; }
+if ${lt_cv_prog_compiler_pic+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler_pic=$lt_prog_compiler_pic
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5
+$as_echo "$lt_cv_prog_compiler_pic" >&6; }
+lt_prog_compiler_pic=$lt_cv_prog_compiler_pic
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$lt_prog_compiler_pic"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5
+$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; }
+if ${lt_cv_prog_compiler_pic_works+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler_pic_works=no
+ ac_outfile=conftest.$ac_objext
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+ lt_compiler_flag="$lt_prog_compiler_pic -DPIC"
+ # Insert the option either (1) after the last *FLAGS variable, or
+ # (2) before a word containing "conftest.", or (3) at the end.
+ # Note that $ac_compile itself does not contain backslashes and begins
+ # with a dollar sign (not a hyphen), so the echo should work correctly.
+ # The option is referenced via a variable to avoid confusing sed.
+ lt_compile=`echo "$ac_compile" | $SED \
+ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>conftest.err)
+ ac_status=$?
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ if (exit $ac_status) && test -s "$ac_outfile"; then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings other than the usual output.
+ $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler_pic_works=yes
+ fi
+ fi
+ $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5
+$as_echo "$lt_cv_prog_compiler_pic_works" >&6; }
+
+if test x"$lt_cv_prog_compiler_pic_works" = xyes; then
+ case $lt_prog_compiler_pic in
+ "" | " "*) ;;
+ *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;;
+ esac
+else
+ lt_prog_compiler_pic=
+ lt_prog_compiler_can_build_shared=no
+fi
+
+fi
+
+
+
+
+
+
+
+
+
+
+
+#
+# Check to make sure the static flag actually works.
+#
+wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5
+$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; }
+if ${lt_cv_prog_compiler_static_works+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler_static_works=no
+ save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
+ echo "$lt_simple_link_test_code" > conftest.$ac_ext
+ if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+ # The linker can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ if test -s conftest.err; then
+ # Append any errors to the config.log.
+ cat conftest.err 1>&5
+ $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if diff conftest.exp conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler_static_works=yes
+ fi
+ else
+ lt_cv_prog_compiler_static_works=yes
+ fi
+ fi
+ $RM -r conftest*
+ LDFLAGS="$save_LDFLAGS"
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5
+$as_echo "$lt_cv_prog_compiler_static_works" >&6; }
+
+if test x"$lt_cv_prog_compiler_static_works" = xyes; then
+ :
+else
+ lt_prog_compiler_static=
+fi
+
+
+
+
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
+$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
+if ${lt_cv_prog_compiler_c_o+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler_c_o=no
+ $RM -r conftest 2>/dev/null
+ mkdir conftest
+ cd conftest
+ mkdir out
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+ lt_compiler_flag="-o out/conftest2.$ac_objext"
+ # Insert the option either (1) after the last *FLAGS variable, or
+ # (2) before a word containing "conftest.", or (3) at the end.
+ # Note that $ac_compile itself does not contain backslashes and begins
+ # with a dollar sign (not a hyphen), so the echo should work correctly.
+ lt_compile=`echo "$ac_compile" | $SED \
+ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>out/conftest.err)
+ ac_status=$?
+ cat out/conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ if (exit $ac_status) && test -s out/conftest2.$ac_objext
+ then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
+ $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+ if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler_c_o=yes
+ fi
+ fi
+ chmod u+w . 2>&5
+ $RM conftest*
+ # SGI C++ compiler will create directory out/ii_files/ for
+ # template instantiation
+ test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
+ $RM out/* && rmdir out
+ cd ..
+ $RM -r conftest
+ $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5
+$as_echo "$lt_cv_prog_compiler_c_o" >&6; }
+
+
+
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
+$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
+if ${lt_cv_prog_compiler_c_o+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler_c_o=no
+ $RM -r conftest 2>/dev/null
+ mkdir conftest
+ cd conftest
+ mkdir out
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+ lt_compiler_flag="-o out/conftest2.$ac_objext"
+ # Insert the option either (1) after the last *FLAGS variable, or
+ # (2) before a word containing "conftest.", or (3) at the end.
+ # Note that $ac_compile itself does not contain backslashes and begins
+ # with a dollar sign (not a hyphen), so the echo should work correctly.
+ lt_compile=`echo "$ac_compile" | $SED \
+ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>out/conftest.err)
+ ac_status=$?
+ cat out/conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ if (exit $ac_status) && test -s out/conftest2.$ac_objext
+ then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
+ $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+ if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler_c_o=yes
+ fi
+ fi
+ chmod u+w . 2>&5
+ $RM conftest*
+ # SGI C++ compiler will create directory out/ii_files/ for
+ # template instantiation
+ test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
+ $RM out/* && rmdir out
+ cd ..
+ $RM -r conftest
+ $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5
+$as_echo "$lt_cv_prog_compiler_c_o" >&6; }
+
+
+
+
+hard_links="nottested"
+if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then
+ # do not overwrite the value of need_locks provided by the user
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5
+$as_echo_n "checking if we can lock with hard links... " >&6; }
+ hard_links=yes
+ $RM conftest*
+ ln conftest.a conftest.b 2>/dev/null && hard_links=no
+ touch conftest.a
+ ln conftest.a conftest.b 2>&5 || hard_links=no
+ ln conftest.a conftest.b 2>/dev/null && hard_links=no
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5
+$as_echo "$hard_links" >&6; }
+ if test "$hard_links" = no; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
+$as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
+ need_locks=warn
+ fi
+else
+ need_locks=no
+fi
+
+
+
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; }
+
+ runpath_var=
+ allow_undefined_flag=
+ always_export_symbols=no
+ archive_cmds=
+ archive_expsym_cmds=
+ compiler_needs_object=no
+ enable_shared_with_static_runtimes=no
+ export_dynamic_flag_spec=
+ export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+ hardcode_automatic=no
+ hardcode_direct=no
+ hardcode_direct_absolute=no
+ hardcode_libdir_flag_spec=
+ hardcode_libdir_separator=
+ hardcode_minus_L=no
+ hardcode_shlibpath_var=unsupported
+ inherit_rpath=no
+ link_all_deplibs=unknown
+ module_cmds=
+ module_expsym_cmds=
+ old_archive_from_new_cmds=
+ old_archive_from_expsyms_cmds=
+ thread_safe_flag_spec=
+ whole_archive_flag_spec=
+ # include_expsyms should be a list of space-separated symbols to be *always*
+ # included in the symbol list
+ include_expsyms=
+ # exclude_expsyms can be an extended regexp of symbols to exclude
+ # it will be wrapped by ` (' and `)$', so one must not match beginning or
+ # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+ # as well as any symbol that contains `d'.
+ exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'
+ # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+ # platforms (ab)use it in PIC code, but their linkers get confused if
+ # the symbol is explicitly referenced. Since portable code cannot
+ # rely on this symbol name, it's probably fine to never include it in
+ # preloaded symbol tables.
+ # Exclude shared library initialization/finalization symbols.
+ extract_expsyms_cmds=
+
+ case $host_os in
+ cygwin* | mingw* | pw32* | cegcc*)
+ # FIXME: the MSVC++ port hasn't been tested in a loooong time
+ # When not using gcc, we currently assume that we are using
+ # Microsoft Visual C++.
+ if test "$GCC" != yes; then
+ with_gnu_ld=no
+ fi
+ ;;
+ interix*)
+ # we just hope/assume this is gcc and not c89 (= MSVC++)
+ with_gnu_ld=yes
+ ;;
+ openbsd*)
+ with_gnu_ld=no
+ ;;
+ linux* | k*bsd*-gnu | gnu*)
+ link_all_deplibs=no
+ ;;
+ esac
+
+ ld_shlibs=yes
+
+ # On some targets, GNU ld is compatible enough with the native linker
+ # that we're better off using the native interface for both.
+ lt_use_gnu_ld_interface=no
+ if test "$with_gnu_ld" = yes; then
+ case $host_os in
+ aix*)
+ # The AIX port of GNU ld has always aspired to compatibility
+ # with the native linker. However, as the warning in the GNU ld
+ # block says, versions before 2.19.5* couldn't really create working
+ # shared libraries, regardless of the interface used.
+ case `$LD -v 2>&1` in
+ *\ \(GNU\ Binutils\)\ 2.19.5*) ;;
+ *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;;
+ *\ \(GNU\ Binutils\)\ [3-9]*) ;;
+ *)
+ lt_use_gnu_ld_interface=yes
+ ;;
+ esac
+ ;;
+ *)
+ lt_use_gnu_ld_interface=yes
+ ;;
+ esac
+ fi
+
+ if test "$lt_use_gnu_ld_interface" = yes; then
+ # If archive_cmds runs LD, not CC, wlarc should be empty
+ wlarc='${wl}'
+
+ # Set some defaults for GNU ld with shared library support. These
+ # are reset later if shared libraries are not supported. Putting them
+ # here allows them to be overridden if necessary.
+ runpath_var=LD_RUN_PATH
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ export_dynamic_flag_spec='${wl}--export-dynamic'
+ # ancient GNU ld didn't support --whole-archive et. al.
+ if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then
+ whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+ else
+ whole_archive_flag_spec=
+ fi
+ supports_anon_versioning=no
+ case `$LD -v 2>&1` in
+ *GNU\ gold*) supports_anon_versioning=yes ;;
+ *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
+ *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+ *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+ *\ 2.11.*) ;; # other 2.11 versions
+ *) supports_anon_versioning=yes ;;
+ esac
+
+ # See if GNU ld supports shared libraries.
+ case $host_os in
+ aix[3-9]*)
+ # On AIX/PPC, the GNU linker is very broken
+ if test "$host_cpu" != ia64; then
+ ld_shlibs=no
+ cat <<_LT_EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.19, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support. If you
+*** really care for shared libraries, you may want to install binutils
+*** 2.20 or above, or modify your PATH so that a non-GNU linker is found.
+*** You will then need to restart the configuration process.
+
+_LT_EOF
+ fi
+ ;;
+
+ amigaos*)
+ case $host_cpu in
+ powerpc)
+ # see comment about AmigaOS4 .so support
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds=''
+ ;;
+ m68k)
+ archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+ ;;
+ esac
+ ;;
+
+ beos*)
+ if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ allow_undefined_flag=unsupported
+ # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+ # support --undefined. This deserves some investigation. FIXME
+ archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+
+ cygwin* | mingw* | pw32* | cegcc*)
+ # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless,
+ # as there is no search path for DLLs.
+ hardcode_libdir_flag_spec='-L$libdir'
+ export_dynamic_flag_spec='${wl}--export-all-symbols'
+ allow_undefined_flag=unsupported
+ always_export_symbols=no
+ enable_shared_with_static_runtimes=yes
+ export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols'
+ exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'
+
+ if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ # If the export-symbols file already is a .def file (1st line
+ # is EXPORTS), use it as is; otherwise, prepend...
+ archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+ cp $export_symbols $output_objdir/$soname.def;
+ else
+ echo EXPORTS > $output_objdir/$soname.def;
+ cat $export_symbols >> $output_objdir/$soname.def;
+ fi~
+ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+
+ haiku*)
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ link_all_deplibs=yes
+ ;;
+
+ interix[3-9]*)
+ hardcode_direct=no
+ hardcode_shlibpath_var=no
+ hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+ export_dynamic_flag_spec='${wl}-E'
+ # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+ # Instead, shared libraries are loaded at an image base (0x10000000 by
+ # default) and relocated if they conflict, which is a slow very memory
+ # consuming and fragmenting process. To avoid this, we pick a random,
+ # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+ # time. Moving up from 0x10000000 also allows more sbrk(2) space.
+ archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+ archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+ ;;
+
+ gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
+ tmp_diet=no
+ if test "$host_os" = linux-dietlibc; then
+ case $cc_basename in
+ diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn)
+ esac
+ fi
+ if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
+ && test "$tmp_diet" = no
+ then
+ tmp_addflag=' $pic_flag'
+ tmp_sharedflag='-shared'
+ case $cc_basename,$host_cpu in
+ pgcc*) # Portland Group C compiler
+ whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+ tmp_addflag=' $pic_flag'
+ ;;
+ pgf77* | pgf90* | pgf95* | pgfortran*)
+ # Portland Group f77 and f90 compilers
+ whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+ tmp_addflag=' $pic_flag -Mnomain' ;;
+ ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64
+ tmp_addflag=' -i_dynamic' ;;
+ efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64
+ tmp_addflag=' -i_dynamic -nofor_main' ;;
+ ifc* | ifort*) # Intel Fortran compiler
+ tmp_addflag=' -nofor_main' ;;
+ lf95*) # Lahey Fortran 8.1
+ whole_archive_flag_spec=
+ tmp_sharedflag='--shared' ;;
+ xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below)
+ tmp_sharedflag='-qmkshrobj'
+ tmp_addflag= ;;
+ nvcc*) # Cuda Compiler Driver 2.2
+ whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+ compiler_needs_object=yes
+ ;;
+ esac
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ C*) # Sun C 5.9
+ whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+ compiler_needs_object=yes
+ tmp_sharedflag='-G' ;;
+ *Sun\ F*) # Sun Fortran 8.3
+ tmp_sharedflag='-G' ;;
+ esac
+ archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+
+ if test "x$supports_anon_versioning" = xyes; then
+ archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~
+ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+ echo "local: *; };" >> $output_objdir/$libname.ver~
+ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+ fi
+
+ case $cc_basename in
+ xlf* | bgf* | bgxlf* | mpixlf*)
+ # IBM XL Fortran 10.1 on PPC cannot create shared libs itself
+ whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive'
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'
+ if test "x$supports_anon_versioning" = xyes; then
+ archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~
+ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+ echo "local: *; };" >> $output_objdir/$libname.ver~
+ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
+ fi
+ ;;
+ esac
+ else
+ ld_shlibs=no
+ fi
+ ;;
+
+ netbsd* | netbsdelf*-gnu)
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+ archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+ wlarc=
+ else
+ archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ fi
+ ;;
+
+ solaris*)
+ if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then
+ ld_shlibs=no
+ cat <<_LT_EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems. Therefore, libtool
+*** is disabling shared libraries support. We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer. Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+ elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+
+ sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
+ case `$LD -v 2>&1` in
+ *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
+ ld_shlibs=no
+ cat <<_LT_EOF 1>&2
+
+*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
+*** reliably create shared libraries on SCO systems. Therefore, libtool
+*** is disabling shared libraries support. We urge you to upgrade GNU
+*** binutils to release 2.16.91.0.3 or newer. Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+ ;;
+ *)
+ # For security reasons, it is highly recommended that you always
+ # use absolute paths for naming shared libraries, and exclude the
+ # DT_RUNPATH tag from executables and libraries. But doing so
+ # requires that you compile everything twice, which is a pain.
+ if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+ esac
+ ;;
+
+ sunos4*)
+ archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ wlarc=
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ *)
+ if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+ esac
+
+ if test "$ld_shlibs" = no; then
+ runpath_var=
+ hardcode_libdir_flag_spec=
+ export_dynamic_flag_spec=
+ whole_archive_flag_spec=
+ fi
+ else
+ # PORTME fill in a description of your system's linker (not GNU ld)
+ case $host_os in
+ aix3*)
+ allow_undefined_flag=unsupported
+ always_export_symbols=yes
+ archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+ # Note: this linker hardcodes the directories in LIBPATH if there
+ # are no directories specified by -L.
+ hardcode_minus_L=yes
+ if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
+ # Neither direct hardcoding nor static linking is supported with a
+ # broken collect2.
+ hardcode_direct=unsupported
+ fi
+ ;;
+
+ aix[4-9]*)
+ if test "$host_cpu" = ia64; then
+ # On IA64, the linker does run time linking by default, so we don't
+ # have to do anything special.
+ aix_use_runtimelinking=no
+ exp_sym_flag='-Bexport'
+ no_entry_flag=""
+ else
+ # If we're using GNU nm, then we don't want the "-C" option.
+ # -C means demangle to AIX nm, but means don't demangle with GNU nm
+ # Also, AIX nm treats weak defined symbols like other global
+ # defined symbols, whereas GNU nm marks them as "W".
+ if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
+ export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+ else
+ export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+ fi
+ aix_use_runtimelinking=no
+
+ # Test if we are trying to use run time linking or normal
+ # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+ # need to do runtime linking.
+ case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)
+ for ld_flag in $LDFLAGS; do
+ if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+ aix_use_runtimelinking=yes
+ break
+ fi
+ done
+ ;;
+ esac
+
+ exp_sym_flag='-bexport'
+ no_entry_flag='-bnoentry'
+ fi
+
+ # When large executables or shared objects are built, AIX ld can
+ # have problems creating the table of contents. If linking a library
+ # or program results in "error TOC overflow" add -mminimal-toc to
+ # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not
+ # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+ archive_cmds=''
+ hardcode_direct=yes
+ hardcode_direct_absolute=yes
+ hardcode_libdir_separator=':'
+ link_all_deplibs=yes
+ file_list_spec='${wl}-f,'
+
+ if test "$GCC" = yes; then
+ case $host_os in aix4.[012]|aix4.[012].*)
+ # We only want to do this on AIX 4.2 and lower, the check
+ # below for broken collect2 doesn't work under 4.3+
+ collect2name=`${CC} -print-prog-name=collect2`
+ if test -f "$collect2name" &&
+ strings "$collect2name" | $GREP resolve_lib_name >/dev/null
+ then
+ # We have reworked collect2
+ :
+ else
+ # We have old collect2
+ hardcode_direct=unsupported
+ # It fails to find uninstalled libraries when the uninstalled
+ # path is not listed in the libpath. Setting hardcode_minus_L
+ # to unsupported forces relinking
+ hardcode_minus_L=yes
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_libdir_separator=
+ fi
+ ;;
+ esac
+ shared_flag='-shared'
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag="$shared_flag "'${wl}-G'
+ fi
+ link_all_deplibs=no
+ else
+ # not using gcc
+ if test "$host_cpu" = ia64; then
+ # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+ # chokes on -Wl,-G. The following line is correct:
+ shared_flag='-G'
+ else
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag='${wl}-G'
+ else
+ shared_flag='${wl}-bM:SRE'
+ fi
+ fi
+ fi
+
+ export_dynamic_flag_spec='${wl}-bexpall'
+ # It seems that -bexpall does not export symbols beginning with
+ # underscore (_), so it is better to generate a list of symbols to export.
+ always_export_symbols=yes
+ if test "$aix_use_runtimelinking" = yes; then
+ # Warning - without using the other runtime loading flags (-brtl),
+ # -berok will link without error, but may produce a broken library.
+ allow_undefined_flag='-berok'
+ # Determine the default libpath from the value encoded in an
+ # empty executable.
+ if test "${lt_cv_aix_libpath+set}" = set; then
+ aix_libpath=$lt_cv_aix_libpath
+else
+ if ${lt_cv_aix_libpath_+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+
+ lt_aix_libpath_sed='
+ /Import File Strings/,/^$/ {
+ /^0/ {
+ s/^0 *\([^ ]*\) *$/\1/
+ p
+ }
+ }'
+ lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+ # Check for a 64-bit object if we didn't find anything.
+ if test -z "$lt_cv_aix_libpath_"; then
+ lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+ fi
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ if test -z "$lt_cv_aix_libpath_"; then
+ lt_cv_aix_libpath_="/usr/lib:/lib"
+ fi
+
+fi
+
+ aix_libpath=$lt_cv_aix_libpath_
+fi
+
+ hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+ archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+ else
+ if test "$host_cpu" = ia64; then
+ hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
+ allow_undefined_flag="-z nodefs"
+ archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+ else
+ # Determine the default libpath from the value encoded in an
+ # empty executable.
+ if test "${lt_cv_aix_libpath+set}" = set; then
+ aix_libpath=$lt_cv_aix_libpath
+else
+ if ${lt_cv_aix_libpath_+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+
+ lt_aix_libpath_sed='
+ /Import File Strings/,/^$/ {
+ /^0/ {
+ s/^0 *\([^ ]*\) *$/\1/
+ p
+ }
+ }'
+ lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+ # Check for a 64-bit object if we didn't find anything.
+ if test -z "$lt_cv_aix_libpath_"; then
+ lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+ fi
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ if test -z "$lt_cv_aix_libpath_"; then
+ lt_cv_aix_libpath_="/usr/lib:/lib"
+ fi
+
+fi
+
+ aix_libpath=$lt_cv_aix_libpath_
+fi
+
+ hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+ # Warning - without using the other run time loading flags,
+ # -berok will link without error, but may produce a broken library.
+ no_undefined_flag=' ${wl}-bernotok'
+ allow_undefined_flag=' ${wl}-berok'
+ if test "$with_gnu_ld" = yes; then
+ # We only use this code for GNU lds that support --whole-archive.
+ whole_archive_flag_spec='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+ else
+ # Exported symbols can be pulled into shared objects from archives
+ whole_archive_flag_spec='$convenience'
+ fi
+ archive_cmds_need_lc=yes
+ # This is similar to how AIX traditionally builds its shared libraries.
+ archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+ fi
+ fi
+ ;;
+
+ amigaos*)
+ case $host_cpu in
+ powerpc)
+ # see comment about AmigaOS4 .so support
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds=''
+ ;;
+ m68k)
+ archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+ ;;
+ esac
+ ;;
+
+ bsdi[45]*)
+ export_dynamic_flag_spec=-rdynamic
+ ;;
+
+ cygwin* | mingw* | pw32* | cegcc*)
+ # When not using gcc, we currently assume that we are using
+ # Microsoft Visual C++.
+ # hardcode_libdir_flag_spec is actually meaningless, as there is
+ # no search path for DLLs.
+ case $cc_basename in
+ cl*)
+ # Native MSVC
+ hardcode_libdir_flag_spec=' '
+ allow_undefined_flag=unsupported
+ always_export_symbols=yes
+ file_list_spec='@'
+ # Tell ltmain to make .lib files, not .a files.
+ libext=lib
+ # Tell ltmain to make .dll files, not .so files.
+ shrext_cmds=".dll"
+ # FIXME: Setting linknames here is a bad hack.
+ archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
+ archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+ sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
+ else
+ sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
+ fi~
+ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
+ linknames='
+ # The linker will not automatically build a static lib if we build a DLL.
+ # _LT_TAGVAR(old_archive_from_new_cmds, )='true'
+ enable_shared_with_static_runtimes=yes
+ exclude_expsyms='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
+ export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
+ # Don't use ranlib
+ old_postinstall_cmds='chmod 644 $oldlib'
+ postlink_cmds='lt_outputfile="@OUTPUT@"~
+ lt_tool_outputfile="@TOOL_OUTPUT@"~
+ case $lt_outputfile in
+ *.exe|*.EXE) ;;
+ *)
+ lt_outputfile="$lt_outputfile.exe"
+ lt_tool_outputfile="$lt_tool_outputfile.exe"
+ ;;
+ esac~
+ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
+ $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
+ $RM "$lt_outputfile.manifest";
+ fi'
+ ;;
+ *)
+ # Assume MSVC wrapper
+ hardcode_libdir_flag_spec=' '
+ allow_undefined_flag=unsupported
+ # Tell ltmain to make .lib files, not .a files.
+ libext=lib
+ # Tell ltmain to make .dll files, not .so files.
+ shrext_cmds=".dll"
+ # FIXME: Setting linknames here is a bad hack.
+ archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames='
+ # The linker will automatically build a .lib file if we build a DLL.
+ old_archive_from_new_cmds='true'
+ # FIXME: Should let the user specify the lib program.
+ old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs'
+ enable_shared_with_static_runtimes=yes
+ ;;
+ esac
+ ;;
+
+ darwin* | rhapsody*)
+
+
+ archive_cmds_need_lc=no
+ hardcode_direct=no
+ hardcode_automatic=yes
+ hardcode_shlibpath_var=unsupported
+ if test "$lt_cv_ld_force_load" = "yes"; then
+ whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
+
+ else
+ whole_archive_flag_spec=''
+ fi
+ link_all_deplibs=yes
+ allow_undefined_flag="$_lt_dar_allow_undefined"
+ case $cc_basename in
+ ifort*) _lt_dar_can_shared=yes ;;
+ *) _lt_dar_can_shared=$GCC ;;
+ esac
+ if test "$_lt_dar_can_shared" = "yes"; then
+ output_verbose_link_cmd=func_echo_all
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
+
+ else
+ ld_shlibs=no
+ fi
+
+ ;;
+
+ dgux*)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_shlibpath_var=no
+ ;;
+
+ # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+ # support. Future versions do this automatically, but an explicit c++rt0.o
+ # does not break anything, and helps significantly (at the cost of a little
+ # extra space).
+ freebsd2.2*)
+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+ freebsd2.*)
+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct=yes
+ hardcode_minus_L=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+ freebsd* | dragonfly*)
+ archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ hpux9*)
+ if test "$GCC" = yes; then
+ archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ else
+ archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ fi
+ hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator=:
+ hardcode_direct=yes
+
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ hardcode_minus_L=yes
+ export_dynamic_flag_spec='${wl}-E'
+ ;;
+
+ hpux10*)
+ if test "$GCC" = yes && test "$with_gnu_ld" = no; then
+ archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+ fi
+ if test "$with_gnu_ld" = no; then
+ hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator=:
+ hardcode_direct=yes
+ hardcode_direct_absolute=yes
+ export_dynamic_flag_spec='${wl}-E'
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ hardcode_minus_L=yes
+ fi
+ ;;
+
+ hpux11*)
+ if test "$GCC" = yes && test "$with_gnu_ld" = no; then
+ case $host_cpu in
+ hppa*64*)
+ archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ ia64*)
+ archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ *)
+ archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ esac
+ else
+ case $host_cpu in
+ hppa*64*)
+ archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ ia64*)
+ archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ *)
+
+ # Older versions of the 11.00 compiler do not understand -b yet
+ # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5
+$as_echo_n "checking if $CC understands -b... " >&6; }
+if ${lt_cv_prog_compiler__b+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler__b=no
+ save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS -b"
+ echo "$lt_simple_link_test_code" > conftest.$ac_ext
+ if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+ # The linker can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ if test -s conftest.err; then
+ # Append any errors to the config.log.
+ cat conftest.err 1>&5
+ $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if diff conftest.exp conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler__b=yes
+ fi
+ else
+ lt_cv_prog_compiler__b=yes
+ fi
+ fi
+ $RM -r conftest*
+ LDFLAGS="$save_LDFLAGS"
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5
+$as_echo "$lt_cv_prog_compiler__b" >&6; }
+
+if test x"$lt_cv_prog_compiler__b" = xyes; then
+ archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+else
+ archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+fi
+
+ ;;
+ esac
+ fi
+ if test "$with_gnu_ld" = no; then
+ hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator=:
+
+ case $host_cpu in
+ hppa*64*|ia64*)
+ hardcode_direct=no
+ hardcode_shlibpath_var=no
+ ;;
+ *)
+ hardcode_direct=yes
+ hardcode_direct_absolute=yes
+ export_dynamic_flag_spec='${wl}-E'
+
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ hardcode_minus_L=yes
+ ;;
+ esac
+ fi
+ ;;
+
+ irix5* | irix6* | nonstopux*)
+ if test "$GCC" = yes; then
+ archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ # Try to use the -exported_symbol ld option, if it does not
+ # work, assume that -exports_file does not work either and
+ # implicitly export all symbols.
+ # This should be the same for all languages, so no per-tag cache variable.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5
+$as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; }
+if ${lt_cv_irix_exported_symbol+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+int foo (void) { return 0; }
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ lt_cv_irix_exported_symbol=yes
+else
+ lt_cv_irix_exported_symbol=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ LDFLAGS="$save_LDFLAGS"
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5
+$as_echo "$lt_cv_irix_exported_symbol" >&6; }
+ if test "$lt_cv_irix_exported_symbol" = yes; then
+ archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
+ fi
+ else
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
+ fi
+ archive_cmds_need_lc='no'
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator=:
+ inherit_rpath=yes
+ link_all_deplibs=yes
+ ;;
+
+ netbsd* | netbsdelf*-gnu)
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out
+ else
+ archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF
+ fi
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ newsos6)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct=yes
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator=:
+ hardcode_shlibpath_var=no
+ ;;
+
+ *nto* | *qnx*)
+ ;;
+
+ openbsd*)
+ if test -f /usr/libexec/ld.so; then
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ hardcode_direct_absolute=yes
+ if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
+ hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+ export_dynamic_flag_spec='${wl}-E'
+ else
+ case $host_os in
+ openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_libdir_flag_spec='-R$libdir'
+ ;;
+ *)
+ archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+ hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+ ;;
+ esac
+ fi
+ else
+ ld_shlibs=no
+ fi
+ ;;
+
+ os2*)
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+ allow_undefined_flag=unsupported
+ archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+ old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+ ;;
+
+ osf3*)
+ if test "$GCC" = yes; then
+ allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+ archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ else
+ allow_undefined_flag=' -expect_unresolved \*'
+ archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+ fi
+ archive_cmds_need_lc='no'
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator=:
+ ;;
+
+ osf4* | osf5*) # as osf3* with the addition of -msym flag
+ if test "$GCC" = yes; then
+ allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+ archive_cmds='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ else
+ allow_undefined_flag=' -expect_unresolved \*'
+ archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+ archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~
+ $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
+
+ # Both c and cxx compiler support -rpath directly
+ hardcode_libdir_flag_spec='-rpath $libdir'
+ fi
+ archive_cmds_need_lc='no'
+ hardcode_libdir_separator=:
+ ;;
+
+ solaris*)
+ no_undefined_flag=' -z defs'
+ if test "$GCC" = yes; then
+ wlarc='${wl}'
+ archive_cmds='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+ $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+ else
+ case `$CC -V 2>&1` in
+ *"Compilers 5.0"*)
+ wlarc=''
+ archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp'
+ ;;
+ *)
+ wlarc='${wl}'
+ archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+ $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+ ;;
+ esac
+ fi
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_shlibpath_var=no
+ case $host_os in
+ solaris2.[0-5] | solaris2.[0-5].*) ;;
+ *)
+ # The compiler driver will combine and reorder linker options,
+ # but understands `-z linker_flag'. GCC discards it without `$wl',
+ # but is careful enough not to reorder.
+ # Supported since Solaris 2.6 (maybe 2.5.1?)
+ if test "$GCC" = yes; then
+ whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+ else
+ whole_archive_flag_spec='-z allextract$convenience -z defaultextract'
+ fi
+ ;;
+ esac
+ link_all_deplibs=yes
+ ;;
+
+ sunos4*)
+ if test "x$host_vendor" = xsequent; then
+ # Use $CC to link under sequent, because it throws in some extra .o
+ # files that make .init and .fini sections work.
+ archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+ fi
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_direct=yes
+ hardcode_minus_L=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ sysv4)
+ case $host_vendor in
+ sni)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct=yes # is this really true???
+ ;;
+ siemens)
+ ## LD is ld it makes a PLAMLIB
+ ## CC just makes a GrossModule.
+ archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+ reload_cmds='$CC -r -o $output$reload_objs'
+ hardcode_direct=no
+ ;;
+ motorola)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct=no #Motorola manual says yes, but my tests say they lie
+ ;;
+ esac
+ runpath_var='LD_RUN_PATH'
+ hardcode_shlibpath_var=no
+ ;;
+
+ sysv4.3*)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_shlibpath_var=no
+ export_dynamic_flag_spec='-Bexport'
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_shlibpath_var=no
+ runpath_var=LD_RUN_PATH
+ hardcode_runpath_var=yes
+ ld_shlibs=yes
+ fi
+ ;;
+
+ sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
+ no_undefined_flag='${wl}-z,text'
+ archive_cmds_need_lc=no
+ hardcode_shlibpath_var=no
+ runpath_var='LD_RUN_PATH'
+
+ if test "$GCC" = yes; then
+ archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ fi
+ ;;
+
+ sysv5* | sco3.2v5* | sco5v6*)
+ # Note: We can NOT use -z defs as we might desire, because we do not
+ # link with -lc, and that would cause any symbols used from libc to
+ # always be unresolved, which means just about no library would
+ # ever link correctly. If we're not using GNU ld we use -z text
+ # though, which does catch some bad symbols but isn't as heavy-handed
+ # as -z defs.
+ no_undefined_flag='${wl}-z,text'
+ allow_undefined_flag='${wl}-z,nodefs'
+ archive_cmds_need_lc=no
+ hardcode_shlibpath_var=no
+ hardcode_libdir_flag_spec='${wl}-R,$libdir'
+ hardcode_libdir_separator=':'
+ link_all_deplibs=yes
+ export_dynamic_flag_spec='${wl}-Bexport'
+ runpath_var='LD_RUN_PATH'
+
+ if test "$GCC" = yes; then
+ archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ fi
+ ;;
+
+ uts4*)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_shlibpath_var=no
+ ;;
+
+ *)
+ ld_shlibs=no
+ ;;
+ esac
+
+ if test x$host_vendor = xsni; then
+ case $host in
+ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+ export_dynamic_flag_spec='${wl}-Blargedynsym'
+ ;;
+ esac
+ fi
+ fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5
+$as_echo "$ld_shlibs" >&6; }
+test "$ld_shlibs" = no && can_build_shared=no
+
+with_gnu_ld=$with_gnu_ld
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$archive_cmds_need_lc" in
+x|xyes)
+ # Assume -lc should be added
+ archive_cmds_need_lc=yes
+
+ if test "$enable_shared" = yes && test "$GCC" = yes; then
+ case $archive_cmds in
+ *'~'*)
+ # FIXME: we may have to deal with multi-command sequences.
+ ;;
+ '$CC '*)
+ # Test whether the compiler implicitly links with -lc since on some
+ # systems, -lgcc has to come before -lc. If gcc already passes -lc
+ # to ld, don't add -lc before -lgcc.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5
+$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; }
+if ${lt_cv_archive_cmds_need_lc+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ $RM conftest*
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } 2>conftest.err; then
+ soname=conftest
+ lib=conftest
+ libobjs=conftest.$ac_objext
+ deplibs=
+ wl=$lt_prog_compiler_wl
+ pic_flag=$lt_prog_compiler_pic
+ compiler_flags=-v
+ linker_flags=-v
+ verstring=
+ output_objdir=.
+ libname=conftest
+ lt_save_allow_undefined_flag=$allow_undefined_flag
+ allow_undefined_flag=
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5
+ (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+ then
+ lt_cv_archive_cmds_need_lc=no
+ else
+ lt_cv_archive_cmds_need_lc=yes
+ fi
+ allow_undefined_flag=$lt_save_allow_undefined_flag
+ else
+ cat conftest.err 1>&5
+ fi
+ $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5
+$as_echo "$lt_cv_archive_cmds_need_lc" >&6; }
+ archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc
+ ;;
+ esac
+ fi
+ ;;
+esac
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5
+$as_echo_n "checking dynamic linker characteristics... " >&6; }
+
+if test "$GCC" = yes; then
+ case $host_os in
+ darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
+ *) lt_awk_arg="/^libraries:/" ;;
+ esac
+ case $host_os in
+ mingw* | cegcc*) lt_sed_strip_eq="s,=\([A-Za-z]:\),\1,g" ;;
+ *) lt_sed_strip_eq="s,=/,/,g" ;;
+ esac
+ lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq`
+ case $lt_search_path_spec in
+ *\;*)
+ # if the path contains ";" then we assume it to be the separator
+ # otherwise default to the standard path separator (i.e. ":") - it is
+ # assumed that no part of a normal pathname contains ";" but that should
+ # okay in the real world where ";" in dirpaths is itself problematic.
+ lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'`
+ ;;
+ *)
+ lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"`
+ ;;
+ esac
+ # Ok, now we have the path, separated by spaces, we can step through it
+ # and add multilib dir if necessary.
+ lt_tmp_lt_search_path_spec=
+ lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`
+ for lt_sys_path in $lt_search_path_spec; do
+ if test -d "$lt_sys_path/$lt_multi_os_dir"; then
+ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir"
+ else
+ test -d "$lt_sys_path" && \
+ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
+ fi
+ done
+ lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk '
+BEGIN {RS=" "; FS="/|\n";} {
+ lt_foo="";
+ lt_count=0;
+ for (lt_i = NF; lt_i > 0; lt_i--) {
+ if ($lt_i != "" && $lt_i != ".") {
+ if ($lt_i == "..") {
+ lt_count++;
+ } else {
+ if (lt_count == 0) {
+ lt_foo="/" $lt_i lt_foo;
+ } else {
+ lt_count--;
+ }
+ }
+ }
+ }
+ if (lt_foo != "") { lt_freq[lt_foo]++; }
+ if (lt_freq[lt_foo] == 1) { print lt_foo; }
+}'`
+ # AWK program above erroneously prepends '/' to C:/dos/paths
+ # for these hosts.
+ case $host_os in
+ mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\
+ $SED 's,/\([A-Za-z]:\),\1,g'` ;;
+ esac
+ sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP`
+else
+ sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+fi
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+case $host_os in
+aix3*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+ shlibpath_var=LIBPATH
+
+ # AIX 3 has no versioning support, so we append a major version to the name.
+ soname_spec='${libname}${release}${shared_ext}$major'
+ ;;
+
+aix[4-9]*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ need_lib_prefix=no
+ need_version=no
+ hardcode_into_libs=yes
+ if test "$host_cpu" = ia64; then
+ # AIX 5 supports IA64
+ library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ else
+ # With GCC up to 2.95.x, collect2 would create an import file
+ # for dependence libraries. The import file would start with
+ # the line `#! .'. This would cause the generated library to
+ # depend on `.', always an invalid library. This was fixed in
+ # development snapshots of GCC prior to 3.0.
+ case $host_os in
+ aix4 | aix4.[01] | aix4.[01].*)
+ if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+ echo ' yes '
+ echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then
+ :
+ else
+ can_build_shared=no
+ fi
+ ;;
+ esac
+ # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+ # soname into executable. Probably we can add versioning support to
+ # collect2, so additional links can be useful in future.
+ if test "$aix_use_runtimelinking" = yes; then
+ # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+ # instead of lib<name>.a to let people know that these are not
+ # typical AIX shared libraries.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ else
+ # We preserve .a as extension for shared libraries through AIX4.2
+ # and later when we are not doing run time linking.
+ library_names_spec='${libname}${release}.a $libname.a'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ fi
+ shlibpath_var=LIBPATH
+ fi
+ ;;
+
+amigaos*)
+ case $host_cpu in
+ powerpc)
+ # Since July 2007 AmigaOS4 officially supports .so libraries.
+ # When compiling the executable, add -use-dynld -Lsobjs: to the compileline.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ ;;
+ m68k)
+ library_names_spec='$libname.ixlibrary $libname.a'
+ # Create ${libname}_ixlibrary.a entries in /sys/libs.
+ finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+ ;;
+ esac
+ ;;
+
+beos*)
+ library_names_spec='${libname}${shared_ext}'
+ dynamic_linker="$host_os ld.so"
+ shlibpath_var=LIBRARY_PATH
+ ;;
+
+bsdi[45]*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+ sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+ # the default ld.so.conf also contains /usr/contrib/lib and
+ # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+ # libtool to hard-code these into programs
+ ;;
+
+cygwin* | mingw* | pw32* | cegcc*)
+ version_type=windows
+ shrext_cmds=".dll"
+ need_version=no
+ need_lib_prefix=no
+
+ case $GCC,$cc_basename in
+ yes,*)
+ # gcc
+ library_names_spec='$libname.dll.a'
+ # DLL is installed to $(libdir)/../bin by postinstall_cmds
+ postinstall_cmds='base_file=`basename \${file}`~
+ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+ dldir=$destdir/`dirname \$dlpath`~
+ test -d \$dldir || mkdir -p \$dldir~
+ $install_prog $dir/$dlname \$dldir/$dlname~
+ chmod a+x \$dldir/$dlname~
+ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+ eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
+ fi'
+ postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+ dlpath=$dir/\$dldll~
+ $RM \$dlpath'
+ shlibpath_overrides_runpath=yes
+
+ case $host_os in
+ cygwin*)
+ # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+ soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+
+ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"
+ ;;
+ mingw* | cegcc*)
+ # MinGW DLLs use traditional 'lib' prefix
+ soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+ ;;
+ pw32*)
+ # pw32 DLLs use 'pw' prefix rather than 'lib'
+ library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+ ;;
+ esac
+ dynamic_linker='Win32 ld.exe'
+ ;;
+
+ *,cl*)
+ # Native MSVC
+ libname_spec='$name'
+ soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+ library_names_spec='${libname}.dll.lib'
+
+ case $build_os in
+ mingw*)
+ sys_lib_search_path_spec=
+ lt_save_ifs=$IFS
+ IFS=';'
+ for lt_path in $LIB
+ do
+ IFS=$lt_save_ifs
+ # Let DOS variable expansion print the short 8.3 style file name.
+ lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"`
+ sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path"
+ done
+ IFS=$lt_save_ifs
+ # Convert to MSYS style.
+ sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'`
+ ;;
+ cygwin*)
+ # Convert to unix form, then to dos form, then back to unix form
+ # but this time dos style (no spaces!) so that the unix form looks
+ # like /cygdrive/c/PROGRA~1:/cygdr...
+ sys_lib_search_path_spec=`cygpath --path --unix "$LIB"`
+ sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null`
+ sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+ ;;
+ *)
+ sys_lib_search_path_spec="$LIB"
+ if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then
+ # It is most probably a Windows format PATH.
+ sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+ else
+ sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+ fi
+ # FIXME: find the short name or the path components, as spaces are
+ # common. (e.g. "Program Files" -> "PROGRA~1")
+ ;;
+ esac
+
+ # DLL is installed to $(libdir)/../bin by postinstall_cmds
+ postinstall_cmds='base_file=`basename \${file}`~
+ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+ dldir=$destdir/`dirname \$dlpath`~
+ test -d \$dldir || mkdir -p \$dldir~
+ $install_prog $dir/$dlname \$dldir/$dlname'
+ postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+ dlpath=$dir/\$dldll~
+ $RM \$dlpath'
+ shlibpath_overrides_runpath=yes
+ dynamic_linker='Win32 link.exe'
+ ;;
+
+ *)
+ # Assume MSVC wrapper
+ library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
+ dynamic_linker='Win32 ld.exe'
+ ;;
+ esac
+ # FIXME: first we should search . and the directory the executable is in
+ shlibpath_var=PATH
+ ;;
+
+darwin* | rhapsody*)
+ dynamic_linker="$host_os dyld"
+ version_type=darwin
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+ soname_spec='${libname}${release}${major}$shared_ext'
+ shlibpath_overrides_runpath=yes
+ shlibpath_var=DYLD_LIBRARY_PATH
+ shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+
+ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"
+ sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+ ;;
+
+dgux*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+freebsd* | dragonfly*)
+ # DragonFly does not have aout. When/if they implement a new
+ # versioning mechanism, adjust this.
+ if test -x /usr/bin/objformat; then
+ objformat=`/usr/bin/objformat`
+ else
+ case $host_os in
+ freebsd[23].*) objformat=aout ;;
+ *) objformat=elf ;;
+ esac
+ fi
+ version_type=freebsd-$objformat
+ case $version_type in
+ freebsd-elf*)
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+ need_version=no
+ need_lib_prefix=no
+ ;;
+ freebsd-*)
+ library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+ need_version=yes
+ ;;
+ esac
+ shlibpath_var=LD_LIBRARY_PATH
+ case $host_os in
+ freebsd2.*)
+ shlibpath_overrides_runpath=yes
+ ;;
+ freebsd3.[01]* | freebsdelf3.[01]*)
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+ freebsd3.[2-9]* | freebsdelf3.[2-9]* | \
+ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1)
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+ *) # from 4.6 on, and DragonFly
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+ esac
+ ;;
+
+haiku*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ need_lib_prefix=no
+ need_version=no
+ dynamic_linker="$host_os runtime_loader"
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
+ hardcode_into_libs=yes
+ ;;
+
+hpux9* | hpux10* | hpux11*)
+ # Give a soname corresponding to the major version so that dld.sl refuses to
+ # link against other versions.
+ version_type=sunos
+ need_lib_prefix=no
+ need_version=no
+ case $host_cpu in
+ ia64*)
+ shrext_cmds='.so'
+ hardcode_into_libs=yes
+ dynamic_linker="$host_os dld.so"
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ if test "X$HPUX_IA64_MODE" = X32; then
+ sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+ else
+ sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+ fi
+ sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+ ;;
+ hppa*64*)
+ shrext_cmds='.sl'
+ hardcode_into_libs=yes
+ dynamic_linker="$host_os dld.sl"
+ shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+ shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+ sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+ ;;
+ *)
+ shrext_cmds='.sl'
+ dynamic_linker="$host_os dld.sl"
+ shlibpath_var=SHLIB_PATH
+ shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ ;;
+ esac
+ # HP-UX runs *really* slowly unless shared libraries are mode 555, ...
+ postinstall_cmds='chmod 555 $lib'
+ # or fails outright, so override atomically:
+ install_override_mode=555
+ ;;
+
+interix[3-9]*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+
+irix5* | irix6* | nonstopux*)
+ case $host_os in
+ nonstopux*) version_type=nonstopux ;;
+ *)
+ if test "$lt_cv_prog_gnu_ld" = yes; then
+ version_type=linux # correct to gnu/linux during the next big refactor
+ else
+ version_type=irix
+ fi ;;
+ esac
+ need_lib_prefix=no
+ need_version=no
+ soname_spec='${libname}${release}${shared_ext}$major'
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+ case $host_os in
+ irix5* | nonstopux*)
+ libsuff= shlibsuff=
+ ;;
+ *)
+ case $LD in # libtool.m4 will add one of these switches to LD
+ *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+ libsuff= shlibsuff= libmagic=32-bit;;
+ *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+ libsuff=32 shlibsuff=N32 libmagic=N32;;
+ *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+ libsuff=64 shlibsuff=64 libmagic=64-bit;;
+ *) libsuff= shlibsuff= libmagic=never-match;;
+ esac
+ ;;
+ esac
+ shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+ shlibpath_overrides_runpath=no
+ sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+ sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+ hardcode_into_libs=yes
+ ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+ dynamic_linker=no
+ ;;
+
+# This must be glibc/ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+
+ # Some binutils ld are patched to set DT_RUNPATH
+ if ${lt_cv_shlibpath_overrides_runpath+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_shlibpath_overrides_runpath=no
+ save_LDFLAGS=$LDFLAGS
+ save_libdir=$libdir
+ eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \
+ LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\""
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then :
+ lt_cv_shlibpath_overrides_runpath=yes
+fi
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ LDFLAGS=$save_LDFLAGS
+ libdir=$save_libdir
+
+fi
+
+ shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath
+
+ # This implies no fast_install, which is unacceptable.
+ # Some rework will be needed to allow for fast_install
+ # before this can be enabled.
+ hardcode_into_libs=yes
+
+ # Append ld.so.conf contents to the search path
+ if test -f /etc/ld.so.conf; then
+ lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
+ sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+ fi
+
+ # We used to test for /lib/ld.so.1 and disable shared libraries on
+ # powerpc, because MkLinux only supported shared libraries with the
+ # GNU dynamic linker. Since this was broken with cross compilers,
+ # most powerpc-linux boxes support dynamic linking these days and
+ # people can always --disable-shared, the test was removed, and we
+ # assume the GNU/Linux dynamic linker is in use.
+ dynamic_linker='GNU/Linux ld.so'
+ ;;
+
+netbsdelf*-gnu)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ dynamic_linker='NetBSD ld.elf_so'
+ ;;
+
+netbsd*)
+ version_type=sunos
+ need_lib_prefix=no
+ need_version=no
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+ dynamic_linker='NetBSD (a.out) ld.so'
+ else
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ dynamic_linker='NetBSD ld.elf_so'
+ fi
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+
+newsos6)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ ;;
+
+*nto* | *qnx*)
+ version_type=qnx
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ dynamic_linker='ldqnx.so'
+ ;;
+
+openbsd*)
+ version_type=sunos
+ sys_lib_dlsearch_path_spec="/usr/lib"
+ need_lib_prefix=no
+ # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+ case $host_os in
+ openbsd3.3 | openbsd3.3.*) need_version=yes ;;
+ *) need_version=no ;;
+ esac
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ case $host_os in
+ openbsd2.[89] | openbsd2.[89].*)
+ shlibpath_overrides_runpath=no
+ ;;
+ *)
+ shlibpath_overrides_runpath=yes
+ ;;
+ esac
+ else
+ shlibpath_overrides_runpath=yes
+ fi
+ ;;
+
+os2*)
+ libname_spec='$name'
+ shrext_cmds=".dll"
+ need_lib_prefix=no
+ library_names_spec='$libname${shared_ext} $libname.a'
+ dynamic_linker='OS/2 ld.exe'
+ shlibpath_var=LIBPATH
+ ;;
+
+osf3* | osf4* | osf5*)
+ version_type=osf
+ need_lib_prefix=no
+ need_version=no
+ soname_spec='${libname}${release}${shared_ext}$major'
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+ sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+ ;;
+
+rdos*)
+ dynamic_linker=no
+ ;;
+
+solaris*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ # ldd complains unless libraries are executable
+ postinstall_cmds='chmod +x $lib'
+ ;;
+
+sunos4*)
+ version_type=sunos
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ if test "$with_gnu_ld" = yes; then
+ need_lib_prefix=no
+ fi
+ need_version=yes
+ ;;
+
+sysv4 | sysv4.3*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ case $host_vendor in
+ sni)
+ shlibpath_overrides_runpath=no
+ need_lib_prefix=no
+ runpath_var=LD_RUN_PATH
+ ;;
+ siemens)
+ need_lib_prefix=no
+ ;;
+ motorola)
+ need_lib_prefix=no
+ need_version=no
+ shlibpath_overrides_runpath=no
+ sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+ ;;
+ esac
+ ;;
+
+sysv4*MP*)
+ if test -d /usr/nec ;then
+ version_type=linux # correct to gnu/linux during the next big refactor
+ library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+ soname_spec='$libname${shared_ext}.$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ fi
+ ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+ version_type=freebsd-elf
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ if test "$with_gnu_ld" = yes; then
+ sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
+ else
+ sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+ case $host_os in
+ sco3.2v5*)
+ sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+ ;;
+ esac
+ fi
+ sys_lib_dlsearch_path_spec='/usr/lib'
+ ;;
+
+tpf*)
+ # TPF is a cross-target only. Preferred cross-host = GNU/Linux.
+ version_type=linux # correct to gnu/linux during the next big refactor
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+
+uts4*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+*)
+ dynamic_linker=no
+ ;;
+esac
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5
+$as_echo "$dynamic_linker" >&6; }
+test "$dynamic_linker" = no && can_build_shared=no
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+ variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
+ sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
+fi
+if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
+ sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5
+$as_echo_n "checking how to hardcode library paths into programs... " >&6; }
+hardcode_action=
+if test -n "$hardcode_libdir_flag_spec" ||
+ test -n "$runpath_var" ||
+ test "X$hardcode_automatic" = "Xyes" ; then
+
+ # We can hardcode non-existent directories.
+ if test "$hardcode_direct" != no &&
+ # If the only mechanism to avoid hardcoding is shlibpath_var, we
+ # have to relink, otherwise we might link with an installed library
+ # when we should be linking with a yet-to-be-installed one
+ ## test "$_LT_TAGVAR(hardcode_shlibpath_var, )" != no &&
+ test "$hardcode_minus_L" != no; then
+ # Linking always hardcodes the temporary library directory.
+ hardcode_action=relink
+ else
+ # We can link without hardcoding, and we can hardcode nonexisting dirs.
+ hardcode_action=immediate
+ fi
+else
+ # We cannot hardcode anything, or else we can only hardcode existing
+ # directories.
+ hardcode_action=unsupported
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5
+$as_echo "$hardcode_action" >&6; }
+
+if test "$hardcode_action" = relink ||
+ test "$inherit_rpath" = yes; then
+ # Fast installation is not supported
+ enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+ test "$enable_shared" = no; then
+ # Fast installation is not necessary
+ enable_fast_install=needless
+fi
+
+
+
+
+
+
+ if test "x$enable_dlopen" != xyes; then
+ enable_dlopen=unknown
+ enable_dlopen_self=unknown
+ enable_dlopen_self_static=unknown
+else
+ lt_cv_dlopen=no
+ lt_cv_dlopen_libs=
+
+ case $host_os in
+ beos*)
+ lt_cv_dlopen="load_add_on"
+ lt_cv_dlopen_libs=
+ lt_cv_dlopen_self=yes
+ ;;
+
+ mingw* | pw32* | cegcc*)
+ lt_cv_dlopen="LoadLibrary"
+ lt_cv_dlopen_libs=
+ ;;
+
+ cygwin*)
+ lt_cv_dlopen="dlopen"
+ lt_cv_dlopen_libs=
+ ;;
+
+ darwin*)
+ # if libdl is installed we need to link against it
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
+$as_echo_n "checking for dlopen in -ldl... " >&6; }
+if ${ac_cv_lib_dl_dlopen+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+int
+main ()
+{
+return dlopen ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_dl_dlopen=yes
+else
+ ac_cv_lib_dl_dlopen=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
+$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
+if test "x$ac_cv_lib_dl_dlopen" = xyes; then :
+ lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+else
+
+ lt_cv_dlopen="dyld"
+ lt_cv_dlopen_libs=
+ lt_cv_dlopen_self=yes
+
+fi
+
+ ;;
+
+ *)
+ ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load"
+if test "x$ac_cv_func_shl_load" = xyes; then :
+ lt_cv_dlopen="shl_load"
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5
+$as_echo_n "checking for shl_load in -ldld... " >&6; }
+if ${ac_cv_lib_dld_shl_load+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldld $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char shl_load ();
+int
+main ()
+{
+return shl_load ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_dld_shl_load=yes
+else
+ ac_cv_lib_dld_shl_load=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5
+$as_echo "$ac_cv_lib_dld_shl_load" >&6; }
+if test "x$ac_cv_lib_dld_shl_load" = xyes; then :
+ lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"
+else
+ ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen"
+if test "x$ac_cv_func_dlopen" = xyes; then :
+ lt_cv_dlopen="dlopen"
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
+$as_echo_n "checking for dlopen in -ldl... " >&6; }
+if ${ac_cv_lib_dl_dlopen+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+int
+main ()
+{
+return dlopen ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_dl_dlopen=yes
+else
+ ac_cv_lib_dl_dlopen=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
+$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
+if test "x$ac_cv_lib_dl_dlopen" = xyes; then :
+ lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5
+$as_echo_n "checking for dlopen in -lsvld... " >&6; }
+if ${ac_cv_lib_svld_dlopen+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lsvld $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+int
+main ()
+{
+return dlopen ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_svld_dlopen=yes
+else
+ ac_cv_lib_svld_dlopen=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5
+$as_echo "$ac_cv_lib_svld_dlopen" >&6; }
+if test "x$ac_cv_lib_svld_dlopen" = xyes; then :
+ lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5
+$as_echo_n "checking for dld_link in -ldld... " >&6; }
+if ${ac_cv_lib_dld_dld_link+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldld $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dld_link ();
+int
+main ()
+{
+return dld_link ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_dld_dld_link=yes
+else
+ ac_cv_lib_dld_dld_link=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5
+$as_echo "$ac_cv_lib_dld_dld_link" >&6; }
+if test "x$ac_cv_lib_dld_dld_link" = xyes; then :
+ lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+ ;;
+ esac
+
+ if test "x$lt_cv_dlopen" != xno; then
+ enable_dlopen=yes
+ else
+ enable_dlopen=no
+ fi
+
+ case $lt_cv_dlopen in
+ dlopen)
+ save_CPPFLAGS="$CPPFLAGS"
+ test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
+
+ save_LDFLAGS="$LDFLAGS"
+ wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
+
+ save_LIBS="$LIBS"
+ LIBS="$lt_cv_dlopen_libs $LIBS"
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5
+$as_echo_n "checking whether a program can dlopen itself... " >&6; }
+if ${lt_cv_dlopen_self+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test "$cross_compiling" = yes; then :
+ lt_cv_dlopen_self=cross
+else
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<_LT_EOF
+#line $LINENO "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+# define LT_DLGLOBAL RTLD_GLOBAL
+#else
+# ifdef DL_GLOBAL
+# define LT_DLGLOBAL DL_GLOBAL
+# else
+# define LT_DLGLOBAL 0
+# endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+ find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+# ifdef RTLD_LAZY
+# define LT_DLLAZY_OR_NOW RTLD_LAZY
+# else
+# ifdef DL_LAZY
+# define LT_DLLAZY_OR_NOW DL_LAZY
+# else
+# ifdef RTLD_NOW
+# define LT_DLLAZY_OR_NOW RTLD_NOW
+# else
+# ifdef DL_NOW
+# define LT_DLLAZY_OR_NOW DL_NOW
+# else
+# define LT_DLLAZY_OR_NOW 0
+# endif
+# endif
+# endif
+# endif
+#endif
+
+/* When -fvisbility=hidden is used, assume the code has been annotated
+ correspondingly for the symbols needed. */
+#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
+int fnord () __attribute__((visibility("default")));
+#endif
+
+int fnord () { return 42; }
+int main ()
+{
+ void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+ int status = $lt_dlunknown;
+
+ if (self)
+ {
+ if (dlsym (self,"fnord")) status = $lt_dlno_uscore;
+ else
+ {
+ if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+ else puts (dlerror ());
+ }
+ /* dlclose (self); */
+ }
+ else
+ puts (dlerror ());
+
+ return status;
+}
+_LT_EOF
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then
+ (./conftest; exit; ) >&5 2>/dev/null
+ lt_status=$?
+ case x$lt_status in
+ x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;;
+ x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;;
+ x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;;
+ esac
+ else :
+ # compilation failed
+ lt_cv_dlopen_self=no
+ fi
+fi
+rm -fr conftest*
+
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5
+$as_echo "$lt_cv_dlopen_self" >&6; }
+
+ if test "x$lt_cv_dlopen_self" = xyes; then
+ wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5
+$as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; }
+if ${lt_cv_dlopen_self_static+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test "$cross_compiling" = yes; then :
+ lt_cv_dlopen_self_static=cross
+else
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<_LT_EOF
+#line $LINENO "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+# define LT_DLGLOBAL RTLD_GLOBAL
+#else
+# ifdef DL_GLOBAL
+# define LT_DLGLOBAL DL_GLOBAL
+# else
+# define LT_DLGLOBAL 0
+# endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+ find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+# ifdef RTLD_LAZY
+# define LT_DLLAZY_OR_NOW RTLD_LAZY
+# else
+# ifdef DL_LAZY
+# define LT_DLLAZY_OR_NOW DL_LAZY
+# else
+# ifdef RTLD_NOW
+# define LT_DLLAZY_OR_NOW RTLD_NOW
+# else
+# ifdef DL_NOW
+# define LT_DLLAZY_OR_NOW DL_NOW
+# else
+# define LT_DLLAZY_OR_NOW 0
+# endif
+# endif
+# endif
+# endif
+#endif
+
+/* When -fvisbility=hidden is used, assume the code has been annotated
+ correspondingly for the symbols needed. */
+#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
+int fnord () __attribute__((visibility("default")));
+#endif
+
+int fnord () { return 42; }
+int main ()
+{
+ void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+ int status = $lt_dlunknown;
+
+ if (self)
+ {
+ if (dlsym (self,"fnord")) status = $lt_dlno_uscore;
+ else
+ {
+ if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+ else puts (dlerror ());
+ }
+ /* dlclose (self); */
+ }
+ else
+ puts (dlerror ());
+
+ return status;
+}
+_LT_EOF
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then
+ (./conftest; exit; ) >&5 2>/dev/null
+ lt_status=$?
+ case x$lt_status in
+ x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;;
+ x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;;
+ x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;;
+ esac
+ else :
+ # compilation failed
+ lt_cv_dlopen_self_static=no
+ fi
+fi
+rm -fr conftest*
+
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5
+$as_echo "$lt_cv_dlopen_self_static" >&6; }
+ fi
+
+ CPPFLAGS="$save_CPPFLAGS"
+ LDFLAGS="$save_LDFLAGS"
+ LIBS="$save_LIBS"
+ ;;
+ esac
+
+ case $lt_cv_dlopen_self in
+ yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
+ *) enable_dlopen_self=unknown ;;
+ esac
+
+ case $lt_cv_dlopen_self_static in
+ yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
+ *) enable_dlopen_self_static=unknown ;;
+ esac
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+striplib=
+old_striplib=
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5
+$as_echo_n "checking whether stripping libraries is possible... " >&6; }
+if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then
+ test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
+ test -z "$striplib" && striplib="$STRIP --strip-unneeded"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+# FIXME - insert some real tests, host_os isn't really good enough
+ case $host_os in
+ darwin*)
+ if test -n "$STRIP" ; then
+ striplib="$STRIP -x"
+ old_striplib="$STRIP -S"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ fi
+ ;;
+ *)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ ;;
+ esac
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+ # Report which library types will actually be built
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5
+$as_echo_n "checking if libtool supports shared libraries... " >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5
+$as_echo "$can_build_shared" >&6; }
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5
+$as_echo_n "checking whether to build shared libraries... " >&6; }
+ test "$can_build_shared" = "no" && enable_shared=no
+
+ # On AIX, shared libraries and static libraries use the same namespace, and
+ # are all built from PIC.
+ case $host_os in
+ aix3*)
+ test "$enable_shared" = yes && enable_static=no
+ if test -n "$RANLIB"; then
+ archive_cmds="$archive_cmds~\$RANLIB \$lib"
+ postinstall_cmds='$RANLIB $lib'
+ fi
+ ;;
+
+ aix[4-9]*)
+ if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+ test "$enable_shared" = yes && enable_static=no
+ fi
+ ;;
+ esac
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5
+$as_echo "$enable_shared" >&6; }
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5
+$as_echo_n "checking whether to build static libraries... " >&6; }
+ # Make sure either enable_shared or enable_static is yes.
+ test "$enable_shared" = yes || enable_static=yes
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5
+$as_echo "$enable_static" >&6; }
+
+
+
+
+fi
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+CC="$lt_save_CC"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ac_config_commands="$ac_config_commands libtool"
+
+
+
+
+# Only expand once:
+
+
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..db7802c
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,176 @@
+# -*- Autoconf -*-
+# Process this file with autoconf to produce a configure script.
+
+
+# $Id: configure.ac 1201 2014-09-06 02:44:21Z michael $
+# $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/configure.ac $
+
+
+# LCD4Linux autoconf script
+#
+# Copyright (C) 1999, 2000, 2001, 2002, 2003 Michael Reinelt <michael@reinelt.co.at>
+# Copyright (C) 2004, 2005, 2006, 2007 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+#
+# This file is part of LCD4Linux.
+#
+# LCD4Linux is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# LCD4Linux is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+AC_PREREQ(2.59)
+AC_INIT([LCD4Linux],[0.11.0-SVN],[lcd4linux-users@lists.sourceforge.net])
+AC_CONFIG_SRCDIR([lcd4linux.c])
+AM_INIT_AUTOMAKE
+AM_CONFIG_HEADER(config.h)
+
+# Checks for programs.
+AC_PROG_CC
+AC_PROG_CPP
+AC_PROG_INSTALL
+AC_PROG_LN_S
+AC_PROG_MAKE_SET
+PKG_PROG_PKG_CONFIG
+
+# dmalloc
+AM_WITH_DMALLOC
+
+# Checks for libraries.
+AC_CHECK_LIB(m, log)
+
+# curses
+sinclude(curses.m4)
+AC_CHECK_CURSES
+
+# Checks for X11
+AC_PATH_X
+AC_PATH_XTRA
+# double-check for X11
+if test "$no_x" != "yes"; then
+ AC_CHECK_HEADERS(X11/Xlib.h X11/Xutil.h, [no_x="$no_x"], [no_x="yes"])
+ if test "$no_x" = "yes"; then
+ AC_MSG_WARN([configure thinks X11 is available while it is *not*])
+ AC_MSG_WARN([maybe someone wants to fix autoconf's AC PATH XTRA])
+ fi
+fi
+
+# check for gd.h
+AC_CHECK_HEADERS(gd/gd.h gd.h, [has_gd="true"; break], [has_gd="false"])
+
+# check for jpeglib.h
+AC_CHECK_HEADERS(jpeglib.h, [has_jpeglib="true"], [has_jpeglib="false"])
+
+# check for sys/io.h (RouterBoard driver)
+AC_CHECK_HEADERS(sys/io.h, [has_io_h="true"], [has_io_h="false"])
+
+# check for usb.h
+AC_CHECK_HEADERS(usb.h, [has_usb="true"], [has_usb="false"])
+
+# check for libusb-1.0/libusb.h
+AC_CHECK_HEADERS(libusb-1.0/libusb.h, [has_usb10="true"], [has_usb10="false"])
+
+# check for luise.h
+AC_CHECK_HEADERS(luise.h, [has_luise="true"], [has_luise="false"])
+
+# check for serdisplib
+AC_CHECK_HEADERS(serdisplib/serdisp.h, [has_serdisplib="true"], [has_serdisplib="false"])
+
+# check for st2205 libs
+AC_CHECK_HEADERS(st2205.h, [has_st2205="true"], [has_st2205="false"])
+
+# check for vncserver libs
+AC_CHECK_HEADERS(rfb/rfb.h, [has_vncserverlib="true"], [has_vncserverlib="false"])
+
+# check for LCD-Linux
+AC_CHECK_HEADERS(linux/lcd-linux.h linux/hd44780.h, [has_lcd_linux="true"], [has_lcd_linux="false"; break])
+
+# check for ftdi.h (ULA200)
+AC_CHECK_HEADERS(ftdi.h, [has_ftdi="true"], [has_ftdi="false"; break])
+
+# check for python
+AC_MSG_CHECKING(if python support is wanted)
+AC_ARG_WITH(python,
+[ --with-python enable python support [[default=no]]],
+[AC_MSG_RESULT($withval)], [AC_MSG_RESULT(no)])
+
+if test "$with_python" = "yes"; then
+ sinclude(ax_python_devel.m4)
+ AC_PYTHON_DEVEL
+fi
+
+# check for parport
+AC_MSG_CHECKING(if raw port I/O is wanted)
+AC_ARG_WITH(outb,
+[ --with-outb enable raw port I/O support [[default=no]]],
+[AC_MSG_RESULT($withval)], [AC_MSG_RESULT(no)])
+
+AC_CHECK_HEADERS([asm/io.h] [linux/parport.h linux/ppdev.h], [has_parport="true"], [has_parport="false"])
+
+# drivers
+sinclude(drivers.m4)
+
+# plugins
+sinclude(plugins.m4)
+
+# Checks for header files.
+AC_HEADER_DIRENT
+AC_HEADER_STDC
+AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h netinet/in.h stdlib.h string.h sys/ioctl.h sys/socket.h sys/time.h sys/vfs.h syslog.h termios.h unistd.h])
+
+# Checks for typedefs, structures, and compiler characteristics.
+AC_C_CONST
+AC_C_INLINE
+AC_TYPE_OFF_T
+AC_TYPE_PID_T
+AC_TYPE_SIZE_T
+AC_TYPE_SSIZE_T
+AC_HEADER_TIME
+AC_TYPE_UID_T
+
+
+# Checks for library functions.
+AC_FUNC_CLOSEDIR_VOID
+AC_FUNC_ERROR_AT_LINE
+AC_FUNC_FORK
+
+# uClibc has no getloadavg()
+# AC_FUNC_GETLOADAVG sounds promising, but does not really work
+#AC_FUNC_GETLOADAVG
+
+AC_PROG_GCC_TRADITIONAL
+
+# removed for uClibc compatibility
+#AC_FUNC_MALLOC
+#AC_FUNC_REALLOC
+
+AC_FUNC_SELECT_ARGTYPES
+AC_TYPE_SIGNAL
+AC_FUNC_STAT
+AC_FUNC_STRFTIME
+AC_FUNC_STRTOD
+AC_CHECK_FUNCS([dup2 floor gethostbyname gettimeofday memmove memset pow putenv regcomp select socket sqrt strcasecmp strchr strcspn strdup strerror strncasecmp strndup strpbrk strrchr strstr strtol strtoul uname])
+
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
+
+AC_MSG_RESULT(
+[-----------------------------------------]
+[included drivers:]
+[ $DRIVERS]
+[-----------------------------------------]
+[included plugins:]
+[ $PLUGINS]
+[-----------------------------------------]
+)
+
+AC_CONFIG_MACRO_DIR([m4])
+LT_INIT
diff --git a/contrib/picoLCD/lcd4linux.conf b/contrib/picoLCD/lcd4linux.conf
new file mode 100644
index 0000000..4b80e53
--- /dev/null
+++ b/contrib/picoLCD/lcd4linux.conf
@@ -0,0 +1,629 @@
+Display picoLCD {
+ Driver 'picoLCDGraphic'
+ Size '256x64'
+ Update 200
+ Contrast 230
+ Backlight 1
+ Inverted 1
+ Icons 1
+}
+
+Variables {
+ tick 500
+ tack 100
+ minute 60000
+}
+
+
+
+
+
+#Plugin MySQL {
+# server 'gsmlandia.com' # if none, localhost assumed
+# port 3306 # if none, MySQL default assumed
+# user 'lcd4linux' # if none, lcd4linux unix owner assumed
+# password 'lcd4linux' # if none, empty password assumed
+# database 'lcd4linux' # MUST be specified
+#}
+
+#Plugin Pop3 {
+# server1 'localhost'
+# port1 110
+# user1 'user'
+# password1 'pass'
+#}
+
+
+Widget OS {
+ class 'Text'
+ expression '*** '.uname('sysname').' '.uname('release').' ***'
+ width 20
+ align 'M'
+ style 'bold'
+ speed 50
+ update tick
+}
+
+
+
+
+Widget HDDTemp {
+ class 'Text'
+ expression 'IDE Temp'.exec ('hddtemp /dev/sda | cut -f 3 -d :', 1000)
+ width 14
+ align 'L'
+ update 1000
+}
+
+Widget FSSpace {
+ class 'Text'
+ expression a=((statfs('/', 'bavail')*statfs('/', 'bsize'))/1024/1024);b=((statfs('/media/disk', 'bavail')*statfs('/media/disk', 'bsize'))/1024/1024);c='/ '.' '.a.'MB /media/disk/ '.b.' MB'
+ prefix 'Free Space:'
+ postfix ''
+ width 42
+ align 'M'
+ #precision 0
+ update 1000
+}
+
+
+Widget BottomTicker {
+ class 'Text'
+ expression uname('sysname').' '.uname('nodename').' '.uname('release').' '.uname('machine').' '.cpuinfo('model name')
+ #expression strftime('%A %d/%m %H:%M:%S',time()).' '.cpuinfo('model name').' '. uptime('%d days %H:%M:%S')
+ #expression strftime('%A %d/%m %H:%M:%S',time())
+ prefix ''
+ width 42
+ align 'M'
+ speed 1000
+ update tick
+ style 'bold'
+}
+
+#Widget CPU {
+# class 'Text'
+# expression uname('machine')
+# prefix 'CPU '
+# width 9
+# align 'L'
+# style test::onoff(7)>0?'bold':'norm'
+# update tick
+#}
+
+
+Widget CPULabel {
+ class 'text'
+ expression 'CPU:'
+ width 4
+ align 'L'
+ style 'bold'
+}
+
+Widget CPU {
+ class 'Text'
+ expression proc_stat::cpu('busy', 500)
+ prefix ''
+ postfix '% '
+ width 5
+ precision 0
+ align 'R'
+ update tick
+}
+
+Widget CPUBar {
+ class 'Bar'
+ expression proc_stat::cpu('busy', 500)
+ expression2 proc_stat::cpu('system', 500)
+ length 10
+ min 1
+ max 100
+ direction 'E'
+ style 'H'
+ update tick
+}
+
+
+Widget RAMLabel {
+ class 'text'
+ expression 'RAM:'
+ width 4
+ align 'L'
+ style 'bold'
+}
+
+
+Widget RAMTotal {
+ class 'Text'
+ expression meminfo('MemTotal')/1024
+ postfix 'MB FREE'
+ width 11
+ precision 0
+ align 'L'
+ update tick
+}
+
+Widget RAMFree {
+ class 'Text'
+ expression meminfo('MemFree')/1024
+ prefix ''
+ postfix '/'
+ width 5
+ precision 0
+ align 'R'
+ update tick
+}
+
+Widget IDELabel {
+ class 'text'
+ expression 'IDE:'
+ width 4
+ align 'L'
+ style 'bold'
+}
+
+Widget IDEIn {
+ class 'text'
+ # In MB/s
+ expression (diskstats('sda', 'read_sectors', 500))/2048
+ prefix 'OUT '
+ postfix 'MB'
+ precision 2
+ align 'R'
+ width 10
+ update tick
+}
+
+Widget IDEOut {
+ class 'text'
+ # In MB/s
+ expression (diskstats('sda', 'write_sectors', 500))/2048
+ prefix 'IN '
+ postfix 'MB'
+ precision 2
+ align 'R'
+ width 10
+ update tick
+}
+
+Widget IDEBar {
+ class 'Bar'
+ expression diskstats('sda', 'read_sectors', 500)
+ expression2 diskstats('sda', 'write_sectors', 500)
+ length 14
+ direction 'E'
+ style 'H'
+ update tick
+}
+
+Widget ETHLabel {
+ class 'text'
+ expression 'ETH:'
+ width 4
+ align 'L'
+ style 'bold'
+}
+
+
+Widget ETHIn {
+ class 'Text'
+ expression (netdev('eth0', 'Rx_bytes', 500))/1024
+ prefix 'OUT'
+ postfix 'KB'
+ width 9
+ precision 0
+ align 'R'
+ update tick
+}
+
+Widget ETHOut {
+ class 'Text'
+ expression (netdev('eth0', 'Tx_bytes', 500))/1024
+ prefix 'IN'
+ postfix 'KB'
+ width 9
+ precision 0
+ align 'R'
+ update tick
+}
+
+Widget ETHBar {
+ class 'Bar'
+ expression netdev('eth0', 'Rx_bytes', 500)
+ expression2 netdev('eth0', 'Tx_bytes', 500)
+ length 14
+ direction 'E'
+ style 'H'
+ update tick
+}
+
+Widget Time {
+ class 'Text'
+ expression strftime('%a,%d/%m %H:%M:%S',time())
+ width 20
+ align 'Left'
+ update 1000
+}
+
+Widget Uptime {
+ class 'Text'
+ expression uptime('%d d %H:%M:%S')
+ width 21
+ align 'R'
+ prefix 'Uptime '
+ update 1000
+}
+
+
+#Widget Disk {
+# class 'Text'
+# # disk.[rw]blk return blocks, we assume a blocksize of 512
+# # to get the number in kB/s we would do blk*512/1024, which is blk/2
+# # expression (proc_stat::disk('.*', 'rblk', 500)+proc_stat::disk('.*', 'wblk', 500))/2
+# # with kernel 2.6, disk_io disappeared from /proc/stat but moved to /proc/diskstat
+# # therefore you have to use another function called 'diskstats':
+# expression diskstats('sda', 'read_sectors', 500) + diskstats('sda', 'write_sectors', 500)
+# prefix ''
+# postfix ' '
+# width 7
+# precision 0
+# align 'R'
+# update tick
+#}
+
+#Widget DiskBar {
+# class 'Bar'
+# #expression proc_stat::disk('.*', 'rblk', 500)
+# #expression2 proc_stat::disk('.*', 'wblk', 500)
+# # for kernel 2.6:
+# expression diskstats('sda', 'read_sectors', 500)
+# expression2 diskstats('sda', 'write_sectors', 500)
+# length 14
+# direction 'E'
+# update tack
+#}
+
+
+Widget PPP {
+ class 'Text'
+ expression (ppp('Rx:0', 500)+ppp('Tx:0', 500))
+ prefix 'PPP'
+ width 9
+ precision 0
+ align 'R'
+ update tick
+}
+
+Widget Temp {
+ class 'Text'
+ expression i2c_sensors('temp_input3')*1.0324-67
+ prefix 'Temp'
+ width 9
+ precision 1
+ align 'R'
+ update tick
+}
+
+Widget TempBar {
+ class 'Bar'
+ expression i2c_sensors('temp_input3')*1.0324-67
+ min 40
+ max 80
+ length 10
+ direction 'E'
+ update tack
+}
+
+Widget MySQLtest1 {
+ class 'Text'
+ expression MySQL::query('SELECT id FROM table1')
+ width 20
+ align 'R'
+ prefix 'MySQL test:'
+ update minute
+}
+
+Widget MySQLtest2 {
+ class 'Text'
+ expression MySQL::status()
+ width 20
+ align 'M'
+ prefix 'Status: '
+ update minute
+}
+
+
+
+
+# Icons
+
+Widget Heartbeat {
+ class 'Icon'
+ speed 800
+ Bitmap {
+ Row1 '.....|.....'
+ Row2 '.*.*.|.*.*.'
+ Row3 '*****|*.*.*'
+ Row4 '*****|*...*'
+ Row5 '.***.|.*.*.'
+ Row6 '.***.|.*.*.'
+ Row7 '..*..|..*..'
+ Row8 '.....|.....'
+ }
+}
+
+Widget EKG {
+ class 'Icon'
+ speed 50
+ Bitmap {
+ Row1 '.....|.....|.....|.....|.....|.....|.....|.....'
+ Row2 '.....|....*|...*.|..*..|.*...|*....|.....|.....'
+ Row3 '.....|....*|...*.|..*..|.*...|*....|.....|.....'
+ Row4 '.....|....*|...**|..**.|.**..|**...|*....|.....'
+ Row5 '.....|....*|...**|..**.|.**..|**...|*....|.....'
+ Row6 '.....|....*|...*.|..*.*|.*.*.|*.*..|.*...|*....'
+ Row7 '*****|*****|****.|***..|**..*|*..**|..***|.****'
+ Row8 '.....|.....|.....|.....|.....|.....|.....|.....'
+ }
+}
+Widget Karo {
+ class 'Icon'
+ speed 200
+ Bitmap {
+ Row1 '.....|.....|.....|.....|..*..|.....|.....|.....'
+ Row2 '.....|.....|.....|..*..|.*.*.|..*..|.....|.....'
+ Row3 '.....|.....|..*..|.*.*.|*...*|.*.*.|..*..|.....'
+ Row4 '.....|..*..|.*.*.|*...*|.....|*...*|.*.*.|..*..'
+ Row5 '.....|.....|..*..|.*.*.|*...*|.*.*.|..*..|.....'
+ Row6 '.....|.....|.....|..*..|.*.*.|..*..|.....|.....'
+ Row7 '.....|.....|.....|.....|..*..|.....|.....|.....'
+ Row8 '.....|.....|.....|.....|.....|.....|.....|.....'
+ }
+}
+Widget Heart {
+ class 'Icon'
+ speed 250
+ Bitmap {
+ Row1 '.....|.....|.....|.....|.....|.....'
+ Row2 '.*.*.|.....|.*.*.|.....|.....|.....'
+ Row3 '*****|.*.*.|*****|.*.*.|.*.*.|.*.*.'
+ Row4 '*****|.***.|*****|.***.|.***.|.***.'
+ Row5 '.***.|.***.|.***.|.***.|.***.|.***.'
+ Row6 '.***.|..*..|.***.|..*..|..*..|..*..'
+ Row7 '..*..|.....|..*..|.....|.....|.....'
+ Row8 '.....|.....|.....|.....|.....|.....'
+ }
+}
+Widget Blob {
+ class 'Icon'
+ speed 250
+ Bitmap {
+ Row1 '.....|.....|.....'
+ Row2 '.....|.....|.***.'
+ Row3 '.....|.***.|*...*'
+ Row4 '..*..|.*.*.|*...*'
+ Row5 '.....|.***.|*...*'
+ Row6 '.....|.....|.***.'
+ Row7 '.....|.....|.....'
+ Row8 '.....|.....|.....'
+ }
+}
+Widget Wave {
+ class 'Icon'
+ speed 100
+ Bitmap {
+ Row1 '..**.|.**..|**...|*....|.....|.....|.....|.....|....*|...**'
+ Row2 '.*..*|*..*.|..*..|.*...|*....|.....|.....|....*|...*.|..*..'
+ Row3 '*....|....*|...*.|..*..|.*...|*....|....*|...*.|..*..|.*...'
+ Row4 '*....|....*|...*.|..*..|.*...|*....|....*|...*.|..*..|.*...'
+ Row5 '*....|....*|...*.|..*..|.*...|*....|....*|...*.|..*..|.*...'
+ Row6 '.....|.....|....*|...*.|..*..|.*..*|*..*.|..*..|.*...|*....'
+ Row7 '.....|.....|.....|....*|...**|..**.|.**..|**...|*....|.....'
+ Row8 '.....|.....|.....|.....|.....|.....|.....|.....|.....|.....'
+ }
+}
+Widget Squirrel {
+ class 'Icon'
+ speed 100
+ Bitmap {
+ Row1 '.....|.....|.....|.....|.....|.....'
+ Row2 '.....|.....|.....|.....|.....|.....'
+ Row3 '.....|.....|.....|.....|.....|.....'
+ Row4 '**...|.**..|..**.|...**|....*|.....'
+ Row5 '*****|*****|*****|*****|*****|*****'
+ Row6 '...**|..**.|.**..|**...|*....|.....'
+ Row7 '.....|.....|.....|.....|.....|.....'
+ Row8 '.....|.....|.....|.....|.....|.....'
+ }
+}
+
+Widget IOIcon {
+ class 'Icon'
+ speed 100
+ Bitmap {
+ Row1 '.....|.....|.....|.....|.....|.....'
+ Row2 '...*.|.....|...*.|.....|...*.|.....'
+ Row3 '*****|.....|*****|.....|*****|.....'
+ Row4 '...*.|.....|...*.|.....|...*.|.....'
+ Row5 '.*...|.....|.*...|.....|.*...|.....'
+ Row6 '*****|.....|*****|.....|*****|.....'
+ Row7 '.*...|.....|.*...|.....|.*...|.....'
+ Row8 '.....|.....|.....|.....|.....|.....'
+ }
+}
+
+Widget Lightning {
+ class 'icon'
+ speed 100
+ visible cpu('busy', 500)-50
+ bitmap {
+ row1 '...***'
+ row2 '..***.'
+ row3 '.***..'
+ row4 '.****.'
+ row5 '..**..'
+ row6 '.**...'
+ row7 '**....'
+ row8 '*.....'
+ }
+}
+
+Widget Rain {
+ class 'icon'
+ speed 200
+ bitmap {
+ row1 '...*.|.....|.....|.*...|....*|..*..|.....|*....'
+ row2 '*....|...*.|.....|.....|.*...|....*|..*..|.....'
+ row3 '.....|*....|...*.|.....|.....|.*...|....*|..*..'
+ row4 '..*..|.....|*....|...*.|.....|.....|.*...|....*'
+ row5 '....*|..*..|.....|*....|...*.|.....|.....|.*...'
+ row6 '.*...|....*|..*..|.....|*....|...*.|.....|.....'
+ row7 '.....|.*...|....*|..*..|.....|*....|...*.|.....'
+ row8 '.....|.....|.*...|....*|..*..|.....|*....|...*.'
+ }
+}
+
+
+Widget GPO_Val1 {
+ class 'Text'
+ expression LCD::GPO(1)
+ prefix 'GPO#1'
+ width 10
+ precision 0
+ align 'R'
+ update tick
+}
+
+Widget GPI_Val1 {
+ class 'Text'
+ expression LCD::GPI(1)
+ prefix 'GPI#1'
+ width 10
+ precision 0
+ align 'R'
+ update tick
+}
+
+Widget GPO_Val4 {
+ class 'Text'
+ expression LCD::GPO(4)
+ prefix 'GPO#4'
+ width 10
+ precision 0
+ align 'R'
+ update tick
+}
+
+Widget GPO_Test1 {
+ class 'GPO'
+ expression 255*test::onoff(1)
+ update 300
+}
+
+Widget GPO_Test255 {
+ class 'GPO'
+ expression test::bar(0,255, 0, 1)
+ update 100
+}
+
+Widget GPO_picolcd {
+ class 'GPO'
+ expression test::onoff(1)
+ update 300
+}
+
+Widget CpuImage {
+ class 'Image'
+ file '/etc/picoLCDGraphic/Images/cpu_a.png'
+ update 1000
+ visible 1
+ inverted 0
+ reload 0
+}
+
+Widget HddImage {
+ class 'Image'
+ file '/etc/picoLCDGraphic/Images/hdd_a.png'
+ update 1000
+ visible 1
+ inverted 0
+ reload 0
+}
+
+Widget RamImage {
+ class 'Image'
+ file '/etc/picoLCDGraphic/Images/ram_a.png'
+ update 1000
+ visible 1
+ inverted 0
+ reload 0
+}
+
+Widget NetImage {
+ class 'Image'
+ file '/etc/picoLCDGraphic/Images/net_a.png'
+ update 1000
+ visible 1
+ inverted 0
+ reload 0
+}
+
+Widget FanImage {
+ class 'Image'
+ file '/etc/picoLCDGraphic/Images/fan_a.png'
+ update 1000
+ visible 1
+ inverted 0
+ reload 0
+}
+
+
+Layout picoLCD {
+# Layer 1 {
+# X0.Y0 'BandwidthImage'
+# }
+# Layer 1 {
+# X0.Y0 'CpuImage'
+# }
+ Row1 {
+ Col1 'CPULabel'
+ Col6 'CPU'
+ Col11 'CPUBar'
+ Col21 'RAMLabel'
+ Col26 'RAMFree'
+ Col31 'RAMTotal'
+ }
+ Row2 {
+ Col1 'IDELabel'
+ Col6 'IDEIn'
+ Col17 'IDEOut'
+ Col28 'IDEBar'
+ }
+ Row3 {
+ Col1 'FSSpace'
+ }
+ Row4 {
+ Col1 'ETHLabel'
+ Col6 'ETHIn'
+ Col17 'ETHOut'
+ Col28 'ETHBar'
+ }
+ Row7 {
+ Col1 'Time'
+ Col22 'Uptime'
+ }
+
+ Row8 {
+ Col1 'Uptime'
+ Col1 'BottomTicker'
+ }
+ #Layer 2 {
+ # X0.Y0 'ImageTest'
+ #}
+
+#GPO1 'GPO_picolcd'
+#GPO2 'GPO_picolcd'
+#GPO8 'GPO_picolcd'
+}
+
+Display 'picoLCD'
+Layout 'picoLCD'
diff --git a/contrib/picoLCD/lcd4linux.conf.mrtg b/contrib/picoLCD/lcd4linux.conf.mrtg
new file mode 100644
index 0000000..b74506b
--- /dev/null
+++ b/contrib/picoLCD/lcd4linux.conf.mrtg
@@ -0,0 +1,92 @@
+Display picoLCD {
+ Driver 'picoLCDGraphic'
+ Size '256x64'
+ Update 200
+ Contrast 230
+ Backlight 1
+ Inverted 1
+ Icons 1
+}
+
+
+Variables {
+ n 0
+ nkey 0
+ currentImage 'http://192.168.12.113/mrtg/127.0.0.1_2-month.png'
+ mrtgDayImageURL 'http://192.168.12.113/mrtg/127.0.0.1_2-day.png'
+ mrtgWeekImageURL 'http://192.168.12.113/mrtg/127.0.0.1_2-week.png'
+ #currentFile '/tmp/127.0.0.1_2-day.png'
+ currentFile ' '
+ tick 500
+ tack 100
+ minute 60000
+}
+
+Widget TimerW {
+ class 'Timer'
+ expression n=LCD::GPI(1);nkey=n!=0?n:nkey
+ active 1
+ update 100
+}
+
+
+# export PYTHONPATH which should point to the scripts usually /etc/picoLCDGraphic/Scripts
+Widget MRTGMinute {
+ class 'Text'
+ expression currentFile=python::exec('mrtg', 'saveimage', currentImage)
+ width 42
+ #update minute
+ update 100
+}
+
+Widget test {
+ class 'Text'
+ expression currentFile
+ width 42
+ #update minute
+ update 100
+}
+
+# Python script will save the filename as taken from the URL above in the /etc/picoLCDGraphic/Images path
+# Modify mrtg.py to save in another path and also change file tag below
+Widget BandwidthImage {
+ class 'Image'
+ file currentFile
+ visible 1
+ inverted 0
+ reload 1
+ #update minute
+ update 100
+ #update tick
+}
+
+Widget GPO_kup {
+ class 'GPO'
+ expression currentImage=nkey==5?mrtgDayImageURL:currentImage;nkey==5?1:0
+ update 300
+}
+
+ Widget GPO_kdown {
+ class 'GPO'
+ expression currentImage=nkey==7?mrtgWeekImageURL:currentImage;nkey==7?1:0
+ update 300
+}
+
+
+Layout picoLCD {
+ Row1 {
+ Col1 'MRTGMinute'
+ }
+
+ Layer 1 {
+ X0.Y0 'BandwidthImage'
+ }
+
+ Timer1 'TimerW'
+ GPO2 'GPO_kup'
+ GPO3 'GPO_kdown'
+
+}
+
+Display 'picoLCD'
+Layout 'picoLCD'
diff --git a/contrib/picoLCD/lcd4linux.conf.rss b/contrib/picoLCD/lcd4linux.conf.rss
new file mode 100644
index 0000000..95c58a8
--- /dev/null
+++ b/contrib/picoLCD/lcd4linux.conf.rss
@@ -0,0 +1,143 @@
+Display picoLCD {
+ Driver 'picoLCDGraphic'
+ Size '256x64'
+ Update 200
+ Contrast 230
+ Backlight 1
+ Inverted 1
+ Icons 1
+}
+
+
+Variables {
+ n 0
+ nkey 0
+ page 0
+ title 0
+ rss1 'http://slashdot.org/slashdot.rdf'
+ rss2 'http://www.engadget.com/rss.xml'
+ rss 'http://www.linuxsecurity.com/static-content/debian.rss'
+ tick 500
+ tack 100
+ minute 60000
+}
+
+Widget TimerW {
+ class 'Timer'
+ expression n=LCD::GPI(1);nkey=n
+ active 1
+ update 100
+}
+
+
+# export PYTHONPATH which should point to the scripts usually /etc/picoLCDGraphic/Scripts
+
+Widget RSSFeedInfo {
+ class 'Text'
+ #expression title=1+page;param='!'.title;python::exec('rsstimer', 'getfeed', rss.param)
+ expression rss.' page:'.page
+ width 42
+ align 'L'
+ style 'bold'
+ #update minute
+ update 500
+}
+
+Widget RSSFeedTitle1 {
+ class 'Text'
+ expression title=1+page;param='!'.title;python::exec('rsstimer', 'getfeed', rss.param)
+ width 42
+ prefix '>'
+ align 'L'
+ #update minute
+ update 500
+}
+
+
+
+Widget RSSFeedTitle2 {
+ class 'Text'
+ expression title=2+page;param='!'.title;python::exec('rsstimer', 'getfeed', rss.param)
+ width 42
+ prefix '>'
+ align 'L'
+ #update minute
+ update 500
+}
+
+
+Widget RSSFeedTitle3 {
+ class 'Text'
+ expression title=3+page;param='!'.title;python::exec('rsstimer', 'getfeed', rss.param)
+ width 42
+ prefix '>'
+ align 'L'
+ #update minute
+ update 500
+}
+
+Widget RSSFeedTitle4 {
+ class 'Text'
+ expression title=4+page;param='!'.title;python::exec('rsstimer', 'getfeed', rss.param)
+ width 42
+ prefix '>'
+ align 'L'
+ #update minute
+ update 500
+}
+
+
+Widget GPO_kback {
+ class 'GPO'
+ expression rss=nkey==1?rss1:rss
+ update 100
+}
+
+Widget GPO_khome {
+ class 'GPO'
+ expression rss=nkey==2?rss2:rss
+ update 100
+}
+
+
+Widget GPO_kup {
+ class 'GPO'
+ expression page=nkey==5?page-1:page#;nkey==5?1:0
+ update 100
+}
+
+ Widget GPO_kdown {
+ class 'GPO'
+ expression page=nkey==7?page+1:page#;nkey==7?1:0
+ update 100
+}
+
+
+Layout picoLCD {
+ Row1 {
+ Col1 'RSSFeedInfo'
+ }
+ Row2 {
+ Col1 'RSSFeedTitle1'
+ }
+ Row4 {
+ Col1 'RSSFeedTitle2'
+ }
+ Row6 {
+ Col1 'RSSFeedTitle3'
+ }
+ Row8 {
+ Col1 'RSSFeedTitle4'
+ }
+
+ Timer1 'TimerW'
+
+ GPO1 'GPO_kback'
+ GPO2 'GPO_khome'
+ GPO3 'GPO_kup'
+ GPO4 'GPO_kdown'
+
+}
+
+Display 'picoLCD'
+Layout 'picoLCD'
diff --git a/contrib/picoLCD/lcd4linux.conf.rss.timers b/contrib/picoLCD/lcd4linux.conf.rss.timers
new file mode 100644
index 0000000..8c9f32e
--- /dev/null
+++ b/contrib/picoLCD/lcd4linux.conf.rss.timers
@@ -0,0 +1,128 @@
+Display picoLCD {
+ Driver 'picoLCDGraphic'
+ Size '256x64'
+ Update 200
+ Contrast 230
+ Backlight 1
+ Inverted 1
+ Icons 1
+}
+
+
+Variables {
+ n 0
+ nkey 0
+ page 0
+ t 0
+ p ' '
+ r1 ' '
+ r2 ' '
+ r3 ' '
+ r4 ' '
+ rss 'http://slashdot.org/slashdot.rdf'
+
+ tick 500
+ tack 100
+ minute 60000
+ #rssRefresh minute
+ rssRefresh 1000
+}
+
+Widget TimerW {
+ class 'Timer'
+ expression n=LCD::GPI(1);nkey=n!=0?n:nkey
+ active 1
+ update 100
+}
+
+Widget TimerRSS {
+ class 'Timer'
+ expression t=1+page;p='!'.t;r1=python::exec('rss', 'pf', rss.p);t=2+page;p='!'.t;r2=python::exec('rss', 'pf', rss.p);t=3+page;p='!'.t;r3=python::exec('rss', 'pf', rss.p);t=4+page;p='!'.t;r4=python::exec('rss', 'pf', rss.p);rssRefresh=1000
+ active 1
+ update rssRefresh
+}
+
+
+# export PYTHONPATH which should point to the scripts usually /etc/picoLCDGraphic/Scripts
+Widget RSSFeedTitle1 {
+ class 'Text'
+ #expression title=1+page;param='!'.title;python::exec('rss', 'parsefeed', slashdotRSS.param)
+ expression r1
+ width 42
+ prefix '- '
+ align 'L'
+ #update minute
+ update 300
+}
+
+
+
+Widget RSSFeedTitle2 {
+ class 'Text'
+ expression r2
+ width 42
+ prefix '- '
+ align 'L'
+ #update minute
+ update 300
+}
+
+
+Widget RSSFeedTitle3 {
+ class 'Text'
+ expression r3
+ width 42
+ prefix '- '
+ align 'L'
+ #update minute
+ update 300
+}
+
+Widget RSSFeedTitle4 {
+ class 'Text'
+ expression r4
+ width 42
+ prefix '- '
+ align 'L'
+ #update minute
+ update 300
+}
+
+
+Widget GPO_kup {
+ class 'GPO'
+ expression page=nkey==5?0:page;nkey==5?1:0#;rssRefresh=nkey==5?100:rssRefresh
+ update 100
+}
+
+ Widget GPO_kdown {
+ class 'GPO'
+ expression page=nkey==7?4:page;nkey==7?1:0#;rssRefresh=nkey==7?100:rssRefresh
+ update 100
+}
+
+
+Layout picoLCD {
+ Row1 {
+ Col1 'RSSFeedTitle1'
+ }
+ Row3 {
+ Col1 'RSSFeedTitle2'
+ }
+ Row5 {
+ Col1 'RSSFeedTitle3'
+ }
+ Row7 {
+ Col1 'RSSFeedTitle4'
+ }
+
+ Timer1 'TimerW'
+ Timer2 'TimerRSS'
+
+ GPO2 'GPO_kup'
+ GPO3 'GPO_kdown'
+
+}
+
+Display 'picoLCD'
+Layout 'picoLCD'
diff --git a/contrib/picoLCD/mrtg.py b/contrib/picoLCD/mrtg.py
new file mode 100644
index 0000000..e501ca9
--- /dev/null
+++ b/contrib/picoLCD/mrtg.py
@@ -0,0 +1,21 @@
+import urllib
+import shutil
+
+download_path = "/tmp/"
+
+def saveimage(imageurl):
+ filename = imageurl.split('/')[-1]
+ tmpname = filename + ".tmp"
+ try:
+ urllib.urlretrieve(imageurl, download_path + tmpname)
+ except IOError:
+ return "Error downloading file"
+ else:
+ shutil.move(download_path + tmpname, download_path + filename)
+ return download_path + filename
+
+
+#saveimage("http://www.switch.ch/network/operation/statistics/geant2-day.png")
+#saveimage("http://192.168.12.113/mrtg/127.0.0.1_2-day.png")
+
+
diff --git a/contrib/picoLCD/rsstimer.py b/contrib/picoLCD/rsstimer.py
new file mode 100644
index 0000000..5da92ea
--- /dev/null
+++ b/contrib/picoLCD/rsstimer.py
@@ -0,0 +1,92 @@
+import feedparser
+import time
+import datetime
+import tempfile
+import linecache
+
+# temporary file used to store rss entries
+filename = "/tmp/rsstimer.tmp"
+# interval in seconds between rss updates
+updateinterval = 60
+
+# lcd4linux permits only 1 parameter passed to the function
+# we send the rss title id with the ! spacer
+def getfeed(rssfeed):
+ print rssfeed
+ idx = 0
+ feed = rssfeed.split('!')[0]
+ idx = int(rssfeed.split('!')[-1])
+ if (idx <= 0): idx = 1;
+
+ oldfeed = fgetfeed()
+
+ if (oldfeed != feed):
+ lastupdate = 0
+ print "Feed changed refresing"
+ else:
+ lastupdate = fgetseconds()
+
+ if (lastupdate <= 0):
+ saverss(feed)
+ else:
+ now = getseconds()
+ delta = now - lastupdate
+ if (delta > updateinterval):
+ print "Last update: " + str(delta) + " seconds ago. Updating the rss entries."
+ saverss(feed)
+ # first line in the file is the timestamp second is the feed url
+ output = linecache.getline(filename, idx + 2)
+ print output
+ return output
+
+def getseconds():
+ ts = datetime.datetime.now()
+ return time.mktime(ts.timetuple())
+
+def fgetseconds():
+ try:
+ f = open(filename, "r")
+ except IOError:
+ print "Cannot get timestamp from file"
+ return 0
+ else:
+ return float(f.readline())
+
+def fgetfeed():
+ try:
+ f = open(filename, "r")
+ except IOError:
+ print "Cannot get feed from file"
+ return ' '
+ else:
+ # skip first line
+ f.readline()
+ return f.readline().rstrip("\n")
+
+
+def saverss(rssfeed):
+ linecache.clearcache()
+ f = open(filename, "w")
+ # save timestamp
+ f.write(str(getseconds()))
+ f.write("\n")
+ # save feed url
+ f.write(rssfeed)
+ f.write("\n")
+ print "Downloading the rss feed from: " + rssfeed
+ feed = feedparser.parse(rssfeed)
+ for entry in feed.entries:
+ f.write(entry.title)
+ f.write("\n")
+ f.close
+ print "Done"
+
+def printrss():
+ f = open(filename, "r")
+ f.readline()
+ for line in f:
+ print line
+
+#print getfeed("http://slashdot.org/slashdot.rdf!5")
+print getfeed("http://www.linux.com/feed?theme=rss!1")
+
diff --git a/curses.m4 b/curses.m4
new file mode 100644
index 0000000..c6ab67e
--- /dev/null
+++ b/curses.m4
@@ -0,0 +1,322 @@
+dnl $Id: curses.m4 729 2007-01-14 13:44:38Z michael $
+dnl $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/curses.m4 $
+
+
+dnl Curses detection: Munged from Midnight Commander's configure.in
+dnl
+dnl What it does:
+dnl =============
+dnl
+dnl - Determine which version of curses is installed on your system
+dnl and set the -I/-L/-l compiler entries and add a few preprocessor
+dnl symbols
+dnl - Do an AC_SUBST on the CURSES_INCLUDEDIR and CURSES_LIBS so that
+dnl @CURSES_INCLUDEDIR@ and @CURSES_LIBS@ will be available in
+dnl Makefile.in's
+dnl - Modify the following configure variables (these are the only
+dnl curses.m4 variables you can access from within configure.in)
+dnl CURSES_INCLUDEDIR - contains -I's and possibly -DRENAMED_CURSES if
+dnl an ncurses.h that's been renamed to curses.h
+dnl is found.
+dnl CURSES_LIBS - sets -L and -l's appropriately
+dnl CFLAGS - if --with-sco, add -D_SVID3
+dnl has_curses - exports result of tests to rest of configure
+dnl
+dnl Usage:
+dnl ======
+dnl 1) Add lines indicated below to acconfig.h
+dnl 2) call AC_CHECK_CURSES after AC_PROG_CC in your configure.in
+dnl 3) Instead of #include <curses.h> you should use the following to
+dnl properly locate ncurses or curses header file
+dnl
+dnl #if defined(USE_NCURSES) && !defined(RENAMED_NCURSES)
+dnl #include <ncurses.h>
+dnl #else
+dnl #include <curses.h>
+dnl #endif
+dnl
+dnl 4) Make sure to add @CURSES_INCLUDEDIR@ to your preprocessor flags
+dnl 5) Make sure to add @CURSES_LIBS@ to your linker flags or LIBS
+dnl
+dnl Notes with automake:
+dnl - call AM_CONDITIONAL(HAS_CURSES, test "$has_curses" = true) from
+dnl configure.in
+dnl - your Makefile.am can look something like this
+dnl -----------------------------------------------
+dnl INCLUDES= blah blah blah $(CURSES_INCLUDEDIR)
+dnl if HAS_CURSES
+dnl CURSES_TARGETS=name_of_curses_prog
+dnl endif
+dnl bin_PROGRAMS = other_programs $(CURSES_TARGETS)
+dnl other_programs_SOURCES = blah blah blah
+dnl name_of_curses_prog_SOURCES = blah blah blah
+dnl other_programs_LDADD = blah
+dnl name_of_curses_prog_LDADD = blah $(CURSES_LIBS)
+dnl -----------------------------------------------
+dnl
+dnl
+dnl The following lines should be added to acconfig.h:
+dnl ==================================================
+dnl
+dnl /*=== Curses version detection defines ===*/
+dnl /* Found some version of curses that we're going to use */
+dnl #undef HAS_CURSES
+dnl
+dnl /* Use SunOS SysV curses? */
+dnl #undef USE_SUNOS_CURSES
+dnl
+dnl /* Use old BSD curses - not used right now */
+dnl #undef USE_BSD_CURSES
+dnl
+dnl /* Use SystemV curses? */
+dnl #undef USE_SYSV_CURSES
+dnl
+dnl /* Use Ncurses? */
+dnl #undef USE_NCURSES
+dnl
+dnl /* If you Curses does not have color define this one */
+dnl #undef NO_COLOR_CURSES
+dnl
+dnl /* Define if you want to turn on SCO-specific code */
+dnl #undef SCO_FLAVOR
+dnl
+dnl /* Set to reflect version of ncurses *
+dnl * 0 = version 1.*
+dnl * 1 = version 1.9.9g
+dnl * 2 = version 4.0/4.1 */
+dnl #undef NCURSES_970530
+dnl
+dnl /*=== End new stuff for acconfig.h ===*/
+dnl
+
+
+AC_DEFUN([AC_CHECK_CURSES],[
+ search_ncurses=true
+ screen_manager=""
+ has_curses=false
+
+ CFLAGS=${CFLAGS--O}
+
+ AC_SUBST(CURSES_LIBS)
+ AC_SUBST(CURSES_INCLUDEDIR)
+
+ AC_ARG_WITH(sco,
+ [ --with-sco Use this to turn on SCO-specific code],[
+ if test x$withval = xyes; then
+ AC_DEFINE(SCO_FLAVOR,1,[Define if you want to turn on SCO-specific code])
+ CFLAGS="$CFLAGS -D_SVID3"
+ fi
+ ])
+
+ AC_ARG_WITH(sunos-curses,
+ [ --with-sunos-curses Used to force SunOS 4.x curses],[
+ if test x$withval = xyes; then
+ AC_USE_SUNOS_CURSES
+ fi
+ ])
+
+ AC_ARG_WITH(osf1-curses,
+ [ --with-osf1-curses Used to force OSF/1 curses],[
+ if test x$withval = xyes; then
+ AC_USE_OSF1_CURSES
+ fi
+ ])
+
+ AC_ARG_WITH(vcurses,
+ [ --with-vcurses[=incdir] Used to force SysV curses],
+ if test x$withval != xyes; then
+ CURSES_INCLUDEDIR="-I$withval"
+ fi
+ AC_USE_SYSV_CURSES
+ )
+
+ AC_ARG_WITH(ncurses,
+ [ --with-ncurses[=dir] Compile with ncurses/locate base dir],
+ if test x$withval = xno ; then
+ search_ncurses=false
+ elif test x$withval != xyes ; then
+ CURSES_LIBS="$LIBS -L$withval/lib -lncurses"
+ CURSES_INCLUDEDIR="-I$withval/include"
+ search_ncurses=false
+ screen_manager="ncurses"
+ AC_DEFINE(USE_NCURSES,1,[Use Ncurses?])
+ AC_DEFINE(HAS_CURSES,1,[Found some version of curses that we're going to use])
+ has_curses=true
+ fi
+ )
+
+ if $search_ncurses
+ then
+ AC_SEARCH_NCURSES()
+ fi
+
+
+])
+
+
+AC_DEFUN([AC_USE_SUNOS_CURSES], [
+ search_ncurses=false
+ screen_manager="SunOS 4.x /usr/5include curses"
+ AC_MSG_RESULT(Using SunOS 4.x /usr/5include curses)
+ AC_DEFINE(USE_SUNOS_CURSES,1,[Use SunOS SysV curses?])
+ AC_DEFINE(HAS_CURSES,1,[Found some version of curses that we're going to use])
+ has_curses=true
+ AC_DEFINE(NO_COLOR_CURSES,1,[If you Curses does not have color define this one])
+ AC_DEFINE(USE_SYSV_CURSES,1,[Use SystemV curses?])
+ CURSES_INCLUDEDIR="-I/usr/5include"
+ CURSES_LIBS="/usr/5lib/libcurses.a /usr/5lib/libtermcap.a"
+ AC_MSG_RESULT(Please note that some screen refreshs may fail)
+])
+
+AC_DEFUN([AC_USE_OSF1_CURSES], [
+ AC_MSG_RESULT(Using OSF1 curses)
+ search_ncurses=false
+ screen_manager="OSF1 curses"
+ AC_DEFINE(HAS_CURSES,1,[Found some version of curses that we're going to use])
+ has_curses=true
+ AC_DEFINE(NO_COLOR_CURSES,1,[If you Curses does not have color define this one])
+ AC_DEFINE(USE_SYSV_CURSES,1,[Use SystemV curses?])
+ CURSES_LIBS="-lcurses"
+])
+
+AC_DEFUN([AC_USE_SYSV_CURSES], [
+ AC_MSG_RESULT(Using SysV curses)
+ AC_DEFINE(HAS_CURSES,1,[Found some version of curses that we're going to use])
+ has_curses=true
+ AC_DEFINE(USE_SYSV_CURSES,1,[Use SystemV curses?])
+ search_ncurses=false
+ screen_manager="SysV/curses"
+ CURSES_LIBS="-lcurses"
+])
+
+dnl AC_ARG_WITH(bsd-curses,
+dnl [--with-bsd-curses Used to compile with bsd curses, not very fancy],
+dnl search_ncurses=false
+dnl screen_manager="Ultrix/cursesX"
+dnl if test $system = ULTRIX
+dnl then
+dnl THIS_CURSES=cursesX
+dnl else
+dnl THIS_CURSES=curses
+dnl fi
+dnl
+dnl CURSES_LIBS="-l$THIS_CURSES -ltermcap"
+dnl AC_DEFINE(HAS_CURSES,1,[Found some version of curses that we're going to use])
+dnl has_curses=true
+dnl AC_DEFINE(USE_BSD_CURSES,1,[Use old BSD curses - not used right now])
+dnl AC_MSG_RESULT(Please note that some screen refreshs may fail)
+dnl AC_MSG_WARN(Use of the bsdcurses extension has some)
+dnl AC_MSG_WARN(display/input problems.)
+dnl AC_MSG_WARN(Reconsider using xcurses)
+dnl)
+
+
+dnl
+dnl Parameters: directory filename cureses_LIBS curses_INCLUDEDIR nicename
+dnl
+AC_DEFUN([AC_NCURSES], [
+ if $search_ncurses
+ then
+ if test -f $1/$2
+ then
+ AC_MSG_RESULT(Found ncurses on $1/$2)
+ CURSES_LIBS="$3"
+ CURSES_INCLUDEDIR="$4"
+ search_ncurses=false
+ screen_manager=$5
+ AC_DEFINE(HAS_CURSES,1,[Found some version of curses that we're going to use])
+ has_curses=true
+ AC_DEFINE(USE_NCURSES,1,[Use Ncurses?])
+ fi
+ fi
+])
+
+AC_DEFUN([AC_SEARCH_NCURSES], [
+ AC_CHECKING(location of ncurses.h file)
+
+ AC_NCURSES(/usr/include, ncurses.h, -lncurses,, "ncurses on /usr/include")
+ AC_NCURSES(/usr/include/ncurses, ncurses.h, -lncurses, -I/usr/include/ncurses, "ncurses on /usr/include/ncurses")
+ AC_NCURSES(/usr/local/include, ncurses.h, -L/usr/local/lib -lncurses, -I/usr/local/include, "ncurses on /usr/local")
+ AC_NCURSES(/usr/local/include/ncurses, ncurses.h, -L/usr/local/lib -L/usr/local/lib/ncurses -lncurses, -I/usr/local/include/ncurses, "ncurses on /usr/local/include/ncurses")
+
+ AC_NCURSES(/usr/local/include/ncurses, curses.h, -L/usr/local/lib -lncurses, -I/usr/local/include/ncurses -DRENAMED_NCURSES, "renamed ncurses on /usr/local/.../ncurses")
+
+ AC_NCURSES(/usr/include/ncurses, curses.h, -lncurses, -I/usr/include/ncurses -DRENAMED_NCURSES, "renamed ncurses on /usr/include/ncurses")
+
+ dnl
+ dnl We couldn't find ncurses, try SysV curses
+ dnl
+ if $search_ncurses
+ then
+ AC_EGREP_HEADER(init_color, /usr/include/curses.h,
+ AC_USE_SYSV_CURSES)
+ AC_EGREP_CPP(USE_NCURSES,[
+#include <curses.h>
+#ifdef __NCURSES_H
+#undef USE_NCURSES
+USE_NCURSES
+#endif
+],[
+ CURSES_INCLUDEDIR="$CURSES_INCLUDEDIR -DRENAMED_NCURSES"
+ AC_DEFINE(HAS_CURSES,1,[Found some version of curses that we're going to use])
+ has_curses=true
+ AC_DEFINE(USE_NCURSES,1,[Use Ncurses?])
+ search_ncurses=false
+ screen_manager="ncurses installed as curses"
+])
+ fi
+
+ dnl
+ dnl Try SunOS 4.x /usr/5{lib,include} ncurses
+ dnl The flags USE_SUNOS_CURSES, USE_BSD_CURSES and BUGGY_CURSES
+ dnl should be replaced by a more fine grained selection routine
+ dnl
+ if $search_ncurses
+ then
+ if test -f /usr/5include/curses.h
+ then
+ AC_USE_SUNOS_CURSES
+ fi
+ else
+ # check for ncurses version, to properly ifdef mouse-fix
+ AC_MSG_CHECKING(for ncurses version)
+ ncurses_version=unknown
+cat > conftest.$ac_ext <<EOF
+[#]line __oline__ "configure"
+#include "confdefs.h"
+#ifdef RENAMED_NCURSES
+#include <curses.h>
+#else
+#include <ncurses.h>
+#endif
+#undef VERSION
+VERSION:NCURSES_VERSION
+EOF
+ if (eval "$ac_cpp conftest.$ac_ext") 2>&AC_FD_CC |
+ egrep "VERSION:" >conftest.out 2>&1; then
+changequote(,)dnl
+ ncurses_version=`cat conftest.out|sed -e 's/^[^"]*"//' -e 's/".*//'`
+changequote([,])dnl
+ fi
+ rm -rf conftest*
+ AC_MSG_RESULT($ncurses_version)
+ case "$ncurses_version" in
+changequote(,)dnl
+ 4.[01])
+changequote([,])dnl
+ AC_DEFINE(NCURSES_970530,2,[Set to reflect version of ncurses])
+ ;;
+ 1.9.9g)
+ AC_DEFINE(NCURSES_970530,1,[Set to reflect version of ncurses])
+ ;;
+ 1*)
+ AC_DEFINE(NCURSES_970530,0,[Set to reflect version of ncurses])
+ ;;
+ esac
+ fi
+])
+
+
+
+
+
diff --git a/debug.c b/debug.c
new file mode 100644
index 0000000..56f1a9d
--- /dev/null
+++ b/debug.c
@@ -0,0 +1,93 @@
+/* $Id: debug.c 840 2007-09-09 12:17:42Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/debug.c $
+ *
+ * debug() and error() functions
+ *
+ * Copyright (C) 1999, 2000 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ * exported functions:
+ *
+ * message (level, format, ...)
+ * passes the arguments to vsprintf() and
+ * writes the resulting string either to stdout
+ * or syslog.
+ * this function should not be called directly,
+ * but the macros info(), debug() and error()
+ *
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <stdarg.h>
+#include <syslog.h>
+
+#include "debug.h"
+
+int running_foreground = 0;
+int running_background = 0;
+
+int verbose_level = 0;
+
+void message(const int level, const char *format, ...)
+{
+ va_list ap;
+ char buffer[256];
+ static int log_open = 0;
+
+ if (level > verbose_level)
+ return;
+
+ va_start(ap, format);
+ vsnprintf(buffer, sizeof(buffer), format, ap);
+ va_end(ap);
+
+ if (!running_background) {
+
+#ifdef WITH_CURSES
+ extern int curses_error(char *);
+ if (!curses_error(buffer))
+#endif
+ fprintf(level ? stdout : stderr, "%s\n", buffer);
+ }
+
+ if (running_foreground)
+ return;
+
+ if (!log_open) {
+ openlog("LCD4Linux", LOG_PID, LOG_USER);
+ log_open = 1;
+ }
+
+ switch (level) {
+ case 0:
+ syslog(LOG_ERR, "%s", buffer);
+ break;
+ case 1:
+ syslog(LOG_INFO, "%s", buffer);
+ break;
+ default:
+ syslog(LOG_DEBUG, "%s", buffer);
+ }
+}
diff --git a/debug.h b/debug.h
new file mode 100644
index 0000000..09c93c7
--- /dev/null
+++ b/debug.h
@@ -0,0 +1,40 @@
+/* $Id: debug.h 840 2007-09-09 12:17:42Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/debug.h $
+ *
+ * debug messages
+ *
+ * Copyright (C) 1999, 2000 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+#ifndef _DEBUG_H_
+#define _DEBUG_H_
+
+extern int running_foreground;
+extern int running_background;
+extern int verbose_level;
+
+void message(const int level, const char *format, ...) __attribute__ ((format(__printf__, 2, 3)));
+
+#define debug(args...) message (2, __FILE__ ": " args)
+#define info(args...) message (1, args)
+#define error(args...) message (0, args)
+
+#endif
diff --git a/depcomp b/depcomp
new file mode 100644
index 0000000..e5f9736
--- /dev/null
+++ b/depcomp
@@ -0,0 +1,589 @@
+#! /bin/sh
+# depcomp - compile a program generating dependencies as side-effects
+
+scriptversion=2007-03-29.01
+
+# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007 Free Software
+# Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
+
+case $1 in
+ '')
+ echo "$0: No command. Try \`$0 --help' for more information." 1>&2
+ exit 1;
+ ;;
+ -h | --h*)
+ cat <<\EOF
+Usage: depcomp [--help] [--version] PROGRAM [ARGS]
+
+Run PROGRAMS ARGS to compile a file, generating dependencies
+as side-effects.
+
+Environment variables:
+ depmode Dependency tracking mode.
+ source Source file read by `PROGRAMS ARGS'.
+ object Object file output by `PROGRAMS ARGS'.
+ DEPDIR directory where to store dependencies.
+ depfile Dependency file to output.
+ tmpdepfile Temporary file to use when outputing dependencies.
+ libtool Whether libtool is used (yes/no).
+
+Report bugs to <bug-automake@gnu.org>.
+EOF
+ exit $?
+ ;;
+ -v | --v*)
+ echo "depcomp $scriptversion"
+ exit $?
+ ;;
+esac
+
+if test -z "$depmode" || test -z "$source" || test -z "$object"; then
+ echo "depcomp: Variables source, object and depmode must be set" 1>&2
+ exit 1
+fi
+
+# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
+depfile=${depfile-`echo "$object" |
+ sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
+tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
+
+rm -f "$tmpdepfile"
+
+# Some modes work just like other modes, but use different flags. We
+# parameterize here, but still list the modes in the big case below,
+# to make depend.m4 easier to write. Note that we *cannot* use a case
+# here, because this file can only contain one case statement.
+if test "$depmode" = hp; then
+ # HP compiler uses -M and no extra arg.
+ gccflag=-M
+ depmode=gcc
+fi
+
+if test "$depmode" = dashXmstdout; then
+ # This is just like dashmstdout with a different argument.
+ dashmflag=-xM
+ depmode=dashmstdout
+fi
+
+case "$depmode" in
+gcc3)
+## gcc 3 implements dependency tracking that does exactly what
+## we want. Yay! Note: for some reason libtool 1.4 doesn't like
+## it if -MD -MP comes after the -MF stuff. Hmm.
+## Unfortunately, FreeBSD c89 acceptance of flags depends upon
+## the command line argument order; so add the flags where they
+## appear in depend2.am. Note that the slowdown incurred here
+## affects only configure: in makefiles, %FASTDEP% shortcuts this.
+ for arg
+ do
+ case $arg in
+ -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
+ *) set fnord "$@" "$arg" ;;
+ esac
+ shift # fnord
+ shift # $arg
+ done
+ "$@"
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ mv "$tmpdepfile" "$depfile"
+ ;;
+
+gcc)
+## There are various ways to get dependency output from gcc. Here's
+## why we pick this rather obscure method:
+## - Don't want to use -MD because we'd like the dependencies to end
+## up in a subdir. Having to rename by hand is ugly.
+## (We might end up doing this anyway to support other compilers.)
+## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
+## -MM, not -M (despite what the docs say).
+## - Using -M directly means running the compiler twice (even worse
+## than renaming).
+ if test -z "$gccflag"; then
+ gccflag=-MD,
+ fi
+ "$@" -Wp,"$gccflag$tmpdepfile"
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ rm -f "$depfile"
+ echo "$object : \\" > "$depfile"
+ alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
+## The second -e expression handles DOS-style file names with drive letters.
+ sed -e 's/^[^:]*: / /' \
+ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
+## This next piece of magic avoids the `deleted header file' problem.
+## The problem is that when a header file which appears in a .P file
+## is deleted, the dependency causes make to die (because there is
+## typically no way to rebuild the header). We avoid this by adding
+## dummy dependencies for each header file. Too bad gcc doesn't do
+## this for us directly.
+ tr ' ' '
+' < "$tmpdepfile" |
+## Some versions of gcc put a space before the `:'. On the theory
+## that the space means something, we add a space to the output as
+## well.
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly. Breaking it into two sed invocations is a workaround.
+ sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+hp)
+ # This case exists only to let depend.m4 do its work. It works by
+ # looking at the text of this script. This case will never be run,
+ # since it is checked for above.
+ exit 1
+ ;;
+
+sgi)
+ if test "$libtool" = yes; then
+ "$@" "-Wp,-MDupdate,$tmpdepfile"
+ else
+ "$@" -MDupdate "$tmpdepfile"
+ fi
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ rm -f "$depfile"
+
+ if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
+ echo "$object : \\" > "$depfile"
+
+ # Clip off the initial element (the dependent). Don't try to be
+ # clever and replace this with sed code, as IRIX sed won't handle
+ # lines with more than a fixed number of characters (4096 in
+ # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
+ # the IRIX cc adds comments like `#:fec' to the end of the
+ # dependency line.
+ tr ' ' '
+' < "$tmpdepfile" \
+ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
+ tr '
+' ' ' >> $depfile
+ echo >> $depfile
+
+ # The second pass generates a dummy entry for each header file.
+ tr ' ' '
+' < "$tmpdepfile" \
+ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
+ >> $depfile
+ else
+ # The sourcefile does not contain any dependencies, so just
+ # store a dummy comment line, to avoid errors with the Makefile
+ # "include basename.Plo" scheme.
+ echo "#dummy" > "$depfile"
+ fi
+ rm -f "$tmpdepfile"
+ ;;
+
+aix)
+ # The C for AIX Compiler uses -M and outputs the dependencies
+ # in a .u file. In older versions, this file always lives in the
+ # current directory. Also, the AIX compiler puts `$object:' at the
+ # start of each line; $object doesn't have directory information.
+ # Version 6 uses the directory in both cases.
+ dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
+ test "x$dir" = "x$object" && dir=
+ base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+ if test "$libtool" = yes; then
+ tmpdepfile1=$dir$base.u
+ tmpdepfile2=$base.u
+ tmpdepfile3=$dir.libs/$base.u
+ "$@" -Wc,-M
+ else
+ tmpdepfile1=$dir$base.u
+ tmpdepfile2=$dir$base.u
+ tmpdepfile3=$dir$base.u
+ "$@" -M
+ fi
+ stat=$?
+
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
+ exit $stat
+ fi
+
+ for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
+ do
+ test -f "$tmpdepfile" && break
+ done
+ if test -f "$tmpdepfile"; then
+ # Each line is of the form `foo.o: dependent.h'.
+ # Do two passes, one to just change these to
+ # `$object: dependent.h' and one to simply `dependent.h:'.
+ sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
+ # That's a tab and a space in the [].
+ sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
+ else
+ # The sourcefile does not contain any dependencies, so just
+ # store a dummy comment line, to avoid errors with the Makefile
+ # "include basename.Plo" scheme.
+ echo "#dummy" > "$depfile"
+ fi
+ rm -f "$tmpdepfile"
+ ;;
+
+icc)
+ # Intel's C compiler understands `-MD -MF file'. However on
+ # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
+ # ICC 7.0 will fill foo.d with something like
+ # foo.o: sub/foo.c
+ # foo.o: sub/foo.h
+ # which is wrong. We want:
+ # sub/foo.o: sub/foo.c
+ # sub/foo.o: sub/foo.h
+ # sub/foo.c:
+ # sub/foo.h:
+ # ICC 7.1 will output
+ # foo.o: sub/foo.c sub/foo.h
+ # and will wrap long lines using \ :
+ # foo.o: sub/foo.c ... \
+ # sub/foo.h ... \
+ # ...
+
+ "$@" -MD -MF "$tmpdepfile"
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ rm -f "$depfile"
+ # Each line is of the form `foo.o: dependent.h',
+ # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
+ # Do two passes, one to just change these to
+ # `$object: dependent.h' and one to simply `dependent.h:'.
+ sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
+ # Some versions of the HPUX 10.20 sed can't process this invocation
+ # correctly. Breaking it into two sed invocations is a workaround.
+ sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
+ sed -e 's/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+hp2)
+ # The "hp" stanza above does not work with aCC (C++) and HP's ia64
+ # compilers, which have integrated preprocessors. The correct option
+ # to use with these is +Maked; it writes dependencies to a file named
+ # 'foo.d', which lands next to the object file, wherever that
+ # happens to be.
+ # Much of this is similar to the tru64 case; see comments there.
+ dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
+ test "x$dir" = "x$object" && dir=
+ base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+ if test "$libtool" = yes; then
+ tmpdepfile1=$dir$base.d
+ tmpdepfile2=$dir.libs/$base.d
+ "$@" -Wc,+Maked
+ else
+ tmpdepfile1=$dir$base.d
+ tmpdepfile2=$dir$base.d
+ "$@" +Maked
+ fi
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile1" "$tmpdepfile2"
+ exit $stat
+ fi
+
+ for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
+ do
+ test -f "$tmpdepfile" && break
+ done
+ if test -f "$tmpdepfile"; then
+ sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
+ # Add `dependent.h:' lines.
+ sed -ne '2,${; s/^ *//; s/ \\*$//; s/$/:/; p;}' "$tmpdepfile" >> "$depfile"
+ else
+ echo "#dummy" > "$depfile"
+ fi
+ rm -f "$tmpdepfile" "$tmpdepfile2"
+ ;;
+
+tru64)
+ # The Tru64 compiler uses -MD to generate dependencies as a side
+ # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
+ # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
+ # dependencies in `foo.d' instead, so we check for that too.
+ # Subdirectories are respected.
+ dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
+ test "x$dir" = "x$object" && dir=
+ base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+
+ if test "$libtool" = yes; then
+ # With Tru64 cc, shared objects can also be used to make a
+ # static library. This mechanism is used in libtool 1.4 series to
+ # handle both shared and static libraries in a single compilation.
+ # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
+ #
+ # With libtool 1.5 this exception was removed, and libtool now
+ # generates 2 separate objects for the 2 libraries. These two
+ # compilations output dependencies in $dir.libs/$base.o.d and
+ # in $dir$base.o.d. We have to check for both files, because
+ # one of the two compilations can be disabled. We should prefer
+ # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
+ # automatically cleaned when .libs/ is deleted, while ignoring
+ # the former would cause a distcleancheck panic.
+ tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4
+ tmpdepfile2=$dir$base.o.d # libtool 1.5
+ tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
+ tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
+ "$@" -Wc,-MD
+ else
+ tmpdepfile1=$dir$base.o.d
+ tmpdepfile2=$dir$base.d
+ tmpdepfile3=$dir$base.d
+ tmpdepfile4=$dir$base.d
+ "$@" -MD
+ fi
+
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
+ exit $stat
+ fi
+
+ for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
+ do
+ test -f "$tmpdepfile" && break
+ done
+ if test -f "$tmpdepfile"; then
+ sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
+ # That's a tab and a space in the [].
+ sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
+ else
+ echo "#dummy" > "$depfile"
+ fi
+ rm -f "$tmpdepfile"
+ ;;
+
+#nosideeffect)
+ # This comment above is used by automake to tell side-effect
+ # dependency tracking mechanisms from slower ones.
+
+dashmstdout)
+ # Important note: in order to support this mode, a compiler *must*
+ # always write the preprocessed file to stdout, regardless of -o.
+ "$@" || exit $?
+
+ # Remove the call to Libtool.
+ if test "$libtool" = yes; then
+ while test $1 != '--mode=compile'; do
+ shift
+ done
+ shift
+ fi
+
+ # Remove `-o $object'.
+ IFS=" "
+ for arg
+ do
+ case $arg in
+ -o)
+ shift
+ ;;
+ $object)
+ shift
+ ;;
+ *)
+ set fnord "$@" "$arg"
+ shift # fnord
+ shift # $arg
+ ;;
+ esac
+ done
+
+ test -z "$dashmflag" && dashmflag=-M
+ # Require at least two characters before searching for `:'
+ # in the target name. This is to cope with DOS-style filenames:
+ # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
+ "$@" $dashmflag |
+ sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
+ rm -f "$depfile"
+ cat < "$tmpdepfile" > "$depfile"
+ tr ' ' '
+' < "$tmpdepfile" | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly. Breaking it into two sed invocations is a workaround.
+ sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+dashXmstdout)
+ # This case only exists to satisfy depend.m4. It is never actually
+ # run, as this mode is specially recognized in the preamble.
+ exit 1
+ ;;
+
+makedepend)
+ "$@" || exit $?
+ # Remove any Libtool call
+ if test "$libtool" = yes; then
+ while test $1 != '--mode=compile'; do
+ shift
+ done
+ shift
+ fi
+ # X makedepend
+ shift
+ cleared=no
+ for arg in "$@"; do
+ case $cleared in
+ no)
+ set ""; shift
+ cleared=yes ;;
+ esac
+ case "$arg" in
+ -D*|-I*)
+ set fnord "$@" "$arg"; shift ;;
+ # Strip any option that makedepend may not understand. Remove
+ # the object too, otherwise makedepend will parse it as a source file.
+ -*|$object)
+ ;;
+ *)
+ set fnord "$@" "$arg"; shift ;;
+ esac
+ done
+ obj_suffix="`echo $object | sed 's/^.*\././'`"
+ touch "$tmpdepfile"
+ ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
+ rm -f "$depfile"
+ cat < "$tmpdepfile" > "$depfile"
+ sed '1,2d' "$tmpdepfile" | tr ' ' '
+' | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly. Breaking it into two sed invocations is a workaround.
+ sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile" "$tmpdepfile".bak
+ ;;
+
+cpp)
+ # Important note: in order to support this mode, a compiler *must*
+ # always write the preprocessed file to stdout.
+ "$@" || exit $?
+
+ # Remove the call to Libtool.
+ if test "$libtool" = yes; then
+ while test $1 != '--mode=compile'; do
+ shift
+ done
+ shift
+ fi
+
+ # Remove `-o $object'.
+ IFS=" "
+ for arg
+ do
+ case $arg in
+ -o)
+ shift
+ ;;
+ $object)
+ shift
+ ;;
+ *)
+ set fnord "$@" "$arg"
+ shift # fnord
+ shift # $arg
+ ;;
+ esac
+ done
+
+ "$@" -E |
+ sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
+ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
+ sed '$ s: \\$::' > "$tmpdepfile"
+ rm -f "$depfile"
+ echo "$object : \\" > "$depfile"
+ cat < "$tmpdepfile" >> "$depfile"
+ sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+msvisualcpp)
+ # Important note: in order to support this mode, a compiler *must*
+ # always write the preprocessed file to stdout, regardless of -o,
+ # because we must use -o when running libtool.
+ "$@" || exit $?
+ IFS=" "
+ for arg
+ do
+ case "$arg" in
+ "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
+ set fnord "$@"
+ shift
+ shift
+ ;;
+ *)
+ set fnord "$@" "$arg"
+ shift
+ shift
+ ;;
+ esac
+ done
+ "$@" -E |
+ sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
+ rm -f "$depfile"
+ echo "$object : \\" > "$depfile"
+ . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
+ echo " " >> "$depfile"
+ . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+none)
+ exec "$@"
+ ;;
+
+*)
+ echo "Unknown depmode $depmode" 1>&2
+ exit 1
+ ;;
+esac
+
+exit 0
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
diff --git a/drivers.m4 b/drivers.m4
new file mode 100644
index 0000000..cccfbee
--- /dev/null
+++ b/drivers.m4
@@ -0,0 +1,959 @@
+dnl $Id: drivers.m4 1198 2013-05-23 03:05:50Z michael $
+dnl $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/drivers.m4 $
+
+
+dnl LCD4Linux Drivers conf part
+dnl
+dnl Copyright (C) 1999, 2000, 2001, 2002, 2003 Michael Reinelt <michael@reinelt.co.at>
+dnl Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+dnl
+dnl This file is part of LCD4Linux.
+dnl
+dnl LCD4Linux is free software; you can redistribute it and/or modify
+dnl it under the terms of the GNU General Public License as published by
+dnl the Free Software Foundation; either version 2, or (at your option)
+dnl any later version.
+dnl
+dnl LCD4Linux is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+dnl GNU General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU General Public License
+dnl along with this program; if not, write to the Free Software
+dnl Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+AC_MSG_CHECKING([which drivers to compile])
+AC_ARG_WITH(
+ drivers,
+ [ --with-drivers=<list> compile driver for displays in <list>,]
+ [ drivers may be separated with commas,]
+ [ 'all' (default) compiles all available drivers,]
+ [ drivers may be excluded with 'all,!<driver>',]
+ [ (try 'all,\!<driver>' if your shell complains...)]
+ [ possible drivers are:]
+ [ ASTUSB, BeckmannEgle, BWCT, CrystalFontz, Curses, Cwlinux, D4D, DPF]
+ [ EA232graphic, EFN, FutabaVFD, FW8888, G15, GLCD2USB, HD44780, HD44780-I2C,]
+ [ IRLCD, LCD2USB, LCDLinux, LEDMatrix, LCDTerm, LPH7508, LUIse,]
+ [ LW_ABP, M50530, MatrixOrbital, MatrixOrbitalGX, MilfordInstruments, MDM166A,]
+ [ Newhaven, Noritake, NULL, Pertelian, PHAnderson,]
+ [ PICGraphic, picoLCD, picoLCDGraphic, PNG, PPM, RouterBoard,]
+ [ Sample, SamsungSPF, serdisplib, ShuttleVFD, SimpleLCD, st2205, T6963,]
+ [ TeakLCM, Trefon, ULA200, USBHUB, USBLCD, VNC, WincorNixdorf, X11],
+ drivers=$withval,
+ drivers=all
+)
+
+drivers=`echo $drivers|sed 's/,/ /g'`
+
+for driver in $drivers; do
+
+ case $driver in
+ !*)
+ val="no"
+ driver=`echo $driver|cut -c 2-`
+ ;;
+ *)
+ val="yes"
+ ;;
+ esac
+
+ case "$driver" in
+ all)
+ ASTUSB="yes"
+ BECKMANNEGLE="yes"
+ BWCT="yes"
+ CRYSTALFONTZ="yes"
+ CURSES="yes"
+ CWLINUX="yes"
+ D4D="yes"
+ DPF="yes"
+ EA232graphic="yes"
+ EFN="yes"
+ FUTABAVFD="yes"
+ FW8888="yes"
+ G15="yes"
+ GLCD2USB="yes"
+ HD44780="yes"
+ HD44780_I2C="yes"
+ IRLCD="yes"
+ LCD2USB="yes"
+ LCDLINUX="yes"
+ LCDTERM="yes"
+ LEDMATRIX="yes"
+ LPH7508="yes"
+ LUISE="yes"
+ LW_ABP="yes"
+ M50530="yes"
+ MATRIXORBITAL="yes"
+ MATRIXORBITALGX="yes"
+ MDM166A="yes"
+ MILINST="yes"
+ NEWHAVEN="yes"
+ NORITAKE="yes"
+ NULL="yes"
+ PERTELIAN="yes"
+ PHANDERSON="yes"
+ PICGRAPHIC="yes"
+ PICOLCD="yes"
+ PICOLCDGRAPHIC="yes"
+ PNG="yes"
+ PPM="yes"
+ ROUTERBOARD="yes"
+ SAMPLE="yes"
+ SAMSUNGSPF="yes"
+ ST2205="yes"
+ SERDISPLIB="yes"
+ SHUTTLEVFD="yes"
+ SIMPLELCD="yes"
+ T6963="yes"
+ TeakLCM="yes"
+ Trefon="yes"
+ ULA200="yes"
+ USBHUB="yes"
+ USBLCD="yes"
+ VNC="yes"
+ WINCORNIXDORF="yes"
+ X11="yes"
+ ;;
+ ASTUSB)
+ ASTUSB=$val
+ ;;
+ BeckmannEgle)
+ BECKMANNEGLE=$val
+ ;;
+ BWCT)
+ BWCT=$val
+ ;;
+ CrystalFontz)
+ CRYSTALFONTZ=$val
+ ;;
+ Curses)
+ CURSES=$val
+ ;;
+ Cwlinux)
+ CWLINUX=$val
+ ;;
+ D4D)
+ D4D=$val
+ ;;
+ DPF)
+ DPF=$val
+ ;;
+ EA232graphic)
+ EA232graphic=$val
+ ;;
+ EFN)
+ EFN=$val
+ ;;
+ FutabaVFD)
+ FUTABAVFD=$val
+ ;;
+ FW8888)
+ FW8888=$val
+ ;;
+ G15)
+ G15=$val
+ ;;
+ GLCD2USB)
+ GLCD2USB=$val
+ ;;
+ HD44780)
+ HD44780=$val
+ ;;
+ HD44780-I2C)
+ HD44780_I2C=$val
+ ;;
+ IRLCD)
+ IRLCD=$val
+ ;;
+ LCD2USB)
+ LCD2USB=$val
+ ;;
+ LCDLinux)
+ LCDLINUX=$val
+ ;;
+ LCDTerm)
+ LCDTERM=$val
+ ;;
+ LEDMatrix)
+ LEDMATRIX=$val
+ ;;
+ LPH7508)
+ LPH7508=$val
+ ;;
+ LUIse)
+ LUISE=$val
+ ;;
+ LW_ABP)
+ LW_ABP=$val
+ ;;
+ M50530)
+ M50530=$val
+ ;;
+ MatrixOrbital)
+ MATRIXORBITAL=$val
+ ;;
+ MatrixOrbitalGX)
+ MATRIXORBITALGX=$val
+ ;;
+ MDM166A)
+ MDM166A=$val
+ ;;
+ MilfordInstruments)
+ MILINST=$val
+ ;;
+ Newhaven)
+ NEWHAVEN=$val
+ ;;
+ Noritake)
+ NORITAKE=$val;
+ ;;
+ NULL)
+ NULL=$val;
+ ;;
+ Pertelian)
+ PERTELIAN=$val
+ ;;
+ PHAnderson)
+ PHANDERSON=$val
+ ;;
+ PICGraphic)
+ PICGRAPHIC=$val
+ ;;
+ picoLCD)
+ PICOLCD=$val
+ ;;
+ picoLCDGraphic)
+ PICOLCDGRAPHIC=$val
+ ;;
+ PNG)
+ PNG=$val
+ ;;
+ PPM)
+ PPM=$val
+ ;;
+ RouterBoard)
+ ROUTERBOARD=$val
+ ;;
+ Sample)
+ SAMPLE=$val
+ ;;
+ SamsungSPF)
+ SAMSUNGSPF=$val
+ ;;
+ serdisplib)
+ SERDISPLIB=$val;
+ ;;
+ ShuttleVFD)
+ SHUTTLEVFD=$val
+ ;;
+ SimpleLCD)
+ SIMPLELCD=$val
+ ;;
+ st2205)
+ ST2205=$val
+ ;;
+ T6963)
+ T6963=$val
+ ;;
+ TeakLCM)
+ TeakLCM=$val
+ ;;
+ Trefon)
+ Trefon=$val
+ ;;
+ ULA200)
+ ULA200=$val
+ ;;
+ USBHUB)
+ USBHUB=$val
+ ;;
+ USBLCD)
+ USBLCD=$val
+ ;;
+ VNC)
+ VNC=$val
+ ;;
+ WincorNixdorf)
+ WINCORNIXDORF=$val
+ ;;
+ X11)
+ X11=$val
+ ;;
+ *)
+ AC_MSG_ERROR([Unknown driver '$driver'])
+ ;;
+ esac
+done
+
+AC_MSG_RESULT([done])
+
+
+# generic display drivers
+TEXT="no"
+GRAPHIC="no"
+IMAGE="no"
+GPIO="no"
+
+# generiv I/O drivers
+PARPORT="no"
+SERIAL="no"
+I2C="no"
+KEYPAD="no"
+
+# generic libraries
+LIBUSB="no"
+LIBUSB10="no"
+LIBFTDI="no"
+
+if test "$ASTUSB" = "yes"; then
+ if test "$has_usb" = "true"; then
+ TEXT="yes"
+ SERIAL="yes"
+ DRIVERS="$DRIVERS drv_ASTUSB.o"
+ LIBUSB="yes"
+ AC_DEFINE(WITH_ASTUSB,1,[ASTUSB driver])
+ else
+ AC_MSG_WARN(usb.h not found: ASTUSB driver disabled)
+ fi
+fi
+
+if test "$BECKMANNEGLE" = "yes"; then
+ TEXT="yes"
+ GPIO="yes"
+ SERIAL="yes"
+ DRIVERS="$DRIVERS drv_BeckmannEgle.o"
+ AC_DEFINE(WITH_BECKMANNEGLE,1,[Beckmann&Egle driver])
+fi
+
+if test "$BWCT" = "yes"; then
+ if test "$has_usb" = "true"; then
+ TEXT="yes"
+ DRIVERS="$DRIVERS drv_BWCT.o"
+ LIBUSB="yes"
+ AC_DEFINE(WITH_BWCT,1,[BWCT driver])
+ else
+ AC_MSG_WARN(usb.h not found: BWCT driver disabled)
+ fi
+fi
+
+if test "$CRYSTALFONTZ" = "yes"; then
+ TEXT="yes"
+ GPIO="yes"
+ SERIAL="yes"
+ KEYPAD="yes"
+ DRIVERS="$DRIVERS drv_Crystalfontz.o"
+ AC_DEFINE(WITH_CRYSTALFONTZ,1,[Crystalfontz driver])
+fi
+
+if test "$CURSES" = "yes"; then
+ if test "$has_curses" = true; then
+ TEXT="yes"
+ KEYPAD="yes"
+ DRIVERS="$DRIVERS drv_Curses.o"
+ DRVLIBS="$DRVLIBS $CURSES_LIBS"
+ CPPFLAGS="$CPPFLAGS $CURSES_INCLUDES"
+ AC_DEFINE(WITH_CURSES,1,[Curses driver])
+ else
+ AC_MSG_WARN(curses not found: Curses driver disabled)
+ fi
+fi
+
+if test "$CWLINUX" = "yes"; then
+ TEXT="yes"
+ GPIO="yes"
+ SERIAL="yes"
+ KEYPAD="yes"
+ DRIVERS="$DRIVERS drv_Cwlinux.o"
+ AC_DEFINE(WITH_CWLINUX,1,[CwLinux driver])
+fi
+
+if test "$D4D" = "yes"; then
+ TEXT="yes"
+ GRAPHIC="yes"
+ SERIAL="yes"
+ DRIVERS="$DRIVERS drv_D4D.o"
+ AC_DEFINE(WITH_D4D,1,[D4D driver])
+fi
+
+if test "$DPF" = "yes"; then
+ GRAPHIC="yes"
+ DRIVERS="$DRIVERS drv_dpf.o"
+ LIBUSB="yes"
+ AC_DEFINE(WITH_DPF,1,[DPF driver])
+fi
+
+if test "$EA232graphic" = "yes"; then
+ GRAPHIC="yes"
+ SERIAL="yes"
+ GPIO="yes"
+ DRIVERS="$DRIVERS drv_EA232graphic.o"
+ AC_DEFINE(WITH_EA232graphic,1,[Electronic Assembly RS232 graphic driver])
+fi
+
+if test "$EFN" = "yes"; then
+ TEXT="yes"
+ DRIVERS="$DRIVERS drv_EFN.o"
+ AC_DEFINE(WITH_EFN,1,[Driver for EFN LED modules and EUG 100 ethernet to serial converter])
+fi
+
+if test "$FUTABAVFD" = "yes"; then
+ if test "$has_parport" = "true"; then
+ TEXT="yes"
+ # select bus: serial (including USB), parallel or i2c
+ PARPORT="yes"
+ DRIVERS="$DRIVERS drv_FutabaVFD.o"
+ AC_DEFINE(WITH_FUTABAVFD,1,[FutabaVFD driver])
+ else
+ AC_MSG_WARN(asm/io.h or {linux/parport.h and linux/ppdev.h} not found: FutabaVFD driver disabled)
+ fi
+fi
+
+
+
+if test "$FW8888" = "yes"; then
+ TEXT="yes"
+ SERIAL="yes"
+ DRIVERS="$DRIVERS drv_FW8888.o"
+ AC_DEFINE(WITH_FW8888,1,[Allnet FW8888 driver])
+fi
+
+if test "$G15" = "yes"; then
+ if test "$has_usb" = "true"; then
+ GRAPHIC="yes"
+ LIBUSB="yes"
+ DRIVERS="$DRIVERS drv_G15.o"
+ AC_DEFINE(WITH_G15,1,[G-15 driver])
+ else
+ AC_MSG_WARN(usb.h not found: G15 driver disabled)
+ fi
+fi
+
+if test "$GLCD2USB" = "yes"; then
+ if test "$has_usb" = "true"; then
+ GRAPHIC="yes"
+ KEYPAD="yes"
+ DRIVERS="$DRIVERS drv_GLCD2USB.o"
+ LIBUSB="yes"
+ AC_DEFINE(WITH_GLCD2USB,1,[GLCD2USB driver])
+ else
+ AC_MSG_WARN(usb.h not found: GLCD2USB driver disabled)
+ fi
+fi
+
+if test "$HD44780_I2C" = "yes"; then
+ TEXT="yes"
+ I2C="yes"
+ GPIO="yes"
+ DRIVERS="$DRIVERS drv_HD44780.o"
+ AC_DEFINE(WITH_HD44780,1,[HD44780 driver])
+fi
+
+if test "$HD44780" = "yes"; then
+ if test "$HD44780_I2C" != "yes"; then
+ if test "$has_parport" = "true"; then
+ TEXT="yes"
+ PARPORT="yes"
+ I2C="yes"
+ GPIO="yes"
+ KEYPAD="yes"
+ DRIVERS="$DRIVERS drv_HD44780.o"
+ AC_DEFINE(WITH_HD44780,1,[HD44780 driver])
+ else
+ AC_MSG_WARN(asm/io.h or {linux/parport.h and linux/ppdev.h} not found: HD44780 driver disabled)
+ fi
+ else
+ HD44780="no"
+ AC_MSG_WARN(HD44780-i2c enabled disabling HD44780)
+ fi
+fi
+
+if test "$IRLCD" = "yes"; then
+ if test "$has_usb" = "true"; then
+ TEXT="yes"
+ SERIAL="yes"
+ DRIVERS="$DRIVERS drv_IRLCD.o"
+ LIBUSB="yes"
+ AC_DEFINE(WITH_IRLCD,1,[IRLCD driver])
+ else
+ AC_MSG_WARN(usb.h not found: IRLCD driver disabled)
+ fi
+fi
+
+if test "$LCD2USB" = "yes"; then
+ if test "$has_usb" = "true"; then
+ TEXT="yes"
+ SERIAL="yes"
+ KEYPAD="yes"
+ DRIVERS="$DRIVERS drv_LCD2USB.o"
+ LIBUSB="yes"
+ AC_DEFINE(WITH_LCD2USB,1,[LCD2USB driver])
+ else
+ AC_MSG_WARN(usb.h not found: LCD2USB driver disabled)
+ fi
+fi
+
+if test "$LCDLINUX" = "yes"; then
+ if test "$has_lcd_linux" = true; then
+ TEXT="yes"
+ DRIVERS="$DRIVERS drv_LCDLinux.o"
+ AC_DEFINE(WITH_LCDLINUX,1,[LCD-Linux driver])
+ else
+ AC_MSG_WARN(linux/lcd-linux.h or linux/hd44780.h not found: LCD-Linux driver disabled)
+ fi
+fi
+
+if test "$LCDTERM" = "yes"; then
+ TEXT="yes"
+ SERIAL="yes"
+ DRIVERS="$DRIVERS drv_LCDTerm.o"
+ AC_DEFINE(WITH_LCDTERM,1,[LCDTerm driver])
+fi
+
+if test "$LEDMATRIX" = "yes"; then
+ GRAPHIC="yes"
+ DRIVERS="$DRIVERS drv_LEDMatrix.o"
+ AC_DEFINE(WITH_LEDMATRIX,1,[LEDMatrix driver])
+fi
+
+if test "$LPH7508" = "yes"; then
+ if test "$has_parport" = "true"; then
+ GRAPHIC="yes"
+ GPIO="yes"
+ PARPORT="yes"
+ DRIVERS="$DRIVERS drv_LPH7508.o"
+ AC_DEFINE(WITH_LPH7508,1,[LPH7508 driver])
+ else
+ AC_MSG_WARN(asm/io.h or {linux/parport.h and linux/ppdev.h} not found: LPH7508 driver disabled)
+ fi
+fi
+
+if test "$LUISE" = "yes"; then
+ if test "$has_luise" = "true"; then
+ GRAPHIC="yes"
+ DRIVERS="$DRIVERS drv_LUIse.o"
+ DRVLIBS="$DRVLIBS -L/usr/local/lib -lluise"
+ AC_DEFINE(WITH_LUISE,1,[LUIse driver])
+ else
+ AC_MSG_WARN(luise.h not found: LUIse driver disabled)
+ fi
+fi
+
+if test "$LW_ABP" = "yes"; then
+ TEXT="yes"
+ SERIAL="yes"
+ KEYPAD="yes"
+ DRIVERS="$DRIVERS drv_LW_ABP.o"
+ AC_DEFINE(WITH_LW_ABP,1,[LW ABP driver])
+fi
+
+if test "$M50530" = "yes"; then
+ if test "$has_parport" = "true"; then
+ TEXT="yes"
+ GPIO="yes"
+ PARPORT="yes"
+ DRIVERS="$DRIVERS drv_M50530.o"
+ AC_DEFINE(WITH_M50530,1,[M50530 driver])
+ else
+ AC_MSG_WARN(asm/io.h or {linux/parport.h and linux/ppdev.h} not found: M50530 driver disabled)
+ fi
+fi
+
+if test "$MATRIXORBITAL" = "yes"; then
+ TEXT="yes"
+ GPIO="yes"
+ SERIAL="yes"
+ DRIVERS="$DRIVERS drv_MatrixOrbital.o"
+ AC_DEFINE(WITH_MATRIXORBITAL,1,[MatrixOrbital driver])
+fi
+
+if test "$MATRIXORBITALGX" = "yes"; then
+ if test "$has_usb" = "true"; then
+ GRAPHIC="yes"
+ SERIAL="yes"
+ LIBUSB="yes"
+ DRIVERS="$DRIVERS drv_MatrixOrbitalGX.o"
+ AC_DEFINE(WITH_MATRIXORBITALGX,1,[MatrixOrbitalGX driver])
+ else
+ AC_MSG_WARN(usb.h not found: MatrixOrbitalGX driver disabled)
+ fi
+fi
+
+if test "$MDM166A" = "yes"; then
+ if test "$has_usb10" = "true"; then
+ GRAPHIC="yes"
+ DRIVERS="$DRIVERS drv_mdm166a.o"
+ GPIO="yes"
+ LIBUSB10="yes"
+ AC_DEFINE(WITH_MDM166A,1,[MDM166A driver])
+ else
+ AC_MSG_WARN(libusb-1.0/libusb.h not found: MDM166A driver disabled)
+ fi
+fi
+
+if test "$MILINST" = "yes"; then
+ TEXT="yes"
+ SERIAL="yes"
+ DRIVERS="$DRIVERS drv_MilfordInstruments.o"
+ AC_DEFINE(WITH_MILINST,1,[Milford Instruments driver])
+fi
+
+if test "$NEWHAVEN" = "yes"; then
+ TEXT="yes"
+ I2C="yes"
+ DRIVERS="$DRIVERS drv_Newhaven.o"
+ AC_DEFINE(WITH_NEWHAVEN,1,[Newhaven driver])
+fi
+
+if test "$NORITAKE" = "yes"; then
+ if test "$has_parport" = "true"; then
+ TEXT="yes"
+ GRAPHIC="yes"
+ PARPORT="yes"
+ DRIVERS="$DRIVERS drv_Noritake.o"
+ AC_DEFINE(WITH_NORITAKE,1,[Noritake driver])
+ else
+ AC_MSG_WARN(asm/io.h or {linux/parport.h and linux/ppdev.h} not found: NORITAKE driver disabled)
+ fi
+fi
+
+if test "$NULL" = "yes"; then
+ TEXT="yes"
+ DRIVERS="$DRIVERS drv_NULL.o"
+ AC_DEFINE(WITH_NULL,1,[NULL driver])
+fi
+
+if test "$PERTELIAN" = "yes"; then
+ TEXT="yes"
+ SERIAL="yes"
+ DRIVERS="$DRIVERS drv_Pertelian.o"
+ AC_DEFINE(WITH_PERTELIAN,1,[Pertelian driver])
+fi
+
+if test "$PHANDERSON" = "yes"; then
+ TEXT="yes"
+ SERIAL="yes"
+ DRIVERS="$DRIVERS drv_PHAnderson.o"
+ AC_DEFINE(WITH_PHANDERSON,1,[PHAnderson driver])
+fi
+
+if test "$PICGRAPHIC" = "yes"; then
+ GRAPHIC="yes"
+ GPIO="yes"
+ SERIAL="yes"
+ DRIVERS="$DRIVERS drv_PICGraphic.o"
+ AC_DEFINE(WITH_PICGRAPHIC,1,[PICGraphic driver])
+fi
+
+if test "$PICOLCD" = "yes"; then
+ if test "$has_usb" = "true"; then
+ TEXT="yes"
+ GPIO="yes"
+ SERIAL="yes"
+ LIBUSB="yes"
+ DRIVERS="$DRIVERS drv_picoLCD.o"
+ AC_DEFINE(WITH_PICOLCD,1,[picoLCD driver])
+ else
+ AC_MSG_WARN(usb.h not found: picoLCD driver disabled)
+ fi
+fi
+
+if test "$PICOLCDGRAPHIC" = "yes"; then
+ if test "$has_usb" = "true"; then
+ TEXT="yes"
+ GRAPHIC="yes"
+ KEYPAD="yes"
+ GPIO="yes"
+ SERIAL="yes"
+ LIBUSB="yes"
+ DRIVERS="$DRIVERS drv_picoLCDGraphic.o"
+ AC_DEFINE(WITH_PICOLCDGRAPHIC,1,[picoLCDGraphic driver])
+ else
+ AC_MSG_WARN(usb.h not found: picoLCDGraphic driver disabled)
+ fi
+fi
+
+if test "$PNG" = "yes"; then
+ if test "$has_gd" = "true"; then
+ IMAGE="yes"
+ AC_DEFINE(WITH_PNG,1,[PNG driver])
+ else
+ AC_MSG_WARN(gd.h not found: PNG driver disabled)
+ fi
+fi
+
+if test "$PPM" = "yes"; then
+ IMAGE="yes"
+ AC_DEFINE(WITH_PPM,1,[PPM driver])
+fi
+
+if test "$ROUTERBOARD" = "yes"; then
+ if test "$has_io_h" = "true"; then
+ TEXT="yes"
+ GPIO="yes"
+ DRIVERS="$DRIVERS drv_RouterBoard.o"
+ AC_DEFINE(WITH_ROUTERBOARD,1,[RouterBoard driver])
+ else
+ AC_MSG_WARN(sys/io.h not found: RouterBoard driver disabled)
+ fi
+fi
+
+if test "$SAMPLE" = "yes"; then
+ if test "$has_parport" = "true"; then
+ # select either text or graphics mode
+ TEXT="yes"
+ GRAPHIC="yes"
+ # support for GPIO's
+ GPIO="yes"
+ # select bus: serial (including USB), parallel or i2c
+ SERIAL="yes"
+ PARPORT="yes"
+ #I2C="yes"
+ DRIVERS="$DRIVERS drv_Sample.o"
+ AC_DEFINE(WITH_SAMPLE,1,[Sample driver])
+ else
+ AC_MSG_WARN(asm/io.h or {linux/parport.h and linux/ppdev.h} not found: SAMPLE driver disabled)
+ fi
+fi
+
+if test "$SAMSUNGSPF" = "yes"; then
+ if test "$has_usb" = "true"; then
+ if test "$has_jpeglib" = "true"; then
+ GRAPHIC="yes"
+ DRIVERS="$DRIVERS drv_SamsungSPF.o"
+ LIBUSB="yes"
+ LIBJPEG="yes"
+ AC_DEFINE(WITH_SAMSUNGSPF,1,[SamsungSPF driver])
+ else
+ AC_MSG_WARN(jpeglib.h not found: SamsungSPF driver disabled)
+ fi
+ else
+ AC_MSG_WARN(usb.h not found: SamsungSPF driver disabled)
+ fi
+fi
+
+if test "$SERDISPLIB" = "yes"; then
+ if test "$has_serdisplib" = "true"; then
+ GRAPHIC="yes"
+ DRIVERS="$DRIVERS drv_serdisplib.o"
+ DRVLIBS="$DRVLIBS -L/usr/local/lib -lserdisp"
+ AC_DEFINE(WITH_SERDISPLIB,1,[serdisplib driver])
+ if test "$has_usb" = "true"; then
+ LIBUSB="yes"
+ fi
+ else
+ AC_MSG_WARN(serdisp.h not found: serdisplib driver disabled)
+ fi
+fi
+
+if test "$SHUTTLEVFD" = "yes"; then
+ if test "$has_usb" = "true"; then
+ TEXT="yes"
+ GPIO="yes"
+ DRIVERS="$DRIVERS drv_ShuttleVFD.o"
+ LIBUSB="yes"
+ AC_DEFINE(WITH_SHUTTLEVFD,1,[ShuttleVFD driver])
+ else
+ AC_MSG_WARN(usb.h not found: ShuttleVFD driver disabled)
+ fi
+fi
+
+if test "$SIMPLELCD" = "yes"; then
+ TEXT="yes"
+ SERIAL="yes"
+ DRIVERS="$DRIVERS drv_SimpleLCD.o"
+ AC_DEFINE(WITH_SIMPLELCD,1,[SimpleLCD driver])
+fi
+
+if test "$ST2205" = "yes"; then
+ if test "$has_st2205" = "true"; then
+ GRAPHIC="yes"
+ DRIVERS="$DRIVERS drv_st2205.o"
+ DRVLIBS="$DRVLIBS -L/usr/local/lib -lst2205"
+ AC_DEFINE(WITH_ST2205,1,[st2205 driver])
+ else
+ AC_MSG_WARN(st2205.h not found: st2205 driver disabled)
+ fi
+fi
+
+
+if test "$T6963" = "yes"; then
+ if test "$has_parport" = "true"; then
+ GRAPHIC="yes"
+ PARPORT="yes"
+ DRIVERS="$DRIVERS drv_T6963.o"
+ AC_DEFINE(WITH_T6963,1,[T6963 driver])
+ else
+ AC_MSG_WARN(asm/io.h or {linux/parport.h and linux/ppdev.h} not found: T6963 driver disabled)
+ fi
+fi
+
+if test "$TeakLCM" = "yes"; then
+ TEXT="yes"
+ SERIAL="yes"
+ DRIVERS="$DRIVERS drv_TeakLCM.o"
+ AC_DEFINE(WITH_TEAK_LCM,1,[TeakLCM driver])
+fi
+
+if test "$Trefon" = "yes"; then
+ if test "$has_usb" = "true"; then
+ TEXT="yes"
+ DRIVERS="$DRIVERS drv_Trefon.o"
+ LIBUSB="yes"
+ AC_DEFINE(WITH_TREFON,1,[TREFON driver])
+ else
+ AC_MSG_WARN(usb.h not found: Trefon driver disabled)
+ fi
+fi
+
+if test "$ULA200" = "yes"; then
+ if test "$has_ftdi" = "true"; then
+ TEXT="yes"
+ LIBUSB="yes"
+ LIBFTDI="yes"
+ DRIVERS="$DRIVERS drv_ula200.o"
+ AC_DEFINE(WITH_ULA200,1,[ULA200 driver])
+ else
+ AC_MSG_WARN(ftdi.h not found: ULA200 driver disabled)
+ fi
+fi
+
+if test "$USBHUB" = "yes"; then
+ if test "$has_usb" = "true"; then
+ GPIO="yes"
+ DRIVERS="$DRIVERS drv_USBHUB.o"
+ LIBUSB="yes"
+ AC_DEFINE(WITH_USBHUB,1,[USBHUB driver])
+ else
+ AC_MSG_WARN(usb.h not found: USB-Hub driver disabled)
+ fi
+fi
+
+if test "$USBLCD" = "yes"; then
+ TEXT="yes"
+ SERIAL="yes"
+ DRIVERS="$DRIVERS drv_USBLCD.o"
+ if test "$has_usb" = "true"; then
+ LIBUSB="yes"
+ fi
+ AC_DEFINE(WITH_USBLCD,1,[USBLCD driver])
+fi
+
+if test "$VNC" = "yes"; then
+ if test "$has_vncserverlib" = "true"; then
+ GRAPHIC="yes"
+ KEYPAD="yes"
+ DRIVERS="$DRIVERS drv_vnc.o"
+ DRVLIBS="$DRVLIBS -L/usr/local/lib -lvncserver -lz"
+ AC_DEFINE(WITH_VNC,1,[vnc driver])
+ else
+ AC_MSG_WARN(libvncserver not found: vnc driver disabled)
+ fi
+fi
+
+if test "$WINCORNIXDORF" = "yes"; then
+ TEXT="yes"
+ SERIAL="yes"
+ DRIVERS="$DRIVERS drv_WincorNixdorf.o"
+ AC_DEFINE(WITH_WINCORNIXDORF,1,[WincorNixdorf driver])
+fi
+
+if test "$X11" = "yes"; then
+ if test "$no_x" = "yes"; then
+ AC_MSG_WARN(X11 headers or libraries not available: X11 driver disabled)
+ else
+ GRAPHIC="yes"
+ KEYPAD="yes"
+ DRIVERS="$DRIVERS drv_X11.o"
+ if test "x$ac_x_libraries" = "x"; then
+ DRVLIBS="$DRVLIBS -lX11"
+ else
+ DRVLIBS="$DRVLIBS -L$ac_x_libraries -lX11"
+ fi
+ CPP_FLAGS="$CPPFLAGS $X_CFLAGS"
+ AC_DEFINE(WITH_X11, 1, [X11 driver])
+ fi
+fi
+
+
+# Image driver
+if test "$IMAGE" = "yes"; then
+ GRAPHIC="yes"
+ DRIVERS="$DRIVERS drv_Image.o"
+fi
+
+if test "$DRIVERS" = ""; then
+ AC_MSG_ERROR([You should activate at least one driver...])
+fi
+
+# generic text driver
+if test "$TEXT" = "yes"; then
+ DRIVERS="$DRIVERS drv_generic_text.o"
+fi
+
+# generic graphic driver
+if test "$GRAPHIC" = "yes"; then
+ DRIVERS="$DRIVERS drv_generic_graphic.o"
+ if test "$has_gd" = "true"; then
+ DRIVERS="$DRIVERS widget_image.o"
+ DRVLIBS="$DRVLIBS -lgd"
+ AC_DEFINE(WITH_GD, 1, [GD library])
+ AC_DEFINE(WITH_IMAGE, 1, [image widget])
+ fi
+fi
+
+# generic GPIO driver
+if test "$GPIO" = "yes"; then
+ DRIVERS="$DRIVERS drv_generic_gpio.o"
+fi
+
+# generic parport driver
+if test "$PARPORT" = "yes"; then
+ DRIVERS="$DRIVERS drv_generic_parport.o"
+ AC_DEFINE(WITH_PARPORT, 1, [parport bus driver])
+fi
+
+# generic serial driver
+if test "$SERIAL" = "yes"; then
+ DRIVERS="$DRIVERS drv_generic_serial.o"
+ AC_DEFINE(WITH_SERIAL, 1, [serial bus driver])
+fi
+
+# generic i2c driver
+if test "$I2C" = "yes"; then
+ DRIVERS="$DRIVERS drv_generic_i2c.o"
+ AC_DEFINE(WITH_I2C, 1, [I2C bus driver])
+fi
+
+# generic keypad driver
+if test "$KEYPAD" = "yes"; then
+ DRIVERS="$DRIVERS drv_generic_keypad.o"
+fi
+
+# libjpeg
+if test "$LIBJPEG" = "yes"; then
+ DRVLIBS="$DRVLIBS -ljpeg"
+fi
+
+# libusb
+if test "$LIBUSB" = "yes"; then
+ DRVLIBS="$DRVLIBS -lusb"
+fi
+
+# libusb-1.0
+if test "$LIBUSB10" = "yes"; then
+ DRVLIBS="$DRVLIBS -lusb-1.0"
+fi
+
+# libftdi
+if test "$LIBFTDI" = "yes"; then
+ DRVLIBS="$DRVLIBS -lftdi"
+fi
+
+if test "$DRIVERS" = ""; then
+ AC_MSG_ERROR([You should include at least one driver...])
+fi
+
+AC_SUBST(DRIVERS)
+AC_SUBST(DRVLIBS)
diff --git a/drv.c b/drv.c
new file mode 100644
index 0000000..cbc58cc
--- /dev/null
+++ b/drv.c
@@ -0,0 +1,327 @@
+/* $Id: drv.c 1177 2012-02-22 03:11:31Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/drv.c $
+ *
+ * new framework for display drivers
+ *
+ * Copyright (C) 2003 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ * exported functions:
+ *
+ * drv_list (void)
+ * lists all available drivers to stdout
+ *
+ * drv_init (char *driver)
+ * initializes the named driver
+ *
+ * int drv_quit (void)
+ * de-initializes the driver
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "debug.h"
+#include "cfg.h"
+#include "drv.h"
+
+extern DRIVER drv_ASTUSB;
+extern DRIVER drv_BeckmannEgle;
+extern DRIVER drv_BWCT;
+extern DRIVER drv_Crystalfontz;
+extern DRIVER drv_Curses;
+extern DRIVER drv_Cwlinux;
+extern DRIVER drv_D4D;
+extern DRIVER drv_DPF;
+extern DRIVER drv_EA232graphic;
+extern DRIVER drv_EFN;
+extern DRIVER drv_FutabaVFD;
+extern DRIVER drv_FW8888;
+extern DRIVER drv_G15;
+extern DRIVER drv_GLCD2USB;
+extern DRIVER drv_HD44780;
+extern DRIVER drv_Image;
+extern DRIVER drv_IRLCD;
+extern DRIVER drv_LCD2USB;
+extern DRIVER drv_LCDLinux;
+extern DRIVER drv_LCDTerm;
+extern DRIVER drv_LEDMatrix;
+extern DRIVER drv_LPH7508;
+extern DRIVER drv_LUIse;
+extern DRIVER drv_LW_ABP;
+extern DRIVER drv_M50530;
+extern DRIVER drv_MatrixOrbital;
+extern DRIVER drv_MatrixOrbitalGX;
+extern DRIVER drv_MDM166A;
+extern DRIVER drv_MilfordInstruments;
+extern DRIVER drv_Newhaven;
+extern DRIVER drv_Noritake;
+extern DRIVER drv_NULL;
+extern DRIVER drv_Pertelian;
+extern DRIVER drv_PHAnderson;
+extern DRIVER drv_PICGraphic;
+extern DRIVER drv_picoLCD;
+extern DRIVER drv_picoLCDGraphic;
+extern DRIVER drv_RouterBoard;
+extern DRIVER drv_Sample;
+extern DRIVER drv_SamsungSPF;
+extern DRIVER drv_st2205;
+extern DRIVER drv_serdisplib;
+extern DRIVER drv_ShuttleVFD;
+extern DRIVER drv_SimpleLCD;
+extern DRIVER drv_T6963;
+extern DRIVER drv_TeakLCM;
+extern DRIVER drv_Trefon;
+extern DRIVER drv_ula200;
+extern DRIVER drv_USBHUB;
+extern DRIVER drv_USBLCD;
+extern DRIVER drv_vnc;
+extern DRIVER drv_WincorNixdorf;
+extern DRIVER drv_X11;
+
+/* output file for Image driver
+ * has to be defined here because it's referenced
+ * even if the raster driver is not included!
+ */
+char *output = NULL;
+
+
+
+DRIVER *Driver[] = {
+#ifdef WITH_ASTUSB
+ &drv_ASTUSB,
+#endif
+#ifdef WITH_BECKMANNEGLE
+ &drv_BeckmannEgle,
+#endif
+#ifdef WITH_BWCT
+ &drv_BWCT,
+#endif
+#ifdef WITH_CRYSTALFONTZ
+ &drv_Crystalfontz,
+#endif
+#ifdef WITH_CURSES
+ &drv_Curses,
+#endif
+#ifdef WITH_CWLINUX
+ &drv_Cwlinux,
+#endif
+#ifdef WITH_D4D
+ &drv_D4D,
+#endif
+#ifdef WITH_DPF
+ &drv_DPF,
+#endif
+#ifdef WITH_EA232graphic
+ &drv_EA232graphic,
+#endif
+#ifdef WITH_EFN
+ &drv_EFN,
+#endif
+#ifdef WITH_FUTABAVFD
+ &drv_FutabaVFD,
+#endif
+#ifdef WITH_FW8888
+ &drv_FW8888,
+#endif
+#ifdef WITH_G15
+ &drv_G15,
+#endif
+#ifdef WITH_GLCD2USB
+ &drv_GLCD2USB,
+#endif
+#ifdef WITH_HD44780
+ &drv_HD44780,
+#endif
+#if (defined(WITH_PNG) && defined(WITH_GD)) || defined(WITH_PPM)
+ &drv_Image,
+#endif
+#ifdef WITH_IRLCD
+ &drv_IRLCD,
+#endif
+#ifdef WITH_LCD2USB
+ &drv_LCD2USB,
+#endif
+#ifdef WITH_LCDLINUX
+ &drv_LCDLinux,
+#endif
+#ifdef WITH_LCDTERM
+ &drv_LCDTerm,
+#endif
+#ifdef WITH_LEDMATRIX
+ &drv_LEDMatrix,
+#endif
+#ifdef WITH_LPH7508
+ &drv_LPH7508,
+#endif
+#ifdef WITH_LUISE
+ &drv_LUIse,
+#endif
+#ifdef WITH_LW_ABP
+ &drv_LW_ABP,
+#endif
+#ifdef WITH_M50530
+ &drv_M50530,
+#endif
+#ifdef WITH_MATRIXORBITAL
+ &drv_MatrixOrbital,
+#endif
+#ifdef WITH_MATRIXORBITALGX
+ &drv_MatrixOrbitalGX,
+#endif
+#ifdef WITH_MDM166A
+ &drv_MDM166A,
+#endif
+#ifdef WITH_MILINST
+ &drv_MilfordInstruments,
+#endif
+#ifdef WITH_NEWHAVEN
+ &drv_Newhaven,
+#endif
+#ifdef WITH_NORITAKE
+ &drv_Noritake,
+#endif
+#ifdef WITH_NULL
+ &drv_NULL,
+#endif
+#ifdef WITH_PERTELIAN
+ &drv_Pertelian,
+#endif
+#ifdef WITH_PHANDERSON
+ &drv_PHAnderson,
+#endif
+#ifdef WITH_PICGRAPHIC
+ &drv_PICGraphic,
+#endif
+#ifdef WITH_PICOLCD
+ &drv_picoLCD,
+#endif
+#ifdef WITH_PICOLCDGRAPHIC
+ &drv_picoLCDGraphic,
+#endif
+#ifdef WITH_ROUTERBOARD
+ &drv_RouterBoard,
+#endif
+#ifdef WITH_SAMPLE
+ &drv_Sample,
+#endif
+#ifdef WITH_SAMSUNGSPF
+ &drv_SamsungSPF,
+#endif
+#ifdef WITH_ST2205
+ &drv_st2205,
+#endif
+#ifdef WITH_SHUTTLEVFD
+ &drv_ShuttleVFD,
+#endif
+#ifdef WITH_SERDISPLIB
+ &drv_serdisplib,
+#endif
+#ifdef WITH_SIMPLELCD
+ &drv_SimpleLCD,
+#endif
+#ifdef WITH_T6963
+ &drv_T6963,
+#endif
+#ifdef WITH_TEAK_LCM
+ &drv_TeakLCM,
+#endif
+#ifdef WITH_TREFON
+ &drv_Trefon,
+#endif
+#ifdef WITH_ULA200
+ &drv_ula200,
+#endif
+#ifdef WITH_USBHUB
+ &drv_USBHUB,
+#endif
+#ifdef WITH_USBLCD
+ &drv_USBLCD,
+#endif
+#ifdef WITH_VNC
+ &drv_vnc,
+#endif
+#ifdef WITH_WINCORNIXDORF
+ &drv_WincorNixdorf,
+#endif
+#ifdef WITH_X11
+ &drv_X11,
+#endif
+
+ NULL,
+};
+
+
+static DRIVER *Drv = NULL;
+
+
+/* maybe we need this */
+extern int drv_SD_list_verbose(void);
+
+
+int drv_list(void)
+{
+ int i;
+
+ printf("available display drivers:");
+
+ for (i = 0; Driver[i]; i++) {
+ printf("\n %-20s: ", Driver[i]->name);
+ if (Driver[i]->list)
+ Driver[i]->list();
+ }
+ printf("\n");
+
+#ifdef WITH_SERDISPLIB
+ printf("\n");
+ drv_SD_list_verbose();
+#endif
+
+ return 0;
+}
+
+
+int drv_init(const char *section, const char *driver, const int quiet)
+{
+ int i;
+ for (i = 0; Driver[i]; i++) {
+ if (strcmp(Driver[i]->name, driver) == 0) {
+ Drv = Driver[i];
+ if (Drv->init == NULL)
+ return 0;
+ return Drv->init(section, quiet);
+ }
+ }
+ error("drv_init(%s) failed: no such driver", driver);
+ return -1;
+}
+
+
+int drv_quit(const int quiet)
+{
+ if (Drv->quit == NULL)
+ return 0;
+ return Drv->quit(quiet);
+}
diff --git a/drv.h b/drv.h
new file mode 100644
index 0000000..d04464b
--- /dev/null
+++ b/drv.h
@@ -0,0 +1,56 @@
+/* $Id: drv.h 1067 2009-11-20 14:49:34Z volker $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/drv.h $
+ *
+ * new framework for display drivers
+ *
+ * Copyright (C) 1999-2003 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+#ifndef _DRV_H_
+#define _DRV_H_
+
+typedef struct DRIVER {
+ char *name;
+ int (*list) (void);
+ int (*init) (const char *section, const int quiet);
+ int (*quit) (const int quiet);
+} DRIVER;
+
+
+/* output file for Raster driver
+ * has to be defined here because it's referenced
+ * even if the raster driver is not included!
+ */
+extern char *output;
+
+#ifdef WITH_X11
+/* function to handle special X11 command line parameters
+ * has to be defined here because it's referenced
+ * in main before dealing with normal parameters.
+ */
+void drv_X11_parseArgs(int *argc, char *arvg[]);
+#endif
+
+int drv_list(void);
+int drv_init(const char *section, const char *driver, const int quiet);
+int drv_quit(const int quiet);
+
+#endif
diff --git a/drv_ASTUSB.c b/drv_ASTUSB.c
new file mode 100644
index 0000000..6cc0297
--- /dev/null
+++ b/drv_ASTUSB.c
@@ -0,0 +1,512 @@
+/* $Id: $
+ * $URL: $
+ *
+ * driver for Attiny2313 USB LCD display interface
+ * see http://ast.m-faq.de/USB-LCD/USB-LCD.htm for schematics
+ *
+ * Copyright 2005 Till Harbaum <till@harbaum.org>
+ * Copyright 2005 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ *
+ * exported fuctions:
+ *
+ * struct DRIVER drv_LCD2USB
+ *
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <unistd.h>
+#include <termios.h>
+#include <fcntl.h>
+#include <ctype.h>
+#include <sys/ioctl.h>
+#include <sys/time.h>
+
+#include <usb.h>
+
+#include "debug.h"
+#include "cfg.h"
+#include "timer.h"
+#include "qprintf.h"
+#include "plugin.h"
+#include "widget.h"
+#include "widget_text.h"
+#include "widget_icon.h"
+#include "widget_bar.h"
+#include "widget_keypad.h"
+#include "drv.h"
+#include "drv_generic_text.h"
+
+
+#define LCD_USB_VENDOR 0x03eb
+#define LCD_USB_DEVICE 0x7a53
+
+#define CMD_LCD_ECHO (0<<5)
+#define CMD_LCD_INIT 1
+#define CMD_LCD_COMMAND 2
+#define CMD_LCD_DATA 3
+#define CMD_LCD_BLIGHT 4
+
+
+/* target is a bit map for CMD/DATA */
+#define LCD_CTRL_0 (1<<0)
+#define LCD_CTRL_1 (1<<1)
+#define LCD_BOTH (LCD_CTRL_0 | LCD_CTRL_1)
+
+
+static char Name[] = "ASTUSB";
+static char *device_id = NULL, *bus_id = NULL;
+
+static usb_dev_handle *lcd;
+static int controllers = 0;
+
+extern int got_signal;
+
+enum {
+ LCD_INIT_INCREASE = 1 << 0,
+ LCD_INIT_SHIFT = 1 << 1,
+ LCD_INIT_CON = 1 << 2,
+ LCD_INIT_BON = 1 << 3,
+ LCD_INIT_DSHIFT = 1 << 4,
+ LCD_INIT_RSHIFT = 1 << 5,
+ LCD_INIT_2LINES = 1 << 6,
+ LCD_INIT_FONT = 1 << 7
+};
+
+/****************************************/
+/*** hardware dependant functions ***/
+/****************************************/
+
+static int drv_AST_HW_open(char *bus_id, char *device_id)
+{
+ struct usb_bus *busses, *bus;
+ struct usb_device *dev;
+
+ lcd = NULL;
+
+ info("%s: scanning USB for ASTUSB interface ...", Name);
+
+ if (bus_id != NULL)
+ info("%s: scanning for bus id: %s", Name, bus_id);
+
+ if (device_id != NULL)
+ info("%s: scanning for device id: %s", Name, device_id);
+
+ usb_set_debug(0);
+
+ usb_init();
+ usb_find_busses();
+ usb_find_devices();
+ busses = usb_get_busses();
+
+ for (bus = busses; bus; bus = bus->next) {
+ /* search this bus if no bus id was given or if this is the given bus id */
+ if (!bus_id || (bus_id && !strcasecmp(bus->dirname, bus_id))) {
+
+ for (dev = bus->devices; dev; dev = dev->next) {
+ /* search this device if no device id was given or if this is the given device id */
+ if (!device_id || (device_id && !strcasecmp(dev->filename, device_id))) {
+
+ if ((dev->descriptor.idVendor == LCD_USB_VENDOR) && (dev->descriptor.idProduct == LCD_USB_DEVICE)) {
+ info("%s: found ASTUSB interface on bus %s device %s", Name, bus->dirname, dev->filename);
+ lcd = usb_open(dev);
+ if (usb_claim_interface(lcd, 0) < 0) {
+ error("%s: usb_claim_interface() failed!", Name);
+ return -1;
+ }
+ return 0;
+ }
+ }
+ }
+ }
+ }
+ return -1;
+}
+
+static int drv_AST_HW_close(void)
+{
+ usb_release_interface(lcd, 0);
+ usb_close(lcd);
+
+ return 0;
+}
+
+static int drv_AST_HW_data(unsigned char *buffer, short length, int __attribute__ ((unused)) index)
+{
+ int request = CMD_LCD_DATA;
+ int value = 0;
+
+ if (usb_control_msg
+ (lcd, USB_TYPE_VENDOR | USB_RECIP_DEVICE, request, value, 0 /*index */ , (char *) buffer, length, 1000) < 0) {
+ error("%s: USB request failed! Trying to reconnect device.", Name);
+
+ usb_release_interface(lcd, 0);
+ usb_close(lcd);
+
+ /* try to close and reopen connection */
+ if (drv_AST_HW_open(bus_id, device_id) < 0) {
+ error("%s: could not re-detect ASTUSB USB LCD", Name);
+ got_signal = -1;
+ return -1;
+ }
+ /* and try to re-send command */
+ if (usb_control_msg
+ (lcd, USB_TYPE_VENDOR | USB_RECIP_DEVICE, request, value, 0 /*index */ , (char *) buffer, length,
+ 1000) < 0) {
+ error("%s: retried USB request failed, aborting!", Name);
+ got_signal = -1;
+ return -1;
+ }
+
+ info("%s: Device successfully reconnected.", Name);
+ }
+
+ return 0;
+}
+
+/* send a number of 16 bit words to the lcd2usb interface */
+/* and verify that they are correctly returned by the echo */
+/* command. This may be used to check the reliability of */
+/* the usb interfacing */
+#define ECHO_NUM 10
+
+
+static int drv_AST_HW_cmd(unsigned char cmd, short value, int __attribute__ ((unused)) index)
+{
+ unsigned char buffer[2];
+ int nBytes;
+
+ /* send control request and accept return value */
+ nBytes = usb_control_msg(lcd,
+ USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_ENDPOINT_IN,
+ cmd, value, 0 /*index */ , (char *) buffer, sizeof(buffer), 1000);
+
+ if (nBytes < 0) {
+ error("%s: USB request failed!", Name);
+ return -1;
+ }
+
+ return buffer[0] + 256 * buffer[1];
+}
+
+int drv_AST_HW_echo(void)
+{
+ int i, errors = 0;
+ char val;
+ char buffer[2];
+
+ for (i = 0; i < ECHO_NUM; i++) {
+ val = rand() & 0xff; //8 bit number
+
+ if (usb_control_msg(lcd,
+ USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_ENDPOINT_IN,
+ CMD_LCD_ECHO, val, 0, buffer, sizeof(buffer), 1000) < 0) {
+ error("%s: USB request failed!", Name);
+ return -1;
+ }
+
+ if (val != buffer[1])
+ errors++;
+ }
+
+ if (errors) {
+ error("%s: ERROR, %d out of %d echo transfers failed!", Name, errors, ECHO_NUM);
+ return -1;
+ } else
+ info("%s: echo test successful", Name);
+
+
+ return 0;
+}
+
+
+/* command format:
+ * 7 6 5 4 3 2 1 0
+ * C C C T T R L L
+ *
+ * TT = target bit map
+ * R = reserved for future use, set to 0
+ * LL = number of bytes in transfer - 1
+ */
+
+short drv_AST_LCD_BL(int backlight)
+{
+
+ if (backlight < 0)
+ backlight = 0;
+ else if (backlight > 1)
+ backlight = 1;
+
+ drv_AST_HW_cmd(CMD_LCD_BLIGHT, backlight, 0);
+
+ return backlight;
+}
+
+
+static void drv_AST_clear(void)
+{
+ drv_AST_HW_cmd(CMD_LCD_COMMAND, 0x01, LCD_BOTH & controllers); /* clear display */
+ drv_AST_HW_cmd(CMD_LCD_COMMAND, 0x03, LCD_BOTH & controllers); /* return home */
+}
+
+static void drv_AST_write(const int row, const int col, const char *data, int len)
+{
+ int pos, ctrl = LCD_CTRL_0;
+ int tmpRow = row;
+
+ /* displays with more two rows and 20 columns have a logical width */
+ /* of 40 chars and use more than one controller */
+ if ((DROWS > 2) && (DCOLS > 20) && (row > 1)) {
+ /* use second controller */
+ tmpRow -= 2;
+ ctrl = LCD_CTRL_1;
+ }
+
+ /* 16x4 Displays use a slightly different layout */
+ if (DCOLS == 16 && DROWS == 4) {
+ pos = (tmpRow % 2) * 64 + (tmpRow / 2) * 16 + col;
+ } else {
+ pos = (tmpRow % 2) * 64 + (tmpRow / 2) * 20 + col;
+ }
+
+ drv_AST_HW_cmd(CMD_LCD_COMMAND, 0x80 | pos, (ctrl & controllers));
+ drv_AST_HW_data((unsigned char *) data, len, (ctrl & controllers));
+
+}
+
+static void drv_AST_defchar(const int ascii, const unsigned char *matrix)
+{
+ int i;
+ unsigned char buffer[8];
+
+ //build buffer
+ for (i = 0; i < 8; i++) {
+ buffer[i] = *matrix++ & 0x1f;
+ }
+
+ //send to HW
+ drv_AST_HW_cmd(CMD_LCD_COMMAND, 0x40 | 8 * ascii, LCD_BOTH & controllers);
+ drv_AST_HW_data((unsigned char *) buffer, sizeof(buffer), LCD_BOTH & controllers);
+}
+
+static int drv_AST_start(const char *section, const int quiet)
+{
+// int contrast, brightness;
+ int backlight;
+ int rows = -1, cols = -1;
+ char *s;
+
+ s = cfg_get(section, "Size", NULL);
+ if (s == NULL || *s == '\0') {
+ error("%s: no '%s.Size' entry from %s", Name, section, cfg_source());
+ return -1;
+ }
+ if (sscanf(s, "%dx%d", &cols, &rows) != 2 || rows < 1 || cols < 1) {
+ error("%s: bad %s.Size '%s' from %s", Name, section, s, cfg_source());
+ free(s);
+ return -1;
+ }
+
+ DROWS = rows;
+ DCOLS = cols;
+
+ /* bus id and device id are strings and not just intergers, since */
+ /* the windows port of libusb treats them as strings. And this way */
+ /* we keep windows compatibility ... just in case ... */
+ bus_id = cfg_get(section, "Bus", NULL);
+ device_id = cfg_get(section, "Device", NULL);
+
+ if (drv_AST_HW_open(bus_id, device_id) < 0) {
+ error("%s: could not find a ASTUSB USB LCD", Name);
+ return -1;
+ }
+
+ /* test interface reliability */
+ drv_AST_HW_echo();
+
+ /*low level init of init LCD */
+ if (drv_AST_HW_cmd(CMD_LCD_INIT, LCD_INIT_INCREASE | (DROWS > 1 ? LCD_INIT_2LINES : 1), LCD_BOTH & controllers) < 0) {
+ error("%s: could not init LCD", Name);
+ return -1;
+ }
+
+ if (cfg_number(section, "Backlight", 0, 0, 1, &backlight) > 0) {
+ info("%s: backlight %s", Name, backlight ? "enabled" : "disabled");
+ drv_AST_LCD_BL(backlight);
+ }
+
+ drv_AST_clear(); /* clear display */
+
+ if (!quiet) {
+ char buffer[40];
+ qprintf(buffer, sizeof(buffer), "%s %dx%d", Name, DCOLS, DROWS);
+ if (drv_generic_text_greet(buffer, "AST USB-LCD")) {
+ sleep(3);
+ drv_AST_clear();
+ }
+ }
+
+ return 0;
+}
+
+
+/****************************************/
+/*** plugins ***/
+/****************************************/
+
+static void plugin_backlight(RESULT * result, RESULT * arg1)
+{
+ double backlight;
+
+ backlight = drv_AST_LCD_BL(R2N(arg1));
+ SetResult(&result, R_NUMBER, &backlight);
+}
+
+/****************************************/
+/*** widget callbacks ***/
+/****************************************/
+
+
+/* using drv_generic_text_draw(W) */
+/* using drv_generic_text_icon_draw(W) */
+/* using drv_generic_text_bar_draw(W) */
+
+
+/****************************************/
+/*** exported functions ***/
+/****************************************/
+
+
+/* list models */
+int drv_AST_list(void)
+{
+ printf("ASTUSB display interface");
+ return 0;
+}
+
+
+/* initialize driver & display */
+int drv_AST_init(const char *section, const int quiet)
+{
+ WIDGET_CLASS wc;
+ int asc255bug;
+ int ret;
+
+ info("%s: %s", Name, "$Rev: 975 $");
+
+ /* display preferences */
+ XRES = 5; /* pixel width of one char */
+ YRES = 8; /* pixel height of one char */
+ CHARS = 8; /* number of user-defineable characters */
+ CHAR0 = 0; /* ASCII of first user-defineable char */
+ GOTO_COST = 2; /* number of bytes a goto command requires */
+
+ /* real worker functions */
+ drv_generic_text_real_write = drv_AST_write;
+ drv_generic_text_real_defchar = drv_AST_defchar;
+
+ /* start display */
+ if ((ret = drv_AST_start(section, quiet)) != 0)
+ return ret;
+
+ /* initialize generic text driver */
+ if ((ret = drv_generic_text_init(section, Name)) != 0)
+ return ret;
+
+ /* initialize generic icon driver */
+ if ((ret = drv_generic_text_icon_init()) != 0)
+ return ret;
+
+ /* initialize generic bar driver */
+ if ((ret = drv_generic_text_bar_init(0)) != 0)
+ return ret;
+
+ /* add fixed chars to the bar driver */
+ /* most displays have a full block on ascii 255, but some have kind of */
+ /* an 'inverted P'. If you specify 'asc255bug 1 in the config, this */
+ /* char will not be used, but rendered by the bar driver */
+ cfg_number(section, "asc255bug", 0, 0, 1, &asc255bug);
+ drv_generic_text_bar_add_segment(0, 0, 255, 32); /* ASCII 32 = blank */
+ if (!asc255bug)
+ drv_generic_text_bar_add_segment(255, 255, 255, 255); /* ASCII 255 = block */
+
+
+ /* register text widget */
+ wc = Widget_Text;
+ wc.draw = drv_generic_text_draw;
+ widget_register(&wc);
+
+ /* register icon widget */
+ wc = Widget_Icon;
+ wc.draw = drv_generic_text_icon_draw;
+ widget_register(&wc);
+
+ /* register bar widget */
+ wc = Widget_Bar;
+ wc.draw = drv_generic_text_bar_draw;
+ widget_register(&wc);
+
+ /* register plugins */
+ // AddFunction("LCD::contrast", 1, plugin_contrast);
+ // AddFunction("LCD::brightness", 1, plugin_brightness);
+ AddFunction("LCD::backlight", 1, plugin_backlight);
+
+ return 0;
+}
+
+
+/* close driver & display */
+int drv_AST_quit(const int quiet)
+{
+
+ info("%s: shutting down.", Name);
+
+ drv_generic_text_quit();
+
+ /* clear display */
+ drv_AST_clear();
+
+ /* say goodbye... */
+ if (!quiet) {
+ drv_generic_text_greet("That's all, folks!", NULL);
+ }
+
+ drv_AST_LCD_BL(0);
+
+ debug("closing USB connection");
+ drv_AST_HW_close();
+
+ return (0);
+}
+
+
+DRIVER drv_ASTUSB = {
+ .name = Name,
+ .list = drv_AST_list,
+ .init = drv_AST_init,
+ .quit = drv_AST_quit,
+};
diff --git a/drv_BWCT.c b/drv_BWCT.c
new file mode 100644
index 0000000..2f7c864
--- /dev/null
+++ b/drv_BWCT.c
@@ -0,0 +1,401 @@
+/* $Id: drv_BWCT.c 975 2009-01-18 11:16:20Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/drv_BWCT.c $
+ *
+ * new style driver for BWCT USB LCD displays
+ *
+ * Copyright (C) 2003 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ *
+ * exported fuctions:
+ *
+ * struct DRIVER drv_BWCT
+ *
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <unistd.h>
+#include <termios.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <sys/time.h>
+
+#include <usb.h>
+
+#include "debug.h"
+#include "cfg.h"
+#include "qprintf.h"
+#include "plugin.h"
+#include "widget.h"
+#include "widget_text.h"
+#include "widget_icon.h"
+#include "widget_bar.h"
+#include "drv.h"
+#include "drv_generic_text.h"
+
+
+#define LCD_USB_VENDOR 0x03da
+#define LCD_USB_DEVICE 0x0002
+
+#define LCD_RESET 1
+#define LCD_CMD 2
+#define LCD_DATA 3
+#define LCD_CONTRAST 4
+
+
+static char Name[] = "BWCT";
+
+static usb_dev_handle *lcd;
+static int interface;
+
+extern int got_signal;
+
+
+/****************************************/
+/*** hardware dependant functions ***/
+/****************************************/
+
+static int drv_BW_open(void)
+{
+ struct usb_bus *busses, *bus;
+ struct usb_device *dev;
+
+ lcd = NULL;
+
+ info("%s: scanning USB for BWCT LCD...", Name);
+
+ usb_set_debug(0);
+
+ usb_init();
+ usb_find_busses();
+ usb_find_devices();
+ busses = usb_get_busses();
+
+ for (bus = busses; bus; bus = bus->next) {
+ for (dev = bus->devices; dev; dev = dev->next) {
+ int c;
+ if (dev->descriptor.idVendor != LCD_USB_VENDOR)
+ continue;
+ /* Loop through all of the configurations */
+ for (c = 0; c < dev->descriptor.bNumConfigurations; c++) {
+ int i;
+ for (i = 0; i < dev->config[c].bNumInterfaces; i++) {
+ int a;
+ for (a = 0; a < dev->config[c].interface[i].num_altsetting; a++) {
+ if ((dev->descriptor.idProduct == LCD_USB_DEVICE) ||
+ ((dev->config[c].interface[i].altsetting[a].bInterfaceClass == 0xff) &&
+ (dev->config[c].interface[i].altsetting[a].bInterfaceSubClass == 0x01))) {
+ info("%s: found BWCT USB LCD on bus %s device %s", Name, bus->dirname, dev->filename);
+ interface = i;
+ lcd = usb_open(dev);
+ if (usb_claim_interface(lcd, interface) < 0) {
+ error("%s: usb_claim_interface() failed!", Name);
+ return -1;
+ }
+ return 0;
+ }
+ }
+ }
+ }
+ }
+ }
+ return -1;
+}
+
+
+static int drv_BW_close(void)
+{
+ usb_release_interface(lcd, interface);
+ usb_close(lcd);
+
+ return 0;
+}
+
+
+static int drv_BW_send(int request, int value)
+{
+ static int errors = 0;
+
+ if (errors > 20)
+ return -1;
+
+ if (usb_control_msg(lcd, USB_TYPE_VENDOR, request, value, interface, NULL, 0, 1000) < 0) {
+ error("%s: USB request failed!", Name);
+ if (++errors > 20) {
+ error("%s: too many USB errors, aborting.", Name);
+ got_signal = -1;
+ }
+ return -1;
+ }
+ errors = 0;
+ return 0;
+}
+
+
+static void drv_BW_command(const unsigned char cmd)
+{
+ drv_BW_send(LCD_CMD, cmd);
+}
+
+
+static void drv_BW_clear(void)
+{
+ drv_BW_command(0x01); /* clear display */
+ drv_BW_command(0x03); /* return home */
+}
+
+
+static void drv_BW_write(const int row, const int col, const char *data, int len)
+{
+ int pos;
+
+ /* 16x4 Displays use a slightly different layout */
+ if (DCOLS == 16 && DROWS == 4) {
+ pos = (row % 2) * 64 + (row / 2) * 16 + col;
+ } else {
+ pos = (row % 2) * 64 + (row / 2) * 20 + col;
+ }
+
+ drv_BW_command(0x80 | pos);
+
+ while (len--) {
+ drv_BW_send(LCD_DATA, *data++);
+ }
+}
+
+static void drv_BW_defchar(const int ascii, const unsigned char *matrix)
+{
+ int i;
+
+ drv_BW_command(0x40 | 8 * ascii);
+
+ for (i = 0; i < 8; i++) {
+ drv_BW_send(LCD_DATA, *matrix++ & 0x1f);
+ }
+}
+
+
+static int drv_BW_contrast(int contrast)
+{
+ if (contrast < 0)
+ contrast = 0;
+ if (contrast > 255)
+ contrast = 255;
+
+ drv_BW_send(LCD_CONTRAST, contrast);
+
+ return contrast;
+}
+
+
+static int drv_BW_start(const char *section, const int quiet)
+{
+ int contrast;
+ int rows = -1, cols = -1;
+ char *s;
+
+ s = cfg_get(section, "Size", NULL);
+ if (s == NULL || *s == '\0') {
+ error("%s: no '%s.Size' entry from %s", Name, section, cfg_source());
+ return -1;
+ }
+ if (sscanf(s, "%dx%d", &cols, &rows) != 2 || rows < 1 || cols < 1) {
+ error("%s: bad %s.Size '%s' from %s", Name, section, s, cfg_source());
+ free(s);
+ return -1;
+ }
+
+ DROWS = rows;
+ DCOLS = cols;
+
+ if (drv_BW_open() < 0) {
+ error("%s: could not find a BWCT USB LCD", Name);
+ return -1;
+ }
+
+ /* reset */
+ drv_BW_send(LCD_RESET, 0);
+
+ /* initialize display */
+ drv_BW_command(0x29); /* 8 Bit mode, 1/16 duty cycle, 5x8 font */
+ drv_BW_command(0x08); /* Display off, cursor off, blink off */
+ drv_BW_command(0x0c); /* Display on, cursor off, blink off */
+ drv_BW_command(0x06); /* curser moves to right, no shift */
+
+
+ if (cfg_number(section, "Contrast", 0, 0, 255, &contrast) > 0) {
+ drv_BW_contrast(contrast);
+ }
+
+ drv_BW_clear(); /* clear display */
+
+ if (!quiet) {
+ char buffer[40];
+ qprintf(buffer, sizeof(buffer), "%s %dx%d", Name, DCOLS, DROWS);
+ if (drv_generic_text_greet(buffer, "www.bwct.de")) {
+ sleep(3);
+ drv_BW_clear();
+ }
+ }
+
+ return 0;
+}
+
+
+/****************************************/
+/*** plugins ***/
+/****************************************/
+
+static void plugin_contrast(RESULT * result, RESULT * arg1)
+{
+ double contrast;
+
+ contrast = drv_BW_contrast(R2N(arg1));
+ SetResult(&result, R_NUMBER, &contrast);
+}
+
+
+/****************************************/
+/*** widget callbacks ***/
+/****************************************/
+
+
+/* using drv_generic_text_draw(W) */
+/* using drv_generic_text_icon_draw(W) */
+/* using drv_generic_text_bar_draw(W) */
+
+
+/****************************************/
+/*** exported functions ***/
+/****************************************/
+
+
+/* list models */
+int drv_BW_list(void)
+{
+ printf("BWCT USB to HD44780 interface");
+ return 0;
+}
+
+
+/* initialize driver & display */
+int drv_BW_init(const char *section, const int quiet)
+{
+ WIDGET_CLASS wc;
+ int asc255bug;
+ int ret;
+
+ info("%s: %s", Name, "$Rev: 975 $");
+
+ /* display preferences */
+ XRES = 5; /* pixel width of one char */
+ YRES = 8; /* pixel height of one char */
+ CHARS = 8; /* number of user-defineable characters */
+ CHAR0 = 0; /* ASCII of first user-defineable char */
+ GOTO_COST = 2; /* number of bytes a goto command requires */
+
+ /* real worker functions */
+ drv_generic_text_real_write = drv_BW_write;
+ drv_generic_text_real_defchar = drv_BW_defchar;
+
+
+ /* start display */
+ if ((ret = drv_BW_start(section, quiet)) != 0)
+ return ret;
+
+ /* initialize generic text driver */
+ if ((ret = drv_generic_text_init(section, Name)) != 0)
+ return ret;
+
+ /* initialize generic icon driver */
+ if ((ret = drv_generic_text_icon_init()) != 0)
+ return ret;
+
+ /* initialize generic bar driver */
+ if ((ret = drv_generic_text_bar_init(0)) != 0)
+ return ret;
+
+ /* add fixed chars to the bar driver */
+ /* most displays have a full block on ascii 255, but some have kind of */
+ /* an 'inverted P'. If you specify 'asc255bug 1 in the config, this */
+ /* char will not be used, but rendered by the bar driver */
+ cfg_number(section, "asc255bug", 0, 0, 1, &asc255bug);
+ drv_generic_text_bar_add_segment(0, 0, 255, 32); /* ASCII 32 = blank */
+ if (!asc255bug)
+ drv_generic_text_bar_add_segment(255, 255, 255, 255); /* ASCII 255 = block */
+
+ /* register text widget */
+ wc = Widget_Text;
+ wc.draw = drv_generic_text_draw;
+ widget_register(&wc);
+
+ /* register icon widget */
+ wc = Widget_Icon;
+ wc.draw = drv_generic_text_icon_draw;
+ widget_register(&wc);
+
+ /* register bar widget */
+ wc = Widget_Bar;
+ wc.draw = drv_generic_text_bar_draw;
+ widget_register(&wc);
+
+ /* register plugins */
+ AddFunction("LCD::contrast", 1, plugin_contrast);
+
+ return 0;
+}
+
+
+/* close driver & display */
+int drv_BW_quit(const int quiet)
+{
+
+ info("%s: shutting down.", Name);
+
+ drv_generic_text_quit();
+
+ /* clear display */
+ drv_BW_clear();
+
+ /* say goodbye... */
+ if (!quiet) {
+ drv_generic_text_greet("goodbye!", NULL);
+ }
+
+ debug("closing USB connection");
+ drv_BW_close();
+
+ return (0);
+}
+
+
+DRIVER drv_BWCT = {
+ .name = Name,
+ .list = drv_BW_list,
+ .init = drv_BW_init,
+ .quit = drv_BW_quit,
+};
diff --git a/drv_BeckmannEgle.c b/drv_BeckmannEgle.c
new file mode 100644
index 0000000..2f09444
--- /dev/null
+++ b/drv_BeckmannEgle.c
@@ -0,0 +1,735 @@
+/* $Id: drv_BeckmannEgle.c 840 2007-09-09 12:17:42Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/drv_BeckmannEgle.c $
+ *
+ * driver for Beckmann+Egle "Mini Terminals" and "Compact Terminals"
+ * Copyright (C) 2000 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ *
+ * exported fuctions:
+ *
+ * struct DRIVER drv_BeckmannEgle
+ *
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <termios.h>
+
+#include "debug.h"
+#include "cfg.h"
+#include "qprintf.h"
+#include "plugin.h"
+#include "widget.h"
+#include "widget_text.h"
+#include "widget_icon.h"
+#include "widget_bar.h"
+#include "drv.h"
+#include "drv_generic_text.h"
+#include "drv_generic_serial.h"
+
+
+#define ESC "\033"
+
+static char Name[] = "Beckmann+Egle";
+
+
+typedef struct {
+ char *name;
+ int rows;
+ int cols;
+ int protocol;
+ int type;
+} MODEL;
+
+
+static MODEL Models[] = {
+
+ /* MultiTerminals */
+ {"MT16x1", 1, 16, 1, 0},
+ {"MT16x2", 2, 16, 1, 1},
+ {"MT16x4", 4, 16, 1, 2},
+ {"MT20x1", 1, 20, 1, 3},
+ {"MT20x2", 2, 20, 1, 4},
+ {"MT20x4", 4, 20, 1, 5},
+ {"MT24x1", 1, 24, 1, 6},
+ {"MT24x2", 2, 24, 1, 7},
+ {"MT32x1", 1, 32, 1, 8},
+ {"MT32x2", 2, 32, 1, 9},
+ {"MT40x1", 1, 40, 1, 10},
+ {"MT40x2", 2, 40, 1, 11},
+ {"MT40x4", 4, 40, 1, 12},
+
+ /* CompactTerminal */
+ {"CT20x4", 4, 20, 2, 0},
+
+ {NULL, 0, 0, 0, 0},
+};
+
+
+static int Model;
+static int Protocol;
+
+
+
+/****************************************/
+/*** hardware dependant functions ***/
+/****************************************/
+
+static void drv_BuE_clear(void)
+{
+ switch (Protocol) {
+ case 1:
+ drv_generic_serial_write(ESC "&#", 3); /* clear display */
+ break;
+ case 2:
+ drv_generic_serial_write(ESC "LL", 3); /* clear display */
+ break;
+ }
+}
+
+
+static void drv_BuE_MT_write(const int row, const int col, const char *data, const int len)
+{
+ char cmd[] = ESC "[y;xH";
+
+ cmd[2] = (char) row;
+ cmd[4] = (char) col;
+
+ drv_generic_serial_write(cmd, 6);
+ drv_generic_serial_write(data, len);
+}
+
+
+static void drv_BuE_MT_defchar(const int ascii, const unsigned char *matrix)
+{
+ int i;
+ char cmd[22] = ESC "&T"; /* enter transparent mode */
+
+ cmd[3] = '\0'; /* write cmd */
+ cmd[4] = 0x40 | 8 * ascii; /* write CGRAM */
+
+ for (i = 0; i < 8; i++) {
+ cmd[2 * i + 5] = '\1'; /* write data */
+ cmd[2 * i + 6] = matrix[i] & 0x1f; /* character bitmap */
+ }
+ cmd[21] = '\377'; /* leave transparent mode */
+
+ drv_generic_serial_write(cmd, 22);
+}
+
+
+static void drv_BuE_CT_write(const int row, const int col, const char *data, const int len)
+{
+ char cmd[] = ESC "LCzs\001";
+ cmd[3] = (char) row + 1;
+ cmd[4] = (char) col + 1;
+
+ drv_generic_serial_write(cmd, 6);
+ drv_generic_serial_write(data, len);
+
+}
+
+
+static void drv_BuE_CT_defchar(const int ascii, const unsigned char *matrix)
+{
+ int i;
+ char cmd[13] = ESC "LZ"; /* set custom char */
+
+ /* number of user-defined char (0..7) */
+ cmd[3] = (char) ascii - CHAR0;
+
+ /* ASCII code to replace */
+ cmd[4] = (char) ascii;
+
+ for (i = 0; i < 8; i++) {
+ cmd[i + 5] = matrix[i] & 0x1f;
+ }
+
+ drv_generic_serial_write(cmd, 13);
+}
+
+
+static int drv_BuE_CT_contrast(int contrast)
+{
+ static char Contrast = 7;
+ char cmd[4] = ESC "LKn";
+
+ /* -1 is used to query the current contrast */
+ if (contrast == -1)
+ return Contrast;
+
+ if (contrast < 0)
+ contrast = 0;
+ if (contrast > 15)
+ contrast = 15;
+ Contrast = contrast;
+
+ cmd[3] = Contrast;
+
+ drv_generic_serial_write(cmd, 4);
+
+ return Contrast;
+}
+
+
+static int drv_BuE_CT_backlight(int backlight)
+{
+ static char Backlight = 0;
+ char cmd[4] = ESC "LBn";
+
+ /* -1 is used to query the current backlight */
+ if (backlight == -1)
+ return Backlight;
+
+ if (backlight < 0)
+ backlight = 0;
+ if (backlight > 1)
+ backlight = 1;
+ Backlight = backlight;
+
+ cmd[3] = Backlight;
+
+ drv_generic_serial_write(cmd, 4);
+
+ return Backlight;
+}
+
+
+static int drv_BuE_CT_gpo(int num, int val)
+{
+ static int GPO[8] = { -1, -1, -1, -1, -1, -1, -1, -1 };
+ char cmd[4] = ESC "Pnx";
+
+ if (num < 0)
+ num = 0;
+ if (num > 7)
+ num = 7;
+
+ /* -1 is used to query the current GPO */
+ if (val == -1)
+ return GPO[num];
+
+ if (val < 0)
+ val = 0;
+ if (val > 255)
+ val = 255;
+ GPO[num] = val;
+
+ cmd[2] = (char) num;
+ cmd[3] = (char) val;
+
+ drv_generic_serial_write(cmd, 4);
+
+ return GPO[num];
+}
+
+
+static int drv_BuE_CT_gpi(int num)
+{
+ char cmd[4] = ESC "?Pn";
+ char buffer[4];
+
+ if (num < 0)
+ num = 0;
+ if (num > 7)
+ num = 7;
+
+ cmd[3] = (char) num;
+ drv_generic_serial_write(cmd, 4);
+
+ usleep(10000);
+
+ if (drv_generic_serial_read(buffer, 4) != 4) {
+ error("%s: error reading port %d", Name, num);
+ return -1;
+ }
+
+ return buffer[3];
+}
+
+
+static int drv_BuE_CT_adc(void)
+{
+ char buffer[4];
+
+ drv_generic_serial_write(ESC "?A", 3);
+
+ usleep(10000);
+
+ if ((drv_generic_serial_read(buffer, 4) != 4) || (buffer[0] != 'A') || (buffer[1] != ':')
+ ) {
+ error("%s: error reading ADC", Name);
+ return -1;
+ }
+
+ /* 10 bit value: 8 bit high, 2 bit low */
+ return 4 * (unsigned char) buffer[2] + (unsigned char) buffer[3];
+}
+
+
+static int drv_BuE_CT_pwm(int val)
+{
+ static int PWM = -1;
+ char cmd[4] = ESC "Adm";
+
+ /* -1 is used to query the current PWM */
+ if (val == -1)
+ return PWM;
+
+ if (val < 0)
+ val = 0;
+ if (val > 255)
+ val = 255;
+ PWM = val;
+
+ cmd[2] = (char) val;
+ cmd[3] = val == 0 ? 1 : 2;
+ drv_generic_serial_write(cmd, 4);
+
+ return val;
+}
+
+
+static int drv_BuE_MT_start(const char *section)
+{
+ char cmd[] = ESC "&sX";
+
+ /* CSTOPB: 2 stop bits */
+ if (drv_generic_serial_open(section, Name, CSTOPB) < 0)
+ return -1;
+
+ cmd[4] = Models[Model].type;
+ drv_generic_serial_write(cmd, 4); /* select display type */
+ drv_generic_serial_write(ESC "&D", 3); /* cursor off */
+
+ return 0;
+}
+
+
+static int drv_BuE_CT_start(const char *section)
+{
+ char buffer[16];
+ char *size;
+ int i, len;
+
+ if (drv_generic_serial_open(section, Name, 0) < 0)
+ return -1;
+
+#if 0
+ /* restart terminal */
+ drv_generic_serial_write(ESC "Kr", 3);
+ usleep(10000);
+#endif
+
+ /* Fixme: the CT does not return a serial number in byte mode */
+ /* set parameter mode 'decimal' */
+ drv_generic_serial_write(ESC "KM\073", 4);
+
+ /* read version */
+ drv_generic_serial_write(ESC "?V", 3);
+ usleep(100000);
+ if ((len = drv_generic_serial_read(buffer, -1 * (int) sizeof(buffer))) > 0) {
+ int v, r, s;
+ if (sscanf(buffer, "V:%d.%d,%d;", &v, &r, &s) != 3) {
+ error("%s: error parsing display identification <%*s>", Name, len, buffer);
+ } else {
+ info("%s: display identified as version %d.%d, S/N %d", Name, v, r, s);
+ }
+ }
+
+ /* set parameter mode 'byte' */
+ drv_generic_serial_write(ESC "KM\072", 4);
+
+ /* the CT20x4 can control smaller displays, too */
+ size = cfg_get(section, "Size", NULL);
+ if (size != NULL && *size != '\0') {
+ int r, c;
+ char cmd[6] = ESC "LArc";
+ if (sscanf(size, "%dx%d", &c, &r) != 2 || r < 1 || c < 1) {
+ error("%s: bad %s.Size '%s' from %s", Name, section, size, cfg_source());
+ return -1;
+ }
+ info("%s: display size: %d rows %d columns", Name, r, c);
+ /* set display size */
+ cmd[3] = (char) r;
+ cmd[4] = (char) c;
+ drv_generic_serial_write(cmd, 5);
+ DCOLS = c;
+ DROWS = r;
+ }
+
+ /* set contrast */
+ if (cfg_number(section, "Contrast", 7, 0, 15, &i) > 0) {
+ drv_BuE_CT_contrast(i);
+ }
+
+ /* set backlight */
+ if (cfg_number(section, "Backlight", 0, 0, 1, &i) > 0) {
+ drv_BuE_CT_backlight(i);
+ }
+
+
+ /* identify modules */
+
+ for (i = 0; i < 8; i++) {
+ char cmd[5] = ESC "K?Pn";
+ cmd[4] = (char) i;
+ drv_generic_serial_write(cmd, 5); /* query I/O port */
+ usleep(10000);
+ if ((len = drv_generic_serial_read(buffer, 4)) == 4) {
+ char *type = NULL;
+ if (i == 0) {
+ if (buffer[3] == 8) {
+ /* internal port */
+ type = "CT 20x4 internal port";
+ } else {
+ error("%s: internal error: port 0 type %d should be type 8", Name, buffer[3]);
+ continue;
+ }
+ } else {
+ switch (buffer[3]) {
+ case 1: /* Key Module */
+ type = "XM-KEY-2x4-LED";
+ break;
+ case 8: /* I/O Module */
+ type = "XM-IO8-T";
+ break;
+ case 9: /* I/O Module */
+ type = "XM-IO4-R";
+ break;
+ case 15: /* nothing */
+ continue;
+ default: /* unhandled */
+ type = NULL;
+ break;
+ }
+ }
+ if (type != NULL) {
+ info("%s: Port %d: %s", Name, i, type);
+ } else {
+ error("%s: internal error: port %d unknown type %d", Name, i, cmd[3]);
+ }
+ } else {
+ error("%s: error fetching type of port %d", Name, i);
+ }
+ }
+
+ return 0;
+}
+
+
+static int drv_BuE_start(const char *section)
+{
+ int i, ret;
+ char *model;
+
+ model = cfg_get(section, "Model", NULL);
+ if (model == NULL && *model == '\0') {
+ error("%s: no '%s.Model' entry from %s", Name, section, cfg_source());
+ return -1;
+ }
+
+ for (i = 0; Models[i].name != NULL; i++) {
+ if (strcasecmp(Models[i].name, model) == 0)
+ break;
+ }
+
+ if (Models[i].name == NULL) {
+ error("%s: %s.Model '%s' is unknown from %s", Name, section, model, cfg_source());
+ return -1;
+ }
+
+ Model = i;
+ Protocol = Models[Model].protocol;
+
+ info("%s: using model '%s'", Name, Models[Model].name);
+
+ /* initialize global variables */
+ DROWS = Models[Model].rows;
+ DCOLS = Models[Model].cols;
+
+ ret = 0;
+ switch (Protocol) {
+ case 1:
+ ret = drv_BuE_MT_start(section);
+ break;
+ case 2:
+ ret = drv_BuE_CT_start(section);
+ break;
+ }
+ if (ret != 0) {
+ return ret;
+ }
+
+ drv_BuE_clear();
+
+ return 0;
+}
+
+
+/****************************************/
+/*** plugins ***/
+/****************************************/
+
+static void plugin_contrast(RESULT * result, const int argc, RESULT * argv[])
+{
+ double contrast;
+
+ switch (argc) {
+ case 0:
+ contrast = drv_BuE_CT_contrast(-1);
+ SetResult(&result, R_NUMBER, &contrast);
+ break;
+ case 1:
+ contrast = drv_BuE_CT_contrast(R2N(argv[0]));
+ SetResult(&result, R_NUMBER, &contrast);
+ break;
+ default:
+ error("%s::contrast(): wrong number of parameters", Name);
+ SetResult(&result, R_STRING, "");
+ }
+}
+
+
+static void plugin_backlight(RESULT * result, const int argc, RESULT * argv[])
+{
+ double backlight;
+
+ switch (argc) {
+ case 0:
+ backlight = drv_BuE_CT_backlight(-1);
+ SetResult(&result, R_NUMBER, &backlight);
+ break;
+ case 1:
+ backlight = drv_BuE_CT_backlight(R2N(argv[0]));
+ SetResult(&result, R_NUMBER, &backlight);
+ break;
+ default:
+ error("%s::backlight(): wrong number of parameters", Name);
+ SetResult(&result, R_STRING, "");
+ }
+}
+
+
+static void plugin_gpo(RESULT * result, const int argc, RESULT * argv[])
+{
+ double gpo;
+
+ switch (argc) {
+ case 1:
+ gpo = drv_BuE_CT_gpo(R2N(argv[0]), -1);
+ SetResult(&result, R_NUMBER, &gpo);
+ break;
+ case 2:
+ gpo = drv_BuE_CT_gpo(R2N(argv[0]), R2N(argv[1]));
+ SetResult(&result, R_NUMBER, &gpo);
+ break;
+ default:
+ error("%s::gpo(): wrong number of parameters", Name);
+ SetResult(&result, R_STRING, "");
+ }
+}
+
+
+static void plugin_gpi(RESULT * result, RESULT * arg1)
+{
+ double gpi;
+
+ gpi = drv_BuE_CT_gpi(R2N(arg1));
+ SetResult(&result, R_NUMBER, &gpi);
+}
+
+
+static void plugin_adc(RESULT * result)
+{
+ double adc;
+
+ adc = drv_BuE_CT_adc();
+ SetResult(&result, R_NUMBER, &adc);
+}
+
+
+static void plugin_pwm(RESULT * result, const int argc, RESULT * argv[])
+{
+ double pwm;
+
+ switch (argc) {
+ case 0:
+ pwm = drv_BuE_CT_pwm(-1);
+ SetResult(&result, R_NUMBER, &pwm);
+ break;
+ case 1:
+ pwm = drv_BuE_CT_pwm(R2N(argv[0]));
+ SetResult(&result, R_NUMBER, &pwm);
+ break;
+ default:
+ error("%s::pwm(): wrong number of parameters", Name);
+ SetResult(&result, R_STRING, "");
+ }
+}
+
+
+/****************************************/
+/*** widget callbacks ***/
+/****************************************/
+
+/* using drv_generic_text_draw(W) */
+/* using drv_generic_text_icon_draw(W) */
+/* using drv_generic_text_bar_draw(W) */
+
+
+/****************************************/
+/*** exported functions ***/
+/****************************************/
+
+
+/* list models */
+int drv_BuE_list(void)
+{
+ int i;
+
+ for (i = 0; Models[i].name != NULL; i++) {
+ printf("%s ", Models[i].name);
+ }
+ return 0;
+}
+
+
+/* initialize driver & display */
+int drv_BuE_init(const char *section, const int quiet)
+{
+ WIDGET_CLASS wc;
+ int ret;
+
+ info("%s: %s", Name, "$Rev: 840 $");
+
+ /* start display */
+ if ((ret = drv_BuE_start(section)) != 0) {
+ return ret;
+ }
+
+ /* display preferences */
+ XRES = 5; /* pixel width of one char */
+ YRES = 8; /* pixel height of one char */
+ CHARS = 8; /* number of user-defineable characters */
+
+ /* real worker functions */
+ switch (Protocol) {
+ case 1:
+ CHAR0 = 0; /* ASCII of first user-defineable char */
+ GOTO_COST = 6; /* number of bytes a goto command requires */
+ drv_generic_text_real_write = drv_BuE_MT_write;
+ drv_generic_text_real_defchar = drv_BuE_MT_defchar;
+ break;
+ case 2:
+ CHAR0 = 128; /* ASCII of first user-defineable char */
+ GOTO_COST = 6; /* number of bytes a goto command requires */
+ drv_generic_text_real_write = drv_BuE_CT_write;
+ drv_generic_text_real_defchar = drv_BuE_CT_defchar;
+ break;
+ }
+
+ if (!quiet) {
+ char buffer[40];
+ qprintf(buffer, sizeof(buffer), "%s %s", Name, Models[Model].name);
+ if (drv_generic_text_greet(buffer, "www.bue.com")) {
+ sleep(3);
+ drv_BuE_clear();
+ }
+ }
+
+ /* initialize generic text driver */
+ if ((ret = drv_generic_text_init(section, Name)) != 0)
+ return ret;
+
+ /* initialize generic icon driver */
+ if ((ret = drv_generic_text_icon_init()) != 0)
+ return ret;
+
+ /* initialize generic bar driver */
+ if ((ret = drv_generic_text_bar_init(0)) != 0)
+ return ret;
+
+ /* add fixed chars to the bar driver */
+ drv_generic_text_bar_add_segment(0, 0, 255, 32); /* ASCII 32 = blank */
+ drv_generic_text_bar_add_segment(255, 255, 255, 255); /* ASCII 255 = block */
+
+ /* register text widget */
+ wc = Widget_Text;
+ wc.draw = drv_generic_text_draw;
+ widget_register(&wc);
+
+ /* register icon widget */
+ wc = Widget_Icon;
+ wc.draw = drv_generic_text_icon_draw;
+ widget_register(&wc);
+
+ /* register bar widget */
+ wc = Widget_Bar;
+ wc.draw = drv_generic_text_bar_draw;
+ widget_register(&wc);
+
+ /* register plugins */
+ AddFunction("LCD::contrast", -1, plugin_contrast);
+ AddFunction("LCD::backlight", -1, plugin_backlight);
+ AddFunction("LCD::gpo", -1, plugin_gpo);
+ AddFunction("LCD::gpi", 1, plugin_gpi);
+ AddFunction("LCD::adc", 0, plugin_adc);
+ AddFunction("LCD::pwm", -1, plugin_pwm);
+
+ return 0;
+}
+
+
+/* close driver & display */
+int drv_BuE_quit(const int quiet)
+{
+
+ info("%s: shutting down.", Name);
+
+ drv_generic_text_quit();
+
+ /* clear display */
+ drv_BuE_clear();
+
+ /* say goodbye... */
+ if (!quiet) {
+ drv_generic_text_greet("goodbye!", NULL);
+ }
+
+ drv_generic_serial_close();
+
+ return (0);
+}
+
+
+DRIVER drv_BeckmannEgle = {
+ .name = Name,
+ .list = drv_BuE_list,
+ .init = drv_BuE_init,
+ .quit = drv_BuE_quit,
+};
diff --git a/drv_Crystalfontz.c b/drv_Crystalfontz.c
new file mode 100644
index 0000000..9b11587
--- /dev/null
+++ b/drv_Crystalfontz.c
@@ -0,0 +1,1185 @@
+/* $Id: drv_Crystalfontz.c 906 2008-12-23 14:55:32Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/drv_Crystalfontz.c $
+ *
+ * new style driver for Crystalfontz display modules
+ *
+ * Copyright (C) 1999, 2000 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ *
+ * exported fuctions:
+ *
+ * struct DRIVER drv_Crystalfontz
+ *
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/time.h>
+
+#include "debug.h"
+#include "cfg.h"
+#include "qprintf.h"
+#include "thread.h"
+#include "timer.h"
+#include "plugin.h"
+#include "widget.h"
+#include "widget_text.h"
+#include "widget_icon.h"
+#include "widget_bar.h"
+#include "widget_keypad.h"
+#include "drv.h"
+#include "drv_generic_text.h"
+#include "drv_generic_gpio.h"
+#include "drv_generic_serial.h"
+#include "drv_generic_keypad.h"
+
+
+static char Name[] = "Crystalfontz";
+
+static int Model;
+static int Protocol;
+static int Payload;
+
+/* ring buffer for bytes received from the display */
+static unsigned char RingBuffer[256];
+static unsigned int RingRPos = 0;
+static unsigned int RingWPos = 0;
+
+/* packet from the display */
+struct {
+ unsigned char type;
+ unsigned char code;
+ unsigned char size;
+ unsigned char data[16 + 1]; /* trailing '\0' */
+} Packet;
+
+/* Line Buffer for 633 displays */
+static unsigned char Line[2 * 16];
+
+/* Fan RPM */
+static double Fan_RPM[4] = { 0.0, };
+
+/* Temperature sensors */
+static double Temperature[32] = { 0.0, };
+
+
+typedef struct {
+ int type;
+ char *name;
+ int rows;
+ int cols;
+ int gpis;
+ int gpos;
+ int protocol;
+ int payload;
+} MODEL;
+
+/* Fixme #1: number of GPI's & GPO's should be verified */
+/* Fixme #2: protocol should be verified */
+/* Fixme #3: number of keys on the keypad should be verified */
+
+static MODEL Models[] = {
+ {626, "626", 2, 16, 0, 0, 1, 0},
+ {631, "631", 2, 20, 4, 0, 3, 22},
+ {632, "632", 2, 16, 0, 0, 1, 0},
+ {633, "633", 2, 16, 4, 4, 2, 18},
+ {634, "634", 4, 20, 0, 0, 1, 0},
+ {635, "635", 4, 20, 4, 12, 3, 22},
+ {636, "636", 2, 16, 0, 0, 1, 0},
+ {-1, "Unknown", -1, -1, 0, 0, 0, 0}
+};
+
+
+/****************************************/
+/*** hardware dependant functions ***/
+/****************************************/
+
+/* x^0 + x^5 + x^12 */
+#define CRCPOLY 0x8408
+
+static unsigned short CRC(const unsigned char *p, size_t len, unsigned short seed)
+{
+ int i;
+ while (len--) {
+ seed ^= *p++;
+ for (i = 0; i < 8; i++)
+ seed = (seed >> 1) ^ ((seed & 1) ? CRCPOLY : 0);
+ }
+ return ~seed;
+}
+
+static unsigned char LSB(const unsigned short word)
+{
+ return word & 0xff;
+}
+
+static unsigned char MSB(const unsigned short word)
+{
+ return word >> 8;
+}
+
+
+static unsigned char byte(unsigned int pos)
+{
+ pos += RingRPos;
+ if (pos >= sizeof(RingBuffer))
+ pos -= sizeof(RingBuffer);
+ return RingBuffer[pos];
+}
+
+
+static void drv_CF_process_packet(void)
+{
+
+ switch (Packet.type) {
+
+ case 0x02:
+
+ /* async response from display to host */
+ switch (Packet.code) {
+
+ case 0x00:
+ /* Key Activity */
+ debug("Key Activity: %d", Packet.data[0]);
+ drv_generic_keypad_press(Packet.data[0]);
+ break;
+
+ case 0x01:
+ /* Fan Speed Report */
+ if (Packet.data[1] == 0xff) {
+ Fan_RPM[Packet.data[0]] = -1.0;
+ } else if (Packet.data[1] < 4) {
+ Fan_RPM[Packet.data[0]] = 0.0;
+ } else {
+ Fan_RPM[Packet.data[0]] =
+ (double) 27692308L *(Packet.data[1] - 3) / (Packet.data[2] + 256 * Packet.data[3]);
+ }
+ break;
+
+ case 0x02:
+ /* Temperature Sensor Report */
+ switch (Packet.data[3]) {
+ case 0:
+ error("%s: 1-Wire device #%d: CRC error", Name, Packet.data[0]);
+ break;
+ case 1:
+ case 2:
+ Temperature[Packet.data[0]] = (Packet.data[1] + 256 * Packet.data[2]) / 16.0;
+ break;
+ default:
+ error("%s: 1-Wire device #%d: unknown CRC status %d", Name, Packet.data[0], Packet.data[3]);
+ break;
+ }
+ break;
+
+ default:
+ /* this should not happen */
+ error("%s: unexpected response type=0x%02x code=0x%02x size=%d", Name, Packet.type, Packet.code,
+ Packet.size);
+ break;
+ }
+
+ break;
+
+ case 0x03:
+ /* error response from display to host */
+ error("%s: error response type=0x%02x code=0x%02x size=%d", Name, Packet.type, Packet.code, Packet.size);
+ break;
+
+ default:
+ /* these should not happen: */
+ /* type 0x00: command from host to display: should never come back */
+ /* type 0x01: command response from display to host: are processed within send() */
+ error("%s: unexpected packet type=0x%02x code=0x%02x size=%d", Name, Packet.type, Packet.code, Packet.size);
+ break;
+ }
+
+}
+
+
+static int drv_CF_poll(void)
+{
+ /* read into RingBuffer */
+ while (1) {
+ char buffer[32];
+ int num, n;
+ num = drv_generic_serial_poll(buffer, sizeof(buffer));
+ if (num <= 0)
+ break;
+ /* put result into RingBuffer */
+ for (n = 0; n < num; n++) {
+ RingBuffer[RingWPos++] = (unsigned char) buffer[n];
+ if (RingWPos >= sizeof(RingBuffer))
+ RingWPos = 0;
+ }
+ }
+
+ /* process RingBuffer */
+ while (1) {
+ unsigned char buffer[32];
+ int n, num, size;
+ unsigned short crc;
+ /* packet size */
+ num = RingWPos - RingRPos;
+ if (num < 0)
+ num += sizeof(RingBuffer);
+ /* minimum packet size=4 */
+ if (num < 4)
+ return 0;
+ /* valid response types: 01xxxxx 10.. 11.. */
+ /* therefore: 00xxxxxx is invalid */
+ if (byte(0) >> 6 == 0)
+ goto GARBAGE;
+ /* command length */
+ size = byte(1);
+ /* valid command length is 0 to 16 */
+ if (size > 16)
+ goto GARBAGE;
+ /* all bytes available? */
+ if (num < size + 4)
+ return 0;
+ /* check CRC */
+ for (n = 0; n < size + 4; n++)
+ buffer[n] = byte(n);
+ crc = CRC(buffer, size + 2, 0xffff);
+ if (LSB(crc) != buffer[size + 2])
+ goto GARBAGE;
+ if (MSB(crc) != buffer[size + 3])
+ goto GARBAGE;
+ /* process packet */
+ Packet.type = buffer[0] >> 6;
+ Packet.code = buffer[0] & 0x3f;
+ Packet.size = size;
+ memcpy(Packet.data, buffer + 2, size);
+ Packet.data[size] = '\0'; /* trailing zero */
+ /* increment read pointer */
+ RingRPos += size + 4;
+ if (RingRPos >= sizeof(RingBuffer))
+ RingRPos -= sizeof(RingBuffer);
+ /* a packet arrived */
+ return 1;
+ GARBAGE:
+ debug("dropping garbage byte %02x", byte(0));
+ RingRPos++;
+ if (RingRPos >= sizeof(RingBuffer))
+ RingRPos = 0;
+ continue;
+ }
+
+ /* not reached */
+ return 0;
+}
+
+
+static void drv_CF_timer(void __attribute__ ((unused)) * notused)
+{
+ while (drv_CF_poll()) {
+ drv_CF_process_packet();
+ }
+}
+
+
+static void drv_CF_send(const unsigned char cmd, const unsigned char len, const unsigned char *data)
+{
+ /* 1 cmd + 1 len + 22 payload + 2 crc = 26 */
+ unsigned char buffer[26];
+ unsigned short crc;
+ struct timeval now, end;
+
+ if (len > Payload) {
+ error("%s: internal error: packet length %d exceeds payload size %d", Name, len, Payload);
+ return;
+ }
+
+ buffer[0] = cmd;
+ buffer[1] = len;
+ memcpy(buffer + 2, data, len);
+ crc = CRC(buffer, len + 2, 0xffff);
+ buffer[len + 2] = LSB(crc);
+ buffer[len + 3] = MSB(crc);
+
+ drv_generic_serial_write((char *) buffer, len + 4);
+
+ /* wait for acknowledge packet */
+ gettimeofday(&now, NULL);
+ while (1) {
+ /* delay 1 msec */
+ usleep(1 * 1000);
+ if (drv_CF_poll()) {
+ if (Packet.type == 0x01 && Packet.code == cmd) {
+ /* this is the ack we're waiting for */
+ if (0) {
+ gettimeofday(&end, NULL);
+ debug("%s: ACK after %ld usec", Name,
+ 1000000 * (end.tv_sec - now.tv_sec) + end.tv_usec - now.tv_usec);
+ }
+ break;
+ } else {
+ /* some other (maybe async) packet, just process it */
+ drv_CF_process_packet();
+ }
+ }
+ gettimeofday(&end, NULL);
+ /* don't wait more than 250 msec */
+ if ((1000000 * (end.tv_sec - now.tv_sec) + end.tv_usec - now.tv_usec) > 250 * 1000) {
+ error("%s: timeout waiting for response to cmd 0x%02x", Name, cmd);
+ break;
+ }
+ }
+}
+
+
+/* check http://www.crystalfontz.com/products/634/cgrom.html */
+/* HINT: the input should using the ISO-8859-1 charset */
+void convertToCgrom2(char *str)
+{
+ unsigned int i;
+ for (i = 0; i < strlen(str); i++) {
+ switch ((unsigned char) str[i]) {
+ case 0x5d: /* ] */
+ str[i] = 252;
+ break;
+ case 0x5b: /* [ */
+ str[i] = 250;
+ break;
+ case 0x24: /* $ */
+ str[i] = 162;
+ break;
+ case 0x40: /* @ */
+ str[i] = 160;
+ break;
+ case 0x5c: /* \ */
+ str[i] = 251;
+ break;
+ case 0x7b: /* { */
+ str[i] = 253;
+ break;
+ case 0x7d: /* } */
+ str[i] = 255;
+ break;
+ case 0x7c:
+ str[i] = 254; /* pipe */
+ break;
+ case 0x27:
+ case 0x60:
+ case 0xB4:
+ str[i] = 39; /* ' */
+ break;
+ case 0xe8:
+ str[i] = 164; /* french e */
+ break;
+ case 0xe9:
+ str[i] = 165; /* french e */
+ break;
+ case 0xc8:
+ str[i] = 197; /* french E */
+ break;
+ case 0xc9:
+ str[i] = 207; /* french E */
+ break;
+
+ case 0xe4:
+ str[i] = 123; /* small german ae */
+ break;
+ case 0xc4:
+ str[i] = 91; /* big german ae */
+ break;
+ case 0xf6:
+ str[i] = 124; /* small german oe */
+ break;
+ case 0xd6:
+ str[i] = 92; /* big german oe */
+ break;
+ case 0xfc:
+ str[i] = 126; /* small german ue */
+ break;
+ case 0xdc:
+ str[i] = 94; /* big german ue */
+ break;
+ case 0x5e: /* ^ */
+ str[i] = 253;
+ break;
+ case 0x5f: /* _ */
+ str[i] = 254;
+ break;
+ default:
+ break;
+ }
+ }
+}
+
+
+static void drv_CF_write1(const int row, const int col, const char *data, const int len)
+{
+ char cmd[3] = "\021xy"; /* set cursor position */
+
+ if (row == 0 && col == 0) {
+ drv_generic_serial_write("\001", 1); /* cursor home */
+ } else {
+ cmd[1] = (char) col;
+ cmd[2] = (char) row;
+ drv_generic_serial_write(cmd, 3);
+ }
+
+ /* Model 634 and 632 use another ROM */
+ if (Model == 4 || Model == 2) {
+ convertToCgrom2((char *) data);
+ }
+
+ drv_generic_serial_write(data, len);
+}
+
+
+static void drv_CF_write2(const int row, const int col, const char *data, const int len)
+{
+ int l = len;
+
+ /* limit length */
+ if (col + l > 16)
+ l = 16 - col;
+ if (l < 0)
+ l = 0;
+
+ /* sanity check */
+ if (row >= 2 || col + l > 16) {
+ error("%s: internal error: write outside linebuffer bounds!", Name);
+ return;
+ }
+ memcpy(Line + 16 * row + col, data, l);
+ drv_CF_send(7 + row, 16, (unsigned char *) (Line + 16 * row));
+}
+
+
+static void drv_CF_write3(const int row, const int col, const char *data, const int len)
+{
+ int l = len;
+ unsigned char cmd[23];
+
+ /* limit length */
+ if (col + l > DCOLS)
+ l = DCOLS - col;
+ if (l < 0)
+ l = 0;
+
+ /* sanity check */
+ if (row >= DROWS || col + l > DCOLS) {
+ error("%s: internal error: write outside display bounds!", Name);
+ return;
+ }
+
+ cmd[0] = col;
+ cmd[1] = row;
+ memcpy(cmd + 2, data, l);
+
+ drv_CF_send(31, l + 2, cmd);
+}
+
+
+static void drv_CF_defchar1(const int ascii, const unsigned char *matrix)
+{
+ int i;
+ char cmd[10] = "\031n"; /* set custom char bitmap */
+
+ /* user-defineable chars start at 128, but are defined at 0 */
+ cmd[1] = (char) (ascii - CHAR0);
+ for (i = 0; i < 8; i++) {
+ cmd[i + 2] = matrix[i] & 0x3f;
+ }
+ drv_generic_serial_write(cmd, 10);
+}
+
+
+static void drv_CF_defchar23(const int ascii, const unsigned char *matrix)
+{
+ int i;
+ unsigned char buffer[9];
+
+ /* user-defineable chars start at 128, but are defined at 0 */
+ buffer[0] = (char) (ascii - CHAR0);
+
+ /* clear bit 6 and 7 of the bitmap (blinking) */
+ for (i = 0; i < 8; i++) {
+ buffer[i + 1] = matrix[i] & 0x3f;
+ }
+
+ drv_CF_send(9, 9, buffer);
+}
+
+
+static int drv_CF_contrast(int contrast)
+{
+ static unsigned char Contrast = 0;
+ char buffer[2];
+
+ /* -1 is used to query the current contrast */
+ if (contrast == -1)
+ return Contrast;
+
+ if (contrast < 0)
+ contrast = 0;
+ if (contrast > 255)
+ contrast = 255;
+ Contrast = contrast;
+
+ switch (Protocol) {
+
+ case 1:
+ /* contrast range 0 to 100 */
+ if (Contrast > 100)
+ Contrast = 100;
+ buffer[0] = 15; /* Set LCD Contrast */
+ buffer[1] = Contrast;
+ drv_generic_serial_write(buffer, 2);
+ break;
+
+ case 2:
+ /* contrast range 0 to 50 */
+ if (Contrast > 50)
+ Contrast = 50;
+ drv_CF_send(13, 1, &Contrast);
+ break;
+
+ case 3:
+ /* contrast range 0 to 255 */
+ drv_CF_send(13, 1, &Contrast);
+ break;
+ }
+
+ return Contrast;
+}
+
+
+static int drv_CF_backlight(int backlight)
+{
+ static unsigned char Backlight = 0;
+ char buffer[2];
+
+ /* -1 is used to query the current backlight */
+ if (backlight == -1)
+ return Backlight;
+
+ if (backlight < 0)
+ backlight = 0;
+ if (backlight > 100)
+ backlight = 100;
+ Backlight = backlight;
+
+ switch (Protocol) {
+
+ case 1:
+ buffer[0] = 14; /* Set LCD Backlight */
+ buffer[1] = Backlight;
+ drv_generic_serial_write(buffer, 2);
+ break;
+
+ case 2:
+ case 3:
+ drv_CF_send(14, 1, &Backlight);
+ break;
+ }
+
+ return Backlight;
+}
+
+
+static int drv_CF_keypad(const int num)
+{
+ int val = 0;
+
+ switch (Protocol) {
+ case 1:
+ case 2:
+ break;
+ case 3:
+ if ((num < 7) || ((num > 12) && (num < 17)))
+ val = WIDGET_KEY_PRESSED;
+ else
+ val = WIDGET_KEY_RELEASED;
+ switch (num) {
+ case 1:
+ case 7:
+ val += WIDGET_KEY_UP;
+ break;
+ case 2:
+ case 8:
+ val += WIDGET_KEY_DOWN;
+ break;
+ case 3:
+ case 9:
+ val += WIDGET_KEY_LEFT;
+ break;
+ case 4:
+ case 10:
+ val += WIDGET_KEY_RIGHT;
+ break;
+ case 5:
+ case 11:
+ val += WIDGET_KEY_CONFIRM;
+ break;
+ case 6:
+ case 12:
+ val += WIDGET_KEY_CANCEL;
+ break;
+
+ /* added for 631, too lazy to make new WIDGET_KEY defines */
+ case 13:
+ case 17:
+ val += WIDGET_KEY_UP; /* really UPLEFT */
+ break;
+ case 14:
+ case 18:
+ val += WIDGET_KEY_RIGHT; /* really UPRIGHT */
+ break;
+ case 15:
+ case 19:
+ val += WIDGET_KEY_LEFT; /* really DOWNLEFT */
+ break;
+ case 16:
+ case 20:
+ val += WIDGET_KEY_DOWN; /* really DOWNRIGHT */
+ break;
+ }
+ break;
+ }
+
+ return val;
+}
+
+
+static int drv_CF_GPI(const int num)
+{
+ if (num < 0 || num > 3) {
+ return 0;
+ }
+ return Fan_RPM[num];
+}
+
+
+static int drv_CF_GPO(const int num, const int val)
+{
+ static unsigned char PWM2[4] = { 0, 0, 0, 0 };
+ static unsigned char PWM3[2];
+
+ int v = val;
+
+ if (v < 0)
+ v = 0;
+ if (v > 100)
+ v = 100;
+
+ switch (Protocol) {
+ case 2:
+ PWM2[num] = v;
+ drv_CF_send(17, 4, PWM2);
+ break;
+ case 3:
+ PWM3[0] = num + 1;
+ PWM3[1] = v;
+ drv_CF_send(34, 2, PWM3);
+ break;
+ }
+
+ return v;
+}
+
+
+static int drv_CF_autodetect(void)
+{
+ int m;
+
+ /* only autodetect newer displays */
+ if (Protocol < 2)
+ return -1;
+
+ /* read display type */
+ drv_CF_send(1, 0, NULL);
+
+ /* send() did already wait for response packet */
+ if (Packet.type == 0x01 && Packet.code == 0x01) {
+ char t[7], c;
+ float h, v;
+ info("%s: display identifies itself as '%s'", Name, Packet.data);
+ if (sscanf((char *) Packet.data, "%6s:h%f,%c%f", t, &h, &c, &v) != 4) {
+ error("%s: error parsing display identification string", Name);
+ return -1;
+ }
+ info("%s: display type '%s', hardware version %3.1f, firmware version %c%3.1f", Name, t, h, c, v);
+ if (strncmp(t, "CFA", 3) == 0) {
+ for (m = 0; Models[m].type != -1; m++) {
+ /* omit the 'CFA' */
+ if (strcasecmp(Models[m].name, t + 3) == 0)
+ return m;
+ }
+ }
+ error("%s: display type '%s' may be not supported!", Name, t);
+ return -1;
+ }
+
+ error("%s: display detection failed!", Name);
+
+ return -1;
+}
+
+
+static char *drv_CF_print_ROM(void)
+{
+ static char buffer[17];
+
+ snprintf(buffer, sizeof(buffer), "0x%02x%02x%02x%02x%02x%02x%02x%02x",
+ Packet.data[1], Packet.data[2], Packet.data[3], Packet.data[4], Packet.data[5], Packet.data[6],
+ Packet.data[7], Packet.data[8]);
+
+ return buffer;
+}
+
+
+static int drv_CF_scan_DOW(unsigned char index)
+{
+ int i;
+
+ /* Read DOW Device Information */
+ drv_CF_send(18, 1, &index);
+
+ i = 0;
+ while (1) {
+ /* wait 10 msec */
+ usleep(10 * 1000);
+ /* packet available? */
+ if (drv_CF_poll()) {
+ /* DOW Device Info */
+ if (Packet.type == 0x01 && Packet.code == 0x12) {
+ switch (Packet.data[1]) {
+ case 0x00:
+ /* no device found */
+ return 0;
+ case 0x22:
+ info("%s: 1-Wire device #%d: DS1822 temperature sensor found at %s", Name, Packet.data[0],
+ drv_CF_print_ROM());
+ return 1;
+ case 0x28:
+ info("%s: 1-Wire device #%d: DS18B20 temperature sensor found at %s", Name, Packet.data[0],
+ drv_CF_print_ROM());
+ return 1;
+ default:
+ info("%s: 1-Wire device #%d: unknown device found at %s", Name, Packet.data[0], drv_CF_print_ROM());
+ return 0;
+ }
+ } else {
+ drv_CF_process_packet();
+ }
+ }
+ /* wait no longer than 300 msec */
+ if (++i > 30) {
+ error("%s: 1-Wire device #%d detection timed out", Name, index);
+ return -1;
+ }
+ }
+
+ /* not reached */
+ return -1;
+}
+
+
+/* clear display */
+static void drv_CF_clear(void)
+{
+ switch (Protocol) {
+ case 1:
+ drv_generic_serial_write("\014", 1);
+ break;
+ case 2:
+ case 3:
+ drv_CF_send(6, 0, NULL);
+ break;
+ }
+}
+
+
+/* init sequences for 626, 632, 634, 636 */
+static void drv_CF_start_1(void)
+{
+ drv_generic_serial_write("\014", 1); /* Form Feed (Clear Display) */
+ drv_generic_serial_write("\004", 1); /* hide cursor */
+ drv_generic_serial_write("\024", 1); /* scroll off */
+ drv_generic_serial_write("\030", 1); /* wrap off */
+}
+
+
+/* init sequences for 633 */
+static void drv_CF_start_2(void)
+{
+ int i;
+ unsigned long mask;
+ unsigned char buffer[4];
+
+ /* Clear Display */
+ drv_CF_send(6, 0, NULL);
+
+ /* Set LCD Cursor Style */
+ buffer[0] = 0;
+ drv_CF_send(12, 1, buffer);
+
+ /* enable Fan Reporting */
+ buffer[0] = 15;
+ drv_CF_send(16, 1, buffer);
+
+ /* Set Fan Power to 100% */
+ buffer[0] = buffer[1] = buffer[2] = buffer[3] = 100;
+ drv_CF_send(17, 4, buffer);
+
+ /* Read DOW Device Information */
+ mask = 0;
+ for (i = 0; i < 32; i++) {
+ if (drv_CF_scan_DOW(i) == 1) {
+ mask |= 1 << i;
+ }
+ }
+
+ /* enable Temperature Reporting */
+ buffer[0] = mask & 0xff;
+ buffer[1] = (mask >> 8) & 0xff;
+ buffer[2] = (mask >> 16) & 0xff;
+ buffer[3] = (mask >> 24) & 0xff;
+ drv_CF_send(19, 4, buffer);
+}
+
+
+/* init sequences for 631 */
+static void drv_CF_start_3(void)
+{
+ unsigned char buffer[1];
+
+ /* Clear Display */
+ drv_CF_send(6, 0, NULL);
+
+ /* Set LCD Cursor Style */
+ buffer[0] = 0;
+ drv_CF_send(12, 1, buffer);
+
+}
+
+
+static int drv_CF_start(const char *section)
+{
+ int i;
+ char *model;
+
+ model = cfg_get(section, "Model", NULL);
+ if (model != NULL && *model != '\0') {
+ for (i = 0; Models[i].type != -1; i++) {
+ if (strcasecmp(Models[i].name, model) == 0)
+ break;
+ }
+ if (Models[i].type == -1) {
+ error("%s: %s.Model '%s' is unknown from %s", Name, section, model, cfg_source());
+ return -1;
+ }
+ Model = i;
+ Protocol = Models[Model].protocol;
+ info("%s: using model '%s'", Name, Models[Model].name);
+ } else {
+ Model = -1;
+ Protocol = 2; /*auto-detect only newer displays */
+ info("%s: no '%s.Model' entry from %s, auto-detecting", Name, section, cfg_source());
+ }
+
+ /* open serial port */
+ if (drv_generic_serial_open(section, Name, 0) < 0)
+ return -1;
+
+ /* Fixme: why such a large delay? */
+ usleep(350 * 1000);
+
+ /* display autodetection */
+ i = drv_CF_autodetect();
+ if (Model == -1)
+ Model = i;
+ if (Model == -1) {
+ error("%s: auto-detection failed, please specify a '%s.Model' entry in %s", Name, section, cfg_source());
+ return -1;
+ }
+ if (i != -1 && Model != i) {
+ error("%s: %s.Model '%s' from %s does not match detected model '%s'", Name, section, model, cfg_source(),
+ Models[i].name);
+ return -1;
+ }
+
+ /* initialize global variables */
+ DROWS = Models[Model].rows;
+ DCOLS = Models[Model].cols;
+ GPIS = Models[Model].gpis;
+ GPOS = Models[Model].gpos;
+ Protocol = Models[Model].protocol;
+ Payload = Models[Model].payload;
+
+
+ switch (Protocol) {
+
+ case 1:
+ drv_CF_start_1();
+ break;
+
+ case 2:
+ /* regularly process display answers */
+ /* Fixme: make 100msec configurable */
+ timer_add(drv_CF_timer, NULL, 100, 0);
+ drv_CF_start_2();
+ /* clear 633 linebuffer */
+ memset(Line, ' ', sizeof(Line));
+ break;
+
+ case 3:
+ /* regularly process display answers */
+ /* Fixme: make 100msec configurable */
+ timer_add(drv_CF_timer, NULL, 100, 0);
+ drv_CF_start_3();
+ break;
+ }
+
+ /* set contrast */
+ if (cfg_number(section, "Contrast", 0, 0, 255, &i) > 0) {
+ drv_CF_contrast(i);
+ }
+
+ /* set backlight */
+ if (cfg_number(section, "Backlight", 0, 0, 100, &i) > 0) {
+ drv_CF_backlight(i);
+ }
+
+ return 0;
+}
+
+
+/****************************************/
+/*** plugins ***/
+/****************************************/
+
+
+static void plugin_contrast(RESULT * result, const int argc, RESULT * argv[])
+{
+ double contrast;
+
+ switch (argc) {
+ case 0:
+ contrast = drv_CF_contrast(-1);
+ SetResult(&result, R_NUMBER, &contrast);
+ break;
+ case 1:
+ contrast = drv_CF_contrast(R2N(argv[0]));
+ SetResult(&result, R_NUMBER, &contrast);
+ break;
+ default:
+ error("%s.contrast(): wrong number of parameters", Name);
+ SetResult(&result, R_STRING, "");
+ }
+}
+
+
+static void plugin_backlight(RESULT * result, const int argc, RESULT * argv[])
+{
+ double backlight;
+
+ switch (argc) {
+ case 0:
+ backlight = drv_CF_backlight(-1);
+ SetResult(&result, R_NUMBER, &backlight);
+ break;
+ case 1:
+ backlight = drv_CF_backlight(R2N(argv[0]));
+ SetResult(&result, R_NUMBER, &backlight);
+ break;
+ default:
+ error("%s.backlight(): wrong number of parameters", Name);
+ SetResult(&result, R_STRING, "");
+ }
+}
+
+
+/* Fixme: other plugins for Fans, Temperature sensors, ... */
+
+
+
+/****************************************/
+/*** widget callbacks ***/
+/****************************************/
+
+/* using drv_generic_text_draw(W) */
+/* using drv_generic_text_icon_draw(W) */
+/* using drv_generic_text_bar_draw(W) */
+/* using drv_generic_gpio_draw(W) */
+/* using drv_generic_keypad_draw(W) */
+
+
+/****************************************/
+/*** exported functions ***/
+/****************************************/
+
+
+/* list models */
+int drv_CF_list(void)
+{
+ int i;
+
+ for (i = 0; Models[i].type != -1; i++) {
+ printf("%s ", Models[i].name);
+ }
+ return 0;
+}
+
+
+/* initialize driver & display */
+int drv_CF_init(const char *section, const int quiet)
+{
+ WIDGET_CLASS wc;
+ int ret;
+
+ info("%s: %s", Name, "$Rev: 906 $");
+
+ /* start display */
+ if ((ret = drv_CF_start(section)) != 0) {
+ return ret;
+ }
+
+ /* display preferences */
+ XRES = 6; /* pixel width of one char */
+ YRES = 8; /* pixel height of one char */
+ CHARS = 8; /* number of user-defineable characters */
+
+ /* real worker functions */
+ switch (Protocol) {
+ case 1:
+ CHAR0 = 128; /* ASCII of first user-defineable char */
+ GOTO_COST = 3; /* number of bytes a goto command requires */
+ drv_generic_text_real_write = drv_CF_write1;
+ drv_generic_text_real_defchar = drv_CF_defchar1;
+ break;
+ case 2:
+ CHAR0 = 0; /* ASCII of first user-defineable char */
+ GOTO_COST = -1; /* there is no goto on 633 */
+ drv_generic_text_real_write = drv_CF_write2;
+ drv_generic_text_real_defchar = drv_CF_defchar23;
+ drv_generic_gpio_real_get = drv_CF_GPI;
+ drv_generic_gpio_real_set = drv_CF_GPO;
+ break;
+ case 3:
+ CHAR0 = 0; /* ASCII of first user-defineable char */
+ GOTO_COST = 3; /* number of bytes a goto command requires */
+ drv_generic_text_real_write = drv_CF_write3;
+ drv_generic_text_real_defchar = drv_CF_defchar23;
+ drv_generic_gpio_real_get = drv_CF_GPI;
+ drv_generic_gpio_real_set = drv_CF_GPO;
+ drv_generic_keypad_real_press = drv_CF_keypad;
+ break;
+ }
+
+ if (!quiet) {
+ char buffer[40];
+ qprintf(buffer, sizeof(buffer), "%s %s", Name, Models[Model].name);
+ if (drv_generic_text_greet(buffer, "www.crystalfontz.com")) {
+ sleep(3);
+ drv_CF_clear();
+ }
+ }
+
+ /* initialize generic text driver */
+ if ((ret = drv_generic_text_init(section, Name)) != 0)
+ return ret;
+
+ /* initialize generic icon driver */
+ if ((ret = drv_generic_text_icon_init()) != 0)
+ return ret;
+
+ /* initialize generic bar driver */
+ if ((ret = drv_generic_text_bar_init(0)) != 0)
+ return ret;
+
+ /* add fixed chars to the bar driver */
+ drv_generic_text_bar_add_segment(0, 0, 255, 32); /* ASCII 32 = blank */
+ if (Protocol == 2)
+ drv_generic_text_bar_add_segment(255, 255, 255, 255); /* ASCII 255 = block */
+
+ /* initialize generic GPIO driver */
+ if ((ret = drv_generic_gpio_init(section, Name)) != 0)
+ return ret;
+
+ /* initialize generic key pad driver */
+ if ((ret = drv_generic_keypad_init(section, Name)) != 0)
+ return ret;
+
+ /* register text widget */
+ wc = Widget_Text;
+ wc.draw = drv_generic_text_draw;
+ widget_register(&wc);
+
+ /* register icon widget */
+ wc = Widget_Icon;
+ wc.draw = drv_generic_text_icon_draw;
+ widget_register(&wc);
+
+ /* register bar widget */
+ wc = Widget_Bar;
+ wc.draw = drv_generic_text_bar_draw;
+ widget_register(&wc);
+
+ /* register plugins */
+ AddFunction("LCD::contrast", -1, plugin_contrast);
+ AddFunction("LCD::backlight", -1, plugin_backlight);
+
+ return 0;
+}
+
+
+/* close driver & display */
+int drv_CF_quit(const int quiet)
+{
+
+ info("%s: shutting down display.", Name);
+
+ drv_generic_text_quit();
+ drv_generic_gpio_quit();
+ drv_generic_keypad_quit();
+
+ /* clear display */
+ drv_CF_clear();
+
+ /* say goodbye... */
+ if (!quiet) {
+ drv_generic_text_greet("goodbye!", NULL);
+ }
+
+ drv_generic_serial_close();
+
+ return (0);
+}
+
+
+DRIVER drv_Crystalfontz = {
+ .name = Name,
+ .list = drv_CF_list,
+ .init = drv_CF_init,
+ .quit = drv_CF_quit,
+};
diff --git a/drv_Curses.c b/drv_Curses.c
new file mode 100644
index 0000000..2e00210
--- /dev/null
+++ b/drv_Curses.c
@@ -0,0 +1,373 @@
+/* $Id: drv_Curses.c 975 2009-01-18 11:16:20Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/drv_Curses.c $
+ *
+ * pure ncurses based text driver
+ *
+ * Copyright (C) 2004 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * based on the old Curses/Text driver which is
+ * Copyright (C) 2001 Leopold Toetsch <lt@toetsch.at>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ *
+ * exported fuctions:
+ *
+ * struct DRIVER drv_Curses
+ *
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <curses.h>
+
+#include "debug.h"
+#include "cfg.h"
+#include "qprintf.h"
+#include "timer.h"
+#include "plugin.h"
+#include "widget.h"
+#include "widget_text.h"
+#include "widget_bar.h"
+#include "widget_keypad.h"
+#include "drv.h"
+#include "drv_generic_text.h"
+#include "drv_generic_keypad.h"
+
+
+static char Name[] = "Curses";
+
+static WINDOW *w = NULL;
+static WINDOW *e = NULL;
+
+static int EROWS;
+
+
+/****************************************/
+/*** hardware dependant functions ***/
+/****************************************/
+
+static void drv_Curs_clear(void)
+{
+ werase(w);
+ box(w, 0, 0);
+ wrefresh(w);
+}
+
+
+static void drv_Curs_write(const int row, const int col, const char *data, const int len)
+{
+ int l = len;
+ char *p;
+
+ while ((p = strpbrk(data, "\r\n")) != NULL) {
+ *p = '\0';
+ }
+
+ if (col < DCOLS) {
+ if (DCOLS - col < l)
+ l = DCOLS - col;
+ mvwprintw(w, row + 1, col + 1, "%.*s", l, data);
+ wmove(w, DROWS + 1, 0);
+ wrefresh(w);
+ }
+}
+
+
+static void drv_Curs_defchar(const __attribute__ ((unused))
+ int ascii, const __attribute__ ((unused))
+ unsigned char *buffer)
+{
+ /* empty */
+}
+
+
+/* ncures scroll SIGSEGVs on my system, so this is a workaroud */
+
+int curses_error(char *buffer)
+{
+ static int lines = 0;
+ static char *lb[100];
+ int start, i;
+ char *p;
+
+ if (e == NULL)
+ return 0;
+
+ /* replace \r, \n with underscores */
+ while ((p = strpbrk(buffer, "\r\n")) != NULL) {
+ *p = '_';
+ }
+
+ if (lines >= EROWS) {
+ free(lb[0]);
+ for (i = 1; i <= EROWS; i++) {
+ lb[i - 1] = lb[i];
+ }
+ start = 0;
+ } else {
+ start = lines;
+ }
+
+ lb[lines] = strdup(buffer);
+ for (i = start; i <= lines; i++) {
+ mvwprintw(e, i + 1, 1, "%s", lb[i]);
+ wclrtoeol(e);
+ }
+
+ box(e, 0, 0);
+ mvwprintw(e, 0, 3, "Stderr:");
+ wrefresh(e);
+
+ if (lines < EROWS)
+ lines++;
+
+ return 1;
+}
+
+
+static int drv_Curs_start(const char *section, const int quiet)
+{
+ char *s;
+
+ if (!running_foreground) {
+ error("%s: You want me to display on /dev/null? Sorry, I can't ...", Name);
+ error("%s: Maybe you want me to run in foreground? Try '-F'", Name);
+ return -1;
+ }
+
+ s = cfg_get(section, "Size", "20x4");
+ if (s == NULL || *s == '\0') {
+ error("%s: no '%s.Size' entry from %s", Name, section, cfg_source());
+ free(s);
+ return -1;
+ }
+ if (sscanf(s, "%dx%d", &DCOLS, &DROWS) != 2 || DROWS < 1 || DCOLS < 1) {
+ error("%s: bad %s.Size '%s' from %s", Name, section, s, cfg_source());
+ free(s);
+ return -1;
+ }
+ free(s);
+
+ initscr();
+ noecho();
+ debug("%s: curses thinks that COLS=%d LINES=%d", Name, COLS, LINES);
+ w = newwin(DROWS + 2, DCOLS + 2, 0, 0);
+ keypad(w, TRUE);
+ nodelay(w, TRUE);
+
+ EROWS = LINES - DROWS - 3;
+ if (EROWS > 99)
+ EROWS = 99;
+ debug("EROWS=%d", EROWS);
+
+ if (EROWS >= 4) {
+ e = newwin(EROWS, COLS, DROWS + 3, 0);
+ EROWS -= 3;
+ box(e, 0, 0);
+ mvwprintw(e, 0, 3, "Stderr:");
+ wmove(e, 1, 0);
+ wrefresh(e);
+ }
+
+ drv_Curs_clear();
+
+ if (!quiet) {
+ char buffer[40];
+ qprintf(buffer, sizeof(buffer), "%s %dx%d", Name, DCOLS, DROWS);
+ if (drv_generic_text_greet(buffer, NULL)) {
+ sleep(3);
+ drv_Curs_clear();
+ }
+ }
+
+ return 0;
+}
+
+static void drv_Curs_timer(void __attribute__ ((unused)) * notused)
+{
+ int c;
+ while (1) {
+ c = wgetch(w);
+ if (c <= 0)
+ break;
+ drv_generic_keypad_press(c);
+ }
+}
+
+static int drv_Curs_keypad(const int num)
+{
+ int val = 0;
+
+ switch (num) {
+ case KEY_UP:
+ debug("Key Up");
+ val += WIDGET_KEY_PRESSED;
+ val += WIDGET_KEY_UP;
+ break;
+ case KEY_DOWN:
+ debug("Key Down");
+ val += WIDGET_KEY_PRESSED;
+ val += WIDGET_KEY_DOWN;
+ break;
+ case KEY_LEFT:
+ debug("Key Left");
+ val += WIDGET_KEY_PRESSED;
+ val += WIDGET_KEY_LEFT;
+ break;
+ case KEY_RIGHT:
+ debug("Key Right");
+ val += WIDGET_KEY_PRESSED;
+ val += WIDGET_KEY_RIGHT;
+ break;
+ default:
+ debug("Unbound Key '%d'", num);
+ break;
+ }
+
+ return val;
+}
+
+
+/****************************************/
+/*** plugins ***/
+/****************************************/
+
+/* none at the moment... */
+
+
+/****************************************/
+/*** widget callbacks ***/
+/****************************************/
+
+/* using drv_generic_text_draw(W) */
+/* using drv_generic_text_bar_draw(W) */
+/* using drv_generic_keypad_draw(W) */
+
+
+/****************************************/
+/*** exported functions ***/
+/****************************************/
+
+
+/* list models */
+int drv_Curs_list(void)
+{
+ printf("pure ncurses based text driver");
+ return 0;
+}
+
+
+/* initialize driver & display */
+int drv_Curs_init(const char *section, const int quiet)
+{
+ WIDGET_CLASS wc;
+ int ret;
+
+ info("%s: %s", Name, "$Rev: 975 $");
+
+ /* display preferences */
+ XRES = 1; /* pixel width of one char */
+ YRES = 1; /* pixel height of one char */
+ CHARS = 0; /* number of user-defineable characters */
+ CHAR0 = 0; /* ASCII of first user-defineable char */
+ GOTO_COST = 0; /* number of bytes a goto command requires */
+
+ /* real worker functions */
+ drv_generic_text_real_write = drv_Curs_write;
+ drv_generic_text_real_defchar = drv_Curs_defchar;
+ drv_generic_keypad_real_press = drv_Curs_keypad;
+
+ /* regularly process display answers */
+ timer_add(drv_Curs_timer, NULL, 100, 0);
+
+ /* start display */
+ if ((ret = drv_Curs_start(section, quiet)) != 0) {
+ return ret;
+ }
+
+ /* initialize generic text driver */
+ if ((ret = drv_generic_text_init(section, Name)) != 0)
+ return ret;
+
+ /* initialize generic bar driver */
+ if ((ret = drv_generic_text_bar_init(1)) != 0)
+ return ret;
+
+ /* initialize generic key pad driver */
+ if ((ret = drv_generic_keypad_init(section, Name)) != 0)
+ return ret;
+
+ /* add fixed chars to the bar driver */
+ drv_generic_text_bar_add_segment(0, 0, 255, 32); /* ASCII 32 = blank */
+ drv_generic_text_bar_add_segment(255, 255, 255, '*'); /* asterisk */
+
+ /* register text widget */
+ wc = Widget_Text;
+ wc.draw = drv_generic_text_draw;
+ widget_register(&wc);
+
+ /* register bar widget */
+ wc = Widget_Bar;
+ wc.draw = drv_generic_text_bar_draw;
+ widget_register(&wc);
+
+ /* register plugins */
+ /* none at the moment... */
+
+ return 0;
+}
+
+
+/* close driver & display */
+int drv_Curs_quit(const int quiet)
+{
+
+ info("%s: shutting down.", Name);
+
+ drv_generic_text_quit();
+ drv_generic_keypad_quit();
+
+ /* clear display */
+ drv_Curs_clear();
+
+ /* say goodbye... */
+ if (!quiet) {
+ drv_generic_text_greet("goodbye!", NULL);
+ }
+
+ endwin();
+
+ return (0);
+}
+
+
+DRIVER drv_Curses = {
+ .name = Name,
+ .list = drv_Curs_list,
+ .init = drv_Curs_init,
+ .quit = drv_Curs_quit,
+};
diff --git a/drv_Cwlinux.c b/drv_Cwlinux.c
new file mode 100644
index 0000000..fbf2393
--- /dev/null
+++ b/drv_Cwlinux.c
@@ -0,0 +1,538 @@
+/* $Id: drv_Cwlinux.c 929 2008-12-31 06:40:59Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/drv_Cwlinux.c $
+ *
+ * new style driver for Cwlinux display modules
+ *
+ * Copyright (C) 1999, 2000 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ *
+ * exported fuctions:
+ *
+ * struct DRIVER drv_Cwlinux
+ *
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "debug.h"
+#include "cfg.h"
+#include "qprintf.h"
+#include "timer.h"
+#include "plugin.h"
+#include "widget.h"
+#include "widget_text.h"
+#include "widget_icon.h"
+#include "widget_bar.h"
+#include "widget_keypad.h"
+#include "drv.h"
+#include "drv_generic_text.h"
+#include "drv_generic_gpio.h"
+#include "drv_generic_serial.h"
+#include "drv_generic_keypad.h"
+
+
+static char Name[] = "Cwlinux";
+
+static int Model;
+static int Protocol;
+
+/* ring buffer for bytes received from the display */
+static unsigned char RingBuffer[256];
+static unsigned int RingRPos = 0;
+static unsigned int RingWPos = 0;
+
+typedef struct {
+ int type;
+ char *name;
+ int rows;
+ int cols;
+ int xres; /* pixel width of one char */
+ int yres; /* pixel height of one char */
+ int gpos;
+ int gpis;
+ int chars; /* number of user definable chars */
+ int protocol;
+} MODEL;
+
+
+/* Fixme: number of gpo's should be verified */
+
+static MODEL Models[] = {
+ /* type, name, rows, cols, xres/char, yres/char, gpo's, gpi's, definable chars, protocol */
+ {0x01, "CW1602", 2, 16, 5, 7, 2, 2, 8, 1},
+ {0x02, "CW12232", 4, 20, 6, 8, 2, 2, 16, 2},
+ {0x03, "CW12832", 4, 21, 6, 8, 2, 2, 16, 2},
+ {0xff, "Unknown", -1, -1, -1, -1, -1, -1, -1, -1}
+};
+
+
+/****************************************/
+/*** hardware dependant functions ***/
+/****************************************/
+
+static void drv_CW_process_input(void)
+{
+ while (RingRPos != RingWPos) {
+ drv_generic_keypad_press(RingBuffer[RingRPos++]);
+ if (RingRPos >= sizeof(RingBuffer))
+ RingRPos = 0;
+ }
+}
+
+
+static int drv_CW_poll(void)
+{
+ while (1) {
+ char buffer[32];
+ int num, n;
+
+ num = drv_generic_serial_poll(buffer, sizeof(buffer));
+ if (num <= 0)
+ break; /* no more input */
+
+ /* put result into RingBuffer */
+ for (n = 0; n < num; n++) {
+ RingBuffer[RingWPos++] = (unsigned char) buffer[n];
+ if (RingWPos >= sizeof(RingBuffer))
+ RingWPos = 0;
+ }
+ }
+
+ if (RingRPos != RingWPos)
+ return 1;
+ else
+ return 0;
+}
+
+
+static void drv_CW_timer(void __attribute__ ((unused)) * notused)
+{
+ while (drv_CW_poll()) {
+ drv_CW_process_input();
+ }
+}
+
+
+static void drv_CW_send(const char *string, const int len)
+{
+ drv_generic_serial_write(string, len);
+ usleep(20);
+ if (drv_CW_poll())
+ drv_CW_process_input();
+}
+
+
+static void drv_CW_write(const int row, const int col, const char *data, const int len)
+{
+ char cmd[6] = "\376Gxy\375";
+
+ cmd[2] = (char) col;
+ cmd[3] = (char) row;
+ drv_CW_send(cmd, 5);
+ drv_CW_send(data, len);
+}
+
+
+static void drv_CW1602_defchar(const int ascii, const unsigned char *buffer)
+{
+ int i;
+ char cmd[12] = "\376Nn12345678\375";
+
+ cmd[2] = (char) ascii;
+
+ for (i = 0; i < 8; i++) {
+ cmd[3 + i] = buffer[i] & 0x1f;
+ }
+ drv_CW_send(cmd, 12);
+}
+
+
+static void drv_CW12232_defchar(const int ascii, const unsigned char *buffer)
+{
+ int i, j;
+ char cmd[10] = "\376Nn123456\375"; /* 0xfe 'N' [1..16] (6 Bytes Data) 0xfd */
+
+ cmd[2] = (char) ascii;
+
+ /* The CW12232 uses a vertical bitmap layout, */
+ /* so we have to 'rotate' the bitmap. */
+
+ for (i = 0; i < 6; i++) {
+ cmd[3 + i] = 0;
+ for (j = 0; j < 8; j++) {
+ if (buffer[j] & (1 << (5 - i))) {
+ cmd[3 + i] |= (1 << j);
+ }
+ }
+ }
+ drv_CW_send(cmd, 10);
+}
+
+
+static int drv_CW_GPO(const int num, const int val)
+{
+ /* Fixme: GPO's not yet implemented! */
+ error("%s: GPO's not yet implemented!", Name);
+ /* Fixme: num*val to avoid compiler warning */
+ return num * val;
+}
+
+
+static int drv_CW_GPI(const int num)
+{
+ if (num < 0 || num > GPIS) {
+ return 0;
+ }
+ error("%s: GPI's not yet implemented!", Name);
+ return num;
+}
+
+
+static void drv_CW_clear(void)
+{
+#if 1
+ drv_CW_send("\376X\375", 3); /* Clear Display */
+ usleep(500000);
+#else
+ /* for some mysterious reason, we have to sleep after */
+ /* the command _and_ after the CMD_END... */
+ drv_CW_send("\376X", 2); /* Clear Display */
+ drv_CW_send("\375", 1); /* Command End */
+#endif
+}
+
+
+static int drv_CW_brightness(int brightness)
+{
+ static unsigned char Brightness = 0;
+ char cmd[5] = "\376A_\375";
+
+ /* -1 is used to query the current brightness */
+ if (brightness == -1)
+ return Brightness;
+
+ if (brightness < 0)
+ brightness = 0;
+ if (brightness > 8)
+ brightness = 8;
+ Brightness = brightness;
+
+ switch (Brightness) {
+ case 0:
+ /* backlight off */
+ drv_CW_send("\376F\375", 3);
+ break;
+ case 8:
+ /* backlight on */
+ drv_CW_send("\376B\375", 3);
+ break;
+ default:
+ /* backlight level */
+ cmd[2] = (char) Brightness;
+ drv_CW_send(cmd, 4);
+ break;
+ }
+
+ return Brightness;
+}
+
+
+static int drv_CW_keypad(const int num)
+{
+ int val = WIDGET_KEY_PRESSED;
+
+ switch (num) {
+ case 65:
+ val += WIDGET_KEY_UP;
+ break;
+ case 66:
+ val += WIDGET_KEY_DOWN;
+ break;
+ case 67:
+ val += WIDGET_KEY_LEFT;
+ break;
+ case 68:
+ val += WIDGET_KEY_RIGHT;
+ break;
+ case 69:
+ val += WIDGET_KEY_CONFIRM;
+ break;
+ case 70:
+ val += WIDGET_KEY_CANCEL;
+ break;
+ default:
+ error("%s: unknown keypad value %d", Name, num);
+ }
+
+ debug("%s: key %c (0x%x) pressed", Name, num, num);
+ return val;
+}
+
+
+static int drv_CW_start(const char *section)
+{
+ int i;
+ char *model;
+ char buffer[16];
+
+ model = cfg_get(section, "Model", NULL);
+ if (model != NULL && *model != '\0') {
+ for (i = 0; Models[i].type != 0xff; i++) {
+ if (strcasecmp(Models[i].name, model) == 0)
+ break;
+ }
+ if (Models[i].type == 0xff) {
+ error("%s: %s.Model '%s' is unknown from %s", Name, section, model, cfg_source());
+ return -1;
+ }
+ Model = i;
+ info("%s: using model '%s'", Name, Models[Model].name);
+ } else {
+ error("%s: no '%s.Model' entry from %s", Name, section, cfg_source());
+ return -1;
+ }
+
+ /* open serial port */
+ if (drv_generic_serial_open(section, Name, 0) < 0)
+ return -1;
+
+ /* read firmware version: 0xfe '1' 0xfd */
+ drv_generic_serial_write("\3761\375", 3);
+ usleep(100000);
+ if (drv_generic_serial_read(buffer, 2) != 2) {
+ info("unable to read firmware version!");
+ } else {
+ info("Cwlinux Firmware V%d.%d", (int) buffer[0], (int) buffer[1]);
+ }
+
+ /* read model mumber: 0xfe 0x30 0xfd */
+ drv_generic_serial_write("\3760\375", 3);
+ usleep(100000);
+ if (drv_generic_serial_read(buffer, 2) != 2) {
+ info("unable to read model number!");
+ } else {
+ info("Cwlinux model CW%d%d", (int) buffer[0], (int) buffer[1]);
+ }
+
+ /* initialize global variables */
+ DROWS = Models[Model].rows;
+ DCOLS = Models[Model].cols;
+ XRES = Models[Model].xres;
+ YRES = Models[Model].yres;
+ GPOS = Models[Model].gpos;
+ GPIS = Models[Model].gpis;
+ CHARS = Models[Model].chars;
+ Protocol = Models[Model].protocol;
+
+ /* regularly process display input */
+ timer_add(drv_CW_timer, NULL, 250, 0);
+
+ drv_CW_clear();
+
+ drv_CW_send("\376D\375", 3); /* auto line wrap off */
+ drv_CW_send("\376R\375", 3); /* auto scroll off */
+ drv_CW_send("\376K\375", 3); /* underline cursor off */
+ drv_CW_send("\376B\375", 3); /* backlight on */
+
+ /* set brightness */
+ if (cfg_number(section, "Brightness", 0, 0, 8, &i) > 0) {
+ drv_CW_brightness(i);
+ }
+
+ return 0;
+}
+
+
+/****************************************/
+/*** plugins ***/
+/****************************************/
+
+
+static void plugin_brightness(RESULT * result, const int argc, RESULT * argv[])
+{
+ double brightness;
+
+ switch (argc) {
+ case 0:
+ brightness = drv_CW_brightness(-1);
+ SetResult(&result, R_NUMBER, &brightness);
+ break;
+ case 1:
+ brightness = drv_CW_brightness(R2N(argv[0]));
+ SetResult(&result, R_NUMBER, &brightness);
+ break;
+ default:
+ error("%s.brightness(): wrong number of parameters", Name);
+ SetResult(&result, R_STRING, "");
+ }
+}
+
+
+/****************************************/
+/*** widget callbacks ***/
+/****************************************/
+
+/* using drv_generic_text_draw(W) */
+/* using drv_generic_text_icon_draw(W) */
+/* using drv_generic_text_bar_draw(W) */
+/* using drv_generic_gpio_draw(W) */
+/* using drv_generic_keypad_draw(W) */
+
+
+/****************************************/
+/*** exported functions ***/
+/****************************************/
+
+
+/* list models */
+int drv_CW_list(void)
+{
+ int i;
+
+ for (i = 0; Models[i].type != 0xff; i++) {
+ printf("%s ", Models[i].name);
+ }
+ return 0;
+}
+
+
+/* initialize driver & display */
+int drv_CW_init(const char *section, const int quiet)
+{
+ WIDGET_CLASS wc;
+ int ret;
+
+ info("%s: %s", Name, "$Rev: 929 $");
+
+ /* display preferences */
+ CHAR0 = 1; /* ASCII of first user-defineable char */
+ GOTO_COST = 3; /* number of bytes a goto command requires */
+ INVALIDATE = 1; /* re-defined chars must be re-sent to the display */
+
+ /* start display */
+ if ((ret = drv_CW_start(section)) != 0)
+ return ret;
+
+ /* real worker functions */
+ drv_generic_text_real_write = drv_CW_write;
+ drv_generic_gpio_real_set = drv_CW_GPO;
+ drv_generic_gpio_real_get = drv_CW_GPI;
+ drv_generic_keypad_real_press = drv_CW_keypad;
+
+ switch (Protocol) {
+ case 1:
+ drv_generic_text_real_defchar = drv_CW1602_defchar;
+ break;
+ case 2:
+ drv_generic_text_real_defchar = drv_CW12232_defchar;
+ break;
+ }
+
+ if (!quiet) {
+ char buffer[40];
+ qprintf(buffer, sizeof(buffer), "%s %s", Name, Models[Model].name);
+ if (drv_generic_text_greet(buffer, "www.cwlinux.com")) {
+ sleep(3);
+ drv_CW_clear();
+ }
+ }
+
+ /* initialize generic text driver */
+ if ((ret = drv_generic_text_init(section, Name)) != 0)
+ return ret;
+
+ /* initialize generic icon driver */
+ if ((ret = drv_generic_text_icon_init()) != 0)
+ return ret;
+
+ /* initialize generic bar driver */
+ if ((ret = drv_generic_text_bar_init(0)) != 0)
+ return ret;
+
+ /* add fixed chars to the bar driver */
+ drv_generic_text_bar_add_segment(0, 0, 255, 32); /* ASCII 32 = blank */
+
+ /* initialize generic GPIO driver */
+ if ((ret = drv_generic_gpio_init(section, Name)) != 0)
+ return ret;
+
+ /* initialize generic key pad driver */
+ if ((ret = drv_generic_keypad_init(section, Name)) != 0)
+ return ret;
+
+ /* register text widget */
+ wc = Widget_Text;
+ wc.draw = drv_generic_text_draw;
+ widget_register(&wc);
+
+ /* register icon widget */
+ wc = Widget_Icon;
+ wc.draw = drv_generic_text_icon_draw;
+ widget_register(&wc);
+
+ /* register bar widget */
+ wc = Widget_Bar;
+ wc.draw = drv_generic_text_bar_draw;
+ widget_register(&wc);
+
+ /* register plugins */
+ AddFunction("LCD::brightness", -1, plugin_brightness);
+
+ return 0;
+}
+
+
+/* close driver & display */
+int drv_CW_quit(const int quiet)
+{
+
+ info("%s: shutting down.", Name);
+ drv_generic_text_quit();
+ drv_generic_gpio_quit();
+ drv_generic_keypad_quit();
+
+ /* clear display */
+ drv_CW_clear();
+
+ /* say goodbye... */
+ if (!quiet) {
+ drv_generic_text_greet("goodbye!", NULL);
+ }
+
+ drv_generic_serial_close();
+
+ return (0);
+}
+
+
+DRIVER drv_Cwlinux = {
+ .name = Name,
+ .list = drv_CW_list,
+ .init = drv_CW_init,
+ .quit = drv_CW_quit,
+};
diff --git a/drv_D4D.c b/drv_D4D.c
new file mode 100755
index 0000000..811fea4
--- /dev/null
+++ b/drv_D4D.c
@@ -0,0 +1,924 @@
+/* $Id: drv_D4D.c 1163 2011-12-09 03:16:17Z sonic74 $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/drv_D4D.c $
+ *
+ * LCD4Linux driver for 4D Systems Display Graphics Modules
+ *
+ * Copyright (C) 2008, 2011 Sven Killig <sven@killig.de>
+ * Modified from sample code by:
+ * Copyright (C) 2005 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2005, 2006, 2007 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ *
+ * exported fuctions:
+ *
+ * struct DRIVER drv_D4D
+ *
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+
+#include <termios.h>
+#include <fcntl.h>
+#include <math.h>
+
+#include "debug.h"
+#include "cfg.h"
+#include "qprintf.h"
+#include "udelay.h"
+#include "plugin.h"
+#include "widget.h"
+#include "widget_text.h"
+#include "widget_icon.h"
+#include "widget_bar.h"
+#include "drv.h"
+
+#include "drv_generic_text.h"
+#include "drv_generic_graphic.h"
+#include "drv_generic_serial.h"
+
+#include <sys/ioctl.h>
+#include <linux/serial.h>
+
+static char Name[] = "D4D";
+char NAME_[20];
+int FONT = 1, MODE = 0, EXTRA = 0, SECTOR = 0, SECTOR_SIZE, POWERCYCLE = 0;
+/* int CONTRAST_; */
+
+#define address_mmsb(variable) ((variable >> 24) & 0xFF)
+#define address_mlsb(variable) ((variable >> 16) & 0xFF)
+#define address_lmsb(variable) ((variable >> 8) & 0xFF)
+#define address_llsb(variable) (variable & 0xFF)
+
+#define address_hi(variable) ((variable >> 16) & 0xFF)
+#define address_mid(variable) ((variable >> 8) & 0xFF)
+#define address_lo(variable) (variable & 0xFF)
+
+#define msb(variable) ((variable >> 8) & 0xFF)
+#define lsb(variable) (variable & 0xFF)
+
+RGBA FG_COL_ = {.R = 0x00,.G = 0x00,.B = 0x00,.A = 0xff };
+RGBA BG_COL_ = {.R = 0xff,.G = 0xff,.B = 0xff,.A = 0xff };
+
+short int FG_COLOR, BG_COLOR;
+
+int RGB_24to16(int red, int grn, int blu)
+{
+ return (((red >> 3) << 11) | ((grn >> 2) << 5) | (blu >> 3));
+}
+
+int RGB_24to8(int red, int grn, int blu)
+{
+ return (((red >> 5) << 5) | ((grn >> 5) << 2) | (blu >> 6));
+}
+
+/****************************************/
+/*** hardware dependant functions ***/
+/****************************************/
+
+
+static void drv_D4D_receive_ACK()
+{
+ char ret[1];
+ while (drv_generic_serial_read(ret, sizeof(ret)) != 1)
+ usleep(1); /* loop should be unneccessary */
+ if (ret[0] == 0x15) {
+ error("NAK!");
+ } else if (ret[0] != 6) {
+ error("no ACK!");
+ }
+}
+
+
+static void drv_D4D_send_nowait(const char *data, const unsigned int len)
+{
+ if (len > 1 && data[0] >= 32 && data[0] < 127)
+ debug("drv_D4D_send_nowait('%c'", data[0]);
+ drv_generic_serial_write(data, len);
+}
+
+static void drv_D4D_send(const char *data, const unsigned int len)
+{
+ drv_D4D_send_nowait(data, len);
+ drv_D4D_receive_ACK();
+}
+
+static void drv_D4D_send_extra_nowait(const char *data, const unsigned int len, unsigned char pos1, unsigned char pos2,
+ unsigned char pos3, unsigned char pos4)
+{
+ /* possibly leave out bytes at posn for GOLDELOX protocol format */
+ if (EXTRA) {
+ drv_D4D_send_nowait(data, len);
+ } else {
+ unsigned int i, j = 0, lenNew = len;
+ char send[len];
+ for (i = 0; i < len; i++) {
+ if (i != pos1 && i != pos2 && i != pos3 && i != pos4) {
+ send[j++] = data[i];
+ } else {
+ lenNew--;
+ }
+ }
+ drv_D4D_send_nowait(send, lenNew);
+ }
+}
+
+static void drv_D4D_send_extra(const char *data, const unsigned int len, unsigned char pos1, unsigned char pos2,
+ unsigned char pos3, unsigned char pos4)
+{
+ drv_D4D_send_extra_nowait(data, len, pos1, pos2, pos3, pos4);
+ drv_D4D_receive_ACK();
+}
+
+
+static int drv_D4D_open(const char *section)
+{
+ info("drv_D4D_open()");
+ int fd, picaso = 0;
+ struct termios portset;
+ static speed_t Speed = 0;
+ fd = drv_generic_serial_open(section, Name, 0);
+ if (fd < 0)
+ return -1;
+ int flags;
+ flags = fcntl(fd, F_GETFL);
+ flags &= ~FNDELAY;
+ fcntl(fd, F_SETFL, flags);
+
+ cfg_number(section, "PICASO", 0, 1200, 4000000, &picaso);
+ if (picaso) {
+ info("switching to 9600 baud");
+ if (tcgetattr(fd, &portset) == -1) {
+ error("%s: tcgetattr failed: %s", Name, strerror(errno));
+ return -1;
+ }
+ cfsetispeed(&portset, B9600);
+ cfsetospeed(&portset, B9600);
+ if (tcsetattr(fd, TCSANOW, &portset) == -1) {
+ error("%s: tcsetattr failed: %s", Name, strerror(errno));
+ return -1;
+ }
+ }
+
+ char cmd[] = { 'U' };
+ drv_D4D_send(cmd, sizeof(cmd));
+ debug("2");
+
+ if (picaso) {
+ char baud[] = { 'Q', 0 };
+ switch (picaso) {
+ case 1200:
+ Speed = B1200;
+ baud[1] = 0x03;
+ break;
+ case 2400:
+ Speed = B2400;
+ baud[1] = 0x04;
+ break;
+ case 4800:
+ Speed = B4800;
+ baud[1] = 0x05;
+ break;
+ case 9600:
+ Speed = B9600;
+ baud[1] = 0x06;
+ break;
+ case 19200:
+ Speed = B19200;
+ baud[1] = 0x08;
+ break;
+ case 38400:
+ Speed = B38400;
+ baud[1] = 0x0A;
+ break;
+ case 57600:
+ Speed = B57600;
+ baud[1] = 0x0B;
+ break;
+ case 115200:
+ Speed = B115200;
+ baud[1] = 0x0D;
+ break;
+ default:
+ if (picaso >= 128000 && picaso < 256000) { /* FTDI: 129032 */
+ Speed = B38400;
+ baud[1] = 0x0E;
+ break;
+ } else if (picaso >= 256000) { /* FTDI: 282353 */
+ Speed = B38400;
+ baud[1] = 0x0F;
+ break;
+ }
+ error("%s: unsupported speed '%d' from %s", Name, picaso, cfg_source());
+ return -1;
+ }
+ drv_D4D_send_nowait(baud, sizeof(baud));
+ sleep(1);
+ debug("3");
+ cfsetispeed(&portset, Speed);
+ cfsetospeed(&portset, Speed);
+ if (picaso >= 128000) {
+ struct serial_struct sstruct;
+ if (ioctl(fd, TIOCGSERIAL, &sstruct) < 0) {
+ error("Error: could not get comm ioctl\n");
+ return -1;
+ }
+ sstruct.custom_divisor = sstruct.baud_base / picaso;
+ info("baud_base=%d; custom_divisor=%d -> effective baud:%d", sstruct.baud_base, sstruct.custom_divisor,
+ sstruct.baud_base / sstruct.custom_divisor);
+ sstruct.flags |= ASYNC_SPD_CUST;
+ if (ioctl(fd, TIOCSSERIAL, &sstruct) < 0) {
+ error("Error: could not set custom comm baud divisor\n");
+ return -1;
+ }
+ }
+ debug("4");
+ info("switching to %d baud", picaso);
+ if (tcsetattr(fd, /*TCSANOW*/ TCSAFLUSH /*TCSADRAIN*/, &portset) == -1) {
+ error("%s: tcsetattr failed: %s", Name, strerror(errno));
+ return -1;
+ }
+ debug("5");
+
+ }
+
+ return 0;
+}
+
+
+static int drv_D4D_close(void)
+{
+ drv_generic_serial_close();
+ return 0;
+}
+
+
+static void drv_D4D_clear(void)
+{
+ char cmd[] = { 'E' };
+ drv_D4D_send(cmd, sizeof(cmd));
+}
+
+
+static void drv_D4D_write(const int row, const int col, const char *data, int len)
+{
+ char out[len];
+ char user_char[len];
+ int user_x[len];
+ int user_y[len];
+ int i, k = 0;
+
+ if (!SECTOR) { /* font in ROM */
+
+ for (i = 0; i < len; i++) {
+ if (data[i] >= 31 && data[i] < CHAR0) {
+ out[i] = data[i];
+ } else if (data[i] == 'µ') { /* mu */
+ if (FONT == 2)
+ out[i] = 31; /* undocumented */
+ else if (FONT == 0)
+ out[i] = 'u';
+ else
+ out[i] = 127; /* undocumented */
+ } else {
+ out[i] = ' ';
+ if (data[i] == '°')
+ user_char[k] = 0; /* degree */
+ else
+ user_char[k] = data[i] - CHAR0;
+ user_x[k] = (col + i) * XRES;
+ user_y[k] = row * YRES;
+ k++;
+ }
+ }
+
+ char cmd[] = { 's', col, row, FONT, msb(FG_COLOR), lsb(FG_COLOR) }; /* normal chars */
+ drv_D4D_send_nowait(cmd, sizeof(cmd));
+ if (len > 256)
+ len = 256;
+ drv_D4D_send_nowait(out, len);
+ char cmdNull[1];
+ cmdNull[0] = 0;
+ drv_D4D_send(cmdNull, 1);
+
+ /* 1, 2, 3, 4, 5, 6
+ g, c,mx,lx,my,ly */
+ char cmd_user[] = { 'D', 0, 0, 0, 0, 0, 0, msb(FG_COLOR), lsb(FG_COLOR) }; /* user defined symbols */
+ for (i = 0; i < k; i++) {
+ cmd_user[2] = user_char[i];
+ cmd_user[3] = msb(user_x[i]);
+ cmd_user[4] = lsb(user_x[i]);
+ cmd_user[5] = msb(user_y[i]);
+ cmd_user[6] = lsb(user_y[i]);
+ drv_D4D_send_extra(cmd_user, sizeof(cmd_user), 1, 3, 5, -1);
+ }
+ } else { /* font on SD card */
+ int sec;
+ /* 2, 3, 4 , 5 , 6 , 7 , 8 , 9 , 10,11,12,13
+ mx,lx, my , ly , mw , lw , mh , lh , cm,hs,ms,ls */
+ char cmd_sd[] =
+ { '@', 'I', 0, 0, msb(row * YRES), lsb(row * YRES), msb(XRES), lsb(XRES), msb(YRES), lsb(YRES), 16, 0, 0,
+ 0
+ };
+ for (i = 0; i < len; i++) {
+ cmd_sd[2] = msb((col + i) * XRES);
+ cmd_sd[3] = lsb((col + i) * XRES);
+ sec = SECTOR + (unsigned char) data[i] * SECTOR_SIZE;
+ cmd_sd[11] = address_hi(sec);
+ cmd_sd[12] = address_mid(sec);
+ cmd_sd[13] = address_lo(sec);
+ drv_D4D_send_extra(cmd_sd, sizeof(cmd_sd), 2, 4, 6, 8);
+ }
+ }
+}
+
+
+static void drv_D4D_defchar(const int ascii, const unsigned char *matrix)
+{
+ info("drv_D4D_defchar");
+ char cmd[11];
+ int i;
+
+ cmd[0] = 'A';
+ cmd[1] = 0;
+ cmd[2] = ascii - CHAR0;
+
+ for (i = 0; i < 8; i++) {
+ cmd[i + 3] = *matrix++;
+ }
+ drv_D4D_send_extra(cmd, sizeof(cmd), 1, -1, -1, -1);
+}
+
+
+static void drv_D4D_blit(const int row, const int col, const int height, const int width)
+{
+ debug("drv_D4D_blit(%i, %i, %i, %i)", row, col, height, width);
+ int r, c;
+ RGBA rgb;
+ short int color;
+ char colorArray[width * height * MODE / 8];
+
+ /* optimization: single colour rectangle? */
+ /* commented out because obviously seldom used and expensive */
+ /*RGBA pixel0_0, pixel;
+ pixel0_0 = drv_generic_graphic_rgb(row, col);
+ char unicolor = 1;
+ for (r = row; (r < row + height) && unicolor; r++) {
+ for (c = col; (c < col + width) && unicolor; c++) {
+ pixel = drv_generic_graphic_rgb(r, c);
+ if (pixel0_0.R != pixel.R || pixel0_0.G != pixel.G || pixel0_0.B != pixel.B || pixel0_0.A != pixel.A)
+ unicolor = 0;
+ }
+ }
+
+ if (unicolor) {
+ color = RGB_24to16(pixel0_0.R, pixel0_0.G, pixel0_0.B);
+ unsigned char col2 = col + width - 1;
+ unsigned char row2 = row + height - 1;
+ char cmdRect[] =
+ { 'r', msb(col), lsb(col), msb(row), lsb(row), msb(col2), lsb(col2), msb(row2), lsb(row2), msb(color),
+ lsb(color)
+ };
+ debug("Rectangle(%i, %i, %i, %i, %i", col, row, col2, row2, color);
+ drv_D4D_send_extra(cmdRect, sizeof(cmdRect), 1, 3, 5, 7);
+ } else { */
+ char cmd[] =
+ { 'I', msb(col), lsb(col), msb(row), lsb(row), msb(width), lsb(width), msb(height), lsb(height), MODE };
+ int p = 0;
+ drv_D4D_send_extra_nowait(cmd, sizeof(cmd), 1, 3, 5, 7);
+ for (r = row; r < row + height; r++) {
+ for (c = col; c < col + width; c++) {
+ rgb = drv_generic_graphic_rgb(r, c);
+ if (MODE == 8) {
+ colorArray[p++] = RGB_24to8(rgb.R, rgb.G, rgb.B);
+ } else {
+ color = RGB_24to16(rgb.R, rgb.G, rgb.B);
+ colorArray[p++] = msb(color);
+ colorArray[p++] = lsb(color);
+ }
+ }
+ }
+ drv_D4D_send_nowait(colorArray, width * height * MODE / 8); /* doesn't werk if sent together (error: "partial write(/dev/tts/1): len=2 ret=1") */
+ drv_D4D_receive_ACK();
+ /*} */
+}
+
+
+static int drv_D4D_contrast(int contrast)
+{
+ if (contrast < 0)
+ contrast = 0;
+ if (contrast > 15)
+ contrast = 15;
+
+ char cmd[] = { 'Y', 2, contrast };
+ drv_D4D_send(cmd, sizeof(cmd));
+
+ /* CONTRAST_=contrast; */
+ return contrast;
+}
+
+
+static int drv_D4D_start(const char *section)
+{
+ info("drv_D4D_start()");
+ int contrast;
+ int xres_cfg = -1, yres_cfg = -1;
+ char *s;
+ char *color;
+
+ if (drv_D4D_open(section) < 0) {
+ return -1;
+ }
+
+ char getVersion[] = { 'V', 0 /*1 */ };
+ drv_D4D_send_nowait(getVersion, sizeof(getVersion));
+ char answer[5];
+ debug("reading answer[0]");
+ drv_generic_serial_read(answer + 0, 1); /* ,5: PICASO 0/1, Speed 9600: error: "partial read(/dev/ttyUSB0): len=5 ret=1" */
+ debug("reading answer[1]");
+ drv_generic_serial_read(answer + 1, 1);
+ debug("reading answer[2]");
+ drv_generic_serial_read(answer + 2, 1);
+ debug("reading answer[3]");
+ drv_generic_serial_read(answer + 3, 1);
+ debug("reading answer[4]");
+ drv_generic_serial_read(answer + 4, 1);
+ char *ids[] = { "uOLED", "uLCD", "uVGA" };
+ char *id;
+ if (answer[0] <= 2)
+ id = ids[(int) answer[0]];
+ else
+ id = "Unknown";
+ qprintf(NAME_, sizeof(NAME_), "%s H%u S%u", id, (int) answer[1], (int) answer[2]);
+ int res[2];
+ int i;
+ for (i = 0; i < 2; i++) {
+ switch ((unsigned char) answer[3 + i]) {
+ case 0x22:
+ res[i] = 220;
+ break;
+ case 0x28:
+ res[i] = 128;
+ break;
+ case 0x32:
+ res[i] = 320;
+ EXTRA = 1;
+ break;
+ case 0x60:
+ res[i] = 160;
+ break;
+ case 0x64:
+ res[i] = 64;
+ break;
+ case 0x76:
+ res[i] = 176;
+ break;
+ case 0x96:
+ res[i] = 96;
+ break;
+ case 0x24: /* undocumented? */
+ res[i] = 240;
+ break;
+ default:
+ error("Can't detect display dimensions! answer: {%d, %d, %d, %d, %d}", answer[0], answer[1], answer[2],
+ answer[3], answer[4]);
+ return -1;
+ }
+ }
+ DCOLS = res[0];
+ DROWS = res[1];
+
+
+ cfg_number(section, "Mode", 0, 0, 16, &MODE);
+
+ if (MODE == 0) {
+ s = cfg_get(section, "Font", NULL);
+ if (s == NULL || *s == '\0') {
+ error("%s: no '%s.Font' entry from %s", Name, section, cfg_source());
+ return -1;
+ }
+ if (sscanf(s, "%dx%d", &xres_cfg, &yres_cfg) < 1 || xres_cfg < 0) {
+ error("%s: bad %s.Font '%s' from %s", Name, section, s, cfg_source());
+ free(s);
+ return -1;
+ }
+
+ if (yres_cfg == -1) { /* font on SD card */
+ SECTOR = xres_cfg * 512;
+ char setAddress[] =
+ { '@', 'A', address_mmsb(SECTOR), address_mlsb(SECTOR), address_lmsb(SECTOR), address_llsb(SECTOR) };
+ drv_D4D_send(setAddress, sizeof(setAddress));
+ char answer1[1];
+ char readByte[] = { '@', 'r' };
+ drv_D4D_send_nowait(readByte, sizeof(readByte));
+ drv_generic_serial_read(answer1, sizeof(answer1));
+ XRES = answer1[0];
+ drv_D4D_send_nowait(readByte, sizeof(readByte));
+ drv_generic_serial_read(answer1, sizeof(answer1));
+ YRES = answer1[0];
+ SECTOR = xres_cfg + 1;
+ SECTOR_SIZE = ceil((double) XRES * (double) YRES * 2.0 / 512.0);
+ } else {
+ XRES = xres_cfg;
+ YRES = yres_cfg;
+ }
+
+
+ color = cfg_get(section, "foreground", "ffffff");
+ if (color2RGBA(color, &FG_COL_) < 0) {
+ error("%s: ignoring illegal color '%s'", Name, color);
+ }
+ if (color)
+ free(color);
+ FG_COLOR = RGB_24to16(FG_COL_.R, FG_COL_.G, FG_COL_.B);
+
+ color = cfg_get(section, "background", "000000");
+ if (color2RGBA(color, &BG_COL_) < 0) {
+ error("%s: ignoring illegal color '%s'", Name, color);
+ }
+ if (color)
+ free(color);
+ BG_COLOR = RGB_24to16(BG_COL_.R, BG_COL_.G, BG_COL_.B);
+
+ DCOLS = DCOLS / XRES;
+ DROWS = DROWS / YRES;
+ switch (yres_cfg) { /* font in ROM */
+ case 8:
+ switch (xres_cfg) {
+ case 6:
+ FONT = 0;
+ break;
+ case 8:
+ FONT = 1;
+ break;
+ default:
+ error("%s: unknown width in %s.Font '%s' from %s", Name, section, s, cfg_source());
+ return -1;
+ };
+ break;
+ case 12:
+ FONT = 2;
+ break;
+ case 16:
+ FONT = 3;
+ break;
+ case -1:
+ break;
+ default:
+ error("%s: unknown height in %s.Font '%s' from %s", Name, section, s, cfg_source());
+ return -1;
+ }
+ }
+
+ info("XRES=%i, YRES=%i; DCOLS=%i, DROWS=%d; FONT=%d, SECTOR=%i, SECTOR_SIZE=%i\n", XRES, YRES, DCOLS, DROWS,
+ FONT, SECTOR, SECTOR_SIZE);
+
+
+
+ cfg_number(section, "PowerCycle", 0, 0, 1, &POWERCYCLE);
+ if (POWERCYCLE) {
+ char powerOn[] = { 'Y', 3, 1 };
+ drv_D4D_send(powerOn, sizeof(powerOn));
+
+ /*char background[] = {'B', msb(BG_COLOR), lsb(BG_COLOR)};
+ drv_D4D_send(background, sizeof(background)); */
+ }
+
+ char opaque[] = { 'O', 1 };
+ drv_D4D_send(opaque, sizeof(opaque));
+
+ char penSize[] = { 'p', 0 };
+ drv_D4D_send(penSize, sizeof(penSize));
+
+
+ if (!MODE) {
+ unsigned char buffer[] = { 0x18, 0x24, 0x24, 0x18, 0, 0, 0, 0 }; /* degree */
+ drv_D4D_defchar(CHAR0, buffer);
+ CHARS--;
+ CHAR0++;
+ }
+
+ if (cfg_number(section, "Contrast", 0, 0, 255, &contrast) > 0) {
+ drv_D4D_contrast(contrast);
+ }
+
+ drv_D4D_clear();
+
+ return 0;
+}
+
+
+int drv_D4D_text_draw(WIDGET * W)
+{
+ short int FG_COLOR_old = FG_COLOR, BG_COLOR_old = BG_COLOR;
+ int ret;
+ RGBA fg, bg;
+ fg = W->fg_valid ? W->fg_color : FG_COL_;
+ bg = W->bg_valid ? W->bg_color : BG_COL_;
+ FG_COLOR = RGB_24to16(fg.R, fg.G, fg.B);
+ BG_COLOR = RGB_24to16(bg.R, bg.G, bg.B);
+ ret = drv_generic_text_draw(W);
+ FG_COLOR = FG_COLOR_old;
+ BG_COLOR = BG_COLOR_old;
+ return ret;
+}
+
+
+int lastVal[40 * 40 * 2]; /* Fixme: MAX_WIDGETS*2 */
+int drv_D4D_bar_draw(WIDGET * W)
+{
+ /* optimizations:
+ - draw filled rectangles instead of user defined bar characters
+ - cache last values */
+
+ WIDGET_BAR *Bar = W->data;
+ int row, col, len, res, max, val1, val2;
+ DIRECTION dir;
+#if 0
+ STYLE style; /* Fixme: missing style support */
+#endif
+
+ row = W->row;
+ col = W->col;
+ dir = Bar->direction;
+#if 0
+ style = Bar->style; /* Fixme: missing style support */
+#endif
+ len = Bar->length;
+
+ res = dir & (DIR_EAST | DIR_WEST) ? XRES : YRES;
+ max = len * res;
+ val1 = Bar->val1 * (double) (max);
+ val2 = Bar->val2 * (double) (max);
+
+ if (val1 < 1)
+ val1 = 1;
+ else if (val1 > max)
+ val1 = max;
+
+ if (val2 < 1)
+ val2 = 1;
+ else if (val2 > max)
+ val2 = max;
+
+ short int FG_COLOR_old = FG_COLOR, BG_COLOR_old = BG_COLOR;
+ RGBA fg, bg;
+ fg = W->fg_valid ? W->fg_color : FG_COL_;
+ bg = W->bg_valid ? W->bg_color : BG_COL_;
+ FG_COLOR = RGB_24to16(fg.R, fg.G, fg.B);
+ BG_COLOR = RGB_24to16(bg.R, bg.G, bg.B);
+
+ char cmd[11];
+ cmd[0] = 'r';
+ int val[2];
+ val[0] = val1;
+ val[1] = val2;
+ int i, vals, x1, x2;
+ int lastValIndex0 = row * DCOLS + col;
+ int cells = DROWS * DCOLS;
+ if (val1 == val2 && lastVal[lastValIndex0] == lastVal[lastValIndex0 + cells])
+ vals = 1;
+ else
+ vals = 2;
+ for (i = 0; i < vals; i++) {
+ int lastValIndex = lastValIndex0 + cells * (i /*+1 */ );
+ int y1 = row * YRES + (YRES / 2) * i;
+ cmd[3] = msb(y1);
+ cmd[4] = lsb(y1);
+ int y2 = y1 + YRES / vals - 1;
+ cmd[7] = msb(y2);
+ cmd[8] = lsb(y2);
+ if (val[i] > lastVal[lastValIndex]) {
+ x1 = col * XRES + lastVal[lastValIndex];
+ cmd[1] = msb(x1);
+ cmd[2] = lsb(x1);
+ x2 = x1 + val[i] - lastVal[lastValIndex] - 1;
+ cmd[5] = msb(x2);
+ cmd[6] = lsb(x2);
+ cmd[9] = msb(FG_COLOR);
+ cmd[10] = lsb(FG_COLOR);
+ drv_D4D_send_extra(cmd, sizeof(cmd), 1, 3, 5, 7);
+ } else if (val[i] < lastVal[lastValIndex]) {
+ x1 = col * XRES + val[i] - 1 + 1;
+ cmd[1] = msb(x1);
+ cmd[2] = lsb(x1);
+ x2 = x1 + lastVal[lastValIndex] - val[i];
+ cmd[5] = msb(x2);
+ cmd[6] = lsb(x2);
+ cmd[9] = msb(BG_COLOR);
+ cmd[10] = lsb(BG_COLOR);
+ drv_D4D_send_extra(cmd, sizeof(cmd), 1, 3, 5, 7);
+ } else {
+ /* do nothing */
+ }
+ lastVal[lastValIndex] = val[i];
+ }
+
+ FG_COLOR = FG_COLOR_old;
+ BG_COLOR = BG_COLOR_old;
+ return 0;
+}
+
+
+
+
+
+/****************************************/
+/*** plugins ***/
+/****************************************/
+
+static void plugin_contrast(RESULT * result, RESULT * arg1)
+{
+ double contrast;
+
+ contrast = drv_D4D_contrast(R2N(arg1));
+ SetResult(&result, R_NUMBER, &contrast);
+}
+
+
+/****************************************/
+/*** widget callbacks ***/
+/****************************************/
+
+
+/* using drv_generic_text_draw(W) */
+/* using drv_generic_text_icon_draw(W) */
+/* using drv_generic_text_bar_draw(W) */
+/* using drv_generic_gpio_draw(W) */
+
+
+/****************************************/
+/*** exported functions ***/
+/****************************************/
+
+
+int drv_D4D_list(void)
+{
+ printf("4D Systems Display Graphics Modules");
+ return 0;
+}
+
+
+int drv_D4D_init(const char *section, const int quiet)
+{
+ info("drv_D4D_init()");
+ WIDGET_CLASS wc;
+ int ret;
+
+ info("%s: %s", Name, "$Rev: 1163 $");
+
+ if ((ret = drv_D4D_start(section)) != 0)
+ return ret;
+
+ if (EXTRA)
+ CHARS = 64;
+ else
+ CHARS = 32;
+ CHAR0 = 128;
+ GOTO_COST = 7;
+
+ if (MODE) {
+ drv_generic_graphic_real_blit = drv_D4D_blit;
+ } else {
+ drv_generic_text_real_write = drv_D4D_write;
+ drv_generic_text_real_defchar = drv_D4D_defchar;
+ }
+
+
+
+
+ if (!quiet) {
+ char buffer[40];
+ qprintf(buffer, sizeof(buffer), "%s %dx%d", NAME_, DCOLS, DROWS);
+ if (MODE) {
+ if (drv_generic_graphic_greet(buffer, "www.4dsystems.com.au")) {
+ sleep(3);
+ drv_generic_graphic_clear();
+ }
+ } else {
+ if (drv_generic_text_greet(buffer, "www.4dsystems.com.au")) {
+ sleep(3);
+ drv_D4D_clear();
+ }
+ }
+ }
+
+
+ if (MODE) {
+ if ((ret = drv_generic_graphic_init(section, Name)) != 0)
+ return ret;
+ } else {
+
+ if ((ret = drv_generic_text_init(section, Name)) != 0)
+ return ret;
+
+ if ((ret = drv_generic_text_icon_init()) != 0)
+ return ret;
+
+ if ((ret = drv_generic_text_bar_init(0)) != 0)
+ return ret;
+
+ drv_generic_text_bar_add_segment(0, 0, 255, 32);
+
+
+ wc = Widget_Text;
+ wc.draw = drv_D4D_text_draw;
+ widget_register(&wc);
+
+ wc = Widget_Icon;
+ wc.draw = drv_generic_text_icon_draw;
+ widget_register(&wc);
+
+ wc = Widget_Bar;
+ wc.draw = drv_D4D_bar_draw;
+ widget_register(&wc);
+
+ }
+
+ AddFunction("LCD::contrast", 1, plugin_contrast);
+
+ return 0;
+}
+
+
+int drv_D4D_quit(const int quiet)
+{
+ info("drv_D4D_quit()");
+
+ info("%s: shutting down.", Name);
+
+ if (MODE == 0)
+ drv_generic_text_quit();
+
+
+ if (POWERCYCLE) {
+ drv_D4D_clear();
+ }
+
+ if (!quiet) {
+ if (MODE)
+ drv_generic_graphic_greet("goodbye!", NULL);
+ else
+ drv_generic_text_greet("goodbye!", NULL);
+ }
+
+ /* fade */
+ /*int i;
+ for(i=CONTRAST_;i>=0;i--) {
+ drv_D4D_contrast(i);
+ usleep(1000);
+ } */
+
+ if (MODE)
+ drv_generic_graphic_quit();
+
+ if (POWERCYCLE) {
+ char powerDown[] = { 'Y', 3, 0 };
+ drv_D4D_send(powerDown, sizeof(powerDown));
+ }
+
+ if (EXTRA) {
+ info("switching to 9600 baud");
+ char baud[] = { 'Q', 0x06 };
+ drv_D4D_send_nowait(baud, sizeof(baud));
+ }
+
+ info("closing connection");
+ drv_D4D_close();
+
+ return (0);
+}
+
+
+
+DRIVER drv_D4D = {
+ .name = Name,
+ .list = drv_D4D_list,
+ .init = drv_D4D_init,
+ .quit = drv_D4D_quit,
+};
diff --git a/drv_EA232graphic.c b/drv_EA232graphic.c
new file mode 100644
index 0000000..bec5fc9
--- /dev/null
+++ b/drv_EA232graphic.c
@@ -0,0 +1,618 @@
+/* $Id: drv_EA232graphic.c 1172 2012-02-10 16:04:36Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/drv_EA232graphic.c $
+ *
+ * Driver for Electronic Assembly serial graphic display
+ *
+ * Copyright (C) 2012 Robert Resch <fli4l@robert.reschpara.de>
+ * Copyright (C) 2007 Stefan Gmeiner <stefangmeiner@solnet.ch>
+ * Copyright (C) 2005 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2005, 2006, 2007 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ * Electronic Assembly RS232 Graphic Displays
+ *
+ * This driver supports some of the Electronic Assembly serial graphic displays. Although
+ * most of this display support higher level operation like text and graphic command, non of
+ * these are used. Instead the lcd4linux graphic routines creates the graphic which is then
+ * transferd to the display.
+ *
+ * FIXME: Some display have addition features such as GPI which are not yet implemented.
+ *
+ * Display Protocol Output Contrast
+ * ============================================
+ * GE120-5NV24 1 8 yes
+ * GE128-6N3V24 1 8 no
+ * GE128-6N9V24 2 0 yes
+ * GE128-7KV24 3 8 no
+ * GE240-6KV24 3 8 no
+ * GE240-6KCV24 3 8 no
+ * GE240-7KV24 3 8 no
+ * GE240-7KLWV24 3 8 no
+ * GE240-6KLWV24 3 8 no
+ * KIT120-5 4 5 no
+ * KIT129-6 4 8 no
+ * KIT160-6 2 8 no
+ * KIT160-7 2 8 no
+ * KIT240-6 2 8 no
+ * KIT240-7 2 8 no
+ * KIT320-8 2 8 no
+ *
+ * Supported protocol commands:
+ *
+ * Clear
+ * Protocol Display Set Output Set Contrast Bitmap Orientation
+ * =======================================================================================
+ * 1 DL Y(0..7)(0..1) K(0..20) U(x)(y)(w)(h)(...) Vertical
+ * 2 <ESC>DL <ESC>YW... <ESC>DK(0..63) <ESC>UL(x)(y)(w)(h)(...) Horizontal
+ * 3 DL Y(0..7)(0..1) -- U(x)(y)(w)(h)(...) Horizontal
+ * 4 <ESC>DL <ESC>YW... -- <ESC>UL(x)(y)(w)(h)(...) Vertical
+ *
+ * Bitmap orientation:
+ *
+ * Vertical: Byte-No.
+ * 123456789....
+ * Bit 0 *********
+ * Bit 1 *********
+ * Bit 2 *********
+ * Bit 3 *********
+ * Bit 4 *********
+ * Bit 5 *********
+ * Bit 6 *********
+ * Bit 7 *********
+ *
+ * Horizontal: Bit-No.
+ * 76543210
+ * Byte 0 ********
+ * Byte 1 ********
+ * Byte 3 ********
+ * ...
+ *
+ *
+ */
+
+/*
+ *
+ * exported fuctions:
+ *
+ * struct DRIVER drv_EA232graphic
+ *
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <sys/time.h>
+#include <unistd.h>
+
+#include "debug.h"
+#include "cfg.h"
+#include "qprintf.h"
+#include "udelay.h"
+#include "plugin.h"
+#include "widget.h"
+#include "widget_text.h"
+#include "widget_icon.h"
+#include "widget_bar.h"
+#include "drv.h"
+
+/* graphic display */
+#include "drv_generic_graphic.h"
+
+/* serial port */
+#include "drv_generic_serial.h"
+
+/* GPO */
+#include "drv_generic_gpio.h"
+
+
+
+#define ESC ((char)27)
+#define MSB_BYTE 0x80
+#define LSB_BYTE 0x01
+
+static char Name[] = "EA232graphic";
+
+typedef struct {
+ char *name;
+ int columns;
+ int rows;
+ int max_contrast;
+ int default_contrast;
+ int gpo;
+ int protocol;
+} MODEL;
+
+static MODEL Models[] = {
+ /* Protocol 1 models */
+ {"GE120-5NV24", 120, 32, 20, 8, 8, 1},
+ {"GE128-6N3V24", 128, 64, 0, 0, 8, 1},
+
+ /* Protocol 2 models */
+ {"GE128-6N9V24", 128, 64, 63, 40, 0, 2},
+ {"KIT160-6", 160, 80, 0, 0, 8, 2},
+ {"KIT160-7", 160, 128, 0, 0, 8, 2},
+ {"KIT240-6", 240, 64, 0, 0, 8, 2},
+ {"KIT240-7", 240, 128, 0, 0, 8, 2},
+ {"KIT320-8", 320, 240, 0, 0, 8, 2},
+
+ /* Protocol 3 models */
+ {"GE128-7KV24", 128, 128, 0, 0, 8, 3},
+ {"GE240-6KV24", 240, 64, 0, 0, 8, 3},
+ {"GE240-6KCV24", 240, 64, 0, 0, 8, 3},
+ {"GE240-7KV24", 240, 128, 0, 0, 8, 3},
+ {"GE240-7KLWV24", 240, 128, 0, 0, 8, 3},
+ {"GE240-6KLWV24", 240, 64, 0, 0, 8, 3},
+
+ /* Protocol 4 models */
+ {"KIT120-5", 120, 32, 0, 0, 5, 4},
+ {"KIT129-6", 128, 64, 0, 0, 8, 4},
+
+ {NULL, 0, 0, 0, 0, 0, 0}
+};
+
+static MODEL *Model;
+
+
+/****************************************/
+/*** hardware dependant functions ***/
+/****************************************/
+
+
+static int drv_EA232graphic_open(const char *section)
+{
+ /* open serial port */
+ /* don't mind about device, speed and stuff, this function will take care of */
+ if (drv_generic_serial_open_handshake(section, Name, 0) < 0)
+ return -1;
+
+ return 0;
+}
+
+
+static int drv_EA232graphic_close(void)
+{
+ drv_generic_serial_close();
+
+ return 0;
+}
+
+
+/* write data to the display */
+static void drv_EA232graphic_send(const char *data, const int len)
+{
+ drv_generic_serial_write_rts(data, len);
+}
+
+
+/* delete Display */
+static void drv_EA232graphic_clear_display()
+{
+ char cmd[4];
+
+ switch (Model->protocol) {
+ case 1:
+ case 3:
+ /* Clear Display */
+ cmd[0] = 'D';
+ cmd[1] = 'L';
+ drv_EA232graphic_send(cmd, 2);
+ break;
+ case 2:
+ /* Clear Display */
+ cmd[0] = ESC;
+ cmd[1] = 'D';
+ cmd[2] = 'L';
+ drv_EA232graphic_send(cmd, 3);
+ usleep(500000);
+ /* Disable Cursor */
+ cmd[0] = ESC;
+ cmd[1] = 'Q';
+ cmd[2] = 'C';
+ cmd[3] = '0';
+ drv_EA232graphic_send(cmd, 4);
+ break;
+ case 4:
+ /* Set all GPIO to Output */
+ cmd[0] = ESC;
+ cmd[1] = 'Y';
+ cmd[2] = 'M';
+ cmd[3] = 8;
+ drv_EA232graphic_send(cmd, 4);
+ /* Clear Display */
+ cmd[0] = ESC;
+ cmd[1] = 'D';
+ cmd[2] = 'L';
+ drv_EA232graphic_send(cmd, 3);
+ usleep(500000);
+ /* Disable Cursor */
+ cmd[0] = ESC;
+ cmd[1] = 'Q';
+ cmd[2] = 'C';
+ cmd[3] = '0';
+ drv_EA232graphic_send(cmd, 4);
+ break;
+ default:
+ error("%s: undefined protocol type", Name);
+ return;
+ }
+}
+
+
+
+/* copy framebuffer to display */
+static void drv_EA232graphic_blit(const int row, const int col, const int height, const int width)
+{
+
+ int r, c, l, p, d;
+ char *cmd;
+
+ /* calculate length of command */
+ l = 0;
+ switch (Model->protocol) {
+ case 1:
+ case 4:
+ l = ((height + 7) / 8) * width;
+ break;
+ case 2:
+ case 3:
+ l = ((width + 7) / 8) * height;
+ break;
+ default:
+ error("%s: undefined protocol type", Name);
+ return;
+ }
+
+ /* add maximum length of command header */
+ cmd = (char *) malloc(l + 10);
+ if (cmd == NULL) {
+ error("%s: allocation of buffer failed: %s", Name, strerror(errno));
+ return;
+ }
+ p = 0;
+
+ /* write command header */
+ switch (Model->protocol) {
+ case 1:
+ case 3:
+ cmd[p++] = 'U';
+ cmd[p++] = col;
+ cmd[p++] = row;
+ cmd[p++] = width;
+ cmd[p++] = height;
+ break;
+ case 2:
+ case 4:
+ cmd[p++] = ESC;
+ cmd[p++] = 'U';
+ cmd[p++] = 'L';
+ cmd[p++] = col;
+ cmd[p++] = row;
+ cmd[p++] = width;
+ cmd[p++] = height;
+ break;
+ default:
+ error("%s: undefined protocol type", Name);
+ free(cmd);
+ return;
+ }
+
+ /* clear all pixels */
+ memset(cmd + p, 0, l);
+
+ /* set pixels */
+ switch (Model->protocol) {
+ case 1:
+ case 4:
+ for (r = 0; r < height; r++) {
+ for (c = 0; c < width; c++) {
+ if (drv_generic_graphic_black(r + row, c + col)) {
+ cmd[(r / 8) * width + c + p] |= (LSB_BYTE << (r % 8));
+ }
+ }
+ }
+ break;
+ case 2:
+ d = ((width + 7) / 8);
+ for (r = 0; r < height; r++) {
+ for (c = 0; c < width; c++) {
+ if (drv_generic_graphic_black(r + row, c + col)) {
+ cmd[(c / 8) + (d * r) + p] |= (MSB_BYTE >> (c % 8));
+ }
+ }
+ }
+ break;
+ case 3:
+ for (c = 0; c < width; c++) {
+ for (r = 0; r < height; r++) {
+ if (drv_generic_graphic_black(r + row, c + col)) {
+ cmd[(c / 8) * height + r + p] |= (MSB_BYTE >> (c % 8));
+ }
+ }
+ }
+ break;
+ default:
+ error("%s: undefined protocol type", Name);
+ free(cmd);
+ return;
+ }
+
+ drv_EA232graphic_send(cmd, p + l);
+
+ free(cmd);
+}
+
+
+static int drv_EA232graphic_GPO(const int num, const int val)
+{
+ char cmd[5];
+
+ if (Model->gpo == 0) {
+ error("%s: GPO not supported on this model.", Name);
+ return -1;
+ }
+
+
+ if (Model->gpo < num) {
+ error("%s: GPO %d is not available.", Name, num);
+ return -1;
+ }
+
+ switch (Model->protocol) {
+ case 1:
+ case 3:
+ cmd[0] = 'Y';
+ cmd[1] = num;
+ cmd[2] = (val > 0) ? 1 : 0;
+ drv_EA232graphic_send(cmd, 3);
+ break;
+ case 2:
+ case 4:
+ cmd[0] = ESC;
+ cmd[1] = 'Y';
+ cmd[2] = 'W';
+ cmd[3] = num + 1;
+ cmd[4] = (val > 0) ? 1 : 0;
+ drv_EA232graphic_send(cmd, 5);
+ break;
+ }
+
+ return 0;
+}
+
+
+/* adjust contast */
+static int drv_EA232graphic_contrast(int contrast)
+{
+ char cmd[4];
+
+ if (Model->max_contrast == 0) {
+ error("%s: contrast setting not support by model", Name);
+ return -1;
+ }
+
+ /* adjust limits according to the display */
+ if (contrast < 0)
+ contrast = 0;
+ if (contrast > Model->max_contrast)
+ contrast = Model->max_contrast;
+
+
+ switch (Model->protocol) {
+ case 1:
+ cmd[0] = 'K';
+ cmd[1] = contrast;
+ drv_EA232graphic_send(cmd, 2);
+ break;
+ case 2:
+ cmd[0] = ESC;
+ cmd[1] = 'D';
+ cmd[2] = 'K';
+ cmd[3] = contrast;
+ drv_EA232graphic_send(cmd, 4);
+ break;
+ default:
+ error("%s: undefined protocol type", Name);
+ return -1;
+ }
+
+ return contrast;
+}
+
+
+/* start graphic display */
+static int drv_EA232graphic_start(const char *section)
+{
+ char *s;
+ int contrast;
+ int i;
+
+ /* read model from configuration */
+ s = cfg_get(section, "Model", NULL);
+ if (s == NULL || *s == '\0') {
+ error("%s: no '%s.Model' entry from %s", Name, section, cfg_source());
+ return -1;
+ }
+
+ for (i = 0; Models[i].name != NULL; i++) {
+ if (strcasecmp(Models[i].name, s) == 0)
+ break;
+ }
+ if (!Models[i].name) {
+ error("%s: %s.Model '%s' is unknown from %s", Name, section, s, cfg_source());
+ free(s);
+ return -1;
+ }
+ Model = &Models[i];
+ info("%s: using model '%s'", Name, Model->name);
+ free(s);
+
+ /* read display size from model configuration */
+ DROWS = Model->rows;
+ DCOLS = Model->columns;
+
+ /* set number of GPO's from model */
+ GPOS = Model->gpo;
+
+ /* read font size from configuration */
+ s = cfg_get(section, "Font", "6x8");
+ if (s == NULL || *s == '\0') {
+ error("%s: no '%s.Font' entry from %s", Name, section, cfg_source());
+ return -1;
+ }
+
+ XRES = -1;
+ YRES = -1;
+ if (sscanf(s, "%dx%d", &XRES, &YRES) != 2 || XRES < 1 || YRES < 1) {
+ error("%s: bad Font '%s' from %s", Name, s, cfg_source());
+ free(s);
+ return -1;
+ }
+ free(s);
+
+ /* open communication with the display */
+ if (drv_EA232graphic_open(section) < 0) {
+ return -1;
+ }
+
+ /* reset & initialize display */
+ drv_EA232graphic_clear_display();
+
+ if (cfg_number(section, "Contrast", Model->default_contrast, 0, Model->max_contrast, &contrast) > 0) {
+ drv_EA232graphic_contrast(contrast);
+ }
+
+ return 0;
+}
+
+
+/****************************************/
+/*** plugins ***/
+/****************************************/
+
+static void plugin_contrast(RESULT * result, RESULT * arg1)
+{
+ double contrast;
+
+ contrast = drv_EA232graphic_contrast(R2N(arg1));
+ SetResult(&result, R_NUMBER, &contrast);
+}
+
+
+/****************************************/
+/*** widget callbacks ***/
+/****************************************/
+
+
+/* using drv_generic_text_draw(W) */
+/* using drv_generic_text_icon_draw(W) */
+/* using drv_generic_text_bar_draw(W) */
+/* using drv_generic_gpio_draw(W) */
+
+
+/****************************************/
+/*** exported functions ***/
+/****************************************/
+
+
+/* list models */
+int drv_EA232graphic_list(void)
+{
+ int i;
+
+ for (i = 0; Models[i].name; i++) {
+ printf("%s ", Models[i].name);
+ }
+
+ return 0;
+}
+
+
+/* initialize driver & display */
+int drv_EA232graphic_init(const char *section, const int quiet)
+{
+ int ret;
+
+ /* real worker functions */
+ drv_generic_graphic_real_blit = drv_EA232graphic_blit;
+ drv_generic_gpio_real_set = drv_EA232graphic_GPO;
+
+ /* start display */
+ if ((ret = drv_EA232graphic_start(section)) != 0)
+ return ret;
+
+ /* initialize generic graphic driver */
+ if ((ret = drv_generic_graphic_init(section, Name)) != 0)
+ return ret;
+
+ /* initialize GPO */
+ if (Model->gpo > 0 && (ret = drv_generic_gpio_init(section, Name)) != 0)
+ return ret;
+
+ if (!quiet) {
+ char buffer[40];
+ qprintf(buffer, sizeof(buffer), "%s %dx%d", Name, DCOLS, DROWS);
+ if (drv_generic_graphic_greet(buffer, NULL)) {
+ sleep(3);
+ drv_generic_graphic_clear();
+ }
+ }
+
+ /* register plugins */
+ AddFunction("LCD::contrast", 1, plugin_contrast);
+
+ return 0;
+}
+
+/* close driver & display */
+int drv_EA232graphic_quit(const int quiet)
+{
+
+ info("%s: shutting down.", Name);
+
+ /* clear display */
+ drv_generic_graphic_clear();
+
+ /* say goodbye... */
+ if (!quiet) {
+ drv_generic_graphic_greet("goodbye!", NULL);
+ }
+
+ drv_generic_graphic_quit();
+
+ if (Model->gpo > 0)
+ drv_generic_gpio_quit();
+
+ debug("%s: closing connection", Name);
+ drv_EA232graphic_close();
+
+ return (0);
+}
+
+/* use this one for a graphic display */
+DRIVER drv_EA232graphic = {
+ .name = Name,
+ .list = drv_EA232graphic_list,
+ .init = drv_EA232graphic_init,
+ .quit = drv_EA232graphic_quit,
+};
diff --git a/drv_EFN.c b/drv_EFN.c
new file mode 100644
index 0000000..69a4574
--- /dev/null
+++ b/drv_EFN.c
@@ -0,0 +1,400 @@
+/* $Id: drv_Sample.c 773 2007-02-25 12:39:09Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/branches/0.10.1/drv_Sample.c $
+ *
+ * lcd4linux driver for EFN LED modules (manufacturer: COMFILE/South Korea)
+ * connected to the ethernet to serial converter EUG 100 (manufacturer ELV/
+ * Germany)
+ *
+ * Up to 256 EFN LED modules listen on a serial bus (9600 BAUD, 1 stop bit,
+ * no parity) and are controlled by a 3 byte protocol:
+ * Byte 1: 0xff
+ * Byte 2: <module address>
+ * Byte 3: <Ascii value of character to be diplayed>
+ * The module address of each EFN LED module is set hy solder bridges.
+ * The driver expects the EFN LED modules to be configured starting
+ * from address 1. The EFN LED module set to address 1 is the right
+ * most module.
+ *
+ * The EUG 100 is an ethernet to seriell converter. The IP address
+ * can be set by dhcp. It listens on ports 1000 (data) and 1001
+ * (configuration). Data received on port 1000 is sent onto the serial bus,
+ * while data sent to configuration port sets format of the EUG 100's
+ * serial interface.
+ * Due to a bug in the firmware, the transmission is interrupted if '\0' (0x00)
+ * is received on port 1000. Consequently, none of the EFN LED modules shall
+ * be set to address 0.
+ *
+ * Copyright (C) 2010 Tilman Glötzner <tilmanglotzner@hotmail.com>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+* You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ *
+ * exported fuctions:
+ *
+ * struct DRIVER drv_EFN
+ *
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <strings.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <netdb.h>
+
+#include "debug.h"
+#include "cfg.h"
+#include "qprintf.h"
+#include "udelay.h"
+#include "plugin.h"
+#include "widget.h"
+#include "widget_text.h"
+#include "widget_icon.h"
+#include "widget_bar.h"
+#include "drv.h"
+
+/* text mode display */
+#include "drv_generic_text.h"
+
+
+
+static char Name[] = "EFN";
+
+char *Host;
+int Port;
+int DataSocket;
+
+static void drv_EFN_clear(void);
+
+/****************************************/
+/*** hardware dependant functions ***/
+/****************************************/
+
+static int drv_EFN_open(const char __attribute__ ((unused)) * section)
+{
+ int sockfd_conf, portno_conf, n;
+ struct sockaddr_in serv_addr;
+ struct sockaddr_in conf_addr;
+ struct hostent *server;
+ char buffer[5];
+
+ /* open tcp sockets to config port to EUG 100 t0 set serial parameter */
+ /* 9600 BAUD; no parity; 1 stop bit */
+ // socket to config EUG
+ portno_conf = Port + 1;
+ sockfd_conf = socket(AF_INET, SOCK_STREAM, 0);
+ if (sockfd_conf < 0) {
+ error("ERROR opening config socket");
+ return -1;
+ }
+ // resolve DNS name of EFN server (= EUG 100)
+ server = gethostbyname(Host);
+ if (server == NULL) {
+ error("ERROR, no such host\n");
+ return -1;
+ }
+ // socket addr for config socket
+ bzero((char *) &conf_addr, sizeof(struct sockaddr_in));
+ conf_addr.sin_family = AF_INET;
+ bcopy((char *) server->h_addr, (char *) &conf_addr.sin_addr.s_addr, server->h_length);
+ conf_addr.sin_port = htons(portno_conf);
+
+ // open config socket
+ if (connect(sockfd_conf, (struct sockaddr *) &conf_addr, sizeof(struct sockaddr_in)) < 0) {
+ error("ERROR connecting to config port");
+ return -1;
+ }
+ // sent config message
+
+ bzero(buffer, 5);
+ buffer[0] = '4';
+ buffer[1] = '0';
+ buffer[2] = '1';
+
+
+ n = write(sockfd_conf, buffer, 3);
+ if (n < 0) {
+ error("ERROR writing to config socket");
+ close(sockfd_conf);
+ return -1;
+ }
+ close(sockfd_conf);
+
+ // open data socket
+
+ DataSocket = socket(AF_INET, SOCK_STREAM, 0);
+ if (DataSocket < 0) {
+ error("ERROR opening data socket");
+ return -1;
+ }
+ // socket addr for data socket
+ bzero((char *) &serv_addr, sizeof(struct sockaddr_in));
+ serv_addr.sin_family = AF_INET;
+ bcopy((char *) server->h_addr, (char *) &serv_addr.sin_addr.s_addr, server->h_length);
+ serv_addr.sin_port = htons(Port);
+
+ if (connect(DataSocket, (struct sockaddr *) &serv_addr, sizeof(struct sockaddr_in)) < 0) {
+ error("ERROR connecting to data socket");
+ return -1;
+ }
+ return 0;
+}
+
+
+static int drv_EFN_close(void)
+{
+ /* close whatever port you've opened */
+ drv_EFN_clear();
+ close(DataSocket);
+ return 0;
+}
+
+
+/* dummy function that sends something to the display */
+static void drv_EFN_send(const char *data, const unsigned int len)
+{
+ int n;
+
+ // transport command string to EUG 100
+ n = write(DataSocket, data, len);
+
+ if (n < 0) {
+ error("%s:drv_EFN_send: Failed to write to data socket\n", Name);
+ }
+}
+
+
+/* text mode displays only */
+static void drv_EFN_clear(void)
+{
+ char *cmd;
+ int max_char, max_cmd, k;
+
+ max_char = DROWS * DCOLS;
+ max_cmd = 3 * max_char; // each EFN module expects 3 bytes
+
+ if ((cmd = malloc(max_cmd)) == NULL) {
+ error("%s : Failed to allocate memory in drv_Sample_write\n", Name);
+ // return -1;
+ } else {
+ /* do whatever is necessary to clear the display */
+ for (k = 0; k < max_char; k++) {
+ cmd[(3 * k) + 0] = 0xff;
+ cmd[(3 * k) + 1] = k + 1;
+ cmd[(3 * k) + 2] = ' ';
+ }
+ drv_EFN_send(cmd, max_cmd);
+ drv_EFN_send(cmd, max_cmd);
+ free(cmd);
+ //return 0;
+ }
+}
+
+
+/* text mode displays only */
+static void drv_EFN_write(const int row, const int col, const char *data, int len)
+{
+ char *cmd;
+ int offset, i, k, max_char, max_cmd;
+
+ max_char = DROWS * DCOLS;
+ max_cmd = 3 * max_char; // each LED blocks expects a 3 byte sequence
+
+
+ if ((cmd = (char *) malloc(max_cmd)) == NULL) {
+ error("%s : Failed to allocate memory in drv_Sample_write\n", Name);
+ //return -1;
+ } else {
+ /* do the cursor positioning here */
+
+ offset = ((row) * DCOLS) + col;
+
+ for (i = max_char - offset, k = 0; ((i > 0) && (k < len)); i--, k++) {
+ cmd[(3 * k) + 0] = 0xff;
+ cmd[(3 * k) + 1] = i;
+ cmd[(3 * k) + 2] = data[k];
+ }
+
+ /* send string to the display twice (to make transmission
+ * reliable) */
+ drv_EFN_send(cmd, 3 * (k));
+ drv_EFN_send(cmd, 3 * (k));
+
+ free(cmd);
+ // return 0;
+ }
+}
+
+static void drv_EFN_defchar(const int __attribute__ ((unused)) ascii, const unsigned char
+ __attribute__ ((unused)) * matrix)
+{
+ error("%s:drv_EFN_defchar: Function not supported by EFN modules\n", Name);
+}
+
+/* start text mode display */
+static int drv_EFN_start(const char *section)
+{
+ int rows = -1, cols = -1;
+ char *s;
+
+ Host = cfg_get(section, "Host", NULL);
+
+ if (Host == NULL || *Host == '\0') {
+ error("%s: no '%s.Host' entry from %s", Name, section, cfg_source());
+ return -1;
+ }
+
+ if (cfg_number(section, "Port", 1000, 0, 65535, &Port) < 0)
+ return -1;
+
+
+ s = cfg_get(section, "Size", NULL);
+ if (s == NULL || *s == '\0') {
+ error("%s: no '%s.Size' entry from %s", Name, section, cfg_source());
+ return -1;
+ }
+ if (sscanf(s, "%dx%d", &cols, &rows) != 2 || rows < 1 || cols < 1) {
+ error("%s: bad %s.Size '%s' from %s", Name, section, s, cfg_source());
+ free(s);
+ return -1;
+ }
+
+ DROWS = rows;
+ DCOLS = cols;
+
+ /* open communication with the display */
+ if (drv_EFN_open(section) < 0) {
+ return -1;
+ }
+
+ /* initialize display */
+ drv_EFN_clear(); /* clear display */
+
+ return 0;
+}
+
+
+
+/****************************************/
+/*** plugins ***/
+/****************************************/
+
+
+/****************************************/
+/*** widget callbacks ***/
+/****************************************/
+
+
+
+
+/****************************************/
+/*** exported functions ***/
+/****************************************/
+
+
+/* list models */
+int drv_EFN_list(void)
+{
+ printf("EFN LED modules + EUG100 Ethernet to serial converter");
+ return 0;
+}
+
+
+/* initialize driver & display */
+/* use this function for a text display */
+int drv_EFN_init(const char *section, const int quiet)
+{
+ WIDGET_CLASS wc;
+ int ret;
+
+ info("%s: %s", Name, "$Rev: 773 $");
+
+ /* display preferences */
+
+ /* real worker functions */
+ drv_generic_text_real_write = drv_EFN_write;
+ drv_generic_text_real_defchar = drv_EFN_defchar;
+
+
+ /* start display */
+ if ((ret = drv_EFN_start(section)) != 0)
+ return ret;
+
+ if (!quiet) {
+ char buffer[40];
+ qprintf(buffer, sizeof(buffer), "%s %dx%d", Name, DCOLS, DROWS);
+ sleep(3);
+ drv_EFN_clear();
+
+ }
+
+ /* initialize generic text driver */
+ if ((ret = drv_generic_text_init(section, Name)) != 0)
+ return ret;
+
+
+ /* register text widget */
+ wc = Widget_Text;
+ wc.draw = drv_generic_text_draw;
+ widget_register(&wc);
+
+ return 0;
+}
+
+
+
+
+/* close driver & display */
+/* use this function for a text display */
+int drv_EFN_quit(const int quiet)
+{
+
+ info("%s: shutting down.", Name);
+
+ drv_generic_text_quit();
+
+ /* clear display */
+ drv_EFN_clear();
+
+ /* say goodbye... */
+ if (!quiet) {
+ drv_generic_text_greet("goodbye!", NULL);
+ }
+
+ debug("closing connection");
+ drv_EFN_close();
+
+ return (0);
+}
+
+/* close driver & display */
+/* use this one for a text display */
+DRIVER drv_EFN = {
+ .name = Name,
+ .list = drv_EFN_list,
+ .init = drv_EFN_init,
+ .quit = drv_EFN_quit,
+};
diff --git a/drv_FW8888.c b/drv_FW8888.c
new file mode 100644
index 0000000..8065831
--- /dev/null
+++ b/drv_FW8888.c
@@ -0,0 +1,309 @@
+/* $Id: drv_FW8888.c 1153 2011-07-27 05:12:30Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/drv_FW8888.c $
+ *
+ * driver for Allnet FW8888 display
+ *
+ * Copyright (C) 2005 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2005, 2006, 2007 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ * Copyright (C) 2010 Linum Software GmbH <support@linum.com>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ *
+ * exported fuctions:
+ *
+ * struct DRIVER drv_FW8888
+ *
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+
+#include "debug.h"
+#include "cfg.h"
+#include "qprintf.h"
+#include "udelay.h"
+#include "plugin.h"
+#include "widget.h"
+#include "widget_text.h"
+#include "widget_icon.h"
+#include "widget_bar.h"
+#include "drv.h"
+
+/* text mode display? */
+#include "drv_generic_text.h"
+
+/* serial port? */
+#include "drv_generic_serial.h"
+
+static char Name[] = "FW8888";
+
+
+/****************************************/
+/*** hardware dependant functions ***/
+/****************************************/
+
+static int drv_FW8888_open(const char *section)
+{
+ /* open serial port */
+ /* don't mind about device, speed and stuff, this function will take care of */
+
+ if (drv_generic_serial_open(section, Name, 0) < 0)
+ return -1;
+
+ return 0;
+}
+
+
+static int drv_FW8888_close(void)
+{
+ /* close whatever port you've opened */
+ drv_generic_serial_close();
+
+ return 0;
+}
+
+
+static void drv_FW8888_send_cmd(const unsigned int cmd)
+{
+ char cmd_str[2];
+
+ cmd_str[0] = 0x10;
+ cmd_str[1] = cmd;
+ drv_generic_serial_write(cmd_str, 2);
+}
+
+
+static void drv_FW8888_send_text(const char *text, const unsigned int len)
+{
+ unsigned int i;
+ char cmd_str[2];
+
+ cmd_str[0] = 0x12;
+
+ for (i = 0; i < len; i++) {
+ cmd_str[1] = text[i];
+ drv_generic_serial_write(cmd_str, 2);
+ }
+}
+
+/* text mode displays only */
+static void drv_FW8888_clear(void)
+{
+ drv_FW8888_send_cmd(0x01);
+}
+
+static void __attribute__ ((unused)) drv_FW8888_home(void)
+{
+ drv_FW8888_send_cmd(0x02);
+}
+
+static void __attribute__ ((unused)) drv_FW8888_display_off(void)
+{
+ drv_FW8888_send_cmd(0x08);
+}
+
+static void __attribute__ ((unused)) drv_FW8888_display_on_cursor_off(void)
+{
+ drv_FW8888_send_cmd(0x0C);
+}
+
+static void __attribute__ ((unused)) drv_FW8888_display_on_cursor_on(void)
+{
+ drv_FW8888_send_cmd(0x0E);
+}
+
+static void __attribute__ ((unused)) drv_FW8888_backlight_off(void)
+{
+ drv_FW8888_send_cmd(0x38);
+}
+
+static void __attribute__ ((unused)) drv_FW8888_backlight_on(void)
+{
+ drv_FW8888_send_cmd(0x39);
+}
+
+static void drv_FW8888_set_cursor(int row, int col)
+{
+ int pos;
+ switch (row) {
+ case 0:
+ pos = 0x80 + col;
+ break;
+ case 1:
+ pos = 0xC0 + col;
+ break;
+ default:
+ error("%s: invalid row(%d) or col(%d)", Name, row, col);
+ return;
+ }
+ drv_FW8888_send_cmd(pos);
+}
+
+
+/* text mode displays only */
+static void drv_FW8888_write(const int row, const int col, const char *data, int len)
+{
+ /* do the cursor positioning here */
+ drv_FW8888_set_cursor(row, col);
+
+ /* send string to the display */
+ drv_FW8888_send_text(data, len);
+}
+
+
+/* start text mode display */
+static int drv_FW8888_start(const char *section)
+{
+ /* display preferences */
+ XRES = 5; /* pixel width of one char */
+ YRES = 8; /* pixel height of one char */
+ CHARS = 0; /* number of user-defineable characters */
+ CHAR0 = 0; /* ASCII of first user-defineable char */
+ DROWS = 2;
+ DCOLS = 16;
+
+ GOTO_COST = -1; /* number of bytes a goto command requires */
+
+ /* open communication with the display */
+ if (drv_FW8888_open(section) < 0) {
+ return -1;
+ }
+
+ drv_FW8888_clear(); /* clear display */
+
+ return 0;
+}
+
+
+
+/****************************************/
+/*** plugins ***/
+/****************************************/
+
+/* none */
+
+/****************************************/
+/*** widget callbacks ***/
+/****************************************/
+
+
+/* using drv_generic_text_draw(W) */
+/* using drv_generic_text_icon_draw(W) */
+/* using drv_generic_text_bar_draw(W) */
+/* using drv_generic_gpio_draw(W) */
+
+
+/****************************************/
+/*** exported functions ***/
+/****************************************/
+
+
+/* list models */
+int drv_FW8888_list(void)
+{
+ printf("Allnet-FW8888");
+ return 0;
+}
+
+
+/* initialize driver & display */
+/* use this function for a text display */
+int drv_FW8888_init(const char *section, const int quiet)
+{
+ WIDGET_CLASS wc;
+ int ret;
+
+ info("%s: %s", Name, "$Rev: 1153 $");
+
+ /* display preferences */
+ XRES = 5; /* pixel width of one char */
+ YRES = 7; /* pixel height of one char */
+ CHARS = 0; /* number of user-defineable characters */
+ CHAR0 = 0; /* ASCII of first user-defineable char */
+
+ /* real worker functions */
+ drv_generic_text_real_write = drv_FW8888_write;
+
+ /* start display */
+ if ((ret = drv_FW8888_start(section)) != 0)
+ return ret;
+
+ if (!quiet) {
+ char buffer[40];
+ qprintf(buffer, sizeof(buffer), "%s %dx%d", Name, DCOLS, DROWS);
+ if (drv_generic_text_greet(buffer, "www.linum.com")) {
+ sleep(3);
+ drv_FW8888_clear();
+ }
+ }
+
+ /* initialize generic text driver */
+ if ((ret = drv_generic_text_init(section, Name)) != 0)
+ return ret;
+
+ /* register text widget */
+ wc = Widget_Text;
+ wc.draw = drv_generic_text_draw;
+ widget_register(&wc);
+
+ /* register plugins */
+ // AddFunction("LCD::contrast", 1, plugin_contrast);
+
+ return 0;
+}
+
+
+/* close driver & display */
+/* use this function for a text display */
+int drv_FW8888_quit(const int quiet)
+{
+
+ info("%s: shutting down.", Name);
+
+ drv_generic_text_quit();
+
+ /* clear display */
+ drv_FW8888_clear();
+
+ /* say goodbye... */
+ if (!quiet) {
+ drv_generic_text_greet("goodbye!", NULL);
+ }
+
+ debug("closing connection");
+ drv_FW8888_close();
+
+ return (0);
+}
+
+
+/* use this one for a text display */
+DRIVER drv_FW8888 = {
+ .name = Name,
+ .list = drv_FW8888_list,
+ .init = drv_FW8888_init,
+ .quit = drv_FW8888_quit,
+};
diff --git a/drv_FutabaVFD.c b/drv_FutabaVFD.c
new file mode 100644
index 0000000..7975845
--- /dev/null
+++ b/drv_FutabaVFD.c
@@ -0,0 +1,418 @@
+/* $Id: drv_FutabaVFD.c -1 $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/drv_FutabaVFD.c $
+ *
+ * A driver to run Futaba VFD M402SD06GL with LCD4Linux on parallel port
+ *
+ * Copyright (C) 2005 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2005, 2006, 2007 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ * Copyright (C) 2012 Marcus Menzel <codingmax@gmx-topmail.de>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ *
+ * exported fuctions:
+ *
+ * struct DRIVER drv_FutabaVFD
+ *
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+
+#include "debug.h"
+#include "cfg.h"
+#include "qprintf.h"
+#include "udelay.h"
+#include "plugin.h"
+#include "widget.h"
+#include "widget_text.h"
+#include "widget_icon.h"
+#include "widget_bar.h"
+#include "drv.h"
+
+#include "drv_generic_text.h"
+#include "drv_generic_parport.h"
+
+
+static char Name[] = "FutabaVFD";
+
+static unsigned char SIGNAL_WR;
+static unsigned char SIGNAL_SELECT;
+static unsigned char SIGNAL_TEST;
+static unsigned char SIGNAL_BUSY;
+
+static unsigned char dim; /* brightness 0..3 */
+static unsigned char curPos; /* cursor position */
+static unsigned char curOn; /* cursor on */
+
+static unsigned char BUSY_SHIFT;
+static unsigned char BUSY_VALUE;
+
+
+/****************************************/
+/*** hardware dependant functions ***/
+/****************************************/
+
+
+/* example for sending one byte over the wire */
+static void drv_FutabaVFD_writeChar(const unsigned char c)
+{
+
+ int i;
+ unsigned char status;
+
+ drv_generic_parport_data(c);
+ drv_generic_parport_control(SIGNAL_WR | SIGNAL_SELECT, 0);
+ ndelay(60);
+ drv_generic_parport_control(SIGNAL_WR, 0xFF);
+
+ /*wait <=60ns till busy */
+ for (i = 0; i < 60; i++) {
+ status = drv_generic_parport_status();
+ if (((status >> BUSY_SHIFT) & 1) == BUSY_VALUE)
+ break;
+ ndelay(1);
+ }
+ ndelay(60 - i);
+ drv_generic_parport_control(SIGNAL_SELECT, 0xFF);
+
+ /*wait max 0.1s till not busy */
+ for (i = 0; i < 100000000; i++) {
+ status = drv_generic_parport_status();
+ if (((status >> BUSY_SHIFT) & 1) != BUSY_VALUE)
+ break;
+ ndelay(1);
+ }
+ ndelay(210);
+}
+
+
+
+static void drv_FutabaVFD_showCursor(int b)
+{
+ drv_FutabaVFD_writeChar((b) ? 0x13 : 0x14); /* b==0: cursor off */
+}
+
+static void drv_FutabaVFD_clear()
+{
+ drv_FutabaVFD_writeChar(0x1F); /*reset */
+ drv_FutabaVFD_writeChar(0x11); /*DC1 - normal display */
+ drv_FutabaVFD_showCursor(0);
+}
+
+
+static int drv_FutabaVFD_open(const char *section)
+{
+
+ if (drv_generic_parport_open(section, Name) != 0) {
+ error("%s: could not initialize parallel port!", Name);
+ return -1;
+ }
+
+ /* read the wiring from config */
+ if ((SIGNAL_WR = drv_generic_parport_wire_ctrl("WR", "STROBE")) == 0xFF)
+ return -1;
+ if ((SIGNAL_SELECT = drv_generic_parport_wire_ctrl("SEL", "SLCTIN")) == 0xFF)
+ return -1;
+ if ((SIGNAL_TEST = drv_generic_parport_wire_ctrl("TEST", "AUTOFD")) == 0xFF)
+ return -1;
+ if ((SIGNAL_BUSY = drv_generic_parport_wire_status("BUSY", "BUSY")) == 0xFF)
+ return -1;
+
+ BUSY_SHIFT = 0;
+ BUSY_VALUE = SIGNAL_BUSY;
+ while (BUSY_VALUE > 1) {
+ BUSY_VALUE >>= 1;
+ BUSY_SHIFT++;
+ }
+ BUSY_VALUE = (SIGNAL_BUSY == 0x80) ? 0 : 1; /* portpin 11 inverted */
+
+ /* set all signals to high */
+ drv_generic_parport_control(SIGNAL_WR | SIGNAL_SELECT | SIGNAL_TEST, 0xFF);
+
+ /* set direction: write */
+ drv_generic_parport_direction(0);
+
+ return 0;
+}
+
+
+static int drv_FutabaVFD_close(void)
+{
+ drv_generic_parport_close();
+ return 0;
+}
+
+static void drv_FutabaVFD_send(const char *data, const unsigned int len)
+{
+ unsigned int i;
+ for (i = 0; i < len; i++)
+ drv_FutabaVFD_writeChar(*data++);
+}
+
+
+static void drv_FutabaVFD_goto(unsigned char pos)
+{
+ curPos = pos;
+ drv_FutabaVFD_writeChar(0x10);
+ drv_FutabaVFD_writeChar(curPos);
+}
+
+
+static void drv_FutabaVFD_write(const int row, const int col, const char *data, int len)
+{
+ unsigned char oldPos = curPos;
+ if (curOn)
+ drv_FutabaVFD_showCursor(0);
+ drv_FutabaVFD_goto(row * DCOLS + col);
+ drv_FutabaVFD_send(data, len);
+ drv_FutabaVFD_goto(oldPos);
+ if (curOn)
+ drv_FutabaVFD_showCursor(1);
+}
+
+static void drv_FutabaVFD_defchar(const int ascii, const unsigned char *matrix)
+{
+ return; // no defchars
+}
+
+
+static void drv_FutabaVFD_brightness(int brightness)
+{
+
+ if (brightness < 0)
+ dim = 0;
+ else if (brightness > 3)
+ dim = 3;
+ else
+ dim = brightness;
+
+ drv_FutabaVFD_writeChar(0x04);
+ drv_FutabaVFD_writeChar((dim < 3) ? (1 + dim) * 0x20 : 0xFF);
+}
+
+
+static void drv_FutabaVFD_test(int test)
+{
+ drv_generic_parport_control(SIGNAL_TEST, (test) ? 0 : 0xFF);
+}
+
+
+
+/* start text mode display */
+static int drv_FutabaVFD_start(const char *section)
+{
+
+ int brightness;
+ int rows = -1, cols = -1;
+ char *s;
+
+
+ s = cfg_get(section, "Size", NULL);
+ if (s == NULL || *s == '\0') {
+ error("%s: no '%s.Size' entry from %s", Name, section, cfg_source());
+ return -1;
+ }
+ if (sscanf(s, "%dx%d", &cols, &rows) != 2 || rows < 1 || cols < 1) {
+ error("%s: bad %s.Size '%s' from %s", Name, section, s, cfg_source());
+ free(s);
+ return -1;
+ }
+
+ DROWS = rows;
+ DCOLS = cols;
+
+ /* open communication with the display */
+ if (drv_FutabaVFD_open(section) < 0)
+ return -1;
+
+
+ if (cfg_number(section, "Brightness", 0, 0, 255, &brightness) > 0)
+ drv_FutabaVFD_brightness(brightness);
+
+
+ drv_FutabaVFD_clear(); /* clear display */
+
+ return 0;
+}
+
+
+
+/****************************************/
+/*** plugins ***/
+/****************************************/
+
+static void plugin_brightness(RESULT * result, const int argc, RESULT * argv[])
+{
+
+ double d = dim;
+
+ switch (argc) {
+ case 0:
+ SetResult(&result, R_NUMBER, &d);
+ break;
+ case 1:
+ drv_FutabaVFD_brightness(R2N(argv[0]));
+ d = dim;
+ SetResult(&result, R_NUMBER, &d);
+ break;
+ default:
+ error("%s::brightness(): wrong number of parameters", Name);
+ SetResult(&result, R_STRING, "");
+ }
+}
+
+
+
+/****************************************/
+/*** widget callbacks ***/
+/****************************************/
+
+
+/* using drv_generic_text_draw(W) */
+/* using drv_generic_text_icon_draw(W) */
+/* using drv_generic_text_bar_draw(W) */
+/* using drv_generic_gpio_draw(W) */
+
+
+/****************************************/
+/*** exported functions ***/
+/****************************************/
+
+
+/* list models */
+int drv_FutabaVFD_list(void)
+{
+ printf("Futaba VFD M402SD06GL");
+ return 0;
+}
+
+
+/* initialize driver & display */
+/* use this function for a text display */
+int drv_FutabaVFD_init(const char *section, const int quiet)
+{
+ WIDGET_CLASS wc;
+ int ret;
+
+
+ info("%s: %s", Name, "$Rev: 0.0.1 $");
+
+
+ XRES = 5; /* pixel width of one char */
+ YRES = 7; /* pixel height of one char */
+ GOTO_COST = 2; /* number of bytes a goto command requires */
+
+
+ /* real worker functions */
+ drv_generic_text_real_write = drv_FutabaVFD_write;
+ drv_generic_text_real_defchar = drv_FutabaVFD_defchar;
+
+
+ /* start display */
+ if ((ret = drv_FutabaVFD_start(section)) != 0)
+ return ret;
+
+ if (!quiet) {
+ char buffer[40];
+ qprintf(buffer, sizeof(buffer), "%s %dx%d", Name, DCOLS, DROWS);
+ if (drv_generic_text_greet(buffer, "---")) {
+ sleep(3);
+ drv_FutabaVFD_clear();
+ }
+ }
+
+ /* initialize generic text driver */
+ if ((ret = drv_generic_text_init(section, Name)) != 0)
+ return ret;
+
+ /* initialize generic icon driver TODO */
+
+ if ((ret = drv_generic_text_icon_init()) != 0)
+ return ret;
+
+
+ /* initialize generic bar driver */
+ if ((ret = drv_generic_text_bar_init(0)) != 0)
+ return ret;
+
+ /* add fixed chars to the bar driver */
+ drv_generic_text_bar_add_segment(0, 0, 255, '_'); /* ASCII 32 = blank */
+ drv_generic_text_bar_add_segment(255, 255, 255, 0x7F); /* 0x7F = full dot */
+
+
+ /* register text widget */
+ wc = Widget_Text;
+ wc.draw = drv_generic_text_draw;
+ widget_register(&wc);
+
+ /* register icon widget TODO */
+ wc = Widget_Icon;
+ wc.draw = drv_generic_text_icon_draw;
+ widget_register(&wc);
+
+
+ /* register bar widget */
+ wc = Widget_Bar;
+ wc.draw = drv_generic_text_bar_draw;
+ widget_register(&wc);
+
+ /* register plugins */
+ AddFunction("LCD::brightness", -1, plugin_brightness);
+
+
+
+ return 0;
+}
+
+
+/* close driver & display */
+/* use this function for a text display */
+int drv_FutabaVFD_quit(const int quiet)
+{
+
+ info("%s: shutting down.", Name);
+
+ drv_generic_text_quit();
+
+ drv_FutabaVFD_clear();
+
+ if (!quiet) {
+ drv_generic_text_greet("goodbye!", NULL);
+ }
+
+ debug("closing connection");
+ drv_FutabaVFD_close();
+
+ return (0);
+}
+
+/* use this one for a text display */
+DRIVER drv_FutabaVFD = {
+ .name = Name,
+ .list = drv_FutabaVFD_list,
+ .init = drv_FutabaVFD_init,
+ .quit = drv_FutabaVFD_quit,
+};
diff --git a/drv_G15.c b/drv_G15.c
new file mode 100644
index 0000000..ae21d18
--- /dev/null
+++ b/drv_G15.c
@@ -0,0 +1,675 @@
+/* $Id: drv_G15.c 1153 2011-07-27 05:12:30Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/drv_G15.c $
+ *
+ * Driver for Logitech G-15 keyboard LCD screen
+ *
+ * Copyright (C) 2006 Dave Ingram <dave@partis-project.net>
+ * Copyright (C) 2005 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2005 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ *
+ * exported fuctions:
+ *
+ * struct DRIVER drv_G15
+ *
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+
+#include <usb.h>
+#include <fcntl.h>
+#include <linux/input.h>
+#include <linux/uinput.h>
+
+#include <unistd.h>
+#include <sys/types.h>
+
+#include "debug.h"
+#include "cfg.h"
+#include "qprintf.h"
+#include "udelay.h"
+#include "plugin.h"
+#include "drv.h"
+#include "drv_generic_graphic.h"
+#include "thread.h"
+
+/* Logitech: VendorID 0x046d */
+#define G15_VENDOR 0x046d
+/* Logitech Keyboard G15: ProductID 0xc222, 0xc227 */
+/* Logitech Speaker Z10: ProductID 0x0a07 */
+#define G15_DEVICE 0xc222
+#define G15_DEVICE2 0xc227
+#define Z10_DEVICE 0x0a07
+#define M1730_DEVICE 0xc251
+
+#if 0
+#define DEBUG(x) debug("%s(): %s", __FUNCTION__, x);
+#else
+#define DEBUG(x)
+#endif
+
+#define KB_UPDOWN_PRESS
+
+static char Name[] = "G-15";
+
+static usb_dev_handle *g15_lcd;
+
+static unsigned char *g15_image;
+
+unsigned char g_key_states[18];
+unsigned char m_key_states[4];
+unsigned char l_key_states[5];
+
+static int uinput_fd;
+static int kb_mutex;
+static int kb_thread_pid;
+static int kb_single_keypress = 0;
+
+static int usb_endpoint = 0;
+
+
+/****************************************/
+/*** hardware dependant functions ***/
+/****************************************/
+
+
+void drv_G15_keyDown(unsigned char scancode)
+{
+ struct input_event event;
+ memset(&event, 0, sizeof(event));
+
+ event.type = EV_KEY;
+ event.code = scancode;
+ event.value = 1;
+ write(uinput_fd, &event, sizeof(event));
+}
+
+void drv_G15_keyUp(unsigned char scancode)
+{
+ struct input_event event;
+ memset(&event, 0, sizeof(event));
+
+ event.type = EV_KEY;
+ event.code = scancode;
+ event.value = 0;
+ write(uinput_fd, &event, sizeof(event));
+}
+
+void drv_G15_keyDownUp(unsigned char scancode)
+{
+ drv_G15_keyDown(scancode);
+ drv_G15_keyUp(scancode);
+
+}
+
+inline unsigned char drv_G15_evalScanCode(int key)
+{
+ /* first 12 G keys produce F1 - F12, thats 0x3a + key */
+ if (key < 12) {
+ return 0x3a + key;
+ }
+
+ /* the other keys produce Key '1' (above letters) + key, thats 0x1e + key */
+ else {
+ return 0x1e + key - 12; /* sigh, half an hour to find -12 .... */
+ }
+}
+
+void drv_G15_processKeyEvent(unsigned char *buffer)
+{
+ const int g_scancode_offset = 167;
+ const int m_scancode_offset = 187;
+ const int l_scancode_offset = 191;
+ int i;
+ int is_set;
+ unsigned char m_key_new_states[4];
+ unsigned char l_key_new_states[5];
+ unsigned char orig_scancode;
+
+#if 0
+ printf("%hhx %hhx %hhx %hhx %hhx %hhx %hhx %hhx %hhx \n\n", buffer[0], buffer[1], buffer[2], buffer[3], buffer[4],
+ buffer[5], buffer[6], buffer[7], buffer[8]);
+ usleep(100);
+#endif
+
+ if (buffer[0] == 0x01) {
+ DEBUG("Checking keys: ");
+
+ for (i = 0; i < 18; ++i) {
+ orig_scancode = drv_G15_evalScanCode(i);
+ is_set = 0;
+
+ if (buffer[1] == orig_scancode || buffer[2] == orig_scancode || buffer[3] == orig_scancode ||
+ buffer[4] == orig_scancode || buffer[5] == orig_scancode)
+ is_set = 1;
+
+ if (!is_set && g_key_states[i] != 0) {
+ /* key was pressed but is no more */
+ if (!kb_single_keypress)
+ drv_G15_keyUp(g_scancode_offset + i);
+ g_key_states[i] = 0;
+ debug("G%d going up", (i + 1));
+ } else if (is_set && g_key_states[i] == 0) {
+ if (!kb_single_keypress)
+ drv_G15_keyDown(g_scancode_offset + i);
+ else
+ drv_G15_keyDownUp(g_scancode_offset + i);
+
+ g_key_states[i] = 1;
+ debug("G%d going down", (i + 1));
+ }
+ }
+ } else {
+ if (buffer[0] == 0x02) {
+ memset(m_key_new_states, 0, sizeof(m_key_new_states));
+
+ if (buffer[6] & 0x01)
+ m_key_new_states[0] = 1;
+ if (buffer[7] & 0x02)
+ m_key_new_states[1] = 1;
+ if (buffer[8] & 0x04)
+ m_key_new_states[2] = 1;
+ if (buffer[7] & 0x40)
+ m_key_new_states[3] = 1;
+
+ for (i = 0; i < 4; ++i) {
+ if (!m_key_new_states[i] && m_key_states[i] != 0) {
+ /* key was pressed but is no more */
+ if (!kb_single_keypress)
+ drv_G15_keyUp(m_scancode_offset + i);
+ m_key_states[i] = 0;
+ debug("M%d going up", (i + 1));
+ } else if (m_key_new_states[i] && m_key_states[i] == 0) {
+ if (!kb_single_keypress)
+ drv_G15_keyDown(m_scancode_offset + i);
+ else
+ drv_G15_keyDownUp(m_scancode_offset + i);
+ m_key_states[i] = 1;
+ debug("M%d going down", (i + 1));
+ }
+ }
+
+ memset(l_key_new_states, 0, sizeof(l_key_new_states));
+ if (buffer[8] & 0x80)
+ l_key_new_states[0] = 1;
+ if (buffer[2] & 0x80)
+ l_key_new_states[1] = 1;
+ if (buffer[3] & 0x80)
+ l_key_new_states[2] = 1;
+ if (buffer[4] & 0x80)
+ l_key_new_states[3] = 1;
+ if (buffer[5] & 0x80)
+ l_key_new_states[4] = 1;
+
+ for (i = 0; i < 5; ++i) {
+ if (!l_key_new_states[i] && l_key_states[i] != 0) {
+ /* key was pressed but is no more */
+ if (!kb_single_keypress)
+ drv_G15_keyUp(l_scancode_offset + i);
+ l_key_states[i] = 0;
+ debug("L%d going up", (i + 1));
+ } else if (l_key_new_states[i] && l_key_states[i] == 0) {
+ if (!kb_single_keypress)
+ drv_G15_keyDown(l_scancode_offset + i);
+ else
+ drv_G15_keyDownUp(l_scancode_offset + i);
+ l_key_states[i] = 1;
+ debug("L%d going down", (i + 1));
+ }
+ }
+
+ }
+ }
+}
+
+void drv_G15_closeUIDevice()
+{
+ DEBUG("closing device");
+ ioctl(uinput_fd, UI_DEV_DESTROY);
+ close(uinput_fd);
+}
+
+
+void drv_G15_initKeyHandling(char *device_filename)
+{
+ struct uinput_user_dev device;
+ int i;
+ DEBUG("Key Handling init")
+ uinput_fd = open(device_filename, O_RDWR);
+
+ if (uinput_fd < 0) {
+ info("Error, could not open the uinput device");
+ info("Compile your kernel for uinput, calling it a day now");
+ info("mknod uinput c 10 223");
+ abort();
+ }
+ memset(&device, 0, sizeof(device));
+ strncpy(device.name, "G15 Keys", UINPUT_MAX_NAME_SIZE);
+ device.id.bustype = BUS_USB;
+ device.id.version = 4;
+
+ ioctl(uinput_fd, UI_SET_EVBIT, EV_KEY);
+
+ for (i = 0; i < 256; ++i)
+ ioctl(uinput_fd, UI_SET_KEYBIT, i);
+
+ write(uinput_fd, &device, sizeof(device));
+
+ if (ioctl(uinput_fd, UI_DEV_CREATE)) {
+ info("Failed to create input device");
+ abort();
+ }
+
+/* atexit(&closeDevice); */
+
+ memset(g_key_states, 0, sizeof(g_key_states));
+ memset(m_key_states, 0, sizeof(m_key_states));
+ memset(l_key_states, 0, sizeof(l_key_states));
+}
+
+
+static void drv_G15_KBThread(void __attribute__ ((unused)) * notused)
+{
+ unsigned char buffer[9];
+ int ret;
+ while (1) {
+ mutex_lock(kb_mutex);
+ ret = usb_bulk_read(g15_lcd, 0x81, (char *) buffer, 9, 10);
+/* ret = usb_interrupt_read(g15_lcd, 0x81, (char*)buffer, 9, 10); */
+ mutex_unlock(kb_mutex);
+ if (ret == 9) {
+ drv_G15_processKeyEvent(buffer);
+ }
+ }
+}
+
+static int drv_G15_open()
+{
+ struct usb_bus *bus;
+ struct usb_device *dev;
+ char dname[32] = { 0 };
+ int interf = -1;
+ int config = 1;
+ int retval;
+
+ g15_lcd = NULL;
+
+ info("%s: Scanning USB for G-15 keyboard or Z-10 speaker ...", Name);
+
+ usb_init();
+ usb_set_debug(0); // 0: no, 1 error, 2 warn, 3 info
+ debug("%s: found %d USB busses", Name, usb_find_busses());
+ debug("%s: found %d USB devices", Name, usb_find_devices());
+
+ for (bus = usb_get_busses(); bus; bus = bus->next) {
+ for (dev = bus->devices; dev; dev = dev->next) {
+ debug("%s: open %s/%s/%s", Name, bus->dirname, dev->bus->dirname, dev->filename);
+ if (dev->descriptor.idVendor == G15_VENDOR) {
+ if ((g15_lcd = usb_open(dev))) {
+ // get vendor name if possible
+ if (dev->descriptor.iManufacturer) {
+ retval = usb_get_string_simple(g15_lcd, dev->descriptor.iManufacturer, dname, sizeof(dname));
+ if (retval <= 0) {
+ snprintf(dname, sizeof(dname), "(unknown)");
+ }
+ }
+ debug("%s: Found USB vendor ID 0x%x (%s), checking productID 0x%x...",
+ Name, G15_VENDOR, dname, dev->descriptor.idProduct);
+ switch (dev->descriptor.idProduct) {
+ case G15_DEVICE:
+ case G15_DEVICE2:
+ case M1730_DEVICE:
+ {
+ info("%s: Found Logitech G-15 or Dell M1730 Keyboard", Name);
+ interf = 0;
+ config = 1;
+ usb_endpoint = 0x02;
+ break;
+ }
+ case Z10_DEVICE:
+ {
+ info("%s: Found Logitech Z-10 Speaker", Name);
+ interf = 2;
+ usb_endpoint = 0x03;
+ break;
+ }
+ default:
+ debug("%s: Don't found USB product IDs 0x%x|0x%x/0x%x for G-15/M1730 or 0x%x for Z10",
+ Name, G15_DEVICE, G15_DEVICE2, M1730_DEVICE, Z10_DEVICE);
+ usb_close(g15_lcd);
+ }
+
+ if (interf >= 0) {
+ debug("%s: Vendor 0x%x Product 0x%x found",
+ Name, dev->descriptor.idVendor, dev->descriptor.idProduct);
+
+#ifdef LIBUSB_HAS_GET_DRIVER_NP
+ /* detach from the kernel if we need to */
+ retval = usb_get_driver_np(g15_lcd, interf, dname, 31);
+ debug("%s: Ret %i from usb_get_driver_np(interf.%d), Drivername %s",
+ Name, retval, interf, dname);
+ switch (retval) {
+ case -EPERM:
+ error("%s: Permission denied! eUID of this process is %i %s",
+ Name, geteuid(), geteuid() != 0 ? "(not root)" : "");
+ //return -1;
+ break;
+ case -ENODATA:
+ error("%s: No data available! Device switched off?", Name);
+ //return -1;
+ break;
+ }
+#ifdef LIBUSB_HAS_DETACH_KERNEL_DRIVER_NP
+ if (retval == 0 && strcmp(dname, "usbhid") == 0) {
+ debug("%s: detaching...", Name);
+ usb_detach_kernel_driver_np(g15_lcd, interf);
+ }
+#endif // detach_kernel_driver_np
+#endif // get_driver_np
+
+ retval = usb_set_configuration(g15_lcd, config);
+ debug("%s: Ret %d from usb_set_configuration(%d)", Name, retval, config);
+ switch (retval) {
+ case -EPERM:
+ error("%s: Permission denied! eUID of this process is %i %s",
+ Name, geteuid(), geteuid() != 0 ? "(not root)" : "");
+ return -1;
+ break;
+ case -EBUSY:
+ error("%s: Device or resource busy! Device switched off?", Name);
+ return -1;
+ break;
+ }
+ usleep(100);
+ retval = usb_claim_interface(g15_lcd, interf);
+ debug("%s: Ret %i from usb_claim_interface(%d)", Name, retval, interf);
+ return retval;
+ }
+
+ }
+ } // G15_Vendor
+ } // all devices
+ } // all busses
+
+ return -1;
+}
+
+
+static int drv_G15_close(void)
+{
+ usb_release_interface(g15_lcd, 0);
+ if (g15_lcd)
+ usb_close(g15_lcd);
+
+ return 0;
+}
+
+
+static void drv_G15_update_img()
+{
+ int i, j, k;
+ unsigned char *output = malloc(DCOLS * DROWS * sizeof(unsigned char));
+
+ DEBUG("entered");
+ if (!output)
+ return;
+
+ DEBUG("memory allocated");
+ memset(output, 0, DCOLS * DROWS);
+ DEBUG("memory set");
+ output[0] = 0x03;
+ DEBUG("first output set");
+
+ for (k = 0; k < 6; k++) {
+ for (i = 0; i < DCOLS; i++) {
+ int maxj = (k == 5) ? 3 : 8;
+ for (j = 0; j < maxj; j++) {
+ if (g15_image[(k * 1280) + i + (j * DCOLS)])
+ output[32 + i + (k * DCOLS)] |= (1 << j);
+ }
+ }
+ }
+
+ DEBUG("output array prepared");
+ mutex_lock(kb_mutex);
+ i = usb_interrupt_write(g15_lcd, usb_endpoint, (char *) output, 992, 1000);
+ //info("%s: Ret %i from usb_interrupt_write(endpoint %d)", Name, i, usb_endpoint);
+ mutex_unlock(kb_mutex);
+ usleep(300);
+
+ DEBUG("data written to LCD");
+
+ free(output);
+
+ DEBUG("memory freed");
+ DEBUG("left");
+}
+
+
+
+/* for graphic displays only */
+static void drv_G15_blit(const int row, const int col, const int height, const int width)
+{
+ int r, c;
+
+ DEBUG("entered");
+
+ for (r = row; r < row + height; r++) {
+ for (c = col; c < col + width; c++) {
+ g15_image[r * DCOLS + c] = drv_generic_graphic_black(r, c);
+ }
+ }
+
+ DEBUG("updating image");
+
+ drv_G15_update_img();
+
+ DEBUG("left");
+}
+
+
+/* start graphic display */
+static int drv_G15_start(const char *section)
+{
+ char *s;
+
+ DEBUG("entered");
+
+ /* read display size from config */
+ DROWS = 43;
+ DCOLS = 160;
+
+ DEBUG("display size set");
+
+ s = cfg_get(section, "Font", "6x8");
+ if (s == NULL || *s == '\0') {
+ error("%s: no '%s.Font' entry from %s", Name, section, cfg_source());
+ return -1;
+ }
+
+ XRES = -1;
+ YRES = -1;
+ if (sscanf(s, "%dx%d", &XRES, &YRES) != 2 || XRES < 1 || YRES < 1) {
+ error("%s: bad Font '%s' from %s", Name, s, cfg_source());
+ return -1;
+ }
+
+ /* Fixme: provider other fonts someday... */
+ if (XRES != 6 && YRES != 8) {
+ error("%s: bad Font '%s' from %s (only 6x8 at the moment)", Name, s, cfg_source());
+ return -1;
+ }
+
+ DEBUG("Finished config stuff");
+
+ DEBUG("allocating image buffer");
+ /* you surely want to allocate a framebuffer or something... */
+ g15_image = malloc(DCOLS * DROWS * sizeof(unsigned char));
+ if (!g15_image)
+ return -1;
+ DEBUG("allocated");
+ memset(g15_image, 0, DCOLS * DROWS);
+ DEBUG("zeroed");
+
+ /* open communication with the display */
+ DEBUG("opening display...");
+ if (drv_G15_open() < 0) {
+ DEBUG("opening failed");
+ return -1;
+ }
+ DEBUG("display open");
+
+ /* reset & initialize display */
+ DEBUG("clearing display");
+ drv_G15_update_img();
+ DEBUG("done");
+
+ /*
+ if (cfg_number(section, "Contrast", 0, 0, 255, &contrast) > 0) {
+ drv_G15_contrast(contrast);
+ }
+ */
+ s = cfg_get(section, "Uinput", "");
+ if (s != NULL && *s != '\0') {
+ cfg_number(section, "SingleKeyPress", 0, 0, 1, &kb_single_keypress);
+ drv_G15_initKeyHandling(s);
+
+ DEBUG("creating thread for keyboard");
+ kb_mutex = mutex_create();
+ kb_thread_pid = thread_create("G15_KBThread", drv_G15_KBThread, NULL);
+
+ DEBUG("done");
+ }
+ DEBUG("left");
+
+ return 0;
+}
+
+
+/****************************************/
+/*** plugins ***/
+/****************************************/
+
+/* none */
+
+
+/****************************************/
+/*** exported functions ***/
+/****************************************/
+
+
+/* list models */
+int drv_G15_list(void)
+{
+ printf("Logitech G-15 or Z-10 / Dell M1730");
+ return 0;
+}
+
+
+/* initialize driver & display */
+int drv_G15_init(const char *section, const int quiet)
+{
+ int ret;
+
+ info("%s: %s", Name, "$Rev: 1153 $");
+
+ DEBUG("entered");
+
+ /* real worker functions */
+ drv_generic_graphic_real_blit = drv_G15_blit;
+
+ /* start display */
+ if ((ret = drv_G15_start(section)) != 0)
+ return ret;
+
+ /* initialize generic graphic driver */
+ if ((ret = drv_generic_graphic_init(section, Name)) != 0)
+ return ret;
+
+ if (!quiet) {
+ char buffer[40];
+
+ qprintf(buffer, sizeof(buffer), "%s %dx%d", Name, DCOLS, DROWS);
+ if (drv_generic_graphic_greet(buffer, NULL)) {
+ sleep(3);
+ drv_generic_graphic_clear();
+ }
+ }
+
+ /* register plugins */
+ /* none at the moment... */
+
+
+ DEBUG("left");
+
+ return 0;
+}
+
+
+
+/* close driver & display */
+int drv_G15_quit(const int quiet)
+{
+ info("%s: shutting down.", Name);
+
+ DEBUG("clearing display");
+ /* clear display */
+ drv_generic_graphic_clear();
+
+ DEBUG("saying goodbye");
+ /* say goodbye... */
+ if (!quiet) {
+ drv_generic_graphic_greet("goodbye!", NULL);
+ }
+
+ DEBUG("generic_graphic_quit()");
+ drv_generic_graphic_quit();
+
+ mutex_destroy(kb_mutex);
+ usleep(10 * 1000);
+ thread_destroy(kb_thread_pid);
+
+ drv_G15_closeUIDevice();
+ DEBUG("closing UInputDev");
+
+
+ DEBUG("closing connection");
+ drv_G15_close();
+
+ DEBUG("freeing image alloc");
+ free(g15_image);
+
+ return (0);
+}
+
+
+DRIVER drv_G15 = {
+ .name = Name,
+ .list = drv_G15_list,
+ .init = drv_G15_init,
+ .quit = drv_G15_quit,
+};
diff --git a/drv_GLCD2USB.c b/drv_GLCD2USB.c
new file mode 100644
index 0000000..0989b46
--- /dev/null
+++ b/drv_GLCD2USB.c
@@ -0,0 +1,648 @@
+
+/* $Id: drv_GLCD2USB.c 1144 2011-05-06 18:21:47Z harbaum $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/drv_GLCD2USB.c $
+ *
+ * GLCD2USB driver for LCD4Linux
+ * (see http://www.harbaum.org/till/glcd2usb for hardware)
+ *
+ * Copyright (C) 2007 Till Harbaum <till@harbaum.org>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ *
+ * exported fuctions:
+ *
+ * struct DRIVER drv_GLCD2USB
+ *
+ */
+
+/*
+ * Options:
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <unistd.h>
+#include <termios.h>
+#include <fcntl.h>
+#include <sys/time.h>
+#include <usb.h>
+
+#include "debug.h"
+#include "cfg.h"
+#include "timer.h"
+#include "qprintf.h"
+#include "plugin.h"
+#include "widget.h"
+#include "widget_text.h"
+#include "widget_icon.h"
+#include "widget_bar.h"
+#include "widget_keypad.h"
+#include "drv.h"
+#include "drv_generic_graphic.h"
+#include "drv_generic_keypad.h"
+
+/* Numeric constants for 'reportType' parameters */
+#define USB_HID_REPORT_TYPE_INPUT 1
+#define USB_HID_REPORT_TYPE_OUTPUT 2
+#define USB_HID_REPORT_TYPE_FEATURE 3
+
+/* These are the error codes which can be returned by functions of this
+ * module.
+ */
+#define USB_ERROR_NONE 0
+#define USB_ERROR_ACCESS 1
+#define USB_ERROR_NOTFOUND 2
+#define USB_ERROR_BUSY 16
+#define USB_ERROR_IO 5
+
+/* ------------------------------------------------------------------------ */
+
+#include "glcd2usb.h"
+
+/* ------------------------------------------------------------------------- */
+
+#define USBRQ_HID_GET_REPORT 0x01
+#define USBRQ_HID_SET_REPORT 0x09
+
+usb_dev_handle *dev = NULL;
+
+/* USB message buffer */
+static union {
+ unsigned char bytes[132];
+ display_info_t display_info;
+} buffer;
+
+/* ------------------------------------------------------------------------- */
+
+
+#define IDENT_VENDOR_NUM 0x1c40
+#define IDENT_VENDOR_STRING "www.harbaum.org/till/glcd2usb"
+#define IDENT_PRODUCT_NUM 0x0525
+#define IDENT_PRODUCT_STRING "GLCD2USB"
+
+/* early versions used the ftdi vendor id */
+#define IDENT_VENDOR_NUM_OLD 0x0403
+#define IDENT_PRODUCT_NUM_OLD 0xc634
+
+static char Name[] = IDENT_PRODUCT_STRING;
+
+/* ------------------------------------------------------------------------- */
+
+static int usbGetString(usb_dev_handle * dev, int index, char *buf, int buflen)
+{
+ char buffer[256];
+ int rval, i;
+
+ if ((rval = usb_control_msg(dev, USB_ENDPOINT_IN, USB_REQ_GET_DESCRIPTOR,
+ (USB_DT_STRING << 8) + index, 0x0409, buffer, sizeof(buffer), 1000)) < 0)
+ return rval;
+
+ /* not a string */
+ if (buffer[1] != USB_DT_STRING)
+ return 0;
+
+ /* string would have been longer than buffer is */
+ if ((unsigned char) buffer[0] < rval)
+ rval = (unsigned char) buffer[0];
+
+ /* 16 bit unicode -> 8 bit ascii */
+ rval /= 2;
+
+ /* lossy conversion to ISO Latin1 */
+ for (i = 1; i < rval; i++) {
+ if (i > buflen) /* destination buffer overflow */
+ break;
+
+ buf[i - 1] = buffer[2 * i];
+
+ if (buffer[2 * i + 1] != 0) /* outside of ISO Latin1 range */
+ buf[i - 1] = '?';
+ }
+
+ /* terminate string */
+ buf[i - 1] = 0;
+
+ return i - 1;
+}
+
+/* ------------------------------------------------------------------------- */
+
+int usbOpenDevice(usb_dev_handle ** device, int vendor, char *vendorName, int product, char *productName)
+{
+ struct usb_bus *bus;
+ struct usb_device *dev;
+ usb_dev_handle *handle = NULL;
+ int errorCode = USB_ERROR_NOTFOUND;
+ static int didUsbInit = 0;
+
+ if (!didUsbInit) {
+ usb_init();
+ didUsbInit = 1;
+ }
+
+ usb_find_busses();
+ usb_find_devices();
+
+ for (bus = usb_get_busses(); bus; bus = bus->next) {
+ for (dev = bus->devices; dev; dev = dev->next) {
+ if (dev->descriptor.idVendor == vendor && dev->descriptor.idProduct == product) {
+ char string[256];
+ int len;
+ handle = usb_open(dev); /* we need to open the device in order to query strings */
+ if (!handle) {
+ errorCode = USB_ERROR_ACCESS;
+ error("%s Warning: cannot open USB device: %s", Name, usb_strerror());
+ continue;
+ }
+ if (vendorName == NULL && productName == NULL) { /* name does not matter */
+ break;
+ }
+ /* now check whether the names match: */
+ len = usbGetString(handle, dev->descriptor.iManufacturer, string, sizeof(string));
+ if (len < 0) {
+ errorCode = USB_ERROR_IO;
+ error("%s: Cannot query manufacturer for device: %s", Name, usb_strerror());
+ } else {
+ errorCode = USB_ERROR_NOTFOUND;
+ if (strcmp(string, vendorName) == 0) {
+ len = usbGetString(handle, dev->descriptor.iProduct, string, sizeof(string));
+ if (len < 0) {
+ errorCode = USB_ERROR_IO;
+ fprintf(stderr, "Warning: cannot query product for device: %s\n", usb_strerror());
+ } else {
+ errorCode = USB_ERROR_NOTFOUND;
+ if (strcmp(string, productName) == 0)
+ break;
+ }
+ }
+ }
+ usb_close(handle);
+ handle = NULL;
+ }
+ }
+ if (handle)
+ break;
+ }
+
+ if (handle != NULL) {
+ int rval, retries = 3;
+ if (usb_set_configuration(handle, 1)) {
+ fprintf(stderr, "Warning: could not set configuration: %s\n", usb_strerror());
+ }
+ /* now try to claim the interface and detach the kernel HID driver on
+ * linux and other operating systems which support the call.
+ */
+ while ((rval = usb_claim_interface(handle, 0)) != 0 && retries-- > 0) {
+#ifdef LIBUSB_HAS_DETACH_KERNEL_DRIVER_NP
+ if (usb_detach_kernel_driver_np(handle, 0) < 0) {
+ fprintf(stderr, "Warning: could not detach kernel HID driver: %s\n", usb_strerror());
+ }
+#endif
+ }
+#ifndef __APPLE__
+ if (rval != 0)
+ fprintf(stderr, "Warning: could not claim interface\n");
+#endif
+ /* Continue anyway, even if we could not claim the interface. Control transfers
+ * should still work.
+ */
+ errorCode = 0;
+ *device = handle;
+ }
+ return errorCode;
+}
+
+/* ------------------------------------------------------------------------- */
+
+void usbCloseDevice(usb_dev_handle * device)
+{
+ if (device != NULL)
+ usb_close(device);
+}
+
+/* ------------------------------------------------------------------------- */
+
+int usbSetReport(usb_dev_handle * device, int reportType, unsigned char *buffer, int len)
+{
+ int bytesSent;
+
+ /* the write command needs some tweaking regarding allowed report lengths */
+ if (buffer[0] == GLCD2USB_RID_WRITE) {
+ int i = 0, allowed_lengths[] = { 4 + 4, 8 + 4, 16 + 4, 32 + 4, 64 + 4, 128 + 4 };
+
+ if (len > 128 + 4)
+ error("%s: %d bytes usb report is too long \n", Name, len);
+
+ while (allowed_lengths[i] != (128 + 4) && allowed_lengths[i] < len)
+ i++;
+
+ len = allowed_lengths[i];
+ buffer[0] = GLCD2USB_RID_WRITE + i;
+ }
+
+ bytesSent = usb_control_msg(device, USB_TYPE_CLASS | USB_RECIP_INTERFACE |
+ USB_ENDPOINT_OUT, USBRQ_HID_SET_REPORT,
+ reportType << 8 | buffer[0], 0, (char *) buffer, len, 1000);
+ if (bytesSent != len) {
+ if (bytesSent < 0)
+ error("%s: Error sending message: %s", Name, usb_strerror());
+ return USB_ERROR_IO;
+ }
+ return 0;
+}
+
+/* ------------------------------------------------------------------------- */
+
+int usbGetReport(usb_dev_handle * device, int reportType, int reportNumber, unsigned char *buffer, int *len)
+{
+ *len = usb_control_msg(device, USB_TYPE_CLASS | USB_RECIP_INTERFACE |
+ USB_ENDPOINT_IN, USBRQ_HID_GET_REPORT,
+ reportType << 8 | reportNumber, 0, (char *) buffer, *len, 1000);
+ if (*len < 0) {
+ error("%s: Error sending message: %s", Name, usb_strerror());
+ return USB_ERROR_IO;
+ }
+ return 0;
+}
+
+char *usbErrorMessage(int errCode)
+{
+ static char buffer[80];
+
+ switch (errCode) {
+ case USB_ERROR_ACCESS:
+ return "Access to device denied";
+ case USB_ERROR_NOTFOUND:
+ return "The specified device was not found";
+ case USB_ERROR_BUSY:
+ return "The device is used by another application";
+ case USB_ERROR_IO:
+ return "Communication error with device";
+ default:
+ sprintf(buffer, "Unknown USB error %d", errCode);
+ return buffer;
+ }
+ return NULL; /* not reached */
+}
+
+static char *video_buffer = NULL;
+static char *dirty_buffer = NULL;
+
+static void drv_GLCD2USB_blit(const int row, const int col, const int height, const int width)
+{
+ int r, c, err, i, j;
+
+ /* update offscreen buffer */
+ for (r = row; r < row + height; r++) {
+ for (c = col; c < col + width; c++) {
+ int x, y, bit;
+
+ /* these assignments are display layout dependent */
+ x = c;
+ y = r / 8;
+ bit = r % 8;
+
+ i = video_buffer[x + DCOLS * y];
+
+ if (drv_generic_graphic_black(r, c))
+ video_buffer[x + DCOLS * y] |= 1 << bit;
+ else
+ video_buffer[x + DCOLS * y] &= ~(1 << bit);
+
+ if (video_buffer[x + DCOLS * y] != i)
+ dirty_buffer[x + DCOLS * y] |= 1 << bit;
+ }
+ }
+
+#if 0
+ /* display what's in the buffer (for debugging) */
+ for (r = 0; r < DROWS; r++) {
+ for (c = 0; c < DCOLS; c++) {
+ if (video_buffer[c + DCOLS * (r / 8)] & (1 << (r % 8)))
+ putchar('#');
+ else
+ putchar(' ');
+ }
+ putchar('\n');
+ }
+#endif
+
+ /* short gaps of unchanged bytes in fact increase the communication */
+ /* overhead. so we eliminate them here */
+ for (j = -1, i = 0; i < DROWS * DCOLS / 8; i++) {
+ if (dirty_buffer[i] && j >= 0 && i - j <= 4) {
+ /* found a clean gap <= 4 bytes: mark it dirty */
+ for (r = j; r < i; r++)
+ dirty_buffer[r] = 1;
+ }
+
+ /* if this is dirty, drop the saved position */
+ if (dirty_buffer[i])
+ j = -1;
+
+ /* save position of this clean entry if there's no position saved yet */
+ if (!dirty_buffer[i] && j < 0)
+ j = i;
+ }
+
+ /* and do the actual data transmission */
+ buffer.bytes[0] = 0;
+ for (i = 0; i < DROWS * DCOLS / 8; i++) {
+ if (dirty_buffer[i]) {
+ /* starting a new run? */
+ if (!buffer.bytes[0]) {
+ buffer.bytes[0] = GLCD2USB_RID_WRITE;
+ buffer.bytes[1] = i % 256; // offset
+ buffer.bytes[2] = i / 256;
+ buffer.bytes[3] = 0; // length
+ }
+ buffer.bytes[4 + buffer.bytes[3]++] = video_buffer[i];
+ }
+
+ /* this part of the buffer is not dirty or we are at end */
+ /* of buffer or the buffer is fill: send data then */
+ if ((!dirty_buffer[i]) || (i == DROWS * DCOLS / 8 - 1) || (buffer.bytes[3] == 128)) {
+ /* is there data to be sent in the buffer? */
+ if (buffer.bytes[0] && buffer.bytes[3]) {
+ if ((err = usbSetReport(dev, USB_HID_REPORT_TYPE_FEATURE, buffer.bytes, buffer.bytes[3] + 4)) != 0)
+ error("%s: Error sending display contents: %s", Name, usbErrorMessage(err));
+
+ buffer.bytes[0] = 0;
+ }
+ }
+
+ /* this entry isn't dirty anymore */
+ dirty_buffer[i] = 0;
+ }
+}
+
+static int drv_GLCD2USB_brightness(int brightness)
+{
+ int err = 0;
+
+ printf("setting bright to %d\n", brightness);
+
+ if (brightness < 0)
+ brightness = 0;
+ if (brightness > 255)
+ brightness = 255;
+
+ buffer.bytes[0] = GLCD2USB_RID_SET_BL;
+ buffer.bytes[1] = brightness;
+ if ((err = usbSetReport(dev, USB_HID_REPORT_TYPE_FEATURE, buffer.bytes, 2)) != 0) {
+ error("%s: Error freeing display: %s\n", Name, usbErrorMessage(err));
+ usbCloseDevice(dev);
+ return -1;
+ }
+
+ return brightness;
+}
+
+static void drv_GLCD2USB_timer(void __attribute__ ((unused)) * notused)
+{
+ /* request button state */
+ static unsigned int last_but = 0;
+ int err = 0, len = 2;
+
+ if ((err = usbGetReport(dev, USB_HID_REPORT_TYPE_FEATURE, GLCD2USB_RID_GET_BUTTONS, buffer.bytes, &len)) != 0) {
+ fprintf(stderr, "Error getting button state: %s\n", usbErrorMessage(err));
+ return;
+ }
+
+ int i;
+
+ /* check if button state changed */
+ if (buffer.bytes[1] ^ last_but) {
+
+ /* send single keypad events for all changed buttons */
+ for (i = 0; i < 4; i++)
+ if ((buffer.bytes[1] & (1 << i)) ^ (last_but & (1 << i)))
+ drv_generic_keypad_press(((buffer.bytes[1] & (1 << i)) ? 0x80 : 0) | i);
+ }
+
+ last_but = buffer.bytes[1];
+}
+
+static int drv_GLCD2USB_start(const char *section)
+{
+ int brightness;
+ char *s;
+ int err = 0, len;
+
+ if (sscanf(s = cfg_get(section, "font", "6x8"), "%dx%d", &XRES, &YRES) != 2 || XRES < 1 || YRES < 1) {
+ error("%s: bad %s.Font '%s' from %s", Name, section, s, cfg_source());
+ free(s);
+ return -1;
+ }
+ free(s);
+
+ if ((err = usbOpenDevice(&dev, IDENT_VENDOR_NUM, IDENT_VENDOR_STRING,
+ IDENT_PRODUCT_NUM, IDENT_PRODUCT_STRING)) != 0) {
+ if ((err = usbOpenDevice(&dev, IDENT_VENDOR_NUM_OLD, IDENT_VENDOR_STRING,
+ IDENT_PRODUCT_NUM_OLD, IDENT_PRODUCT_STRING)) != 0) {
+ error("%s: opening GLCD2USB device: %s", Name, usbErrorMessage(err));
+ return -1;
+ }
+ }
+
+ info("%s: Found device", Name);
+
+ /* query display parameters */
+ memset(&buffer, 0, sizeof(buffer));
+
+ len = sizeof(display_info_t);
+ if ((err = usbGetReport(dev, USB_HID_REPORT_TYPE_FEATURE, GLCD2USB_RID_GET_INFO, buffer.bytes, &len)) != 0) {
+
+ error("%s: query display parameters: %s", Name, usbErrorMessage(err));
+ usbCloseDevice(dev);
+ return -1;
+ }
+
+ if (len < (int) sizeof(buffer.display_info)) {
+ error("%s: Not enough bytes in display info report (%d instead of %d)",
+ Name, len, (int) sizeof(buffer.display_info));
+ usbCloseDevice(dev);
+ return -1;
+ }
+
+ info("%s: display name = %s", Name, buffer.display_info.name);
+ info("%s: display resolution = %d * %d", Name, buffer.display_info.width, buffer.display_info.height);
+ info("%s: display flags: %x", Name, buffer.display_info.flags);
+
+ /* TODO: check for supported features */
+
+
+ /* save display size */
+ DCOLS = buffer.display_info.width;
+ DROWS = buffer.display_info.height;
+
+ /* allocate a offscreen buffer */
+ video_buffer = malloc(DCOLS * DROWS / 8);
+ dirty_buffer = malloc(DCOLS * DROWS / 8);
+ memset(video_buffer, 0, DCOLS * DROWS / 8);
+ memset(dirty_buffer, 0, DCOLS * DROWS / 8);
+
+ /* get access to display */
+ buffer.bytes[0] = GLCD2USB_RID_SET_ALLOC;
+ buffer.bytes[1] = 1; /* 1=alloc, 0=free */
+ if ((err = usbSetReport(dev, USB_HID_REPORT_TYPE_FEATURE, buffer.bytes, 2)) != 0) {
+ error("%s: Error allocating display: %s", Name, usbErrorMessage(err));
+ usbCloseDevice(dev);
+ return -1;
+ }
+
+ /* regularly request key state. can be quite slow since the device */
+ /* buffers button presses internally */
+ timer_add(drv_GLCD2USB_timer, NULL, 100, 0);
+
+ if (cfg_number(section, "Brightness", 0, 0, 255, &brightness) > 0) {
+ drv_GLCD2USB_brightness(brightness);
+ }
+
+ return 0;
+}
+
+
+
+/****************************************/
+/*** plugins ***/
+/****************************************/
+
+static void plugin_brightness(RESULT * result, RESULT * arg1)
+{
+ double brightness;
+
+ brightness = drv_GLCD2USB_brightness(R2N(arg1));
+ SetResult(&result, R_NUMBER, &brightness);
+}
+
+/****************************************/
+/*** widget callbacks ***/
+/****************************************/
+
+
+/* using drv_generic_graphic_draw(W) */
+/* using drv_generic_graphic_icon_draw(W) */
+/* using drv_generic_graphic_bar_draw(W) */
+
+
+/****************************************/
+/*** exported functions ***/
+/****************************************/
+
+
+/* list models */
+int drv_GLCD2USB_list(void)
+{
+ printf("GLCD2USB homebrew USB interface for graphic displays");
+ return 0;
+}
+
+static int drv_GLCD2USB_keypad(const int num)
+{
+ const int keys[] = { WIDGET_KEY_LEFT, WIDGET_KEY_RIGHT,
+ WIDGET_KEY_CONFIRM, WIDGET_KEY_CANCEL
+ };
+
+ int val;
+
+ /* check for key press event */
+ if (num & 0x80)
+ val = WIDGET_KEY_PRESSED;
+ else
+ val = WIDGET_KEY_RELEASED;
+
+ return val | keys[num & 0x03];
+}
+
+/* initialize driver & display */
+int drv_GLCD2USB_init(const char *section, const __attribute__ ((unused))
+ int quiet)
+{
+ int ret;
+
+ info("%s: %s", Name, "$Rev: 1144 $");
+
+ /* real worker functions */
+ drv_generic_graphic_real_blit = drv_GLCD2USB_blit;
+ drv_generic_keypad_real_press = drv_GLCD2USB_keypad;
+
+ /* start display */
+ if ((ret = drv_GLCD2USB_start(section)) != 0)
+ return ret;
+
+ /* initialize generic graphic driver */
+ if ((ret = drv_generic_graphic_init(section, Name)) != 0)
+ return ret;
+
+ /* initialize generic key pad driver */
+ if ((ret = drv_generic_keypad_init(section, Name)) != 0)
+ return ret;
+
+ /* register plugins */
+ AddFunction("LCD::brightness", 1, plugin_brightness);
+
+ return 0;
+}
+
+
+/* close driver & display */
+int drv_GLCD2USB_quit(const __attribute__ ((unused))
+ int quiet)
+{
+ int err;
+
+ info("%s: shutting down.", Name);
+ drv_generic_graphic_quit();
+
+ drv_generic_keypad_quit();
+
+ /* release access to display */
+
+ buffer.bytes[0] = GLCD2USB_RID_SET_ALLOC;
+ buffer.bytes[1] = 0; /* 1=alloc, 0=free */
+ if ((err = usbSetReport(dev, USB_HID_REPORT_TYPE_FEATURE, buffer.bytes, 2)) != 0) {
+ error("%s Error freeing display: %s", Name, usbErrorMessage(err));
+ }
+
+ /* clean up */
+ if (dev != NULL)
+ usbCloseDevice(dev);
+
+ if (video_buffer != NULL) {
+ free(video_buffer);
+ free(dirty_buffer);
+ }
+
+ return (0);
+}
+
+
+DRIVER drv_GLCD2USB = {
+ .name = Name,
+ .list = drv_GLCD2USB_list,
+ .init = drv_GLCD2USB_init,
+ .quit = drv_GLCD2USB_quit,
+};
diff --git a/drv_HD44780.c b/drv_HD44780.c
new file mode 100644
index 0000000..a9aa11c
--- /dev/null
+++ b/drv_HD44780.c
@@ -0,0 +1,1507 @@
+/* $Id: drv_HD44780.c 1202 2015-06-18 16:44:09Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/drv_HD44780.c $
+ *
+ * new style driver for HD44780-based displays
+ *
+ * Copyright (C) 2003 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * Support for I2C bus
+ * Copyright (C) 2005 Luis Correia <lfcorreia@users.sf.net>
+ *
+ * Modification for 4-Bit mode
+ * Copyright (C) 2003 Martin Hejl (martin@hejl.de)
+ *
+ * Modification for 2nd controller support
+ * Copyright (C) 2003 Jesse Brook Kovach <jkovach@wam.umd.edu>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ *
+ * exported fuctions:
+ *
+ * struct DRIVER drv_HD44780
+ *
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <unistd.h>
+#include <termios.h>
+#include <fcntl.h>
+#include <sys/time.h>
+#include <sys/ioctl.h>
+
+#include "debug.h"
+#include "cfg.h"
+#include "udelay.h"
+#include "qprintf.h"
+#include "timer.h"
+#include "plugin.h"
+#include "widget.h"
+#include "widget_text.h"
+#include "widget_icon.h"
+#include "widget_bar.h"
+#include "widget_keypad.h"
+#include "drv.h"
+#include "drv_generic_text.h"
+#include "drv_generic_gpio.h"
+
+#ifdef WITH_PARPORT
+#include "drv_generic_parport.h"
+#include "drv_generic_keypad.h"
+#include "widget_keypad.h"
+#endif
+
+#ifdef WITH_I2C
+#include "drv_generic_i2c.h"
+#endif
+
+static char Name[] = "HD44780";
+
+static int Bus;
+static int Model;
+static int Capabilities;
+
+
+/* Timings */
+#ifdef WITH_PARPORT
+static int T_CY, T_PW, T_AS, T_AH;
+#endif
+static int T_INIT1, T_INIT2, T_EXEC, T_WRCG, T_CLEAR, T_HOME, T_ONOFF;
+#ifdef WITH_PARPORT
+static int T_POWER, T_GPO_ST, T_GPO_PW;
+#endif
+
+static int Bits = 0;
+static int numControllers = 0;
+static int allControllers = 0;
+static int currController = 0;
+
+/* size of every single controller */
+static int CROWS[4];
+static int CCOLS[4];
+
+static unsigned char SIGNAL_RW;
+static unsigned char SIGNAL_RS;
+static unsigned char SIGNAL_ENABLE;
+static unsigned char SIGNAL_ENABLE2;
+static unsigned char SIGNAL_ENABLE3;
+static unsigned char SIGNAL_ENABLE4;
+
+static unsigned char SIGNAL_GPO;
+#ifdef WITH_PARPORT
+static unsigned char SIGNAL_GPI;
+static unsigned char SIGNAL_BACKLIGHT;
+static unsigned char SIGNAL_POWER;
+#endif
+
+/* maximum time to wait for the busy-flag (in usec) */
+#define MAX_BUSYFLAG_WAIT 10000
+
+/* maximum busy flag errors before falling back to busy-waiting */
+#define MAX_BUSYFLAG_ERRORS 20
+
+/* flag for busy-waiting vs. busy flag checking */
+#ifdef WITH_PARPORT
+static int UseBusy = 0;
+#endif
+
+/* which data bits should have their logic inverted */
+static int invert_data_bits = 0;
+
+/* buffer holding the GPIO state */
+#ifdef WITH_PARPORT
+static unsigned char GPO = 0;
+#endif
+
+typedef struct {
+ int type;
+ char *name;
+ int capabilities;
+} MODEL;
+
+#define CAP_PARPORT (1<<0)
+#define CAP_I2C (1<<1)
+#define CAP_GPO (1<<2)
+#define CAP_BACKLIGHT (1<<3)
+#define CAP_BRIGHTNESS (1<<4)
+#define CAP_BUSY4BIT (1<<5)
+#define CAP_HD66712 (1<<6)
+#define CAP_LCM162 (1<<7)
+#define CAP_GPI (1<<8)
+
+#define BUS_PP CAP_PARPORT
+#define BUS_I2C CAP_I2C
+
+
+static MODEL Models[] = {
+ {0x01, "generic", CAP_PARPORT | CAP_I2C | CAP_GPO | CAP_GPI | CAP_BACKLIGHT},
+ {0x02, "Noritake", CAP_PARPORT | CAP_I2C | CAP_GPO | CAP_BRIGHTNESS},
+ {0x03, "Soekris", CAP_PARPORT | CAP_BUSY4BIT},
+ {0x04, "HD66712", CAP_PARPORT | CAP_I2C | CAP_GPO | CAP_BACKLIGHT | CAP_HD66712},
+ {0x05, "LCM-162", CAP_PARPORT | CAP_LCM162},
+ {0xff, "Unknown", 0}
+};
+
+
+/****************************************/
+/*** generic functions ***/
+/****************************************/
+
+static int (*drv_HD_load) (const char *section);
+static void (*drv_HD_command) (const unsigned char controller, const unsigned char cmd, const unsigned long delay);
+static void (*drv_HD_data) (const unsigned char controller, const char *string, const int len,
+ const unsigned long delay);
+static void (*drv_HD_stop) (void);
+
+
+
+/****************************************/
+/*** parport dependant functions ***/
+/****************************************/
+
+#ifdef WITH_PARPORT
+
+static void drv_HD_PP_busy(const int controller)
+{
+ static unsigned int errors = 0;
+
+ unsigned char enable;
+ unsigned char data = 0xFF;
+ unsigned char busymask;
+ unsigned char ctrlmask;
+ unsigned int counter;
+
+ if (Bits == 8) {
+ busymask = 0x80;
+ } else {
+ /* Since in 4-Bit mode DB0 on the parport is mapped to DB4 on the LCD
+ * (and consequently, DB3 on the partport is mapped to DB7 on the LCD)
+ * we need to listen for DB3 on the parport to go low
+ */
+ busymask = 0x08;
+ }
+
+ ctrlmask = 0x08;
+ while (ctrlmask > 0) {
+
+ if (controller & ctrlmask) {
+
+ enable = 0;
+ if (ctrlmask & 0x01)
+ enable = SIGNAL_ENABLE;
+ else if (ctrlmask & 0x02)
+ enable = SIGNAL_ENABLE2;
+ else if (ctrlmask & 0x04)
+ enable = SIGNAL_ENABLE3;
+ else if (ctrlmask & 0x08)
+ enable = SIGNAL_ENABLE4;
+
+ /* set data-lines to input */
+ drv_generic_parport_direction(1);
+
+ if (Bits == 8) {
+ /* Set RW, clear RS */
+ drv_generic_parport_control(SIGNAL_RW | SIGNAL_RS, SIGNAL_RW);
+ } else {
+ drv_generic_parport_data(SIGNAL_RW ^ invert_data_bits);
+ }
+
+ /* Address set-up time */
+ ndelay(T_AS);
+
+ /* rise ENABLE */
+ if (Bits == 8) {
+ drv_generic_parport_control(enable, enable);
+ } else {
+ drv_generic_parport_data((SIGNAL_RW | enable) ^ invert_data_bits);
+ }
+
+ counter = 0;
+ while (1) {
+ /* read the busy flag */
+ data = drv_generic_parport_read();
+ if ((data & busymask) == 0) {
+ errors = 0;
+ break;
+ }
+
+ /* make sure we don't wait forever
+ * - but only check after 5 iterations
+ * that way, we won't slow down normal mode
+ * (where we don't need the timeout anyway)
+ */
+ counter++;
+
+ if (counter >= 5) {
+ struct timeval now, end;
+
+ if (counter == 5) {
+ /* determine the time when the timeout has expired */
+ gettimeofday(&end, NULL);
+ end.tv_usec += MAX_BUSYFLAG_WAIT;
+ while (end.tv_usec > 1000000) {
+ end.tv_usec -= 1000000;
+ end.tv_sec++;
+ }
+ }
+
+ /* get the current time */
+ gettimeofday(&now, NULL);
+ if (now.tv_sec == end.tv_sec ? now.tv_usec >= end.tv_usec : now.tv_sec >= end.tv_sec) {
+ error("%s: timeout waiting for busy flag on controller %x (0x%02x)", Name, ctrlmask, data);
+ if (++errors >= MAX_BUSYFLAG_ERRORS) {
+ error("%s: too many busy flag failures, turning off busy flag checking.", Name);
+ UseBusy = 0;
+ }
+ break;
+ }
+ }
+ }
+
+ /* RS=low, RW=low, EN=low */
+ if (Bits == 8) {
+ /* Lower EN */
+ drv_generic_parport_control(enable, 0);
+
+ /* Address hold time */
+ ndelay(T_AH);
+
+ drv_generic_parport_control(SIGNAL_RW | SIGNAL_RS, 0);
+ } else {
+ /* Lower EN */
+ drv_generic_parport_data(SIGNAL_RW ^ invert_data_bits);
+ ndelay(T_AH);
+ drv_generic_parport_data(0 ^ invert_data_bits);
+ }
+
+ /* set data-lines to output */
+ drv_generic_parport_direction(0);
+ }
+ ctrlmask >>= 1;
+ }
+}
+
+
+static void drv_HD_PP_nibble(const unsigned char controller, const unsigned char nibble)
+{
+ unsigned char enable;
+
+ /* enable signal: 'controller' is a bitmask */
+ /* bit n .. send to controller #n */
+ /* so we can send a byte to more controllers at the same time! */
+ enable = 0;
+ if (controller & 0x01)
+ enable |= SIGNAL_ENABLE;
+ if (controller & 0x02)
+ enable |= SIGNAL_ENABLE2;
+ if (controller & 0x04)
+ enable |= SIGNAL_ENABLE3;
+ if (controller & 0x08)
+ enable |= SIGNAL_ENABLE4;
+
+ /* clear ENABLE */
+ /* put data on DB1..DB4 */
+ /* nibble already contains RS bit! */
+ drv_generic_parport_data(nibble ^ invert_data_bits);
+
+ /* Address set-up time */
+ ndelay(T_AS);
+
+ /* rise ENABLE */
+ drv_generic_parport_data((nibble | enable) ^ invert_data_bits);
+
+ /* Enable pulse width */
+ ndelay(T_PW);
+
+ /* lower ENABLE */
+ drv_generic_parport_data(nibble ^ invert_data_bits);
+}
+
+
+static void drv_HD_PP_byte(const unsigned char controller, const unsigned char data, const unsigned char RS)
+{
+ /* send high nibble of the data */
+ drv_HD_PP_nibble(controller, ((data >> 4) & 0x0f) | RS);
+
+ /* Make sure we honour T_CY */
+ ndelay(T_CY - T_AS - T_PW);
+
+ /* send low nibble of the data */
+ drv_HD_PP_nibble(controller, (data & 0x0f) | RS);
+}
+
+
+static void drv_HD_PP_command(const unsigned char controller, const unsigned char cmd, const unsigned long delay)
+{
+ unsigned char enable;
+
+ if (UseBusy)
+ drv_HD_PP_busy(controller);
+
+ if (Bits == 8) {
+
+ /* enable signal: 'controller' is a bitmask */
+ /* bit n .. send to controller #n */
+ /* so we can send a byte to more controllers at the same time! */
+ enable = 0;
+ if (controller & 0x01)
+ enable |= SIGNAL_ENABLE;
+ if (controller & 0x02)
+ enable |= SIGNAL_ENABLE2;
+ if (controller & 0x04)
+ enable |= SIGNAL_ENABLE3;
+ if (controller & 0x08)
+ enable |= SIGNAL_ENABLE4;
+
+ /* put data on DB1..DB8 */
+ drv_generic_parport_data(cmd ^ invert_data_bits);
+
+ /* clear RW and RS */
+ drv_generic_parport_control(SIGNAL_RW | SIGNAL_RS, 0);
+
+ /* Address set-up time */
+ ndelay(T_AS);
+
+ /* send command */
+ drv_generic_parport_toggle(enable, 1, T_PW);
+
+ } else {
+
+ drv_HD_PP_byte(controller, cmd, 0);
+
+ }
+
+ /* wait for command completion */
+ if (!UseBusy)
+ udelay(delay);
+
+}
+
+
+static void drv_HD_PP_data(const unsigned char controller, const char *string, const int len, const unsigned long delay)
+{
+ int l = len;
+ unsigned char enable;
+
+ /* sanity check */
+ if (len <= 0)
+ return;
+
+ if (Bits == 8) {
+
+ /* enable signal: 'controller' is a bitmask */
+ /* bit n .. send to controller #n */
+ /* so we can send a byte to more controllers at the same time! */
+ enable = 0;
+ if (controller & 0x01)
+ enable |= SIGNAL_ENABLE;
+ if (controller & 0x02)
+ enable |= SIGNAL_ENABLE2;
+ if (controller & 0x04)
+ enable |= SIGNAL_ENABLE3;
+ if (controller & 0x08)
+ enable |= SIGNAL_ENABLE4;
+
+ if (!UseBusy) {
+ /* clear RW, set RS */
+ drv_generic_parport_control(SIGNAL_RW | SIGNAL_RS, SIGNAL_RS);
+ /* Address set-up time */
+ ndelay(T_AS);
+ }
+
+ while (l--) {
+
+ if (UseBusy) {
+ drv_HD_PP_busy(controller);
+ /* clear RW, set RS */
+ drv_generic_parport_control(SIGNAL_RW | SIGNAL_RS, SIGNAL_RS);
+ /* Address set-up time */
+ ndelay(T_AS);
+ }
+
+ /* put data on DB1..DB8 */
+ drv_generic_parport_data((*(string++)) ^ invert_data_bits);
+
+ /* send command */
+ drv_generic_parport_toggle(enable, 1, T_PW);
+
+ /* wait for command completion */
+ if (!UseBusy)
+ udelay(delay);
+ }
+
+ } else { /* 4 bit mode */
+
+ while (l--) {
+ if (UseBusy)
+ drv_HD_PP_busy(controller);
+
+ /* send data with RS enabled */
+ drv_HD_PP_byte(controller, *(string++), SIGNAL_RS);
+
+ /* wait for command completion */
+ if (!UseBusy)
+ udelay(delay);
+ }
+ }
+}
+
+
+static int drv_HD_PP_load(const char *section)
+{
+ if (cfg_number(section, "Bits", 8, 4, 8, &Bits) < 0)
+ return -1;
+
+ if (Bits != 4 && Bits != 8) {
+ error("%s: bad %s.Bits '%d' from %s, should be '4' or '8'", Name, section, Bits, cfg_source());
+ return -1;
+ }
+
+ /* LCM-162 only supports 8-bit-mode */
+ if (Capabilities & CAP_LCM162 && Bits != 8) {
+ error("%s: Model '%s' does not support %d bit mode!", Name, Models[Model].name, Bits);
+ Bits = 8;
+ }
+ info("%s: using %d bit mode", Name, Bits);
+
+ if (drv_generic_parport_open(section, Name) != 0) {
+ error("%s: could not initialize parallel port!", Name);
+ return -1;
+ }
+
+ /* Soft-Wiring */
+ if (Capabilities & CAP_LCM162) {
+ /* the LCM-162 is hardwired */
+ if ((SIGNAL_RS = drv_generic_parport_hardwire_ctrl("RS", "SLCTIN")) == 0xff)
+ return -1;
+ if ((SIGNAL_RW = drv_generic_parport_hardwire_ctrl("RW", "INIT")) == 0xff)
+ return -1;
+ if ((SIGNAL_ENABLE = drv_generic_parport_hardwire_ctrl("ENABLE", "AUTOFD")) == 0xff)
+ return -1;
+ if ((SIGNAL_ENABLE2 = drv_generic_parport_hardwire_ctrl("ENABLE2", "GND")) == 0xff)
+ return -1;
+ if ((SIGNAL_ENABLE3 = drv_generic_parport_hardwire_ctrl("ENABLE3", "GND")) == 0xff)
+ return -1;
+ if ((SIGNAL_ENABLE4 = drv_generic_parport_hardwire_ctrl("ENABLE4", "GND")) == 0xff)
+ return -1;
+ if ((SIGNAL_BACKLIGHT = drv_generic_parport_hardwire_ctrl("BACKLIGHT", "GND")) == 0xff)
+ return -1;
+ if ((SIGNAL_GPO = drv_generic_parport_hardwire_ctrl("GPO", "GND")) == 0xff)
+ return -1;
+ if ((SIGNAL_POWER = drv_generic_parport_hardwire_ctrl("POWER", "GND")) == 0xff)
+ return -1;
+ } else {
+ if (Bits == 8) {
+ if ((SIGNAL_RS = drv_generic_parport_wire_ctrl("RS", "AUTOFD")) == 0xff)
+ return -1;
+ if ((SIGNAL_RW = drv_generic_parport_wire_ctrl("RW", "GND")) == 0xff)
+ return -1;
+ if ((SIGNAL_ENABLE = drv_generic_parport_wire_ctrl("ENABLE", "STROBE")) == 0xff)
+ return -1;
+ if ((SIGNAL_ENABLE2 = drv_generic_parport_wire_ctrl("ENABLE2", "GND")) == 0xff)
+ return -1;
+ if ((SIGNAL_ENABLE3 = drv_generic_parport_wire_ctrl("ENABLE3", "GND")) == 0xff)
+ return -1;
+ if ((SIGNAL_ENABLE4 = drv_generic_parport_wire_ctrl("ENABLE4", "GND")) == 0xff)
+ return -1;
+ } else {
+ if ((SIGNAL_RS = drv_generic_parport_wire_data("RS", "DB4")) == 0xff)
+ return -1;
+ if ((SIGNAL_RW = drv_generic_parport_wire_data("RW", "DB5")) == 0xff)
+ return -1;
+ if ((SIGNAL_ENABLE = drv_generic_parport_wire_data("ENABLE", "DB6")) == 0xff)
+ return -1;
+ if ((SIGNAL_ENABLE2 = drv_generic_parport_wire_data("ENABLE2", "GND")) == 0xff)
+ return -1;
+ if ((SIGNAL_ENABLE3 = drv_generic_parport_wire_data("ENABLE3", "GND")) == 0xff)
+ return -1;
+ if ((SIGNAL_ENABLE4 = drv_generic_parport_wire_data("ENABLE4", "GND")) == 0xff)
+ return -1;
+ }
+ /* backlight GPO and power are always control signals */
+ if ((SIGNAL_BACKLIGHT = drv_generic_parport_wire_ctrl("BACKLIGHT", "GND")) == 0xff)
+ return -1;
+ if ((SIGNAL_GPO = drv_generic_parport_wire_ctrl("GPO", "GND")) == 0xff)
+ return -1;
+ if ((SIGNAL_GPI = drv_generic_parport_wire_ctrl("GPI", "GND")) == 0xff)
+ return -1;
+ if ((SIGNAL_POWER = drv_generic_parport_wire_ctrl("POWER", "GND")) == 0xff)
+ return -1;
+ }
+
+ /* clear capabilities if corresponding signal is GND */
+ if (SIGNAL_BACKLIGHT == 0) {
+ Capabilities &= ~CAP_BACKLIGHT;
+ }
+ if (SIGNAL_GPO == 0) {
+ Capabilities &= ~CAP_GPO;
+ }
+ if (SIGNAL_GPI == 0) {
+ Capabilities &= ~CAP_GPI;
+ }
+
+ /* Timings */
+
+ /* low level communication timings [nanoseconds]
+ * as these values differ from spec to spec,
+ * we use the worst-case default values, but allow
+ * modification from the config file.
+ */
+ T_CY = timing(Name, section, "CY", 1000, "ns"); /* Enable cycle time */
+ T_PW = timing(Name, section, "PW", 450, "ns"); /* Enable pulse width */
+ T_AS = timing(Name, section, "AS", 140, "ns"); /* Address setup time */
+ T_AH = timing(Name, section, "AH", 20, "ns"); /* Address hold time */
+
+ /* GPO timing */
+ if (SIGNAL_GPO != 0) {
+ T_GPO_ST = timing(Name, section, "GPO_ST", 20, "ns"); /* 74HCT573 set-up time */
+ T_GPO_PW = timing(Name, section, "GPO_PW", 230, "ns"); /* 74HCT573 enable pulse width */
+ } else {
+ T_GPO_ST = 0;
+ T_GPO_PW = 0;
+ }
+
+ /* HD44780 execution timings [microseconds]
+ * as these values differ from spec to spec,
+ * we use the worst-case default values, but allow
+ * modification from the config file.
+ */
+ T_INIT1 = timing(Name, section, "INIT1", 4100, "us"); /* first init sequence: 4.1 msec */
+ T_INIT2 = timing(Name, section, "INIT2", 100, "us"); /* second init sequence: 100 usec */
+ T_EXEC = timing(Name, section, "EXEC", 80, "us"); /* normal execution time */
+ T_WRCG = timing(Name, section, "WRCG", 120, "us"); /* CG RAM Write */
+ T_CLEAR = timing(Name, section, "CLEAR", 2250, "us"); /* Clear Display */
+ T_HOME = timing(Name, section, "HOME", 2250, "us"); /* Return Cursor Home */
+ T_ONOFF = timing(Name, section, "ONOFF", 2250, "us"); /* Display On/Off Control */
+
+ /* Power-on delay */
+ if (SIGNAL_POWER != 0) {
+ T_POWER = timing(Name, section, "POWER", 500, "ms");
+ } else {
+ T_POWER = 0;
+ }
+
+ /* clear all signals */
+ if (Bits == 8) {
+ drv_generic_parport_control(SIGNAL_RS | SIGNAL_RW |
+ SIGNAL_ENABLE | SIGNAL_ENABLE2 | SIGNAL_ENABLE3 | SIGNAL_ENABLE4 |
+ SIGNAL_BACKLIGHT | SIGNAL_GPO | SIGNAL_POWER, 0);
+ } else {
+ drv_generic_parport_control(SIGNAL_BACKLIGHT | SIGNAL_GPO | SIGNAL_POWER, 0);
+ drv_generic_parport_data(0 ^ invert_data_bits);
+ }
+
+ /* set direction: write */
+ drv_generic_parport_direction(0);
+
+ /* raise power pin */
+ if (SIGNAL_POWER != 0) {
+ drv_generic_parport_control(SIGNAL_POWER, SIGNAL_POWER);
+ udelay(1000 * T_POWER);
+ }
+
+ /* initialize *all* controllers */
+ if (Bits == 8) {
+ drv_HD_PP_command(allControllers, 0x30, T_INIT1); /* 8 Bit mode, wait 4.1 ms */
+ drv_HD_PP_command(allControllers, 0x30, T_INIT2); /* 8 Bit mode, wait 100 us */
+ drv_HD_PP_command(allControllers, 0x38, T_EXEC); /* 8 Bit mode, 1/16 duty cycle, 5x8 font */
+ } else {
+ drv_HD_PP_nibble(allControllers, 0x03);
+ udelay(T_INIT1); /* 4 Bit mode, wait 4.1 ms */
+ drv_HD_PP_nibble(allControllers, 0x03);
+ udelay(T_INIT2); /* 4 Bit mode, wait 100 us */
+ drv_HD_PP_nibble(allControllers, 0x03);
+ udelay(T_INIT1); /* 4 Bit mode, wait 4.1 ms */
+ drv_HD_PP_nibble(allControllers, 0x02);
+ udelay(T_INIT2); /* 4 Bit mode, wait 100 us */
+ drv_HD_PP_command(allControllers, 0x28, T_EXEC); /* 4 Bit mode, 1/16 duty cycle, 5x8 font */
+ }
+
+ /* maybe use busy-flag from now on */
+ /* (we can't use the busy flag during the init sequence) */
+ cfg_number(section, "UseBusy", 0, 0, 1, &UseBusy);
+
+ /* make sure we don't use the busy flag with RW wired to GND */
+ if (UseBusy && !SIGNAL_RW) {
+ error("%s: busy-flag checking is impossible with RW wired to GND!", Name);
+ UseBusy = 0;
+ }
+
+ /* make sure the display supports busy-flag checking in 4-Bit-Mode */
+ /* at the moment this is inly possible with Martin Hejl's gpio driver, */
+ /* which allows to use 4 bits as input and 4 bits as output */
+ if (UseBusy && Bits == 4 && !(Capabilities & CAP_BUSY4BIT)) {
+ error("%s: Model '%s' does not support busy-flag checking in 4 bit mode", Name, Models[Model].name);
+ UseBusy = 0;
+ }
+
+ info("%s: %susing busy-flag checking", Name, UseBusy ? "" : "not ");
+
+ /* The LCM-162 should really use BusyFlag checking */
+ if (!UseBusy && (Capabilities & CAP_LCM162)) {
+ error("%s: Model '%s' should definitely use busy-flag checking!", Name, Models[Model].name);
+ }
+
+ return 0;
+}
+
+
+static void drv_HD_PP_stop(void)
+{
+ /* clear all signals */
+ if (Bits == 8) {
+ drv_generic_parport_control(SIGNAL_RS |
+ SIGNAL_RW | SIGNAL_ENABLE | SIGNAL_ENABLE2 | SIGNAL_ENABLE3 | SIGNAL_ENABLE4 |
+ SIGNAL_BACKLIGHT | SIGNAL_GPO, 0);
+ } else {
+ drv_generic_parport_data(0 ^ invert_data_bits);
+ drv_generic_parport_control(SIGNAL_BACKLIGHT | SIGNAL_GPO | SIGNAL_POWER, 0);
+ }
+
+ drv_generic_parport_close();
+
+}
+
+#endif
+
+
+#ifdef WITH_I2C
+
+/****************************************/
+/*** i2c dependant functions ***/
+/****************************************/
+
+ /*
+ DISCLAIMER!!!!
+
+ The following code is WORK IN PROGRESS, since it basicly 'works for us...'
+
+ (C) 2005 Paul Kamphuis & Luis Correia
+
+ We have removed all of the delays from this code, as the I2C bus is slow enough...
+ (maximum possible speed is 100KHz only)
+
+ */
+
+static void drv_HD_I2C(unsigned char controller, unsigned char byte, int rs, int rw)
+{
+ unsigned char enable;
+ unsigned char command = 0; /* this is actually the first data byte on the PCF8574 */
+ unsigned char data_block[2];
+ /* enable signal: 'controller' is a bitmask */
+ /* bit n .. send to controller #n */
+ /* so we can send a byte to more controllers at the same time! */
+ enable = 0;
+ if (controller & 0x01)
+ enable |= SIGNAL_ENABLE;
+ if (controller & 0x02)
+ enable |= SIGNAL_ENABLE2;
+ if (controller & 0x04)
+ enable |= SIGNAL_ENABLE3;
+ if (controller & 0x08)
+ enable |= SIGNAL_ENABLE4;
+
+ /*
+ The new method Paul Kamphuis has concocted places the 3 needed writes to the I2C device
+ as a single operation, using the 'i2c_smbus_write_block_data' function.
+ These actual writes are performed by putting the nibble along with the 'EN' signal.
+
+ command = first byte to be written, which contains the nibble (DB0..DB3)
+ data [0] = second byte to be written, which contains the nibble plus the EN signal
+ data [1] = third byte to be written, which contains the nibble (DB0..DB3)
+
+ Then we write the block as a whole.
+
+ The main advantage we see is that we do 2 less IOCTL's from our driver.
+ */
+
+ if (Bits == 4) {
+ if (rw)
+ byte |= SIGNAL_RW;
+ if (rs)
+ byte |= SIGNAL_RS;
+ command = byte;
+ data_block[0] = byte | enable;
+ data_block[1] = byte;
+
+ } else if (Bits == 8) {
+ if (rw)
+ command |= SIGNAL_RW;
+ if (rs)
+ command |= SIGNAL_RS;
+
+ data_block[0] = byte;
+ data_block[1] = enable;
+ }
+
+ drv_generic_i2c_command(command, data_block, 2, Bits);
+}
+
+
+static void drv_HD_I2C_byte(const unsigned char controller, const unsigned char data)
+{
+ /* send data with RS enabled */
+ if (Bits == 4) {
+ drv_HD_I2C(controller, ((data >> 4) & 0x0f), 1, 0);
+ drv_HD_I2C(controller, (data & 0x0f), 1, 0);
+ } else if (Bits == 8) {
+ drv_HD_I2C(controller, data, 1, 0);
+ }
+}
+
+
+static void drv_HD_I2C_command(const unsigned char controller, const unsigned char cmd, __attribute__ ((unused))
+ const unsigned long delay)
+{
+ /* send command data with RS disabled */
+ if (Bits == 4) {
+ drv_HD_I2C(controller, ((cmd >> 4) & 0x0f), 0, 0);
+ drv_HD_I2C(controller, ((cmd) & 0x0f), 0, 0);
+ } else if (Bits == 8) {
+ drv_HD_I2C(controller, cmd, 0, 0);
+ }
+}
+
+static void drv_HD_I2C_data(const unsigned char controller, const char *string, const int len, __attribute__ ((unused))
+ const unsigned long delay)
+{
+ int l = len;
+
+ /* sanity check */
+ if (len <= 0)
+ return;
+
+ while (l--) {
+ drv_HD_I2C_byte(controller, *(string++));
+ }
+}
+
+
+static int drv_HD_I2C_load(const char *section)
+{
+ if (cfg_number(section, "Bits", 8, 4, 8, &Bits) < 0)
+ return -1;
+
+ info("%s: using %d bit mode", Name, Bits);
+
+ if (Bits != 4 && Bits != 8) {
+ error("%s: bad %s.Bits '%d' from %s, should be '4' or '8'", Name, section, Bits, cfg_source());
+ return -1;
+ }
+
+ if (drv_generic_i2c_open(section, Name) != 0) {
+ error("%s: could not initialize i2c attached device!", Name);
+ return -1;
+ }
+
+ if ((SIGNAL_RS = drv_generic_i2c_wire("RS", "DB4")) == 0xff)
+ return -1;
+ if ((SIGNAL_RW = drv_generic_i2c_wire("RW", "DB5")) == 0xff)
+ return -1;
+ if ((SIGNAL_ENABLE = drv_generic_i2c_wire("ENABLE", "DB6")) == 0xff)
+ return -1;
+ if ((SIGNAL_ENABLE2 = drv_generic_i2c_wire("ENABLE2", "GND")) == 0xff)
+ return -1;
+ if ((SIGNAL_GPO = drv_generic_i2c_wire("GPO", "GND")) == 0xff)
+ return -1;
+
+ if (Bits == 4) {
+ /* initialize display */
+ drv_HD_I2C(allControllers, 0x02, 0, 0);
+ udelay(T_INIT1); /* 4 Bit mode, wait 4.1 ms */
+ drv_HD_I2C(allControllers, 0x03, 0, 0);
+ udelay(T_INIT2); /* 4 Bit mode, wait 100 us */
+ drv_HD_I2C(allControllers, 0x03, 0, 0);
+ udelay(T_INIT1); /* 4 Bit mode, wait 4.1 ms */
+ drv_HD_I2C(allControllers, 0x02, 0, 0);
+ udelay(T_INIT2); /* 4 Bit mode, wait 100 us */
+ drv_HD_I2C_command(allControllers, 0x28, T_EXEC); /* 4 Bit mode, 1/16 duty cycle, 5x8 font */
+ } else if (Bits == 8) {
+ drv_HD_I2C(allControllers, 0x30, 0, 0); /* 8 Bit mode, wait 4.1 ms */
+ udelay(T_INIT1); /* 8 Bit mode, wait 4.1 ms */
+ drv_HD_I2C(allControllers, 0x30, 0, 0); /* 8 Bit mode, wait 100 us */
+ udelay(T_INIT2); /* 8 Bit mode, wait 4.1 ms */
+ drv_HD_I2C_command(allControllers, 0x38, T_EXEC); /* 8 Bit mode, 1/16 duty cycle, 5x8 font */
+ }
+
+ info("%s: I2C initialization done", Name);
+
+ return 0;
+}
+
+
+static void drv_HD_I2C_stop(void)
+{
+ /* clear all signals */
+ drv_generic_i2c_data(0);
+
+ /* close port */
+ drv_generic_i2c_close();
+}
+
+/* END OF DISCLAIMER */
+
+#endif /* WITH_I2C */
+
+
+/****************************************/
+/*** display dependant functions ***/
+/****************************************/
+
+static void drv_HD_clear(void)
+{
+ drv_HD_command(allControllers, 0x01, T_CLEAR); /* clear *all* displays */
+}
+
+
+static int drv_HD_goto(int row, int col)
+{
+ int pos, controller;
+
+ /* handle multiple controllers */
+ for (pos = 0, controller = 0; controller < numControllers; controller++) {
+ pos += CROWS[controller];
+ if (row < pos) {
+ currController = (1 << controller);
+ break;
+ }
+ row -= CROWS[controller];
+ }
+
+ /* column outside of current display's width */
+ if (col >= CCOLS[controller])
+ return -1;
+
+ if (0) {
+ debug("goto: [%d,%d] mask=%d, controller=%d, size:%dx%d", row, col, currController, controller,
+ CROWS[controller], CCOLS[controller]);
+ }
+
+ /* 16x1 Displays are organized as 8x2 :-( */
+ if (CCOLS[controller] == 16 && CROWS[controller] == 1 && col > 7) {
+ row++;
+ col -= 8;
+ }
+
+ if (Capabilities & CAP_HD66712) {
+ /* the HD66712 doesn't have a braindamadged RAM layout */
+ pos = row * 32 + col;
+ } else {
+ /* 16x4 Controllers use a slightly different layout */
+ if (CCOLS[controller] == 16 && CROWS[controller] == 4) {
+ pos = (row % 2) * 64 + (row / 2) * 16 + col;
+ } else {
+ pos = (row % 2) * 64 + (row / 2) * 20 + col;
+ }
+ }
+ drv_HD_command(currController, (0x80 | pos), T_EXEC);
+
+ /* return columns left on current display */
+ return CCOLS[controller] - col;
+
+}
+
+
+static void drv_HD_write(const int row, const int col, const char *data, const int len)
+{
+ int space = drv_HD_goto(row, col);
+ if (space > 0) {
+ drv_HD_data(currController, data, len > space ? space : len, T_EXEC);
+ }
+}
+
+
+static void drv_HD_defchar(const int ascii, const unsigned char *matrix)
+{
+ int i;
+ char buffer[8];
+
+ for (i = 0; i < 8; i++) {
+ buffer[i] = matrix[i] & 0x1f;
+ }
+
+ /* define chars on *all* controllers! */
+ drv_HD_command(allControllers, 0x40 | 8 * ascii, T_EXEC);
+ drv_HD_data(allControllers, buffer, 8, T_WRCG);
+}
+
+
+#ifdef WITH_PARPORT
+
+static int drv_HD_backlight(int backlight)
+{
+ if (!(Capabilities & CAP_BACKLIGHT))
+ return -1;
+
+ if (backlight < 0)
+ backlight = 0;
+ if (backlight > 1)
+ backlight = 1;
+
+ drv_generic_parport_control(SIGNAL_BACKLIGHT, backlight ? SIGNAL_BACKLIGHT : 0);
+
+ return backlight;
+}
+
+#endif
+
+
+static int drv_HD_brightness(int brightness)
+{
+ char cmd;
+
+ if (!(Capabilities & CAP_BRIGHTNESS))
+ return -1;
+
+ if (brightness < 0)
+ brightness = 0;
+ if (brightness > 3)
+ brightness = 3;
+
+ cmd = '0' + brightness;
+
+ drv_HD_command(allControllers, 0x38, T_EXEC); /* enable function */
+ drv_HD_data(allControllers, &cmd, 1, T_WRCG); /* set brightness */
+
+ return brightness;
+}
+
+
+#ifdef WITH_PARPORT
+
+static int drv_HD_GPO(const int num, const int val)
+{
+ int v;
+
+ if (val > 0) {
+ /* set bit */
+ v = 1;
+ GPO |= 1 << num;
+ } else {
+ /* clear bit */
+ v = 0;
+ GPO &= ~(1 << num);
+ }
+
+ /* put data on DB1..DB8 */
+ drv_generic_parport_data(GPO ^ invert_data_bits);
+
+ /* 74HCT573 set-up time */
+ ndelay(T_GPO_ST);
+
+ /* send data */
+ /* 74HCT573 enable pulse width */
+ drv_generic_parport_toggle(SIGNAL_GPO, 1, T_GPO_PW);
+
+ return v;
+}
+
+static int drv_HD_GPI(const int num)
+{
+ int v;
+
+ /* switch to read mode */
+ drv_generic_parport_direction(1);
+ drv_generic_parport_control(SIGNAL_GPI, SIGNAL_GPI);
+
+ /* 74HCT573 set-up time + enable pulse width */
+ ndelay(T_GPO_ST + T_GPO_PW);
+
+ /* read data from DB1..DB8 */
+ v = drv_generic_parport_read() ^ invert_data_bits;
+
+ /* switch back to write mode */
+ drv_generic_parport_control(SIGNAL_GPI, 0);
+ drv_generic_parport_direction(0);
+
+ return (v >> num) & 1;
+}
+
+#endif
+
+
+#ifdef WITH_PARPORT
+
+
+static int drv_HD_LCM162_keypad_handler(const int num)
+{
+ return num;
+}
+
+static void drv_HD_LCM162_timer(void __attribute__ ((unused)) * notused)
+{
+ static unsigned char data = 0x00;
+
+ /* Bit 3+5 : key number */
+ /* Bit 6 : key press/release */
+ unsigned char mask3 = 1 << 3;
+ unsigned char mask5 = 1 << 5;
+ unsigned char mask6 = 1 << 6;
+ unsigned char mask = mask3 | mask5 | mask6;
+
+ int keynum;
+ int updown;
+
+ unsigned char temp;
+
+ temp = drv_generic_parport_status() & mask;
+
+ if (data != temp) {
+ data = temp;
+
+ int KEYPAD_VAL = 0;
+ keynum = (data & mask3 ? 1 : 0) + (data & mask5 ? 2 : 0);
+ switch (keynum) {
+ default:
+ case 0:
+ KEYPAD_VAL = WIDGET_KEY_CANCEL;
+ break;
+ case 1:
+ KEYPAD_VAL = WIDGET_KEY_UP;
+ break;
+ case 2:
+ KEYPAD_VAL = WIDGET_KEY_CONFIRM;
+ break;
+ case 3:
+ KEYPAD_VAL = WIDGET_KEY_DOWN;
+ break;
+ }
+
+ updown = (data & mask6 ? 1 : 0);
+ KEYPAD_VAL += updown ? WIDGET_KEY_PRESSED : WIDGET_KEY_RELEASED;
+
+ drv_generic_keypad_press(KEYPAD_VAL);
+
+ debug("key %d press %d", keynum, updown);
+ }
+}
+
+#endif
+
+
+static int drv_HD_start(const char *section, const int quiet)
+{
+ char *model, *size, *bus;
+ int rows = -1, cols = -1, gpos = -1, gpis = -1, i;
+ int size_defined = 0;
+ int size_missing = 0;
+
+ model = cfg_get(section, "Model", "generic");
+ if (model != NULL && *model != '\0') {
+ int i;
+ for (i = 0; Models[i].type != 0xff; i++) {
+ if (strcasecmp(Models[i].name, model) == 0)
+ break;
+ }
+ if (Models[i].type == 0xff) {
+ error("%s: %s.Model '%s' is unknown from %s", Name, section, model, cfg_source());
+ return -1;
+ }
+ Model = i;
+ Capabilities = Models[Model].capabilities;
+ info("%s: using model '%s'", Name, Models[Model].name);
+ } else {
+ error("%s: empty '%s.Model' entry from %s", Name, section, cfg_source());
+ free(model);
+ return -1;
+ }
+ free(model);
+
+ bus = cfg_get(section, "Bus", "parport");
+ if (bus == NULL && *bus == '\0') {
+ error("%s: empty '%s.Bus' entry from %s", Name, section, cfg_source());
+ free(bus);
+ return -1;
+ }
+
+ if (strcasecmp(bus, "parport") == 0) {
+
+#ifdef WITH_PARPORT
+ info("%s: using parallel port", Name);
+ Bus = BUS_PP;
+ drv_HD_load = drv_HD_PP_load;
+ drv_HD_command = drv_HD_PP_command;
+ drv_HD_data = drv_HD_PP_data;
+ drv_HD_stop = drv_HD_PP_stop;
+#else
+ error("%s: %s.Bus '%s' from %s not available:", Name, section, bus, cfg_source());
+ error("%s: lcd4linux was compiled without parport support!", Name);
+ free(bus);
+ return -1;
+#endif
+
+ } else if (strcasecmp(bus, "i2c") == 0) {
+
+#ifdef WITH_I2C
+ info("%s: using I2C bus", Name);
+ Bus = BUS_I2C;
+ drv_HD_load = drv_HD_I2C_load;
+ drv_HD_command = drv_HD_I2C_command;
+ drv_HD_data = drv_HD_I2C_data;
+ drv_HD_stop = drv_HD_I2C_stop;
+#else
+ error("%s: %s.Bus '%s' from %s not available:", Name, section, bus, cfg_source());
+ error("%s: lcd4linux was compiled without i2c support!", Name);
+ free(bus);
+ return -1;
+#endif
+
+ } else {
+ error("%s: bad %s.Bus '%s' from %s, should be 'parport' or 'i2c'", Name, section, bus, cfg_source());
+ free(bus);
+ return -1;
+ }
+
+ /* sanity check: Model can use bus */
+ if (!(Capabilities & Bus)) {
+ error("%s: Model '%s' cannot be used on the %s bus!", Name, Models[Model].name, bus);
+ free(bus);
+ return -1;
+ }
+ free(bus);
+
+ if (cfg_number(section, "Controllers", 1, 1, 4, (int *) &numControllers) < 0)
+ return -1;
+ info("%s: using %d Controller(s)", Name, numControllers);
+
+ /* current Controller */
+ currController = 1;
+
+ /* Bitmask for *all* Controllers */
+ allControllers = (1 << numControllers) - 1;
+
+
+ DCOLS = 0;
+ DROWS = 0;
+
+ for (i = 0; i < numControllers; i++) {
+ char key[6];
+ qprintf(key, sizeof(key), "Size%d", i + 1);
+ size = cfg_get(section, key, NULL);
+ if (size == NULL || *size == '\0') {
+ size_missing++;
+ free(size);
+ continue;
+ }
+ if (sscanf(size, "%dx%d", &cols, &rows) != 2 || rows < 1 || cols < 1) {
+ error("%s: bad %s.%s '%s' from %s", Name, section, key, size, cfg_source());
+ free(size);
+ return -1;
+ }
+ free(size);
+ CCOLS[i] = cols;
+ CROWS[i] = rows;
+ size_defined++;
+ info("%s: Controller %d: %dx%d", Name, i + 1, cols, rows);
+ /* grow the size */
+ if (cols > DCOLS)
+ DCOLS = cols;
+ DROWS += rows;
+ }
+ if (size_defined && size_missing) {
+ error("%s: bad %s.Size* definition in %s:", Name, section, cfg_source());
+ error("%s: either you specify the size for *all* controllers or for none.", Name);
+ return -1;
+ }
+
+ size = cfg_get(section, "Size", NULL);
+ if (size != NULL && *size != '\0') {
+ if (sscanf(size, "%dx%d", &cols, &rows) != 2 || rows < 1 || cols < 1) {
+ error("%s: bad %s.Size '%s' from %s", Name, section, size, cfg_source());
+ free(size);
+ return -1;
+ }
+ if (DCOLS == 0 && DROWS == 0) {
+ for (i = 0; i < numControllers; i++) {
+ CCOLS[i] = cols;
+ CROWS[i] = rows / numControllers;
+ DCOLS = CCOLS[i];
+ DROWS += CROWS[i];
+ }
+ }
+ if (rows != DROWS || cols != DCOLS) {
+ error("%s: bad %s.Size definition in %s:", Name, section, cfg_source());
+ error("%s: Size %dx%d should be %dx%d", Name, cols, rows, DCOLS, DROWS);
+ return -1;
+ }
+ }
+ free(size);
+
+
+ if (cfg_number(section, "GPOs", 0, 0, 8, &gpos) < 0)
+ return -1;
+ if (gpos > 0 && !(Capabilities & CAP_GPO)) {
+ error("%s: Model '%s' does not support GPO's!", Name, Models[Model].name);
+ gpos = 0;
+ }
+ GPOS = gpos;
+ if (GPOS > 0) {
+ info("%s: using %d GPO's", Name, GPOS);
+ }
+
+ if (cfg_number(section, "GPIs", 0, 0, 8, &gpis) < 0)
+ return -1;
+ if (gpis > 0 && !(Capabilities & CAP_GPI)) {
+ error("%s: Model '%s' does not support GPI's!", Name, Models[Model].name);
+ gpis = 0;
+ }
+ GPIS = gpis;
+ if (GPIS > 0) {
+ info("%s: using %d GPI's", Name, GPIS);
+ }
+
+ if (cfg_number(section, "InvertDataBits", 0, 0, 256, &invert_data_bits) < 0)
+ return -1;
+ if (invert_data_bits) {
+ info("%s: inverting data bits (mask %02X)", Name, invert_data_bits);
+ }
+
+ if (drv_HD_load(section) < 0) {
+ error("%s: start display failed!", Name);
+ return -1;
+ }
+
+ drv_HD_command(allControllers, 0x08, T_EXEC); /* Controller off, cursor off, blink off */
+ drv_HD_command(allControllers, 0x0c, T_ONOFF); /* Display on, cursor off, blink off, wait 1.64 ms */
+ drv_HD_command(allControllers, 0x06, T_EXEC); /* curser moves to right, no shift */
+
+ if ((Capabilities & CAP_HD66712) && DROWS > 2) {
+ drv_HD_command(allControllers, Bits == 8 ? 0x3c : 0x2c, T_EXEC); /* set extended register enable bit */
+ drv_HD_command(allControllers, 0x09, T_EXEC); /* set 4-line mode */
+ drv_HD_command(allControllers, Bits == 8 ? 0x38 : 0x28, T_EXEC); /* clear extended register enable bit */
+ }
+
+ drv_HD_clear(); /* clear *all* displays */
+ drv_HD_command(allControllers, 0x03, T_HOME); /* return home */
+
+ /* maybe set backlight */
+#ifdef WITH_PARPORT
+ if (Capabilities & CAP_BACKLIGHT) {
+ int backlight;
+ if (cfg_number(section, "Backlight", 0, 0, 1, &backlight) > 0) {
+ info("%s: backlight %s", Name, backlight ? "enabled" : "disabled");
+ drv_HD_backlight(backlight);
+ }
+ }
+#endif
+
+ /* maybe set brightness */
+ if (Capabilities & CAP_BRIGHTNESS) {
+ int brightness;
+ if (cfg_number(section, "Brightness", 0, 0, 3, &brightness) > 0) {
+ info("%s: brightness level %d", Name, brightness);
+ drv_HD_brightness(brightness);
+ }
+ }
+
+ /* install keypad polling timer for LCM-162 */
+#ifdef WITH_PARPORT
+ if (Capabilities & CAP_LCM162) {
+ timer_add(drv_HD_LCM162_timer, NULL, 10, 0);
+ drv_generic_keypad_real_press = drv_HD_LCM162_keypad_handler;
+ }
+#endif
+
+ if (!quiet) {
+ char buffer[40];
+ qprintf(buffer, sizeof(buffer), "%s %dx%d", Name, DCOLS, DROWS);
+ if (drv_generic_text_greet(buffer, NULL)) {
+ sleep(3);
+ drv_HD_clear();
+ }
+ }
+
+ return 0;
+}
+
+
+/****************************************/
+/*** plugins ***/
+/****************************************/
+
+
+#ifdef WITH_PARPORT
+static void plugin_backlight(RESULT * result, RESULT * arg1)
+{
+ double backlight;
+
+ backlight = drv_HD_backlight(R2N(arg1));
+ SetResult(&result, R_NUMBER, &backlight);
+}
+#endif
+
+static void plugin_brightness(RESULT * result, RESULT * arg1)
+{
+ double brightness;
+
+ brightness = drv_HD_brightness(R2N(arg1));
+ SetResult(&result, R_NUMBER, &brightness);
+}
+
+
+/****************************************/
+/*** widget callbacks ***/
+/****************************************/
+
+
+/* using drv_generic_text_draw(W) */
+/* using drv_generic_text_icon_draw(W) */
+/* using drv_generic_text_bar_draw(W) */
+/* using drv_generic_gpio_draw(W) */
+
+
+/****************************************/
+/*** exported functions ***/
+/****************************************/
+
+
+/* list models */
+int drv_HD_list(void)
+{
+ int i;
+
+ for (i = 0; Models[i].type != 0xff; i++) {
+ printf("%s ", Models[i].name);
+ }
+ return 0;
+}
+
+
+/* initialize driver & display */
+int drv_HD_init(const char *section, const int quiet)
+{
+ WIDGET_CLASS wc;
+ int asc255bug;
+ int ret;
+
+ info("%s: %s", Name, "$Rev: 1202 $");
+
+ /* display preferences */
+ XRES = 5; /* pixel width of one char */
+ YRES = 8; /* pixel height of one char */
+ CHARS = 8; /* number of user-defineable characters */
+ CHAR0 = 0; /* ASCII of first user-defineable char */
+ GOTO_COST = 1; /* number of bytes a goto command requires */
+
+ /* real worker functions */
+ drv_generic_text_real_write = drv_HD_write;
+ drv_generic_text_real_defchar = drv_HD_defchar;
+#ifdef WITH_PARPORT
+ drv_generic_gpio_real_set = drv_HD_GPO;
+ drv_generic_gpio_real_get = drv_HD_GPI;
+#endif
+
+ /* start display */
+ if ((ret = drv_HD_start(section, quiet)) != 0)
+ return ret;
+
+ /* initialize generic text driver */
+ if ((ret = drv_generic_text_init(section, Name)) != 0)
+ return ret;
+
+ /* initialize generic icon driver */
+ if ((ret = drv_generic_text_icon_init()) != 0)
+ return ret;
+
+ /* initialize generic bar driver */
+ if ((ret = drv_generic_text_bar_init(0)) != 0)
+ return ret;
+
+ /* add fixed chars to the bar driver */
+ /* most displays have a full block on ascii 255, but some have kind of */
+ /* an 'inverted P'. If you specify 'asc255bug 1 in the config, this */
+ /* char will not be used, but rendered by the bar driver */
+ cfg_number(section, "asc255bug", 0, 0, 1, &asc255bug);
+ drv_generic_text_bar_add_segment(0, 0, 255, 32); /* ASCII 32 = blank */
+ if (!asc255bug)
+ drv_generic_text_bar_add_segment(255, 255, 255, 255); /* ASCII 255 = block */
+
+ /* initialize generic GPIO driver */
+ if ((ret = drv_generic_gpio_init(section, Name)) != 0)
+ return ret;
+
+#ifdef WITH_PARPORT
+ if ((ret = drv_generic_keypad_init(section, Name)) != 0)
+ return ret;
+#endif
+ /* register text widget */
+ wc = Widget_Text;
+ wc.draw = drv_generic_text_draw;
+ widget_register(&wc);
+
+ /* register icon widget */
+ wc = Widget_Icon;
+ wc.draw = drv_generic_text_icon_draw;
+ widget_register(&wc);
+
+ /* register bar widget */
+ wc = Widget_Bar;
+ wc.draw = drv_generic_text_bar_draw;
+ widget_register(&wc);
+
+ /* register plugins */
+#ifdef WITH_PARPORT
+ if (Capabilities & CAP_BACKLIGHT) {
+ AddFunction("LCD::backlight", 1, plugin_backlight);
+ }
+#endif
+ if (Capabilities & CAP_BRIGHTNESS) {
+ AddFunction("LCD::brightness", 1, plugin_brightness);
+ }
+
+ return 0;
+}
+
+
+/* close driver & display */
+int drv_HD_quit(const int quiet)
+{
+
+ info("%s: shutting down display.", Name);
+
+ drv_generic_text_quit();
+ drv_generic_gpio_quit();
+
+ /* clear display */
+ drv_HD_clear();
+
+ /* say goodbye... */
+ if (!quiet) {
+ drv_generic_text_greet("goodbye!", NULL);
+ }
+
+ drv_HD_stop();
+
+ return (0);
+}
+
+
+DRIVER drv_HD44780 = {
+ .name = Name,
+ .list = drv_HD_list,
+ .init = drv_HD_init,
+ .quit = drv_HD_quit,
+};
diff --git a/drv_IRLCD.c b/drv_IRLCD.c
new file mode 100644
index 0000000..8a8f300
--- /dev/null
+++ b/drv_IRLCD.c
@@ -0,0 +1,406 @@
+/* $Id: drv_IRLCD.c 984 2009-02-28 06:07:10Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/drv_IRLCD.c $
+ *
+ **************************************************************************
+ * Driver for IRLCD : simple USB1.1 LCD + IR Receiver based on ATtiny2313 *
+ **************************************************************************
+ * Hardware from http://www.xs4all.nl/~dicks/avr/usbtiny/index.html : *
+ * [USBtiny LIRC compatible IR receiver and LCD controller] *
+ * Ths driver is based on LCD2USB software by Till Harbaum, adapted to *
+ * USBTiny protocol by Jean-Philippe Civade *
+ **************************************************************************
+ *
+ * The IR receiving par is compatible with IgrPlug protocol
+ * and can be used from LIRC.
+ *
+ * Copyright (C) 2008 Jean-Philippe Civade <jp@civade.com> (for porting to IRLCD)
+ * Copyright (C) 2005 Till Harbaum <till@harbaum.org> (for LCD2USB friver)
+ * Copyright (C) 2005, 2006, 2007, 2008 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ *
+ * exported fuctions:
+ *
+ * struct DRIVER drv_IRLCD
+ *
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+#include <termios.h>
+#include <fcntl.h>
+#include <ctype.h>
+#include <sys/ioctl.h>
+#include <sys/time.h>
+
+#include <usb.h>
+
+#include "debug.h"
+#include "cfg.h"
+#include "qprintf.h"
+#include "udelay.h"
+#include "plugin.h"
+#include "widget.h"
+#include "widget_text.h"
+#include "widget_icon.h"
+#include "widget_bar.h"
+#include "drv.h"
+
+#include "drv_generic_text.h"
+
+/* vid/pid of IRLCD */
+#define LCD_USB_VENDOR 0x03EB /* for Atmel device */
+#define LCD_USB_DEVICE 0x0002
+
+/* Protocole IR/LCD */
+#define LCD_INSTR 20
+#define LCD_DATA 21
+
+static char Name[] = "IRLCD";
+static char *device_id = NULL, *bus_id = NULL;
+
+static usb_dev_handle *lcd;
+
+extern int got_signal;
+
+/****************************************/
+/*** hardware dependant functions ***/
+/****************************************/
+
+static int drv_IRLCD_open(char *bus_id, char *device_id)
+{
+ struct usb_bus *busses, *bus;
+ struct usb_device *dev;
+
+ lcd = NULL;
+
+ info("%s: scanning USB for IRLCD interface ...", Name);
+
+ if (bus_id != NULL)
+ info("%s: scanning for bus id: %s", Name, bus_id);
+
+ if (device_id != NULL)
+ info("%s: scanning for device id: %s", Name, device_id);
+
+ usb_set_debug(0);
+
+ usb_init();
+ usb_find_busses();
+ usb_find_devices();
+ busses = usb_get_busses();
+
+ for (bus = busses; bus; bus = bus->next) {
+ /* search this bus if no bus id was given or if this is the given bus id */
+ if (!bus_id || (bus_id && !strcasecmp(bus->dirname, bus_id))) {
+
+ for (dev = bus->devices; dev; dev = dev->next) {
+ /* search this device if no device id was given or if this is the given device id */
+ if (!device_id || (device_id && !strcasecmp(dev->filename, device_id))) {
+
+ if ((dev->descriptor.idVendor == LCD_USB_VENDOR) && (dev->descriptor.idProduct == LCD_USB_DEVICE)) {
+ info("%s: found IRLCD interface on bus %s device %s", Name, bus->dirname, dev->filename);
+ lcd = usb_open(dev);
+ if (usb_claim_interface(lcd, 0) < 0) {
+ info("%s: WRNING! usb_claim_interface() failed!", Name);
+ /* try to proceed anyway... */
+ }
+ return 0;
+ }
+ }
+ }
+ }
+ }
+ return -1;
+}
+
+
+static int drv_IRLCD_close(void)
+{
+ usb_release_interface(lcd, 0);
+ usb_close(lcd);
+
+ return 0;
+}
+
+
+/* Send a buffer to lcd via a control message */
+static int drv_IRLCD_send(int request, unsigned char *buffer, int size)
+{
+ if (usb_control_msg(lcd, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_ENDPOINT_OUT, /* bRequestType */
+ request, /* bRequest (LCD_INSTR / LCD_DATA) */
+ 0, /* wValue (0) */
+ 0, /* wIndex (0) */
+ (char *) buffer, /* pointer to destination buffer */
+ size, /* wLength */
+ 1000) < 0) { /* Timeout in millisectonds */
+ error("%s: USB request failed! Trying to reconnect device.", Name);
+
+ usb_release_interface(lcd, 0);
+ usb_close(lcd);
+
+ /* try to close and reopen connection */
+ if (drv_IRLCD_open(bus_id, device_id) < 0) {
+ error("%s: could not re-detect IRLCD USB LCD", Name);
+ got_signal = -1;
+ return -1;
+ }
+ /* and try to re-send command */
+ if (usb_control_msg(lcd, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_ENDPOINT_OUT, /* bRequestType */
+ request, /* bRequest (LCD_INSTR / LCD_DATA) */
+ 0, /* wValue (0) */
+ 0, /* wIndex (0) */
+ (char *) buffer, /* pointer to destination buffer */
+ size, /* wLength */
+ 1000) < 0) { /* Timeout in millisectonds */
+ error("%s: retried USB request failed, aborting!", Name);
+ got_signal = -1;
+ return -1;
+ }
+
+ info("%s: Device successfully reconnected.", Name);
+ }
+
+ return 0;
+}
+
+
+/* text mode displays only */
+static void drv_IRLCD_clear(void)
+{
+ unsigned char cmd[1];
+
+ cmd[0] = 0x01; /* clear */
+ drv_IRLCD_send(LCD_INSTR, cmd, 1);
+ cmd[0] = 0x03; /* home */
+ drv_IRLCD_send(LCD_INSTR, cmd, 1);
+}
+
+
+/* text mode displays only */
+static void drv_IRLCD_write(const int row, const int col, const char *data, int len)
+{
+ unsigned char cmd[1];
+ static int pos;
+
+ /* for 2 lines display */
+ pos = (row % 2) * 64 + (row / 2) * 20 + col;
+
+ /* do the cursor positioning here */
+ cmd[0] = 0x80 | pos;
+
+ /* do positionning */
+ drv_IRLCD_send(LCD_INSTR, cmd, 1);
+
+ /* send string to the display */
+ drv_IRLCD_send(LCD_DATA, (unsigned char *) data, len);
+
+}
+
+/* text mode displays only */
+static void drv_IRLCD_defchar(const int ascii, const unsigned char *matrix)
+{
+ unsigned char cmd[10];
+ int i;
+
+ /* Write to CGRAM */
+ cmd[0] = 0x40 | 8 * ascii;
+ drv_IRLCD_send(LCD_INSTR, cmd, 1);
+
+
+ /* send bitmap to the display */
+ for (i = 0; i < 8; i++) {
+ cmd[i] = matrix[i] & 0x1f;
+ }
+ drv_IRLCD_send(LCD_DATA, cmd, 8);
+}
+
+
+/* start text mode display */
+static int drv_IRLCD_start(const char *section)
+{
+ int rows = -1, cols = -1;
+ char *s;
+
+ s = cfg_get(section, "Size", NULL);
+ if (s == NULL || *s == '\0') {
+ error("%s: no '%s.Size' entry from %s", Name, section, cfg_source());
+ return -1;
+ }
+ if (sscanf(s, "%dx%d", &cols, &rows) != 2 || rows < 1 || cols < 1) {
+ error("%s: bad %s.Size '%s' from %s", Name, section, s, cfg_source());
+ free(s);
+ return -1;
+ }
+
+ DROWS = rows;
+ DCOLS = cols;
+
+ /* bus id and device id are strings and not just intergers, since */
+ /* the windows port of libusb treats them as strings. And this way */
+ /* we keep windows compatibility ... just in case ... */
+ bus_id = cfg_get(section, "Bus", NULL);
+ device_id = cfg_get(section, "Device", NULL);
+
+ if (drv_IRLCD_open(bus_id, device_id) < 0) {
+ error("%s: could not find a IRLC USB LCD", Name);
+ return -1;
+ }
+
+ /* reset & initialize display */
+ drv_IRLCD_clear(); /* clear display */
+
+ return 0;
+}
+
+
+/****************************************/
+/*** plugins ***/
+/****************************************/
+/* no plugins capabilities */
+
+/****************************************/
+/*** widget callbacks ***/
+/****************************************/
+/* using drv_generic_text_draw(W) */
+/* using drv_generic_text_icon_draw(W) */
+/* using drv_generic_text_bar_draw(W) */
+/* using drv_generic_gpio_draw(W) */
+
+
+/****************************************/
+/*** exported functions ***/
+/****************************************/
+
+/* list models */
+int drv_IRLCD_list(void)
+{
+ printf("USBtiny LCD controller");
+ return 0;
+}
+
+/* initialize driver & display */
+int drv_IRLCD_init(const char *section, const int quiet)
+{
+ WIDGET_CLASS wc;
+ int asc255bug;
+ int ret;
+
+ info("%s: %s", Name, "$Rev: 984 $");
+
+ /* display preferences */
+ XRES = 5; /* pixel width of one char */
+ YRES = 8; /* pixel height of one char */
+ CHARS = 8; /* number of user-defineable characters */
+ CHAR0 = 0; /* ASCII of first user-defineable char */
+ GOTO_COST = 2; /* number of bytes a goto command requires */
+
+ /* real worker functions */
+ drv_generic_text_real_write = drv_IRLCD_write;
+ drv_generic_text_real_defchar = drv_IRLCD_defchar;
+
+ /* start display */
+ if ((ret = drv_IRLCD_start(section)) != 0)
+ return ret;
+
+ if (!quiet) {
+ char buffer[40];
+ qprintf(buffer, sizeof(buffer), "%s %dx%d", Name, DCOLS, DROWS);
+ if (drv_generic_text_greet(buffer, " www.civade.com")) {
+ sleep(3);
+ drv_IRLCD_clear();
+ }
+ }
+
+ /* initialize generic text driver */
+ if ((ret = drv_generic_text_init(section, Name)) != 0)
+ return ret;
+
+ /* initialize generic icon driver */
+ if ((ret = drv_generic_text_icon_init()) != 0)
+ return ret;
+
+ /* initialize generic bar driver */
+ if ((ret = drv_generic_text_bar_init(0)) != 0)
+ return ret;
+
+ /* add fixed chars to the bar driver */
+ /* most displays have a full block on ascii 255, but some have kind of */
+ /* an 'inverted P'. If you specify 'asc255bug 1 in the config, this */
+ /* char will not be used, but rendered by the bar driver */
+ cfg_number(section, "asc255bug", 0, 0, 1, &asc255bug);
+ drv_generic_text_bar_add_segment(0, 0, 255, 32); /* ASCII 32 = blank */
+ if (!asc255bug)
+ drv_generic_text_bar_add_segment(255, 255, 255, 255); /* ASCII 255 = block */
+
+ /* register text widget */
+ wc = Widget_Text;
+ wc.draw = drv_generic_text_draw;
+ widget_register(&wc);
+
+ /* register icon widget */
+ wc = Widget_Icon;
+ wc.draw = drv_generic_text_icon_draw;
+ widget_register(&wc);
+
+ /* register bar widget */
+ wc = Widget_Bar;
+ wc.draw = drv_generic_text_bar_draw;
+ widget_register(&wc);
+
+ return 0;
+}
+
+
+/* close driver & display */
+/* use this function for a text display */
+int drv_IRLCD_quit(const int quiet)
+{
+
+ info("%s: shutting down.", Name);
+
+ drv_generic_text_quit();
+
+ /* clear display */
+ drv_IRLCD_clear();
+
+ /* say goodbye... */
+ if (!quiet) {
+ drv_generic_text_greet("goodbye!", NULL);
+ }
+
+ debug("closing usb connection");
+ drv_IRLCD_close();
+
+ return (0);
+}
+
+/* use this one for a text display */
+DRIVER drv_IRLCD = {
+ .name = Name,
+ .list = drv_IRLCD_list,
+ .init = drv_IRLCD_init,
+ .quit = drv_IRLCD_quit,
+};
diff --git a/drv_Image.c b/drv_Image.c
new file mode 100644
index 0000000..7f8a005
--- /dev/null
+++ b/drv_Image.c
@@ -0,0 +1,485 @@
+/* $Id: drv_Image.c 840 2007-09-09 12:17:42Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/drv_Image.c $
+ *
+ * new style Image (PPM/PNG) Driver for LCD4Linux
+ *
+ * Copyright (C) 2003 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ *
+ * exported fuctions:
+ *
+ * struct DRIVER drv_Image
+ *
+ */
+
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <unistd.h>
+#include <termios.h>
+#include <fcntl.h>
+#include <sys/time.h>
+
+
+#ifdef WITH_PNG
+
+#ifdef HAVE_GD_GD_H
+#include <gd/gd.h>
+#else
+#ifdef HAVE_GD_H
+#include <gd.h>
+#else
+#error "gd.h not found!"
+#error "cannot compile PNG driver"
+#endif
+#endif
+
+#if GD2_VERS != 2
+#error "lcd4linux requires libgd version 2"
+#error "cannot compile PNG driver"
+#endif
+
+#endif
+
+
+#include "debug.h"
+#include "cfg.h"
+#include "timer.h"
+#include "qprintf.h"
+#include "plugin.h"
+#include "drv.h"
+#include "drv_generic_graphic.h"
+
+#ifdef WITH_DMALLOC
+#include <dmalloc.h>
+#endif
+
+static char Name[] = "Image";
+
+static enum { NIL, PPM, PNG } Format;
+
+static int pixel = -1; /* pointsize in pixel */
+static int pgap = 0; /* gap between points */
+static int rgap = 0; /* row gap between lines */
+static int cgap = 0; /* column gap between characters */
+static int border = 0; /* window border */
+
+static int dimx, dimy; /* total window dimension in pixel */
+
+static RGBA BC;
+static RGBA *drv_IMG_FB = NULL;
+
+static int dirty = 1;
+
+/****************************************/
+/*** hardware dependant functions ***/
+/****************************************/
+
+#ifdef WITH_PPM
+static int drv_IMG_flush_PPM(void)
+{
+ static int seq = 0;
+ static RGBA *bitbuf = NULL;
+ static unsigned char *rowbuf = NULL;
+ int xsize, ysize, row, col, i;
+ char path[256], tmp[256], buffer[256];
+ int fd;
+
+ xsize = 2 * border + (DCOLS / XRES - 1) * cgap + DCOLS * pixel + (DCOLS - 1) * pgap;
+ ysize = 2 * border + (DROWS / YRES - 1) * rgap + DROWS * pixel + (DROWS - 1) * pgap;
+
+ if (bitbuf == NULL) {
+ if ((bitbuf = malloc(xsize * ysize * sizeof(*bitbuf))) == NULL) {
+ error("%s: malloc() failed: %s", Name, strerror(errno));
+ return -1;
+ }
+ }
+
+ if (rowbuf == NULL) {
+ if ((rowbuf = malloc(3 * xsize * sizeof(*rowbuf))) == NULL) {
+ error("Raster: malloc() failed: %s", strerror(errno));
+ return -1;
+ }
+ }
+
+ for (i = 0; i < xsize * ysize; i++) {
+ bitbuf[i] = BC;
+ }
+
+ for (row = 0; row < DROWS; row++) {
+ int y = border + (row / YRES) * rgap + row * (pixel + pgap);
+ for (col = 0; col < DCOLS; col++) {
+ int x = border + (col / XRES) * cgap + col * (pixel + pgap);
+ int a, b;
+ for (a = 0; a < pixel; a++)
+ for (b = 0; b < pixel; b++)
+ bitbuf[y * xsize + x + a * xsize + b] = drv_IMG_FB[row * DCOLS + col];
+ }
+ }
+
+ snprintf(path, sizeof(path), output, seq++);
+ qprintf(tmp, sizeof(tmp), "%s.tmp", path);
+
+ /* remove the file */
+ unlink(tmp);
+
+ /* avoid symlink security hole: */
+ /* open it with O_EXCL will fail if the file exists. */
+ /* This should not happen because we just unlinked it. */
+ if ((fd = open(tmp, O_WRONLY | O_CREAT | O_EXCL, 0644)) < 0) {
+ error("%s: open(%s) failed: %s", Name, tmp, strerror(errno));
+ return -1;
+ }
+
+ qprintf(buffer, sizeof(buffer), "P6\n%d %d\n255\n", xsize, ysize);
+ if (write(fd, buffer, strlen(buffer)) < 0) {
+ error("%s: write(%s) failed: %s", Name, tmp, strerror(errno));
+ return -1;
+ }
+
+ for (row = 0; row < ysize; row++) {
+ int c = 0;
+ for (col = 0; col < xsize; col++) {
+ RGBA p = bitbuf[row * xsize + col];
+ rowbuf[c++] = p.R;
+ rowbuf[c++] = p.G;
+ rowbuf[c++] = p.B;
+ }
+ if (write(fd, rowbuf, c) < 0) {
+ error("%s: write(%s) failed: %s", Name, tmp, strerror(errno));
+ break;
+ }
+ }
+
+ if (close(fd) < 0) {
+ error("%s: close(%s) failed: %s", Name, tmp, strerror(errno));
+ return -1;
+ }
+ if (rename(tmp, path) < 0) {
+ error("%s: rename(%s) failed: %s", Name, tmp, strerror(errno));
+ return -1;
+ }
+
+ return 0;
+}
+#endif
+
+#ifdef WITH_PNG
+static int drv_IMG_flush_PNG(void)
+{
+ static int seq = 0;
+ int xsize, ysize, row, col;
+ char path[256], tmp[256];
+ FILE *fp;
+ int fd;
+ gdImagePtr im;
+
+ xsize = 2 * border + (DCOLS / XRES - 1) * cgap + DCOLS * pixel + (DCOLS - 1) * pgap;
+ ysize = 2 * border + (DROWS / YRES - 1) * rgap + DROWS * pixel + (DROWS - 1) * pgap;
+
+ im = gdImageCreateTrueColor(xsize, ysize);
+ gdImageFilledRectangle(im, 0, 0, xsize, ysize, gdTrueColor(BC.R, BC.G, BC.B));
+
+ for (row = 0; row < DROWS; row++) {
+ int y = border + (row / YRES) * rgap + row * (pixel + pgap);
+ for (col = 0; col < DCOLS; col++) {
+ int x = border + (col / XRES) * cgap + col * (pixel + pgap);
+ RGBA p = drv_IMG_FB[row * DCOLS + col];
+ int c = gdTrueColor(p.R, p.G, p.B);
+ gdImageFilledRectangle(im, x, y, x + pixel - 1, y + pixel - 1, c);
+ }
+ }
+
+ snprintf(path, sizeof(path), output, seq++);
+ qprintf(tmp, sizeof(tmp), "%s.tmp", path);
+
+ /* remove the file */
+ unlink(tmp);
+
+ /* avoid symlink security hole: */
+ /* open it with O_EXCL will fail if the file exists. */
+ /* This should not happen because we just unlinked it. */
+ if ((fd = open(tmp, O_WRONLY | O_CREAT | O_EXCL, 0644)) < 0) {
+ error("%s: open(%s) failed: %s", Name, tmp, strerror(errno));
+ return -1;
+ }
+
+ if ((fp = fdopen(fd, "w")) == NULL) {
+ error("%s: fdopen(%s) failed: %s\n", Name, tmp, strerror(errno));
+ close(fd);
+ return -1;
+ }
+
+ gdImagePng(im, fp);
+ gdImageDestroy(im);
+
+
+ if (fclose(fp) != 0) {
+ error("%s: fclose(%s) failed: %s\n", Name, tmp, strerror(errno));
+ return -1;
+ }
+
+ if (rename(tmp, path) < 0) {
+ error("%s: rename(%s) failed: %s\n", Name, tmp, strerror(errno));
+ return -1;
+ }
+
+ return 0;
+}
+#endif
+
+
+static void drv_IMG_flush(void)
+{
+ switch (Format) {
+ case PPM:
+#ifdef WITH_PPM
+ drv_IMG_flush_PPM();
+#endif
+ break;
+ case PNG:
+#ifdef WITH_PNG
+ drv_IMG_flush_PNG();
+#endif
+ break;
+ default:
+ break;
+ }
+}
+
+
+static void drv_IMG_timer( __attribute__ ((unused))
+ void *notused)
+{
+ if (dirty) {
+ drv_IMG_flush();
+ dirty = 0;
+ }
+}
+
+
+static void drv_IMG_blit(const int row, const int col, const int height, const int width)
+{
+ int r, c;
+
+ for (r = row; r < row + height; r++) {
+ for (c = col; c < col + width; c++) {
+ RGBA p1 = drv_IMG_FB[r * DCOLS + c];
+ RGBA p2 = drv_generic_graphic_rgb(r, c);
+ if (p1.R != p2.R || p1.G != p2.G || p1.B != p2.B) {
+ drv_IMG_FB[r * DCOLS + c] = p2;
+ dirty = 1;
+ }
+ }
+ }
+}
+
+
+static int drv_IMG_start(const char *section)
+{
+ int i;
+ char *s;
+
+ if (output == NULL || *output == '\0') {
+ error("%s: no output file specified (use -o switch)", Name);
+ return -1;
+ }
+
+ /* read file format from config */
+ s = cfg_get(section, "Format", NULL);
+ if (s == NULL || *s == '\0') {
+ error("%s: no '%s.Format' entry from %s", Name, section, cfg_source());
+ free(s);
+ return -1;
+ }
+
+ Format = NIL;
+
+#ifdef WITH_PPM
+ if (strcmp(s, "PPM") == 0) {
+ Format = PPM;
+ }
+#endif
+
+#ifdef WITH_PNG
+ if (strcmp(s, "PNG") == 0) {
+ Format = PNG;
+ }
+#endif
+
+ if (Format == NIL) {
+ error("%s: bad %s.Format '%s' from %s", Name, section, s, cfg_source());
+ free(s);
+ return -1;
+ }
+ free(s);
+
+ /* read display size from config */
+ if (sscanf(s = cfg_get(section, "Size", "120x32"), "%dx%d", &DCOLS, &DROWS) != 2 || DCOLS < 1 || DROWS < 1) {
+ error("%s: bad %s.Size '%s' from %s", Name, section, s, cfg_source());
+ free(s);
+ return -1;
+ }
+ free(s);
+
+ if (sscanf(s = cfg_get(section, "font", "5x8"), "%dx%d", &XRES, &YRES) != 2 || XRES < 1 || YRES < 1) {
+ error("%s: bad %s.Font '%s' from %s", Name, section, s, cfg_source());
+ free(s);
+ return -1;
+ }
+ free(s);
+
+ if (sscanf(s = cfg_get(section, "pixel", "4+1"), "%d+%d", &pixel, &pgap) != 2 || pixel < 1 || pgap < 0) {
+ error("%s: bad %s.Pixel '%s' from %s", Name, section, s, cfg_source());
+ free(s);
+ return -1;
+ }
+ free(s);
+
+ if (sscanf(s = cfg_get(section, "gap", "-1x-1"), "%dx%d", &cgap, &rgap) != 2 || cgap < -1 || rgap < -1) {
+ error("%s: bad %s.Gap '%s' from %s", Name, section, s, cfg_source());
+ free(s);
+ return -1;
+ }
+ free(s);
+
+ if (rgap < 0)
+ rgap = pixel + pgap;
+ if (cgap < 0)
+ cgap = pixel + pgap;
+
+ if (cfg_number(section, "border", 0, 0, -1, &border) < 0)
+ return -1;
+
+ s = cfg_get(section, "basecolor", "000000ff");
+ if (color2RGBA(s, &BC) < 0) {
+ error("%s: ignoring illegal color '%s'", Name, s);
+ }
+ free(s);
+
+ drv_IMG_FB = malloc(DCOLS * DROWS * sizeof(*drv_IMG_FB));
+ if (drv_IMG_FB == NULL) {
+ error("%s: framebuffer could not be allocated: malloc() failed", Name);
+ return -1;
+ }
+
+ for (i = 0; i < DCOLS * DROWS; i++) {
+ drv_IMG_FB[i] = BC;
+ }
+
+ dimx = DCOLS * pixel + (DCOLS - 1) * pgap + (DCOLS / XRES - 1) * cgap;
+ dimy = DROWS * pixel + (DROWS - 1) * pgap + (DROWS / YRES - 1) * rgap;
+
+
+ /* initially flush the image to a file */
+ drv_IMG_flush();
+
+ /* regularly flush the image to a file */
+ /* Fixme: make 100msec configurable */
+ timer_add(drv_IMG_timer, NULL, 100, 0);
+
+
+ return 0;
+}
+
+
+
+/****************************************/
+/*** plugins ***/
+/****************************************/
+
+/* none at the moment... */
+
+
+/****************************************/
+/*** exported functions ***/
+/****************************************/
+
+
+/* list models */
+int drv_IMG_list(void)
+{
+#ifdef WITH_PPM
+ printf("PPM ");
+#endif
+#ifdef WITH_PNG
+ printf("PNG ");
+#endif
+ return 0;
+}
+
+
+/* initialize driver & display */
+int drv_IMG_init(const char *section, const __attribute__ ((unused))
+ int quiet)
+{
+ int ret;
+
+ info("%s: %s", Name, "$Rev: 840 $");
+
+ /* real worker functions */
+ drv_generic_graphic_real_blit = drv_IMG_blit;
+
+ /* start display */
+ if ((ret = drv_IMG_start(section)) != 0)
+ return ret;
+
+ /* initialize generic graphic driver */
+ if ((ret = drv_generic_graphic_init(section, Name)) != 0)
+ return ret;
+
+ /* register plugins */
+ /* none at the moment... */
+
+
+ return 0;
+}
+
+
+/* close driver & display */
+int drv_IMG_quit(const __attribute__ ((unused))
+ int quiet)
+{
+
+ info("%s: shutting down.", Name);
+ drv_generic_graphic_quit();
+
+ if (drv_IMG_FB) {
+ free(drv_IMG_FB);
+ drv_IMG_FB = NULL;
+ }
+
+ return (0);
+}
+
+
+DRIVER drv_Image = {
+ .name = Name,
+ .list = drv_IMG_list,
+ .init = drv_IMG_init,
+ .quit = drv_IMG_quit,
+};
diff --git a/drv_LCD2USB.c b/drv_LCD2USB.c
new file mode 100644
index 0000000..5e2fc72
--- /dev/null
+++ b/drv_LCD2USB.c
@@ -0,0 +1,679 @@
+/* $Id: drv_LCD2USB.c 1130 2010-10-31 19:21:45Z harbaum $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/drv_LCD2USB.c $
+ *
+ * driver for LCD2USB display interface
+ * see http://www.harbaum.org/till/lcd2usb for schematics
+ *
+ * Copyright 2005 Till Harbaum <till@harbaum.org>
+ * Copyright 2005 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ *
+ * exported fuctions:
+ *
+ * struct DRIVER drv_LCD2USB
+ *
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <unistd.h>
+#include <termios.h>
+#include <fcntl.h>
+#include <ctype.h>
+#include <sys/ioctl.h>
+#include <sys/time.h>
+
+#include <usb.h>
+
+#include "debug.h"
+#include "cfg.h"
+#include "timer.h"
+#include "qprintf.h"
+#include "plugin.h"
+#include "widget.h"
+#include "widget_text.h"
+#include "widget_icon.h"
+#include "widget_bar.h"
+#include "widget_keypad.h"
+#include "drv.h"
+#include "drv_generic_text.h"
+#include "drv_generic_keypad.h"
+
+/* vid/pid donated by FTDI */
+#define LCD_USB_VENDOR 0x0403
+#define LCD_USB_DEVICE 0xC630
+
+/* number of buttons on display */
+#define L2U_BUTTONS (2)
+
+#define LCD_ECHO (0<<5)
+#define LCD_CMD (1<<5)
+#define LCD_DATA (2<<5)
+#define LCD_SET (3<<5)
+#define LCD_GET (4<<5)
+
+/* target is a bit map for CMD/DATA */
+#define LCD_CTRL_0 (1<<3)
+#define LCD_CTRL_1 (1<<4)
+#define LCD_BOTH (LCD_CTRL_0 | LCD_CTRL_1)
+
+/* target is value to set */
+#define LCD_SET_CONTRAST (LCD_SET | (0<<3))
+#define LCD_SET_BRIGHTNESS (LCD_SET | (1<<3))
+#define LCD_SET_RESERVED0 (LCD_SET | (2<<3))
+#define LCD_SET_RESERVED1 (LCD_SET | (3<<3))
+
+/* target is value to get */
+#define LCD_GET_FWVER (LCD_GET | (0<<3))
+#define LCD_GET_BUTTONS (LCD_GET | (1<<3))
+#define LCD_GET_CTRL (LCD_GET | (2<<3))
+#define LCD_GET_RESERVED1 (LCD_GET | (3<<3))
+
+static char Name[] = "LCD2USB";
+static char *device_id = NULL, *bus_id = NULL;
+
+static usb_dev_handle *lcd;
+static int controllers = 0;
+
+extern int got_signal;
+
+/****************************************/
+/*** hardware dependant functions ***/
+/****************************************/
+
+static int drv_L2U_open(char *bus_id, char *device_id)
+{
+ struct usb_bus *busses, *bus;
+ struct usb_device *dev;
+
+ lcd = NULL;
+
+ info("%s: scanning USB for LCD2USB interface ...", Name);
+
+ if (bus_id != NULL)
+ info("%s: scanning for bus id: %s", Name, bus_id);
+
+ if (device_id != NULL)
+ info("%s: scanning for device id: %s", Name, device_id);
+
+ usb_set_debug(0);
+
+ usb_init();
+ usb_find_busses();
+ usb_find_devices();
+ busses = usb_get_busses();
+
+ for (bus = busses; bus; bus = bus->next) {
+ /* search this bus if no bus id was given or if this is the given bus id */
+ if (!bus_id || (bus_id && !strcasecmp(bus->dirname, bus_id))) {
+
+ for (dev = bus->devices; dev; dev = dev->next) {
+ /* search this device if no device id was given or if this is the given device id */
+ if (!device_id || (device_id && !strcasecmp(dev->filename, device_id))) {
+
+ if ((dev->descriptor.idVendor == LCD_USB_VENDOR) && (dev->descriptor.idProduct == LCD_USB_DEVICE)) {
+ info("%s: found LCD2USB interface on bus %s device %s", Name, bus->dirname, dev->filename);
+ lcd = usb_open(dev);
+ if (usb_claim_interface(lcd, 0) < 0) {
+ error("%s: usb_claim_interface() failed!", Name);
+ return -1;
+ }
+ return 0;
+ }
+ }
+ }
+ }
+ }
+ return -1;
+}
+
+
+static int drv_L2U_close(void)
+{
+ usb_release_interface(lcd, 0);
+ usb_close(lcd);
+
+ return 0;
+}
+
+
+static int drv_L2U_send(int request, int value, int index)
+{
+ if (usb_control_msg(lcd, USB_TYPE_VENDOR, request, value, index, NULL, 0, 1000) < 0) {
+ error("%s: USB request failed! Trying to reconnect device.", Name);
+
+ usb_release_interface(lcd, 0);
+ usb_close(lcd);
+
+ /* try to close and reopen connection */
+ if (drv_L2U_open(bus_id, device_id) < 0) {
+ error("%s: could not re-detect LCD2USB USB LCD", Name);
+ got_signal = -1;
+ return -1;
+ }
+ /* and try to re-send command */
+ if (usb_control_msg(lcd, USB_TYPE_VENDOR, request, value, index, NULL, 0, 1000) < 0) {
+ error("%s: retried USB request failed, aborting!", Name);
+ got_signal = -1;
+ return -1;
+ }
+
+ info("%s: Device successfully reconnected.", Name);
+ }
+
+ return 0;
+}
+
+/* send a number of 16 bit words to the lcd2usb interface */
+/* and verify that they are correctly returned by the echo */
+/* command. This may be used to check the reliability of */
+/* the usb interfacing */
+#define ECHO_NUM 100
+
+int drv_L2U_echo(void)
+{
+ int i, nBytes, errors = 0;
+ unsigned short val, ret;
+
+ for (i = 0; i < ECHO_NUM; i++) {
+ val = rand() & 0xffff;
+
+ nBytes = usb_control_msg(lcd,
+ USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_ENDPOINT_IN,
+ LCD_ECHO, val, 0, (char *) &ret, sizeof(ret), 1000);
+
+ if (nBytes < 0) {
+ error("%s: USB request failed!", Name);
+ return -1;
+ }
+
+ if (val != ret)
+ errors++;
+ }
+
+ if (errors) {
+ error("%s: ERROR, %d out of %d echo transfers failed!", Name, errors, ECHO_NUM);
+ return -1;
+ } else
+ info("%s: echo test successful", Name);
+
+ return 0;
+}
+
+/* get a value from the lcd2usb interface */
+static int drv_L2U_get(unsigned char cmd)
+{
+ unsigned char buffer[2];
+ int nBytes;
+
+ /* send control request and accept return value */
+ nBytes = usb_control_msg(lcd,
+ USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_ENDPOINT_IN,
+ cmd, 0, 0, (char *) buffer, sizeof(buffer), 1000);
+
+ if (nBytes < 0) {
+ error("%s: USB request failed!", Name);
+ return -1;
+ }
+
+ return buffer[0] + 256 * buffer[1];
+}
+
+/* get lcd2usb interface firmware version */
+static void drv_L2U_get_version(void)
+{
+ int ver = drv_L2U_get(LCD_GET_FWVER);
+
+ if (ver != -1)
+ info("%s: firmware version %d.%02d", Name, ver & 0xff, ver >> 8);
+ else
+ error("%s: unable to read firmware version", Name);
+}
+
+/* get the bit mask of installed LCD controllers (0 = no */
+/* lcd found, 1 = single controller display, 3 = dual */
+/* controller display */
+static void drv_L2U_get_controllers(void)
+{
+ controllers = drv_L2U_get(LCD_GET_CTRL);
+
+ if (controllers != -1) {
+ if (controllers)
+ info("%s: installed controllers: %s%s", Name,
+ (controllers & 1) ? "CTRL0" : "", (controllers & 2) ? " CTRL1" : "");
+ else
+ error("%s: no controllers found", Name);
+ } else {
+ error("%s: unable to read installed controllers", Name);
+ controllers = 0; /* don't access any controllers */
+ }
+
+ /* convert into controller map matching our protocol */
+ controllers = ((controllers & 1) ? LCD_CTRL_0 : 0) | ((controllers & 2) ? LCD_CTRL_1 : 0);
+}
+
+/* get state of the two optional buttons */
+static unsigned long drv_L2U_get_buttons(void)
+{
+ int buttons = drv_L2U_get(LCD_GET_BUTTONS);
+
+ if (buttons == -1) {
+ error("%s: unable to read button state", Name);
+ buttons = 0;
+ }
+
+ return buttons;
+}
+
+
+/* to increase performance, a little buffer is being used to */
+/* collect command bytes of the same type before transmitting them */
+#define BUFFER_MAX_CMD 4 /* current protocol supports up to 4 bytes */
+int buffer_current_type = -1; /* nothing in buffer yet */
+int buffer_current_fill = 0; /* -"- */
+unsigned char buffer[BUFFER_MAX_CMD];
+
+/* command format:
+ * 7 6 5 4 3 2 1 0
+ * C C C T T R L L
+ *
+ * TT = target bit map
+ * R = reserved for future use, set to 0
+ * LL = number of bytes in transfer - 1
+ */
+
+/* flush command queue due to buffer overflow / content */
+/* change or due to explicit request */
+static void drv_L2U_flush(void)
+{
+ int request, value, index;
+
+ /* anything to flush? ignore request if not */
+ if (buffer_current_type == -1)
+ return;
+
+ /* build request byte */
+ request = buffer_current_type | (buffer_current_fill - 1);
+
+ /* fill value and index with buffer contents. endianess should IMHO not */
+ /* be a problem, since usb_control_msg() will handle this. */
+ value = buffer[0] | (buffer[1] << 8);
+ index = buffer[2] | (buffer[3] << 8);
+
+ if (controllers) {
+ /* send current buffer contents */
+ drv_L2U_send(request, value, index);
+ }
+
+ /* buffer is now free again */
+ buffer_current_type = -1;
+ buffer_current_fill = 0;
+}
+
+/* enqueue a command into the buffer */
+static void drv_L2U_enqueue(int command_type, int value)
+{
+ if ((buffer_current_type >= 0) && (buffer_current_type != command_type))
+ drv_L2U_flush();
+
+ /* add new item to buffer */
+ buffer_current_type = command_type;
+ buffer[buffer_current_fill++] = value;
+
+ /* flush buffer if it's full */
+ if (buffer_current_fill == BUFFER_MAX_CMD)
+ drv_L2U_flush();
+}
+
+static void drv_L2U_command(const unsigned char ctrl, const unsigned char cmd)
+{
+ drv_L2U_enqueue(LCD_CMD | (ctrl & controllers), cmd);
+}
+
+
+static void drv_L2U_clear(void)
+{
+ drv_L2U_command(LCD_BOTH, 0x01); /* clear display */
+ drv_L2U_command(LCD_BOTH, 0x03); /* return home */
+}
+
+static void drv_L2U_write(int row, const int col, const char *data, int len)
+{
+ int pos, ctrl = LCD_CTRL_0;
+
+ /* displays with more two rows and 20 columns have a logical width */
+ /* of 40 chars and use more than one controller */
+ if ((DROWS > 2) && (DCOLS > 20) && (row > 1)) {
+ /* use second controller */
+ row -= 2;
+ ctrl = LCD_CTRL_1;
+ }
+
+ /* 16x4 Displays use a slightly different layout */
+ if (DCOLS == 16 && DROWS == 4) {
+ pos = (row % 2) * 64 + (row / 2) * 16 + col;
+ } else {
+ pos = (row % 2) * 64 + (row / 2) * 20 + col;
+ }
+
+ drv_L2U_command(ctrl, 0x80 | pos);
+
+ while (len--) {
+ drv_L2U_enqueue(LCD_DATA | (ctrl & controllers), *data++);
+ }
+
+ drv_L2U_flush();
+}
+
+static void drv_L2U_defchar(const int ascii, const unsigned char *matrix)
+{
+ int i;
+
+ drv_L2U_command(LCD_BOTH, 0x40 | 8 * ascii);
+
+ for (i = 0; i < 8; i++) {
+ drv_L2U_enqueue(LCD_DATA | (LCD_BOTH & controllers), *matrix++ & 0x1f);
+ }
+
+ drv_L2U_flush();
+}
+
+static int drv_L2U_contrast(int contrast)
+{
+ if (contrast < 0)
+ contrast = 0;
+ if (contrast > 255)
+ contrast = 255;
+
+ drv_L2U_send(LCD_SET_CONTRAST, contrast, 0);
+
+ return contrast;
+}
+
+static int drv_L2U_brightness(int brightness)
+{
+ if (brightness < 0)
+ brightness = 0;
+ if (brightness > 255)
+ brightness = 255;
+
+ drv_L2U_send(LCD_SET_BRIGHTNESS, brightness, 0);
+
+ return brightness;
+}
+
+static void drv_L2U_timer(void __attribute__ ((unused)) * notused)
+{
+ static unsigned long last_but = 0;
+ unsigned long new_but = drv_L2U_get_buttons();
+ int i;
+
+ /* check if button state changed */
+ if (new_but ^ last_but) {
+
+ /* send single keypad events for all changed buttons */
+ for (i = 0; i < L2U_BUTTONS; i++)
+ if ((new_but & (1 << i)) ^ (last_but & (1 << i)))
+ drv_generic_keypad_press(((new_but & (1 << i)) ? 0x80 : 0) | i);
+ }
+
+ last_but = new_but;
+}
+
+static int drv_L2U_keypad(const int num)
+{
+ int val = 0;
+
+ /* check for key press event */
+ if (num & 0x80)
+ val = WIDGET_KEY_PRESSED;
+ else
+ val = WIDGET_KEY_RELEASED;
+
+ if ((num & 0x7f) == 0)
+ val += WIDGET_KEY_UP;
+
+ if ((num & 0x7f) == 1)
+ val += WIDGET_KEY_DOWN;
+
+ return val;
+}
+
+static int drv_L2U_start(const char *section, const int quiet)
+{
+ int contrast, brightness;
+ int rows = -1, cols = -1;
+ char *s;
+
+ s = cfg_get(section, "Size", NULL);
+ if (s == NULL || *s == '\0') {
+ error("%s: no '%s.Size' entry from %s", Name, section, cfg_source());
+ return -1;
+ }
+ if (sscanf(s, "%dx%d", &cols, &rows) != 2 || rows < 1 || cols < 1) {
+ error("%s: bad %s.Size '%s' from %s", Name, section, s, cfg_source());
+ free(s);
+ return -1;
+ }
+
+ DROWS = rows;
+ DCOLS = cols;
+
+ /* bus id and device id are strings and not just intergers, since */
+ /* the windows port of libusb treats them as strings. And this way */
+ /* we keep windows compatibility ... just in case ... */
+ bus_id = cfg_get(section, "Bus", NULL);
+ device_id = cfg_get(section, "Device", NULL);
+
+ if (drv_L2U_open(bus_id, device_id) < 0) {
+ error("%s: could not find a LCD2USB USB LCD", Name);
+ return -1;
+ }
+
+ /* test interface reliability */
+ drv_L2U_echo();
+
+ /* get some infos from the interface */
+ drv_L2U_get_version();
+ drv_L2U_get_controllers();
+ if (!controllers)
+ return -1;
+
+ /* regularly request key state */
+ /* Fixme: make 100msec configurable */
+ timer_add(drv_L2U_timer, NULL, 100, 0);
+
+ if (cfg_number(section, "Contrast", 0, 0, 255, &contrast) > 0) {
+ drv_L2U_contrast(contrast);
+ }
+
+ if (cfg_number(section, "Brightness", 0, 0, 255, &brightness) > 0) {
+ drv_L2U_brightness(brightness);
+ }
+
+ drv_L2U_clear(); /* clear display */
+
+ if (!quiet) {
+ char buffer[40];
+ qprintf(buffer, sizeof(buffer), "%s %dx%d", Name, DCOLS, DROWS);
+ if (drv_generic_text_greet(buffer, "www.harbaum.org/till")) {
+ sleep(3);
+ drv_L2U_clear();
+ }
+ }
+
+ return 0;
+}
+
+
+/****************************************/
+/*** plugins ***/
+/****************************************/
+
+static void plugin_contrast(RESULT * result, RESULT * arg1)
+{
+ double contrast;
+
+ contrast = drv_L2U_contrast(R2N(arg1));
+ SetResult(&result, R_NUMBER, &contrast);
+}
+
+
+static void plugin_brightness(RESULT * result, RESULT * arg1)
+{
+ double brightness;
+
+ brightness = drv_L2U_brightness(R2N(arg1));
+ SetResult(&result, R_NUMBER, &brightness);
+}
+
+
+/****************************************/
+/*** widget callbacks ***/
+/****************************************/
+
+
+/* using drv_generic_text_draw(W) */
+/* using drv_generic_text_icon_draw(W) */
+/* using drv_generic_text_bar_draw(W) */
+
+
+/****************************************/
+/*** exported functions ***/
+/****************************************/
+
+
+/* list models */
+int drv_L2U_list(void)
+{
+ printf("LCD2USB homebrew USB interface for HD44780 text displays");
+ return 0;
+}
+
+
+/* initialize driver & display */
+int drv_L2U_init(const char *section, const int quiet)
+{
+ WIDGET_CLASS wc;
+ int asc255bug;
+ int ret;
+
+ info("%s: %s", Name, "$Rev: 1130 $");
+
+ /* display preferences */
+ XRES = 5; /* pixel width of one char */
+ YRES = 8; /* pixel height of one char */
+ CHARS = 8; /* number of user-defineable characters */
+ CHAR0 = 0; /* ASCII of first user-defineable char */
+ GOTO_COST = 2; /* number of bytes a goto command requires */
+
+ /* real worker functions */
+ drv_generic_text_real_write = drv_L2U_write;
+ drv_generic_text_real_defchar = drv_L2U_defchar;
+ drv_generic_keypad_real_press = drv_L2U_keypad;
+
+ /* start display */
+ if ((ret = drv_L2U_start(section, quiet)) != 0)
+ return ret;
+
+ /* initialize generic text driver */
+ if ((ret = drv_generic_text_init(section, Name)) != 0)
+ return ret;
+
+ /* initialize generic icon driver */
+ if ((ret = drv_generic_text_icon_init()) != 0)
+ return ret;
+
+ /* initialize generic bar driver */
+ if ((ret = drv_generic_text_bar_init(0)) != 0)
+ return ret;
+
+ /* add fixed chars to the bar driver */
+ /* most displays have a full block on ascii 255, but some have kind of */
+ /* an 'inverted P'. If you specify 'asc255bug 1 in the config, this */
+ /* char will not be used, but rendered by the bar driver */
+ cfg_number(section, "asc255bug", 0, 0, 1, &asc255bug);
+ drv_generic_text_bar_add_segment(0, 0, 255, 32); /* ASCII 32 = blank */
+ if (!asc255bug)
+ drv_generic_text_bar_add_segment(255, 255, 255, 255); /* ASCII 255 = block */
+
+ /* initialize generic key pad driver */
+ if ((ret = drv_generic_keypad_init(section, Name)) != 0)
+ return ret;
+
+ /* register text widget */
+ wc = Widget_Text;
+ wc.draw = drv_generic_text_draw;
+ widget_register(&wc);
+
+ /* register icon widget */
+ wc = Widget_Icon;
+ wc.draw = drv_generic_text_icon_draw;
+ widget_register(&wc);
+
+ /* register bar widget */
+ wc = Widget_Bar;
+ wc.draw = drv_generic_text_bar_draw;
+ widget_register(&wc);
+
+ /* register plugins */
+ AddFunction("LCD::contrast", 1, plugin_contrast);
+ AddFunction("LCD::brightness", 1, plugin_brightness);
+
+ return 0;
+}
+
+
+/* close driver & display */
+int drv_L2U_quit(const int quiet)
+{
+
+ info("%s: shutting down.", Name);
+
+ drv_generic_text_quit();
+ drv_generic_keypad_quit();
+
+ /* clear display */
+ drv_L2U_clear();
+
+ /* say goodbye... */
+ if (!quiet) {
+ drv_generic_text_greet("That's all, folks!", NULL);
+ }
+
+ debug("closing USB connection");
+ drv_L2U_close();
+
+ return (0);
+}
+
+
+DRIVER drv_LCD2USB = {
+ .name = Name,
+ .list = drv_L2U_list,
+ .init = drv_L2U_init,
+ .quit = drv_L2U_quit,
+};
diff --git a/drv_LCDLinux.c b/drv_LCDLinux.c
new file mode 100644
index 0000000..7f91094
--- /dev/null
+++ b/drv_LCDLinux.c
@@ -0,0 +1,367 @@
+/* $Id: drv_LCDLinux.c 975 2009-01-18 11:16:20Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/drv_LCDLinux.c $
+ *
+ * driver for the LCD-Linux HD44780 kernel driver
+ * http://lcd-linux.sourceforge.net
+ *
+ * Copyright (C) 2005 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2005 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ *
+ * exported fuctions:
+ *
+ * struct DRIVER drv_LCDLinux
+ *
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/ioctl.h>
+
+#include "debug.h"
+#include "cfg.h"
+#include "qprintf.h"
+#include "plugin.h"
+#include "widget.h"
+#include "widget_text.h"
+#include "widget_icon.h"
+#include "widget_bar.h"
+#include "drv.h"
+#include "drv_generic_text.h"
+
+#define LCD_LINUX_MAIN
+#include <linux/lcd-linux.h>
+#include <linux/hd44780.h>
+
+static char Name[] = "LCD-Linux";
+static char Device[] = "/dev/lcd";
+static int lcdlinux_fd = -1;
+
+
+/****************************************/
+/*** hardware dependant functions ***/
+/****************************************/
+
+static void drv_LL_send(const char *string, const int len)
+{
+ int run, ret;
+
+ for (run = 0; run < 10; run++) {
+ ret = write(lcdlinux_fd, string, len);
+ if (ret >= 0 || errno != EAGAIN)
+ break;
+ if (run > 0)
+ info("%s: write(%s): EAGAIN #%d", Name, Device, run);
+ usleep(1000);
+ }
+
+ if (ret < 0) {
+ error("%s: write(%s) failed: %s", Name, Device, strerror(errno));
+ } else if (ret != len) {
+ error("%s: partial write(%s): len=%d ret=%d", Name, Device, len, ret);
+ }
+
+ return;
+}
+
+
+static void drv_LL_clear(void)
+{
+ /* No return value check since this ioctl cannot fail */
+ ioctl(lcdlinux_fd, LCDL_CLEAR_DISP);
+}
+
+
+static void drv_LL_write(const int row, const int col, const char *data, int len)
+{
+ int pos = row * DCOLS + col;
+
+ if (lseek(lcdlinux_fd, pos, SEEK_SET) == (off_t) - 1) {
+ error("%s: lseek(%s) failed: %s", Name, Device, strerror(errno));
+ }
+ drv_LL_send(data, len);
+}
+
+
+static void drv_LL_defchar(const int ascii, const unsigned char *matrix)
+{
+ char buf[9];
+ int i;
+
+ buf[0] = ascii;
+ for (i = 1; i < 9; i++) {
+ buf[i] = *matrix++ & 0x1f;
+ }
+
+ if (ioctl(lcdlinux_fd, LCDL_SET_CGRAM_CHAR, &buf) != 0) {
+ error("%s: ioctl(LCDL_SET_CGRAM_CHAR) failed: %s", Name, strerror(errno));
+ }
+}
+
+
+static int drv_LL_start(const char *section, const int quiet)
+{
+ char *s;
+ int rows = -1, cols = -1;
+ int use_busy = 0, bus4bits = 0, commit = 0;
+ struct lcd_parameters buf;
+
+ /* emit version information */
+ info("%s: Version %s", Name, LCD_LINUX_VERSION);
+
+ /* get size from config file */
+ s = cfg_get(section, "Size", NULL);
+ if (s != NULL || *s != '\0') {
+ if (sscanf(s, "%dx%d", &cols, &rows) != 2 || rows < 1 || cols < 1) {
+ error("%s: bad %s.Size '%s' from %s", Name, section, s, cfg_source());
+ free(s);
+ return -1;
+ }
+ }
+ free(s);
+
+ /* open device */
+ lcdlinux_fd = open(Device, O_WRONLY);
+ if (lcdlinux_fd == -1) {
+ error("%s: open(%s) failed: %s", Name, Device, strerror(errno));
+ return -1;
+ }
+
+ /* get display size */
+ memset(&buf, 0, sizeof(buf));
+ if (ioctl(lcdlinux_fd, LCDL_GET_PARAM, &buf) != 0) {
+ error("%s: ioctl(LCDL_GET_PARAM) failed: %s", Name, strerror(errno));
+ error("%s: Could not query display information!", Name);
+ return -1;
+ }
+ info("%s: %dx%d display with %d controllers, flags=0x%02lx:",
+ Name, buf.cntr_cols, buf.cntr_rows * buf.num_cntr, buf.num_cntr, buf.flags);
+ info("%s: busy-flag checking %sabled", Name, (buf.flags & HD44780_CHECK_BF) ? "en" : "dis");
+ info("%s: bus width %d bits", Name, (buf.flags & HD44780_4BITS_BUS) ? 4 : 8);
+ info("%s: font size %s", Name, (buf.flags & HD44780_5X10_FONT) ? "5x10" : "5x8");
+
+ /* overwrite width size from lcd4linux.conf */
+ if (buf.vs_rows || buf.vs_cols) {
+ info("%s: disabling virtual screen", Name);
+ buf.vs_rows = 0;
+ buf.vs_cols = 0;
+ commit = 1;
+ }
+
+ if ((rows > 0 && rows != buf.cntr_rows * buf.num_cntr) || (cols > 0 && cols != buf.cntr_cols)) {
+ info("%s: changing size to %dx%d", Name, cols, rows);
+ buf.cntr_rows = rows / buf.num_cntr;
+ buf.cntr_cols = cols;
+ commit = 1;
+ }
+
+ DROWS = buf.cntr_rows * buf.num_cntr;
+ DCOLS = buf.cntr_cols;
+
+ /* overwrite busy-flag checking from lcd4linux.conf */
+ cfg_number(section, "UseBusy", 0, 0, 1, &use_busy);
+ if (use_busy && !(buf.flags & HD44780_CHECK_BF)) {
+ info("%s: activating busy-flag checking", Name);
+ buf.flags |= HD44780_CHECK_BF;
+ commit = 1;
+ } else if (!use_busy && (buf.flags & HD44780_CHECK_BF)) {
+ info("%s: deactivating busy-flag checking", Name);
+ buf.flags &= ~HD44780_CHECK_BF;
+ commit = 1;
+ }
+
+ /* overwrite bus length from lcd4linux.conf */
+ cfg_number(section, "Bus4Bit", 0, 0, 1, &bus4bits);
+ if (bus4bits && !(buf.flags & HD44780_4BITS_BUS)) {
+ info("%s: setting bus length to 4 bits", Name);
+ buf.flags |= HD44780_4BITS_BUS;
+ commit = 1;
+ } else if (!bus4bits && (buf.flags & HD44780_4BITS_BUS)) {
+ info("%s: setting bus length to 8 bits", Name);
+ buf.flags &= ~HD44780_4BITS_BUS;
+ commit = 1;
+ }
+
+ if (commit && ioctl(lcdlinux_fd, LCDL_SET_PARAM, &buf) != 0) {
+ error("%s: ioctl(LCDL_SET_PARAM) failed: %s", Name, strerror(errno));
+ return -1;
+ }
+
+ /* initialize display */
+ drv_LL_clear(); /* clear display */
+
+ /* Disable control characters interpretation. */
+ /* No return value check since this ioctl cannot fail */
+ ioctl(lcdlinux_fd, LCDL_RAW_MODE, 1);
+
+ if (!quiet) {
+ char buffer[40];
+ qprintf(buffer, sizeof(buffer), "%s %dx%d", Name, DCOLS, DROWS);
+ if (drv_generic_text_greet(buffer, "lcd-linux.sf.net")) {
+ sleep(3);
+ drv_LL_clear();
+ }
+ }
+
+ return 0;
+}
+
+
+/****************************************/
+/*** plugins ***/
+/****************************************/
+
+/* none */
+
+
+/****************************************/
+/*** widget callbacks ***/
+/****************************************/
+
+
+/* using drv_generic_text_draw(W) */
+/* using drv_generic_text_icon_draw(W) */
+/* using drv_generic_text_bar_draw(W) */
+
+
+/****************************************/
+/*** exported functions ***/
+/****************************************/
+
+
+/* list models */
+int drv_LL_list(void)
+{
+ printf("LCD-Linux HD44780 kernel driver");
+ return 0;
+}
+
+
+/* initialize driver & display */
+int drv_LL_init(const char *section, const int quiet)
+{
+ WIDGET_CLASS wc;
+ int asc255bug;
+ int ret;
+
+ info("%s: %s", Name, "$Rev: 975 $");
+
+ /* display preferences */
+ XRES = 5; /* pixel width of one char */
+ YRES = 8; /* pixel height of one char */
+ CHARS = 8; /* number of user-defineable characters */
+ CHAR0 = 0; /* ASCII of first user-defineable char */
+ GOTO_COST = -1; /* number of bytes a goto command requires */
+
+ /* real worker functions */
+ drv_generic_text_real_write = drv_LL_write;
+ drv_generic_text_real_defchar = drv_LL_defchar;
+
+
+ /* start display */
+ if ((ret = drv_LL_start(section, quiet)) != 0)
+ return ret;
+
+ /* initialize generic text driver */
+ if ((ret = drv_generic_text_init(section, Name)) != 0)
+ return ret;
+
+ /* initialize generic icon driver */
+ if ((ret = drv_generic_text_icon_init()) != 0)
+ return ret;
+
+ /* initialize generic bar driver */
+ if ((ret = drv_generic_text_bar_init(0)) != 0)
+ return ret;
+
+ /* add fixed chars to the bar driver */
+ /* most displays have a full block on ascii 255, but some have kind of */
+ /* an 'inverted P'. If you specify 'asc255bug 1 in the config, this */
+ /* char will not be used, but rendered by the bar driver */
+ cfg_number(section, "asc255bug", 0, 0, 1, &asc255bug);
+ drv_generic_text_bar_add_segment(0, 0, 255, 32); /* ASCII 32 = blank */
+ if (!asc255bug)
+ drv_generic_text_bar_add_segment(255, 255, 255, 255); /* ASCII 255 = block */
+
+ /* register text widget */
+ wc = Widget_Text;
+ wc.draw = drv_generic_text_draw;
+ widget_register(&wc);
+
+ /* register icon widget */
+ wc = Widget_Icon;
+ wc.draw = drv_generic_text_icon_draw;
+ widget_register(&wc);
+
+ /* register bar widget */
+ wc = Widget_Bar;
+ wc.draw = drv_generic_text_bar_draw;
+ widget_register(&wc);
+
+ /* register plugins */
+ /* none */
+
+ return 0;
+}
+
+
+/* close driver & display */
+int drv_LL_quit(const int quiet)
+{
+
+ info("%s: shutting down.", Name);
+
+ drv_generic_text_quit();
+
+ /* clear display */
+ drv_LL_clear();
+
+ /* say goodbye... */
+ if (!quiet) {
+ drv_generic_text_greet("goodbye!", NULL);
+ }
+
+ /* Enable control characters interpretation. */
+ /* No return value check since this ioctl cannot fail */
+ ioctl(lcdlinux_fd, LCDL_RAW_MODE, 0);
+
+ /* close device */
+ close(lcdlinux_fd);
+
+ return (0);
+}
+
+
+DRIVER drv_LCDLinux = {
+ .name = Name,
+ .list = drv_LL_list,
+ .init = drv_LL_init,
+ .quit = drv_LL_quit,
+};
diff --git a/drv_LCDTerm.c b/drv_LCDTerm.c
new file mode 100644
index 0000000..13556b9
--- /dev/null
+++ b/drv_LCDTerm.c
@@ -0,0 +1,291 @@
+/* $Id: drv_LCDTerm.c 975 2009-01-18 11:16:20Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/drv_LCDTerm.c $
+ *
+ * driver for the LCDTerm serial-to-HD44780 adapter boards
+ * http://www.bobblick.com/techref/projects/lcdterm/lcdterm.html
+ *
+ * Copyright (C) 2005 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2005 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ *
+ * exported fuctions:
+ *
+ * struct DRIVER drv_LCDTerm
+ *
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <unistd.h>
+
+#include "debug.h"
+#include "cfg.h"
+#include "qprintf.h"
+#include "plugin.h"
+#include "widget.h"
+#include "widget_text.h"
+#include "widget_icon.h"
+#include "widget_bar.h"
+#include "drv.h"
+#include "drv_generic_text.h"
+#include "drv_generic_serial.h"
+
+#define LCD_CLEAR 0x03
+#define LCD_CMD 0x12
+#define LCD_DATA 0x14
+
+static char Name[] = "LCDTerm";
+
+
+/****************************************/
+/*** hardware dependant functions ***/
+/****************************************/
+
+static void drv_LT_clear(void)
+{
+ char cmd[1];
+
+ cmd[0] = LCD_CLEAR; /* clear display */
+ drv_generic_serial_write(cmd, 1); /* clear screen */
+}
+
+
+static int drv_LT_send(const char request, const char value)
+{
+ char buf[2];
+
+ buf[0] = request;
+ buf[1] = value;
+ drv_generic_serial_write(buf, 2);
+
+ return 0;
+}
+
+
+static void drv_LT_command(const char cmd)
+{
+ drv_LT_send(LCD_CMD, cmd);
+}
+
+
+static void drv_LT_write(const int row, const int col, const char *data, int len)
+{
+ int pos;
+
+ /* 16x4 Displays use a slightly different layout */
+ if (DCOLS == 16 && DROWS == 4) {
+ pos = (row % 2) * 64 + (row / 2) * 16 + col;
+ } else {
+ pos = (row % 2) * 64 + (row / 2) * 20 + col;
+ }
+
+ drv_LT_command(0x80 | pos);
+
+ while (len--) {
+ drv_LT_send(LCD_DATA, *data++);
+ }
+}
+
+static void drv_LT_defchar(const int ascii, const unsigned char *matrix)
+{
+ int i;
+
+ drv_LT_command(0x40 | 8 * ascii);
+
+ for (i = 0; i < 8; i++) {
+ drv_LT_send(LCD_DATA, *matrix++ & 0x1f);
+ }
+}
+
+
+static int drv_LT_start(const char *section, const int quiet)
+{
+ int rows = -1, cols = -1;
+ char *s;
+
+ if (drv_generic_serial_open(section, Name, 0) < 0)
+ return -1;
+
+ s = cfg_get(section, "Size", NULL);
+ if (s == NULL || *s == '\0') {
+ error("%s: no '%s.Size' entry from %s", Name, section, cfg_source());
+ return -1;
+ }
+ if (sscanf(s, "%dx%d", &cols, &rows) != 2 || rows < 1 || cols < 1) {
+ error("%s: bad %s.Size '%s' from %s", Name, section, s, cfg_source());
+ free(s);
+ return -1;
+ }
+
+ DROWS = rows;
+ DCOLS = cols;
+
+ /* initialize display */
+ drv_LT_command(0x29); /* 8 Bit mode, 1/16 duty cycle, 5x8 font */
+ drv_LT_command(0x08); /* Display off, cursor off, blink off */
+ drv_LT_command(0x0c); /* Display on, cursor off, blink off */
+ drv_LT_command(0x06); /* curser moves to right, no shift */
+
+ drv_LT_clear(); /* clear display */
+
+ if (!quiet) {
+ char buffer[40];
+ qprintf(buffer, sizeof(buffer), "%s %dx%d", Name, DCOLS, DROWS);
+ if (drv_generic_text_greet(buffer, "www.bwct.de")) {
+ sleep(3);
+ drv_LT_clear();
+ }
+ }
+
+ return 0;
+}
+
+
+/****************************************/
+/*** plugins ***/
+/****************************************/
+
+/* none */
+
+
+/****************************************/
+/*** widget callbacks ***/
+/****************************************/
+
+
+/* using drv_generic_text_draw(W) */
+/* using drv_generic_text_icon_draw(W) */
+/* using drv_generic_text_bar_draw(W) */
+
+
+/****************************************/
+/*** exported functions ***/
+/****************************************/
+
+
+/* list models */
+int drv_LT_list(void)
+{
+ printf("LCDTerm serial-to-HD44780 adapter board");
+ return 0;
+}
+
+
+/* initialize driver & display */
+int drv_LT_init(const char *section, const int quiet)
+{
+ WIDGET_CLASS wc;
+ int asc255bug;
+ int ret;
+
+ info("%s: %s", Name, "$Rev: 975 $");
+
+ /* display preferences */
+ XRES = 5; /* pixel width of one char */
+ YRES = 8; /* pixel height of one char */
+ CHARS = 8; /* number of user-defineable characters */
+ CHAR0 = 0; /* ASCII of first user-defineable char */
+
+ /* Fixme: */
+ GOTO_COST = 2; /* number of bytes a goto command requires */
+
+ /* real worker functions */
+ drv_generic_text_real_write = drv_LT_write;
+ drv_generic_text_real_defchar = drv_LT_defchar;
+
+
+ /* start display */
+ if ((ret = drv_LT_start(section, quiet)) != 0)
+ return ret;
+
+ /* initialize generic text driver */
+ if ((ret = drv_generic_text_init(section, Name)) != 0)
+ return ret;
+
+ /* initialize generic icon driver */
+ if ((ret = drv_generic_text_icon_init()) != 0)
+ return ret;
+
+ /* initialize generic bar driver */
+ if ((ret = drv_generic_text_bar_init(0)) != 0)
+ return ret;
+
+ /* add fixed chars to the bar driver */
+ /* most displays have a full block on ascii 255, but some have kind of */
+ /* an 'inverted P'. If you specify 'asc255bug 1 in the config, this */
+ /* char will not be used, but rendered by the bar driver */
+ cfg_number(section, "asc255bug", 0, 0, 1, &asc255bug);
+ drv_generic_text_bar_add_segment(0, 0, 255, 32); /* ASCII 32 = blank */
+ if (!asc255bug)
+ drv_generic_text_bar_add_segment(255, 255, 255, 255); /* ASCII 255 = block */
+
+ /* register text widget */
+ wc = Widget_Text;
+ wc.draw = drv_generic_text_draw;
+ widget_register(&wc);
+
+ /* register icon widget */
+ wc = Widget_Icon;
+ wc.draw = drv_generic_text_icon_draw;
+ widget_register(&wc);
+
+ /* register bar widget */
+ wc = Widget_Bar;
+ wc.draw = drv_generic_text_bar_draw;
+ widget_register(&wc);
+
+ /* register plugins */
+ /* none */
+
+ return 0;
+}
+
+
+/* close driver & display */
+int drv_LT_quit(const int quiet)
+{
+
+ info("%s: shutting down.", Name);
+
+ drv_generic_text_quit();
+
+ /* clear display */
+ drv_LT_clear();
+
+ /* say goodbye... */
+ if (!quiet) {
+ drv_generic_text_greet("goodbye!", NULL);
+ }
+
+ drv_generic_serial_close();
+
+ return (0);
+}
+
+
+DRIVER drv_LCDTerm = {
+ .name = Name,
+ .list = drv_LT_list,
+ .init = drv_LT_init,
+ .quit = drv_LT_quit,
+};
diff --git a/drv_LEDMatrix.c b/drv_LEDMatrix.c
new file mode 100644
index 0000000..f4b31a8
--- /dev/null
+++ b/drv_LEDMatrix.c
@@ -0,0 +1,321 @@
+/* $Id: drv_LEDMatrix.c 975 2009-01-18 11:16:20Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/drv_LEDMatrix.c $
+ *
+ * LED matrix driver for LCD4Linux
+ * (see http://www.harbaum.org/till/ledmatrix for hardware)
+ *
+ * Copyright (C) 2006 Till Harbaum <till@harbaum.org>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ *
+ * exported fuctions:
+ *
+ * struct DRIVER drv_LEDMatrix
+ *
+ */
+
+/*
+ * Options:
+ * IPAddress
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <unistd.h>
+#include <termios.h>
+#include <fcntl.h>
+#include <sys/time.h>
+
+/* include network specific headers */
+#include <arpa/inet.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <sys/select.h>
+#include <netdb.h>
+
+#include "debug.h"
+#include "cfg.h"
+#include "qprintf.h"
+#include "plugin.h"
+#include "widget.h"
+#include "widget_text.h"
+#include "widget_icon.h"
+#include "widget_bar.h"
+#include "drv.h"
+#include "drv_generic_graphic.h"
+
+/* display command bytes */
+#define DSP_CMD_ECHO 0
+#define DSP_CMD_NOP 1
+#define DSP_CMD_IMAGE 2
+#define DSP_CMD_ACK 3
+#define DSP_CMD_IR 4
+#define DSP_CMD_BEEP 5
+
+#define DSP_DEFAULT_PORT 4711
+
+#define DSP_MEM (80 * 32 * 2 / 8)
+
+#define DEFAULT_X_OFFSET 1 /* with a font width of 6 */
+
+static char Name[] = "LEDMatrix";
+static char *IPAddress = NULL;
+static int sock = -1;
+static struct sockaddr_in dsp_addr;
+static unsigned char tx_buffer[DSP_MEM + 1];
+static int port = DSP_DEFAULT_PORT;
+
+static void drv_LEDMatrix_blit(const int row, const int col, const int height, const int width)
+{
+ int r, c, i;
+ fd_set rfds;
+ struct timeval tv;
+ unsigned char reply[256];
+ struct sockaddr_in cli_addr;
+ socklen_t fromlen;
+ int ack = 0;
+ int timeout = 10;
+
+ for (r = row; r < row + height; r++) {
+ for (c = col; c < col + width; c++) {
+ /* LEDMATRIX supports three colors: 10b == green, 01b == red, 11b == amber */
+
+ unsigned char color = 0;
+ RGBA p = drv_generic_graphic_rgb(r, c);
+ if (p.G >= 128)
+ color |= 0x80;
+ if (p.R >= 128)
+ color |= 0x40;
+ /* ignore blue ... */
+
+ tx_buffer[1 + 20 * r + c / 4] &= ~(0xc0 >> (2 * (c & 3)));
+ tx_buffer[1 + 20 * r + c / 4] |= color >> (2 * (c & 3));
+ }
+ }
+
+ /* scan entire display */
+ tx_buffer[0] = DSP_CMD_IMAGE;
+
+ do {
+
+ if ((sendto(sock, tx_buffer, DSP_MEM + 1, 0, (struct sockaddr *) &dsp_addr, sizeof(dsp_addr))) != DSP_MEM + 1)
+ error("%s: sendto error on socket", Name);
+
+ /* now wait for reply */
+
+ FD_ZERO(&rfds);
+ FD_SET(sock, &rfds);
+ tv.tv_sec = 0;
+ tv.tv_usec = 100000;
+
+ /* wait 1 sec for ack */
+ if ((i = select(FD_SETSIZE, &rfds, NULL, NULL, &tv)) < 0) {
+ info("%s: Select error: %s", Name, strerror(errno));
+ }
+
+ if (FD_ISSET(sock, &rfds)) {
+ /* wait for ack */
+ fromlen = sizeof(dsp_addr);
+ i = recvfrom(sock, reply, sizeof(reply), 0, (struct sockaddr *) &cli_addr, &fromlen);
+ if (i < 0) {
+ info("%s: Receive error: %s", Name, strerror(errno));
+ } else {
+ if ((i == 2) && (reply[0] == DSP_CMD_ACK) && (reply[1] == DSP_CMD_IMAGE)) {
+ ack = 1;
+ } else if ((i > 1) && (reply[0] == DSP_CMD_IR)) {
+ /* maybe used later: */
+ /* ir_receive(reply+1, i-1); */
+ } else {
+ info("%s: Unexpected reply message", Name);
+ }
+ }
+ }
+ timeout--;
+ } while ((!ack) && (timeout > 0));
+
+ if (timeout == 0) {
+ error("%s: display reply timeout", Name);
+ }
+}
+
+static int drv_LEDMatrix_start(const char *section)
+{
+ char *s;
+ struct sockaddr_in cli_addr;
+ struct hostent *hp;
+ int val;
+
+ IPAddress = cfg_get(section, "IPAddress", NULL);
+ if (IPAddress == NULL || *IPAddress == '\0') {
+ error("%s: no '%s.IPAddress' entry from %s", Name, section, cfg_source());
+ return -1;
+ }
+
+ if (cfg_number(section, "Port", 0, 0, 65535, &val) > 0) {
+ info("%s: port set to %d", Name, val);
+ port = val;
+ } else {
+ info("%s: using default port %d", Name, port);
+ }
+
+ /* display size is hard coded */
+ DCOLS = 80;
+ DROWS = 32;
+
+ if (sscanf(s = cfg_get(section, "font", "6x8"), "%dx%d", &XRES, &YRES) != 2 || XRES < 1 || YRES < 1) {
+ error("%s: bad %s.Font '%s' from %s", Name, section, s, cfg_source());
+ free(s);
+ return -1;
+ }
+ free(s);
+
+ /* contact display */
+ info("%s: contacting %s", Name, IPAddress);
+
+ /* try to resolve as a hostname */
+ if ((hp = gethostbyname(IPAddress)) == NULL) {
+ error("%s: unable to resolve hostname %s: %s", Name, IPAddress, strerror(errno));
+ return -1;
+ }
+
+ /* open datagram socket */
+ if ((sock = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
+ error("%s: could not create socket: %s", Name, strerror(errno));
+ return -1;
+ }
+
+ memset((char *) &dsp_addr, 0, sizeof(dsp_addr));
+ dsp_addr.sin_family = AF_INET;
+ dsp_addr.sin_addr.s_addr = *(int *) hp->h_addr;
+ dsp_addr.sin_port = htons(port);
+
+ cli_addr.sin_family = AF_INET;
+ cli_addr.sin_addr.s_addr = htons(INADDR_ANY);
+ cli_addr.sin_port = htons(port);
+
+ if (bind(sock, (struct sockaddr *) &cli_addr, sizeof(cli_addr)) < 0) {
+ error("%s: can't bind local address: %s", Name, strerror(errno));
+ return -1;
+ }
+
+ memset(tx_buffer, 0, sizeof(tx_buffer));
+
+ return 0;
+}
+
+
+
+/****************************************/
+/*** plugins ***/
+/****************************************/
+
+/* none at the moment... */
+
+
+/****************************************/
+/*** widget callbacks ***/
+/****************************************/
+
+
+/* using drv_generic_graphic_draw(W) */
+/* using drv_generic_graphic_icon_draw(W) */
+/* using drv_generic_graphic_bar_draw(W) */
+
+
+/****************************************/
+/*** exported functions ***/
+/****************************************/
+
+
+/* list models */
+int drv_LEDMatrix_list(void)
+{
+ printf("LEDMATRIX by Till Harbaum");
+ return 0;
+}
+
+
+/* initialize driver & display */
+int drv_LEDMatrix_init(const char *section, const __attribute__ ((unused))
+ int quiet)
+{
+ WIDGET_CLASS wc;
+ int ret;
+
+ /* real worker functions */
+ drv_generic_graphic_real_blit = drv_LEDMatrix_blit;
+
+ /* start display */
+ if ((ret = drv_LEDMatrix_start(section)) != 0)
+ return ret;
+
+ /* initialize generic graphic driver */
+ if ((ret = drv_generic_graphic_init(section, Name)) != 0)
+ return ret;
+
+ /* register text widget */
+ wc = Widget_Text;
+ wc.draw = drv_generic_graphic_draw;
+ widget_register(&wc);
+
+ /* register icon widget */
+ wc = Widget_Icon;
+ wc.draw = drv_generic_graphic_icon_draw;
+ widget_register(&wc);
+
+ /* register bar widget */
+ wc = Widget_Bar;
+ wc.draw = drv_generic_graphic_bar_draw;
+ widget_register(&wc);
+
+ /* register plugins */
+ /* none at the moment... */
+
+
+ return 0;
+}
+
+
+/* close driver & display */
+int drv_LEDMatrix_quit(const __attribute__ ((unused))
+ int quiet)
+{
+
+ info("%s: shutting down.", Name);
+ drv_generic_graphic_quit();
+
+ if (sock != -1)
+ close(sock);
+
+ return (0);
+}
+
+
+DRIVER drv_LEDMatrix = {
+ .name = Name,
+ .list = drv_LEDMatrix_list,
+ .init = drv_LEDMatrix_init,
+ .quit = drv_LEDMatrix_quit,
+};
diff --git a/drv_LPH7508.c b/drv_LPH7508.c
new file mode 100644
index 0000000..013c77a
--- /dev/null
+++ b/drv_LPH7508.c
@@ -0,0 +1,528 @@
+/* $Id: drv_LPH7508.c 840 2007-09-09 12:17:42Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/drv_LPH7508.c $
+ *
+ * driver for Pollin LPH7508
+ *
+ * Copyright (C) 2005 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2005 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ *
+ * exported fuctions:
+ *
+ * struct DRIVER drv_LPH7508
+ *
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <unistd.h>
+#include <termios.h>
+#include <fcntl.h>
+#include <sys/time.h>
+
+#include "debug.h"
+#include "cfg.h"
+#include "qprintf.h"
+#include "udelay.h"
+#include "plugin.h"
+#include "drv.h"
+#include "drv_generic_graphic.h"
+#include "drv_generic_gpio.h"
+#include "drv_generic_parport.h"
+
+#ifdef WITH_DMALLOC
+#include <dmalloc.h>
+#endif
+
+static char Name[] = "LPH7508";
+
+
+static unsigned char SIGNAL_RES;
+static unsigned char SIGNAL_CS1;
+static unsigned char SIGNAL_RW;
+static unsigned char SIGNAL_A0;
+
+static int PAGES, SROWS, SCOLS;
+
+static unsigned char *Buffer1, *Buffer2;
+
+
+
+/****************************************/
+/*** hardware dependant functions ***/
+/****************************************/
+
+static void drv_L7_write_ctrl(const unsigned char data)
+{
+ /* put data on DB1..DB8 */
+ drv_generic_parport_data(data);
+
+ /* CS1 = high, RW = low, A0 = low */
+ drv_generic_parport_control(SIGNAL_CS1 | SIGNAL_RW | SIGNAL_A0, SIGNAL_CS1);
+
+ /* Address Setup Time = 10 ns */
+ /* Data Setup Time = 20 ns */
+ ndelay(20);
+
+ /* Control L Pulse Width = 22 ns */
+ drv_generic_parport_toggle(SIGNAL_CS1, 0, 22);
+
+ /* Address & Data Hold Time = 10 ns */
+ ndelay(10);
+}
+
+
+static void drv_L7_write_data(const unsigned char data)
+{
+ /* put data on DB1..DB8 */
+ drv_generic_parport_data(data);
+
+ /* CS1 = high, RW = low, A0 = high */
+ drv_generic_parport_control(SIGNAL_CS1 | SIGNAL_RW | SIGNAL_A0, SIGNAL_CS1 | SIGNAL_A0);
+
+ /* Address Setup Time = 10 ns */
+ /* Data Setup Time = 20 ns */
+ ndelay(20);
+
+ /* Control L Pulse Width = 22 ns */
+ drv_generic_parport_toggle(SIGNAL_CS1, 0, 22);
+
+ /* Address & Data Hold Time = 10 ns */
+ ndelay(10);
+}
+
+
+static void drv_L7_page(int page)
+{
+ static int cp = -1;
+
+ if (page != cp) {
+ cp = page;
+ drv_L7_write_ctrl(0xb0 | cp);
+ }
+
+}
+
+
+static void drv_L7_put(int col, int val)
+{
+ static int cc = -1;
+
+ /* select page 8 */
+ drv_L7_page(8);
+
+ if (col != cc) {
+ cc = col;
+ drv_L7_write_ctrl(0x00 | (cc & 0x0f));
+ drv_L7_write_ctrl(0x10 | (cc >> 4));
+ }
+ drv_L7_write_data(val);
+ cc++;
+}
+
+
+static void drv_L7_clear(void)
+{
+ int p, c;
+
+ for (p = 0; p < PAGES; p++) {
+ /* select page */
+ drv_L7_page(p);
+ /* select column address */
+ drv_L7_write_ctrl(0x00);
+ drv_L7_write_ctrl(0x10);
+ for (c = 0; c < SCOLS; c++) {
+ drv_L7_write_data(0);
+ }
+ }
+}
+
+
+static void drv_L7_blit(const int row, const int col, const int height, const int width)
+{
+ int r, p, c, a;
+ unsigned char m;
+
+ /* transfer layout to display framebuffer */
+ for (r = row; r < row + height; r++) {
+ /* do not process extra row for symbols */
+ if (r >= SROWS - 1)
+ break;
+ /* page */
+ p = r / 8;
+ for (c = col; c < col + width; c++) {
+ if (c >= SCOLS)
+ break;
+ /* RAM address */
+ a = p * SCOLS + c;
+ /* bit mask */
+ m = 1 << (r % 8);
+ if (drv_generic_graphic_black(r, c)) {
+ /* set bit */
+ Buffer1[a] |= m;
+ } else {
+ /* clear bit */
+ Buffer1[a] &= ~m;
+ }
+ }
+ }
+
+ /* process display framebuffer */
+ for (p = row / 8; p <= (row + height) / 8; p++) {
+ int i, j, a, e;
+ if (p >= PAGES)
+ break;
+ for (i = col; i < col + width; i++) {
+ if (i >= SCOLS)
+ break;
+ a = p * SCOLS + i;
+ if (Buffer1[a] == Buffer2[a])
+ continue;
+ for (j = i, e = 0; i < col + width; i++) {
+ a = p * SCOLS + i;
+ if (Buffer1[a] == Buffer2[a]) {
+ if (++e > 2)
+ break;
+ } else {
+ e = 0;
+ }
+ }
+ /* select page */
+ drv_L7_page(p);
+ /* column address */
+ /* first column address = 32 */
+ drv_L7_write_ctrl(0x00 | ((j + 32) & 0x0f));
+ drv_L7_write_ctrl(0x10 | ((j + 32) >> 4));
+ /* data */
+ for (j = j; j <= i - e; j++) {
+ a = p * SCOLS + j;
+ drv_L7_write_data(Buffer1[a]);
+ Buffer2[a] = Buffer1[a];
+ }
+ }
+ }
+}
+
+
+static int drv_L7_GPO(const int num, const int val)
+{
+ int v = 0;
+
+ switch (num) {
+ case 0:
+ /* battery symbol */
+ v = (val > 0) ? 1 : 0;
+ drv_L7_put(32, v);
+ break;
+ case 1:
+ /* battery level */
+ if (val < 0) {
+ v = 0;
+ drv_L7_put(46, v);
+ drv_L7_put(47, v);
+ drv_L7_put(48, v);
+ drv_L7_put(49, v);
+ } else {
+ v = val & 0x0f;
+ drv_L7_put(46, (v & 1) ? 1 : 0);
+ drv_L7_put(47, (v & 2) ? 1 : 0);
+ drv_L7_put(48, (v & 4) ? 1 : 0);
+ drv_L7_put(49, (v & 8) ? 1 : 0);
+ }
+ break;
+ case 2:
+ /* earpiece */
+ v = (val > 0) ? 1 : 0;
+ drv_L7_put(59, v);
+ break;
+ case 3:
+ /* triangle */
+ v = (val > 0) ? 1 : 0;
+ drv_L7_put(69, v);
+ Buffer1[8 * SCOLS + 69 - 32] = (val > 0);
+ break;
+ case 4:
+ /* head */
+ v = (val > 0) ? 1 : 0;
+ drv_L7_put(83, v);
+ Buffer1[8 * SCOLS + 83 - 32] = (val > 0);
+ break;
+ case 5:
+ /* message */
+ v = (val > 0) ? 1 : 0;
+ drv_L7_put(98, v);
+ Buffer1[8 * SCOLS + 98 - 32] = (val > 0);
+ break;
+ case 6:
+ /* antenna */
+ v = (val > 0) ? 1 : 0;
+ drv_L7_put(117, v);
+ Buffer1[8 * SCOLS + 117 - 32] = (val > 0);
+ break;
+ case 7:
+ /* signal level */
+ if (val < 0) {
+ v = 0;
+ drv_L7_put(112, v);
+ drv_L7_put(113, v);
+ drv_L7_put(114, v);
+ drv_L7_put(115, v);
+ } else {
+ v = val & 0x0f;
+ drv_L7_put(112, (v & 1) ? 1 : 0);
+ drv_L7_put(113, (v & 2) ? 1 : 0);
+ drv_L7_put(114, (v & 4) ? 1 : 0);
+ drv_L7_put(115, (v & 8) ? 1 : 0);
+ }
+ break;
+ }
+
+ return v;
+}
+
+
+static int drv_L7_contrast(int contrast)
+{
+ if (contrast < 0)
+ contrast = 0;
+ if (contrast > 31)
+ contrast = 31;
+
+ drv_L7_write_ctrl(0x80 | contrast);
+
+ return contrast;
+}
+
+
+static int drv_L7_start(const char *section)
+{
+ char *s;
+ int contrast;
+
+ /* fixed size */
+ DROWS = 64;
+ DCOLS = 100;
+ GPOS = 8;
+
+ /* SED1560 display RAM layout */
+ PAGES = 8;
+ SROWS = 64;
+ SCOLS = 166;
+
+ s = cfg_get(section, "Font", "6x8");
+ if (s == NULL || *s == '\0') {
+ error("%s: no '%s.Font' entry from %s", Name, section, cfg_source());
+ return -1;
+ }
+
+ XRES = -1;
+ YRES = -1;
+ if (sscanf(s, "%dx%d", &XRES, &YRES) != 2 || XRES < 1 || YRES < 1) {
+ error("%s: bad Font '%s' from %s", Name, s, cfg_source());
+ return -1;
+ }
+
+ /* Fixme: provider other fonts someday... */
+ if (XRES != 6 && YRES != 8) {
+ error("%s: bad Font '%s' from %s (only 6x8 at the moment)", Name, s, cfg_source());
+ return -1;
+ }
+
+ /* provide room for page 8 (symbols) */
+ Buffer1 = malloc(PAGES * SCOLS);
+ if (Buffer1 == NULL) {
+ error("%s: framebuffer #1 could not be allocated: malloc() failed", Name);
+ return -1;
+ }
+
+ Buffer2 = malloc(PAGES * SCOLS);
+ if (Buffer2 == NULL) {
+ error("%s: framebuffer #2 could not be allocated: malloc() failed", Name);
+ return -1;
+ }
+
+ memset(Buffer1, 0, PAGES * SCOLS * sizeof(*Buffer1));
+ memset(Buffer2, 0, PAGES * SCOLS * sizeof(*Buffer2));
+
+ if (drv_generic_parport_open(section, Name) != 0) {
+ error("%s: could not initialize parallel port!", Name);
+ return -1;
+ }
+
+ if ((SIGNAL_RES = drv_generic_parport_hardwire_ctrl("RES", "INIT")) == 0xff)
+ return -1;
+ if ((SIGNAL_CS1 = drv_generic_parport_hardwire_ctrl("CS1", "STROBE")) == 0xff)
+ return -1;
+ if ((SIGNAL_RW = drv_generic_parport_hardwire_ctrl("RW", "SLCTIN")) == 0xff)
+ return -1;
+ if ((SIGNAL_A0 = drv_generic_parport_hardwire_ctrl("A0", "AUTOFD")) == 0xff)
+ return -1;
+
+ /* rise RES, CS1, RW and A0 */
+ drv_generic_parport_control(SIGNAL_RES | SIGNAL_CS1 | SIGNAL_RW | SIGNAL_A0,
+ SIGNAL_RES | SIGNAL_CS1 | SIGNAL_RW | SIGNAL_A0);
+
+ /* set direction: write */
+ drv_generic_parport_direction(0);
+
+ /* reset display: lower RESET for 1 usec */
+ drv_generic_parport_control(SIGNAL_RES, 0);
+ udelay(1);
+ drv_generic_parport_control(SIGNAL_RES, SIGNAL_RES);
+ udelay(100);
+
+ /* just to make sure: send a software reset */
+ drv_L7_write_ctrl(0xe2);
+ udelay(20000);
+
+ drv_L7_write_ctrl(0xAE); /* Display off */
+ drv_L7_write_ctrl(0x40); /* Start Display Line = 0 */
+ drv_L7_write_ctrl(0x20); /* reverse line driving off */
+ drv_L7_write_ctrl(0xCC); /* OutputStatus = $0C, 102x64 */
+ drv_L7_write_ctrl(0xA0); /* ADC = normal */
+ drv_L7_write_ctrl(0xA9); /* LCD-Duty = 1/64 */
+ drv_L7_write_ctrl(0xAB); /* LCD-Duty +1 (1/65, symbols) */
+ drv_L7_write_ctrl(0x25); /* power supply on */
+ udelay(100 * 1000); /* wait 100 msec */
+ drv_L7_write_ctrl(0xED); /* power supply on completion */
+ drv_L7_write_ctrl(0x8F); /* Contrast medium */
+ drv_L7_write_ctrl(0xA4); /* Display Test off */
+ drv_L7_write_ctrl(0xAF); /* Display on */
+ drv_L7_write_ctrl(0xA6); /* Display on */
+
+ /* clear display */
+ drv_L7_clear();
+
+ if (cfg_number(section, "Contrast", 15, 0, 31, &contrast) > 0) {
+ drv_L7_contrast(contrast);
+ }
+
+ return 0;
+}
+
+
+/****************************************/
+/*** plugins ***/
+/****************************************/
+
+
+static void plugin_contrast(RESULT * result, RESULT * arg1)
+{
+ double contrast = drv_L7_contrast(R2N(arg1));
+ SetResult(&result, R_NUMBER, &contrast);
+}
+
+
+/****************************************/
+/*** exported functions ***/
+/****************************************/
+
+
+/* list models */
+int drv_L7_list(void)
+{
+ printf("LPH7508");
+ return 0;
+}
+
+
+/* initialize driver & display */
+int drv_L7_init(const char *section, const int quiet)
+{
+ int ret;
+
+ info("%s: %s", Name, "$Rev: 840 $");
+
+ /* real worker functions */
+ drv_generic_graphic_real_blit = drv_L7_blit;
+ drv_generic_gpio_real_set = drv_L7_GPO;
+
+ /* start display */
+ if ((ret = drv_L7_start(section)) != 0)
+ return ret;
+
+ /* initialize generic graphic driver */
+ if ((ret = drv_generic_graphic_init(section, Name)) != 0)
+ return ret;
+
+ /* initialize generic GPIO driver */
+ if ((ret = drv_generic_gpio_init(section, Name)) != 0)
+ return ret;
+
+ if (!quiet) {
+ char buffer[40];
+ qprintf(buffer, sizeof(buffer), "%s %dx%d", Name, DCOLS, DROWS);
+ if (drv_generic_graphic_greet(buffer, NULL)) {
+ sleep(3);
+ drv_generic_graphic_clear();
+ }
+ }
+
+
+ /* register plugins */
+ AddFunction("LCD::contrast", 1, plugin_contrast);
+
+
+ return 0;
+}
+
+
+/* close driver & display */
+int drv_L7_quit(const int quiet)
+{
+
+ info("%s: shutting down display.", Name);
+
+ drv_generic_graphic_clear();
+
+ if (!quiet) {
+ drv_generic_graphic_greet("goodbye!", NULL);
+ }
+
+ drv_generic_graphic_quit();
+ drv_generic_gpio_quit();
+ drv_generic_parport_close();
+
+ if (Buffer1) {
+ free(Buffer1);
+ Buffer1 = NULL;
+ }
+
+ if (Buffer2) {
+ free(Buffer2);
+ Buffer2 = NULL;
+ }
+
+ return (0);
+}
+
+
+DRIVER drv_LPH7508 = {
+ .name = Name,
+ .list = drv_L7_list,
+ .init = drv_L7_init,
+ .quit = drv_L7_quit,
+};
diff --git a/drv_LUIse.c b/drv_LUIse.c
new file mode 100644
index 0000000..644d3b4
--- /dev/null
+++ b/drv_LUIse.c
@@ -0,0 +1,336 @@
+/* $Id: drv_LUIse.c 798 2007-05-04 11:35:52Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/drv_LUIse.c $
+ *
+ * LUIse lcd4linux driver
+ *
+ * Copyright (C) 2005 Theo Schneider <theo@schneider-berlin.net>
+ * Copyright (C) 2005 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ *
+ * exported fuctions:
+ *
+ * struct DRIVER drv_LUIse
+ *
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+
+#include <usb.h>
+#include <luise.h>
+
+#include "debug.h"
+#include "cfg.h"
+#include "qprintf.h"
+#include "udelay.h"
+#include "plugin.h"
+#include "drv.h"
+#include "drv_generic_graphic.h"
+
+static char Name[] = "LUIse";
+
+/* default Wert */
+static int devNum = 0;
+
+
+
+/****************************************/
+/*** hardware dependant functions ***/
+/****************************************/
+static void drv_LUIse_clear(void)
+{
+ unsigned char buf[9600];
+ int x;
+
+ // clear text
+ LUI_Text(devNum, 0, 0, 320, 240, 0, 0, 1, 1, "");
+
+ // clear picture
+ for (x = 0; x < 9600; x++)
+ buf[x] = 0x00;
+ LUI_Bitmap(devNum, 0, 0, 0, 0, 0, DCOLS, DROWS, DCOLS, DROWS, buf);
+ LUI_Bitmap(devNum, 1, 0, 0, 0, 0, DCOLS, DROWS, DCOLS, DROWS, buf);
+}
+
+
+static void drv_LUIse_blit(const int row, const int col, const int height, const int width)
+{
+ int r, c;
+
+ for (r = row; r < row + height; r++) {
+ for (c = col; c < col + width; c++) {
+ if (drv_generic_graphic_black(r, c)) {
+ LUI_SetPixel(devNum, 0, c, r, 1);
+ } else {
+ LUI_SetPixel(devNum, 0, c, r, 0);
+ }
+ }
+ }
+}
+
+static int drv_LUIse_contrast(int contrast)
+{
+ /* adjust limits according to the display */
+ if (contrast < 0)
+ contrast = 0;
+ if (contrast > 255)
+ contrast = 255;
+
+ LUI_SetContrast(devNum, contrast);
+
+ return contrast;
+}
+
+static int drv_LUIse_backlight(int backlight)
+{
+ if (backlight < 0)
+ backlight = 0;
+ if (backlight > 1)
+ backlight = 1;
+
+ LUI_CCFL(devNum, backlight);
+
+ return backlight;
+}
+
+
+/* start graphic display */
+static int drv_LUIse_start(const char *section)
+{
+ char *s;
+ int gfxmode, gfxinvert, ScreenRotation, IOrefresh;
+ int contrast, backlight;
+
+ /* read devNum from config */
+ s = cfg_get(section, "DeviceNum", 0);
+ if (s == NULL || *s == '\0') {
+ error("%s: no '%s.DeviceNum' entry from %s", Name, section, cfg_source());
+ return -1;
+ }
+ if (sscanf(s, "%d", &devNum) < 0 || devNum > 4) {
+ error("%s: bad DeviceNum '%s' from %s", Name, s, cfg_source());
+ return -1;
+ }
+ info("%s: using DeviceNum '%d'", Name, devNum);
+
+ /* open communication with the display */
+ if (LUI_OpenDevice(devNum) > 0) {
+ error("unable to open DeviceNum: %d", devNum);
+ return -1;
+ }
+
+ /*
+ * 0 : gfxmode 0 = or, 1 = and, 2 = xor
+ * 0 : gfxinvert 0 = normal, 1 = invert
+ * 0 : ScreenRotation 0 =, 1 =, 2 =, 3 =,
+ * 2 : IOrefresh 0 = 25ms...255=256*25ms
+ */
+
+ s = cfg_get(section, "Mode", "0.0.0.2");
+ if (s == NULL || *s == '\0') {
+ error("%s: no '%s.Mode' entry from %s", Name, section, cfg_source());
+ return -1;
+ }
+
+ if (sscanf(s, "%d.%d.%d.%d", &gfxmode, &gfxinvert, &ScreenRotation, &IOrefresh) != 4 ||
+ gfxmode < 0 || gfxmode > 2 || gfxinvert < 0 || gfxinvert > 1 ||
+ ScreenRotation < 0 || ScreenRotation > 255 || IOrefresh < 0 || IOrefresh > 255) {
+ error("%s: bad Mode '%s' from %s", Name, s, cfg_source());
+ return -1;
+ }
+
+ if (LUI_LCDmode(devNum, gfxmode, gfxinvert, ScreenRotation, IOrefresh) > 0) {
+ error("Error LUI_LCDmode");
+ return -1;
+ }
+
+ switch (ScreenRotation) {
+ case 0:{
+ DCOLS = 320;
+ DROWS = 240;
+ break;
+ }
+ case 1:{
+ DCOLS = 240;
+ DROWS = 320;
+ break;
+ }
+ case 2:{
+ DCOLS = 320;
+ DROWS = 240;
+ break;
+ }
+ case 3:{
+ DCOLS = 240;
+ DROWS = 320;
+ break;
+ }
+ }
+
+ s = cfg_get(section, "Font", "6x8");
+ if (s == NULL || *s == '\0') {
+ error("%s: no '%s.Font' entry from %s", Name, section, cfg_source());
+ return -1;
+ }
+
+ XRES = -1;
+ YRES = -1;
+ if (sscanf(s, "%dx%d", &XRES, &YRES) != 2 || XRES < 1 || YRES < 1) {
+ error("%s: bad Font '%s' from %s", Name, s, cfg_source());
+ return -1;
+ }
+
+ /* Fixme: provider other fonts someday... */
+ if (XRES != 6 && YRES != 8) {
+ error("%s: bad Font '%s' from %s (only 6x8 at the moment)", Name, s, cfg_source());
+ return -1;
+ }
+
+ if (cfg_number(section, "Contrast", 128, 0, 255, &contrast) > 0) {
+ drv_LUIse_contrast(contrast);
+ }
+
+ if (cfg_number(section, "Backlight", 0, 0, 1, &backlight) > 0) {
+ drv_LUIse_backlight(backlight);
+ }
+
+ s = cfg_get(section, "Backpicture", NULL);
+ if (s == NULL || *s == '\0') {
+ error("%s: no '%s.Backpicture' entry from %s", Name, section, cfg_source());
+ } else {
+ drv_LUIse_clear();
+ if (LUI_BMPfile(devNum, 1, 0, 0, 0, 0, DCOLS, DROWS, s)) {
+ error("%s: Sorry unable to load: %s", Name, s);
+ return -1;
+ }
+ }
+
+ return 0;
+}
+
+
+/****************************************/
+/*** plugins ***/
+/****************************************/
+
+static void plugin_contrast(RESULT * result, RESULT * arg1)
+{
+ double contrast;
+
+ contrast = drv_LUIse_contrast(R2N(arg1));
+ SetResult(&result, R_NUMBER, &contrast);
+}
+
+static void plugin_backlight(RESULT * result, RESULT * arg1)
+{
+ double backlight;
+
+ backlight = drv_LUIse_backlight(R2N(arg1));
+ SetResult(&result, R_NUMBER, &backlight);
+}
+
+
+/****************************************/
+/*** exported functions ***/
+/****************************************/
+
+
+/* list models */
+int drv_LUIse_list(void)
+{
+ printf("generic");
+ return 0;
+}
+
+/* initialize driver & display */
+int drv_LUIse_init(const char *section, const int quiet)
+{
+ int ret;
+
+ info("%s: %s", Name, "$Rev: 798 $");
+
+ /* real worker functions */
+ drv_generic_graphic_real_blit = drv_LUIse_blit;
+
+ /* start display */
+ if ((ret = drv_LUIse_start(section)) != 0)
+ return ret;
+
+ /* initialize generic graphic driver */
+ if ((ret = drv_generic_graphic_init(section, Name)) != 0)
+ return ret;
+
+ if (!quiet) {
+ char buffer[40];
+ qprintf(buffer, sizeof(buffer), "%s %dx%d", Name, DCOLS, DROWS);
+ if (drv_generic_graphic_greet(buffer, NULL)) {
+ sleep(3);
+ drv_generic_graphic_clear();
+ }
+ }
+
+ /* register plugins */
+ AddFunction("LCD::contrast", 1, plugin_contrast);
+ AddFunction("LCD::backlight", 1, plugin_backlight);
+
+ return 0;
+}
+
+/* close driver & display */
+/* use this function for a graphic display */
+int drv_LUIse_quit(const int quiet)
+{
+
+ info("%s: shutting down.", Name);
+
+ /* clear display */
+ drv_LUIse_clear();
+
+ /* set default for Contrast, ScreenRotation, gfxmode, gfxinvert, IOrefresh */
+ LUI_SetContrast(devNum, 128);
+ LUI_LCDmode(devNum, 0, 0, 0, 2);
+
+
+ /* say goodbye... */
+ if (!quiet) {
+ drv_generic_graphic_greet("goodbye!", NULL);
+ }
+
+ drv_generic_graphic_quit();
+
+ debug("closing connection");
+ LUI_CloseDevice(devNum);
+
+ return (0);
+}
+
+/* use this one for a graphic display */
+DRIVER drv_LUIse = {
+ .name = Name,
+ .list = drv_LUIse_list,
+ .init = drv_LUIse_init,
+ .quit = drv_LUIse_quit,
+};
diff --git a/drv_LW_ABP.c b/drv_LW_ABP.c
new file mode 100644
index 0000000..c597edb
--- /dev/null
+++ b/drv_LW_ABP.c
@@ -0,0 +1,682 @@
+/* $Id: drv_LW_ABP.c 1071 2009-11-22 05:27:53Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/drv_LW_ABP.c $
+ *
+ * driver for Logic Way GmbH ABP08 (serial) and ABP09 (USB) appliance control panels
+ * http://www.logicway.de/pages/mde-hardware.shtml#ABP.AMC
+ *
+ * Copyright (C) 2009 Arndt Kritzner <kritzner@logicway.de>
+ * Copyright (C) 2005 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2005, 2006, 2007, 2009 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ *
+ * exported fuctions:
+ *
+ * struct DRIVER drv_LW_ABP
+ *
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <time.h>
+#include <errno.h>
+
+#include "debug.h"
+#include "cfg.h"
+#include "qprintf.h"
+#include "udelay.h"
+#include "timer.h"
+#include "plugin.h"
+#include "widget.h"
+#include "widget_text.h"
+#include "widget_bar.h"
+#include "widget_keypad.h"
+#include "drv.h"
+
+/* text mode display? */
+#include "drv_generic_text.h"
+#include "drv_generic_keypad.h"
+
+/* serial port? */
+#include "drv_generic_serial.h"
+
+/* i2c bus? */
+#ifdef WITH_I2C
+#include "drv_generic_i2c.h"
+#endif
+
+#define KEY_UP 4
+#define KEY_DOWN 3
+#define KEY_LEFT 2
+#define KEY_RIGHT 1
+
+static char Name[] = "LW_ABP";
+static char logicway[] = "www.logicway.de";
+
+/* ring buffer for bytes received from the display */
+static unsigned char RingBuffer[256];
+static unsigned int RingRPos = 0;
+static unsigned int RingWPos = 0;
+
+static int button = -1;
+static char *colors[] =
+ { "r 0", "r 1", "g 0", "g 1", "b 0", "b 1", "c 0", "c 1", "m 0", "m 1", "y 0", "y 1", "w 0", "w 1", NULL };
+
+#define TIMESYNC_FIRST 600
+#define TIMESYNC_INTERVAL 24*3600
+static time_t next_timesync;
+
+static char *switchcontact = NULL;
+static int statresult = 0;
+static time_t switchcontact_lastchange = 0;
+static time_t switchcontact_time = 0;
+#define SWITCH_ACTION_DURATION 1000
+
+/****************************************/
+/*** hardware dependant functions ***/
+/****************************************/
+
+static int drv_LW_ABP_open(const char *section)
+{
+ /* open serial port */
+ /* don't mind about device, speed and stuff, this function will take care of */
+
+ if (drv_generic_serial_open(section, Name, 0) < 0)
+ return -1;
+
+ return 0;
+}
+
+
+static int drv_LW_ABP_close(void)
+{
+ drv_generic_serial_close();
+
+ return 0;
+}
+
+
+/* dummy function that sends something to the display */
+static void drv_LW_ABP_send(const char *data, const unsigned int len)
+{
+ /* send data to the serial port is easy... */
+ drv_generic_serial_write(data, len);
+}
+
+
+/* text mode displays only */
+static void drv_LW_ABP_reset(void)
+{
+ char cmd[] = "lcd init\r\n";
+
+ /* do whatever is necessary to initialize the display */
+ drv_LW_ABP_send(cmd, strlen(cmd));
+}
+
+static void drv_LW_ABP_clear(void)
+{
+ char cmd[] = "lcd clear\r\n";
+
+ /* do whatever is necessary to clear the display */
+ drv_LW_ABP_send(cmd, strlen(cmd));
+}
+
+static int drv_LW_ABP_time(unsigned char force)
+{
+ char cmd[] = "date set ";
+ char command[50];
+ time_t t = time(NULL);
+
+ if (force || (t > next_timesync)) {
+ /* do whatever is necessary to set clock on the display */
+ sprintf(command, "%s%lu\r\n", cmd, (unsigned long) t);
+ drv_LW_ABP_send(command, strlen(command));
+ next_timesync = t + TIMESYNC_INTERVAL;
+ info("%s: synced time to %lu, next is %lu\n", Name, (unsigned long) t, (unsigned long) next_timesync);
+ return 1;
+ }
+
+ return 0;
+}
+
+static int drv_LW_ABP_switchcontact(void)
+{
+ char cmd[] = "switch time ";
+ char command[50];
+ struct stat statinfo;
+ FILE *configfile;
+ int scanresult;
+ int config_entries;
+ char inputline[101];
+ if ((switchcontact != NULL) && (*switchcontact != '\0')) {
+ if (stat(switchcontact, &statinfo) == -1) {
+ if (statresult != -1) {
+ error("%s: specified switch contact control file %s not found", Name, switchcontact);
+ switchcontact_time = 0;
+ sprintf(command, "%s%lu %u\r\n", cmd, (unsigned long) switchcontact_time, SWITCH_ACTION_DURATION);
+ drv_LW_ABP_send(command, strlen(command));
+ info("%s: switchtime deactivated", Name);
+ statresult = -1;
+ }
+ } else {
+ if (statresult == -1) {
+ info("%s: specified switch contact control file %s appeared", Name, switchcontact);
+ statresult = 0;
+ }
+ if ((switchcontact_lastchange == 0) || (switchcontact_lastchange < statinfo.st_mtime)) {
+ info("%s: specified switch contact control file %s has changed (%lu < %lu)", Name, switchcontact,
+ (unsigned long) switchcontact_lastchange, (unsigned long) statinfo.st_mtime);
+ switchcontact_lastchange = statinfo.st_mtime;
+ configfile = fopen(switchcontact, "r");
+ if (configfile == NULL) {
+ error("%s: could not open specified switch contact control file %s", Name, switchcontact);
+ } else {
+ config_entries = 0;
+ while (!feof(configfile)) {
+ if (fgets(inputline, 100, configfile) != NULL) {
+ if ((scanresult = sscanf(inputline, "switchtime=%lu", &switchcontact_time)) == 1) {
+ info("%s: switchtime read %lu (file %s)", Name, (unsigned long) switchcontact_time,
+ switchcontact);
+ config_entries++;
+ }
+ }
+ }
+ fclose(configfile);
+ if (config_entries > 0) {
+ if (switchcontact_time < time(NULL)) {
+ switchcontact_time = 0;
+ info("%s: switchtime is in past %lu (now %lu), so deactivated", Name,
+ (unsigned long) switchcontact_time, time(NULL));
+ }
+ } else {
+ switchcontact_time = 0;
+ }
+ if (switchcontact_time != 0) {
+ sprintf(command, "%s%lu %u\r\n", cmd, (unsigned long) switchcontact_time,
+ SWITCH_ACTION_DURATION);
+ drv_LW_ABP_send(command, strlen(command));
+ info("%s: switchtime set to %lu", Name, (unsigned long) switchcontact_time);
+ } else {
+ sprintf(command, "%s%lu %u\r\n", cmd, (unsigned long) switchcontact_time,
+ SWITCH_ACTION_DURATION);
+ drv_LW_ABP_send(command, strlen(command));
+ info("%s: switchtime deactivated", Name);
+ }
+ }
+ }
+ }
+ }
+
+ return 0;
+}
+
+/* text mode displays only */
+static void drv_LW_ABP_write(const int row, const int col, const char *data, int len)
+{
+ char cmd[] = "lcd set line ";
+ char row_[5];
+ char col_[5];
+
+ /* do the cursor positioning here */
+ drv_LW_ABP_send(cmd, strlen(cmd));
+ sprintf(row_, "%d", row + 1);
+ drv_LW_ABP_send(row_, strlen(row_));
+ if (col > 0) {
+ drv_LW_ABP_send(",", 1);
+ sprintf(col_, "%d", col + 1);
+ drv_LW_ABP_send(col_, strlen(col_));
+ }
+ drv_LW_ABP_send(" ", 1);
+
+ /* send string to the display */
+ drv_LW_ABP_send(data, len);
+ drv_LW_ABP_send("\r\n", 2);
+
+}
+
+static unsigned char byte(int pos)
+{
+ if (pos >= 0) {
+ pos += RingRPos;
+ if ((unsigned) pos >= sizeof(RingBuffer))
+ pos -= sizeof(RingBuffer);
+ } else {
+ pos += RingWPos;
+ if (pos < 0)
+ pos += sizeof(RingBuffer);
+ }
+ return RingBuffer[pos];
+}
+
+static void drv_LW_ABP_process_button(void)
+{
+ /* Key Activity */
+ debug("%s: Key Activity: %d", Name, button);
+ drv_generic_keypad_press(button);
+}
+
+static int drv_LW_ABP_poll(void)
+{
+ char received[100];
+
+ /* read into RingBuffer */
+ while (1) {
+ char buffer[32];
+ int num, n;
+ num = drv_generic_serial_poll(buffer, sizeof(buffer));
+ if (num <= 0)
+ break;
+ /* put result into RingBuffer */
+ for (n = 0; n < num; n++) {
+ RingBuffer[RingWPos++] = (unsigned char) buffer[n];
+ if (RingWPos >= sizeof(RingBuffer))
+ RingWPos = 0;
+ }
+ }
+
+ received[0] = '\0';
+
+ /* process RingBuffer */
+ while (1) {
+ char command[32];
+ int n, num;
+ /* packet size */
+ num = RingWPos - RingRPos;
+ if (num < 0)
+ num += sizeof(RingBuffer);
+ /* minimum packet size=3 */
+ if (num < 1) {
+ if (strlen(received) > 0) {
+ debug("%s: received: %s", Name, received);
+ }
+ return 0;
+ }
+ if (byte(0) != '[') {
+ goto GARBAGE;
+ }
+ for (n = 0; (n < num) && ((unsigned) n < (sizeof(command) - 1)); n++) {
+ command[n] = byte(n);
+ if (command[n] == ']') {
+ n++;
+ break;
+ }
+ }
+ command[n] = '\0';
+ if (command[n - 1] != ']') {
+ if (strlen(command) < 4) {
+ if (strlen(received) > 0) {
+ debug("%s: received: %s", Name, received);
+ }
+ return 0;
+ }
+ goto GARBAGE;
+ }
+ info("%s: command read from keypad: %s\n", Name, command);
+ if (sscanf(command, "[T%d]", &button) == 1) {
+ info("%s: button %d pressed\n", Name, button);
+ } else {
+ goto GARBAGE;
+ }
+ /* increment read pointer */
+ RingRPos += strlen(command);
+ if (RingRPos >= sizeof(RingBuffer))
+ RingRPos -= sizeof(RingBuffer);
+ /* a packet arrived */
+ if (strlen(received) > 0) {
+ debug("%s: received: %s", Name, received);
+ }
+ return 1;
+ GARBAGE:
+ switch (byte(0)) {
+ case '\n':
+ case '\r':
+ case '>':
+ if (strlen(received) > 0) {
+ debug("%s: received: %s", Name, received);
+ received[0] = '\0';
+ }
+ break;
+ default:
+ if (byte(0) < ' ')
+ debug("%s: dropping garbage byte %02x", Name, byte(0));
+ else if ((strlen(received) + 2) > sizeof(received)) {
+ debug("%s: received: %s", Name, received);
+ received[0] = '\0';
+ }
+ sprintf(received, "%s%c", received, byte(0));
+ break;
+ }
+ RingRPos++;
+ if (RingRPos >= sizeof(RingBuffer))
+ RingRPos = 0;
+ continue;
+ }
+
+ /* not reached */
+ return 0;
+}
+
+static void drv_LW_ABP_timer(void __attribute__ ((unused)) * notused)
+{
+ while (drv_LW_ABP_poll()) {
+ drv_LW_ABP_process_button();
+ }
+
+ drv_LW_ABP_time(0);
+ drv_LW_ABP_switchcontact();
+}
+
+static int drv_LW_ABP_keypad(const int num)
+{
+ int val = 0;
+
+ switch (num) {
+ case KEY_UP:
+ debug("%s: Key Up", Name);
+ val += WIDGET_KEY_PRESSED;
+ val += WIDGET_KEY_UP;
+ break;
+ case KEY_DOWN:
+ debug("%s: Key Down", Name);
+ val += WIDGET_KEY_PRESSED;
+ val += WIDGET_KEY_DOWN;
+ break;
+ case KEY_LEFT:
+ debug("%s: Key Left / Cancel", Name);
+ val += WIDGET_KEY_PRESSED;
+ val += WIDGET_KEY_LEFT;
+// val += WIDGET_KEY_CANCEL;
+ break;
+ case KEY_RIGHT:
+ debug("%s: Key Right / Confirm", Name);
+ val += WIDGET_KEY_PRESSED;
+ val += WIDGET_KEY_RIGHT;
+// val += WIDGET_KEY_CONFIRM;
+ break;
+ default:
+ debug("%s: Unbound Key '%d'", Name, num);
+ break;
+ }
+
+ return val;
+}
+
+static char *drv_LW_ABP_background(char *color)
+{
+ static char *Background = NULL;
+ char cmd[] = "lcd set color ";
+ int idx;
+ if (color != NULL) {
+ for (idx = 0; colors[idx] != NULL; idx++) {
+ if (strcmp(color, colors[idx]) == 0)
+ break;
+ }
+ if (colors[idx] != NULL) {
+ Background = colors[idx];
+ debug("%s: set background color %s", Name, Background);
+ drv_LW_ABP_send(cmd, strlen(cmd));
+ drv_LW_ABP_send(color, strlen(color));
+ drv_LW_ABP_send("\r\n", 2);
+ }
+ }
+ return Background;
+}
+
+static int drv_LW_ABP_contrast(int contrast)
+{
+ return contrast;
+}
+
+
+/* start text mode display */
+static int drv_LW_ABP_start(const char *section)
+{
+ int contrast;
+ int rows = -1, cols = -1;
+ char *s;
+ char *background;
+
+ s = cfg_get(section, "Size", NULL);
+ if (s == NULL || *s == '\0') {
+ error("%s: no '%s.Size' entry from %s", Name, section, cfg_source());
+ return -1;
+ }
+ if (sscanf(s, "%dx%d", &cols, &rows) != 2 || rows < 1 || cols < 1) {
+ error("%s: bad %s.Size '%s' from %s", Name, section, s, cfg_source());
+ free(s);
+ return -1;
+ }
+
+ DROWS = rows;
+ DCOLS = cols;
+
+ next_timesync = time(NULL) + TIMESYNC_FIRST;
+
+ /* open communication with the display */
+ if (drv_LW_ABP_open(section) < 0) {
+ return -1;
+ }
+
+ drv_LW_ABP_reset(); /* initialize display */
+
+ background = cfg_get(section, "Background", NULL);
+ if ((background != NULL) && (*background != '\0')) {
+ if (drv_LW_ABP_background(background) == NULL) {
+ debug("%s: wrong background color specified: %s", Name, background);
+ }
+ }
+
+ switchcontact = cfg_get(section, "Switchcontact", NULL);
+
+ if (cfg_number(section, "Contrast", 0, 0, 255, &contrast) > 0) {
+ drv_LW_ABP_contrast(contrast);
+ }
+
+ drv_LW_ABP_clear(); /* clear display */
+
+ return 0;
+}
+
+/****************************************/
+/*** plugins ***/
+/****************************************/
+
+static void plugin_contrast(RESULT * result, RESULT * arg1)
+{
+ double contrast;
+
+ contrast = drv_LW_ABP_contrast(R2N(arg1));
+ SetResult(&result, R_NUMBER, &contrast);
+}
+
+static void plugin_background(RESULT * result, const int argc, RESULT * argv[])
+{
+ char *color;
+
+ switch (argc) {
+ case 0:
+ color = drv_LW_ABP_background(NULL);
+ SetResult(&result, R_STRING, &color);
+ break;
+ case 1:
+ color = drv_LW_ABP_background(R2S(argv[0]));
+ SetResult(&result, R_STRING, &color);
+ break;
+ default:
+ error("%s.backlight(): wrong number of parameters (%d)", Name, argc);
+ SetResult(&result, R_STRING, "");
+ }
+}
+
+
+/****************************************/
+/*** widget callbacks ***/
+/****************************************/
+
+
+/* using drv_generic_text_draw(W) */
+/* using drv_generic_text_icon_draw(W) */
+/* using drv_generic_text_bar_draw(W) */
+/* using drv_generic_gpio_draw(W) */
+
+
+/****************************************/
+/*** exported functions ***/
+/****************************************/
+
+
+/* list models */
+int drv_LW_ABP_list(void)
+{
+ printf("Logic Way ABP driver");
+ return 0;
+}
+
+
+/* initialize driver & display */
+/* use this function for a text display */
+int drv_LW_ABP_init(const char *section, const int quiet)
+{
+ WIDGET_CLASS wc;
+ int ret;
+
+ info("%s: %s", Name, "$Rev: 1071 $");
+
+ /* display preferences */
+ XRES = 5; /* pixel width of one char */
+ YRES = 8; /* pixel height of one char */
+ CHARS = 0; /* number of user-defineable characters */
+ CHAR0 = 0; /* ASCII of first user-defineable char */
+ GOTO_COST = 10; /* number of bytes a goto command requires */
+
+ /* real worker functions */
+ drv_generic_text_real_write = drv_LW_ABP_write;
+ drv_generic_keypad_real_press = drv_LW_ABP_keypad;
+
+ /* regularly process display answers */
+ timer_add(drv_LW_ABP_timer, NULL, 100, 0);
+
+ /* start display */
+ if ((ret = drv_LW_ABP_start(section)) != 0)
+ return ret;
+
+ if (!quiet) {
+ char buffer[40];
+ qprintf(buffer, sizeof(buffer), "%s %dx%d", Name, DCOLS, DROWS);
+ if (drv_generic_text_greet(buffer, logicway)) {
+ sleep(3);
+ drv_LW_ABP_clear();
+ }
+ }
+
+ /* initialize generic text driver */
+ if ((ret = drv_generic_text_init(section, Name)) != 0)
+ return ret;
+
+ /* initialize generic icon driver */
+ if ((ret = drv_generic_text_icon_init()) != 0)
+ return ret;
+
+ /* initialize generic bar driver */
+ if ((ret = drv_generic_text_bar_init(0)) != 0)
+ return ret;
+
+ /* initialize generic key pad driver */
+ if ((ret = drv_generic_keypad_init(section, Name)) != 0)
+ return ret;
+
+ /* add fixed chars to the bar driver */
+ drv_generic_text_bar_add_segment(0, 0, 255, 32); /* ASCII 32 = blank */
+
+ /* register text widget */
+ wc = Widget_Text;
+ wc.draw = drv_generic_text_draw;
+ widget_register(&wc);
+
+ /* register bar widget */
+ wc = Widget_Bar;
+ wc.draw = drv_generic_text_bar_draw;
+ widget_register(&wc);
+
+ /* register plugins */
+ AddFunction("LCD::contrast", 1, plugin_contrast);
+ AddFunction("LCD::background", -1, plugin_background);
+
+ return 0;
+}
+
+
+
+/* close driver & display */
+/* use this function for a text display */
+int drv_LW_ABP_quit(const int quiet)
+{
+ char switchactive[] = "switch scheduled";
+ char timeinfo[17];
+ struct tm switchtime_info;
+
+ info("%s: shutting down.", Name);
+
+ drv_generic_text_quit();
+ drv_generic_keypad_quit();
+
+ /* clear display */
+ drv_LW_ABP_clear();
+
+ /* say goodbye... */
+ if (switchcontact_time < time(NULL)) {
+ switchcontact_time = 0;
+ info("%s: switchtime is in past %lu (now %lu), so deactivated", Name, (unsigned long) switchcontact_time,
+ time(NULL));
+ }
+ if (switchcontact_time == 0) {
+ if (!quiet) {
+ drv_generic_text_greet("goodbye!", NULL);
+ }
+ } else {
+ drv_LW_ABP_write(0, 0, logicway, strlen(logicway));
+ drv_LW_ABP_write(1, 0, switchactive, strlen(switchactive));
+ localtime_r(&switchcontact_time, &switchtime_info);
+ if (strftime(timeinfo, sizeof(timeinfo), "for %a %X", &switchtime_info) > 0) {
+ drv_LW_ABP_write(2, 0, timeinfo, strlen(timeinfo));
+ }
+ }
+
+ debug("closing connection");
+ drv_LW_ABP_close();
+
+ return (0);
+}
+
+
+/* use this one for a text display */
+DRIVER drv_LW_ABP = {
+ .name = Name,
+ .list = drv_LW_ABP_list,
+ .init = drv_LW_ABP_init,
+ .quit = drv_LW_ABP_quit,
+};
diff --git a/drv_M50530.c b/drv_M50530.c
new file mode 100644
index 0000000..ffb5b0d
--- /dev/null
+++ b/drv_M50530.c
@@ -0,0 +1,688 @@
+/* $Id: drv_M50530.c 1174 2012-02-15 13:07:53Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/drv_M50530.c $
+ *
+ * new style driver for M50530-based displays
+ *
+ * Copyright (C) 2003 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ *
+ * exported fuctions:
+ *
+ * struct DRIVER drv_M50530
+ *
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <unistd.h>
+#include <termios.h>
+#include <fcntl.h>
+#include <sys/time.h>
+
+#include "debug.h"
+#include "cfg.h"
+#include "qprintf.h"
+#include "udelay.h"
+#include "plugin.h"
+#include "widget.h"
+#include "widget_text.h"
+#include "widget_icon.h"
+#include "widget_bar.h"
+#include "drv.h"
+#include "drv_generic_text.h"
+#include "drv_generic_gpio.h"
+#include "drv_generic_parport.h"
+
+static char Name[] = "M50530";
+
+static int Model;
+
+/* Timings */
+static int T_SU, T_W, T_D, T_H;
+static int T_INIT, T_EXEC, T_CLEAR;
+static int T_GPO_ST, T_GPO_PW;
+
+static unsigned char SIGNAL_RW;
+static unsigned char SIGNAL_EX;
+static unsigned char SIGNAL_IOC1;
+static unsigned char SIGNAL_IOC2;
+static unsigned char SIGNAL_GPO;
+
+static int FONT5X11;
+static int DDRAM;
+static int DUTY;
+
+/* maximum time to wait for the busy-flag (in usec) */
+#define MAX_BUSYFLAG_WAIT 10000
+
+/* maximum busy flag errors before falling back to busy-waiting */
+#define MAX_BUSYFLAG_ERRORS 20
+
+/* flag for busy-waiting vs. busy flag checking */
+static int UseBusy = 0;
+
+/* buffer holding the GPO state */
+static unsigned char GPO = 0;
+
+
+typedef struct {
+ int type;
+ char *name;
+} MODEL;
+
+static MODEL Models[] = {
+ {0x01, "M50530"},
+ {0xff, "Unknown"}
+};
+
+
+/****************************************/
+/*** hardware dependant functions ***/
+/****************************************/
+
+static void drv_M5_busy(void)
+{
+ static unsigned int errors = 0;
+
+ unsigned char data = 0xFF;
+ unsigned char busymask = 0x88;
+ unsigned int counter;
+
+ /* set data-lines to input */
+ drv_generic_parport_direction(1);
+
+ /* clear I/OC1 and I/OC2, set R/W */
+ drv_generic_parport_control(SIGNAL_IOC1 | SIGNAL_IOC2 | SIGNAL_RW, SIGNAL_RW);
+
+ /* Control data setup time */
+ ndelay(T_SU);
+
+ counter = 0;
+ while (1) {
+
+ /* rise enable */
+ drv_generic_parport_control(SIGNAL_EX, SIGNAL_EX);
+
+ /* data output delay time */
+ ndelay(T_D);
+
+ /* read the busy flag */
+ data = drv_generic_parport_read();
+
+ /* lower enable */
+ /* as T_D is larger than T_W, we don't need to delay again */
+ drv_generic_parport_control(SIGNAL_EX, 0);
+
+ if ((data & busymask) == 0) {
+ errors = 0;
+ break;
+ }
+
+ /* make sure we don't wait forever
+ * - but only check after 5 iterations
+ * that way, we won't slow down normal mode
+ * (where we don't need the timeout anyway)
+ */
+ counter++;
+
+ if (counter >= 5) {
+ struct timeval now, end;
+
+ if (counter == 5) {
+ /* determine the time when the timeout has expired */
+ gettimeofday(&end, NULL);
+ end.tv_usec += MAX_BUSYFLAG_WAIT;
+ while (end.tv_usec > 1000000) {
+ end.tv_usec -= 1000000;
+ end.tv_sec++;
+ }
+ }
+
+ /* get the current time */
+ gettimeofday(&now, NULL);
+ if (now.tv_sec == end.tv_sec ? now.tv_usec >= end.tv_usec : now.tv_sec >= end.tv_sec) {
+ error("%s: timeout waiting for busy flag (0x%02x)", Name, data);
+ if (++errors >= MAX_BUSYFLAG_ERRORS) {
+ error("%s: too many busy flag failures, turning off busy flag checking.", Name);
+ UseBusy = 0;
+ }
+ break;
+ }
+ }
+ }
+
+ /* clear R/W */
+ drv_generic_parport_control(SIGNAL_RW, 0);
+
+ /* honour data hold time */
+ ndelay(T_H);
+
+ /* set data-lines to output */
+ drv_generic_parport_direction(0);
+
+}
+
+
+static void drv_M5_command(const unsigned int cmd, const int delay)
+{
+
+ if (UseBusy)
+ drv_M5_busy();
+
+ /* put data on DB1..DB8 */
+ drv_generic_parport_data(cmd & 0xff);
+
+ /* set I/OC1 */
+ /* set I/OC2 */
+ /* clear RW */
+ drv_generic_parport_control(SIGNAL_IOC1 | SIGNAL_IOC2 | SIGNAL_RW,
+ (cmd & 0x100 ? SIGNAL_IOC1 : 0) | (cmd & 0x200 ? SIGNAL_IOC2 : 0));
+
+ /* Control data setup time */
+ ndelay(T_SU);
+
+ /* send command */
+ drv_generic_parport_toggle(SIGNAL_EX, 1, T_W);
+
+ if (UseBusy) {
+ /* honour data hold time */
+ ndelay(T_H);
+ } else {
+ /* wait for command completion */
+ udelay(delay);
+ }
+}
+
+
+static void drv_M5_clear(void)
+{
+ drv_M5_command(0x0001, T_CLEAR); /* clear display */
+}
+
+
+static void drv_M5_write(const int row, const int col, const char *data, const int len)
+{
+ int l = len;
+ unsigned int cmd;
+ unsigned int pos;
+
+ if (row < 4) {
+ pos = row * (DDRAM >> DUTY) + col;
+ } else {
+ pos = (row - 4) * (DDRAM >> DUTY) + (DDRAM >> DUTY) / 2 + col;
+ }
+
+ drv_M5_command(0x300 | pos, T_EXEC);
+
+ while (l--) {
+ cmd = *(unsigned char *) data++;
+ drv_M5_command(0x200 | cmd, T_EXEC);
+ }
+}
+
+
+static void drv_M5_defchar(const int ascii, const unsigned char *matrix)
+{
+ int i;
+
+ drv_M5_command(0x300 + DDRAM + 8 * (ascii - CHAR0), T_EXEC);
+
+ for (i = 0; i < YRES; i++) {
+ drv_M5_command(0x200 | (matrix[i] & 0x3f), T_EXEC);
+ }
+}
+
+
+static int drv_M5_GPO(const int num, const int val)
+{
+ int v;
+
+ if (val > 0) {
+ /* set bit */
+ v = 1;
+ GPO |= 1 << num;
+ } else {
+ /* clear bit */
+ v = 0;
+ GPO &= ~(1 << num);
+ }
+
+ /* put data on DB1..DB8 */
+ drv_generic_parport_data(GPO);
+
+ /* 74HCT573 set-up time */
+ ndelay(T_GPO_ST);
+
+ /* send data */
+ /* 74HCT573 enable pulse width */
+ drv_generic_parport_toggle(SIGNAL_GPO, 1, T_GPO_PW);
+
+ return v;
+}
+
+
+static int drv_M5_start(const char *section, const int quiet)
+{
+ char *s;
+ int n;
+ int rows = -1, cols = -1;
+ unsigned int SF;
+
+ s = cfg_get(section, "Model", "M50530");
+ if (s != NULL && *s != '\0') {
+ int i;
+ for (i = 0; Models[i].type != 0xff; i++) {
+ if (strcasecmp(Models[i].name, s) == 0)
+ break;
+ }
+ free(s);
+ if (Models[i].type == 0xff) {
+ error("%s: %s.Model '%s' is unknown from %s", Name, section, s, cfg_source());
+ return -1;
+ }
+ Model = i;
+ info("%s: using model '%s'", Name, Models[Model].name);
+ } else {
+ error("%s: empty '%s.Model' entry from %s", Name, section, cfg_source());
+ free(s);
+ return -1;
+ }
+
+ s = cfg_get(section, "Size", NULL);
+ if (s == NULL || *s == '\0') {
+ error("%s: no '%s.Size' entry from %s", Name, section, cfg_source());
+ free(s);
+ return -1;
+ }
+ if (sscanf(s, "%dx%d", &cols, &rows) != 2 || rows < 1 || cols < 1) {
+ error("%s: bad %s.Size '%s' from %s", Name, section, s, cfg_source());
+ free(s);
+ return -1;
+ }
+ free(s);
+ DROWS = rows;
+ DCOLS = cols;
+
+ s = cfg_get(section, "Font", "5x7");
+ if (s == NULL && *s == '\0') {
+ error("%s: empty '%s.Font' entry from %s", Name, section, cfg_source());
+ free(s);
+ return -1;
+ }
+ if (strcasecmp(s, "5x7") == 0) {
+ XRES = 5;
+ YRES = 7;
+ FONT5X11 = 0;
+ } else if (strcasecmp(s, "5x11") == 0) {
+ XRES = 5;
+ YRES = 11;
+ FONT5X11 = 1;
+ } else {
+ error("%s: bad '%s.Font' entry '%s' from %s", Name, section, s, cfg_source());
+ error("%s: should be '5x7' or '5x11'", Name);
+ free(s);
+ return -1;
+ }
+ free(s);
+
+
+ if (DCOLS * DROWS > 256) {
+ error("%s: %s.Size '%dx%d' is too big, would require %d bytes", Name, section, DCOLS, DROWS, DCOLS * DROWS);
+ return -1;
+ } else if (DCOLS * DROWS > 224) {
+ DDRAM = 256;
+ CHARS = 0;
+ } else if (DCOLS * DROWS > 192) {
+ DDRAM = 224;
+ CHARS = FONT5X11 ? 2 : 4;
+ } else if (DCOLS * DROWS > 160) {
+ DDRAM = 192;
+ CHARS = FONT5X11 ? 4 : 8;
+ } else {
+ DDRAM = 160;
+ CHARS = FONT5X11 ? 6 : 12;
+ }
+ info("%s: using %d words DDRAM / %d words CGRAM (%d user chars)", Name, DDRAM, 256 - DDRAM, CHARS);
+
+ if (cfg_number(section, "DUTY", 2, 0, 2, &DUTY) < 0)
+ return -1;
+ info("%s: using duty %d: 1/%d, %d lines x %d words", Name, DUTY, (XRES + 1) << DUTY, 1 << DUTY, DDRAM >> DUTY);
+
+
+ if (cfg_number(section, "GPOs", 0, 0, 8, &n) < 0)
+ return -1;
+ GPOS = n;
+ if (GPOS > 0) {
+ info("%s: controlling %d GPO's", Name, GPOS);
+ }
+
+ if (drv_generic_parport_open(section, Name) != 0) {
+ error("%s: could not initialize parallel port!", Name);
+ return -1;
+ }
+
+ if ((SIGNAL_RW = drv_generic_parport_wire_ctrl("RW", "GND")) == 0xff)
+ return -1;
+ if ((SIGNAL_EX = drv_generic_parport_wire_ctrl("EX", "STROBE")) == 0xff)
+ return -1;
+ if ((SIGNAL_IOC1 = drv_generic_parport_wire_ctrl("IOC1", "SLCTIN")) == 0xff)
+ return -1;
+ if ((SIGNAL_IOC2 = drv_generic_parport_wire_ctrl("IOC2", "AUTOFD")) == 0xff)
+ return -1;
+ if ((SIGNAL_GPO = drv_generic_parport_wire_ctrl("GPO", "GND")) == 0xff)
+ return -1;
+
+ /* Timings */
+
+ /* low level communication timings [nanoseconds]
+ * we use the worst-case default values, but allow
+ * modification from the config file.
+ */
+
+ T_SU = timing(Name, section, "SU", 200, "ns"); /* control data setup time */
+ T_W = timing(Name, section, "W", 500, "ns"); /* EX signal pulse width */
+ T_D = timing(Name, section, "D", 300, "ns"); /* Data output delay time */
+ T_H = timing(Name, section, "H", 100, "ns"); /* Data hold time */
+
+ /* GPO timing */
+ if (SIGNAL_GPO != 0) {
+ T_GPO_ST = timing(Name, section, "GPO_ST", 20, "ns"); /* 74HCT573 set-up time */
+ T_GPO_PW = timing(Name, section, "GPO_PW", 230, "ns"); /* 74HCT573 enable pulse width */
+ } else {
+ T_GPO_ST = 0;
+ T_GPO_PW = 0;
+ }
+
+ /* M50530 execution timings [microseconds]
+ * we use the worst-case default values, but allow
+ * modification from the config file.
+ */
+
+ T_EXEC = timing(Name, section, "EXEC", 20, "us"); /* normal execution time */
+ T_CLEAR = timing(Name, section, "CLEAR", 1250, "us"); /* 'clear display' execution time */
+ T_INIT = timing(Name, section, "INIT", 2000, "us"); /* mysterious initialization time */
+
+
+ /* maybe use busy-flag from now on */
+ cfg_number(section, "UseBusy", 0, 0, 1, &UseBusy);
+
+ /* make sure we don't use the busy flag with RW wired to GND */
+ if (UseBusy && !SIGNAL_RW) {
+ error("%s: busy-flag checking is impossible with RW wired to GND!", Name);
+ UseBusy = 0;
+ }
+ info("%s: %susing busy-flag checking", Name, UseBusy ? "" : "not ");
+
+ /* clear all signals */
+ drv_generic_parport_control(SIGNAL_RW | SIGNAL_EX | SIGNAL_IOC1 | SIGNAL_IOC2 | SIGNAL_GPO, 0);
+
+ /* for some mysterious reason, this delay is necessary... */
+ udelay(T_INIT);
+
+ /* set direction: write */
+ drv_generic_parport_direction(0);
+
+
+ /* set function (SF) mode:
+ * Bit 0 : RAM 0
+ * Bit 1 : RAM 1
+ * Bit 2 : DUTY 0
+ * Bit 3 : DUTY 1
+ * Bit 4 : FONT: 0 = 5x12, 1 = 5x8
+ * Bit 5 : I/O: 0 = 4-bit, 1 = 8-bit
+ * Bit 6 : 1
+ * Bit 7 : 1
+ *
+ * RAM layout:
+ * 00: 256 words DDRAM, 0 words CGRAM
+ * 01: 224 words DDRAM, 32 words CGRAM
+ * 10: 192 words DDRAM, 64 words CGRAM
+ * 11: 160 words DDRAM, 96 words CGRAM
+ *
+ * Duty:
+ * 00: 1/8 (1/12 for 5x11), 1 line
+ * 00: 1/16 (1/24 for 5x11), 2 lines
+ * 00: 1/32 (1/48 for 5x11), 4 lines
+ * 11: undefined
+ */
+
+ /* 11100000 : SF, 8-bit mode */
+ SF = 0xE0;
+
+ /* RAM layout */
+ switch (DDRAM) {
+ case 160:
+ SF |= 0x03;
+ break;
+ case 192:
+ SF |= 0x02;
+ break;
+ case 224:
+ SF |= 0x01;
+ break;
+ case 256:
+ SF |= 0x00;
+ break;
+ }
+
+ /* Duty */
+ SF |= (DUTY << 2);
+
+ /* Font */
+ SF |= (!FONT5X11) << 4;
+
+
+ debug("SET FUNCTION MODE 0x%02x", SF);
+ drv_M5_command(SF, T_EXEC);
+
+
+ /* set display (SD) mode:
+ * Bit 0 : 1 = turn on character blinking
+ * Bit 0 : 1 = turn on cursor blinking
+ * Bit 0 : 1 = turn on underline display
+ * Bit 0 : 1 = turn on cursor
+ * Bit 0 : 1 = turn on display
+ * Bit 0 : 1
+ * Bit 0 : 0
+ * Bit 0 : 0
+ */
+
+ /* SD: 0x20 = 00100000 */
+ /* SD: turn off display */
+ drv_M5_command(0x0020, T_EXEC);
+
+
+ /* set entry (SE) mode:
+ * Bit 0 : 1 = inc/dec cursor address after Read
+ * Bit 1 : 1 = inc/dec cursor address after Write
+ * Bit 2 : 0 = inc, 1 = dec
+ * Bit 3 : 1 = inc/dec display start addr after Read
+ * Bit 4 : 1 = inc/dec display start addr after Write
+ * Bit 5 : 0 = inc, 1 = dec
+ * Bit 6 : 1
+ * Bit 7 : 0
+ *
+ */
+
+ /* SE: 0x50 = 01010000 */
+ /* SE: increment display start after Write */
+ drv_M5_command(0x0050, T_EXEC);
+
+
+ /* SD: 0x30 = 00110000 */
+ /* SD: turn on display */
+ drv_M5_command(0x0030, T_EXEC);
+
+
+ drv_M5_clear();
+
+ if (!quiet) {
+ char buffer[40];
+ qprintf(buffer, sizeof(buffer), "%s %dx%d", Name, DCOLS, DROWS);
+ if (drv_generic_text_greet(buffer, NULL)) {
+ sleep(3);
+ drv_M5_clear();
+ }
+ }
+
+ return 0;
+}
+
+
+/****************************************/
+/*** plugins ***/
+/****************************************/
+
+/* none at the moment */
+
+
+/****************************************/
+/*** widget callbacks ***/
+/****************************************/
+
+/* using drv_generic_text_draw(W) */
+/* using drv_generic_text_icon_draw(W) */
+/* using drv_generic_text_bar_draw(W) */
+/* using drv_generic_gpio_draw(W) */
+
+
+/****************************************/
+/*** exported functions ***/
+/****************************************/
+
+
+/* list models */
+int drv_M5_list(void)
+{
+ int i;
+
+ for (i = 0; Models[i].type != 0xff; i++) {
+ printf("%s ", Models[i].name);
+ }
+ return 0;
+}
+
+
+/* initialize driver & display */
+int drv_M5_init(const char *section, const int quiet)
+{
+ WIDGET_CLASS wc;
+ int ret;
+
+ info("%s: %s", Name, "$Rev: 1174 $");
+
+ /* display preferences */
+ XRES = -1; /* pixel width of one char */
+ YRES = -1; /* pixel height of one char */
+ CHARS = 0; /* number of user-defineable characters */
+ CHAR0 = 248; /* ASCII of first user-defineable char */
+ GOTO_COST = 1; /* number of bytes a goto command requires */
+
+ /* real worker functions */
+ drv_generic_text_real_write = drv_M5_write;
+ drv_generic_text_real_defchar = drv_M5_defchar;
+ drv_generic_gpio_real_set = drv_M5_GPO;
+
+
+ /* start display */
+ if ((ret = drv_M5_start(section, quiet)) != 0)
+ return ret;
+
+ /* initialize generic text driver */
+ if ((ret = drv_generic_text_init(section, Name)) != 0)
+ return ret;
+
+ /* initialize generic icon driver */
+ if ((ret = drv_generic_text_icon_init()) != 0)
+ return ret;
+
+ /* initialize generic bar driver */
+ if ((ret = drv_generic_text_bar_init(0)) != 0)
+ return ret;
+
+ /* add fixed chars to the bar driver */
+ drv_generic_text_bar_add_segment(0, 0, 255, 32); /* ASCII 32 = blank */
+
+ /* initialize generic GPIO driver */
+ if ((ret = drv_generic_gpio_init(section, Name)) != 0)
+ return ret;
+
+ /* register text widget */
+ wc = Widget_Text;
+ wc.draw = drv_generic_text_draw;
+ widget_register(&wc);
+
+ /* register icon widget */
+ wc = Widget_Icon;
+ wc.draw = drv_generic_text_icon_draw;
+ widget_register(&wc);
+
+ /* register bar widget */
+ wc = Widget_Bar;
+ wc.draw = drv_generic_text_bar_draw;
+ widget_register(&wc);
+
+ /* register plugins */
+ /* none at the moment */
+
+ return 0;
+}
+
+
+/* close driver & display */
+int drv_M5_quit(const int quiet)
+{
+
+ info("%s: shutting down.", Name);
+
+ drv_generic_text_quit();
+ drv_generic_gpio_quit();
+
+ /* clear display */
+ drv_M5_clear();
+
+ /* say goodbye... */
+ if (!quiet) {
+ drv_generic_text_greet("goodbye!", NULL);
+ }
+
+ /* clear all signals */
+ drv_generic_parport_control(SIGNAL_RW | SIGNAL_EX | SIGNAL_IOC1 | SIGNAL_IOC2 | SIGNAL_GPO, 0);
+
+ /* close port */
+ drv_generic_parport_close();
+
+ return (0);
+}
+
+
+DRIVER drv_M50530 = {
+ .name = Name,
+ .list = drv_M5_list,
+ .init = drv_M5_init,
+ .quit = drv_M5_quit,
+};
diff --git a/drv_MatrixOrbital.c b/drv_MatrixOrbital.c
new file mode 100644
index 0000000..17a00e4
--- /dev/null
+++ b/drv_MatrixOrbital.c
@@ -0,0 +1,611 @@
+/* $Id: drv_MatrixOrbital.c 1150 2011-07-27 02:53:04Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/drv_MatrixOrbital.c $
+ *
+ * new style driver for Matrix Orbital serial display modules
+ *
+ * Copyright (C) 1999, 2000 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ *
+ * exported fuctions:
+ *
+ * struct DRIVER drv_MatrixOrbital
+ *
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <time.h>
+
+#include "debug.h"
+#include "cfg.h"
+#include "plugin.h"
+#include "widget.h"
+#include "widget_text.h"
+#include "widget_icon.h"
+#include "widget_bar.h"
+#include "drv.h"
+#include "drv_generic_text.h"
+#include "drv_generic_gpio.h"
+#include "drv_generic_serial.h"
+
+
+static char Name[] = "MatrixOrbital";
+
+static int Model;
+static int Protocol;
+
+static char dispBuffer[4][20];
+
+typedef struct {
+ int type;
+ char *name;
+ int rows;
+ int cols;
+ int gpis;
+ int gpos;
+ int protocol;
+} MODEL;
+
+/* Fixme #1: number of gpo's should be verified */
+/* Fixme #2: protocol should be verified */
+
+static MODEL Models[] = {
+ {0x01, "LCD0821", 2, 8, 0, 1, 1},
+ {0x03, "LCD2021", 2, 20, 0, 1, 1},
+ {0x04, "LCD1641", 4, 16, 0, 1, 1},
+ {0x05, "LCD2041", 4, 20, 0, 1, 1},
+ {0x06, "LCD4021", 2, 40, 0, 1, 1},
+ {0x07, "LCD4041", 4, 40, 0, 1, 1},
+ {0x08, "LK202-25", 2, 20, 8, 8, 2},
+ {0x09, "LK204-25", 4, 20, 8, 8, 2},
+ {0x0a, "LK404-55", 4, 40, 8, 8, 2},
+ {0x0b, "VFD2021", 2, 20, 0, 1, 1},
+ {0x0c, "VFD2041", 4, 20, 0, 1, 1},
+ {0x0d, "VFD4021", 2, 40, 0, 1, 1},
+ {0x0e, "VK202-25", 2, 20, 0, 1, 1},
+ {0x0f, "VK204-25", 4, 20, 0, 1, 1},
+ {0x10, "GLC12232", -1, -1, 0, 1, 1},
+ {0x13, "GLC24064", -1, -1, 0, 1, 1},
+ {0x15, "GLK24064-25", -1, -1, 0, 1, 1},
+ {0x22, "GLK12232-25", -1, -1, 0, 1, 1},
+ {0x31, "LK404-AT", 4, 40, 8, 8, 2},
+ {0x32, "VFD1621", 2, 16, 0, 1, 1},
+ {0x33, "LK402-12", 2, 40, 8, 8, 2},
+ {0x34, "LK162-12", 2, 16, 8, 8, 2},
+ {0x35, "LK204-25PC", 4, 20, 8, 8, 2},
+ {0x36, "LK202-24-USB", 2, 20, 8, 8, 2},
+ {0x38, "LK204-24-USB", 4, 20, 8, 8, 2},
+ {0x39, "VK204-24-USB", 4, 20, 8, 8, 2},
+ {0x40, "DE-LD011", 2, 16, 0, 0, 3}, /* Sure electronics USB LCD board Rev.I */
+ {0x41, "DE-LD021", 4, 20, 0, 0, 3},
+ {0x42, "DE-LD023", 4, 20, 0, 0, 4},
+ {0xff, "Unknown", -1, -1, 0, 0, 0}
+};
+
+
+/****************************************/
+/*** hardware dependant functions ***/
+/****************************************/
+
+static void drv_MO_write(const int row, const int col, const char *data, const int len)
+{
+ char cmd[5] = "\376Gyx";
+
+ if (Models[Model].protocol == 3 || Models[Model].protocol == 4) { // Sure electronics USB LCD board - full line output
+ cmd[2] = (char) 1;
+ cmd[3] = (char) row + 1;
+ strncpy(&(dispBuffer[row][col]), data, len);
+ drv_generic_serial_write(cmd, 4);
+ drv_generic_serial_write(dispBuffer[row], Models[Model].cols);
+ } else {
+ cmd[2] = (char) col + 1;
+ cmd[3] = (char) row + 1;
+ drv_generic_serial_write(cmd, 4);
+ drv_generic_serial_write(data, len);
+ }
+}
+
+
+static void drv_MO_clear(void)
+{
+ int i, j;
+
+ switch (Protocol) {
+ case 1:
+ drv_generic_serial_write("\014", 1); /* Clear Screen */
+ break;
+ case 2:
+ drv_generic_serial_write("\376\130", 2); /* Clear Screen */
+ break;
+
+ default:
+ /* Sure electronics USB LCD board - clear buffer */
+ /* protocol 3 and 4 */
+ for (i = 0; i < Models[Model].rows; i++) {
+ for (j = 0; j < Models[Model].cols; j++) {
+ dispBuffer[i][j] = ' ';
+ }
+ drv_MO_write(1, i + 1, dispBuffer[i], Models[Model].cols);
+ }
+ break;
+ }
+}
+
+
+static void drv_MO_defchar(const int ascii, const unsigned char *matrix)
+{
+ int i;
+ char cmd[11] = "\376N";
+
+ cmd[2] = (char) ascii;
+ for (i = 0; i < 8; i++) {
+ cmd[i + 3] = matrix[i] & 0x1f;
+ }
+ drv_generic_serial_write(cmd, 11);
+}
+
+
+static int drv_MO_contrast(int contrast)
+{
+ static unsigned char Contrast = 0;
+ char cmd[3] = "\376Pn";
+
+ /* -1 is used to query the current contrast */
+ if (contrast == -1)
+ return Contrast;
+
+ if (contrast < 0)
+ contrast = 0;
+ if (contrast > 255)
+ contrast = 255;
+ Contrast = contrast;
+
+ cmd[2] = Contrast;
+
+ drv_generic_serial_write(cmd, 3);
+
+ return Contrast;
+}
+
+
+static int drv_MO_backlight(int backlight)
+{
+ static unsigned char Backlight = 0;
+ char cmd[3] = "\376Bn";
+
+ /* -1 is used to query the current backlight */
+ if (backlight == -1)
+ return Backlight;
+
+ if (backlight < 0)
+ backlight = 0;
+ if (backlight > 255)
+ backlight = 255;
+ Backlight = backlight;
+
+ if (backlight <= 0) {
+ /* backlight off */
+ drv_generic_serial_write("\376F", 2);
+ } else {
+ /* backlight on for n minutes */
+ cmd[2] = Backlight;
+ drv_generic_serial_write(cmd, 3);
+ }
+
+ return Backlight;
+}
+
+
+static int drv_MO_GPI(const int num)
+{
+ static int GPI[8] = { -1, -1, -1, -1, -1, -1, -1, -1 };
+ static time_t T[8], now;
+
+
+ if (num < 0 || num > 7) {
+ return 0;
+ }
+
+ /* read RPM every two seconds */
+ if (time(&now) - T[num] >= 2) {
+
+ char cmd[3];
+ unsigned char ans[7];
+
+ T[num] = now;
+
+ cmd[0] = '\376';
+ cmd[1] = '\301';
+ cmd[2] = (char) num + 1;
+ drv_generic_serial_write(cmd, 3);
+ usleep(100000);
+
+ if (drv_generic_serial_read((char *) ans, 7) == 7) {
+ if (ans[0] == 0x23 && ans[1] == 0x2a && ans[2] == 0x03 && ans[3] == 0x52 && ans[4] == num + 1) {
+ GPI[num] = 18750000 / (256 * ans[5] + ans[6]);
+ } else {
+ error("%s: strange answer %02x %02x %02x %02x %02x %02x %02x", Name, ans[0], ans[1], ans[2], ans[3],
+ ans[4], ans[5], ans[6]);
+ }
+ }
+ }
+
+ return GPI[num];
+}
+
+
+static int drv_MO_GPO(const int num, const int val)
+{
+ int v = 0;
+ char cmd[4];
+
+ switch (Protocol) {
+ case 1:
+ if (num == 0) {
+ if (val > 0) {
+ v = 1;
+ drv_generic_serial_write("\376W", 2); /* GPO on */
+ } else {
+ v = 0;
+ drv_generic_serial_write("\376V", 2); /* GPO off */
+ }
+ }
+ break;
+
+ case 2:
+ if (val <= 0) {
+ v = 0;
+ cmd[0] = '\376';
+ cmd[1] = 'V'; /* GPO off */
+ cmd[2] = (char) num + 1;
+ drv_generic_serial_write(cmd, 3);
+ } else if (val >= 255) {
+ v = 255;
+ cmd[0] = '\376';
+ cmd[1] = 'W'; /* GPO on */
+ cmd[2] = (char) num + 1;
+ drv_generic_serial_write(cmd, 3);
+ } else {
+ v = val;
+ cmd[0] = '\376';
+ cmd[1] = '\300'; /* PWM control */
+ cmd[2] = (char) num + 1;
+ cmd[3] = (char) v;
+ drv_generic_serial_write(cmd, 4);
+ }
+ break;
+ }
+
+ return v;
+}
+
+
+static int drv_MO_start(const char *section, const int quiet)
+{
+ int i;
+ char *model;
+ char buffer[256];
+
+ model = cfg_get(section, "Model", NULL);
+ if (model != NULL && *model != '\0') {
+ for (i = 0; Models[i].type != 0xff; i++) {
+ if (strcasecmp(Models[i].name, model) == 0)
+ break;
+ }
+ if (Models[i].type == 0xff) {
+ error("%s: %s.Model '%s' is unknown from %s", Name, section, model, cfg_source());
+ return -1;
+ }
+ Model = i;
+ info("%s: using model '%s'", Name, Models[Model].name);
+ } else {
+ info("%s: no '%s.Model' entry from %s, auto-dedecting", Name, section, cfg_source());
+ Model = -1;
+ }
+
+ if (Model != -1 && (Models[Model].protocol == 3 || Models[Model].protocol == 4)) { // Sure electronics USB LCD board - full line output
+ int i, j;
+ for (i = 0; i < Models[Model].rows; i++) { // Clear buffer
+ for (j = 0; j < Models[Model].cols; j++) {
+ dispBuffer[i][j] = ' ';
+ }
+ }
+ }
+
+ if (drv_generic_serial_open(section, Name, 0) < 0)
+ return -1;
+
+ if (Model == -1 || Models[Model].protocol > 1) {
+ /* read module type */
+ drv_generic_serial_write("\3767", 2);
+ usleep(1000);
+ if (drv_generic_serial_read(buffer, 1) == 1) {
+ for (i = 0; Models[i].type != 0xff; i++) {
+ if (Models[i].type == (int) *buffer)
+ break;
+ }
+ info("%s: display reports model '%s' (type 0x%02x)", Name, Models[i].name, Models[i].type);
+
+ /* auto-dedection */
+ if (Model == -1)
+ Model = i;
+
+ /* auto-dedection matches specified model? */
+ if (Models[i].type != 0xff && Model != i) {
+ error("%s: %s.Model '%s' from %s does not match dedected Model '%s'", Name, section, model,
+ cfg_source(), Models[i].name);
+ return -1;
+ }
+
+ } else {
+ info("%s: display detection failed.", Name);
+ }
+ }
+
+ /* initialize global variables */
+ DROWS = Models[Model].rows;
+ DCOLS = Models[Model].cols;
+ GPIS = Models[Model].gpis;
+ GPOS = Models[Model].gpos;
+ Protocol = Models[Model].protocol;
+
+ if (Protocol > 1) {
+ /* read serial number */
+ drv_generic_serial_write("\3765", 2);
+ usleep(100000);
+ if (drv_generic_serial_read(buffer, 2) == 2) {
+ info("%s: display reports serial number 0x%x", Name, *(short *) buffer);
+ }
+
+ /* read version number */
+ drv_generic_serial_write("\3766", 2);
+ usleep(100000);
+ if (drv_generic_serial_read(buffer, 1) == 1) {
+ info("%s: display reports firmware version 0x%x", Name, *buffer);
+ }
+ }
+
+ char cmd[5];
+ if (Protocol == 4) {
+ /* send init string */
+ cmd[0] = '\376';
+ cmd[1] = 'S';
+ cmd[2] = 'u';
+ cmd[3] = 'r';
+ cmd[4] = 'e';
+ drv_generic_serial_write(cmd, 5);
+ }
+
+ drv_MO_clear();
+
+ drv_generic_serial_write("\376B", 3); /* backlight on */
+ drv_generic_serial_write("\376K", 2); /* cursor off */
+ drv_generic_serial_write("\376T", 2); /* blink off */
+ drv_generic_serial_write("\376D", 2); /* line wrapping off */
+ drv_generic_serial_write("\376R", 2); /* auto scroll off */
+
+ /* set contrast */
+ if (cfg_number(section, "Contrast", 0, 0, 255, &i) > 0) {
+ drv_MO_contrast(i);
+ }
+
+ /* set backlight */
+ if (cfg_number(section, "Backlight", 0, 0, 255, &i) > 0) {
+ drv_MO_backlight(i);
+ }
+
+ if (!quiet) {
+ if (drv_generic_text_greet(Models[Model].name, "MatrixOrbital")) {
+ sleep(3);
+ drv_MO_clear();
+ }
+ }
+
+ return 0;
+}
+
+
+/****************************************/
+/*** plugins ***/
+/****************************************/
+
+
+static void plugin_contrast(RESULT * result, const int argc, RESULT * argv[])
+{
+ double contrast;
+
+ switch (argc) {
+ case 0:
+ contrast = drv_MO_contrast(-1);
+ SetResult(&result, R_NUMBER, &contrast);
+ break;
+ case 1:
+ contrast = drv_MO_contrast(R2N(argv[0]));
+ SetResult(&result, R_NUMBER, &contrast);
+ break;
+ default:
+ error("%s::contrast(): wrong number of parameters", Name);
+ SetResult(&result, R_STRING, "");
+ }
+}
+
+
+static void plugin_backlight(RESULT * result, const int argc, RESULT * argv[])
+{
+ double backlight;
+
+ switch (argc) {
+ case 0:
+ backlight = drv_MO_backlight(-1);
+ SetResult(&result, R_NUMBER, &backlight);
+ break;
+ case 1:
+ backlight = drv_MO_backlight(R2N(argv[0]));
+ SetResult(&result, R_NUMBER, &backlight);
+ break;
+ default:
+ error("%s::backlight(): wrong number of parameters", Name);
+ SetResult(&result, R_STRING, "");
+ }
+}
+
+
+/****************************************/
+/*** widget callbacks ***/
+/****************************************/
+
+/* using drv_generic_text_draw(W) */
+/* using drv_generic_text_icon_draw(W) */
+/* using drv_generic_text_bar_draw(W) */
+/* using drv_generic_gpio_draw(W) */
+
+
+/****************************************/
+/*** exported functions ***/
+/****************************************/
+
+
+/* list models */
+int drv_MO_list(void)
+{
+ int i;
+
+ for (i = 0; Models[i].type != 0xff; i++) {
+ printf("%s ", Models[i].name);
+ }
+ return 0;
+}
+
+
+/* initialize driver & display */
+int drv_MO_init(const char *section, const int quiet)
+{
+ WIDGET_CLASS wc;
+ int ret;
+ int asc255bug;
+
+ info("%s: %s", Name, "$Rev: 1150 $");
+
+ /* display preferences */
+ XRES = 5; /* pixel width of one char */
+ YRES = 8; /* pixel height of one char */
+ CHARS = 8; /* number of user-defineable characters */
+ CHAR0 = 0; /* ASCII of first user-defineable char */
+ GOTO_COST = 4; /* number of bytes a goto command requires */
+
+ /* real worker functions */
+ drv_generic_text_real_write = drv_MO_write;
+ drv_generic_text_real_defchar = drv_MO_defchar;
+ drv_generic_gpio_real_get = drv_MO_GPI;
+ drv_generic_gpio_real_set = drv_MO_GPO;
+
+
+ /* start display */
+ if ((ret = drv_MO_start(section, quiet)) != 0)
+ return ret;
+
+ /* initialize generic text driver */
+ if ((ret = drv_generic_text_init(section, Name)) != 0)
+ return ret;
+
+ /* initialize generic icon driver */
+ if ((ret = drv_generic_text_icon_init()) != 0)
+ return ret;
+
+ /* initialize generic bar driver */
+ if ((ret = drv_generic_text_bar_init(0)) != 0)
+ return ret;
+
+ /* add fixed chars to the bar driver */
+ /* most displays have a full block on ascii 255, but some have kind of */
+ /* an 'inverted P'. If you specify 'asc255bug 1 in the config, this */
+ /* char will not be used, but rendered by the bar driver */
+ cfg_number(section, "asc255bug", 0, 0, 1, &asc255bug);
+ drv_generic_text_bar_add_segment(0, 0, 255, 32); /* ASCII 32 = blank */
+ if (!asc255bug)
+ drv_generic_text_bar_add_segment(255, 255, 255, 255); /* ASCII 255 = block */
+
+ /* initialize generic GPIO driver */
+ if ((ret = drv_generic_gpio_init(section, Name)) != 0)
+ return ret;
+
+ /* register text widget */
+ wc = Widget_Text;
+ wc.draw = drv_generic_text_draw;
+ widget_register(&wc);
+
+ /* register icon widget */
+ wc = Widget_Icon;
+ wc.draw = drv_generic_text_icon_draw;
+ widget_register(&wc);
+
+ /* register bar widget */
+ wc = Widget_Bar;
+ wc.draw = drv_generic_text_bar_draw;
+ widget_register(&wc);
+
+ /* register plugins */
+ AddFunction("LCD::contrast", -1, plugin_contrast);
+ AddFunction("LCD::backlight", -1, plugin_backlight);
+
+ return 0;
+}
+
+
+/* close driver & display */
+int drv_MO_quit(const int quiet)
+{
+
+ info("%s: shutting down display.", Name);
+
+ drv_generic_text_quit();
+ drv_generic_gpio_quit();
+
+ /* clear display */
+ drv_MO_clear();
+
+ usleep(300000);
+
+ /* say goodbye... */
+ if (!quiet) {
+ drv_generic_text_greet("goodbye!", NULL);
+ }
+
+ usleep(300000);
+
+ drv_generic_serial_close();
+
+ return (0);
+}
+
+
+DRIVER drv_MatrixOrbital = {
+ .name = Name,
+ .list = drv_MO_list,
+ .init = drv_MO_init,
+ .quit = drv_MO_quit,
+};
diff --git a/drv_MatrixOrbitalGX.c b/drv_MatrixOrbitalGX.c
new file mode 100644
index 0000000..20f082a
--- /dev/null
+++ b/drv_MatrixOrbitalGX.c
@@ -0,0 +1,571 @@
+/* $Id: drv_MatrixOrbitalGX.c 975 2009-02-27 18:50:20Z abbas $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/drv_MatrixOrbitalGX.c $
+ *
+ * driver for Matrix Orbital GX Series Graphic(240x64) displays from matrixorbital.com
+ *
+ * Copyright (C) 2009 Abbas Kosan <abbaskosan@gmail.com>
+ * Copyright (C) 2005, 2006, 2007 The LCD4Linux Team
+ * <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ *
+ * exported fuctions:
+ *
+ * struct DRIVER drv_MatrixOrbitalGX
+ *
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+//#include <termios.h>
+//#include <fcntl.h>
+//#include <sys/ioctl.h>
+//#include <sys/time.h>
+
+#include <usb.h>
+
+#include "debug.h"
+#include "cfg.h"
+#include "qprintf.h"
+#include "udelay.h"
+#include "plugin.h"
+#include "widget.h"
+#include "widget_text.h"
+#include "widget_icon.h"
+#include "widget_bar.h"
+#include "drv.h"
+
+#include "drv_generic_graphic.h"
+
+#define MatrixOrbitalGX_VENDOR 0x1b3d
+#define MatrixOrbitalGX_DEVICE_1 0x000a
+#define MatrixOrbitalGX_DEVICE_2 0x000b
+#define MatrixOrbitalGX_DEVICE_3 0x000c
+
+/********Matrix Orbital GX Series*********/
+#define INTERFACE_ 0
+#define BULK_OUT_ENDPOINT 0x05
+#define BULK_IN_ENDPOINT 0x82
+
+#define SCREEN_H 64
+#define SCREEN_W 240
+#define SCREEN_SIZE (SCREEN_H * SCREEN_W)
+/*****************************************/
+
+#if 1
+#define DEBUG(x) debug("%s(): %s", __FUNCTION__, x);
+#else
+#define DEBUG(x)
+#endif
+
+
+static char Name[] = "MatrixOrbitalGX";
+static unsigned char *MOGX_framebuffer;
+
+/* used to display white text on blue background or inverse */
+static unsigned char invert = 0x00;
+static unsigned char backlight_RGB = 0;
+
+static usb_dev_handle *lcd_dev;
+
+/*
+int mygetch(void)
+{
+ struct termios oldt, newt;
+ int ch;
+ tcgetattr( STDIN_FILENO, &oldt );
+ newt = oldt;
+ newt.c_lflag &= ~( ICANON | ECHO );
+ tcsetattr( STDIN_FILENO, TCSANOW, &newt );
+ ch = getchar();
+ tcsetattr( STDIN_FILENO, TCSANOW, &oldt );
+ return ch;
+}
+*/
+
+/****************************************/
+/*** hardware dependant functions ***/
+/****************************************/
+
+static int drv_MOGX_open(void)
+{
+ struct usb_bus *busses, *bus;
+ struct usb_device *dev;
+ char driver[1024];
+ char product[1024];
+ char manufacturer[1024];
+ char serialnumber[1024];
+ int ret;
+
+ lcd_dev = NULL;
+
+ info("%s: scanning for Matrix Orbital GX Series LCD...", Name);
+
+ usb_set_debug(0);
+
+ usb_init();
+ usb_find_busses();
+ usb_find_devices();
+ busses = usb_get_busses();
+
+ for (bus = busses; bus; bus = bus->next) {
+ for (dev = bus->devices; dev; dev = dev->next) {
+ if ((dev->descriptor.idVendor == MatrixOrbitalGX_VENDOR) &&
+ ((dev->descriptor.idProduct == MatrixOrbitalGX_DEVICE_1) ||
+ (dev->descriptor.idProduct == MatrixOrbitalGX_DEVICE_2) ||
+ (dev->descriptor.idProduct == MatrixOrbitalGX_DEVICE_3))) {
+
+ /* At the moment, I have information for only this LCD */
+ if (dev->descriptor.idProduct == MatrixOrbitalGX_DEVICE_2)
+ backlight_RGB = 0;
+
+ info("%s: found Matrix Orbital GX Series LCD on bus %s device %s", Name, bus->dirname, dev->filename);
+
+ lcd_dev = usb_open(dev);
+
+ ret = usb_get_driver_np(lcd_dev, 0, driver, sizeof(driver));
+
+ if (ret == 0) {
+ info("%s: interface 0 already claimed by '%s'", Name, driver);
+ info("%s: attempting to detach driver...", Name);
+ if (usb_detach_kernel_driver_np(lcd_dev, 0) < 0) {
+ error("%s: usb_detach_kernel_driver_np() failed!", Name);
+ return -1;
+ }
+ }
+
+ usb_set_configuration(lcd_dev, 1);
+ usleep(100);
+
+ if (usb_claim_interface(lcd_dev, 0) < 0) {
+ error("%s: usb_claim_interface() failed!", Name);
+ return -1;
+ }
+
+ usb_set_altinterface(lcd_dev, 0);
+
+ usb_get_string_simple(lcd_dev, dev->descriptor.iProduct, product, sizeof(product));
+ usb_get_string_simple(lcd_dev, dev->descriptor.iManufacturer, manufacturer, sizeof(manufacturer));
+ usb_get_string_simple(lcd_dev, dev->descriptor.iSerialNumber, serialnumber, sizeof(serialnumber));
+
+ info("%s: Manufacturer='%s' Product='%s' SerialNumber='%s'", Name, manufacturer, product, serialnumber);
+
+ return 0;
+ }
+ }
+ }
+ error("%s: could not find a Matrix Orbital GX Series LCD", Name);
+ return -1;
+}
+
+static void drv_MOGX_send(const unsigned char *data, const unsigned int size)
+{
+ int __attribute__ ((unused)) ret;
+
+ //unsigned char rcv_buffer[64] = "";
+
+ ret = usb_bulk_write(lcd_dev, BULK_OUT_ENDPOINT, (char *) data, size, 1000);
+
+ //info("%s written %d bytes\n", __FUNCTION__, ret);
+
+ //ret = usb_bulk_read(lcd_dev, BULK_IN_ENDPOINT, (char *) rcv_buffer,64,1000);
+
+ //printf("\nReply : ");
+ //for (i=0;i<ret;i++)
+ //printf("%3x",rcv_buffer[i]);
+}
+
+static int drv_MOGX_close(void)
+{
+ /* close whatever port you've opened */
+ usb_release_interface(lcd_dev, 0);
+ usb_close(lcd_dev);
+
+ return 0;
+}
+
+/* Send framebuffer to lcd */
+static void drv_MOGX_update_lcd()
+{
+ unsigned char cmd[3852] = { 0x38, 0x46, 0x42, 0x46, 0x50, 0x00, 0x00, 0x07, 0x80, 0xff, 0xff };
+ /*
+ index : index of pixel_byte in cmd[]
+ bit : pixel of each pixel_byte
+ x : index of pixel in framebuffer
+ pixel_byte : each 8 pixel in framebuffer = 1 byte
+ */
+ int index, bit, x = 0;
+ unsigned int cmd_length = 0;
+ unsigned char pixel_byte;
+
+ //info("In %s\n", __FUNCTION__);
+
+ for (index = 0; index < (SCREEN_SIZE / 8); index++) {
+ pixel_byte = 0x00;
+ for (bit = 7; bit >= 0; bit--) {
+ if (MOGX_framebuffer[x] ^ invert)
+ pixel_byte |= (1 << bit);
+ else
+ pixel_byte &= ~(1 << bit);
+ x++;
+ }
+
+ if (pixel_byte == 0xc0) {
+ cmd[11 + cmd_length] = 0xdb;
+ cmd_length++;
+ cmd[11 + cmd_length] = 0xdc;
+ cmd_length++;
+ } else if (pixel_byte == 0xdb) {
+ cmd[11 + cmd_length] = 0xdb;
+ cmd_length++;
+ cmd[11 + cmd_length] = 0xdd;
+ cmd_length++;
+ } else {
+ cmd[11 + cmd_length] = pixel_byte;
+ cmd_length++;
+ }
+ }
+ /* finish command */
+ cmd[11 + cmd_length] = 0xc0;
+
+ //info("In %s - %s \n", __FUNCTION__, cmd_img);
+ /* send command which includes framebuffer */
+ drv_MOGX_send(cmd, cmd_length + 12);
+}
+
+static void drv_MOGX_blit(const int row, const int col, const int height, const int width)
+{
+ int r, c;
+
+ for (r = row; r < row + height; r++) {
+ for (c = col; c < col + width; c++)
+ MOGX_framebuffer[r * SCREEN_W + c] = drv_generic_graphic_black(r, c);
+ }
+ drv_MOGX_update_lcd();
+}
+
+void drv_MOGX_clear(void)
+{
+ //info("In %s\n", __FUNCTION__);
+ memset(MOGX_framebuffer, 0x00, SCREEN_SIZE);
+ /* clear the screen */
+ drv_MOGX_update_lcd();
+}
+
+/* TODO : I am not sure for contrast function (command)
+ Don't try to adjust contrast until contrast function is checked and fixed
+*/
+/*
+static int drv_MOGX_contrast(int contrast)
+{
+ unsigned char cmd[11] = {0x18,0x4c,0x43,0x53,0x43,0x00,0x00,0x00,0x01,0x00,0xc0};
+
+ // adjust limits according to the display
+ if (contrast < 0)
+ contrast = 0;
+ if (contrast > 255)
+ contrast = 255;
+
+ // send contrast command
+ cmd[9] = contrast;
+ drv_MOGX_send(cmd, 11);
+
+ return contrast;
+}
+*/
+
+/* backlight function used in plugin */
+static int drv_MOGX_backlight(int backlight)
+{
+ unsigned char cmd[13] = { 0x18, 0x4c, 0x43, 0x53, 0x48, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xc0 };
+
+ if (backlight < 0)
+ backlight = 0;
+ if (backlight >= 255)
+ backlight = 255;
+
+ cmd[10] = backlight;
+ drv_MOGX_send(cmd, 13);
+
+ return backlight;
+}
+
+/* backlightRGB function used in plugin */
+static int drv_MOGX_backlightRGB(int backlight_R, int backlight_G, int backlight_B)
+{
+ /*
+ TODO : Function should be tested for three color LCD
+ */
+ //unsigned char cmd1[11] = {0x18,0x4c,0x43,0x53,0x42,0x00,0x00,0x00,0x01,0xff,0xc0};
+ unsigned char cmd2[13] = { 0x18, 0x4c, 0x43, 0x53, 0x48, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xc0 };
+
+ if (backlight_R < 0)
+ backlight_R = 0;
+ if (backlight_R >= 255)
+ backlight_R = 255;
+
+ if (backlight_G < 0)
+ backlight_G = 0;
+ if (backlight_G >= 255)
+ backlight_G = 255;
+
+ if (backlight_B < 0)
+ backlight_B = 0;
+ if (backlight_B >= 255)
+ backlight_B = 255;
+
+ //cmd1[9] = backlight;
+ cmd2[9] = backlight_R;
+ cmd2[10] = backlight_G;
+ cmd2[11] = backlight_B;
+ //drv_MOGX_send(cmd1, 11);
+ drv_MOGX_send(cmd2, 13);
+
+ return backlight_R + backlight_G + backlight_B;
+}
+
+/* start graphic display */
+static int drv_MOGX_start(const char *section, const __attribute__ ((unused))
+ int quiet)
+{
+ char *s;
+ int value1, value2, value3;
+
+ /* read display size from config */
+ s = cfg_get(section, "Size", NULL);
+ if (s == NULL || *s == '\0') {
+ error("%s: no '%s.Size' entry from %s", Name, section, cfg_source());
+ return -1;
+ }
+
+ DROWS = -1;
+ DCOLS = -1;
+ if (sscanf(s, "%dx%d", &DCOLS, &DROWS) != 2 || DCOLS < 1 || DROWS < 1) {
+ error("%s: bad %s.Size '%s' from %s", Name, section, s, cfg_source());
+ return -1;
+ }
+
+ s = cfg_get(section, "Font", "6x8");
+ if (s == NULL || *s == '\0') {
+ error("%s: no '%s.Font' entry from %s", Name, section, cfg_source());
+ return -1;
+ }
+
+ XRES = -1;
+ YRES = -1;
+ if (sscanf(s, "%dx%d", &XRES, &YRES) != 2 || XRES < 1 || YRES < 1) {
+ error("%s: bad %s.Font '%s' from %s", Name, section, s, cfg_source());
+ return -1;
+ }
+
+ /* Fixme: provider other fonts someday... */
+ if (XRES != 6 && YRES != 8) {
+ error("%s: bad Font '%s' from %s (only 6x8 at the moment)", Name, s, cfg_source());
+ return -1;
+ }
+
+ if (cfg_number(section, "Invert", 0, 0, 1, &value1) > 0)
+ if (value1 > 0) {
+ info("%s: Display is inverted", Name);
+ invert = 0x01;
+ }
+
+ /* open communication with the display */
+ if (drv_MOGX_open() < 0) {
+ return -1;
+ }
+
+ /* Init framebuffer buffer */
+ MOGX_framebuffer = (unsigned char *) malloc(SCREEN_SIZE * sizeof(unsigned char));
+ if (!MOGX_framebuffer) {
+ error("%s: framebuffer could not be allocated: malloc() failed", Name);
+ return -1;
+ }
+
+ memset(MOGX_framebuffer, 0x00, SCREEN_SIZE);
+ //info("%s framebuffer zeroed", __FUNCTION__);
+
+/* TODO : I am not sure for contrast function (command)
+ Don't try to adjust contrast until contrast function is checked and fixed
+*/
+/*
+ if (cfg_number(section, "Contrast", 0, 0, 255, &value1) > 0) {
+ info("%s: Setting contrast to %d", Name, value1);
+ drv_MOGX_contrast(value1);
+ }
+*/
+ /* if lcd has three color backlight call the backlightRGB function */
+ if (backlight_RGB) {
+ if ((cfg_number(section, "Backlight_R", 0, 0, 255, &value1) > 0) &&
+ (cfg_number(section, "Backlight_G", 0, 0, 255, &value2) > 0) &&
+ (cfg_number(section, "Backlight_B", 0, 0, 255, &value3) > 0)) {
+ info("%s: Setting backlight to %d,%d,%d (RGB)", Name, value1, value2, value3);
+ drv_MOGX_backlightRGB(value1, value2, value3);
+ }
+ } else {
+ if ((cfg_number(section, "Backlight", 0, 0, 255, &value1) > 0)) {
+ info("%s: Setting backlight to %d", Name, value1);
+ drv_MOGX_backlight(value1);
+ }
+ }
+
+ //info("In %s\n", __FUNCTION__);
+
+ return 0;
+}
+
+
+/****************************************/
+/*** plugins ***/
+/****************************************/
+/* TODO : I am not sure for contrast function (command)
+ Don't try to adjust contrast until contrast function is checked and fixed
+*/
+/*
+static void plugin_contrast(RESULT * result, RESULT * arg1)
+{
+ double contrast;
+
+ contrast = drv_MOGX_contrast(R2N(arg1));
+ SetResult(&result, R_NUMBER, &contrast);
+}
+*/
+
+static void plugin_backlight(RESULT * result, RESULT * arg1)
+{
+ double backlight;
+
+ backlight = drv_MOGX_backlight(R2N(arg1));
+ SetResult(&result, R_NUMBER, &backlight);
+}
+
+static void plugin_backlightRGB(RESULT * result, RESULT * arg1, RESULT * arg2, RESULT * arg3)
+{
+ double backlight;
+
+ backlight = drv_MOGX_backlightRGB(R2N(arg1), R2N(arg2), R2N(arg3));
+ SetResult(&result, R_NUMBER, &backlight);
+}
+
+/****************************************/
+/*** widget callbacks ***/
+/****************************************/
+
+
+/* using drv_generic_text_draw(W) */
+/* using drv_generic_text_icon_draw(W) */
+/* using drv_generic_text_bar_draw(W) */
+/* using drv_generic_gpio_draw(W) */
+
+
+/****************************************/
+/*** exported functions ***/
+/****************************************/
+
+
+/* list models */
+int drv_MOGX_list(void)
+{
+ printf("Matrix Orbital GX Series driver");
+ return 0;
+}
+
+/* initialize driver & display */
+int drv_MOGX_init(const char *section, const int quiet)
+{
+ int ret;
+
+ //info("%s: %s", Name, "$Rev: 2$");
+ //info("Matrix Orbital GX Series LCD initialization\n");
+
+ /* real worker functions */
+ drv_generic_graphic_real_blit = drv_MOGX_blit;
+
+ /* start display */
+ if ((ret = drv_MOGX_start(section, quiet)) != 0)
+ return ret;
+
+ /* initialize generic graphic driver */
+ if ((ret = drv_generic_graphic_init(section, Name)) != 0)
+ return ret;
+
+ if (!quiet) {
+ char buffer[40];
+ qprintf(buffer, sizeof(buffer), "%s %dx%d", Name, DCOLS, DROWS);
+ if (drv_generic_graphic_greet(buffer, "http://www.matrixorbital.com")) {
+ sleep(3);
+ drv_generic_graphic_clear();
+ }
+ }
+
+ /* register plugins */
+ /* TODO : I am not sure for contrast function (command)
+ Don't try to adjust contrast until contrast function is checked and fixed
+ */
+ //AddFunction("LCD::contrast", 1, plugin_contrast);
+ if (backlight_RGB)
+ AddFunction("LCD::backlightRGB", 3, plugin_backlightRGB);
+ else
+ AddFunction("LCD::backlight", 1, plugin_backlight);
+
+ //info("In %s\n", __FUNCTION__);
+
+ memset(MOGX_framebuffer, 0x00, SCREEN_SIZE);
+ //DEBUG("zeroed");
+
+ return 0;
+}
+
+
+
+/* close driver & display */
+int drv_MOGX_quit(const __attribute__ ((unused))
+ int quiet)
+{
+ info("%s: shutting down.", Name);
+
+ /* clear display */
+ drv_MOGX_clear();
+
+ drv_generic_graphic_quit();
+
+ //debug("closing connection");
+ drv_MOGX_close();
+
+ if (MOGX_framebuffer) {
+ free(MOGX_framebuffer);
+ }
+
+ return (0);
+}
+
+/* use this one for a graphic display */
+DRIVER drv_MatrixOrbitalGX = {
+ .name = Name,
+ .list = drv_MOGX_list,
+ .init = drv_MOGX_init,
+ .quit = drv_MOGX_quit,
+};
diff --git a/drv_MilfordInstruments.c b/drv_MilfordInstruments.c
new file mode 100644
index 0000000..ed49ab8
--- /dev/null
+++ b/drv_MilfordInstruments.c
@@ -0,0 +1,285 @@
+/* $Id: drv_MilfordInstruments.c 840 2007-09-09 12:17:42Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/drv_MilfordInstruments.c $
+ *
+ * driver for Milford Instruments 'BPK' piggy-back serial interface board
+ * for standard Hitachi 44780 compatible lcd modules.
+ *
+ * Copyright (C) 2003, 2004 Andy Baxter <andy@earthsong.free-online.co.uk>
+ * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * based on the MatrixOrbital driver which is
+ * Copyright (C) 1999, 2000 Michael Reinelt <michael@reinelt.co.at>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ *
+ * exported fuctions:
+ *
+ * struct DRIVER drv_MilfordInstruments
+ *
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "debug.h"
+#include "cfg.h"
+#include "plugin.h"
+#include "widget.h"
+#include "widget_text.h"
+#include "widget_icon.h"
+#include "widget_bar.h"
+#include "drv.h"
+#include "drv_generic_text.h"
+#include "drv_generic_serial.h"
+
+
+static char Name[] = "MilfordInstruments";
+
+typedef struct {
+ int type;
+ char *name;
+ int rows;
+ int cols;
+} MODEL;
+
+static MODEL Models[] = {
+ {216, "MI216", 2, 16},
+ {220, "MI220", 2, 20},
+ {240, "MI240", 2, 40},
+ {420, "MI420", 4, 20},
+ {-1, "unknown", -1, -1},
+};
+
+static int Model;
+
+
+/****************************************/
+/*** hardware dependant functions ***/
+/****************************************/
+
+static void drv_MI_clear(void)
+{
+ drv_generic_serial_write("\376\001", 2); /* clear screen */
+}
+
+
+static void drv_MI_write(const int row, const int col, const char *data, const int len)
+{
+ char cmd[2] = "\376x";
+ int ddbase = 128;
+ if (row & 1) { /* i.e. if row is 1 or 3 */
+ ddbase += 64;
+ }
+ if (row & 2) { /* i.e. if row is 0 or 2. */
+ ddbase += 20;
+ }
+ cmd[1] = (char) (ddbase + col);
+ drv_generic_serial_write(cmd, 2);
+
+ drv_generic_serial_write(data, len);
+}
+
+
+static void drv_MI_defchar(const int ascii, const unsigned char *matrix)
+{
+ int i;
+ char cmd[10] = "\376x";
+
+ if (ascii < 8) {
+ cmd[1] = (char) (64 + ascii * 8);
+ for (i = 0; i < 8; i++) {
+ cmd[i + 2] = matrix[i] & 0x1f;
+ };
+ drv_generic_serial_write(cmd, 10);
+ }
+}
+
+
+static int drv_MI_start(const char *section, const int quiet)
+{
+ int i;
+ char *model;
+
+ model = cfg_get(section, "Model", NULL);
+ if (model == NULL && *model == '\0') {
+ error("%s: no '%s.Model' entry from %s", Name, section, cfg_source());
+ return -1;
+ }
+
+ for (i = 0; Models[i].type != 0xff; i++) {
+ if (strcasecmp(Models[i].name, model) == 0)
+ break;
+ }
+ if (Models[i].type == 0xff) {
+ error("%s: %s.Model '%s' is unknown from %s", Name, section, model, cfg_source());
+ return -1;
+ }
+ Model = i;
+ info("%s: using model '%s'", Name, Models[Model].name);
+
+ if (drv_generic_serial_open(section, Name, 0) < 0)
+ return -1;
+
+ /* initialize global variables */
+ DROWS = Models[Model].rows;
+ DCOLS = Models[Model].cols;
+
+ drv_MI_clear();
+ drv_generic_serial_write("\376\014", 2); /* cursor off */
+
+ if (!quiet) {
+ if (drv_generic_text_greet(Models[Model].name, "Milford Instruments")) {
+ sleep(3);
+ drv_MI_clear();
+ }
+ }
+
+ return 0;
+}
+
+
+/****************************************/
+/*** plugins ***/
+/****************************************/
+
+/* none at the moment... */
+
+
+/****************************************/
+/*** widget callbacks ***/
+/****************************************/
+
+/* using drv_generic_text_draw(W) */
+/* using drv_generic_text_icon_draw(W) */
+/* using drv_generic_text_bar_draw(W) */
+
+
+/****************************************/
+/*** exported functions ***/
+/****************************************/
+
+
+/* list models */
+int drv_MI_list(void)
+{
+ int i;
+
+ for (i = 0; Models[i].type > 0; i++) {
+ printf("%s ", Models[i].name);
+ }
+ return 0;
+}
+
+
+/* initialize driver & display */
+int drv_MI_init(const char *section, const int quiet)
+{
+ WIDGET_CLASS wc;
+ int ret;
+
+ info("%s: %s", Name, "$Rev: 840 $");
+
+ /* display preferences */
+ XRES = 5; /* pixel width of one char */
+ YRES = 8; /* pixel height of one char */
+ CHARS = 8; /* number of user-defineable characters */
+ CHAR0 = 0; /* ASCII of first user-defineable char */
+ GOTO_COST = 4; /* number of bytes a goto command requires */
+
+ /* real worker functions */
+ drv_generic_text_real_write = drv_MI_write;
+ drv_generic_text_real_defchar = drv_MI_defchar;
+
+
+ /* start display */
+ if ((ret = drv_MI_start(section, quiet)) != 0)
+ return ret;
+
+ /* initialize generic text driver */
+ if ((ret = drv_generic_text_init(section, Name)) != 0)
+ return ret;
+
+ /* initialize generic icon driver */
+ if ((ret = drv_generic_text_icon_init()) != 0)
+ return ret;
+
+ /* initialize generic bar driver */
+ if ((ret = drv_generic_text_bar_init(0)) != 0)
+ return ret;
+
+ /* add fixed chars to the bar driver */
+ drv_generic_text_bar_add_segment(0, 0, 255, 32); /* ASCII 32 = blank */
+ drv_generic_text_bar_add_segment(255, 255, 255, 255); /* ASCII 255 = block */
+
+ /* register text widget */
+ wc = Widget_Text;
+ wc.draw = drv_generic_text_draw;
+ widget_register(&wc);
+
+ /* register icon widget */
+ wc = Widget_Icon;
+ wc.draw = drv_generic_text_icon_draw;
+ widget_register(&wc);
+
+ /* register bar widget */
+ wc = Widget_Bar;
+ wc.draw = drv_generic_text_bar_draw;
+ widget_register(&wc);
+
+ /* register plugins */
+ /* none at the moment... */
+
+ return 0;
+}
+
+
+/* close driver & display */
+int drv_MI_quit(const int quiet)
+{
+
+ info("%s: shutting down.", Name);
+
+ drv_generic_text_quit();
+
+ /* clear display */
+ drv_MI_clear();
+
+ /* say goodbye... */
+ if (!quiet) {
+ drv_generic_text_greet("goodbye!", NULL);
+ }
+
+ drv_generic_serial_close();
+
+ return (0);
+}
+
+
+DRIVER drv_MilfordInstruments = {
+ .name = Name,
+ .list = drv_MI_list,
+ .init = drv_MI_init,
+ .quit = drv_MI_quit,
+};
diff --git a/drv_NULL.c b/drv_NULL.c
new file mode 100644
index 0000000..35459b6
--- /dev/null
+++ b/drv_NULL.c
@@ -0,0 +1,195 @@
+/* $Id: drv_NULL.c 975 2009-01-18 11:16:20Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/drv_NULL.c $
+ *
+ * NULL driver (for testing)
+ *
+ * Copyright (C) 2004 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ *
+ * exported fuctions:
+ *
+ * struct DRIVER drv_NULL
+ *
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "debug.h"
+#include "cfg.h"
+#include "plugin.h"
+#include "widget.h"
+#include "widget_text.h"
+#include "widget_bar.h"
+#include "drv.h"
+#include "drv_generic_text.h"
+
+
+static char Name[] = "NULL";
+
+
+/****************************************/
+/*** hardware dependant functions ***/
+/****************************************/
+
+static void drv_NULL_write(const __attribute__ ((unused))
+ int row, const __attribute__ ((unused))
+ int col, const __attribute__ ((unused))
+ char *data, const __attribute__ ((unused))
+ int len)
+{
+ /* empty */
+}
+
+
+static void drv_NULL_defchar(const __attribute__ ((unused))
+ int ascii, const __attribute__ ((unused))
+ unsigned char *matrix)
+{
+ /* empty */
+}
+
+
+static int drv_NULL_start(const char *section)
+{
+ char *s;
+
+ s = cfg_get(section, "Size", "20x4");
+ if (s == NULL || *s == '\0') {
+ error("%s: no '%s.Size' entry from %s", Name, section, cfg_source());
+ free(s);
+ return -1;
+ }
+ if (sscanf(s, "%dx%d", &DCOLS, &DROWS) != 2 || DROWS < 1 || DCOLS < 1) {
+ error("%s: bad %s.Size '%s' from %s", Name, section, s, cfg_source());
+ free(s);
+ return -1;
+ }
+ free(s);
+
+ return 0;
+}
+
+
+/****************************************/
+/*** plugins ***/
+/****************************************/
+
+/* none at the moment... */
+
+
+/****************************************/
+/*** widget callbacks ***/
+/****************************************/
+
+/* using drv_generic_text_draw(W) */
+/* using drv_generic_text_bar_draw(W) */
+
+
+/****************************************/
+/*** exported functions ***/
+/****************************************/
+
+
+/* list models */
+int drv_NULL_list(void)
+{
+ printf("NULL driver for testing purposes");
+ return 0;
+}
+
+
+/* initialize driver & display */
+int drv_NULL_init(const char *section, const __attribute__ ((unused))
+ int quiet)
+{
+ WIDGET_CLASS wc;
+ int ret;
+
+ info("%s: %s", Name, "$Rev: 975 $");
+
+ /* display preferences */
+ XRES = 6; /* pixel width of one char */
+ YRES = 8; /* pixel height of one char */
+ CHARS = 8; /* number of user-defineable characters */
+ CHAR0 = 0; /* ASCII of first user-defineable char */
+ GOTO_COST = 2; /* number of bytes a goto command requires */
+
+ /* real worker functions */
+ drv_generic_text_real_write = drv_NULL_write;
+ drv_generic_text_real_defchar = drv_NULL_defchar;
+
+ /* start display */
+ if ((ret = drv_NULL_start(section)) != 0)
+ return ret;
+
+ /* initialize generic text driver */
+ if ((ret = drv_generic_text_init(section, Name)) != 0)
+ return ret;
+
+ /* initialize generic bar driver */
+ if ((ret = drv_generic_text_bar_init(1)) != 0)
+ return ret;
+
+ /* add fixed chars to the bar driver */
+ drv_generic_text_bar_add_segment(0, 0, 255, 32); /* ASCII 32 = blank */
+ drv_generic_text_bar_add_segment(255, 255, 255, '*'); /* asterisk */
+
+ /* register text widget */
+ wc = Widget_Text;
+ wc.draw = drv_generic_text_draw;
+ widget_register(&wc);
+
+ /* register bar widget */
+ wc = Widget_Bar;
+ wc.draw = drv_generic_text_bar_draw;
+ widget_register(&wc);
+
+ /* register plugins */
+ /* none at the moment... */
+
+ return 0;
+}
+
+
+/* close driver & display */
+int drv_NULL_quit(const __attribute__ ((unused))
+ int quiet)
+{
+
+ info("%s: shutting down.", Name);
+ drv_generic_text_quit();
+
+ return (0);
+}
+
+
+DRIVER drv_NULL = {
+ .name = Name,
+ .list = drv_NULL_list,
+ .init = drv_NULL_init,
+ .quit = drv_NULL_quit,
+};
diff --git a/drv_Newhaven.c b/drv_Newhaven.c
new file mode 100644
index 0000000..2b4e266
--- /dev/null
+++ b/drv_Newhaven.c
@@ -0,0 +1,526 @@
+/* $Id: drv_Newhaven.c 1157 2011-07-27 05:58:08Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/drv_Newhaven.c $
+ *
+ * Newhaven lcd4linux driver
+ *
+ * Copyright (C) 2005 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2005, 2006, 2007 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ * Copyright (C) 2011 Rusty Clarkson <rusty@sutus.com>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ * *** Newhaven NHDâ€0420D3Zâ€FLâ€GBW ***
+ * A 20x4 LCD (Liquid Crystal Display).
+ *
+ * The display supports text mode provide 4 rows of 20 characters. This display
+ * also supports many functions. The documentation for this display can be found
+ * online easily. http://www.newhavendisplay.com/ would be a good place to start.
+ * This driver was designed with the NHD-0420D3Z-FL-GBW in mind, but I'm sure
+ * similar Newhaven displays will work with little to no effort.
+ *
+ * This driver is released under the GPL.
+ */
+
+/*
+ *
+ * exported fuctions:
+ *
+ * struct DRIVER drv_Newhaven
+ *
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+
+#include "debug.h"
+#include "cfg.h"
+#include "qprintf.h"
+#include "udelay.h"
+#include "plugin.h"
+#include "widget.h"
+#include "widget_text.h"
+#include "widget_icon.h"
+#include "widget_bar.h"
+#include "drv.h"
+
+/* text mode display? */
+#include "drv_generic_text.h"
+
+/* serial port? */
+//#include "drv_generic_serial.h"
+
+/* i2c bus? */
+#ifdef WITH_I2C
+#include "drv_generic_i2c.h"
+#endif
+
+
+static char Name[] = "Newhaven";
+
+
+/* Newhaven Constants */
+
+/* Line 1 */
+#define NEWHAVEN_R1_C1 0x00
+/* Line 2 */
+#define NEWHAVEN_R2_C1 0x40
+/* Line 3 */
+#define NEWHAVEN_R3_C1 0x14
+/* Line 4 */
+#define NEWHAVEN_R4_C1 0x54
+
+#define NEWHAVEN_ROW_MAX 4
+#define NEWHAVEN_COL_MAX 20
+
+#define NEWHAVEN_COMMAND 0xFE
+
+#define NEWHAVEN_DISPLAY_ON 0x41
+#define NEWHAVEN_DISPLAY_OFF 0x42
+
+#define NEWHAVEN_BAUD_RATE_SET 0x61
+#define NEWHAVEN_BAUD_RATE_SHOW 0x71
+#define NEWHAVEN_I2C_ADDR_SET 0x62
+#define NEWHAVEN_I2C_ADDR_SHOW 0x72
+#define NEWHAVEN_I2C_ADDR_DEFAULT 0x28
+#define NEWHAVEN_DISPLAY_FIRMWARE_VER 0x70
+
+#define NEWHAVEN_CONTRAST_SET 0x52
+#define NEWHAVEN_CONTRAST_MIN 1
+#define NEWHAVEN_CONTRAST_MAX 50
+#define NEWHAVEN_CONTRAST_DEFAULT 25
+#define NEWHAVEN_BRIGHTNESS_SET 0x53
+#define NEWHAVEN_BRIGHTNESS_MIN 1
+#define NEWHAVEN_BRIGHTNESS_MAX 8
+#define NEWHAVEN_BRIGHTNESS_DEFAULT 6
+
+#define NEWHAVEN_CLEAR_SCREEN 0x51
+#define NEWHAVEN_DISPLAY_SHIFT_LEFT 0x55
+#define NEWHAVEN_DISPLAY_SHIFT_RIGHT 0x56
+
+#define NEWHAVEN_CURSOR_SET_POS 0x45
+#define NEWHAVEN_CURSOR_HOME 0x46
+#define NEWHAVEN_CURSOR_UNDERLINE_ON 0x47
+#define NEWHAVEN_CURSOR_UNDERLINE_OFF 0x48
+#define NEWHAVEN_CURSOR_LEFT_ONE 0x49
+#define NEWHAVEN_CURSOR_RIGHT_ONE 0x4A
+#define NEWHAVEN_CURSOR_BLINKING_ON 0x4B
+#define NEWHAVEN_CURSOR_BLINKING_OFF 0x4C
+#define NEWHAVEN_BACKSPACE 0x4E
+
+#define NEWHAVEN_LOAD_CUSTOM_CHAR 0x54
+
+
+/****************************************/
+/*** hardware dependant functions ***/
+/****************************************/
+
+static int drv_Newhaven_open(const char *section)
+{
+ /* open serial port */
+ /* don't mind about device, speed and stuff, this function will take care of */
+
+ //if (drv_generic_serial_open(section, Name, 0) < 0)
+ //return -1;
+
+ /* open i2c port */
+
+ if (drv_generic_i2c_open(section, Name) < 0)
+ return -1;
+
+ return 0;
+}
+
+
+static int drv_Newhaven_close(void)
+{
+ /* close whatever port you've opened */
+ //drv_generic_serial_close();
+ drv_generic_i2c_close();
+
+ return 0;
+}
+
+
+/* dummy function that sends data to the display */
+static void drv_Newhaven_sendData(const char *data, const unsigned int len)
+{
+ unsigned int i;
+
+ /* send data to the serial port is easy... */
+ //drv_generic_serial_write(data, len);
+
+ /* sending data using other methods is a bit more tricky... */
+ for (i = 0; i < len; i++) {
+ /* send data to the i2c port */
+ drv_generic_i2c_byte(data[i]);
+ }
+
+}
+
+
+/* dummy function that sends commands to the display */
+static void drv_Newhaven_sendCommand(const char command, const char *data, const unsigned int len)
+{
+
+ /* send commands to the serial port */
+ //drv_generic_serial_write(NEWHAVEN_COMMAND, 1);
+ //drv_generic_serial_write(command, 1);
+
+ /* send commands to the i2c port */
+ drv_generic_i2c_byte(NEWHAVEN_COMMAND);
+ drv_generic_i2c_byte(command);
+
+ /* send data */
+ drv_Newhaven_sendData(data, len);
+
+}
+
+
+/* text mode displays only */
+static void drv_Newhaven_clear(void)
+{
+ char cmd;
+
+ /* do whatever is necessary to clear the display */
+ cmd = NEWHAVEN_CLEAR_SCREEN;
+ drv_Newhaven_sendCommand(cmd, NULL, 0);
+}
+
+
+/* Turn display on */
+static void drv_Newhaven_display_on(void)
+{
+ char cmd;
+
+ /* do whatever is necessary to turn on the display */
+ cmd = NEWHAVEN_DISPLAY_ON;
+ drv_Newhaven_sendCommand(cmd, NULL, 0);
+}
+
+
+/* Turn display off */
+static void __attribute__ ((unused)) drv_Newhaven_display_off(void)
+{
+ char cmd;
+
+ /* do whatever is necessary to turn off the display */
+ cmd = NEWHAVEN_DISPLAY_OFF;
+ drv_Newhaven_sendCommand(cmd, NULL, 0);
+}
+
+
+/* text mode displays only */
+static void drv_Newhaven_write(const int row, const int col, const char *data, int len)
+{
+ char cmd;
+ char wData[1];
+
+ /* do the cursor positioning here */
+ cmd = NEWHAVEN_CURSOR_SET_POS;
+ if (col < 0 || col > DCOLS - 1)
+ error("%s: Invalid col, %d. Valid cols 0-%d.", Name, col, DCOLS - 1);
+ if (len > DCOLS - (col + 1))
+ error("%s: Data length, %d, longer than columns left in row, %d.", Name, len, DCOLS - (col + 1));
+ switch (row) {
+ case 0:
+ wData[0] = NEWHAVEN_R1_C1 + col;
+ break;
+ case 1:
+ wData[0] = NEWHAVEN_R2_C1 + col;
+ break;
+ case 2:
+ wData[0] = NEWHAVEN_R3_C1 + col;
+ break;
+ case 3:
+ wData[0] = NEWHAVEN_R4_C1 + col;
+ break;
+ default:
+ error("%s: Invalid row, %d. Valid rows 0-%d.", Name, row, DROWS - 1);
+ return;
+ }
+ drv_Newhaven_sendCommand(cmd, wData, 1);
+
+ /* send string to the display */
+ drv_Newhaven_sendData(data, len);
+
+}
+
+/* text mode displays only */
+static void drv_Newhaven_defchar(const int ascii, const unsigned char *matrix)
+{
+ char cmd;
+ char wData[9];
+ int i;
+
+ /* call the 'define character' function */
+ cmd = NEWHAVEN_LOAD_CUSTOM_CHAR;
+ wData[0] = ascii;
+
+ /* send bitmap to the display */
+ for (i = 0; i < 8; i++) {
+ wData[i + 1] = *matrix++;
+ }
+ drv_Newhaven_sendCommand(cmd, wData, 9);
+}
+
+
+/* Set the contrast of the display */
+static int drv_Newhaven_contrast(int contrast)
+{
+ char cmd;
+ char wData[1];
+
+ /* adjust limits according to the display */
+ if (contrast < NEWHAVEN_CONTRAST_MIN)
+ contrast = NEWHAVEN_CONTRAST_MIN;
+ if (contrast > NEWHAVEN_CONTRAST_MAX)
+ contrast = NEWHAVEN_CONTRAST_MAX;
+
+ /* call a 'contrast' function */
+ cmd = NEWHAVEN_CONTRAST_SET;
+ wData[0] = contrast;
+ drv_Newhaven_sendCommand(cmd, wData, 1);
+
+ return contrast;
+}
+
+
+/* Set the brightness of the display */
+static int drv_Newhaven_brightness(int brightness)
+{
+ char cmd;
+ char wData[1];
+
+ /* adjust limits according to the display */
+ if (brightness < NEWHAVEN_BRIGHTNESS_MIN)
+ brightness = NEWHAVEN_BRIGHTNESS_MIN;
+ if (brightness > NEWHAVEN_BRIGHTNESS_MAX)
+ brightness = NEWHAVEN_BRIGHTNESS_MAX;
+
+ /* call a 'brightness' function */
+ cmd = NEWHAVEN_BRIGHTNESS_SET;
+ wData[0] = brightness;
+ drv_Newhaven_sendCommand(cmd, wData, 1);
+
+ return brightness;
+}
+
+
+/* start text mode display */
+static int drv_Newhaven_start(const char *section)
+{
+ int contrast, brightness;
+ int rows = -1, cols = -1;
+ char *s;
+
+ s = cfg_get(section, "Size", NULL);
+ if (s == NULL || *s == '\0') {
+ error("%s: no '%s.Size' entry from %s", Name, section, cfg_source());
+ return -1;
+ }
+ if (sscanf(s, "%dx%d", &cols, &rows) != 2 || rows < 1 || cols < 1 || rows > NEWHAVEN_ROW_MAX
+ || cols > NEWHAVEN_COL_MAX) {
+ error("%s: bad %s.Size '%s' from %s", Name, section, s, cfg_source());
+ free(s);
+ return -1;
+ }
+
+ DROWS = rows;
+ DCOLS = cols;
+
+ /* open communication with the display */
+ if (drv_Newhaven_open(section) < 0) {
+ return -1;
+ }
+
+ /* reset & initialize display */
+ drv_Newhaven_display_on();
+
+ if (cfg_number
+ (section, "Contrast", NEWHAVEN_CONTRAST_DEFAULT, NEWHAVEN_CONTRAST_MIN, NEWHAVEN_CONTRAST_MAX, &contrast) > 0) {
+ drv_Newhaven_contrast(contrast);
+ }
+
+ if (cfg_number
+ (section, "Brightness", NEWHAVEN_BRIGHTNESS_DEFAULT, NEWHAVEN_BRIGHTNESS_MIN, NEWHAVEN_BRIGHTNESS_MAX,
+ &brightness) > 0) {
+ drv_Newhaven_brightness(brightness);
+ }
+
+ drv_Newhaven_clear(); /* clear display */
+ sleep(1);
+
+ return 0;
+}
+
+
+/****************************************/
+/*** plugins ***/
+/****************************************/
+
+static void plugin_contrast(RESULT * result, RESULT * arg1)
+{
+ double contrast;
+
+ contrast = drv_Newhaven_contrast(R2N(arg1));
+ SetResult(&result, R_NUMBER, &contrast);
+}
+
+static void plugin_brightness(RESULT * result, RESULT * arg1)
+{
+ double brightness;
+
+ brightness = drv_Newhaven_brightness(R2N(arg1));
+ SetResult(&result, R_NUMBER, &brightness);
+}
+
+
+/****************************************/
+/*** widget callbacks ***/
+/****************************************/
+
+
+/* using drv_generic_text_draw(W) */
+/* using drv_generic_text_icon_draw(W) */
+/* using drv_generic_text_bar_draw(W) */
+
+
+/****************************************/
+/*** exported functions ***/
+/****************************************/
+
+
+/* list models */
+int drv_Newhaven_list(void)
+{
+ printf("%s driver", Name);
+ return 0;
+}
+
+
+/* initialize driver & display */
+/* use this function for a text display */
+int drv_Newhaven_init(const char *section, const int quiet)
+{
+ WIDGET_CLASS wc;
+ int ret;
+
+ info("%s: %s", Name, "$Rev: 1157 $");
+
+ /* display preferences */
+ XRES = 5; /* pixel width of one char */
+ YRES = 8; /* pixel height of one char */
+ CHARS = 8; /* number of user-defineable characters */
+ CHAR0 = 0; /* ASCII of first user-defineable char */
+ GOTO_COST = 2; /* number of bytes a goto command requires */
+
+ /* real worker functions */
+ drv_generic_text_real_write = drv_Newhaven_write;
+ drv_generic_text_real_defchar = drv_Newhaven_defchar;
+
+
+ /* start display */
+ if ((ret = drv_Newhaven_start(section)) != 0)
+ return ret;
+
+ if (!quiet) {
+ char buffer[40];
+ qprintf(buffer, sizeof(buffer), "%s %dx%d", Name, DCOLS, DROWS);
+ if (drv_generic_text_greet(buffer, "www.bwct.de")) {
+ sleep(3);
+ drv_Newhaven_clear();
+ }
+ }
+
+ /* initialize generic text driver */
+ if ((ret = drv_generic_text_init(section, Name)) != 0)
+ return ret;
+
+ /* initialize generic icon driver */
+ if ((ret = drv_generic_text_icon_init()) != 0)
+ return ret;
+
+ /* initialize generic bar driver */
+ if ((ret = drv_generic_text_bar_init(0)) != 0)
+ return ret;
+
+ /* add fixed chars to the bar driver */
+ drv_generic_text_bar_add_segment(0, 0, 255, 32); /* ASCII 32 = blank */
+
+
+ /* register text widget */
+ wc = Widget_Text;
+ wc.draw = drv_generic_text_draw;
+ widget_register(&wc);
+
+ /* register icon widget */
+ wc = Widget_Icon;
+ wc.draw = drv_generic_text_icon_draw;
+ widget_register(&wc);
+
+ /* register bar widget */
+ wc = Widget_Bar;
+ wc.draw = drv_generic_text_bar_draw;
+ widget_register(&wc);
+
+ /* register plugins */
+ AddFunction("LCD::contrast", 1, plugin_contrast);
+ AddFunction("LCD::brightness", 1, plugin_brightness);
+
+ return 0;
+}
+
+
+
+/* close driver & display */
+/* use this function for a text display */
+int drv_Newhaven_quit(const int quiet)
+{
+ info("%s: shutting down.", Name);
+
+ drv_generic_text_quit();
+
+ /* clear display */
+ drv_Newhaven_clear();
+
+ /* say goodbye... */
+ if (!quiet) {
+ drv_generic_text_greet("goodbye!", NULL);
+ }
+
+ debug("closing connection");
+ drv_Newhaven_close();
+
+ return (0);
+}
+
+
+/* use this one for a text display */
+DRIVER drv_Newhaven = {
+ .name = Name,
+ .list = drv_Newhaven_list,
+ .init = drv_Newhaven_init,
+ .quit = drv_Newhaven_quit,
+};
diff --git a/drv_Noritake.c b/drv_Noritake.c
new file mode 100644
index 0000000..011ff35
--- /dev/null
+++ b/drv_Noritake.c
@@ -0,0 +1,389 @@
+/* $Id: drv_Noritake.c 771 2007-02-25 12:27:26Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/drv_Noritake.c $
+ *
+ * Driver for a Noritake GU128x32-311 graphical display.
+ *
+ * Copyright (C) 2005 Julien Aube <ob@obconseil.net>
+ * Copyright (C) 2005 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ * *** Noritake Itron GU128x32-311 ***
+ * A 128x32 VFD (Vacuum Fluorescent Display).
+ * It is driver by a Hitachi microcontroller, with a specific
+ * firmware.
+ * The datasheet can be easily found on the internet by searching for the
+ * the name of the display, it's a PDF file that describe the timing, and
+ * the protocol to communicate with the Hitachi microcontroller.
+ *
+ * The display support 2 modes (that can be mutiplexed), one text mode
+ * thanks to an integrated character generator, and provide 4 lines of
+ * 21 caracters.
+ * There is also a graphical mode that can be used to switch on or off
+ * each one if the 128x32 pixels. (monochrome).
+ *
+ * The protocol include the possibility to clear the display memory quickly,
+ * change the luminosity, swich the display on or off (without affecting the
+ * content of the memory) and finally change the "page" or the caracter
+ * generator. Two pages are available in the ROM, all the characters are
+ * listed in the documentation.
+ *
+ * This driver support only the character mode at the moment.
+ * A future release will support the graphical mode as an option.
+ *
+ * This driver is released under the GPL.
+ */
+
+/*
+ *
+ * exported fuctions:
+ *
+ * struct DRIVER drv_Noritake
+ *
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+
+#include "debug.h"
+#include "cfg.h"
+#include "qprintf.h"
+#include "plugin.h"
+#include "widget.h"
+#include "widget_text.h"
+#include "widget_icon.h"
+#include "widget_bar.h"
+#include "drv.h"
+#include "udelay.h"
+#include "drv_generic_text.h"
+#include "drv_generic_parport.h"
+
+
+static char Name[] = "Noritake";
+
+typedef struct {
+ int type;
+ char *name;
+ int rows;
+ int cols;
+ int xres;
+ int yrex;
+ int goto_cost;
+ int protocol;
+} MODEL;
+
+static int Model, Protocol;
+static MODEL Models[] = {
+ {0x01, "GU311", 4, 21, 6, 8, 5, 1},
+ {0x02, "GU311_Graphic", 4, 21, 6, 8, 6, 1},
+ {0xff, "Unknown", -1, -1, -1, -1, -1, -1}
+};
+
+static unsigned char SIGNAL_CS; /* Chip select, OUTPUT, negative logic, pport AUTOFEED */
+static unsigned char SIGNAL_WR; /* Write OUTPUT, negative logic, pport STOBE */
+static unsigned char SIGNAL_RESET; /* Reset, OUTPUT, negative logic, pport INIT */
+static unsigned char SIGNAL_BLANK; /* Blank, OUTPUT , negative logic, pport SELECT-IN */
+
+#if 0
+static unsigned char SIGNAL_BUSY; /* Busy, INPUT , positive logic, pport BUSY, not used */
+static unsigned char SIGNAL_FRP; /* Frame Pulse, INPUT , positive logic, pport ACK, not used */
+#endif
+
+void (*drv_Noritake_clear) (void);
+
+/* Data port is positive logic */
+
+
+/****************************************/
+/*** hardware dependant functions ***/
+/****************************************/
+
+/* Low-level parport driving functions */
+
+/* This function was used to pool the BUSY line on the parallel port, which
+can be linked to the BUSY line on the display. But since it works
+with a timed wait, this function is not necessary, and is kept just in case.*/
+#if 0
+static void drv_GU311_wait_busy(void)
+{
+ char c;
+
+ c = drv_generic_parport_status();
+ while ((c & SIGNAL_BUSY) == 0) {
+ ndelay(200); /* Wait 100ns before next consultation of BUSY line
+ if the first one was not successful */
+ c = drv_generic_parport_status();
+ }
+}
+#endif
+
+
+static void drv_GU311_send_char(char c)
+{
+#if 0
+ /* Disabled because all the cables does not have the busy line linked. */
+ drv_GU311_wait_busy(); /* ensuite the display is ready to take the command */
+#endif
+ drv_generic_parport_data(c);
+ ndelay(30); /* delay to ensure data line stabilisation on long cables */
+ drv_generic_parport_control(SIGNAL_WR, 0); /* write line to enable */
+ ndelay(150); /* data hold time */
+ drv_generic_parport_control(SIGNAL_WR, 0xff); /* write line to disable */
+ ndelay(75); /* From spec : minimum time before next command */
+}
+
+static void drv_GU311_send_string(char *str, int size)
+{
+ int i;
+ for (i = 0; i < size; i++)
+ drv_GU311_send_char(str[i]);
+
+}
+
+/* Command-string elaboration functions */
+static void drv_GU311_make_text_string(const int row, const int col, const char *data, int len)
+{
+ static char cmd[96] = { 0x01, 'C', 0, 0, 'S', 0 };
+ unsigned char start_addr;
+
+ /* Cols are 0x00..0x15, on 4 lines. */
+ start_addr = (0x16 * row) + col;
+ if (start_addr > 0x57)
+ return;
+ if (len > 0x57)
+ return;
+
+ cmd[2] = start_addr;
+ cmd[3] = len;
+
+ memcpy(cmd + 5, data, len);
+
+ drv_GU311_send_string(cmd, len + 5);
+
+}
+
+/* API functions */
+
+static void drv_GU311_clear(void)
+{
+ static char clear_cmd[] = { 0x01, 'O', 'P' };
+ drv_GU311_send_string(clear_cmd, sizeof(clear_cmd));
+ ndelay(500); /* Delay for execution - this command is the longuest */
+}
+
+
+static void drv_GU311_write(const int row, const int col, const char *data, int len)
+{
+ drv_GU311_make_text_string(row, col, data, len);
+}
+
+
+static void drv_GU311_reset(void)
+{
+ drv_generic_parport_control(SIGNAL_RESET, 0); /* initiate reset */
+ ndelay(1000); /* reset hold time 1ms */
+ drv_generic_parport_control(SIGNAL_RESET, 0xff);
+ ndelay(200000); /* reset ready time 200ms */
+
+}
+
+
+static int drv_GU311_start(const char *section)
+{
+ char cmd[3] = { 0x01, 'O' };
+
+ /* Parallel port opening and association */
+ if (drv_generic_parport_open(section, Name) < 0)
+ return -1;
+ if ((SIGNAL_CS = drv_generic_parport_wire_ctrl("CS", "AUTOFD")) == 0xff)
+ return -1;
+ if ((SIGNAL_WR = drv_generic_parport_wire_ctrl("WR", "STROBE")) == 0xff)
+ return -1;
+ if ((SIGNAL_RESET = drv_generic_parport_wire_ctrl("RESET", "INIT")) == 0xff)
+ return -1;
+ if ((SIGNAL_BLANK = drv_generic_parport_wire_ctrl("BLANK", "SLCTIN")) == 0xff)
+ return -1;
+ /* SIGNAL_BUSY=PARPORT_STATUS_BUSY; *//* Not currently needed */
+ /* SIGNAL_FRP=PARPORT_STATUS_ACK; *//* Not currently needed */
+
+ /* Signals configuration */
+ drv_generic_parport_direction(0); /* parallel port in output mode */
+ drv_generic_parport_control(SIGNAL_CS | SIGNAL_WR | SIGNAL_RESET | SIGNAL_BLANK, 0xff);
+ /* All lines to "deactivate", -> 1 level on the wire */
+ drv_generic_parport_control(SIGNAL_CS, 0); /* CS to 0 all the time, write done by WR */
+ drv_GU311_reset();
+
+ /* Ready for commands from now on. */
+
+ /* Display configuration */
+ cmd[2] = '0';
+ drv_GU311_send_string(cmd, sizeof(cmd)); /* Select char. page 0 */
+ cmd[2] = 'Q';
+ drv_GU311_send_string(cmd, sizeof(cmd)); /* Select 'Quick Mode' */
+ cmd[2] = 'a';
+ drv_GU311_send_string(cmd, sizeof(cmd)); /* Brightness at 100% */
+ cmd[2] = 'T';
+ drv_GU311_send_string(cmd, sizeof(cmd)); /* Ensure display ON */
+
+ drv_Noritake_clear();
+ return 0;
+}
+
+
+
+static int drv_Noritake_start(const char *section)
+{
+ char *model = 0;
+ int i;
+ model = cfg_get(section, "Model", NULL);
+ if (model != NULL && *model != '\0') {
+ for (i = 0; Models[i].type != 0xff; i++) {
+ if (strcasecmp(Models[i].name, model) == 0)
+ break;
+ }
+ if (Models[i].type == 0xff) {
+ error("%s: %s.Model '%s' is unknown from %s", Name, section, model, cfg_source());
+ return -1;
+ }
+ Model = i;
+ info("%s: using model '%s'", Name, Models[Model].name);
+ } else {
+ error("%s: no '%s.Model' entry from %s", Name, section, cfg_source());
+ return -1;
+ }
+
+ DROWS = Models[Model].rows;
+ DCOLS = Models[Model].cols;
+ XRES = Models[Model].xres;
+ YRES = Models[Model].xres;
+ GOTO_COST = Models[Model].goto_cost;
+ Protocol = Models[Model].protocol;
+ /* display preferences */
+ CHARS = 0; /* number of user-defineable characters */
+ CHAR0 = 0; /* ASCII of first user-defineable char */
+
+
+
+ /* real worker functions */
+ drv_Noritake_clear = drv_GU311_clear;
+ if (Models[Model].type == 0x01) {
+ drv_generic_text_real_write = drv_GU311_write;
+ } else {
+ error("%s: Unsupported display. Currently supported are : GU311.", Name);
+ return -1;
+ }
+ return drv_GU311_start(section);
+}
+
+
+/****************************************/
+/*** plugins ***/
+/****************************************/
+
+/* none */
+
+
+/****************************************/
+/*** widget callbacks ***/
+/****************************************/
+
+
+/* using drv_generic_text_draw(W) */
+
+
+/****************************************/
+/*** exported functions ***/
+/****************************************/
+
+
+/* list models */
+int drv_Noritake_list(void)
+{
+ printf("GU311 GU311_Graphic");
+ return 0;
+}
+
+
+/* initialize driver & display */
+int drv_Noritake_init(const char *section, const int quiet)
+{
+ WIDGET_CLASS wc;
+ int ret;
+
+ info("%s: %s", Name, "$Rev: 771 $");
+
+ /* start display */
+ if ((ret = drv_Noritake_start(section)) != 0)
+ return ret;
+
+ /* initialize generic text driver */
+ if ((ret = drv_generic_text_init(section, Name)) != 0)
+ return ret;
+
+ /* register text widget */
+ wc = Widget_Text;
+ wc.draw = drv_generic_text_draw;
+ widget_register(&wc);
+
+ /* register plugins */
+ /* none */
+
+ if (!quiet) {
+ char buffer[40];
+ qprintf(buffer, sizeof(buffer), "%s %dx%d", Name, DCOLS, DROWS);
+ if (drv_generic_text_greet(buffer, NULL)) {
+ sleep(3);
+ drv_Noritake_clear();
+ }
+ }
+
+ return 0;
+}
+
+
+/* close driver & display */
+int drv_Noritake_quit(const int quiet)
+{
+
+ info("%s: shutting down.", Name);
+
+ /* clear display */
+ drv_Noritake_clear();
+
+ /* say goodbye... */
+ if (!quiet) {
+ drv_generic_text_greet("goodbye!", NULL);
+ }
+
+ drv_generic_parport_close();
+ drv_generic_text_quit();
+ return (0);
+}
+
+
+DRIVER drv_Noritake = {
+ .name = Name,
+ .list = drv_Noritake_list,
+ .init = drv_Noritake_init,
+ .quit = drv_Noritake_quit,
+};
diff --git a/drv_PHAnderson.c b/drv_PHAnderson.c
new file mode 100644
index 0000000..4cf618b
--- /dev/null
+++ b/drv_PHAnderson.c
@@ -0,0 +1,416 @@
+/* $Id: drv_PHAnderson.c 840 2008-11-19 23:56:42 guimli $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/drv_PHAnderson.c $
+ *
+ * driver for the PHAnderson serial-to-HD44780 adapter boards
+ * http://www.phanderson.com/lcd106/lcd107.html
+ * http://moderndevice.com/Docs/LCD117CommandSummary.doc
+ * http://wulfden.org/TheShoppe/k107/index.shtml
+ *
+ * Copyright (C) 2008 Nicolas Weill <guimli@free.fr>
+ * Copyright (C) 2005 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ *
+ * exported fuctions:
+ *
+ * struct DRIVER drv_PHAnderson
+ *
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+
+#include "debug.h"
+#include "cfg.h"
+#include "qprintf.h"
+#include "udelay.h"
+#include "plugin.h"
+#include "widget.h"
+#include "widget_text.h"
+#include "widget_icon.h"
+#include "widget_bar.h"
+#include "drv.h"
+#include "drv_generic_text.h"
+#include "drv_generic_serial.h"
+
+#define PHAnderson_CMD '?'
+
+static char Name[] = "PHAnderson";
+
+static int T_READ, T_WRITE, T_BOOT;
+
+
+/****************************************/
+/*** hardware dependant functions ***/
+/****************************************/
+
+static int drv_PHAnderson_open(const char *section)
+{
+ if (drv_generic_serial_open(section, Name, 0) < 0)
+ return -1;
+
+ return 0;
+}
+
+
+static int drv_PHAnderson_close(void)
+{
+ drv_generic_serial_close();
+
+ return 0;
+}
+
+
+static void drv_PHAnderson_send(const char *data, const unsigned int len)
+{
+ char buffer[255];
+ unsigned int i, j;
+
+ j = 0;
+ for (i = 0; i < len; i++) {
+ if (data[i] < 8) {
+ buffer[j++] = '?';
+ buffer[j++] = '0' + data[i];
+ drv_generic_serial_write(buffer, j);
+ udelay(T_READ);
+
+ j = 0;
+ } else {
+ buffer[j++] = data[i];
+ }
+ }
+
+ if (j > 0) {
+ drv_generic_serial_write(buffer, j);
+ }
+}
+
+
+static void drv_PHAnderson_clear(void)
+{
+ char cmd[2];
+
+ cmd[0] = '?';
+ cmd[1] = 'f';
+ drv_PHAnderson_send(cmd, 2);
+}
+
+
+static void drv_PHAnderson_write(const int row, const int col, const char *data, int len)
+{
+ char cmd[7];
+
+ cmd[0] = '?';
+ cmd[1] = 'y';
+ cmd[2] = row + '0';
+ cmd[3] = '?';
+ cmd[4] = 'x';
+ cmd[5] = col / 10 + '0';
+ cmd[6] = col % 10 + '0';
+ drv_PHAnderson_send(cmd, 7);
+
+ drv_PHAnderson_send(data, len);
+}
+
+
+static void drv_PHAnderson_defchar(const int ascii, const unsigned char *matrix)
+{
+ char cmd[19];
+ int i;
+
+ cmd[0] = '?';
+ cmd[1] = 'D';
+ cmd[2] = ascii + '0';
+
+ for (i = 0; i < 8; i++) {
+ cmd[i * 2 + 3] = ((matrix[i] >> 4) & 1) + '0';
+ cmd[i * 2 + 4] = (((matrix[i] & 0x0F) < 10) ? (matrix[i] & 0x0F) + '0' : (matrix[i] & 0x0F) + '7');
+ }
+ drv_PHAnderson_send(cmd, 19);
+ udelay(T_WRITE);
+}
+
+
+static int drv_PHAnderson_blacklight(int blacklight)
+{
+ char cmd[4];
+
+ if (blacklight < 0)
+ blacklight = 0;
+ if (blacklight > 255)
+ blacklight = 255;
+
+ cmd[0] = '?';
+ cmd[1] = 'B';
+ cmd[2] = (((blacklight >> 4) < 10) ? (blacklight >> 4) + '0' : (blacklight >> 4) + '7');
+ cmd[3] = (((blacklight & 0x0F) < 10) ? (blacklight & 0x0F) + '0' : (blacklight & 0x0F) + '7');
+ drv_PHAnderson_send(cmd, 4);
+ udelay(T_WRITE);
+
+ return blacklight;
+}
+
+static int drv_PHAnderson_bootscreen(const char *bootmsg)
+{
+ char cmd[255];
+ int i, j, k;
+
+ i = 0;
+ j = 0;
+ k = 0;
+
+ if (bootmsg == NULL || *bootmsg == '\0') {
+ cmd[0] = '?';
+ cmd[1] = 'S';
+ cmd[2] = '0';
+ drv_PHAnderson_send(cmd, 3);
+ udelay(T_WRITE);
+ } else {
+ cmd[0] = '?';
+ cmd[1] = 'S';
+ cmd[2] = '2';
+ drv_PHAnderson_send(cmd, 3);
+ udelay(T_WRITE);
+ cmd[0] = '?';
+ cmd[1] = 'C';
+ for (i = 0; i < DROWS; i++) {
+ cmd[2] = '0' + i;
+ for (k = 0; k < DCOLS; k++) {
+ if (bootmsg[j] != '\0') {
+ cmd[3 + k] = bootmsg[j];
+ j++;
+ } else {
+ cmd[3 + k] = ' ';
+ }
+ }
+ drv_PHAnderson_send(cmd, k + 3);
+ udelay(T_BOOT);
+ }
+ }
+
+ return j;
+}
+
+static int drv_PHAnderson_start(const char *section)
+{
+ int blacklight;
+ int rows = -1, cols = -1;
+ char *s;
+ char cmd[255];
+
+ s = cfg_get(section, "Size", NULL);
+ if (s == NULL || *s == '\0') {
+ error("%s: no '%s.Size' entry from %s", Name, section, cfg_source());
+ return -1;
+ }
+ if (sscanf(s, "%dx%d", &cols, &rows) != 2 || rows < 1 || cols < 1) {
+ error("%s: bad %s.Size '%s' from %s", Name, section, s, cfg_source());
+ free(s);
+ return -1;
+ }
+
+ DROWS = rows;
+ DCOLS = cols;
+
+ /* PHAnderson execution timings [milliseconds]
+ * we use the worst-case default values, but allow
+ * modification from the config file.
+ */
+
+ T_WRITE = timing(Name, section, "WRITE", 170, "ms") * 1000; /* write eeprom time */
+ T_READ = timing(Name, section, "READ", 10, "ms") * 1000; /* read eeprom time */
+ T_BOOT = timing(Name, section, "BOOT", 300, "ms") * 1000; /* boot screen write eeprom time */
+
+ if (drv_PHAnderson_open(section) < 0) {
+ return -1;
+ }
+
+ /* Define screen size */
+ cmd[0] = '?';
+ cmd[1] = 'G';
+ cmd[2] = rows + '0';
+ cmd[3] = (cols / 10) + '0';
+ cmd[4] = (cols % 10) + '0';
+ drv_PHAnderson_send(cmd, 5);
+ udelay(T_WRITE);
+
+ /* Hide cursor */
+ cmd[0] = '?';
+ cmd[1] = 'c';
+ cmd[2] = '0';
+ drv_PHAnderson_send(cmd, 3);
+ udelay(T_WRITE);
+
+ if (cfg_number(section, "Blacklight", 0, 0, 255, &blacklight) > 0) {
+ drv_PHAnderson_blacklight(blacklight);
+ }
+
+ s = cfg_get(section, "Bootscreen", NULL);
+ printf("%s", s);
+ drv_PHAnderson_bootscreen(s);
+
+ drv_PHAnderson_clear(); /* clear display */
+
+ return 0;
+}
+
+/****************************************/
+/*** plugins ***/
+/****************************************/
+
+static void plugin_blacklight(RESULT * result, RESULT * arg1)
+{
+ double blacklight;
+
+ blacklight = drv_PHAnderson_blacklight(R2N(arg1));
+ SetResult(&result, R_NUMBER, &blacklight);
+}
+
+static void plugin_bootscreen(RESULT * result, RESULT * arg1)
+{
+ double bootmsg;
+
+ bootmsg = drv_PHAnderson_bootscreen(R2S(arg1));
+ SetResult(&result, R_NUMBER, &bootmsg);
+}
+
+/****************************************/
+/*** widget callbacks ***/
+/****************************************/
+
+
+/* using drv_generic_text_draw(W) */
+/* using drv_generic_text_icon_draw(W) */
+/* using drv_generic_text_bar_draw(W) */
+
+
+/****************************************/
+/*** exported functions ***/
+/****************************************/
+
+
+/* list models */
+int drv_PHAnderson_list(void)
+{
+ printf("PHAnderson serial-to-HD44780 adapter");
+ return 0;
+}
+
+int drv_PHAnderson_init(const char *section, const int quiet)
+{
+ WIDGET_CLASS wc;
+ int ret;
+
+ info("%s: %s", Name, "$Rev: 840 $");
+
+ /* display preferences */
+ XRES = 5; /* pixel width of one char */
+ YRES = 8; /* pixel height of one char */
+ CHARS = 8; /* number of user-defineable characters */
+ CHAR0 = 0; /* ASCII of first user-defineable char */
+ GOTO_COST = 7; /* number of bytes a goto command requires */
+
+ /* real worker functions */
+ drv_generic_text_real_write = drv_PHAnderson_write;
+ drv_generic_text_real_defchar = drv_PHAnderson_defchar;
+
+ /* start display */
+ if ((ret = drv_PHAnderson_start(section)) != 0)
+ return ret;
+
+ if (!quiet) {
+ char buffer[40];
+ qprintf(buffer, sizeof(buffer), "%s %dx%d", Name, DCOLS, DROWS);
+ if (drv_generic_text_greet(buffer, "www.bwct.de")) {
+ sleep(3);
+ drv_PHAnderson_clear();
+ }
+ }
+
+ /* initialize generic text driver */
+ if ((ret = drv_generic_text_init(section, Name)) != 0)
+ return ret;
+
+ /* initialize generic icon driver */
+ if ((ret = drv_generic_text_icon_init()) != 0)
+ return ret;
+
+ /* initialize generic bar driver */
+ if ((ret = drv_generic_text_bar_init(0)) != 0)
+ return ret;
+
+ /* add fixed chars to the bar driver */
+ drv_generic_text_bar_add_segment(0, 0, 0, 32); /* ASCII 32 = blank */
+
+ /* register text widget */
+ wc = Widget_Text;
+ wc.draw = drv_generic_text_draw;
+ widget_register(&wc);
+
+ /* register icon widget */
+ wc = Widget_Icon;
+ wc.draw = drv_generic_text_icon_draw;
+ widget_register(&wc);
+
+ /* register bar widget */
+ wc = Widget_Bar;
+ wc.draw = drv_generic_text_bar_draw;
+ widget_register(&wc);
+
+ /* register plugins */
+ AddFunction("LCD::blacklight", 1, plugin_blacklight);
+
+ AddFunction("LCD::bootscreen", 1, plugin_bootscreen);
+
+ return 0;
+}
+
+
+int drv_PHAnderson_quit(const int quiet)
+{
+
+ info("%s: shutting down.", Name);
+
+ drv_generic_text_quit();
+
+ drv_PHAnderson_clear();
+
+ /* say goodbye... */
+ if (!quiet) {
+ drv_generic_text_greet("goodbye!", NULL);
+ }
+
+ debug("closing connection");
+ drv_PHAnderson_close();
+
+ return (0);
+}
+
+
+DRIVER drv_PHAnderson = {
+ .name = Name,
+ .list = drv_PHAnderson_list,
+ .init = drv_PHAnderson_init,
+ .quit = drv_PHAnderson_quit,
+};
diff --git a/drv_PICGraphic.c b/drv_PICGraphic.c
new file mode 100644
index 0000000..7105eaf
--- /dev/null
+++ b/drv_PICGraphic.c
@@ -0,0 +1,478 @@
+/* $Id: drv_PICGraphic.c 1199 2013-05-23 03:07:28Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/drv_PICGraphic.c $
+ *
+ * PICGraphic lcd4linux driver
+ *
+ * Copyright (C) 2009 Peter Bailey <peter.eldridge.bailey@gmail.com>
+ * Copyright (C) 2005 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2005, 2006, 2007 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ *
+ * exported fuctions:
+ *
+ * struct DRIVER drv_PICGraphic
+ *
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <string.h>
+#include <strings.h>
+#include <errno.h>
+
+#include "debug.h"
+#include "cfg.h"
+#include "qprintf.h"
+#include "udelay.h"
+#include "plugin.h"
+#include "widget.h"
+#include "widget_text.h"
+#include "widget_icon.h"
+#include "widget_bar.h"
+#include "drv.h"
+#include "timer.h"
+
+#include "drv_generic_graphic.h"
+#include "drv_generic_gpio.h"
+#include "drv_generic_serial.h"
+
+#define min(a,b) (a < b ? a : b)
+
+static char Name[] = "PICGraphic";
+
+//#define partialFrame
+
+/* example config:
+
+Display PICGraphic {
+ Driver 'PICGraphic'
+ Port '/dev/ttyS1'
+ Contrast 8
+# these could be automatic
+ Size '48x128'
+ Speed 115200
+ Font '6x8'
+}
+
+*/
+
+/*
+typedef struct {
+ char *name;
+ int columns;
+ int rows;
+ int max_contrast;
+ int default_contrast;
+ int gpo;
+ int protocol;
+} MODEL;
+*/
+
+static char *fbPG = 0, delayDone = 0;
+
+void drv_PICGraphic_delay(void *arg)
+{
+ (void) arg;
+ delayDone = 1;
+ debug("delay done");
+}
+
+
+/****************************************/
+/*** hardware-dependent functions ***/
+/****************************************/
+static int drv_PICGraphic_open(const char *section)
+{
+ /* open serial port */
+ if (drv_generic_serial_open(section, Name, 0) < 0)
+ return -1;
+
+ return 0;
+}
+
+
+static int drv_PICGraphic_close(void)
+{
+ /* close opened serial port */
+ return drv_generic_serial_close();
+}
+
+static void convert2ASCII(char input, char *output)
+{
+ unsigned char temp = input >> 4;
+ if (temp < 10)
+ output[0] = temp + '0';
+ else
+ output[0] = temp - 10 + 'a';
+ input &= 0xf;
+ if (input < 10)
+ output[1] = input + '0';
+ else
+ output[1] = input - 10 + 'a';
+}
+
+static void drv_PICGraphic_send(const char *data, const unsigned int len)
+{
+ unsigned int i;
+ char hexDigits[3];
+ hexDigits[2] = 0;
+ drv_generic_serial_write(data, len);
+ info("sending %d bytes: ", len);
+ for (i = 0; i < min(10, len); i++) { // min(10, len)
+ convert2ASCII(data[i], hexDigits);
+ debug("0x%s (%c)", hexDigits, data[i]);
+ }
+}
+
+static int drv_PICGraphic_recv(char *dest, const unsigned int len, const char *expect)
+{
+ unsigned int bytes = 0;
+ int status;
+ while (bytes < len) {
+ status = drv_generic_serial_read((char *) dest + bytes, 1);
+ if (status == 1) {
+ if (dest[bytes] != 0xa && dest[bytes] != 0xd) {
+ if (dest[bytes] != '@') {
+ bytes += status;
+ }
+ }
+ } else {
+ info("error receiving response: %d", status);
+ return status;
+ }
+ usleep(10000);
+ }
+ status = strncmp((const char *) dest, expect, len);
+ if (!status) {
+ return 0;
+ } else {
+ return 1;
+ }
+
+}
+
+static void drv_PICGraphic_blit(const int row, const int col, const int height, const int width)
+{
+ /* update a rectangular portion of the display */
+ int r, c, index, status;
+ unsigned char cmd[5];
+
+ debug("blit from (%d,%d) to (%d,%d) out of (%d,%d)", row, col, row + height, col + width, DROWS, DCOLS);
+ if (!fbPG)
+ return;
+ for (c = min(col, DCOLS - 1); c < min(col + width, DCOLS); c++) {
+ for (r = min(row, DROWS - 1); r < min(row + height, DROWS); r++) {
+ index = DCOLS * (r / 8) + c;
+ if (index < 0 || index >= DCOLS * DROWS / 8) {
+ error("index too large: %d, r: %d, c: %d", index, r, c);
+ break;
+ }
+ if (drv_generic_graphic_black(r, c)) {
+ fbPG[index] |= (1 << (r % 8));
+ } else {
+ fbPG[index] &= ~(1 << (r % 8));
+ }
+ }
+ }
+
+ // send rectangular portion with height divisible by 8
+#ifdef partialFrame
+ if (delayDone) {
+ delayDone = 0;
+ int row8, height8;
+ row8 = 8 * (row / 8);
+ height8 = 8 * (height / 8) + ! !(height % 8);
+ info("sending blit");
+ cmd[0] = 'b';
+ cmd[1] = row8;
+ cmd[2] = col;
+ cmd[3] = height8;
+ cmd[4] = width;
+ drv_PICGraphic_send(cmd, 5);
+ for (r = min(row8, DROWS - 1); r < min(row8 + height8, DROWS); r += 8) {
+ drv_PICGraphic_send(fbPG + DCOLS * (r / 8) + col, width);
+ }
+ }
+#else
+ // send full frame
+ if (delayDone) {
+ delayDone = 0;
+ info("sending frame");
+ cmd[0] = 'f';
+ drv_PICGraphic_send((char *) cmd, 1);
+ drv_PICGraphic_send(fbPG, DROWS * DCOLS / 8);
+ usleep(20000);
+ // wait for reception of confirmation code
+ status = drv_PICGraphic_recv((char *) cmd, 2, "ff");
+ if (!status) {
+ info("received ff from device");
+ } else {
+ info("did not receive ff from device");
+ }
+
+ }
+#endif
+}
+
+static int drv_PICGraphic_GPO(const int num, const int val)
+{
+ char __attribute__ ((unused)) cmd[3];
+
+ cmd[0] = 'g';
+ cmd[1] = val ? 's' : 'c';
+ cmd[2] = num;
+
+ // todo: fixme
+ // drv_PICGraphic_send(cmd, 3);
+
+ return 0;
+}
+
+static int drv_PICGraphic_GPI(const int num)
+{
+ char __attribute__ ((unused)) cmd[3];
+ int ret = 0;
+
+ cmd[0] = 'g';
+ cmd[1] = 'r';
+ cmd[2] = num;
+
+ // todo: fixme
+ // drv_PICGraphic_send(cmd, 3);
+ // ret = drv_generic_serial_read(cmd, 1);
+
+ if (ret)
+ return -1;
+ else
+ return cmd[0];
+}
+
+/* example function used in a plugin */
+static int drv_PICGraphic_contrast(int contrast)
+{
+ char __attribute__ ((unused)) cmd[2];
+
+ /* adjust limits according to the display */
+ if (contrast < 0)
+ contrast = 0;
+ if (contrast > 15)
+ contrast = 15;
+
+ /* call a 'contrast' function */
+ cmd[0] = 'c';
+ cmd[1] = contrast;
+ // todo: fixme
+ // drv_PICGraphic_send(cmd, 2);
+
+ return contrast;
+}
+
+/* start graphic display */
+static int drv_PICGraphic_start2(const char *section)
+{
+ char *s;
+ char cmd[2];
+ int contrast, status, tick, tack;
+
+ /* read display size from config */
+ s = cfg_get(section, "Size", NULL);
+ if (s == NULL || *s == '\0') {
+ error("%s: no '%s.Size' entry from %s", Name, section, cfg_source());
+ return -1;
+ }
+
+ DROWS = -1;
+ DCOLS = -1;
+ if (sscanf(s, "%dx%d", &DCOLS, &DROWS) != 2 || DCOLS < 1 || DROWS < 1) {
+ error("%s: bad Size '%s' from %s", Name, s, cfg_source());
+ return -1;
+ }
+
+ s = cfg_get(section, "Font", "6x8");
+ if (s == NULL || *s == '\0') {
+ error("%s: no '%s.Font' entry from %s", Name, section, cfg_source());
+ return -1;
+ }
+
+ XRES = -1;
+ YRES = -1;
+ if (sscanf(s, "%dx%d", &XRES, &YRES) != 2 || XRES < 1 || YRES < 1) {
+ error("%s: bad Font '%s' from %s", Name, s, cfg_source());
+ return -1;
+ }
+
+ if (XRES != 6 && YRES != 8) {
+ error("%s: bad Font '%s' from %s (only 6x8 at the moment)", Name, s, cfg_source());
+ return -1;
+ }
+
+ /* you surely want to allocate a framebuffer or something... */
+ fbPG = calloc(DCOLS * DROWS / 8, 1);
+ if (!fbPG) {
+ error("failed to allocate framebuffer");
+ return -1;
+ }
+
+ info("allocated framebuffer with size %d", DCOLS * DROWS / 8);
+ if (cfg_number("Variables", "tick", 500, 100, 0, &tick) > 0 &&
+ cfg_number("Variables", "tack", 500, 100, 0, &tack) > 0) {
+ info("tick & tack read from config");
+ timer_add(drv_PICGraphic_delay, 0, min(tick, tack), 0); //
+ } else {
+ info("tick & tack not read from config");
+ timer_add(drv_PICGraphic_delay, 0, 80, 0); //
+ }
+
+ /* open communication with the display */
+ if (drv_PICGraphic_open(section) < 0) {
+ return -1;
+ }
+
+ /* reset & initialize display */
+ cmd[0] = 'i';
+ drv_PICGraphic_send(cmd, 1);
+ usleep(10000);
+ // wait for reception of confirmation code
+ status = drv_PICGraphic_recv(cmd, 2, "fi");
+
+ if (!status) {
+ info("received fi from device");
+ } else {
+ info("did not receive fi from device");
+ }
+
+ if (cfg_number(section, "Contrast", 8, 0, 15, &contrast) > 0) {
+ drv_PICGraphic_contrast(contrast);
+ }
+
+ return 0;
+}
+
+
+/****************************************/
+/*** plugins ***/
+/****************************************/
+
+static void plugin_contrast(RESULT * result, RESULT * arg1)
+{
+ double contrast;
+
+ contrast = drv_PICGraphic_contrast(R2N(arg1));
+ SetResult(&result, R_NUMBER, &contrast);
+}
+
+
+/****************************************/
+/*** widget callbacks ***/
+/****************************************/
+
+
+/* using drv_generic_text_draw(W) */
+/* using drv_generic_text_icon_draw(W) */
+/* using drv_generic_text_bar_draw(W) */
+/* using drv_generic_gpio_draw(W) */
+
+
+/****************************************/
+/*** exported functions ***/
+/****************************************/
+
+
+/* list models */
+int drv_PICGraphic_list(void)
+{
+ printf("PICGraphic serial-to-graphic by Peter Bailey");
+ return 0;
+}
+
+/* initialize driver & display */
+int drv_PICGraphic_init2(const char *section, const int quiet)
+{
+ int ret;
+
+ /* real worker functions */
+ drv_generic_graphic_real_blit = drv_PICGraphic_blit;
+ drv_generic_gpio_real_set = drv_PICGraphic_GPO;
+ drv_generic_gpio_real_get = drv_PICGraphic_GPI;
+
+ /* start display */
+ if ((ret = drv_PICGraphic_start2(section)) != 0)
+ return ret;
+
+ /* initialize generic graphic driver */
+ if ((ret = drv_generic_graphic_init(section, Name)) != 0)
+ return ret;
+
+ if (!quiet) {
+ char buffer[40];
+ qprintf(buffer, sizeof(buffer), "%s %dx%d", Name, DCOLS, DROWS);
+ if (drv_generic_graphic_greet(buffer, NULL)) {
+ sleep(3);
+ drv_generic_graphic_clear(); // also clears main framebuffer
+ }
+ }
+
+ /* register plugins */
+ AddFunction("LCD::contrast", 1, plugin_contrast);
+
+ return 0;
+}
+
+/* close driver & display */
+/* use this function for a graphic display */
+int drv_PICGraphic_quit2(const int quiet)
+{
+
+ info("%s: shutting down.", Name);
+
+ /* clear display */
+ drv_generic_graphic_clear();
+
+ drv_generic_gpio_quit();
+
+
+ /* say goodbye... */
+ if (!quiet) {
+ drv_generic_graphic_greet("goodbye!", NULL);
+ }
+
+ info("freeing framebuffer");
+ free(fbPG);
+
+ drv_generic_graphic_quit();
+
+ debug("closing connection");
+ drv_PICGraphic_close();
+
+ return (0);
+}
+
+/* use this one for a graphic display */
+DRIVER drv_PICGraphic = {
+ .name = Name,
+ .list = drv_PICGraphic_list,
+ .init = drv_PICGraphic_init2,
+ .quit = drv_PICGraphic_quit2,
+};
diff --git a/drv_Pertelian.c b/drv_Pertelian.c
new file mode 100644
index 0000000..69b6580
--- /dev/null
+++ b/drv_Pertelian.c
@@ -0,0 +1,331 @@
+/* $Id: drv_Pertelian.c 975 2009-01-18 11:16:20Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/drv_Pertelian.c $
+ *
+ * Pertelian lcd4linux driver
+ * Copyright (C) 2007 Andy Powell <lcd4linux@automted.it>
+ *
+ * Copyright (C) 2005 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2005, 2006, 2007 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ *
+ * exported fuctions:
+ *
+ * struct DRIVER drv_Pertelian
+ *
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+
+#include "debug.h"
+#include "cfg.h"
+#include "qprintf.h"
+#include "udelay.h"
+#include "plugin.h"
+#include "widget.h"
+#include "widget_text.h"
+#include "widget_icon.h"
+#include "widget_bar.h"
+#include "drv.h"
+
+#include "drv_generic_text.h"
+#include "drv_generic_serial.h"
+
+static char Name[] = "Pertelian";
+
+static unsigned char rowoffset[4] = { 0x80, 0x80 + 0x40, 0x80 + 0x14, 0x80 + 0x40 + 0x14 };
+
+#define PERTELIAN_LCDCOMMAND 0xfe
+
+/****************************************/
+/*** hardware dependant functions ***/
+/****************************************/
+
+
+static int drv_Pertelian_open(const char *section)
+{
+ if (drv_generic_serial_open(section, Name, 0) < 0)
+ return -1;
+ return 0;
+}
+
+
+static int drv_Pertelian_close(void)
+{
+ drv_generic_serial_close();
+ return 0;
+}
+
+
+static void drv_Pertelian_send(const char *data, const unsigned int len)
+{
+ unsigned int i;
+
+ /* Pertelian interface seems to offer no buffering at all
+ so we have to slow things down a tad yes 1usec is enough */
+
+ for (i = 0; i < len; i++) {
+ drv_generic_serial_write(&data[i], 1);
+ usleep(100);
+ }
+}
+
+
+static void drv_Pertelian_clear(void)
+{
+ char cmd[2];
+
+ cmd[0] = PERTELIAN_LCDCOMMAND;
+ cmd[1] = 0x01;
+ drv_Pertelian_send(cmd, 2);
+}
+
+
+static void drv_Pertelian_write(const int row, const int col, const char *data, int len)
+{
+ char cmd[3];
+
+ cmd[0] = PERTELIAN_LCDCOMMAND;
+ cmd[1] = ((rowoffset[row]) + (col));
+ drv_Pertelian_send(cmd, 2);
+ drv_Pertelian_send(data, len);
+}
+
+
+static void drv_Pertelian_defchar(const int ascii, const unsigned char *matrix)
+{
+ char cmd[11] = "";
+ int i;
+
+ cmd[0] = PERTELIAN_LCDCOMMAND;
+ cmd[1] = (0x40 + (8 * ascii));
+ for (i = 0; i < 8; i++) {
+ cmd[i + 2] = matrix[i] & 0x1f;
+ }
+ drv_Pertelian_send(cmd, 10);
+}
+
+
+static int drv_Pertelian_backlight(int backlight)
+{
+ char cmd[2];
+
+ if (backlight <= 0)
+ backlight = 2;
+ else if (backlight >= 1)
+ backlight = 3;
+
+ cmd[0] = PERTELIAN_LCDCOMMAND;
+ cmd[1] = backlight;
+
+ drv_Pertelian_send(cmd, 2);
+
+ return backlight;
+}
+
+
+static int drv_Pertelian_start(const char *section)
+{
+ int backlight;
+ int rows = -1, cols = -1;
+ char *s;
+ char cmd[12] = "";
+
+ s = cfg_get(section, "Size", NULL);
+ if (s == NULL || *s == '\0') {
+ error("%s: no '%s.Size' entry from %s", Name, section, cfg_source());
+ return -1;
+ }
+ if (sscanf(s, "%dx%d", &cols, &rows) != 2 || rows < 1 || cols < 1) {
+ error("%s: bad %s.Size '%s' from %s", Name, section, s, cfg_source());
+ free(s);
+ return -1;
+ }
+
+ DROWS = rows;
+ DCOLS = cols;
+
+ /* open communication with the display */
+ if (drv_Pertelian_open(section) < 0) {
+ return -1;
+ }
+
+ /* reset & initialize display */
+ cmd[0] = PERTELIAN_LCDCOMMAND;
+ cmd[1] = 0x38;
+ cmd[2] = PERTELIAN_LCDCOMMAND;
+ cmd[3] = 0x06;
+ cmd[4] = PERTELIAN_LCDCOMMAND;
+ cmd[5] = 0x10; /* move cursor on data write */
+ cmd[6] = PERTELIAN_LCDCOMMAND;
+ cmd[7] = 0x0c;
+ cmd[8] = 0x0c;
+
+ drv_Pertelian_send(cmd, 8);
+
+ if (cfg_number(section, "Backlight", 0, 0, 1, &backlight) > 0) {
+ drv_Pertelian_backlight(backlight);
+ }
+
+ drv_Pertelian_clear(); /* clear display */
+ return 0;
+}
+
+
+/****************************************/
+/*** plugins ***/
+/****************************************/
+
+static void plugin_backlight(RESULT * result, RESULT * arg1)
+{
+ double backlight = 0;
+ backlight = drv_Pertelian_backlight(R2N(arg1));
+ SetResult(&result, R_NUMBER, &backlight);
+}
+
+/****************************************/
+/*** widget callbacks ***/
+/****************************************/
+
+
+/* using drv_generic_text_draw(W) */
+/* using drv_generic_text_icon_draw(W) */
+/* using drv_generic_text_bar_draw(W) */
+/* using drv_generic_gpio_draw(W) */
+
+
+/****************************************/
+/*** exported functions ***/
+/****************************************/
+
+
+/* list models */
+int drv_Pertelian_list(void)
+{
+ printf("Pertelian X2040 displays");
+ return 0;
+}
+
+
+/* initialize driver & display */
+int drv_Pertelian_init(const char *section, const int quiet)
+{
+ WIDGET_CLASS wc;
+ int ret;
+
+ info("%s: %s", Name, "$Rev: 975 $");
+
+ /* display preferences */
+ XRES = 5; /* pixel width of one char */
+ YRES = 8; /* pixel height of one char */
+ CHARS = 8; /* number of user-defineable characters */
+ CHAR0 = 0; /* ASCII of first user-defineable char */
+ GOTO_COST = 2; /* number of bytes a goto command requires */
+
+ /* real worker functions */
+ drv_generic_text_real_write = drv_Pertelian_write;
+ drv_generic_text_real_defchar = drv_Pertelian_defchar;
+
+
+ /* start display */
+ if ((ret = drv_Pertelian_start(section)) != 0)
+ return ret;
+
+ if (!quiet) {
+ char buffer[40];
+ qprintf(buffer, sizeof(buffer), "%s %dx%d", Name, DCOLS, DROWS);
+ if (drv_generic_text_greet(buffer, "LinITX.com")) {
+ sleep(3);
+ drv_Pertelian_clear();
+ }
+ }
+
+ /* initialize generic text driver */
+ if ((ret = drv_generic_text_init(section, Name)) != 0)
+ return ret;
+
+ /* initialize generic icon driver */
+ if ((ret = drv_generic_text_icon_init()) != 0)
+ return ret;
+
+ /* initialize generic bar driver */
+ if ((ret = drv_generic_text_bar_init(0)) != 0)
+ return ret;
+
+ /* add fixed chars to the bar driver */
+ drv_generic_text_bar_add_segment(0, 0, 255, 32); /* ASCII 32 = blank */
+
+
+ /* register text widget */
+ wc = Widget_Text;
+ wc.draw = drv_generic_text_draw;
+ widget_register(&wc);
+
+ /* register icon widget */
+ wc = Widget_Icon;
+ wc.draw = drv_generic_text_icon_draw;
+ widget_register(&wc);
+
+ /* register bar widget */
+ wc = Widget_Bar;
+ wc.draw = drv_generic_text_bar_draw;
+ widget_register(&wc);
+ AddFunction("LCD::backlight", 1, plugin_backlight);
+ return 0;
+}
+
+
+/* close driver & display */
+int drv_Pertelian_quit(const int quiet)
+{
+
+ info("%s: shutting down.", Name);
+
+ drv_generic_text_quit();
+
+ /* clear display */
+ drv_Pertelian_clear();
+
+ /* say goodbye... */
+ if (!quiet) {
+ drv_generic_text_greet("goodbye!", NULL);
+ }
+
+ drv_Pertelian_backlight(0);
+ debug("closing connection");
+ drv_Pertelian_close();
+
+ return (0);
+}
+
+
+DRIVER drv_Pertelian = {
+ .name = Name,
+ .list = drv_Pertelian_list,
+ .init = drv_Pertelian_init,
+ .quit = drv_Pertelian_quit,
+};
diff --git a/drv_RouterBoard.c b/drv_RouterBoard.c
new file mode 100644
index 0000000..0948255
--- /dev/null
+++ b/drv_RouterBoard.c
@@ -0,0 +1,693 @@
+/* $Id: drv_RouterBoard.c 771 2007-02-25 12:27:26Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/drv_RouterBoard.c $
+ *
+ * driver for the "Router Board LCD port"
+ * see port details at http://www.routerboard.com
+ *
+ * Copyright (C) 2004 Roman Jozsef <rjoco77@freemail.hu>
+ * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * based on the HD44780 parallel port driver and RB SDK example
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+
+/* This particulary board not have paralell port but have a special LCD header
+ * where can connect an HD44780 display.
+ * This port called IOSC0 port, and is write only, this port control the
+ * 4 leds on board too.
+ * Because its a write only port you can't control leds outside lcd driver
+ * or inverse, for this added the socket controlled leds. To send led status
+ * simply open an UDP socket and send to localhost 127.0.0.1 port 3333 one
+ * byte or more anyway only the first byte 4 low bits used the others is
+ * cleared and ignored bit0 = Led1 ,bit1 = Led2 ...
+ * This socket polled via timer callback, for detail see at drv_RB_start()
+ * I add at to end of this file an example!
+ * If you don't want coment #define RB_WITH LEDS and this part will be ignored
+ *
+ * The connection details:
+ * The IOCS0 port lower 16 bits connected as follows:
+ * bit LCD LEDS
+ * 0..7 data
+ * 8 INITX
+ * 9 SLINX
+ * 10 AFDX
+ * 11 backlit
+ * 12 LED1
+ * 13 LED2
+ * 14 LED3
+ * 15 LED4
+ *
+ * LCD male header:
+ * 1 Vcc +5V
+ * 2 GND
+ * 3 RS (Register Select,AFDX)
+ * 4 Contrast adjust (controlled) but how? if you know tell me not mentioned on User Manual
+ * 5 E (enable signal, INITX)
+ * 6 R/W (Data read/write or SLINX) not used connect LCD pin to ground
+ * 7 Data 1
+ * 8 Data 0
+ * 9 Data 3
+ * 10 Data 2
+ * 11 Data 5
+ * 12 Data 4
+ * 13 Data 7
+ * 14 Data 6
+ * 15 Backlit GND (controlled) (IOSC0 bit 11)
+ * 16 Backlit Vcc +5V
+ *
+ * If you using this driver and board and you have any fun device connected,
+ * program or story :-) ,please share for me. Thanks.
+ *
+ * Literature
+ * [GEODE] Geode SC1100 Information Appliance On a Chip
+ * (http://www.national.com/ds/SC/SC1100.pdf)
+ * [RB User Manual]
+ * (http://www.routerboard.com)
+ *
+ *
+ * Revision 1.2
+ * Added backlight control
+ */
+
+
+/*
+ *
+ * exported fuctions:
+ *
+ * struct DRIVER drv_RouterBoard
+ *
+ */
+
+
+
+
+
+#include "config.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include <unistd.h>
+#include <sys/io.h>
+
+#include "debug.h"
+#include "cfg.h"
+#include "udelay.h"
+#include "qprintf.h"
+#include "plugin.h"
+#include "widget.h"
+#include "widget_text.h"
+#include "widget_icon.h"
+#include "widget_bar.h"
+#include "drv.h"
+#include "drv_generic_text.h"
+#include "drv_generic_gpio.h"
+
+
+/* #define RB_WITH_LEDS 1 */
+
+#ifdef RB_WITH_LEDS /* Build without socket&led support */
+
+#include <arpa/inet.h>
+#include <sys/socket.h>
+#include <sys/poll.h>
+
+#define POLL_TIMEOUT 10 /* Socket poll timeout */
+#define MAXMSG_SIZE 100 /* Max messagge we can receive */
+
+static int sock_c; /* Socket handler */
+static struct sockaddr_in *sacl;
+char sock_msg[MAXMSG_SIZE];
+
+#endif
+
+
+static char Name[] = "RouterBoard";
+
+static int Model;
+static int Capabilities;
+
+/* RouterBoard control signals */
+
+#define LCD_INITX 0x0100
+#define LCD_SLINX 0x0200
+#define LCD_AFDX 0x0400
+#define LCD_BACKLIGHT 0x0800
+#define RB_LEDS 0xF000
+
+#define CAR 0x0CF8
+#define CDR 0x0CFC
+
+
+/* HD44780 execution timings [microseconds]
+ * as these values differ from spec to spec,
+ * we use the worst-case values.
+ */
+
+#define T_INIT1 4100 /* first init sequence: 4.1 msec */
+#define T_INIT2 100 /* second init sequence: 100 usec */
+#define T_EXEC 80 /* normal execution time */
+#define T_WRCG 120 /* CG RAM Write */
+#define T_CLEAR 1680 /* Clear Display */
+#define T_AS 60 /* Address setup time */
+
+
+/* buffer holding the GPO state */
+static unsigned char GPO = 0;
+
+/* buffor holding backlight and LED states */
+static unsigned int RB_Leds = 0;
+
+typedef struct {
+ int type;
+ char *name;
+ int capabilities;
+} MODEL;
+
+#define CAP_HD66712 (1<<0)
+
+static MODEL Models[] = {
+ {0x01, "HD44780", 0},
+ {0x02, "HD66712", CAP_HD66712},
+ {0xff, "Unknown", 0}
+};
+
+
+/****************************************/
+/*** hardware dependant functions ***/
+/****************************************/
+
+#ifdef RB_WITH_LEDS
+
+static int drv_RB_sock_init()
+{
+
+ if ((sacl = (struct sockaddr_in *) malloc(sizeof(struct sockaddr_in))) == NULL) {
+ return -1;
+ }
+
+ memset(sacl, 0, sizeof(struct sockaddr_in));
+ sacl->sin_family = AF_INET;
+ sacl->sin_port = htons(3333); /* Listen Port */
+ sacl->sin_addr.s_addr = inet_addr("127.0.0.1"); /* Listen Address */
+
+ if ((sock_c = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
+ error("Socket open failed");
+ free(sacl);
+ return -1;
+ }
+
+ if (bind(sock_c, (struct sockaddr *) sacl, sizeof(struct sockaddr_in)) < 0) {
+ error("Socket bind open failed");
+ free(sacl);
+ return -1;
+ }
+ return 0;
+}
+
+
+static void drv_RB_poll_data(void __attribute__ ((unused)) * notused)
+{
+ int len, size;
+ struct pollfd usfd;
+ usfd.fd = sock_c;
+ usfd.events = POLLIN | POLLPRI;
+ while (poll(&usfd, 1, POLL_TIMEOUT) > 0) {
+ len = sizeof(struct sockaddr_in);
+ if ((size = recvfrom(sock_c, sock_msg, MAXMSG_SIZE, 0, (struct sockaddr *) sacl, (socklen_t *) & len)) < 0);
+ else {
+ RB_Leds &= 0x0fff;
+ RB_Leds |= (sock_msg[0] & 0x0F) << 12;
+ /* fprintf(stderr, "Received data %s\n",sock_msg); */
+ }
+ }
+}
+
+#endif
+
+
+static void drv_RB_outw(const unsigned int data)
+{
+ static unsigned int port = 0;
+
+ /* IOCS0 port number can read from PCI Configuration Space Function 0 (F0) */
+ /* at index 74h as 16 bit value (see [GEODE] 5.3.1 pg.151 and pg.176 Table 5-29 */
+ if (port == 0) {
+ /* get IO permission, here you can't use ioperm command */
+ iopl(3);
+ outl(0x80009074, CAR);
+ port = inw(CDR);
+ }
+
+ outw(data | RB_Leds, port);
+}
+
+
+static int drv_RB_backlight(int backlight)
+{
+ /* -1 is used to query the current Backlight */
+ if (backlight == -1) {
+ return (RB_Leds & LCD_BACKLIGHT) ? 1 : 0;
+ }
+
+ if (backlight > 0) {
+ /* set bit */
+ RB_Leds |= LCD_BACKLIGHT;
+ backlight = 1;
+ } else {
+ backlight = 0;
+ /* clear bit */
+ RB_Leds &= ~LCD_BACKLIGHT;
+ }
+
+ /* Set backlight output */
+ drv_RB_outw(0);
+
+ return backlight;
+}
+
+
+
+
+static void drv_RB_command(const unsigned char cmd, const int delay)
+{
+
+ drv_RB_outw(LCD_INITX | cmd);
+ ndelay(T_AS);
+ drv_RB_outw(cmd);
+
+ /* wait for command completion */
+ udelay(delay);
+
+}
+
+
+static void drv_RB_data(const char *string, const int len, const int delay)
+{
+ int l = len;
+ unsigned char ch;
+
+ /* sanity check */
+ if (len <= 0)
+ return;
+
+ while (l--) {
+
+ ch = *(string++);
+
+ drv_RB_outw(ch | LCD_AFDX | LCD_INITX);
+ ndelay(T_AS);
+ drv_RB_outw(ch | LCD_AFDX);
+
+ /* wait for command completion */
+ udelay(delay);
+
+ }
+}
+
+
+static void drv_RB_clear(void)
+{
+ drv_RB_command(0x01, T_CLEAR);
+}
+
+
+static void drv_RB_goto(int row, int col)
+{
+ int pos;
+
+ /* 16x1 Displays are organized as 8x2 :-( */
+ if (DCOLS == 16 && DROWS == 1 && col > 7) {
+ row++;
+ col -= 8;
+ }
+
+ if (Capabilities & CAP_HD66712) {
+ /* the HD66712 doesn't have a braindamadged RAM layout */
+ pos = row * 32 + col;
+ } else {
+ /* 16x4 Displays use a slightly different layout */
+ if (DCOLS == 16 && DROWS == 4) {
+ pos = (row % 2) * 64 + (row / 2) * 16 + col;
+ } else {
+ pos = (row % 2) * 64 + (row / 2) * 20 + col;
+ }
+ }
+ drv_RB_command((0x80 | pos), T_EXEC);
+}
+
+
+static void drv_RB_write(const int row, const int col, const char *data, const int len)
+{
+ drv_RB_goto(row, col);
+ drv_RB_data(data, len, T_EXEC);
+}
+
+
+static void drv_RB_defchar(const int ascii, const unsigned char *matrix)
+{
+ int i;
+ char buffer[8];
+
+ for (i = 0; i < 8; i++) {
+ buffer[i] = matrix[i] & 0x1f;
+ }
+
+ drv_RB_command(0x40 | 8 * ascii, T_EXEC);
+ drv_RB_data(buffer, 8, T_WRCG);
+}
+
+
+static int drv_RB_GPO(const int num, const int val)
+{
+ int v;
+
+ if (val > 0) {
+ /* set bit */
+ v = 1;
+ GPO |= 1 << num;
+ } else {
+ /* clear bit */
+ v = 0;
+ GPO &= ~(1 << num);
+ }
+
+ RB_Leds &= 0x0fff;
+ RB_Leds |= GPO << 12;
+
+ drv_RB_outw(0);
+
+ return v;
+}
+
+
+static int drv_RB_start(const char *section, const int quiet)
+{
+ char *model, *strsize;
+ int rows = -1, cols = -1, gpos = -1;
+ int l;
+
+ model = cfg_get(section, "Model", "HD44780");
+ if (model != NULL && *model != '\0') {
+ int i;
+ for (i = 0; Models[i].type != 0xff; i++) {
+ if (strcasecmp(Models[i].name, model) == 0)
+ break;
+ }
+ if (Models[i].type == 0xff) {
+ error("%s: %s.Model '%s' is unknown from %s", Name, section, model, cfg_source());
+ return -1;
+ }
+ Model = i;
+ Capabilities = Models[Model].capabilities;
+ info("%s: using model '%s'", Name, Models[Model].name);
+ } else {
+ error("%s: empty '%s.Model' entry from %s", Name, section, cfg_source());
+ return -1;
+ }
+ free(model);
+
+ strsize = cfg_get(section, "Size", NULL);
+ if (strsize == NULL || *strsize == '\0') {
+ error("%s: no '%s.Size' entry from %s", Name, section, cfg_source());
+ free(strsize);
+ return -1;
+ }
+ if (sscanf(strsize, "%dx%d", &cols, &rows) != 2 || rows < 1 || cols < 1) {
+ error("%s: bad %s.Size '%s' from %s", Name, section, strsize, cfg_source());
+ free(strsize);
+ return -1;
+ }
+ free(strsize);
+
+ /*set backlight */
+ if (cfg_number(section, "Backlight", 1, 0, 1, &l) > 0) {
+ drv_RB_backlight(l);
+ }
+
+ if (cfg_number(section, "GPOs", 0, 0, 4, &gpos) < 0)
+ return -1;
+ GPOS = gpos;
+ if (GPOS > 0) {
+ info("%s: using %d GPO's", Name, GPOS);
+ }
+#ifdef RB_WITH_LEDS
+
+ if (drv_RB_sock_init() < 0) {
+ error("Sock error");
+ return -1;
+ } else
+ timer_add(drv_RB_poll_data, NULL, 500, 0);
+
+#endif
+
+ DROWS = rows;
+ DCOLS = cols;
+
+ drv_RB_command(0x30, T_INIT1); /* 8 Bit mode, wait 4.1 ms */
+ drv_RB_command(0x30, T_INIT2); /* 8 Bit mode, wait 100 us */
+ drv_RB_command(0x38, T_EXEC); /* 8 Bit mode, 1/16 duty cycle, 5x8 font */
+
+ drv_RB_command(0x08, T_EXEC); /* Display off, cursor off, blink off */
+ drv_RB_command(0x0c, T_CLEAR); /* Display on, cursor off, blink off, wait 1.64 ms */
+ drv_RB_command(0x06, T_EXEC); /* curser moves to right, no shift */
+
+ if ((Capabilities & CAP_HD66712) && DROWS > 2) {
+ drv_RB_command(0x3c, T_EXEC); /* set extended register enable bit */
+ drv_RB_command(0x09, T_EXEC); /* set 4-line mode */
+ drv_RB_command(0x38, T_EXEC); /* clear extended register enable bit */
+ }
+
+ drv_RB_clear();
+ drv_RB_command(0x03, T_CLEAR); /* return home */
+
+ if (!quiet) {
+ char buffer[40];
+ qprintf(buffer, sizeof(buffer), "%s %dx%d", Name, DCOLS, DROWS);
+ if (drv_generic_text_greet(buffer, NULL)) {
+ sleep(3);
+ drv_RB_clear();
+ }
+ }
+
+ return 0;
+}
+
+
+/****************************************/
+/*** plugins ***/
+/****************************************/
+static void plugin_backlight(RESULT * result, const int argc, RESULT * argv[])
+{
+ double backlight;
+
+ switch (argc) {
+ case 0:
+ backlight = drv_RB_backlight(-1);
+ SetResult(&result, R_NUMBER, &backlight);
+ break;
+ case 1:
+ backlight = drv_RB_backlight(R2N(argv[0]));
+ SetResult(&result, R_NUMBER, &backlight);
+ break;
+ default:
+ error("%s::backlight(): wrong number of parameters", Name);
+ SetResult(&result, R_STRING, "");
+ }
+}
+
+
+
+/****************************************/
+/*** widget callbacks ***/
+/****************************************/
+
+
+/* using drv_generic_text_draw(W) */
+/* using drv_generic_text_icon_draw(W) */
+/* using drv_generic_text_bar_draw(W) */
+/* using drv_generic_gpio_draw(W) */
+
+
+/****************************************/
+/*** exported functions ***/
+/****************************************/
+
+
+/* list models */
+int drv_RB_list(void)
+{
+ int i;
+
+ for (i = 0; Models[i].type != 0xff; i++) {
+ printf("%s ", Models[i].name);
+ }
+ return 0;
+}
+
+/* initialize driver & display */
+int drv_RB_init(const char *section, const int quiet)
+{
+ WIDGET_CLASS wc;
+ int asc255bug;
+ int ret;
+
+ info("%s: %s", Name, "$Rev: 771 $");
+
+ /* display preferences */
+ XRES = 5; /* pixel width of one char */
+ YRES = 8; /* pixel height of one char */
+ CHARS = 8; /* number of user-defineable characters */
+ CHAR0 = 0; /* ASCII of first user-defineable char */
+ GOTO_COST = 2; /* number of bytes a goto command requires */
+
+ /* real worker functions */
+ drv_generic_text_real_write = drv_RB_write;
+ drv_generic_text_real_defchar = drv_RB_defchar;
+ drv_generic_gpio_real_set = drv_RB_GPO;
+
+
+ /* start display */
+ if ((ret = drv_RB_start(section, quiet)) != 0)
+ return ret;
+
+ /* initialize generic text driver */
+ if ((ret = drv_generic_text_init(section, Name)) != 0)
+ return ret;
+
+ /* initialize generic icon driver */
+ if ((ret = drv_generic_text_icon_init()) != 0)
+ return ret;
+
+ /* initialize generic bar driver */
+ if ((ret = drv_generic_text_bar_init(0)) != 0)
+ return ret;
+
+ /* add fixed chars to the bar driver */
+ /* most displays have a full block on ascii 255, but some have kind of */
+ /* an 'inverted P'. If you specify 'asc255bug 1 in the config, this */
+ /* char will not be used, but rendered by the bar driver */
+ cfg_number(section, "asc255bug", 0, 0, 1, &asc255bug);
+ drv_generic_text_bar_add_segment(0, 0, 255, 32); /* ASCII 32 = blank */
+ if (!asc255bug)
+ drv_generic_text_bar_add_segment(255, 255, 255, 255); /* ASCII 255 = block */
+
+ /* initialize generic GPIO driver */
+ if ((ret = drv_generic_gpio_init(section, Name)) != 0)
+ return ret;
+
+ /* register text widget */
+ wc = Widget_Text;
+ wc.draw = drv_generic_text_draw;
+ widget_register(&wc);
+
+ /* register icon widget */
+ wc = Widget_Icon;
+ wc.draw = drv_generic_text_icon_draw;
+ widget_register(&wc);
+
+ /* register bar widget */
+ wc = Widget_Bar;
+ wc.draw = drv_generic_text_bar_draw;
+ widget_register(&wc);
+
+ /* register plugins */
+ AddFunction("LCD::backlight", -1, plugin_backlight);
+
+ return 0;
+}
+
+
+/* close driver & display */
+int drv_RB_quit(const int quiet)
+{
+
+ info("%s: shutting down.", Name);
+
+ drv_generic_text_quit();
+ drv_generic_gpio_quit();
+
+ /* clear *both* displays */
+ drv_RB_clear();
+
+ /* say goodbye... */
+ if (!quiet) {
+ drv_generic_text_greet("goodbye!", NULL);
+ }
+#ifdef RB_WITH_LEDS
+ close(sock_c);
+ free(sacl); /*close network socket */
+#endif
+
+ return (0);
+}
+
+
+DRIVER drv_RouterBoard = {
+ .name = Name,
+ .list = drv_RB_list,
+ .init = drv_RB_init,
+ .quit = drv_RB_quit,
+};
+
+
+
+#if 0
+
+Simple example to send led status to port 3333
+#include <stdio.h>
+#include <arpa/inet.h>
+#include <errno.h>
+int send_packet(unsigned char leds)
+{
+ struct sockaddr_in *sas;
+ int sock;
+ char msg[20];
+ msg[0] = leds;
+ msg[1] = 0;
+
+ if ((sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) {
+ fprintf(stderr, "Socket option failed.\n");
+ return -1;
+ }
+
+ if ((sas = (struct sockaddr_in *) malloc(sizeof(struct sockaddr_in))) == NULL)
+ return -1;
+ memset(sas, 0, sizeof(struct sockaddr_in));
+ sas->sin_family = AF_INET;
+ sas->sin_port = htons(3333);
+ sas->sin_addr.s_addr = inet_addr("127.0.0.1");
+ if (sendto(sock, msg, 6, 0, (struct sockaddr *) sas, sizeof(struct sockaddr_in)) > 0) {
+ free(sas);
+ return 1;
+ }
+ /* sent ok to dest */
+ free(sas);
+ return -1; /* Send failed */
+}
+
+int main()
+{
+ send_packet(0x03);
+ return 0;
+}
+
+#endif
diff --git a/drv_Sample.c b/drv_Sample.c
new file mode 100644
index 0000000..05df26b
--- /dev/null
+++ b/drv_Sample.c
@@ -0,0 +1,601 @@
+/* $Id: drv_Sample.c 975 2009-01-18 11:16:20Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/drv_Sample.c $
+ *
+ * sample lcd4linux driver
+ *
+ * Copyright (C) 2005 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2005, 2006, 2007 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ *
+ * exported fuctions:
+ *
+ * struct DRIVER drv_Sample
+ *
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+
+#include "debug.h"
+#include "cfg.h"
+#include "qprintf.h"
+#include "udelay.h"
+#include "plugin.h"
+#include "widget.h"
+#include "widget_text.h"
+#include "widget_icon.h"
+#include "widget_bar.h"
+#include "drv.h"
+
+/* text mode display? */
+#include "drv_generic_text.h"
+
+/* graphic display? */
+#include "drv_generic_graphic.h"
+
+/* GPO's? */
+#include "drv_generic_gpio.h"
+
+/* serial port? */
+#include "drv_generic_serial.h"
+
+/* parallel port? */
+#include "drv_generic_parport.h"
+
+/* i2c bus? */
+#ifdef WITH_I2C
+#include "drv_generic_i2c.h"
+#endif
+
+
+static char Name[] = "Sample";
+
+
+/* for parallel port displays only */
+/* use whatever lines you need */
+static unsigned char SIGNAL_RS;
+static unsigned char SIGNAL_EX;
+
+
+
+/****************************************/
+/*** hardware dependant functions ***/
+/****************************************/
+
+/* low-level parallel port stuff */
+/* example for sending one byte over the wire */
+static void drv_Sample_bang(const unsigned int data)
+{
+ /* put data on DB1..DB8 */
+ drv_generic_parport_data(data & 0xff);
+
+ /* set/clear some signals */
+ drv_generic_parport_control(SIGNAL_RS, SIGNAL_RS);
+
+ /* data setup time (e.g. 200 ns) */
+ ndelay(200);
+
+ /* send byte */
+ /* signal pulse width 500ns */
+ drv_generic_parport_toggle(SIGNAL_EX, 1, 500);
+
+ /* wait for command completion (e.g. 100 us) */
+ udelay(100);
+}
+
+
+static int drv_Sample_open(const char *section)
+{
+ /* open serial port */
+ /* don't mind about device, speed and stuff, this function will take care of */
+
+ if (drv_generic_serial_open(section, Name, 0) < 0)
+ return -1;
+
+
+ /* opening the parallel port is a bit more tricky: */
+ /* you have to do all the bit-banging yourself... */
+
+ if (drv_generic_parport_open(section, Name) != 0) {
+ error("%s: could not initialize parallel port!", Name);
+ return -1;
+ }
+
+ /* read the wiring from config */
+ if ((SIGNAL_EX = drv_generic_parport_wire_ctrl("EX", "STROBE")) == 0xff)
+ return -1;
+ if ((SIGNAL_RS = drv_generic_parport_wire_ctrl("RS", "INIT")) == 0xff)
+ return -1;
+
+ /* clear all signals */
+ drv_generic_parport_control(SIGNAL_EX | SIGNAL_RS, 0);
+
+ /* set direction: write */
+ drv_generic_parport_direction(0);
+
+ return 0;
+}
+
+
+static int drv_Sample_close(void)
+{
+ /* close whatever port you've opened */
+ drv_generic_parport_close();
+ drv_generic_serial_close();
+
+ return 0;
+}
+
+
+/* dummy function that sends something to the display */
+static void drv_Sample_send(const char *data, const unsigned int len)
+{
+ unsigned int i;
+
+ /* send data to the serial port is easy... */
+ drv_generic_serial_write(data, len);
+
+ /* sending data to the parallel port is a bit more tricky... */
+ for (i = 0; i < len; i++) {
+ drv_Sample_bang(*data++);
+ }
+}
+
+
+/* text mode displays only */
+static void drv_Sample_clear(void)
+{
+ char cmd[1];
+
+ /* do whatever is necessary to clear the display */
+ /* assume 0x01 to be a 'clear display' command */
+ cmd[0] = 0x01;
+ drv_Sample_send(cmd, 1);
+}
+
+
+/* text mode displays only */
+static void drv_Sample_write(const int row, const int col, const char *data, int len)
+{
+ char cmd[3];
+
+ /* do the cursor positioning here */
+ /* assume 0x02 to be a 'Goto' command */
+ cmd[0] = 0x02;
+ cmd[1] = row;
+ cmd[2] = col;
+ drv_Sample_send(cmd, 3);
+
+ /* send string to the display */
+ drv_Sample_send(data, len);
+
+}
+
+/* text mode displays only */
+static void drv_Sample_defchar(const int ascii, const unsigned char *matrix)
+{
+ char cmd[10];
+ int i;
+
+ /* call the 'define character' function */
+ /* assume 0x03 to be the 'defchar' command */
+ cmd[0] = 0x03;
+ cmd[1] = ascii;
+
+ /* send bitmap to the display */
+ for (i = 0; i < 8; i++) {
+ cmd[i + 2] = *matrix++;
+ }
+ drv_Sample_send(cmd, 10);
+}
+
+
+/* for graphic displays only */
+static void drv_Sample_blit(const int row, const int col, const int height, const int width)
+{
+ int r, c;
+
+ for (r = row; r < row + height; r++) {
+ for (c = col; c < col + width; c++) {
+ /* drv_generic_graphic_black() returns 1 if pixel is black */
+ /* drv_generic_graphic_gray() returns a gray value 0..255 */
+ /* drv_generic_graphic_rgb() returns a RGB color */
+ if (drv_generic_graphic_black(r, c)) {
+ /* set bit */
+ } else {
+ /* clear bit */
+ }
+ }
+ }
+}
+
+
+/* remove unless you have GPO's */
+static int drv_Sample_GPO(const int num, const int val)
+{
+ char cmd[4];
+
+ /* assume 0x42 to be the 'GPO' command */
+ cmd[0] = 0x42;
+ cmd[1] = num;
+ cmd[2] = (val > 0) ? 1 : 0;
+
+ drv_Sample_send(cmd, 3);
+
+ return 0;
+}
+
+
+/* example function used in a plugin */
+static int drv_Sample_contrast(int contrast)
+{
+ char cmd[2];
+
+ /* adjust limits according to the display */
+ if (contrast < 0)
+ contrast = 0;
+ if (contrast > 255)
+ contrast = 255;
+
+ /* call a 'contrast' function */
+ /* assume 0x04 to be the 'set contrast' command */
+ cmd[0] = 0x04;
+ cmd[1] = contrast;
+ drv_Sample_send(cmd, 2);
+
+ return contrast;
+}
+
+
+/* start text mode display */
+static int drv_Sample_start(const char *section)
+{
+ int contrast;
+ int rows = -1, cols = -1;
+ char *s;
+ char cmd[1];
+
+ s = cfg_get(section, "Size", NULL);
+ if (s == NULL || *s == '\0') {
+ error("%s: no '%s.Size' entry from %s", Name, section, cfg_source());
+ return -1;
+ }
+ if (sscanf(s, "%dx%d", &cols, &rows) != 2 || rows < 1 || cols < 1) {
+ error("%s: bad %s.Size '%s' from %s", Name, section, s, cfg_source());
+ free(s);
+ return -1;
+ }
+
+ DROWS = rows;
+ DCOLS = cols;
+
+ /* number of GPO's; remove if you don't have them */
+ GPOS = 8;
+
+ /* open communication with the display */
+ if (drv_Sample_open(section) < 0) {
+ return -1;
+ }
+
+ /* reset & initialize display */
+ /* assume 0x00 to be a 'reset' command */
+ cmd[0] = 0x00;
+ drv_Sample_send(cmd, 0);
+
+ if (cfg_number(section, "Contrast", 0, 0, 255, &contrast) > 0) {
+ drv_Sample_contrast(contrast);
+ }
+
+ drv_Sample_clear(); /* clear display */
+
+ return 0;
+}
+
+
+/* start graphic display */
+static int drv_Sample_start2(const char *section)
+{
+ char *s;
+ char cmd[1];
+ int contrast;
+
+ /* read display size from config */
+ s = cfg_get(section, "Size", NULL);
+ if (s == NULL || *s == '\0') {
+ error("%s: no '%s.Size' entry from %s", Name, section, cfg_source());
+ return -1;
+ }
+
+ DROWS = -1;
+ DCOLS = -1;
+ if (sscanf(s, "%dx%d", &DCOLS, &DROWS) != 2 || DCOLS < 1 || DROWS < 1) {
+ error("%s: bad Size '%s' from %s", Name, s, cfg_source());
+ return -1;
+ }
+
+ s = cfg_get(section, "Font", "6x8");
+ if (s == NULL || *s == '\0') {
+ error("%s: no '%s.Font' entry from %s", Name, section, cfg_source());
+ return -1;
+ }
+
+ XRES = -1;
+ YRES = -1;
+ if (sscanf(s, "%dx%d", &XRES, &YRES) != 2 || XRES < 1 || YRES < 1) {
+ error("%s: bad Font '%s' from %s", Name, s, cfg_source());
+ return -1;
+ }
+
+ /* Fixme: provider other fonts someday... */
+ if (XRES != 6 && YRES != 8) {
+ error("%s: bad Font '%s' from %s (only 6x8 at the moment)", Name, s, cfg_source());
+ return -1;
+ }
+
+ /* you surely want to allocate a framebuffer or something... */
+
+ /* open communication with the display */
+ if (drv_Sample_open(section) < 0) {
+ return -1;
+ }
+
+ /* reset & initialize display */
+ /* assume 0x00 to be a 'reset' command */
+ cmd[0] = 0x00;
+ drv_Sample_send(cmd, 1);
+
+ if (cfg_number(section, "Contrast", 0, 0, 255, &contrast) > 0) {
+ drv_Sample_contrast(contrast);
+ }
+
+ return 0;
+}
+
+
+/****************************************/
+/*** plugins ***/
+/****************************************/
+
+static void plugin_contrast(RESULT * result, RESULT * arg1)
+{
+ double contrast;
+
+ contrast = drv_Sample_contrast(R2N(arg1));
+ SetResult(&result, R_NUMBER, &contrast);
+}
+
+
+/****************************************/
+/*** widget callbacks ***/
+/****************************************/
+
+
+/* using drv_generic_text_draw(W) */
+/* using drv_generic_text_icon_draw(W) */
+/* using drv_generic_text_bar_draw(W) */
+/* using drv_generic_gpio_draw(W) */
+
+
+/****************************************/
+/*** exported functions ***/
+/****************************************/
+
+
+/* list models */
+int drv_Sample_list(void)
+{
+ printf("Sample driver");
+ return 0;
+}
+
+
+/* initialize driver & display */
+/* use this function for a text display */
+int drv_Sample_init(const char *section, const int quiet)
+{
+ WIDGET_CLASS wc;
+ int ret;
+
+ info("%s: %s", Name, "$Rev: 975 $");
+
+ /* display preferences */
+ XRES = 5; /* pixel width of one char */
+ YRES = 8; /* pixel height of one char */
+ CHARS = 8; /* number of user-defineable characters */
+ CHAR0 = 0; /* ASCII of first user-defineable char */
+ GOTO_COST = 2; /* number of bytes a goto command requires */
+
+ /* real worker functions */
+ drv_generic_text_real_write = drv_Sample_write;
+ drv_generic_text_real_defchar = drv_Sample_defchar;
+
+ /* remove unless you have GPO's */
+ drv_generic_gpio_real_set = drv_Sample_GPO;
+
+
+ /* start display */
+ if ((ret = drv_Sample_start(section)) != 0)
+ return ret;
+
+ if (!quiet) {
+ char buffer[40];
+ qprintf(buffer, sizeof(buffer), "%s %dx%d", Name, DCOLS, DROWS);
+ if (drv_generic_text_greet(buffer, "www.bwct.de")) {
+ sleep(3);
+ drv_Sample_clear();
+ }
+ }
+
+ /* initialize generic text driver */
+ if ((ret = drv_generic_text_init(section, Name)) != 0)
+ return ret;
+
+ /* initialize generic icon driver */
+ if ((ret = drv_generic_text_icon_init()) != 0)
+ return ret;
+
+ /* initialize generic bar driver */
+ if ((ret = drv_generic_text_bar_init(0)) != 0)
+ return ret;
+
+ /* add fixed chars to the bar driver */
+ drv_generic_text_bar_add_segment(0, 0, 255, 32); /* ASCII 32 = blank */
+
+
+ /* initialize generic GPIO driver */
+ /* remove unless you have GPO's */
+ if ((ret = drv_generic_gpio_init(section, Name)) != 0)
+ return ret;
+
+ /* register text widget */
+ wc = Widget_Text;
+ wc.draw = drv_generic_text_draw;
+ widget_register(&wc);
+
+ /* register icon widget */
+ wc = Widget_Icon;
+ wc.draw = drv_generic_text_icon_draw;
+ widget_register(&wc);
+
+ /* register bar widget */
+ wc = Widget_Bar;
+ wc.draw = drv_generic_text_bar_draw;
+ widget_register(&wc);
+
+ /* register plugins */
+ AddFunction("LCD::contrast", 1, plugin_contrast);
+
+ return 0;
+}
+
+
+/* initialize driver & display */
+/* use this function for a graphic display */
+int drv_Sample_init2(const char *section, const int quiet)
+{
+ int ret;
+
+ /* real worker functions */
+ drv_generic_graphic_real_blit = drv_Sample_blit;
+
+ /* remove unless you have GPO's */
+ drv_generic_gpio_real_set = drv_Sample_GPO;
+
+ /* start display */
+ if ((ret = drv_Sample_start2(section)) != 0)
+ return ret;
+
+ /* initialize generic graphic driver */
+ if ((ret = drv_generic_graphic_init(section, Name)) != 0)
+ return ret;
+
+ if (!quiet) {
+ char buffer[40];
+ qprintf(buffer, sizeof(buffer), "%s %dx%d", Name, DCOLS, DROWS);
+ if (drv_generic_graphic_greet(buffer, NULL)) {
+ sleep(3);
+ drv_generic_graphic_clear();
+ }
+ }
+
+ /* register plugins */
+ AddFunction("LCD::contrast", 1, plugin_contrast);
+
+ return 0;
+}
+
+
+
+/* close driver & display */
+/* use this function for a text display */
+int drv_Sample_quit(const int quiet)
+{
+
+ info("%s: shutting down.", Name);
+
+ drv_generic_text_quit();
+
+ /* remove unless you have GPO's */
+ drv_generic_gpio_quit();
+
+ /* clear display */
+ drv_Sample_clear();
+
+ /* say goodbye... */
+ if (!quiet) {
+ drv_generic_text_greet("goodbye!", NULL);
+ }
+
+ debug("closing connection");
+ drv_Sample_close();
+
+ return (0);
+}
+
+/* close driver & display */
+/* use this function for a graphic display */
+int drv_Sample_quit2(const int quiet)
+{
+
+ info("%s: shutting down.", Name);
+
+ /* clear display */
+ drv_generic_graphic_clear();
+
+ /* remove unless you have GPO's */
+ drv_generic_gpio_quit();
+
+ /* say goodbye... */
+ if (!quiet) {
+ drv_generic_graphic_greet("goodbye!", NULL);
+ }
+
+ drv_generic_graphic_quit();
+
+ debug("closing connection");
+ drv_Sample_close();
+
+ return (0);
+}
+
+
+/* use this one for a text display */
+DRIVER drv_Sample = {
+ .name = Name,
+ .list = drv_Sample_list,
+ .init = drv_Sample_init,
+ .quit = drv_Sample_quit,
+};
+
+
+/* use this one for a graphic display */
+DRIVER drv_Sample2 = {
+ .name = Name,
+ .list = drv_Sample_list,
+ .init = drv_Sample_init2,
+ .quit = drv_Sample_quit2,
+};
diff --git a/drv_SamsungSPF.c b/drv_SamsungSPF.c
new file mode 100644
index 0000000..69f07cf
--- /dev/null
+++ b/drv_SamsungSPF.c
@@ -0,0 +1,511 @@
+/* $Id: drv_SamsungSPF 975 2009-01-18 11:16:20Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/drv_SamsungSPF.c $
+ *
+ * SamsungSPF lcd4linux driver
+ *
+ * Copyright (C) 2012 Sascha Plazar <sascha@plazar.de>
+ * Copyright (C) 2005, 2006, 2007 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This driver is based on playusb.c created on Aug 2, 2010 by Andre Puschmann
+ * which is in turn based on code from Grace Woo:
+ * http://web.media.mit.edu/~gracewoo/stuff/picframe
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ *
+ * exported fuctions:
+ *
+ * struct DRIVER drv_SamsungSPF
+ *
+ */
+
+#include "config.h"
+
+#include <stdio.h>
+#include <string.h>
+
+#include <usb.h>
+#include <jpeglib.h>
+
+#include "debug.h"
+#include "cfg.h"
+#include "qprintf.h"
+#include "timer.h"
+#include "drv.h"
+
+/* graphic display? */
+#include "drv_generic_graphic.h"
+
+// Drivername for verbose output
+static char Name[] = "SamsungSPF";
+
+struct SPFdev {
+ const char type[64];
+ const int vendorID;
+ struct {
+ const int storageMode;
+ const int monitorMode;
+ } productID;
+ const unsigned int xRes;
+ const unsigned int yRes;
+};
+
+static struct SPFdev spfDevices[] = {
+ {
+ .type = "SPF-75H",
+ .vendorID = 0x04e8,
+ .productID = {0x200e, 0x200f},
+ .xRes = 800,
+ .yRes = 480,
+ },
+ {
+ .type = "SPF-85H",
+ .vendorID = 0x04e8,
+ .productID = {0x2012, 0x2013},
+ .xRes = 800,
+ .yRes = 600,
+ },
+ {
+ .type = "SPF-107H",
+ .vendorID = 0x04e8,
+ .productID = {0x2027, 0x2028},
+ .xRes = 1024,
+ .yRes = 600,
+ },
+};
+
+static int numFrames = sizeof(spfDevices) / sizeof(spfDevices[0]);
+
+struct usb_device *myDev;
+usb_dev_handle *myDevHandle;
+struct SPFdev *myFrame;
+
+typedef struct {
+ unsigned char R, G, B;
+} RGB;
+
+static struct {
+ RGB *buf;
+ int dirty;
+ int fbsize;
+} image;
+
+static struct {
+ unsigned char *buf;
+ unsigned long int size;
+} jpegImage;
+
+
+/****************************************/
+/*** hardware dependant functions ***/
+/****************************************/
+
+
+/* please note that in-memory compression doesn't work satisfactory */
+int convert2JPG()
+{
+ struct jpeg_compress_struct cinfo;
+ struct jpeg_error_mgr jerr;
+ int row_stride; /* physical row width in buffer */
+ JSAMPROW row_pointer[1]; /* pointer to a single row */
+
+ /* Initialize compression frame */
+ cinfo.err = jpeg_std_error(&jerr);
+ jpeg_create_compress(&cinfo);
+ jpeg_mem_dest(&cinfo, &jpegImage.buf, &jpegImage.size);
+
+ cinfo.image_width = myFrame->xRes;
+ cinfo.image_height = myFrame->yRes;
+ cinfo.input_components = sizeof(RGB);
+ cinfo.in_color_space = JCS_RGB;
+
+ /* call some jpeg helpers */
+ jpeg_set_defaults(&cinfo);
+ jpeg_set_quality(&cinfo, 100, 1); /*set the quality [0..100] */
+ jpeg_start_compress(&cinfo, 1);
+
+ row_stride = cinfo.image_width;
+
+ /* Convert line by line */
+ while (cinfo.next_scanline < cinfo.image_height) {
+ row_pointer[0] = (JSAMPROW) (image.buf + (cinfo.next_scanline * row_stride));
+ jpeg_write_scanlines(&cinfo, row_pointer, 1);
+ }
+
+ /* Finish compression and free internal memory */
+ jpeg_finish_compress(&cinfo);
+ jpeg_destroy_compress(&cinfo);
+
+ return 0;
+}
+
+
+// Find specific Samsung device
+static void drv_SamsungSPF_find()
+{
+ info("%s: Searching SPF.", Name);
+
+ /* open USB device */
+ struct usb_bus *bus;
+ struct usb_device *dev;
+
+ usb_init();
+ usb_find_busses();
+ usb_find_devices();
+
+ for (bus = usb_busses; bus; bus = bus->next) {
+ for (dev = bus->devices; dev; dev = dev->next) {
+ if (dev->descriptor.idVendor == myFrame->vendorID) {
+ if (dev->descriptor.idProduct == myFrame->productID.storageMode) {
+
+ info("Samsung photoframe in Mass Storage mode found.");
+ myDev = dev;
+
+ return;
+ } else if (dev->descriptor.idProduct == myFrame->productID.monitorMode) {
+
+ info("Samsung photoframe in Custom Product mode found.");
+ myDev = dev;
+
+ return;
+ }
+ }
+ }
+ }
+
+ free(bus);
+ myDev = 0;
+}
+
+
+static int drv_SamsungSPF_open()
+{
+ if (!myDev) {
+ error("%s: No device specified!", Name);
+ return -1;
+ }
+
+ int res = -1;
+ char buf[256];
+
+ if (myDev->descriptor.idProduct == myFrame->productID.storageMode) {
+ info("%s: Opening device and switching to monitor mode", Name);
+
+ myDevHandle = usb_open(myDev);
+
+ setuid(getuid());
+
+ strcpy(buf, "** no string **");
+ res = usb_get_string_simple(myDevHandle, myDev->descriptor.iManufacturer, buf, sizeof(buf));
+ debug("usb_get_string_simple => %d, %s", res, buf);
+
+ memset(buf, 0, 256);
+
+ res = usb_control_msg(myDevHandle, USB_TYPE_STANDARD | USB_ENDPOINT_IN,
+ USB_REQ_GET_DESCRIPTOR, 0xfe, 0xfe, buf, 0xfe, 1000);
+ /* usb_close( myDev ); */
+ // Sleep some time before research
+ sleep(1);
+ drv_SamsungSPF_find();
+ } else
+ info("%s: No device in storage mode found", Name);
+
+ if (myDev->descriptor.idProduct == myFrame->productID.storageMode) {
+ error("%s: Was not able to switch to monitor mode!", Name);
+ return -1;
+ }
+
+ if (myDev->descriptor.idProduct == myFrame->productID.monitorMode) {
+ info("%s: Device '%s' is now in monitor mode.", Name, myFrame->type);
+ myDevHandle = usb_open(myDev);
+ return 0;
+ }
+
+ error("Unknown error: usb_control_msg() = %d", res);
+ return -1;
+}
+
+
+/* dummy function that sends something to the display */
+static int drv_SamsungSPF_send(char *data, unsigned int len)
+{
+ char usb_hdr[12] = { 0xa5, 0x5a, 0x18, 0x04, 0xff, 0xff,
+ 0xff, 0xff, 0x48, 0x00, 0x00, 0x00
+ };
+ char buffer[1] = { 0x0 };
+ int usb_timeout = 1000;
+ int usb_endpoint = 0x2;
+ int ret;
+
+ *(int *) (usb_hdr + 4) = len;
+
+ debug("bytes_to_send: %d, offset: %d", len, 12);
+
+ /* Send USB header */
+ if ((ret = usb_bulk_write(myDevHandle, usb_endpoint, usb_hdr, 12, usb_timeout)) < 0) {
+ error("%s: Error occurred while writing data to device.", Name);
+ error("%s: usb_bulk_write returned: %d", Name, ret);
+ return -1;
+ }
+
+ /* Send JPEG image */
+ if ((ret = usb_bulk_write(myDevHandle, usb_endpoint, data, len, usb_timeout)) < 0) {
+ error("%s: Error occurred while writing data to device.", Name);
+ error("%s: usb_bulk_write returned: %d", Name, ret);
+ return -1;
+ }
+
+ /* Finish transmission by sending zero */
+ if ((ret = usb_bulk_write(myDevHandle, usb_endpoint, buffer, 1, usb_timeout)) < 0) {
+ error("%s: Error occurred while writing data to device.", Name);
+ error("%s: usb_bulk_write returned: %d", Name, ret);
+ return -1;
+ }
+
+ return 0;
+}
+
+
+/* for graphic displays only */
+static void drv_SamsungSPF_blit(const int row, const int col, const int height, const int width)
+{
+ int r, c;
+
+ for (r = row; r < row + height; r++) {
+ for (c = col; c < col + width; c++) {
+ RGB p1 = image.buf[r * myFrame->xRes + c];
+ RGBA p2 = drv_generic_graphic_rgb(r, c);
+ if (p1.R != p2.R || p1.G != p2.G || p1.B != p2.B) {
+ image.buf[r * myFrame->xRes + c].R = p2.R;
+ image.buf[r * myFrame->xRes + c].G = p2.G;
+ image.buf[r * myFrame->xRes + c].B = p2.B;
+ image.dirty = 1;
+ }
+ }
+ }
+}
+
+
+static void drv_SamsungSPF_timer( __attribute__ ((unused))
+ void *notused)
+{
+ if (image.dirty) {
+ debug("FB dirty, writing jpeg...");
+ convert2JPG();
+
+ /* Sent image to display */
+ if ((drv_SamsungSPF_send((char *) jpegImage.buf, jpegImage.size)) != 0) {
+ error("%s: Error occurred while sending jpeg image to device.", Name);
+ }
+ /* Clean dirty bit */
+ image.dirty = 0;
+
+ /* Free JPEG buffer since a new is allocated each time an image is
+ compressed */
+ if (jpegImage.size)
+ free(jpegImage.buf);
+ jpegImage.size = 0;
+ }
+}
+
+
+/* start graphic display */
+static int drv_SamsungSPF_start(const char *section)
+{
+ int timerInterval = 1000;
+ char *s;
+
+ cfg_number(section, "update", timerInterval, 0, -1, &timerInterval);
+ debug("Updating display every %dms", timerInterval);
+
+ DROWS = myFrame->yRes;
+ DCOLS = myFrame->xRes;
+ info("%s: Using SPF with %dx%d pixels.", Name, DCOLS, DROWS);
+
+ s = cfg_get(section, "Font", "6x8");
+ if (s == NULL || *s == '\0') {
+ error("%s: no '%s.Font' entry from %s", Name, section, cfg_source());
+ return -1;
+ }
+
+ XRES = -1;
+ YRES = -1;
+ if (sscanf(s, "%dx%d", &XRES, &YRES) != 2 || XRES < 1 || YRES < 1) {
+ error("%s: bad Font '%s' from %s", Name, s, cfg_source());
+ return -1;
+ }
+
+ if (XRES < 6 || YRES < 8) {
+ error("%s: bad Font '%s' from %s (must be at least 6x8)", Name, s, cfg_source());
+ return -1;
+ }
+ free(s);
+
+ /* Allocate framebuffer */
+ image.fbsize = myFrame->xRes * myFrame->yRes * sizeof(RGB);
+ image.buf = malloc(image.fbsize);
+ memset(image.buf, 128, image.fbsize);
+ image.dirty = 0;
+
+ /* JPEG buffer is allocated by jpeglib */
+ jpegImage.buf = 0;
+ jpegImage.size = 0;
+
+ /* regularly transmit the image */
+ timer_add(drv_SamsungSPF_timer, NULL, timerInterval, 0);
+
+ return 0;
+}
+
+
+
+/****************************************/
+/*** exported functions ***/
+/****************************************/
+
+
+/* list models */
+int drv_SamsungSPF_list(void)
+{
+ int i;
+
+ printf("SamsungSPF driver, supported models [");
+ for (i = 0; i < numFrames; i++) {
+ printf("%s", spfDevices[i].type);
+ if (i < numFrames - 1)
+ printf(", ");
+ }
+ printf("]\n");
+
+ return 0;
+}
+
+
+/* initialize driver & display */
+/* use this function for a graphic display */
+int drv_SamsungSPF_init(const char *section, const int quiet)
+{
+ info("%s: Initializing SPF.", Name);
+
+ char *s;
+ int i;
+
+ myDev = 0;
+ myFrame = 0;
+
+ // Look for model entry in config
+ s = cfg_get(section, "Model", NULL);
+ if (s == NULL || *s != '\0') {
+ s = cfg_get(section, "Model", NULL);
+ if (s == NULL || *s == '\0') {
+
+ drv_SamsungSPF_list();
+ error("%s: no '%s.Model' entry from %s", Name, section, cfg_source());
+ return -1;
+ }
+ }
+ // Look for specified device
+ for (i = 0; i < numFrames; i++) {
+ if (strcasecmp(s, spfDevices[i].type) == 0) {
+ myFrame = &spfDevices[i];
+ info("%s: Configured for model %s.", Name, spfDevices[i].type);
+ break;
+ }
+ }
+
+ if (!myFrame) {
+ drv_SamsungSPF_list();
+ error("%s: unknown model '%s'!", Name, s);
+ return -1;
+ }
+
+ free(s);
+
+ /* try to open USB device */
+ drv_SamsungSPF_find();
+ if (!myDev) {
+ error("%s: No Samsung '%s' found!", Name, myFrame->type);
+ return -1;
+ }
+
+ /* open display and switch to monitor mode if necessary */
+ if (drv_SamsungSPF_open() == -1)
+ return -1;
+
+ int ret;
+
+ /* real worker functions */
+ drv_generic_graphic_real_blit = drv_SamsungSPF_blit;
+
+ /* start display */
+ if ((ret = drv_SamsungSPF_start(section)) != 0)
+ return ret;
+
+ /* initialize generic graphic driver */
+ if ((ret = drv_generic_graphic_init(section, Name)) != 0)
+ return ret;
+
+ if (!quiet) {
+ char buffer[40];
+ qprintf(buffer, sizeof(buffer), "%s %dx%d", Name, DCOLS, DROWS);
+ if (drv_generic_graphic_greet(buffer, NULL)) {
+ sleep(3);
+ drv_generic_graphic_clear();
+ }
+ }
+
+ return 0;
+}
+
+
+/* close driver & display */
+/* use this function for a graphic display */
+int drv_SamsungSPF_quit(const int quiet)
+{
+
+ info("%s: shutting down.", Name);
+
+ /* clear display */
+ drv_generic_graphic_clear();
+
+ /* say goodbye... */
+ if (!quiet) {
+ drv_generic_graphic_greet("goodbye!", NULL);
+ }
+
+ drv_generic_graphic_quit();
+
+ debug("closing connection");
+ printf("%s: Closing driver...\n", Name);
+ usb_close(myDevHandle);
+ free(myDev);
+ free(myDevHandle);
+
+ return (0);
+}
+
+
+/* use this one for a graphic display */
+DRIVER drv_SamsungSPF = {
+ .name = Name,
+ .list = drv_SamsungSPF_list,
+ .init = drv_SamsungSPF_init,
+ .quit = drv_SamsungSPF_quit,
+};
diff --git a/drv_ShuttleVFD.c b/drv_ShuttleVFD.c
new file mode 100644
index 0000000..24fc434
--- /dev/null
+++ b/drv_ShuttleVFD.c
@@ -0,0 +1,429 @@
+/* $Id: drv_Sample.c 975 2009-01-18 11:16:20Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/drv_Sample.c $
+ *
+ * Shuttle SG33G5M VFD lcd4linux driver
+ *
+ * Copyright (C) 2009 Matthieu Crapet <mcrapet@gmail.com>
+ * based on the USBLCD driver.
+ *
+ * Shuttle SG33G5M VFD (20x1 character display. Each character cell is 5x8 pixels)
+ * - The display is driven by Princeton Technologies PT6314 VFD controller
+ * - Cypress CY7C63723C (receives USB commands and talk to VFD controller)
+ *
+ * LCD "prococol" : each message has a length of 8 bytes
+ * - 1 nibble: command (0x1, 0x3, 0x7, 0x9, 0xD)
+ * - 0x1 : clear text and icons (len=1)
+ * - 0x7 : icons (len=4)
+ * - 0x9 : text (len=7)
+ * - 0xD : set clock data (len=7)
+ * - 0x3 : display clock (internal feature) (len=1)
+ * - 1 nibble: message length (0-7)
+ * - 7 bytes : message data
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ *
+ * exported fuctions:
+ *
+ * struct DRIVER drv_ShuttleVFD
+ *
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+
+#ifdef HAVE_USB_H
+#include <usb.h>
+#else
+#error "ShuttleVFD: libusb required"
+#endif
+
+#include "debug.h"
+#include "cfg.h"
+#include "qprintf.h"
+#include "udelay.h"
+#include "plugin.h"
+#include "widget.h"
+#include "widget_text.h"
+#include "widget_bar.h" // for DIRECTION
+#include "drv.h"
+#include "drv_generic_text.h"
+#include "drv_generic_gpio.h"
+
+
+/*
+ * Some hardware definitions
+ */
+// VFD USB properties
+#define SHUTTLE_VFD_VENDOR_ID 0x051C
+#define SHUTTLE_VFD_PRODUCT_ID1 0x0003
+#define SHUTTLE_VFD_PRODUCT_ID2 0x0005 // IR-receiver included
+#define SHUTTLE_VFD_INTERFACE_NUM 1
+
+// VFD physical dimensions
+#define SHUTTLE_VFD_WIDTH 20
+#define SHUTTLE_VFD_HEIGHT 1
+
+// VFD USB control message
+#define SHUTTLE_VFD_PACKET_SIZE 8
+#define SHUTTLE_VFD_DATA_SIZE (SHUTTLE_VFD_PACKET_SIZE-1)
+#define SHUTTLE_VFD_SUCCESS_SLEEP_USEC 25600
+
+
+/* Global static data */
+static char Name[] = "ShuttleVFD";
+static usb_dev_handle *lcd;
+static unsigned char buffer[SHUTTLE_VFD_PACKET_SIZE];
+
+/* Issues with the display module:
+ * - Can't set cursor position. Must save full buffer here.
+ * - Can't get icons status (on or off). Must save status here.
+ * - Clear command also clear text AND icons.
+ */
+static unsigned char fb[SHUTTLE_VFD_WIDTH * SHUTTLE_VFD_HEIGHT];
+static unsigned icons;
+
+
+/****************************************/
+/*** hardware dependant functions ***/
+/****************************************/
+
+/* look for device on USB bus */
+static int drv_ShuttleVFD_open(void)
+{
+ struct usb_bus *bus;
+ struct usb_device *dev;
+
+ int vendor_id = SHUTTLE_VFD_VENDOR_ID;
+ int interface = SHUTTLE_VFD_INTERFACE_NUM;
+
+ lcd = NULL;
+
+ usb_init();
+ usb_find_busses();
+ usb_find_devices();
+
+ for (bus = usb_get_busses(); bus != NULL; bus = bus->next) {
+ for (dev = bus->devices; dev != NULL; dev = dev->next) {
+ if (dev->descriptor.idVendor == vendor_id && ((dev->descriptor.idProduct == SHUTTLE_VFD_PRODUCT_ID1) ||
+ (dev->descriptor.idProduct == SHUTTLE_VFD_PRODUCT_ID2))) {
+
+ unsigned int v = dev->descriptor.bcdDevice;
+
+ info("%s: found ShuttleVFD V%1d%1d.%1d%1d on bus %s device %s", Name,
+ (v & 0xF000) >> 12, (v & 0xF00) >> 8, (v & 0xF0) >> 4, (v & 0xF), bus->dirname, dev->filename);
+
+ lcd = usb_open(dev);
+ }
+ }
+ }
+
+ if (lcd != NULL) {
+ if (usb_claim_interface(lcd, interface) < 0) {
+ usb_close(lcd);
+ error("%s: usb_claim_interface() failed!", Name);
+ error("%s: root permissions maybe required?", Name);
+ return -1;
+ }
+ } else {
+ error("%s: could not find ShuttleVFD", Name);
+ return -1;
+ }
+
+ return 0;
+}
+
+
+static int drv_ShuttleVFD_close(void)
+{
+ int interface = SHUTTLE_VFD_INTERFACE_NUM;
+
+ usb_release_interface(lcd, interface);
+ usb_close(lcd);
+ return 0;
+}
+
+
+static void drv_ShuttleVFD_send(unsigned char packet[SHUTTLE_VFD_PACKET_SIZE])
+{
+ if (usb_control_msg(lcd, 0x21, // requesttype
+ 0x09, // request
+ 0x0200, // value
+ 0x0001, // index
+ (char *) packet, SHUTTLE_VFD_PACKET_SIZE, 100) == SHUTTLE_VFD_PACKET_SIZE) {
+
+ udelay(SHUTTLE_VFD_SUCCESS_SLEEP_USEC);
+ } else {
+ debug("usb_control_msg failed");
+ }
+}
+
+
+/* Clear full display and icons. */
+static void drv_ShuttleVFD_clear(void)
+{
+ // Update local framebuffer mirror
+ memset(fb, ' ', SHUTTLE_VFD_HEIGHT * SHUTTLE_VFD_WIDTH);
+
+ buffer[0] = (1 << 4) + 1;
+ buffer[1] = 0x1;
+ drv_ShuttleVFD_send(buffer);
+}
+
+
+static void drv_ShuttleVFD_reset_cursor(void)
+{
+ buffer[0] = (1 << 4) + 1;
+ buffer[1] = 0x2;
+ drv_ShuttleVFD_send(buffer);
+}
+
+
+/* text mode displays only */
+static void drv_ShuttleVFD_write(const int row, const int col, const char *data, int len)
+{
+ unsigned char *p;
+ int i;
+
+ // Update local framebuffer mirror
+ memcpy(fb + (row * SHUTTLE_VFD_WIDTH) + col, data, len);
+
+ p = fb;
+ len = SHUTTLE_VFD_WIDTH;
+
+ drv_ShuttleVFD_reset_cursor();
+
+ while (len > 0) {
+ if (len > 7)
+ buffer[0] = (9 << 4) + 7;
+ else
+ buffer[0] = (9 << 4) + len;
+
+ for (i = 0; i < 7 && len--; i++) {
+ buffer[i + 1] = *p++;
+ }
+
+ drv_ShuttleVFD_send(buffer);
+ }
+}
+
+
+static void drv_ShuttleVFD_defchar(const int ascii, const unsigned char *matrix)
+{
+ (void) matrix;
+ debug("%s: not available (ascii=%d)", Name, ascii);
+}
+
+
+static int drv_ShuttleVFD_start(const char *section)
+{
+ char *port;
+
+ port = cfg_get(section, "Port", NULL);
+
+ if (port == NULL || *port == '\0') {
+ error("%s: no '%s.Port' entry from %s", Name, section, cfg_source());
+ return -1;
+ }
+
+ if (strcasecmp(port, "libusb") != 0) {
+ error("%s: libusb expected", Name);
+ error("%s: compile lcd4linux with libusb support!", Name);
+ return -1;
+ }
+
+ DROWS = SHUTTLE_VFD_HEIGHT;
+ DCOLS = SHUTTLE_VFD_WIDTH;
+
+ /* open communication with the display */
+ if (drv_ShuttleVFD_open() < 0) {
+ return -1;
+ }
+
+ drv_ShuttleVFD_clear(); /* clear display */
+ return 0;
+}
+
+
+/* VFD Icons. Add +1 in lcd4linux.conf (GPO1..GPIO27)
+ * 0: television
+ * 1: cd/dvd
+ * 2: music
+ * 3: radio
+ * 4: clock
+ * 5: pause
+ * 6: play
+ * 7: record
+ * 8: rewind
+ * 9: camera
+ * 10: mute
+ * 11: repeat
+ * 12: reverse
+ * 13: fastforward
+ * 14: stop
+ * 15: volume 1
+ * 16: volume 2
+ * ...
+ * 25: volume 11
+ * 26: volume 12
+ */
+static int drv_ShuttleVFD_icons_set(const int num, const int val)
+{
+ unsigned long value;
+
+ if (num < 0 || num >= 27) {
+ info("%s: num %d out of range (1..27)", Name, num);
+ return -1;
+ }
+ // Special case for volume (icon n°16)
+ if (num >= 15)
+ value = (num - 15 + 1) << 15;
+ else
+ value = 1 << num;
+
+ if (val > 0)
+ icons |= value;
+ else
+ icons &= ~value;
+
+ buffer[0] = (7 << 4) + 4;
+ buffer[1] = (value >> 15) & 0x1F;
+ buffer[2] = (value >> 10) & 0x1F;
+ buffer[3] = (value >> 5) & 0x1F;
+ buffer[4] = value & 0x1F; // each data byte is stored on 5 bits
+ drv_ShuttleVFD_send(buffer);
+
+ return 0;
+}
+
+
+/****************************************/
+/*** plugins ***/
+/****************************************/
+
+/* none yet ! */
+
+
+/****************************************/
+/*** widget callbacks ***/
+/****************************************/
+
+/* using drv_generic_text_draw(W) */
+/* using drv_generic_gpio_draw(W) */
+
+
+/****************************************/
+/*** exported functions ***/
+/****************************************/
+
+
+/* supported Shuttle models */
+int drv_ShuttleVFD_list(void)
+{
+ printf("Shuttle SG33G5M, Shuttle PF27 upgrade kit");
+ return 0;
+}
+
+
+/* initialize driver & text display */
+int drv_ShuttleVFD_init(const char *section, const int quiet)
+{
+ WIDGET_CLASS wc;
+ int ret;
+
+ info("%s: %s", Name, "$Rev: 975 $");
+
+ /* display preferences */
+ XRES = 5; /* pixel width of one char */
+ YRES = 8; /* pixel height of one char */
+ CHARS = 0; /* number of user-defineable characters */
+ CHAR0 = 0; /* ASCII of first user-defineable char */
+ GOTO_COST = 2; /* number of bytes a goto command requires */
+ GPOS = 15 + 12; /* Fancy icons on top of display */
+
+ /* real worker functions */
+ drv_generic_text_real_write = drv_ShuttleVFD_write;
+ drv_generic_text_real_defchar = drv_ShuttleVFD_defchar;
+ drv_generic_gpio_real_set = drv_ShuttleVFD_icons_set;
+
+ /* start display */
+ if ((ret = drv_ShuttleVFD_start(section)) != 0)
+ return ret;
+
+ if (!quiet) {
+ char buffer[40];
+ qprintf(buffer, sizeof(buffer), "%s %dx%d", Name, DCOLS, DROWS);
+ if (drv_generic_text_greet(buffer, "Shuttle")) {
+ sleep(3);
+ drv_ShuttleVFD_clear();
+ }
+ }
+
+ /* initialize generic text driver */
+ if ((ret = drv_generic_text_init(section, Name)) != 0)
+ return ret;
+
+ /* initialize generic GPIO driver */
+ if ((ret = drv_generic_gpio_init(section, Name)) != 0)
+ return ret;
+
+ /* register text widget */
+ wc = Widget_Text;
+ wc.draw = drv_generic_text_draw;
+ widget_register(&wc);
+
+ return 0;
+}
+
+
+/* close driver & text display */
+int drv_ShuttleVFD_quit(const int quiet)
+{
+ info("%s: shutting down.", Name);
+
+ /* clear display */
+ drv_ShuttleVFD_clear();
+
+ /* say goodbye... */
+ if (!quiet) {
+ drv_generic_text_greet("goodbye!", NULL);
+ }
+
+ drv_generic_text_quit();
+ drv_generic_gpio_quit();
+
+ debug("closing connection");
+ drv_ShuttleVFD_close();
+
+ return (0);
+}
+
+
+DRIVER drv_ShuttleVFD = {
+ .name = Name,
+ .list = drv_ShuttleVFD_list,
+ .init = drv_ShuttleVFD_init,
+ .quit = drv_ShuttleVFD_quit,
+};
diff --git a/drv_SimpleLCD.c b/drv_SimpleLCD.c
new file mode 100644
index 0000000..f308d87
--- /dev/null
+++ b/drv_SimpleLCD.c
@@ -0,0 +1,350 @@
+/* $Id: drv_SimpleLCD.c 771 2007-02-25 12:27:26Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/drv_SimpleLCD.c $
+ *
+ * driver for a simple serial terminal.
+ *
+ * Copyright (C) 2005 Julien Aube <ob@obconseil.net>
+ * Copyright (C) 2005 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ * This driver simply send out caracters on the serial port, without any
+ * formatting instructions for a particular LCD device.
+ * This is useful for custom boards of for very simple LCD.
+ *
+ * I use it for tests on a custom-made board based on a AVR microcontroler
+ * and also for driver a Point-of-Sale text-only display.
+ * I assume the following :
+ * - CR (0x0d) Return to the begining of the line without erasing,
+ * - LF (0x0a) Initiate a new line (but without sending the cursor to
+ * the begining of the line)
+ * - BS (0x08) Move the cursor to the previous caracter (but does no erase it).
+ * - It's not possible to return to the first line. Thus a back buffer is used
+ * in this driver.
+ *
+ * ******** UPDATE *********
+ * I have added a "VT-100 Compatible mode" that allows the driver to support
+ * control-sequence code. This greatly reduce flickering and eliminate the need
+ * for the back-buffer. But it is optional since all displays cannot support them.
+ * Here are the codes:
+ * Delete the display (but does not move the cursor) :
+ * "ESC [ 2 J" (0x1b 0x5b 0x32 0x4a)
+ * Position the cursor :
+ * "ESC [ YY ; XX H" ( 0x1b 0x5b YY 0x3b XX 0x48 ) where YY is the ascii for the line
+ * number, and XX is the ascii for the column number ( first line/column is '1', not zero)
+ * Delete to the end of line from current cursor position :
+ * "ESC [ 0 K" ( 0x1b 0x5b 0x30 0x4b )
+ * Set Country Code :
+ * "ESC R NN" (0x1b 0x52 NN) where NN is the country code *in byte, NOT ascii*.
+ * The default is 0 (USA), see below for specific countries.
+ * the list of accessible characters page are available on this page :
+ * http://www.wincor-nixdorf.com/internet/com/Services/Support/TechnicalSupport/POSSystems
+ * /Manuals/BAxx/index.html
+ * Get the display identification : (Doesn't work reliably, timing issues here)
+ * "ESC [ 0 c" ( 0x1b 0x5b 0x30 0x63). Return a string which look like this :
+ * ESC [ ? M ; NN ; OO ; PP ; QQ c) where M is type of display (2 for VFD),
+ * NN is the rom version, 00 is the current caracter set, PP is the number of lines and
+ * QQ the number of colomns.
+ *
+ *
+ * A "bar" capability is now provided if the config file has a "BarCharValue" parameter in it.
+ *
+ * The code come mostly taken from the LCDTerm driver in LCD4Linux, from
+ * Michaels Reinelt, many thanks to him.
+ *
+ * This driver is released under the GPL.
+ */
+
+/*
+ *
+ * exported fuctions:
+ *
+ * struct DRIVER drv_SimpleLCD
+ *
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+
+#include "debug.h"
+#include "cfg.h"
+#include "qprintf.h"
+#include "plugin.h"
+#include "widget.h"
+#include "widget_text.h"
+#include "widget_icon.h"
+#include "widget_bar.h"
+#include "drv.h"
+#include "drv_generic_text.h"
+#include "drv_generic_serial.h"
+
+
+static char Name[] = "SimpleLCD";
+static char *backbuffer = 0;
+static int backbuffer_size = 0;
+static int vt100_mode = 0;
+static unsigned char bar_char = 0;
+
+/****************************************/
+/*** hardware dependant functions ***/
+/****************************************/
+
+/** No clear function on SimpleLCD : Just send CR-LF * number of lines **/
+static void drv_SL_simple_clear(void)
+{
+ char cmd[2];
+ int i;
+ cmd[0] = '\r';
+ cmd[1] = '\n';
+ for (i = 0; i < DROWS; ++i) {
+ drv_generic_serial_write(cmd, 2);
+ }
+ memset(backbuffer, ' ', backbuffer_size);
+}
+
+/** vt-100 mode : send the ESC-code **/
+static void drv_SL_vt100_clear(void)
+{
+ char cmd[4];
+ cmd[0] = 0x1b;
+ cmd[1] = '[';
+ cmd[2] = '2';
+ cmd[3] = 'J';
+ drv_generic_serial_write(cmd, 4);
+
+}
+
+static void drv_SL_clear(void)
+{
+ vt100_mode == 1 ? drv_SL_vt100_clear() : drv_SL_simple_clear();
+}
+
+
+/* If full_commit = true, then the whole buffer is to be sent to screen.
+ if full_commit = false, then only the last line is to be sent (faster on slow screens)
+*/
+
+static void drv_SL_commit(int full_commit)
+{
+ int row;
+ char cmd[2] = { '\r', '\n' };
+ if (full_commit) {
+ for (row = 0; row < DROWS; row++) {
+ drv_generic_serial_write(cmd, 2);
+ drv_generic_serial_write(backbuffer + (DCOLS * row), DCOLS);
+ }
+ } else {
+ drv_generic_serial_write(cmd, 1); /* Go to the beginning of the line only */
+ drv_generic_serial_write(backbuffer + (DCOLS * (DROWS - 1)), DCOLS);
+ }
+}
+
+static void drv_SL_simple_write(const int row, const int col, const char *data, int len)
+{
+ memcpy(backbuffer + (row * DCOLS) + col, data, len);
+ if (row == DROWS - 1)
+ drv_SL_commit(0);
+ else
+ drv_SL_commit(1);
+}
+
+static void drv_SL_vt100_write(const int row, const int col, const char *data, int len)
+{
+ char cmd[8];
+ cmd[0] = 0x1b;
+ cmd[1] = '[';
+ cmd[2] = row + '1';
+ cmd[3] = ';';
+ cmd[4] = (col / 10) + '0';
+ cmd[5] = (col % 10) + '1';
+ cmd[6] = 'H';
+ drv_generic_serial_write(cmd, 7);
+ drv_generic_serial_write(data, len);
+}
+
+
+static int drv_SL_start(const char *section, const int quiet)
+{
+ int rows = -1, cols = -1;
+ int value;
+ unsigned int flags = 0;
+ char *s;
+ char *model = 0;
+
+ vt100_mode = 0;
+ model = cfg_get(section, "Model", "generic");
+ if (model != NULL && *model != '\0') {
+ if (strcasecmp("vt100", model) == 0)
+ vt100_mode = 1;
+ }
+
+ cfg_number(section, "BarCharValue", 0, 0, 255, &value);
+ bar_char = value;
+ cfg_number(section, "Options", 0, 0, 0xffff, &value);
+ flags = value;
+ if (drv_generic_serial_open(section, Name, flags) < 0)
+ return -1;
+
+ s = cfg_get(section, "Size", NULL);
+ if (s == NULL || *s == '\0') {
+ error("%s: no '%s.Size' entry from %s", Name, section, cfg_source());
+ return -1;
+ }
+ if (sscanf(s, "%dx%d", &cols, &rows) != 2 || rows < 1 || cols < 1) {
+ error("%s: bad %s.Size '%s' from %s", Name, section, s, cfg_source());
+ free(s);
+ return -1;
+ }
+
+ DROWS = rows;
+ DCOLS = cols;
+
+ if (!vt100_mode) {
+ backbuffer_size = DROWS * DCOLS;
+ backbuffer = malloc(backbuffer_size);
+ if (!backbuffer) {
+ return -1;
+ }
+ }
+
+ /* real worker functions */
+ if (vt100_mode) {
+ drv_generic_text_real_write = drv_SL_vt100_write;
+ } else {
+ drv_generic_text_real_write = drv_SL_simple_write;
+ }
+
+ drv_SL_clear(); /* clear */
+
+
+ if (!quiet) {
+ char buffer[40];
+ qprintf(buffer, sizeof(buffer), "%s %dx%d", Name, DCOLS, DROWS);
+ if (drv_generic_text_greet(buffer, NULL)) {
+ sleep(3);
+ drv_SL_clear();
+ }
+ }
+
+ return 0;
+}
+
+
+/****************************************/
+/*** plugins ***/
+/****************************************/
+
+/* none */
+
+
+/****************************************/
+/*** widget callbacks ***/
+/****************************************/
+
+
+/* using drv_generic_text_draw(W) */
+
+
+/****************************************/
+/*** exported functions ***/
+/****************************************/
+
+
+/* list models */
+int drv_SL_list(void)
+{
+ printf("generic vt100");
+ return 0;
+}
+
+
+/* initialize driver & display */
+int drv_SL_init(const char *section, const int quiet)
+{
+ WIDGET_CLASS wc;
+ int ret;
+
+ info("%s: %s", Name, "$Rev: 771 $");
+
+ /* display preferences */
+ XRES = 5; /* pixel width of one char */
+ YRES = 8; /* pixel height of one char */
+ CHARS = 0; /* number of user-defineable characters */
+ CHAR0 = 0; /* ASCII of first user-defineable char */
+
+ GOTO_COST = -1; /* number of bytes a goto command requires */
+
+
+ /* start display */
+ if ((ret = drv_SL_start(section, quiet)) != 0)
+ return ret;
+
+ /* initialize generic text driver */
+ if ((ret = drv_generic_text_init(section, Name)) != 0)
+ return ret;
+
+ /* register text widget */
+ wc = Widget_Text;
+ wc.draw = drv_generic_text_draw;
+ widget_register(&wc);
+
+ /* register plugins */
+ /* none */
+
+ return 0;
+}
+
+
+/* close driver & display */
+int drv_SL_quit(const int quiet)
+{
+
+ info("%s: shutting down.", Name);
+
+ drv_generic_text_quit();
+
+ /* clear display */
+ drv_SL_clear();
+
+ /* say goodbye... */
+ if (!quiet) {
+ drv_generic_text_greet("goodbye!", NULL);
+ }
+
+ drv_generic_serial_close();
+
+ if (backbuffer) {
+ free(backbuffer);
+ backbuffer = 0;
+ backbuffer_size = 0;
+ }
+ return (0);
+}
+
+
+DRIVER drv_SimpleLCD = {
+ .name = Name,
+ .list = drv_SL_list,
+ .init = drv_SL_init,
+ .quit = drv_SL_quit,
+};
diff --git a/drv_T6963.c b/drv_T6963.c
new file mode 100644
index 0000000..40fd6db
--- /dev/null
+++ b/drv_T6963.c
@@ -0,0 +1,576 @@
+/* $Id: drv_T6963.c 1136 2010-11-28 16:07:16Z mzuther $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/drv_T6963.c $
+ *
+ * new style driver for T6963-based displays
+ *
+ * Copyright (C) 2003 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ *
+ * exported fuctions:
+ *
+ * struct DRIVER drv_T6963
+ *
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <unistd.h>
+#include <termios.h>
+#include <fcntl.h>
+#include <sys/time.h>
+
+#include "debug.h"
+#include "cfg.h"
+#include "qprintf.h"
+#include "udelay.h"
+#include "plugin.h"
+#include "drv.h"
+#include "drv_generic_graphic.h"
+#include "drv_generic_parport.h"
+
+#ifdef WITH_DMALLOC
+#include <dmalloc.h>
+#endif
+
+static char Name[] = "T6963";
+static int Model;
+
+typedef struct {
+ int type;
+ char *name;
+} MODEL;
+
+static MODEL Models[] = {
+ {0x01, "T6963"},
+ {0xff, "Unknown"}
+};
+
+
+/* font width of display */
+static int CELL;
+
+/* text rows/columns */
+static int TROWS, TCOLS;
+
+/* SingleScan or DualScan */
+static int DualScan = 0;
+
+/* Timings */
+static int T_ACC, T_OH, T_PW, T_DH, T_CDS;
+
+/* soft-wiring */
+static unsigned char SIGNAL_CE;
+static unsigned char SIGNAL_CD;
+static unsigned char SIGNAL_RD;
+static unsigned char SIGNAL_WR;
+
+unsigned char *Buffer1, *Buffer2;
+
+static int bug = 0;
+
+
+/****************************************/
+/*** hardware dependant functions ***/
+/****************************************/
+
+/* perform normal status check */
+static void drv_T6_status1(void)
+{
+ int n;
+
+ /* turn off data line drivers */
+ drv_generic_parport_direction(1);
+
+ /* lower CE and RD */
+ drv_generic_parport_control(SIGNAL_CE | SIGNAL_RD, 0);
+
+ /* Access Time */
+ ndelay(T_ACC);
+
+ /* wait for STA0=1 and STA1=1 */
+ n = 0;
+ do {
+ rep_nop();
+ if (++n > 1000) {
+ debug("hang in status1");
+ bug = 1;
+ break;
+ }
+ } while ((drv_generic_parport_read() & 0x03) != 0x03);
+
+ /* rise RD and CE */
+ drv_generic_parport_control(SIGNAL_RD | SIGNAL_CE, SIGNAL_RD | SIGNAL_CE);
+
+ /* Output Hold Time */
+ ndelay(T_OH);
+
+ /* turn on data line drivers */
+ drv_generic_parport_direction(0);
+}
+
+
+/* perform status check in "auto mode" */
+static void drv_T6_status2(void)
+{
+ int n;
+
+ /* turn off data line drivers */
+ drv_generic_parport_direction(1);
+
+ /* lower RD and CE */
+ drv_generic_parport_control(SIGNAL_RD | SIGNAL_CE, 0);
+
+ /* Access Time */
+ ndelay(T_ACC);
+
+ /* wait for STA3=1 */
+ n = 0;
+ do {
+ rep_nop();
+ if (++n > 1000) {
+ debug("hang in status2");
+ bug = 1;
+ break;
+ }
+ } while ((drv_generic_parport_read() & 0x08) != 0x08);
+
+ /* rise RD and CE */
+ drv_generic_parport_control(SIGNAL_RD | SIGNAL_CE, SIGNAL_RD | SIGNAL_CE);
+
+ /* Output Hold Time */
+ ndelay(T_OH);
+
+ /* turn on data line drivers */
+ drv_generic_parport_direction(0);
+}
+
+
+static void drv_T6_write_cmd(const unsigned char cmd)
+{
+ /* wait until the T6963 is idle */
+ drv_T6_status1();
+
+ /* put data on DB1..DB8 */
+ drv_generic_parport_data(cmd);
+
+ /* lower WR and CE */
+ drv_generic_parport_control(SIGNAL_WR | SIGNAL_CE, 0);
+
+ /* Pulse width */
+ ndelay(T_PW);
+
+ /* rise WR and CE */
+ drv_generic_parport_control(SIGNAL_WR | SIGNAL_CE, SIGNAL_WR | SIGNAL_CE);
+
+ /* Data Hold Time */
+ ndelay(T_DH);
+}
+
+
+static void drv_T6_write_data(const unsigned char data)
+{
+ /* wait until the T6963 is idle */
+ drv_T6_status1();
+
+ /* put data on DB1..DB8 */
+ drv_generic_parport_data(data);
+
+ /* lower C/D */
+ drv_generic_parport_control(SIGNAL_CD, 0);
+
+ /* C/D Setup Time */
+ ndelay(T_CDS);
+
+ /* lower WR and CE */
+ drv_generic_parport_control(SIGNAL_WR | SIGNAL_CE, 0);
+
+ /* Pulse Width */
+ ndelay(T_PW);
+
+ /* rise WR and CE */
+ drv_generic_parport_control(SIGNAL_WR | SIGNAL_CE, SIGNAL_WR | SIGNAL_CE);
+
+ /* Data Hold Time */
+ ndelay(T_DH);
+
+ /* rise CD */
+ drv_generic_parport_control(SIGNAL_CD, SIGNAL_CD);
+}
+
+
+static void drv_T6_write_auto(const unsigned char data)
+{
+ /* wait until the T6963 is idle */
+ drv_T6_status2();
+
+ /* put data on DB1..DB8 */
+ drv_generic_parport_data(data);
+
+ /* lower C/D */
+ drv_generic_parport_control(SIGNAL_CD, 0);
+
+ /* C/D Setup Time */
+ ndelay(T_CDS);
+
+ /* lower WR and CE */
+ drv_generic_parport_control(SIGNAL_WR | SIGNAL_CE, 0);
+
+ /* Pulse Width */
+ ndelay(T_PW);
+
+ /* rise WR and CE */
+ drv_generic_parport_control(SIGNAL_WR | SIGNAL_CE, SIGNAL_WR | SIGNAL_CE);
+
+ /* Data Hold Time */
+ ndelay(T_DH);
+
+ /* rise CD */
+ drv_generic_parport_control(SIGNAL_CD, SIGNAL_CD);
+}
+
+
+#if 0 /* not used */
+static void drv_T6_send_byte(const unsigned char cmd, const unsigned char data)
+{
+ drv_T6_write_data(data);
+ drv_T6_write_cmd(cmd);
+}
+#endif
+
+static void drv_T6_send_word(const unsigned char cmd, const unsigned short data)
+{
+ drv_T6_write_data(data & 0xff);
+ drv_T6_write_data(data >> 8);
+ drv_T6_write_cmd(cmd);
+}
+
+
+static void drv_T6_clear(const unsigned short addr, const int len)
+{
+ int i;
+
+ drv_T6_send_word(0x24, addr); /* Set Adress Pointer */
+ drv_T6_write_cmd(0xb0); /* Set Data Auto Write */
+ for (i = 0; i < len; i++) {
+ drv_T6_write_auto(0x0);
+ if (bug) {
+ bug = 0;
+ debug("bug occurred at byte %d of %d", i, len);
+ }
+ }
+ drv_T6_status2();
+ drv_T6_write_cmd(0xb2); /* Auto Reset */
+}
+
+
+static void drv_T6_copy(const unsigned short addr, const unsigned char *data, const int len)
+{
+ int i;
+
+ drv_T6_send_word(0x24, addr); /* Set Adress Pointer */
+ drv_T6_write_cmd(0xb0); /* Set Data Auto Write */
+ for (i = 0; i < len; i++) {
+ drv_T6_write_auto(*(data++));
+ if (bug) {
+ bug = 0;
+ debug("bug occurred at byte %d of %d, addr=%d", i, len, addr);
+ }
+ }
+ drv_T6_status2();
+ drv_T6_write_cmd(0xb2); /* Auto Reset */
+}
+
+
+static void drv_T6_blit(const int row, const int col, const int height, const int width)
+{
+ int r, c, a, b;
+ int i, j, e, n;
+ int base;
+
+ for (r = row; r < row + height; r++) {
+ for (c = col; c < col + width; c++) {
+ unsigned char mask = 1 << (CELL - 1 - c % CELL);
+ if (drv_generic_graphic_black(r, c)) {
+ /* set bit */
+ Buffer1[(r * DCOLS + c) / CELL] |= mask;
+ } else {
+ /* clear bit */
+ Buffer1[(r * DCOLS + c) / CELL] &= ~mask;
+ }
+ }
+ a = (r * DCOLS + col) / CELL;
+ b = (r * DCOLS + col + width + CELL - 1) / CELL;
+ for (i = a; i <= b; i++) {
+ if (Buffer1[i] == Buffer2[i])
+ continue;
+ for (j = i, e = 0; i <= b; i++) {
+ if (Buffer1[i] == Buffer2[i]) {
+ if (++e > 4)
+ break;
+ } else {
+ e = 0;
+ }
+ }
+ if (DualScan && r >= DROWS / 2) {
+ base = 0x8200 - DCOLS * DROWS / 2 / CELL;
+ } else {
+ base = 0x0200;
+ }
+ n = i - j - e + 1;
+ memcpy(Buffer2 + j, Buffer1 + j, n);
+ drv_T6_copy(base + j, Buffer1 + j, n);
+ }
+ }
+}
+
+
+static int drv_T6_start(const char *section)
+{
+ char *model, *s;
+
+ model = cfg_get(section, "Model", "generic");
+ if (model != NULL && *model != '\0') {
+ int i;
+ for (i = 0; Models[i].type != 0xff; i++) {
+ if (strcasecmp(Models[i].name, model) == 0)
+ break;
+ }
+ if (Models[i].type == 0xff) {
+ error("%s: %s.Model '%s' is unknown from %s", Name, section, model, cfg_source());
+ return -1;
+ }
+ Model = i;
+ } else {
+ error("%s: empty '%s.Model' entry from %s", Name, section, cfg_source());
+ return -1;
+ }
+
+ /* read display size from config */
+ s = cfg_get(section, "Size", NULL);
+ if (s == NULL || *s == '\0') {
+ error("%s: no '%s.Size' entry from %s", Name, section, cfg_source());
+ return -1;
+ }
+
+ DROWS = -1;
+ DCOLS = -1;
+ if (sscanf(s, "%dx%d", &DCOLS, &DROWS) != 2 || DCOLS < 1 || DROWS < 1) {
+ error("%s: bad Size '%s' from %s", Name, s, cfg_source());
+ return -1;
+ }
+
+ if (sscanf(s = cfg_get(section, "font", "6x8"), "%dx%d", &XRES, &YRES) != 2 || XRES < 1 || YRES < 1) {
+ error("%s: bad %s.Font '%s' from %s", Name, section, s, cfg_source());
+ free(s);
+ return -1;
+ }
+ free(s);
+
+
+ /* get font width of display */
+ cfg_number(section, "Cell", 6, 5, 8, &CELL);
+
+ TROWS = DROWS / 8; /* text rows */
+ TCOLS = DCOLS / CELL; /* text columns */
+
+ /* get DualScan mode */
+ cfg_number(section, "DualScan", 0, 0, 1, &DualScan);
+
+ info("%s: %dx%d %sScan %d bits/cell", Name, DCOLS, DROWS, DualScan ? "Dual" : "Single", CELL);
+
+ Buffer1 = malloc(TCOLS * DROWS);
+ if (Buffer1 == NULL) {
+ error("%s: framebuffer #1 could not be allocated: malloc() failed", Name);
+ return -1;
+ }
+
+ Buffer2 = malloc(TCOLS * DROWS);
+ if (Buffer2 == NULL) {
+ error("%s: framebuffer #2 could not be allocated: malloc() failed", Name);
+ return -1;
+ }
+
+ memset(Buffer1, 0, TCOLS * DROWS * sizeof(*Buffer1));
+ memset(Buffer2, 0, TCOLS * DROWS * sizeof(*Buffer2));
+
+ if (drv_generic_parport_open(section, Name) != 0) {
+ error("%s: could not initialize parallel port!", Name);
+ return -1;
+ }
+
+ /* soft-wiring */
+ if ((SIGNAL_CE = drv_generic_parport_wire_ctrl("CE", "STROBE")) == 0xff)
+ return -1;
+ if ((SIGNAL_CD = drv_generic_parport_wire_ctrl("CD", "SLCTIN")) == 0xff)
+ return -1;
+ if ((SIGNAL_RD = drv_generic_parport_wire_ctrl("RD", "AUTOFD")) == 0xff)
+ return -1;
+ if ((SIGNAL_WR = drv_generic_parport_wire_ctrl("WR", "INIT")) == 0xff)
+ return -1;
+
+ /* timings */
+ T_ACC = timing(Name, section, "ACC", 150, "ns"); /* Access Time */
+ T_OH = timing(Name, section, "OH", 50, "ns"); /* Output Hold Time */
+ T_PW = timing(Name, section, "PW", 80, "ns"); /* CE, RD, WR Pulse Width */
+ T_DH = timing(Name, section, "DH", 40, "ns"); /* Data Hold Time */
+ T_CDS = timing(Name, section, "CDS", 100, "ns"); /* C/D Setup Time */
+
+
+ /* rise CE, CD, RD and WR */
+ drv_generic_parport_control(SIGNAL_CE | SIGNAL_CD | SIGNAL_RD | SIGNAL_WR,
+ SIGNAL_CE | SIGNAL_CD | SIGNAL_RD | SIGNAL_WR);
+ /* set direction: write */
+ drv_generic_parport_direction(0);
+
+
+ /* initialize display */
+
+ drv_T6_send_word(0x40, 0x0000); /* Set Text Home Address */
+ drv_T6_send_word(0x41, TCOLS); /* Set Text Area */
+
+ drv_T6_send_word(0x42, 0x0200); /* Set Graphic Home Address */
+ drv_T6_send_word(0x43, TCOLS); /* Set Graphic Area */
+
+ drv_T6_write_cmd(0x80); /* Mode Set: OR mode, Internal CG RAM mode */
+ drv_T6_send_word(0x22, 0x0002); /* Set Offset Register */
+ drv_T6_write_cmd(0x98); /* Set Display Mode: Curser off, Text off, Graphics on */
+ drv_T6_write_cmd(0xa0); /* Set Cursor Pattern: 1 line cursor */
+ drv_T6_send_word(0x21, 0x0000); /* Set Cursor Pointer to (0,0) */
+
+
+ /* clear display */
+
+ if (DualScan) {
+ /* upper half */
+ drv_T6_clear(0x0000, TCOLS * TROWS / 2); /* clear text area */
+ drv_T6_clear(0x0200, TCOLS * TROWS * 8 / 2); /* clear graphic area */
+ /* lower half */
+ drv_T6_clear(0x8000, TCOLS * TROWS / 2); /* clear text area */
+ drv_T6_clear(0x8200, TCOLS * TROWS * 8 / 2); /* clear graphic area */
+ } else {
+ drv_T6_clear(0x0000, TCOLS * TROWS); /* clear text area */
+ drv_T6_clear(0x0200, TCOLS * TROWS * 8); /* clear graphic area */
+ }
+
+ return 0;
+}
+
+
+/****************************************/
+/*** plugins ***/
+/****************************************/
+
+/* none at the moment... */
+
+
+/****************************************/
+/*** exported functions ***/
+/****************************************/
+
+
+/* list models */
+int drv_T6_list(void)
+{
+ int i;
+
+ for (i = 0; Models[i].type != 0xff; i++) {
+ printf("%s ", Models[i].name);
+ }
+ return 0;
+}
+
+
+/* initialize driver & display */
+int drv_T6_init(const char *section, const int quiet)
+{
+ int ret;
+
+ info("%s: %s", Name, "$Rev: 1136 $");
+
+ /* real worker functions */
+ drv_generic_graphic_real_blit = drv_T6_blit;
+
+ /* start display */
+ if ((ret = drv_T6_start(section)) != 0)
+ return ret;
+
+ /* initialize generic graphic driver */
+ if ((ret = drv_generic_graphic_init(section, Name)) != 0)
+ return ret;
+
+ if (!quiet) {
+ char buffer[40];
+ qprintf(buffer, sizeof(buffer), "%s %dx%d", Name, DCOLS, DROWS);
+ if (drv_generic_graphic_greet(buffer, NULL)) {
+ sleep(3);
+ drv_generic_graphic_clear();
+ }
+ }
+
+ /* register plugins */
+ /* none at the moment... */
+
+
+ return 0;
+}
+
+
+/* close driver & display */
+int drv_T6_quit(const int quiet)
+{
+
+ info("%s: shutting down.", Name);
+
+ drv_generic_graphic_clear();
+
+ if (!quiet) {
+ drv_generic_graphic_greet("goodbye!", NULL);
+ }
+
+ drv_generic_graphic_quit();
+ drv_generic_parport_close();
+
+ if (Buffer1) {
+ free(Buffer1);
+ Buffer1 = NULL;
+ }
+
+ if (Buffer2) {
+ free(Buffer2);
+ Buffer2 = NULL;
+ }
+
+ return (0);
+}
+
+
+DRIVER drv_T6963 = {
+ .name = Name,
+ .list = drv_T6_list,
+ .init = drv_T6_init,
+ .quit = drv_T6_quit,
+};
diff --git a/drv_TeakLCM.c b/drv_TeakLCM.c
new file mode 100644
index 0000000..b5bdec1
--- /dev/null
+++ b/drv_TeakLCM.c
@@ -0,0 +1,1025 @@
+/* $Id$
+ * $URL$
+ *
+ * TeakLCM lcd4linux driver
+ *
+ * Copyright (C) 2005 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2005, 2006, 2007 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ * Copyright (C) 2011 Hans Ulrich Niedermann <hun@n-dimensional.de>
+ * Copyright (C) 2011, 2012 Andreas Thienemann <andreas@bawue.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ *
+ * exported fuctions:
+ *
+ * struct DRIVER drv_TeakLCM
+ *
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+
+#include <assert.h>
+
+#include "event.h"
+#include "timer.h"
+#include "debug.h"
+#include "cfg.h"
+#include "qprintf.h"
+#include "udelay.h"
+#include "plugin.h"
+#include "widget.h"
+#include "widget_text.h"
+#include "widget_icon.h"
+#include "widget_bar.h"
+#include "drv.h"
+
+#include "drv_generic_text.h"
+#include "drv_generic_serial.h"
+
+
+static char Name[] = "TeakLCM";
+
+
+static int global_reset_rx_flag = 0;
+
+
+#define HI8(value) ((uint8_t)(((value)>>8) & 0xff))
+#define LO8(value) ((uint8_t)((value) & 0xff))
+
+
+static uint16_t CRC16(uint8_t value, uint16_t crcin)
+{
+ uint16_t k = (((crcin >> 8) ^ value) & 255) << 8;
+ uint16_t crc = 0;
+ int bits;
+ for (bits = 8; bits; --bits) {
+ if ((crc ^ k) & 0x8000)
+ crc = (crc << 1) ^ 0x1021;
+ else
+ crc <<= 1;
+ k <<= 1;
+ }
+ return ((crcin << 8) ^ crc);
+}
+
+
+/** Return a printable character */
+static char printable(const char ch)
+{
+ if ((32 <= ch) && (ch < 127)) {
+ return ch;
+ } else {
+ return '.';
+ }
+}
+
+
+static void debug_data_int(const char *prefix, const void *data, const size_t size, const unsigned int delta)
+{
+ const uint8_t *b = (const uint8_t *) data;
+ size_t y;
+ assert(delta <= 24);
+ for (y = 0; y < size; y += delta) {
+ char buf[100];
+ size_t x;
+ ssize_t idx = 0;
+ idx += sprintf(&(buf[idx]), "%04x ", y);
+ for (x = 0; x < delta; x++) {
+ const size_t i = x + y;
+ if (i < size) {
+ idx += sprintf(&(buf[idx]), " %02x", b[i]);
+ } else {
+ idx += sprintf(&(buf[idx]), " ");
+ }
+ }
+ idx += sprintf(&buf[idx], " ");
+ for (x = 0; x < delta; x++) {
+ const size_t i = x + y;
+ if (i < size) {
+ idx += sprintf(&buf[idx], "%c", printable(b[i]));
+ } else {
+ idx += sprintf(&buf[idx], " ");
+ }
+ }
+ debug("%s%s", prefix, buf);
+ }
+}
+
+
+static void debug_data(const char *prefix, const void *data, const size_t size)
+{
+ debug_data_int(prefix, data, size, 16);
+}
+
+
+typedef enum {
+ CMD_CONNECT = 0x05,
+ CMD_DISCONNECT = 0x06,
+ CMD_ALARM = 0x07,
+ CMD_WRITE = 0x08,
+ CMD_PRINT1 = 0x09,
+ CMD_PRINT2 = 0x0A,
+ CMD_ACK = 0x0B,
+ CMD_NACK = 0x0C,
+ CMD_CONFIRM = 0x0D,
+ CMD_RESET = 0x0E,
+
+ LCM_CLEAR = 0x21,
+ LCM_HOME = 0x22,
+ LCM_CURSOR_SHIFT_R = 0x23,
+ LCM_CURSOR_SHIFT_L = 0x24,
+ LCM_BACKLIGHT_ON = 0x25,
+ LCM_BACKLIGHT_OFF = 0x26,
+ LCM_LINE2 = 0x27,
+ LCM_DISPLAY_SHIFT_R = 0x28,
+ LCM_DISPLAY_SHIFT_L = 0x29,
+ LCM_CURSOR_ON = 0x2A,
+ LCM_CURSOR_OFF = 0x2B,
+ LCM_CURSOR_BLINK = 0x2C,
+ LCM_DISPLAY_ON = 0x2D,
+ LCM_DISPLAY_OFF = 0x2E
+} lcm_cmd_t;
+
+
+static
+const char *cmdstr(const lcm_cmd_t cmd)
+{
+ switch (cmd) {
+#define D(CMD) case CMD_ ## CMD: return "CMD_" # CMD; break;
+ D(CONNECT);
+ D(DISCONNECT);
+ D(ACK);
+ D(NACK);
+ D(CONFIRM);
+ D(RESET);
+ D(ALARM);
+ D(WRITE);
+ D(PRINT1);
+ D(PRINT2);
+#undef D
+#define D(CMD) case LCM_ ## CMD: return "LCM_" # CMD; break;
+ D(CLEAR);
+ D(HOME);
+ D(CURSOR_SHIFT_R);
+ D(CURSOR_SHIFT_L);
+ D(BACKLIGHT_ON);
+ D(BACKLIGHT_OFF);
+ D(LINE2);
+ D(DISPLAY_SHIFT_R);
+ D(DISPLAY_SHIFT_L);
+ D(CURSOR_ON);
+ D(CURSOR_OFF);
+ D(CURSOR_BLINK);
+ D(DISPLAY_ON);
+ D(DISPLAY_OFF);
+#undef D
+ }
+ return "CMD_UNKNOWN";
+}
+
+
+/*
+ * Magic defines
+ */
+
+#define LCM_FRAME_MASK 0xFF
+#define LCM_TIMEOUT 2
+#define LCM_ESC 0x1B
+
+#define LCM_KEY1 0x31
+#define LCM_KEY2 0x32
+#define LCM_KEY3 0x33
+#define LCM_KEY4 0x34
+#define LCM_KEY12 0x35
+#define LCM_KEY13 0x36
+#define LCM_KEY14 0x37
+#define LCM_KEY23 0x38
+#define LCM_KEY24 0x39
+#define LCM_KEY34 0x3A
+
+
+/****************************************/
+/*** hardware dependant functions ***/
+/****************************************/
+
+/* global LCM state machine */
+
+
+struct _lcm_fsm_t;
+typedef struct _lcm_fsm_t lcm_fsm_t;
+
+
+typedef enum {
+ ST_IDLE, /* mode == 0, IDLE */
+ ST_COMMAND, /* mode == 1, COMMAND */
+ ST_CONNECTED /* mode == 2, CONNECTED */
+} lcm_state_t;
+
+
+static
+const char *state2str(const lcm_state_t state)
+{
+ switch (state) {
+ case ST_IDLE:
+ return "ST_IDLE (0)";
+ break;
+ case ST_COMMAND:
+ return "ST_COMMAND (1)";
+ break;
+ case ST_CONNECTED:
+ return "ST_CONNECTED (2)";
+ break;
+ }
+ return "ST_UNKNOWN";
+}
+
+
+#if 0
+static
+void repeat_connect_to_display_callback(void *data);
+#endif
+
+static
+void lcm_send_cmd(lcm_cmd_t cmd);
+
+static
+void drv_TeakLCM_clear(void);
+
+
+static
+void raw_send_cmd_frame(lcm_cmd_t cmd);
+
+static
+void raw_send_data_frame(lcm_cmd_t cmd, const char *data, const unsigned int len);
+
+
+static
+lcm_state_t fsm_get_state(lcm_fsm_t * fsm);
+
+static
+void fsm_handle_cmd(lcm_fsm_t * fsm, const lcm_cmd_t cmd);
+
+static
+void fsm_handle_datacmd(lcm_fsm_t * fsm, const lcm_cmd_t cmd, const uint8_t * payload, const unsigned int payload_len);
+
+static
+void try_reset(void);
+
+static
+void fsm_step(lcm_fsm_t * fsm);
+
+static
+void fsm_trans_noop(lcm_fsm_t * fsm, const lcm_state_t next_state);
+
+static
+void fsm_trans_cmd(lcm_fsm_t * fsm, const lcm_state_t next_state, const lcm_cmd_t cmd);
+
+static
+void fsm_trans_data(lcm_fsm_t * fsm,
+ const lcm_state_t next_state, const lcm_cmd_t cmd, const char *data, const unsigned int len);
+
+
+static
+void fsm_handle_bytes(lcm_fsm_t * fsm, uint8_t * rxbuf, const unsigned int buflen)
+{
+ if ((buflen >= 3) && (rxbuf[0] == LCM_FRAME_MASK) && (rxbuf[2] == LCM_FRAME_MASK)) {
+ const lcm_cmd_t cmd = rxbuf[1];
+ debug("%s Received cmd frame (cmd=%d=%s)", __FUNCTION__, cmd, cmdstr(cmd));
+ fsm_handle_cmd(fsm, cmd);
+ if (buflen > 3) {
+ /* recursively handle remaining bytes */
+ fsm_handle_bytes(fsm, &rxbuf[3], buflen - 3);
+ }
+ return;
+ } else if ((buflen > 3) && (rxbuf[0] == LCM_FRAME_MASK)) {
+ unsigned int ri; /* raw indexed */
+ unsigned int ci; /* cooked indexed, i.e. after unescaping */
+
+ debug("%s Received possible data frame", __FUNCTION__);
+
+ /* unescape rxframe data in place */
+ uint16_t crc0 = 0, crc1 = 0, crc2 = 0, crc3 = 0;
+ for (ri = 1, ci = 1; ri < buflen; ri++) {
+ switch (rxbuf[ri]) {
+ case LCM_ESC:
+ ri++;
+ /* fall through */
+ default:
+ rxbuf[ci++] = rxbuf[ri];
+ crc3 = crc2;
+ crc2 = crc1;
+ crc1 = crc0;
+ crc0 = CRC16(rxbuf[ri], crc0);
+ break;
+ }
+ if ((rxbuf[ci - 1] == LCM_FRAME_MASK) && (rxbuf[ci - 2] == LO8(crc3)) && (rxbuf[ci - 3] == HI8(crc3))) {
+ /* looks like a complete data frame */
+ lcm_cmd_t cmd = rxbuf[1];
+ uint16_t len = (rxbuf[3] << 8) + rxbuf[2];
+ assert(ci == (unsigned int) (1 + 1 + 2 + len + 2 + 1));
+ fsm_handle_datacmd(fsm, cmd, &rxbuf[4], len);
+ if (ri + 1 < buflen) {
+ /* recursively handle remaining bytes */
+ fsm_handle_bytes(fsm, &rxbuf[ri + 1], buflen - ri);
+ }
+ return;
+ }
+ }
+
+ fsm_trans_cmd(fsm, fsm_get_state(fsm), /* TODO: Is this a good next_state value? */
+ CMD_NACK);
+ debug("%s checksum/framemask error", __FUNCTION__);
+ return;
+ } else {
+ debug("%s Received garbage data:", __FUNCTION__);
+ debug_data(" RXD ", rxbuf, buflen);
+ return;
+ }
+}
+
+
+static void fsm_handle_cmd(lcm_fsm_t * fsm, lcm_cmd_t cmd)
+{
+ // debug("fsm_handle_cmd: old state 0x%02x %s", lcm_mode, modestr(lcm_mode));
+ const lcm_state_t old_state = fsm_get_state(fsm);
+ if (CMD_RESET == cmd) {
+ global_reset_rx_flag = 1;
+ }
+ switch (old_state) {
+ case ST_IDLE:
+ case ST_COMMAND:
+ switch (cmd) {
+ case CMD_CONNECT:
+ fsm_trans_cmd(fsm, ST_COMMAND, CMD_ACK);
+ break;
+ case CMD_ACK:
+ fsm_trans_cmd(fsm, ST_CONNECTED, CMD_CONFIRM);
+ break;
+ case CMD_NACK:
+ fsm_trans_cmd(fsm, ST_IDLE, CMD_CONFIRM);
+ break;
+ case CMD_CONFIRM:
+ fsm_trans_noop(fsm, ST_CONNECTED);
+ break;
+ case CMD_RESET:
+ fsm_trans_cmd(fsm, ST_COMMAND, CMD_CONNECT);
+ break;
+ default:
+ error("%s: Unhandled cmd %s in state %s", Name, cmdstr(cmd), state2str(old_state));
+ fsm_trans_cmd(fsm, ST_IDLE, CMD_NACK);
+ break;
+ }
+ break;
+ case ST_CONNECTED: /* "if (mode == 2)" */
+ switch (cmd) {
+ case CMD_ACK:
+ fsm_trans_cmd(fsm, ST_CONNECTED, CMD_CONFIRM);
+ break;
+ case CMD_CONNECT:
+ fsm_trans_cmd(fsm, ST_CONNECTED, CMD_NACK);
+ break;
+ case CMD_DISCONNECT:
+ fsm_trans_cmd(fsm, ST_CONNECTED, CMD_ACK);
+ break;
+ case CMD_RESET:
+ fsm_trans_cmd(fsm, ST_IDLE, CMD_CONNECT);
+ break;
+ default:
+ debug("%s: Ignoring unhandled cmd %s in state %s", Name, cmdstr(cmd), state2str(old_state));
+ fsm_trans_noop(fsm, ST_CONNECTED);
+ break;
+ }
+ break;
+ }
+ fsm_step(fsm);
+}
+
+
+static
+void fsm_handle_datacmd(lcm_fsm_t * fsm, const lcm_cmd_t cmd, const uint8_t * payload, unsigned int payload_len)
+{
+ const lcm_state_t old_state = fsm_get_state(fsm);
+ debug("fsm_handle_datacmd: old state 0x%02x %s", old_state, state2str(old_state));
+ switch (old_state) {
+ case ST_CONNECTED:
+ switch (cmd) {
+ case CMD_WRITE:
+ assert(payload_len == 1);
+ debug("Got a key code 0x%02x", *payload);
+ fsm_trans_noop(fsm, ST_CONNECTED);
+ // lcm_send_cmd_frame(CMD_ACK);
+ break;
+ default:
+ debug("Got an unknown data frame: %d=%s", cmd, cmdstr(cmd));
+ fsm_trans_noop(fsm, ST_CONNECTED);
+ // lcm_send_cmd_frame(CMD_NACK);
+ break;
+ }
+ break;
+ case ST_IDLE:
+ case ST_COMMAND:
+ fsm_trans_cmd(fsm, old_state, CMD_NACK);
+ break;
+ }
+ fsm_step(fsm);
+}
+
+
+struct _lcm_fsm_t {
+ lcm_state_t state;
+ lcm_state_t next_state;
+ enum {
+ ACTION_UNINITIALIZED,
+ ACTION_NOOP,
+ ACTION_CMD,
+ ACTION_DATA
+ } action_type;
+ union {
+ struct {
+ lcm_cmd_t cmd;
+ } cmd_frame;
+ struct {
+ lcm_cmd_t cmd;
+ const char *data;
+ unsigned int len;
+ } data_frame;
+ } action;
+};
+
+
+static
+lcm_state_t fsm_get_state(lcm_fsm_t * fsm)
+{
+ return fsm->state;
+}
+
+
+static
+void flush_shadow(void);
+
+
+static
+void fsm_step(lcm_fsm_t * fsm)
+{
+ debug("fsm: old_state=%s new_state=%s", state2str(fsm->state), state2str(fsm->next_state));
+ switch (fsm->action_type) {
+ case ACTION_UNINITIALIZED:
+ error("Uninitialized LCM FSM action");
+ abort();
+ break;
+ case ACTION_NOOP:
+ break;
+ case ACTION_CMD:
+ raw_send_cmd_frame(fsm->action.cmd_frame.cmd);
+ break;
+ case ACTION_DATA:
+ raw_send_data_frame(fsm->action.data_frame.cmd, fsm->action.data_frame.data, fsm->action.data_frame.len);
+ break;
+ }
+ fsm->action_type = ACTION_UNINITIALIZED;
+ switch (fsm->next_state) {
+ case ST_IDLE:
+ case ST_COMMAND:
+ fsm->state = fsm->next_state;
+ fsm->next_state = -1;
+ return;
+ break;
+ case ST_CONNECTED:
+ if (fsm->state != ST_CONNECTED) {
+ /* going from ST_IDLE or ST_COMMAND into ST_CONNECTED */
+ if (!global_reset_rx_flag) {
+ try_reset();
+#if 0
+ int timer_res = timer_add(repeat_connect_to_display_callback, NULL, 50 /*ms */ , 1);
+ debug("re-scheduled connect callback result: %d", timer_res);
+
+ done by try_reset / fsm_init fsm->state = fsm->next_state;
+ fsm->next_state = -1;
+#endif
+ return;
+ } else {
+ /* properly connected for the first time */
+ debug("%s: %s NOW CONNECTED!!!", Name, __FUNCTION__);
+
+ fsm->state = fsm->next_state;
+ fsm->next_state = -1;
+
+ lcm_send_cmd(LCM_DISPLAY_ON);
+ flush_shadow();
+ lcm_send_cmd(LCM_BACKLIGHT_ON);
+ return;
+ }
+ } else {
+ debug("no state change in ST_CONNECTED");
+ fsm->state = fsm->next_state;
+ fsm->next_state = -1;
+ return;
+ }
+ error("we should never arrive here");
+ abort();
+ break;
+ }
+ error("LCM FSM: Illegal next_state");
+ abort();
+}
+
+
+#if 0
+
+#endif
+
+
+static
+void fsm_trans_noop(lcm_fsm_t * fsm, const lcm_state_t next_state)
+{
+ fsm->next_state = next_state;
+ fsm->action_type = ACTION_NOOP;
+}
+
+
+static
+void fsm_trans_cmd(lcm_fsm_t * fsm, const lcm_state_t next_state, const lcm_cmd_t cmd)
+{
+ fsm->next_state = next_state;
+ fsm->action_type = ACTION_CMD;
+ fsm->action.cmd_frame.cmd = cmd;
+}
+
+
+static
+void fsm_trans_data(lcm_fsm_t * fsm,
+ const lcm_state_t next_state, const lcm_cmd_t cmd, const char *data, const unsigned int len)
+{
+ fsm->next_state = next_state;
+ fsm->action_type = ACTION_DATA;
+ fsm->action.data_frame.cmd = cmd;
+ fsm->action.data_frame.data = data;
+ fsm->action.data_frame.len = len;
+}
+
+
+static
+void fsm_send(lcm_fsm_t * fsm, const lcm_cmd_t cmd)
+{
+ const lcm_state_t old_state = fsm_get_state(fsm);
+ switch (old_state) {
+ case ST_IDLE:
+ case ST_COMMAND:
+ debug("%s: %s, ignoring cmd 0x%02x=%s", __FUNCTION__, state2str(old_state), cmd, cmdstr(cmd));
+ /* Silently ignore the command to send. */
+ /* TODO: Would it be better to queue it and send it later? */
+ break;
+ case ST_CONNECTED:
+ fsm_trans_cmd(fsm, ST_CONNECTED, cmd);
+ fsm_step(fsm);
+ break;
+ }
+}
+
+
+static
+void fsm_send_data(lcm_fsm_t * fsm, const lcm_cmd_t cmd, const void *data, const unsigned int len)
+{
+ const lcm_state_t old_state = fsm_get_state(fsm);
+ switch (old_state) {
+ case ST_IDLE:
+ case ST_COMMAND:
+ debug("%s: %s, ignoring data cmd 0x%02x=%s", __FUNCTION__, state2str(old_state), cmd, cmdstr(cmd));
+ /* Silently ignore the command to send. */
+ /* TODO: Would it be better to queue it and send it later? */
+ break;
+ case ST_CONNECTED:
+ fsm_trans_data(fsm, ST_CONNECTED, cmd, data, len);
+ fsm_step(fsm);
+ break;
+ }
+}
+
+
+static lcm_fsm_t lcm_fsm;
+
+
+static
+void fsm_init(void)
+{
+ lcm_fsm.state = ST_IDLE;
+ lcm_fsm.next_state = -1;
+ lcm_fsm.action_type = ACTION_UNINITIALIZED;
+}
+
+
+
+/* Send a command frame to the TCM board */
+static
+void raw_send_cmd_frame(lcm_cmd_t cmd)
+{
+ // lcm_receive_check();
+ char cmd_buf[3];
+ cmd_buf[0] = LCM_FRAME_MASK;
+ cmd_buf[1] = cmd;
+ cmd_buf[2] = LCM_FRAME_MASK;
+ debug("%s sending cmd frame cmd=0x%02x=%s", __FUNCTION__, cmd, cmdstr(cmd));
+ debug_data(" TX ", cmd_buf, 3);
+ drv_generic_serial_write(cmd_buf, 3);
+ usleep(100);
+#if 0
+ usleep(100000);
+ switch (cmd) {
+ case CMD_ACK:
+ //case CMD_CONFIRM:
+ case CMD_NACK:
+ lcm_receive_check();
+ break;
+ default:
+ if (1) {
+ int i;
+ for (i = 0; i < 20; i++) {
+ usleep(100000);
+ if (lcm_receive_check()) {
+ break;
+ }
+ }
+ }
+ break;
+ }
+#endif
+}
+
+
+/* Send a data frame to the TCM board */
+static
+void raw_send_data_frame(lcm_cmd_t cmd, const char *data, const unsigned int len)
+{
+ unsigned int di; /* data index */
+ unsigned int fi; /* frame index */
+ static char frame[32];
+ uint16_t crc = 0;
+
+ frame[0] = LCM_FRAME_MASK;
+
+ frame[1] = cmd;
+ crc = CRC16(frame[1], crc);
+
+ frame[2] = HI8(len);
+ crc = CRC16(frame[2], crc);
+
+ frame[3] = LO8(len);
+ crc = CRC16(frame[3], crc);
+
+#define APPEND(value) \
+ do { \
+ const unsigned char v = (value); \
+ if ((v == LCM_FRAME_MASK) || (v == LCM_ESC)) { \
+ frame[fi++] = LCM_ESC; \
+ } \
+ frame[fi++] = v; \
+ crc = CRC16(v, crc); \
+ } while (0)
+
+#define APPEND_NOCRC(value) \
+ do { \
+ const unsigned char v = (value); \
+ if ((v == LCM_FRAME_MASK) || (v == LCM_ESC)) { \
+ frame[fi++] = LCM_ESC; \
+ } \
+ frame[fi++] = v; \
+ } while (0)
+
+ for (fi = 4, di = 0; di < len; di++) {
+ APPEND(data[di]);
+ }
+
+ APPEND_NOCRC(HI8(crc));
+ APPEND_NOCRC(LO8(crc));
+
+ frame[fi++] = LCM_FRAME_MASK;
+
+ debug_data(" TXD ", frame, fi);
+ drv_generic_serial_write(frame, fi);
+
+#undef APPEND
+
+ usleep(500);
+}
+
+
+static
+void lcm_send_cmd(lcm_cmd_t cmd)
+{
+ fsm_send(&lcm_fsm, cmd);
+}
+
+
+static
+void lcm_event_callback(event_flags_t flags, void *data)
+{
+ lcm_fsm_t *fsm = (lcm_fsm_t *) data;
+ debug("%s: flags=%d, data=%p", __FUNCTION__, flags, data);
+ if (flags & EVENT_READ) {
+ static uint8_t rxbuf[32];
+ const int readlen = drv_generic_serial_poll((void *) rxbuf, sizeof(rxbuf));
+ if (readlen <= 0) {
+ debug("%s Received no data", __FUNCTION__);
+ } else {
+ debug("%s RECEIVED %d bytes", __FUNCTION__, readlen);
+ debug_data(" RX ", rxbuf, readlen);
+ fsm_handle_bytes(fsm, rxbuf, readlen);
+ }
+ }
+}
+
+
+static int drv_TeakLCM_open(const char *section)
+{
+ /* open serial port */
+ /* don't mind about device, speed and stuff, this function will take care of */
+
+ const int fd = drv_generic_serial_open(section, Name, 0);
+ if (fd < 0)
+ return -1;
+
+ return fd;
+}
+
+
+static int drv_TeakLCM_close(int fd)
+{
+ if (fd >= 0) {
+ event_del(fd);
+ }
+
+ /* close whatever port you've opened */
+ drv_generic_serial_close();
+
+ return 0;
+}
+
+
+/* shadow buffer */
+static
+char *shadow;
+
+
+static void debug_shadow(const char *prefix)
+{
+ debug_data_int(prefix, shadow, DCOLS * DROWS, 20);
+}
+
+
+static
+void flush_shadow(void)
+{
+ debug("%s called", __FUNCTION__);
+ debug_shadow(" shadow ");
+ usleep(50000);
+ fsm_send_data(&lcm_fsm, CMD_PRINT1, &shadow[DCOLS * 0], DCOLS);
+ usleep(50000);
+ fsm_send_data(&lcm_fsm, CMD_PRINT2, &shadow[DCOLS * 1], DCOLS);
+ usleep(50000);
+}
+
+
+/* text mode displays only */
+static
+void drv_TeakLCM_clear(void)
+{
+ /* do whatever is necessary to clear the display */
+ memset(shadow, ' ', DROWS * DCOLS);
+ flush_shadow();
+}
+
+
+/* text mode displays only */
+static void drv_TeakLCM_write(const int row, const int col, const char *data, int len)
+{
+ debug("%s row=%d col=%d len=%d data=\"%s\"", __FUNCTION__, row, col, len, data);
+
+ memcpy(&shadow[DCOLS * row + col], data, len);
+
+ debug_shadow(" shadow ");
+
+ fsm_send_data(&lcm_fsm, (row == 0) ? CMD_PRINT1 : CMD_PRINT2, &shadow[DCOLS * row], DCOLS);
+}
+
+
+static
+void try_reset(void)
+{
+ debug("%s called", __FUNCTION__);
+ fsm_init();
+ raw_send_cmd_frame(CMD_RESET);
+}
+
+
+#if 0
+static
+void repeat_connect_to_display_callback(void *data)
+{
+ static int already_called = 0;
+ if (!already_called) {
+ debug("%s(%p): called", __FUNCTION__, data);
+
+ /* reset & initialize display */
+ try_reset();
+ already_called = 1;
+ } else {
+ debug("%s(%p): already called, ignoring", __FUNCTION__, data);
+ }
+}
+#endif
+
+
+static
+int global_fd = -1;
+
+
+static
+void initial_connect_to_display_callback(void *data)
+{
+ debug("%s(%p): called", __FUNCTION__, data);
+
+ debug("Calling event_add for fd=%d", global_fd);
+ int ret = event_add(lcm_event_callback, &lcm_fsm, global_fd, 1, 0, 1);
+ debug("event_add result: %d", ret);
+
+ /* reset & initialize display */
+ try_reset();
+}
+
+
+/* start text mode display */
+static int drv_TeakLCM_start(const char *section)
+{
+ int rows = -1, cols = -1;
+ char *s;
+
+ s = cfg_get(section, "Size", NULL);
+ if (s == NULL || *s == '\0') {
+ error("%s: no '%s.Size' entry from %s", Name, section, cfg_source());
+ return -1;
+ }
+ if (sscanf(s, "%dx%d", &cols, &rows) != 2 || rows < 1 || cols < 1) {
+ error("%s: bad %s.Size '%s' from %s", Name, section, s, cfg_source());
+ free(s);
+ return -1;
+ }
+
+ DROWS = rows;
+ DCOLS = cols;
+ shadow = malloc(DROWS * DCOLS);
+ memset(shadow, ' ', DROWS * DCOLS);
+
+ /* open communication with the display */
+ global_fd = drv_TeakLCM_open(section);
+ if (global_fd < 0) {
+ return -1;
+ }
+ debug("%s: %s opened", Name, __FUNCTION__);
+
+ /* read initial garbage data */
+ static uint8_t rxbuf[32];
+ const int readlen = drv_generic_serial_poll((void *) rxbuf, sizeof(rxbuf));
+ if (readlen >= 0) {
+ debug_data(" initial RX garbage ", rxbuf, readlen);
+ }
+
+ /* We need to do a delayed connect */
+ int timer_res = timer_add(initial_connect_to_display_callback, NULL, 10 /*ms */ , 1);
+ debug("timer_add for connect callback result: %d", timer_res);
+
+ debug("%s: %s done", Name, __FUNCTION__);
+ return 0;
+}
+
+
+/****************************************/
+/*** plugins ***/
+/****************************************/
+
+
+/****************************************/
+/*** widget callbacks ***/
+/****************************************/
+
+
+/* using drv_generic_text_draw(W) */
+/* using drv_generic_text_icon_draw(W) */
+/* using drv_generic_text_bar_draw(W) */
+
+
+/****************************************/
+/*** exported functions ***/
+/****************************************/
+
+
+/* list models */
+int drv_TeakLCM_list(void)
+{
+ printf("TeakLCM driver");
+ return 0;
+}
+
+
+/* initialize driver & display */
+/* use this function for a text display */
+int drv_TeakLCM_init(const char *section, const int quiet)
+{
+ WIDGET_CLASS wc;
+ int ret;
+
+ info("%s: %s (quiet=%d)", Name, "$Rev$", quiet);
+
+ /* display preferences */
+ XRES = 5; /* pixel width of one char */
+ YRES = 8; /* pixel height of one char */
+ CHARS = 0; /* number of user-defineable characters */
+ CHAR0 = 0; /* ASCII of first user-defineable char */
+ GOTO_COST = -1; /* number of bytes a goto command requires */
+
+ /* real worker functions */
+ drv_generic_text_real_write = drv_TeakLCM_write;
+
+ /* start display */
+ if ((ret = drv_TeakLCM_start(section)) != 0)
+ return ret;
+
+ /* initialize generic text driver */
+ if ((ret = drv_generic_text_init(section, Name)) != 0)
+ return ret;
+
+ /* register text widget */
+ wc = Widget_Text;
+ wc.draw = drv_generic_text_draw;
+ widget_register(&wc);
+
+ /* register plugins */
+
+ return 0;
+}
+
+
+/* close driver & display */
+/* use this function for a text display */
+int drv_TeakLCM_quit(const int quiet)
+{
+
+ info("%s: shutting down. (quiet=%d)", Name, quiet);
+
+ drv_generic_text_quit();
+
+ /* clear display */
+ drv_TeakLCM_clear();
+
+ lcm_send_cmd(LCM_DISPLAY_OFF);
+ // lcm_send_cmd_frame(LCM_BACKLIGHT_OFF);
+ lcm_send_cmd(CMD_DISCONNECT);
+
+ /* FIXME: consume final ack frame */
+ usleep(100000);
+
+ debug("closing connection");
+ drv_TeakLCM_close(global_fd);
+
+ return (0);
+}
+
+
+/* use this one for a text display */
+DRIVER drv_TeakLCM = {
+ .name = Name,
+ .list = drv_TeakLCM_list,
+ .init = drv_TeakLCM_init,
+ .quit = drv_TeakLCM_quit,
+};
+
+
+/*
+ * Local Variables:
+ * c-basic-offset: 4
+ * End:
+ */
diff --git a/drv_Trefon.c b/drv_Trefon.c
new file mode 100644
index 0000000..00d03eb
--- /dev/null
+++ b/drv_Trefon.c
@@ -0,0 +1,416 @@
+/* $Id: drv_Trefon.c 975 2009-01-18 11:16:20Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/drv_Trefon.c $
+ *
+ * driver for TREFON USB LCD displays - http://www.trefon.de
+ *
+ * Copyright (C) 2005 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2005 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ *
+ * exported fuctions:
+ *
+ * struct DRIVER drv_Trefon
+ *
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <unistd.h>
+#include <termios.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <sys/time.h>
+
+#include <usb.h>
+
+#include "debug.h"
+#include "cfg.h"
+#include "qprintf.h"
+#include "plugin.h"
+#include "widget.h"
+#include "widget_text.h"
+#include "widget_icon.h"
+#include "widget_bar.h"
+#include "drv.h"
+#include "drv_generic_text.h"
+
+
+#define LCD_USB_VENDOR 0xfff0
+#define LCD_USB_DEVICE 0xfffe
+
+#define PKT_START 0x02
+#define PKT_BACKLIGHT 0x01
+#define PKT_DATA 0x02
+#define PKT_CTRL 0x06
+#define PKT_END 0xff
+
+static char Name[] = "TREFON";
+
+static usb_dev_handle *lcd;
+static int interface;
+
+
+/****************************************/
+/*** hardware dependant functions ***/
+/****************************************/
+
+static int drv_TF_open(void)
+{
+ struct usb_bus *busses, *bus;
+ struct usb_device *dev;
+
+ lcd = NULL;
+
+ info("%s: scanning USB for TREFON LCD...", Name);
+
+ usb_set_debug(0);
+
+ usb_init();
+ usb_find_busses();
+ usb_find_devices();
+ busses = usb_get_busses();
+
+ for (bus = busses; bus; bus = bus->next) {
+ for (dev = bus->devices; dev; dev = dev->next) {
+ if ((dev->descriptor.idVendor == LCD_USB_VENDOR) && (dev->descriptor.idProduct == LCD_USB_DEVICE)) {
+ info("%s: found TREFON USB LCD on bus %s device %s", Name, bus->dirname, dev->filename);
+ lcd = usb_open(dev);
+ if (usb_set_configuration(lcd, 1) < 0) {
+ error("%s: usb_set_configuration() failed!", Name);
+ return -1;
+ }
+ interface = 0;
+ if (usb_claim_interface(lcd, interface) < 0) {
+ error("%s: usb_claim_interface() failed!", Name);
+ return -1;
+ }
+ return 0;
+ }
+ }
+ }
+ return -1;
+}
+
+
+static int drv_TF_close(void)
+{
+ usb_release_interface(lcd, interface);
+ usb_close(lcd);
+
+ return 0;
+}
+
+
+static void drv_TF_send(unsigned char *data, int size)
+{
+ unsigned char buffer[64];
+
+ /* the controller always wants a 64-byte packet */
+ memset(buffer, 0, 64);
+ memcpy(buffer, data, size);
+
+ /* Endpoint hardcoded to 2 */
+ usb_bulk_write(lcd, 2, (char *) buffer, 64, 2000);
+}
+
+
+static void drv_TF_command(const unsigned char cmd)
+{
+ unsigned char buffer[4] = { PKT_START, PKT_CTRL, 0, PKT_END };
+ buffer[2] = cmd;
+ drv_TF_send(buffer, 4);
+}
+
+
+static void drv_TF_clear(void)
+{
+ drv_TF_command(0x01);
+}
+
+
+static void drv_TF_write(const int row, const int col, const char *data, const int len)
+{
+ unsigned char buffer[64];
+ unsigned char *p;
+ int pos = 0;
+
+ if (DCOLS == 8 && DROWS == 1) { /* 8x1 Characters */
+ pos = row * 0x40 + col;
+ } else if (DCOLS == 16 && DROWS == 2) { /* 16x2 Characters */
+ pos = row * 0x40 + col;
+ } else if (DCOLS == 20 && DROWS == 4) { /* 20x4 Characters */
+ pos = row * 0x20 + col;
+ } else {
+ error("%s: internal error: DCOLS=%d DROWS=%d", Name, DCOLS, DROWS);
+ return;
+ }
+
+ /* combine the GOTO and the data into one packet */
+ p = buffer;
+ *p++ = PKT_START;
+ *p++ = PKT_CTRL; /* Goto */
+ *p++ = 0x80 | pos;
+ *p++ = PKT_DATA; /* Data */
+ *p++ = (char) len;
+ for (pos = 0; pos < len; pos++) {
+ *p++ = *data++;
+ }
+ *p++ = PKT_END;
+
+ drv_TF_send(buffer, len + 5);
+}
+
+
+static void drv_TF_defchar(const int ascii, const unsigned char *matrix)
+{
+
+ unsigned char buffer[14];
+ unsigned char *p;
+ int i;
+
+ p = buffer;
+ *p++ = PKT_START;
+ *p++ = PKT_CTRL;
+ *p++ = 0x40 | 8 * ascii;
+ *p++ = PKT_DATA;
+ *p++ = 8; /* data length */
+ for (i = 0; i < 8; i++) {
+ *p++ = *matrix++ & 0x1f;
+ }
+ *p++ = PKT_END;
+
+ drv_TF_send(buffer, 14);
+}
+
+
+static int drv_TF_backlight(int backlight)
+{
+ unsigned char buffer[4] = { PKT_START, PKT_BACKLIGHT, 0, PKT_END };
+
+ if (backlight < 0)
+ backlight = 0;
+ if (backlight > 1)
+ backlight = 1;
+
+ buffer[2] = backlight;
+ drv_TF_send(buffer, 4);
+
+ return backlight;
+}
+
+
+/* test for existing resolutions from TREFON USB-LCDs (TEXT-Mode only) */
+int drv_TF_valid_resolution(int rows, int cols)
+{
+
+ if (rows == 1 && cols == 8) {
+ return 0;
+ } else if (rows == 2 && cols == 16) {
+ return 0;
+ } else if (rows == 4 && cols == 20) {
+ return 0;
+ }
+ return -1;
+}
+
+
+static int drv_TF_start(const char *section, const int quiet)
+{
+ int backlight;
+ int rows = -1, cols = -1;
+ char *s;
+
+ s = cfg_get(section, "Size", NULL);
+ if (s == NULL || *s == '\0') {
+ error("%s: no '%s.Size' entry from %s", Name, section, cfg_source());
+ return -1;
+ }
+ if (sscanf(s, "%dx%d", &cols, &rows) != 2 || drv_TF_valid_resolution(rows, cols) < 0) {
+ error("%s: bad %s.Size '%s' (only 8x1/16x2/20x4) from %s", Name, section, s, cfg_source());
+ free(s);
+ return -1;
+ }
+
+ DROWS = rows;
+ DCOLS = cols;
+
+ if (drv_TF_open() < 0) {
+ error("%s: could not find a TREFON USB LCD", Name);
+ return -1;
+ }
+
+ if (cfg_number(section, "Backlight", 1, 0, 1, &backlight) > 0) {
+ drv_TF_backlight(backlight);
+ }
+
+ drv_TF_clear(); /* clear display */
+
+ if (!quiet) {
+ char buffer[40];
+ qprintf(buffer, sizeof(buffer), "%s %dx%d", Name, DCOLS, DROWS);
+ if (drv_generic_text_greet(buffer, "www.trefon.de")) {
+ sleep(3);
+ drv_TF_clear();
+ }
+ }
+
+ return 0;
+}
+
+
+/****************************************/
+/*** plugins ***/
+/****************************************/
+
+static void plugin_backlight(RESULT * result, RESULT * arg1)
+{
+ double backlight;
+
+ backlight = drv_TF_backlight(R2N(arg1));
+ SetResult(&result, R_NUMBER, &backlight);
+}
+
+
+/****************************************/
+/*** widget callbacks ***/
+/****************************************/
+
+
+/* using drv_generic_text_draw(W) */
+/* using drv_generic_text_icon_draw(W) */
+/* using drv_generic_text_bar_draw(W) */
+
+
+/****************************************/
+/*** exported functions ***/
+/****************************************/
+
+
+/* list models */
+int drv_TF_list(void)
+{
+ printf("TREFON USB LCD");
+ return 0;
+}
+
+
+/* initialize driver & display */
+int drv_TF_init(const char *section, const int quiet)
+{
+ WIDGET_CLASS wc;
+ int asc255bug;
+ int ret;
+
+ info("%s: %s", Name, "$Rev: 975 $");
+
+ /* display preferences */
+ XRES = 5; /* pixel width of one char */
+ YRES = 8; /* pixel height of one char */
+ CHARS = 8; /* number of user-defineable characters */
+ CHAR0 = 1; /* ASCII of first user-defineable char */
+ GOTO_COST = 64; /* number of bytes a goto command requires */
+
+ /* real worker functions */
+ drv_generic_text_real_write = drv_TF_write;
+ drv_generic_text_real_defchar = drv_TF_defchar;
+
+
+ /* start display */
+ if ((ret = drv_TF_start(section, quiet)) != 0)
+ return ret;
+
+ /* initialize generic text driver */
+ if ((ret = drv_generic_text_init(section, Name)) != 0)
+ return ret;
+
+ /* initialize generic icon driver */
+ if ((ret = drv_generic_text_icon_init()) != 0)
+ return ret;
+
+ /* initialize generic bar driver */
+ if ((ret = drv_generic_text_bar_init(0)) != 0)
+ return ret;
+
+ /* add fixed chars to the bar driver */
+ /* most displays have a full block on ascii 255, but some have kind of */
+ /* an 'inverted P'. If you specify 'asc255bug 1 in the config, this */
+ /* char will not be used, but rendered by the bar driver */
+ cfg_number(section, "asc255bug", 0, 0, 1, &asc255bug);
+ drv_generic_text_bar_add_segment(0, 0, 255, 32); /* ASCII 32 = blank */
+ if (!asc255bug)
+ drv_generic_text_bar_add_segment(255, 255, 255, 255); /* ASCII 255 = block */
+
+ /* register text widget */
+ wc = Widget_Text;
+ wc.draw = drv_generic_text_draw;
+ widget_register(&wc);
+
+ /* register icon widget */
+ wc = Widget_Icon;
+ wc.draw = drv_generic_text_icon_draw;
+ widget_register(&wc);
+
+ /* register bar widget */
+ wc = Widget_Bar;
+ wc.draw = drv_generic_text_bar_draw;
+ widget_register(&wc);
+
+ /* register plugins */
+ AddFunction("LCD::backlight", 1, plugin_backlight);
+
+ return 0;
+}
+
+
+/* close driver & display */
+int drv_TF_quit(const int quiet)
+{
+
+ info("%s: shutting down.", Name);
+
+ drv_generic_text_quit();
+
+ /* clear display */
+ drv_TF_clear();
+
+ /* say goodbye... */
+ if (!quiet) {
+ drv_generic_text_greet("goodbye!", NULL);
+ }
+
+ debug("closing USB connection");
+ drv_TF_close();
+
+ return (0);
+}
+
+
+DRIVER drv_Trefon = {
+ .name = Name,
+ .list = drv_TF_list,
+ .init = drv_TF_init,
+ .quit = drv_TF_quit,
+};
diff --git a/drv_USBHUB.c b/drv_USBHUB.c
new file mode 100644
index 0000000..32589d8
--- /dev/null
+++ b/drv_USBHUB.c
@@ -0,0 +1,341 @@
+/* $Id: drv_USBHUB.c 1203 2015-07-12 21:26:15Z jmccrohan $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/drv_USBHUB.c $
+ *
+ * driver for USBHUB
+ *
+ * Copyright (C) 2006 Ernst Bachmann <e.bachmann@xebec.de>
+ * Copyright (C) 2004,2006 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * Based on the USBLCD driver Copyright (C) 2003 Michael Reinelt <michael@reinelt.co.at>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ *
+ * exported fuctions:
+ *
+ * struct DRIVER drv_USBHUB
+ *
+ */
+
+#include "config.h"
+#include <stdint.h>
+
+#ifdef HAVE_USB_H
+#include <usb.h>
+#else
+#error The USB-HUB driver only makes sense with USB support
+#endif
+
+#include "debug.h"
+#include "cfg.h"
+#include "qprintf.h"
+#include "udelay.h"
+#include "drv.h"
+#include "drv_generic_gpio.h"
+
+
+
+#define HUB_CONTROL_PORT 0x23
+#define HUB_SET_FEATURE 3
+#define HUB_SET_INDICATOR 22
+
+static char Name[] = "USBHUB";
+
+/* TODO: Better not specify defaults here,
+ * instead look for the first suitable HUB arround if
+ * no Vendor/Product specified in config.
+ */
+
+static unsigned int hubVendor = 0x0409;
+static unsigned int hubProduct = 0x0058;
+
+static usb_dev_handle *hub = NULL;
+
+typedef struct _usb_hub_descriptor {
+ uint8_t bLength;
+ uint8_t bDescriptorType;
+ uint8_t nNbrPorts;
+ uint8_t wHubCharacteristicLow;
+ uint8_t wHubCharacteristicHigh;
+ uint8_t bPwrOn2PwrGood;
+ uint8_t bHubContrCurrent;
+ uint8_t deviceRemovable;
+ uint8_t PortPwrCtrlMask[8];
+} usb_hub_descriptor;
+
+/****************************************/
+/*** hardware dependant functions ***/
+/****************************************/
+
+
+static int drv_UH_open(void)
+{
+ struct usb_bus *busses, *bus;
+ struct usb_device *dev;
+
+ hub = NULL;
+
+ info("%s: scanning for an USB HUB (0x%04x:0x%04x)...", Name, hubVendor, hubProduct);
+
+ usb_init();
+ usb_find_busses();
+ usb_find_devices();
+ busses = usb_get_busses();
+
+ for (bus = busses; bus; bus = bus->next) {
+ for (dev = bus->devices; dev; dev = dev->next) {
+ if ((dev->descriptor.idVendor == hubVendor) && (dev->descriptor.idProduct == hubProduct)) {
+
+ unsigned int v = dev->descriptor.bcdDevice;
+
+ info("%s: found USBHUB V%1d%1d.%1d%1d on bus %s device %s", Name,
+ (v & 0xF000) >> 12, (v & 0xF00) >> 8, (v & 0xF0) >> 4, (v & 0xF), bus->dirname, dev->filename);
+
+ if (dev->descriptor.bDeviceClass != USB_CLASS_HUB) {
+ error("%s: the specified device claims to be no HUB", Name);
+ return -1;
+ }
+
+ hub = usb_open(dev);
+ if (!hub) {
+ error("%s: usb_open() failed!", Name);
+ return -1;
+ }
+ return 0;
+ }
+ }
+ }
+ error("%s: could not find a USB HUB", Name);
+ return -1;
+}
+
+
+static int drv_UH_close(void)
+{
+ debug("closing USB handle");
+
+ usb_close(hub);
+
+ return 0;
+}
+
+
+/*
+ * Set the Indicator status on port "num+1" to val.
+ * according to the USB Specification, the following values would be allowed:
+ *
+ * 0 : Automatic color (display link state etc)
+ * 1 : Amber
+ * 2 : Green
+ * 3 : Off
+ * 4..255: Reserved
+ *
+ */
+
+static int drv_UH_set(const int num, const int val)
+{
+ int ret;
+
+ if (!hub)
+ return -1;
+
+ if (val < 0 || val > 3) {
+ info("%s: value %d out of range (0..3)", Name, val);
+ return -1;
+ }
+
+ if ((ret = usb_control_msg(hub,
+ HUB_CONTROL_PORT,
+ HUB_SET_FEATURE, HUB_SET_INDICATOR, (val << 8) | (num + 1), NULL, 0, 1000)) != 0) {
+ info("%s: usb_control_msg failed with %d", Name, ret);
+ return -1;
+ }
+
+ return 0;
+}
+
+
+static int drv_UH_start(const char *section, const __attribute__ ((unused))
+ int quiet)
+{
+ char *buf;
+
+ usb_hub_descriptor hub_desc;
+ int ret;
+
+
+ buf = cfg_get(section, "Vendor", NULL);
+ if (buf) {
+ if (!*buf) {
+ error("%s: Strange Vendor Specification", Name);
+ return -1;
+ }
+ if (sscanf(buf, "0x%x", &hubVendor) != 1) {
+ error("%s: Strange Vendor Specification: [%s]", Name, buf);
+ return -1;
+ }
+ }
+
+ buf = cfg_get(section, "Product", NULL);
+ if (buf) {
+ if (!*buf) {
+ error("%s: Strange Product Specification", Name);
+ return -1;
+ }
+ if (sscanf(buf, "0x%x", &hubProduct) != 1) {
+ error("%s: Strange Product Specification: [%s]", Name, buf);
+ return -1;
+ }
+ }
+
+ if (drv_UH_open() < 0) {
+ return -1;
+ }
+
+
+ if ((ret = usb_control_msg(hub,
+ USB_ENDPOINT_IN | USB_TYPE_CLASS | USB_RECIP_DEVICE,
+ USB_REQ_GET_DESCRIPTOR, USB_DT_HUB << 8, 0, (char *) &hub_desc, sizeof(hub_desc),
+ 1000)) <= 8) {
+ error("%s: hub_get_descriptor failed with %d", Name, ret);
+ drv_UH_close();
+ return -1;
+ }
+ GPOS = hub_desc.nNbrPorts;
+ debug("%s: HUB claims to have %d ports. Configuring them as GPOs", Name, GPOS);
+ if (!(hub_desc.wHubCharacteristicLow & 0x80)) {
+ error("%s: HUB claims to have no Indicator LEDs (Characteristics 0x%04x). Bailing out.", Name,
+ (hub_desc.wHubCharacteristicHigh << 8) | hub_desc.wHubCharacteristicLow);
+ /* The HUB Tells us that there are no LEDs to control. Breaking? Maybe don't trust it and continue anyways? */
+ drv_UH_close();
+ return -1;
+
+ }
+
+ return 0;
+}
+
+
+/****************************************/
+/*** plugins ***/
+/****************************************/
+
+/* none at the moment... */
+
+
+/****************************************/
+/*** widget callbacks ***/
+/****************************************/
+
+
+/* using drv_generic_text_draw(W) */
+/* using drv_generic_text_icon_draw(W) */
+/* using drv_generic_text_bar_draw(W) */
+
+
+/****************************************/
+/*** exported functions ***/
+/****************************************/
+
+
+/* list models */
+int drv_UH_list(void)
+{
+ printf("USBHUB");
+ return 0;
+}
+
+
+/* initialize driver & display */
+int drv_UH_init(const char *section, const int quiet)
+{
+ int ret;
+ int i;
+
+ info("%s: %s", Name, "$Rev: 1203 $");
+
+
+
+ /* start display */
+ if ((ret = drv_UH_start(section, quiet)) != 0)
+ return ret;
+
+
+ /* real worker functions */
+ drv_generic_gpio_real_set = drv_UH_set;
+
+
+ /* initialize generic GPIO driver */
+ if ((ret = drv_generic_gpio_init(section, Name)) != 0)
+ return ret;
+
+ /* register gpio widget, done already by generic_gpio */
+
+ /* register plugins */
+ /* none at the moment... */
+
+ /* greeting */
+ if (!quiet) {
+ /* Light all LEDS green for a greeting */
+ for (i = 0; i < GPOS; ++i) {
+ drv_UH_set(i, 2);
+ }
+ sleep(1);
+ for (i = 0; i < GPOS; ++i) {
+ drv_UH_set(i, 3); /* OFF */
+ }
+ }
+
+
+ return 0;
+}
+
+
+/* close driver & display */
+int drv_UH_quit(const int quiet)
+{
+ int i;
+ debug("%s: shutting down.", Name);
+
+ /* say goodbye... */
+ if (!quiet) {
+ /* Light all LEDS amber for a goodbye */
+ for (i = 0; i < GPOS; ++i) {
+ drv_UH_set(i, 1);
+ }
+ sleep(1);
+
+ }
+
+ drv_generic_gpio_quit();
+
+ drv_UH_close();
+
+ info("%s: shutdown complete.", Name);
+ return 0;
+}
+
+
+DRIVER drv_USBHUB = {
+ .name = Name,
+ .list = drv_UH_list,
+ .init = drv_UH_init,
+ .quit = drv_UH_quit,
+};
diff --git a/drv_USBLCD.c b/drv_USBLCD.c
new file mode 100644
index 0000000..20346c6
--- /dev/null
+++ b/drv_USBLCD.c
@@ -0,0 +1,508 @@
+/* $Id: drv_USBLCD.c 1143 2011-02-12 22:46:19Z mzuther $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/drv_USBLCD.c $
+ *
+ * new style driver for USBLCD displays
+ *
+ * Copyright (C) 2003 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * based on the old-style USBLCD driver which is
+ * Copyright (C) 2002 Robin Adams, Adams IT Services <info@usblcd.de>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ *
+ * exported fuctions:
+ *
+ * struct DRIVER drv_USBLCD
+ *
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <unistd.h>
+#include <termios.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <sys/time.h>
+
+#ifdef HAVE_USB_H
+#include <usb.h>
+#endif
+
+#include "debug.h"
+#include "cfg.h"
+#include "qprintf.h"
+#include "udelay.h"
+#include "plugin.h"
+#include "widget.h"
+#include "widget_text.h"
+#include "widget_icon.h"
+#include "widget_bar.h"
+#include "drv.h"
+#include "drv_generic_text.h"
+
+
+#define USBLCD_VENDOR 0x10D2
+#define USBLCD_VENDOR2 0x1212
+#define USBLCD_DEVICE 0x0001
+
+#define IOC_GET_HARD_VERSION 1
+#define IOC_GET_DRV_VERSION 2
+
+
+static char Name[] = "USBLCD";
+
+static char *Port = NULL;
+static int use_libusb = 0;
+static int usblcd_file;
+static char *Buffer;
+static char *BufPtr;
+
+
+#ifdef HAVE_USB_H
+
+static usb_dev_handle *lcd;
+static int interface;
+
+#endif
+
+
+
+/****************************************/
+/*** hardware dependant functions ***/
+/****************************************/
+
+#ifdef HAVE_USB_H
+
+static int drv_UL_open(void)
+{
+ struct usb_bus *busses, *bus;
+ struct usb_device *dev;
+
+ lcd = NULL;
+
+ info("%s: scanning for USBLCD...", Name);
+
+ usb_set_debug(0);
+
+ usb_init();
+ usb_find_busses();
+ usb_find_devices();
+ busses = usb_get_busses();
+
+ for (bus = busses; bus; bus = bus->next) {
+ for (dev = bus->devices; dev; dev = dev->next) {
+ if (((dev->descriptor.idVendor == USBLCD_VENDOR) ||
+ (dev->descriptor.idVendor == USBLCD_VENDOR2)) && (dev->descriptor.idProduct == USBLCD_DEVICE)) {
+
+ unsigned int v = dev->descriptor.bcdDevice;
+
+ info("%s: found USBLCD V%1d%1d.%1d%1d on bus %s device %s", Name,
+ (v & 0xF000) >> 12, (v & 0xF00) >> 8, (v & 0xF0) >> 4, (v & 0xF), bus->dirname, dev->filename);
+
+ interface = 0;
+ lcd = usb_open(dev);
+ if (usb_claim_interface(lcd, interface) < 0) {
+ error("%s: usb_claim_interface() failed!", Name);
+ error("%s: maybe you have the usblcd module loaded?", Name);
+ return -1;
+ }
+ return 0;
+ }
+ }
+ }
+ error("%s: could not find a USBLCD", Name);
+ return -1;
+}
+
+
+static int drv_UL_close(void)
+{
+ usb_release_interface(lcd, interface);
+ usb_close(lcd);
+
+ return 0;
+}
+
+#endif
+
+
+static void drv_UL_send(void)
+{
+
+#if 0
+ struct timeval now, end;
+ gettimeofday(&now, NULL);
+#endif
+
+ if (use_libusb) {
+#ifdef HAVE_USB_H
+ /* Fixme: Endpoint hardcoded to 1 ??? */
+ usb_bulk_write(lcd, 1, Buffer, BufPtr - Buffer, 1000);
+#endif
+ } else {
+ write(usblcd_file, Buffer, BufPtr - Buffer);
+ }
+
+
+#if 0
+ gettimeofday(&end, NULL);
+ debug("send %d bytes in %d usec (%d usec/byte)", BufPtr - Buffer,
+ (1000000 * (end.tv_sec - now.tv_sec) + end.tv_usec - now.tv_usec),
+ (1000000 * (end.tv_sec - now.tv_sec) + end.tv_usec - now.tv_usec) / (BufPtr - Buffer));
+#endif
+
+ BufPtr = Buffer;
+}
+
+
+static void drv_UL_command(const unsigned char cmd)
+{
+ *BufPtr++ = '\0';
+ *BufPtr++ = cmd;
+}
+
+
+static void drv_UL_clear(void)
+{
+ drv_UL_command(0x01); /* clear display */
+ drv_UL_command(0x03); /* return home */
+ drv_UL_send(); /* flush buffer */
+}
+
+
+static void drv_UL_write(const int row, const int col, const char *data, int len)
+{
+ int pos;
+
+ /* 16x4 Displays use a slightly different layout */
+ if (DCOLS == 16 && DROWS == 4) {
+ pos = (row % 2) * 64 + (row / 2) * 16 + col;
+ } else {
+ pos = (row % 2) * 64 + (row / 2) * 20 + col;
+ }
+
+ drv_UL_command(0x80 | pos);
+
+ while (len--) {
+ if (*data == 0)
+ *BufPtr++ = 0;
+ *BufPtr++ = *data++;
+ }
+
+ drv_UL_send();
+}
+
+static void drv_UL_defchar(const int ascii, const unsigned char *matrix)
+{
+ int i;
+
+ drv_UL_command(0x40 | 8 * ascii);
+
+ for (i = 0; i < 8; i++) {
+ if ((*matrix & 0x1f) == 0)
+ *BufPtr++ = 0;
+ *BufPtr++ = *matrix++ & 0x1f;
+ }
+
+ drv_UL_send();
+}
+
+
+static int drv_UL_start(const char *section, const int quiet)
+{
+ int rows = -1, cols = -1;
+ int major, minor;
+ char *port, *s;
+ char buf[128];
+
+ if (Port) {
+ free(Port);
+ Port = NULL;
+ }
+
+ if ((port = cfg_get(section, "Port", NULL)) == NULL || *port == '\0') {
+ error("%s: no '%s.Port' entry from %s", Name, section, cfg_source());
+ return -1;
+ }
+
+ if (strcasecmp(port, "libusb") == 0) {
+#ifdef HAVE_USB_H
+ use_libusb = 1;
+ debug("using libusb");
+#else
+ error("%s: cannot use 'libusb' port.", Name);
+ error("%s: lcd4linux was compiled without libusb support!", Name);
+ return -1;
+#endif
+ } else {
+ if (port[0] == '/') {
+ Port = strdup(port);
+ } else {
+ int len = 5 + strlen(port) + 1;
+ Port = malloc(len);
+ qprintf(Port, len, "/dev/%s", port);
+ }
+ debug("using device %s ", Port);
+ }
+
+ s = cfg_get(section, "Size", NULL);
+ if (s == NULL || *s == '\0') {
+ error("%s: no '%s.Size' entry from %s", Name, section, cfg_source());
+ return -1;
+ }
+ if (sscanf(s, "%dx%d", &cols, &rows) != 2 || rows < 1 || cols < 1) {
+ error("%s: bad %s.Size '%s' from %s", Name, section, s, cfg_source());
+ free(s);
+ return -1;
+ }
+
+ DROWS = rows;
+ DCOLS = cols;
+
+ if (use_libusb) {
+
+#ifdef HAVE_USB_H
+ if (drv_UL_open() < 0) {
+ return -1;
+ }
+#endif
+
+ } else {
+
+ /* open port */
+ usblcd_file = open(Port, O_WRONLY);
+ if (usblcd_file == -1) {
+ error("%s: open(%s) failed: %s", Name, Port, strerror(errno));
+ return -1;
+ }
+
+ /* get driver version */
+ memset(buf, 0, sizeof(buf));
+ if (ioctl(usblcd_file, IOC_GET_DRV_VERSION, buf) != 0) {
+ error("%s: ioctl() failed, could not get Driver Version!", Name);
+ return -1;
+ }
+ info("%s: Driver Version: %s", Name, buf);
+
+ if (sscanf(buf, "USBLCD Driver Version %d.%d", &major, &minor) != 2) {
+ error("%s: could not read Driver Version!", Name);
+ return -1;
+ }
+ if (major != 1) {
+ error("%s: Driver Version %d not supported!", Name, major);
+ return -1;
+ }
+
+ memset(buf, 0, sizeof(buf));
+ if (ioctl(usblcd_file, IOC_GET_HARD_VERSION, buf) != 0) {
+ error("%s: ioctl() failed, could not get Hardware Version!", Name);
+ return -1;
+ }
+ info("%s: Hardware Version: %s", Name, buf);
+
+ if (sscanf(buf, "%d.%d", &major, &minor) != 2) {
+ error("%s: could not read Hardware Version!", Name);
+ return -1;
+ }
+
+ if (major != 1) {
+ error("%s: Hardware Version %d not supported!", Name, major);
+ return -1;
+ }
+ }
+
+ /* Init the command buffer */
+ Buffer = (char *) malloc(1024);
+ if (Buffer == NULL) {
+ error("%s: command buffer could not be allocated: malloc() failed", Name);
+ return -1;
+ }
+ BufPtr = Buffer;
+
+ /* initialize display */
+ drv_UL_command(0x29); /* 8 Bit mode, 1/16 duty cycle, 5x8 font */
+ drv_UL_command(0x08); /* Display off, cursor off, blink off */
+ drv_UL_command(0x0c); /* Display on, cursor off, blink off */
+ drv_UL_command(0x06); /* curser moves to right, no shift */
+
+ drv_UL_clear(); /* clear display */
+
+ if (!quiet) {
+ char buffer[40];
+ qprintf(buffer, sizeof(buffer), "%s %dx%d", Name, DCOLS, DROWS);
+ if (drv_generic_text_greet(buffer, "http://www.usblcd.de")) {
+ sleep(3);
+ drv_UL_clear();
+ }
+ }
+
+ return 0;
+}
+
+
+/****************************************/
+/*** plugins ***/
+/****************************************/
+
+/* none at the moment... */
+
+
+/****************************************/
+/*** widget callbacks ***/
+/****************************************/
+
+
+/* using drv_generic_text_draw(W) */
+/* using drv_generic_text_icon_draw(W) */
+/* using drv_generic_text_bar_draw(W) */
+
+
+/****************************************/
+/*** exported functions ***/
+/****************************************/
+
+
+/* list models */
+int drv_UL_list(void)
+{
+ printf("USBLCD");
+ return 0;
+}
+
+
+/* initialize driver & display */
+int drv_UL_init(const char *section, const int quiet)
+{
+ WIDGET_CLASS wc;
+ int asc255bug;
+ int ret;
+
+ info("%s: %s", Name, "$Rev: 1143 $");
+
+ /* display preferences */
+ XRES = 5; /* pixel width of one char */
+ YRES = 8; /* pixel height of one char */
+ CHARS = 8; /* number of user-defineable characters */
+ CHAR0 = 0; /* ASCII of first user-defineable char */
+ GOTO_COST = 2; /* number of bytes a goto command requires */
+
+ /* real worker functions */
+ drv_generic_text_real_write = drv_UL_write;
+ drv_generic_text_real_defchar = drv_UL_defchar;
+
+
+ /* start display */
+ if ((ret = drv_UL_start(section, quiet)) != 0)
+ return ret;
+
+ /* initialize generic text driver */
+ if ((ret = drv_generic_text_init(section, Name)) != 0)
+ return ret;
+
+ /* initialize generic icon driver */
+ if ((ret = drv_generic_text_icon_init()) != 0)
+ return ret;
+
+ /* initialize generic bar driver */
+ if ((ret = drv_generic_text_bar_init(0)) != 0)
+ return ret;
+
+ /* add fixed chars to the bar driver */
+ /* most displays have a full block on ascii 255, but some have kind of */
+ /* an 'inverted P'. If you specify 'asc255bug 1 in the config, this */
+ /* char will not be used, but rendered by the bar driver */
+ cfg_number(section, "asc255bug", 0, 0, 1, &asc255bug);
+ drv_generic_text_bar_add_segment(0, 0, 255, 32); /* ASCII 32 = blank */
+ if (!asc255bug)
+ drv_generic_text_bar_add_segment(255, 255, 255, 255); /* ASCII 255 = block */
+
+ /* register text widget */
+ wc = Widget_Text;
+ wc.draw = drv_generic_text_draw;
+ widget_register(&wc);
+
+ /* register icon widget */
+ wc = Widget_Icon;
+ wc.draw = drv_generic_text_icon_draw;
+ widget_register(&wc);
+
+ /* register bar widget */
+ wc = Widget_Bar;
+ wc.draw = drv_generic_text_bar_draw;
+ widget_register(&wc);
+
+ /* register plugins */
+ /* none at the moment... */
+
+
+ return 0;
+}
+
+
+/* close driver & display */
+int drv_UL_quit(const int quiet)
+{
+
+ info("%s: shutting down.", Name);
+
+ /* flush buffer */
+ drv_UL_send();
+
+ drv_generic_text_quit();
+
+ /* clear display */
+ drv_UL_clear();
+
+ /* say goodbye... */
+ if (!quiet) {
+ drv_generic_text_greet("goodbye!", NULL);
+ }
+
+ if (use_libusb) {
+#ifdef HAVE_USB_H
+ drv_UL_close();
+#endif
+ } else {
+ debug("closing port %s", Port);
+ close(usblcd_file);
+ }
+
+ if (Buffer) {
+ free(Buffer);
+ Buffer = NULL;
+ BufPtr = Buffer;
+ }
+
+ return (0);
+}
+
+
+DRIVER drv_USBLCD = {
+ .name = Name,
+ .list = drv_UL_list,
+ .init = drv_UL_init,
+ .quit = drv_UL_quit,
+};
diff --git a/drv_WincorNixdorf.c b/drv_WincorNixdorf.c
new file mode 100644
index 0000000..ef090e4
--- /dev/null
+++ b/drv_WincorNixdorf.c
@@ -0,0 +1,276 @@
+/* $Id: drv_WincorNixdorf.c 840 2007-09-09 12:17:42Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/drv_WincorNixdorf.c $
+ *
+ * driver for WincorNixdorf serial cashier displays BA63 and BA66
+ *
+ * Copyright (C) 2005 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2005 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * based on the SimpleLCD driver which is
+ * Copyright (C) 2005 Julien Aube <ob@obconseil.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ *
+ * exported fuctions:
+ *
+ * struct DRIVER drv_WincorNixdorf
+ *
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <termios.h>
+
+#include "debug.h"
+#include "cfg.h"
+#include "qprintf.h"
+#include "plugin.h"
+#include "widget.h"
+#include "widget_text.h"
+#include "widget_bar.h"
+#include "drv.h"
+#include "drv_generic_text.h"
+#include "drv_generic_serial.h"
+
+
+#define ESC "\033"
+
+
+static char Name[] = "WincorNixdorf";
+
+typedef struct {
+ int type;
+ char *name;
+ int rows;
+ int cols;
+} MODEL;
+
+static MODEL Models[] = {
+ {63, "BA63", 2, 20},
+ {66, "BA66", 4, 20},
+ {-1, "unknown", -1, -1},
+};
+
+static int Model;
+
+
+/****************************************/
+/*** hardware dependant functions ***/
+/****************************************/
+
+static void drv_WN_clear(void)
+{
+ drv_generic_serial_write(ESC "[2J", 4);
+}
+
+
+static void drv_WN_write(const int row, const int col, const char *data, int len)
+{
+ char cmd[8] = ESC "[r;ccH";
+
+ cmd[2] = '1' + row;
+ cmd[4] = '0' + (col / 10);
+ cmd[5] = '1' + (col % 10);
+
+ drv_generic_serial_write(cmd, 7);
+ drv_generic_serial_write(data, len);
+}
+
+
+static int drv_WN_start(const char *section, const int quiet)
+{
+ int i, len;
+ int selftest;
+ char *model = NULL;
+ char buffer[32];
+
+ model = cfg_get(section, "Model", NULL);
+ if (model == NULL && *model == '\0') {
+ error("%s: no '%s.Model' entry from %s", Name, section, cfg_source());
+ return -1;
+ }
+
+ for (i = 0; Models[i].type != -1; i++) {
+ if (strcasecmp(Models[i].name, model) == 0)
+ break;
+ }
+ if (Models[i].type == -1) {
+ error("%s: %s.Model '%s' is unknown from %s", Name, section, model, cfg_source());
+ return -1;
+ }
+ Model = i;
+ info("%s: using model '%s'", Name, Models[Model].name);
+
+ /* initialize global variables */
+ DROWS = Models[Model].rows;
+ DCOLS = Models[Model].cols;
+
+ if (drv_generic_serial_open(section, Name, CS8 | PARENB | PARODD) < 0)
+ return -1;
+
+ /* real worker functions */
+ drv_generic_text_real_write = drv_WN_write;
+
+ cfg_number(section, "SelfTest", 0, 0, 1, &selftest);
+ if (selftest) {
+ info("%s: initiating display selftest sequence", Name);
+
+ /* read display identification */
+ drv_generic_serial_write(ESC "[0c", 4);
+ usleep(100 * 1000);
+
+ if ((len = drv_generic_serial_read(buffer, -1 * (int) sizeof(buffer))) > 0) {
+ info("%s: waiting 15 seconds for selftest", Name);
+ drv_generic_serial_write(buffer, len);
+ sleep(15);
+ info("%s: selftest finished", Name);
+ } else {
+ info("%s: selftest initiation failed", Name);
+ }
+ }
+
+ /* clear display */
+ drv_WN_clear();
+
+ if (!quiet) {
+ char buffer[40];
+ qprintf(buffer, sizeof(buffer), "%s %dx%d", Name, DCOLS, DROWS);
+ if (drv_generic_text_greet(buffer, NULL)) {
+ sleep(3);
+ drv_WN_clear();
+ }
+ }
+
+ return 0;
+}
+
+
+/****************************************/
+/*** plugins ***/
+/****************************************/
+
+/* none */
+
+
+/****************************************/
+/*** widget callbacks ***/
+/****************************************/
+
+
+/* using drv_generic_text_draw(W) */
+
+
+/****************************************/
+/*** exported functions ***/
+/****************************************/
+
+
+/* list models */
+int drv_WN_list(void)
+{
+ printf("BA63 BA66");
+ return 0;
+}
+
+
+/* initialize driver & display */
+int drv_WN_init(const char *section, const int quiet)
+{
+ WIDGET_CLASS wc;
+ int ascii;
+ int ret;
+
+ info("%s: %s", Name, "$Rev: 840 $");
+
+ /* display preferences */
+ XRES = 5; /* pixel width of one char */
+ YRES = 7; /* pixel height of one char */
+ CHARS = 0; /* number of user-defineable characters */
+ CHAR0 = 0; /* ASCII of first user-defineable char */
+ ICONS = 0; /* number of user-defineable characters reserved for icons */
+ GOTO_COST = 6; /* number of bytes a goto command requires */
+
+ /* start display */
+ if ((ret = drv_WN_start(section, quiet)) != 0)
+ return ret;
+
+ /* initialize generic text driver */
+ if ((ret = drv_generic_text_init(section, Name)) != 0)
+ return ret;
+
+ /* initialize generic bar driver */
+ if ((ret = drv_generic_text_bar_init(1)) != 0)
+ return ret;
+
+ cfg_number(section, "BarChar", '*', 1, 255, &ascii);
+
+ /* add fixed chars to the bar driver */
+ drv_generic_text_bar_add_segment(0, 0, 255, 32); /* ASCII 32 = blank */
+ drv_generic_text_bar_add_segment(255, 255, 255, ascii);
+
+ /* register text widget */
+ wc = Widget_Text;
+ wc.draw = drv_generic_text_draw;
+ widget_register(&wc);
+
+ /* register bar widget */
+ wc = Widget_Bar;
+ wc.draw = drv_generic_text_bar_draw;
+ widget_register(&wc);
+
+ /* register plugins */
+ /* none */
+
+ return 0;
+}
+
+
+/* close driver & display */
+int drv_WN_quit(const int quiet)
+{
+
+ info("%s: shutting down.", Name);
+
+ drv_generic_text_quit();
+
+ /* clear display */
+ drv_WN_clear();
+
+ /* say goodbye... */
+ if (!quiet) {
+ drv_generic_text_greet("goodbye!", NULL);
+ }
+
+ drv_generic_serial_close();
+
+ return (0);
+}
+
+
+DRIVER drv_WincorNixdorf = {
+ .name = Name,
+ .list = drv_WN_list,
+ .init = drv_WN_init,
+ .quit = drv_WN_quit,
+};
diff --git a/drv_X11.c b/drv_X11.c
new file mode 100644
index 0000000..e92b769
--- /dev/null
+++ b/drv_X11.c
@@ -0,0 +1,808 @@
+/* $Id: drv_X11.c 1125 2010-07-11 11:17:41Z mzuther $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/drv_X11.c $
+ *
+ * new style X11 Driver for LCD4Linux
+ *
+ * Copyright (C) 2003 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2004, 2008 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * based on the old XWindow.c which is
+ * Copyright (C) 2000 Herbert Rosmanith <herp@wildsau.idv.uni-linz.ac.at>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ *
+ * exported fuctions:
+ *
+ * struct DRIVER drv_X11
+ *
+ */
+
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <unistd.h>
+#include <termios.h>
+#include <fcntl.h>
+#include <sys/time.h>
+#include <signal.h>
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <X11/Xresource.h>
+
+#include "debug.h"
+#include "cfg.h"
+#include "qprintf.h"
+#include "timer.h"
+#include "plugin.h"
+#include "rgb.h"
+#include "drv.h"
+#include "widget.h"
+#include "widget_keypad.h"
+#include "drv_generic_graphic.h"
+#include "drv_generic_keypad.h"
+
+#ifdef WITH_DMALLOC
+#include <dmalloc.h>
+#endif
+
+static char Name[] = "X11";
+
+static int pixel = -1; /* pointsize in pixel */
+static int pgap = 0; /* gap between points */
+static int rgap = 0; /* row gap between lines */
+static int cgap = 0; /* column gap between characters */
+static int border = 0; /* window border */
+static int buttons = 0; /* number of keypad buttons */
+static int btnwidth = 0;
+static int btnheight = 0;
+
+static int dimx, dimy; /* total window dimension in pixel */
+static Atom wmDeleteMessage;
+
+static RGBA *drv_X11_FB = NULL; /* framebuffer */
+
+static RGBA BP_COL = {.R = 0xff,.G = 0xff,.B = 0xff,.A = 0x00 }; /* pixel background color */
+static RGBA BR_COL = {.R = 0xff,.G = 0xff,.B = 0xff,.A = 0x00 }; /* border color */
+
+static Display *dp;
+static int sc, dd;
+static Window w, rw;
+static Visual *vi;
+static GC gc;
+static Colormap cm;
+static Pixmap pm;
+
+static int allow_autorepeat = 1; /* consider auto-repeated KeyPress events? */
+
+static char myDisplayName[256] = "";
+static int opTableEntries = 2;
+static XrmOptionDescRec opTable[] = {
+ {"-display", ".display", XrmoptionSepArg, NULL},
+ {"-synchronous", "*synchronous", XrmoptionNoArg, "on"},
+};
+
+static XrmDatabase commandlineDB;
+
+
+/****************************************/
+/*** hardware dependant functions ***/
+/****************************************/
+
+static XColor drv_X11_color(RGBA c, int brightness)
+{
+ static XColor col[64];
+ static unsigned char alloced[64] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ };
+ XColor xc;
+ int key;
+
+ xc.red = brightness * c.R;
+ xc.green = brightness * c.G;
+ xc.blue = brightness * c.B;
+ /* 16bits per color, compressed to 6 bits (2 each color) */
+ key = (xc.red & 0xc000) >> 10 | (xc.green & 0xc000) >> 12 | (xc.blue & 0xc000) >> 14;
+ /* todo: support more than 64 colors: check if allocated color is exactly the requested */
+ if (alloced[key]) {
+ xc = col[key];
+ } else {
+ xc.flags = DoRed | DoGreen | DoBlue;
+ if (XAllocColor(dp, cm, &xc) == False) {
+ error("%s: XAllocColor(%02x%02x%02x) failed!", Name, c.R, c.G, c.B);
+ }
+ col[key] = xc;
+ alloced[key] = 1;
+ }
+
+ XSetForeground(dp, gc, xc.pixel);
+
+ return (xc);
+}
+
+
+static void drv_X11_blit(const int row, const int col, const int height, const int width)
+{
+ int r, c;
+
+ for (r = row; r < row + height; r++) {
+ int y = border + (r / YRES) * rgap + r * (pixel + pgap);
+ for (c = col; c < col + width; c++) {
+ int x = border + (c / XRES) * cgap + c * (pixel + pgap);
+ RGBA p1 = drv_X11_FB[r * DCOLS + c];
+ RGBA p2 = drv_generic_graphic_rgb(r, c);
+ if (p1.R != p2.R || p1.G != p2.G || p1.B != p2.B) {
+ XClearArea(dp, w, x, y, pixel, pixel, 1);
+ drv_X11_FB[r * DCOLS + c] = p2;
+ }
+ }
+ }
+}
+
+
+static int drv_X11_brightness(int brightness)
+{
+ static int Brightness = 255;
+ int i;
+
+ /* -1 is used to query the current brightness */
+ if (brightness == -1)
+ return Brightness;
+
+ if (brightness < 0)
+ brightness = 0;
+ if (brightness > 255)
+ brightness = 255;
+
+ if (Brightness != brightness) {
+
+ float dim = brightness / 255.0;
+
+ debug("%s: set brightness to %d%%", Name, (int) (dim * 100));
+
+ /* set new background */
+ XSetWindowBackground(dp, w, drv_X11_color(BR_COL, brightness).pixel);
+
+ /* redraw every LCD pixel */
+ XClearWindow(dp, w);
+ for (i = 0; i < DROWS * DCOLS; i++) {
+ drv_X11_FB[i] = NO_COL;
+ }
+ drv_X11_blit(0, 0, LROWS, LCOLS);
+
+ /* remember new brightness */
+ Brightness = brightness;
+ }
+
+ return Brightness;
+}
+
+
+static int drv_X11_keypad(const int num)
+{
+ int val;
+ int new_num = num;
+
+ if (new_num > 0)
+ val = WIDGET_KEY_PRESSED;
+ else {
+ /* negative values mark a key release */
+ new_num = -num;
+ val = WIDGET_KEY_RELEASED;
+ }
+
+ switch (new_num) {
+ case 1:
+ val += WIDGET_KEY_UP;
+ break;
+ case 2:
+ val += WIDGET_KEY_DOWN;
+ break;
+ case 3:
+ val += WIDGET_KEY_LEFT;
+ break;
+ case 4:
+ val += WIDGET_KEY_RIGHT;
+ break;
+ case 5:
+ val += WIDGET_KEY_CONFIRM;
+ break;
+ case 6:
+ val += WIDGET_KEY_CANCEL;
+ break;
+ default:
+ error("%s: unknown keypad value %d", Name, num);
+ }
+
+ return val;
+}
+
+
+static void drv_X11_expose(const int x, const int y, const int width, const int height)
+{
+ /*
+ * theory of operation:
+ * instead of the old, fully-featured but complicated update
+ * region calculation, we do an update of the whole display,
+ * but check before every pixel if the pixel region is inside
+ * the update region.
+ */
+
+ int r, c;
+ int x0, y0;
+ int x1, y1;
+ XFontStruct *xfs;
+ int xoffset = border + (DCOLS / XRES) * cgap + DCOLS * (pixel + pgap);
+ int yoffset = border + (DROWS / YRES) * rgap;
+ int yk;
+ char *s;
+ char unknownTxt[10];
+ XRectangle rect[DROWS * DCOLS];
+ int nrect = 0;
+ RGBA col;
+ RGBA lastCol = { 0, 0, 0, 0 };
+ int hasLastCol = 0;
+ int brightness = drv_X11_brightness(-1);
+
+ x0 = x - pixel;
+ x1 = x + pixel + width;
+ y0 = y - pixel;
+ y1 = y + pixel + height;
+
+ for (r = 0; r < DROWS; r++) {
+ int yc = border + (r / YRES) * rgap + r * (pixel + pgap);
+ if (yc < y0 || yc > y1)
+ continue;
+ for (c = 0; c < DCOLS; c++) {
+ int xc = border + (c / XRES) * cgap + c * (pixel + pgap);
+ if (xc < x0 || xc > x1)
+ continue;
+ col = drv_generic_graphic_rgb(r, c);
+ if (hasLastCol) {
+ /* if the color of this pixel is different to the last pixels draw the old ones */
+ if (col.R != lastCol.R || col.G != lastCol.G || col.B != lastCol.B) {
+ drv_X11_color(lastCol, brightness);
+ XFillRectangles(dp, w, gc, rect, nrect);
+ nrect = 0;
+ lastCol = col;
+ }
+ rect[nrect].x = xc;
+ rect[nrect].y = yc;
+ rect[nrect].width = pixel;
+ rect[nrect].height = pixel;
+ nrect++;
+ } else {
+ /* 1st shot: no old color */
+ drv_X11_color(col, brightness);
+ XFillRectangle(dp, w, gc, xc, yc, pixel, pixel);
+ lastCol = col;
+ hasLastCol = 1;
+ }
+ }
+ }
+ /* draw the last block of rectangles */
+ drv_X11_color(lastCol, brightness);
+ XFillRectangles(dp, w, gc, rect, nrect);
+
+ /* Keypad on the right side */
+ if (x1 >= xoffset) {
+ xfs = XQueryFont(dp, XGContextFromGC(DefaultGC(dp, 0)));
+ if (drv_X11_brightness(-1) > 127) {
+ drv_X11_color(FG_COL, 255);
+ } else {
+ drv_X11_color(BG_COL, 255);
+ }
+ for (r = 0; r < buttons; r++) {
+ yk = yoffset + r * (btnheight + pgap);
+ switch (r) {
+ case 0:
+ s = "Up";
+ break;
+ case 1:
+ s = "Down";
+ break;
+ case 2:
+ s = "Left";
+ break;
+ case 3:
+ s = "Right";
+ break;
+ case 4:
+ s = "Confirm";
+ break;
+ case 5:
+ s = "Cancel";
+ break;
+ default:
+ snprintf(unknownTxt, sizeof(unknownTxt), "#%d??", r);
+ s = unknownTxt;
+ }
+ XDrawRectangle(dp, w, gc, xoffset, yk, btnwidth, btnheight - 2);
+ XDrawString(dp, w, gc,
+ xoffset + btnwidth / 2 - (xfs->max_bounds.width * strlen(s)) / 2,
+ yk + btnheight / 2 + xfs->max_bounds.ascent / 2, s, strlen(s));
+ }
+ }
+}
+
+
+static void drv_X11_timer( __attribute__ ((unused))
+ void *notused)
+{
+ XEvent ev;
+ XRectangle exp;
+ KeySym key;
+ int xoffset = border + (DCOLS / XRES) * cgap + DCOLS * (pixel + pgap);
+ int yoffset = border + (DROWS / YRES) * rgap;
+ static int btn = 0;
+
+ if (XCheckWindowEvent
+ (dp, w, ExposureMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask, &ev) == 0
+ /* there is no ClientMessageMask, so this will be checked separately */
+ && XCheckTypedWindowEvent(dp, w, ClientMessage, &ev) == 0)
+ return;
+
+ /* check whether key has been retriggered by "auto repeat" */
+ unsigned short is_retriggered = 0;
+
+ switch (ev.type) {
+
+ case Expose:
+ /* collect all expose events in eventqueue */
+ exp.x = ev.xexpose.x;
+ exp.y = ev.xexpose.y;
+ exp.width = ev.xexpose.width;
+ exp.height = ev.xexpose.height;
+ while (XCheckWindowEvent(dp, w, ExposureMask, &ev)) {
+ if (ev.xexpose.x < exp.x) {
+ exp.width += exp.x - ev.xexpose.x;
+ exp.x -= exp.x - ev.xexpose.x;
+ }
+ if (ev.xexpose.y < exp.y) {
+ exp.height += exp.y - ev.xexpose.y;
+ exp.y -= exp.y - ev.xexpose.y;
+ }
+ if (ev.xexpose.x + ev.xexpose.width > exp.x + exp.width) {
+ exp.width += ev.xexpose.x + ev.xexpose.width - (exp.x + exp.width);
+ }
+ if (ev.xexpose.y + ev.xexpose.height > exp.y + exp.height) {
+ exp.height += ev.xexpose.y + ev.xexpose.height - (exp.y + exp.height);
+ }
+ }
+ drv_X11_expose(exp.x, exp.y, exp.width, exp.height);
+ break;
+
+ case KeyPress:
+ key = XLookupKeysym(&ev.xkey, 0);
+ switch (key) {
+ case XK_Up:
+ btn = 1;
+ break;
+ case XK_Down:
+ btn = 2;
+ break;
+ case XK_Left:
+ btn = 3;
+ break;
+ case XK_Right:
+ btn = 4;
+ break;
+ case XK_Return:
+ btn = 5;
+ break;
+ case XK_Escape:
+ btn = 6;
+ break;
+ default:
+ btn = 0;
+ }
+ /* only register key press if button is defined on GUI */
+ if (btn > 0) {
+ if (btn <= buttons) {
+ debug("key for button %i pressed", btn);
+ drv_X11_color(BG_COL, 255);
+ XFillRectangle(dp, w, gc, xoffset + 1, yoffset + (btn - 1) * (btnheight + pgap) + 1, btnwidth - 1,
+ btnheight - 2 - 1);
+ drv_generic_keypad_press(btn);
+ } else {
+ debug("key press for button %i ignored", btn);
+ }
+ }
+ break;
+
+ case KeyRelease:
+ /* check whether key has been retriggered by "auto repeat" */
+ if (!allow_autorepeat && XEventsQueued(dp, QueuedAfterReading)) {
+ XEvent nev;
+ XPeekEvent(dp, &nev);
+
+ if (nev.type == KeyPress && nev.xkey.time == ev.xkey.time && nev.xkey.keycode == ev.xkey.keycode) {
+ is_retriggered = 1;
+
+ /* delete retriggered KeyPress event */
+ XNextEvent(dp, &ev);
+ }
+ }
+
+ key = XLookupKeysym(&ev.xkey, 0);
+ switch (key) {
+ case XK_Up:
+ btn = 1;
+ break;
+ case XK_Down:
+ btn = 2;
+ break;
+ case XK_Left:
+ btn = 3;
+ break;
+ case XK_Right:
+ btn = 4;
+ break;
+ case XK_Return:
+ btn = 5;
+ break;
+ case XK_Escape:
+ btn = 6;
+ break;
+ }
+ /* only register key release if button is defined on GUI */
+ if (!is_retriggered && (btn > 0)) {
+ if (btn <= buttons) {
+ debug("key for button %i released", btn);
+ XClearArea(dp, w, xoffset, yoffset + (btn - 1) * (btnheight + pgap), btnwidth, btnheight - 2,
+ 1 /* true */ );
+ /* negative values mark a key release */
+ drv_generic_keypad_press(-btn);
+ } else {
+ debug("key release for button %i ignored", btn);
+ }
+ }
+ break;
+
+ case ButtonPress:
+ if (ev.xbutton.x >= xoffset && ev.xbutton.x <= xoffset + btnwidth
+ && ev.xbutton.y >= yoffset && ev.xbutton.y <= yoffset + buttons * btnheight + (buttons - 1) * pgap) {
+ btn = (ev.xbutton.y - yoffset) / (btnheight + pgap) + 1; /* btn 0 is unused */
+ debug("button %d pressed", btn);
+ drv_X11_color(BG_COL, 255);
+ XFillRectangle(dp, w, gc, xoffset + 1, yoffset + (btn - 1) * (btnheight + pgap) + 1, btnwidth - 1,
+ btnheight - 2 - 1);
+ drv_generic_keypad_press(btn);
+ }
+ break;
+
+ case ButtonRelease:
+ if (ev.xbutton.x >= xoffset && ev.xbutton.x <= xoffset + btnwidth
+ && ev.xbutton.y >= yoffset && ev.xbutton.y <= yoffset + buttons * btnheight + (buttons - 1) * pgap) {
+ btn = (ev.xbutton.y - yoffset) / (btnheight + pgap) + 1; /* btn 0 is unused */
+ debug("button %d released", btn);
+ XClearArea(dp, w, xoffset, yoffset + (btn - 1) * (btnheight + pgap), btnwidth, btnheight - 2,
+ 1 /* true */ );
+ }
+ break;
+
+ case ClientMessage:
+ if ((Atom) (ev.xclient.data.l[0]) == wmDeleteMessage) {
+ info("%s: Window closed by WindowManager, quit.", Name);
+ if (raise(SIGTERM) != 0) {
+ error("%s: Error raising SIGTERM: exit!", Name);
+ exit(1);
+ }
+ } else {
+ debug("%s: Got XClient message 0x%lx %lx %lx %lx %lx", Name, ev.xclient.data.l[0],
+ ev.xclient.data.l[1], ev.xclient.data.l[2], ev.xclient.data.l[3], ev.xclient.data.l[4]);
+ }
+
+ default:
+ debug("%s: unknown XEvent %d", Name, ev.type);
+ }
+}
+
+
+static int drv_X11_start(const char *section)
+{
+ int i;
+ char *s;
+ XrmValue value;
+ char *str_type[20];
+ XSetWindowAttributes wa;
+ XSizeHints sh;
+ XEvent ev;
+
+ /* read display size from config */
+ if (sscanf(s = cfg_get(section, "Size", "120x32"), "%dx%d", &DCOLS, &DROWS) != 2 || DCOLS < 1 || DROWS < 1) {
+ error("%s: bad %s.Size '%s' from %s", Name, section, s, cfg_source());
+ free(s);
+ return -1;
+ }
+ free(s);
+
+ if (sscanf(s = cfg_get(section, "font", "5x8"), "%dx%d", &XRES, &YRES) != 2 || XRES < 1 || YRES < 1) {
+ error("%s: bad %s.font '%s' from %s", Name, section, s, cfg_source());
+ free(s);
+ return -1;
+ }
+ free(s);
+
+ if (sscanf(s = cfg_get(section, "pixel", "4+1"), "%d+%d", &pixel, &pgap) != 2 || pixel < 1 || pgap < 0) {
+ error("%s: bad %s.pixel '%s' from %s", Name, section, s, cfg_source());
+ free(s);
+ return -1;
+ }
+ free(s);
+
+ if (sscanf(s = cfg_get(section, "gap", "-1x-1"), "%dx%d", &cgap, &rgap) != 2 || cgap < -1 || rgap < -1) {
+ error("%s: bad %s.gap '%s' from %s", Name, section, s, cfg_source());
+ free(s);
+ return -1;
+ }
+ free(s);
+
+ if (rgap < 0)
+ rgap = pixel + pgap;
+ if (cgap < 0)
+ cgap = pixel + pgap;
+
+ if (cfg_number(section, "border", 0, 0, -1, &border) < 0)
+ return -1;
+
+ /* special case for the X11 driver:
+ * the border color may be different from the backlight color
+ * the backlight color is the color of an inactive pixel
+ * the border color is the color of the border and gaps between pixels
+ * for the brightness pugin we need a copy of BL_COL, we call it BP_COL
+ */
+ s = cfg_get(section, "basecolor", "000000ff");
+ if (color2RGBA(s, &BP_COL) < 0) {
+ error("%s: ignoring illegal color '%s'", Name, s);
+ }
+ free(s);
+ BL_COL = BP_COL;
+
+ BR_COL = BP_COL;
+ if ((s = cfg_get(section, "bordercolor", NULL)) != NULL) {
+ if (color2RGBA(s, &BR_COL) < 0) {
+ error("%s: ignoring illegal color '%s'", Name, s);
+ }
+ free(s);
+ }
+
+ /* consider auto-repeated KeyPress events? */
+ cfg_number(section, "autorepeat", 1, 0, 1, &allow_autorepeat);
+
+ /* virtual keyboard: number of buttons (0..6) */
+ if (cfg_number(section, "buttons", 0, 0, 6, &buttons) < 0)
+ return -1;
+
+ drv_X11_FB = malloc(DCOLS * DROWS * sizeof(*drv_X11_FB));
+ if (drv_X11_FB == NULL) {
+ error("%s: framebuffer could not be allocated: malloc() failed", Name);
+ return -1;
+ }
+
+ for (i = 0; i < DCOLS * DROWS; i++) {
+ drv_X11_FB[i] = NO_COL;
+ }
+
+ if (XrmGetResource(commandlineDB, "lcd4linux.display", "Lcd4linux.Display", str_type, &value)) {
+ strncpy(myDisplayName, value.addr, value.size);
+ debug("%s: X11 display name from command line: %s", Name, myDisplayName);
+ }
+
+ if ((dp = XOpenDisplay(strlen(myDisplayName) > 0 ? myDisplayName : NULL)) == NULL) {
+ error("%s: can't open display %s", Name, XDisplayName(strlen(myDisplayName) > 0 ? myDisplayName : NULL));
+ return -1;
+ }
+
+ if (XrmGetResource(commandlineDB, "lcd4linux*synchronous", "Lcd4linux*Synchronous", str_type, &value)) {
+ debug("%s: X synchronize on", Name);
+ XSynchronize(dp, 1 /* true */ );
+ }
+
+ sc = DefaultScreen(dp);
+ gc = DefaultGC(dp, sc);
+ vi = DefaultVisual(dp, sc);
+ dd = DefaultDepth(dp, sc);
+ rw = DefaultRootWindow(dp);
+ cm = DefaultColormap(dp, sc);
+
+ dimx = DCOLS * pixel + (DCOLS - 1) * pgap + (DCOLS / XRES - 1) * cgap;
+ dimy = DROWS * pixel + (DROWS - 1) * pgap + (DROWS / YRES - 1) * rgap;
+ if (buttons != 0) {
+ btnwidth = (DCOLS * pixel + (DCOLS - 1) * pgap) / 10;
+ btnheight = (DROWS * pixel + (DROWS - 1) * pgap) / buttons;
+ }
+
+ wa.event_mask = ExposureMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask;
+
+ sh.min_width = sh.max_width = dimx + 2 * border + btnwidth;
+ sh.min_height = sh.max_height = dimy + 2 * border;
+ sh.flags = PPosition | PSize | PMinSize | PMaxSize;
+
+ if (sh.min_width > DisplayWidth(dp, sc) || sh.min_height > DisplayHeight(dp, sc)) {
+ error("%s: Warning: X11-Window with dimensions (%d,%d) is greater than display (%d,%d)!",
+ Name, sh.min_width, sh.min_height, DisplayWidth(dp, sc), DisplayHeight(dp, sc));
+ if (sh.min_width > 32767 || sh.min_height > 32676) {
+ /* XProtocol data size exceeded */
+ exit(1);
+ }
+ }
+ w = XCreateWindow(dp, rw, 0, 0, sh.min_width, sh.min_height, 0, 0, InputOutput, vi, CWEventMask, &wa);
+
+ pm = XCreatePixmap(dp, w, dimx, dimy, dd);
+
+ XSetWMProperties(dp, w, NULL, NULL, NULL, 0, &sh, NULL, NULL);
+ wmDeleteMessage = XInternAtom(dp, "WM_DELETE_WINDOW", False);
+ XSetWMProtocols(dp, w, &wmDeleteMessage, 1);
+
+ XSetWindowBackground(dp, w, drv_X11_color(BR_COL, 255).pixel);
+ XClearWindow(dp, w);
+
+ /* set brightness (after first background painting) */
+ if (cfg_number(section, "Brightness", 255, 0, 255, &i) > 0) {
+ drv_X11_brightness(i);
+ }
+
+ XStoreName(dp, w, "LCD4Linux");
+ XMapWindow(dp, w);
+
+ XFlush(dp);
+
+ while (1) {
+ XNextEvent(dp, &ev);
+ if (ev.type == Expose && ev.xexpose.count == 0)
+ break;
+ }
+
+ /* regularly process X events */
+ /* Fixme: make 20msec configurable */
+ timer_add(drv_X11_timer, NULL, 20, 0);
+
+ return 0;
+}
+
+
+
+/****************************************/
+/*** plugins ***/
+/****************************************/
+
+static void plugin_brightness(RESULT * result, const int argc, RESULT * argv[])
+{
+ double brightness;
+
+ switch (argc) {
+ case 0:
+ brightness = drv_X11_brightness(-1);
+ SetResult(&result, R_NUMBER, &brightness);
+ break;
+ case 1:
+ brightness = drv_X11_brightness(R2N(argv[0]));
+ SetResult(&result, R_NUMBER, &brightness);
+ break;
+ default:
+ error("%s.brightness(): wrong number of parameters", Name);
+ SetResult(&result, R_STRING, "");
+ }
+}
+
+
+/****************************************/
+/*** exported functions ***/
+/****************************************/
+
+
+/* list models */
+int drv_X11_list(void)
+{
+ printf("any X11 server");
+ return 0;
+}
+
+
+/* read X11 specific command line arguments */
+/* it is defined in drv.h */
+void drv_X11_parseArgs(int *argc, char *argv[])
+{
+ XrmInitialize();
+ XrmParseCommand(&commandlineDB, opTable, opTableEntries, "lcd4linux", argc, argv);
+}
+
+
+/* initialize driver & display */
+int drv_X11_init(const char *section, const int quiet)
+{
+ RGBA bl_col;
+ int ret;
+
+ info("%s: %s", Name, "$Rev: 1125 $");
+
+ /* start display */
+ if ((ret = drv_X11_start(section)) != 0)
+ return ret;
+
+ /* real worker functions */
+ drv_generic_graphic_real_blit = drv_X11_blit;
+ drv_generic_keypad_real_press = drv_X11_keypad;
+
+ /* initialize generic graphic driver */
+ /* save BL_COL which may already be dimmed */
+ bl_col = BL_COL;
+ if ((ret = drv_generic_graphic_init(section, Name)) != 0)
+ return ret;
+ BL_COL = bl_col;
+
+ /* initialize generic key pad driver */
+ if ((ret = drv_generic_keypad_init(section, Name)) != 0)
+ return ret;
+
+ drv_generic_graphic_clear();
+
+ /* initially expose window */
+ drv_X11_expose(0, 0, dimx + 2 * border, dimy + 2 * border);
+
+ if (!quiet) {
+ char buffer[40];
+ qprintf(buffer, sizeof(buffer), "%s %dx%d", Name, DCOLS, DROWS);
+ if (drv_generic_graphic_greet(buffer, NULL)) {
+ drv_X11_expose(0, 0, dimx + 2 * border, dimy + 2 * border);
+ sleep(3);
+ drv_generic_graphic_clear();
+ }
+ }
+
+ /* register plugins */
+ AddFunction("LCD::brightness", -1, plugin_brightness);
+
+
+ return 0;
+}
+
+
+/* close driver & display */
+int drv_X11_quit(const __attribute__ ((unused))
+ int quiet)
+{
+
+ info("%s: shutting down.", Name);
+ drv_generic_graphic_quit();
+ drv_generic_keypad_quit();
+
+ if (drv_X11_FB) {
+ free(drv_X11_FB);
+ drv_X11_FB = NULL;
+ }
+
+ return (0);
+}
+
+
+DRIVER drv_X11 = {
+ .name = Name,
+ .list = drv_X11_list,
+ .init = drv_X11_init,
+ .quit = drv_X11_quit,
+};
diff --git a/drv_dpf.c b/drv_dpf.c
new file mode 100644
index 0000000..33c4958
--- /dev/null
+++ b/drv_dpf.c
@@ -0,0 +1,726 @@
+/* $Id: drv_dpf.c 980 2009-01-28 21:18:52Z michux $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/drv_dpf.c $
+ *
+ * Driver for hacked digital picture frames. Uses *NO* external libraries.
+ * See http://dpf-ax.sourceforge.net/ for more information.
+ *
+ * Copyright (C) 2008 Jeroen Domburg <picframe@spritesmods.com>
+ * Modified from sample code by:
+ * Copyright (C) 2005 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2005, 2006, 2007 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * Mods by <hackfin@section5.ch>
+ * Complete rewrite 05/2013 by superelchi <superelchi AT wolke7.net>
+ *
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ *
+ * exported fuctions:
+ *
+ * struct DRIVER drv_DPF
+ *
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+
+#include "debug.h"
+#include "cfg.h"
+#include "qprintf.h"
+#include "udelay.h"
+#include "plugin.h"
+#include "widget.h"
+#include "widget_text.h"
+#include "widget_icon.h"
+#include "widget_bar.h"
+#include "drv.h"
+
+#include "drv_generic_graphic.h"
+
+//###################################################################
+// Start dpfcore4driver.h
+// See http://dpf-ax.sourceforge.net/
+//###################################################################
+
+#define DPFAXHANDLE void * // Handle needed for dpf_ax access
+#define DPF_BPP 2 //bpp for dfp-ax is currently always 2!
+
+/**
+ * Open DPF device.
+ *
+ * Device must be string in the form "usbX" or "dpfX", with X = 0 .. number of connected dpfs.
+ * The open function will scan the USB bus and return a handle to access dpf #X.
+ * If dpf #X is not found, returns NULL.
+ *
+ * \param dev device name to open
+ * \return device handle or NULL
+ */
+DPFAXHANDLE dpf_ax_open(const char *device);
+
+/**
+ * Close DPF device.
+ */
+void dpf_ax_close(DPFAXHANDLE h);
+
+/** Blit data to screen.
+ *
+ * \param buf buffer to 16 bpp RGB 565 image data
+ * \param rect rectangle tuple: [x0, y0, x1, y1]
+ */
+void dpf_ax_screen_blit(DPFAXHANDLE h, const unsigned char *buf, short rect[4]);
+
+/** Set backlight brightness.
+ *
+ * \param value Backlight value 0..7 (0 = off, 7 = max brightness)
+ */
+void dpf_ax_setbacklight(DPFAXHANDLE h, int value);
+
+/** Get screen width.
+ *
+ * \return width in pixel
+ */
+int dpf_ax_getwidth(DPFAXHANDLE h);
+
+/** Get screen height.
+ *
+ * \return height in pixel
+ */
+int dpf_ax_getheight(DPFAXHANDLE h);
+
+//###################################################################
+// End dpfcore4driver.h
+//###################################################################
+
+
+static char Name[] = "DPF";
+
+
+/*
+ * Dpf status
+ */
+static struct {
+ unsigned char *lcdBuf; // Display data buffer
+ unsigned char *xferBuf; // USB transfer buffer
+ DPFAXHANDLE dpfh; // Handle for dpf access
+ int pwidth; // Physical display width
+ int pheight; // Physical display height
+
+ // Flags to translate logical to physical orientation
+ int isPortrait;
+ int rotate90;
+ int flip;
+
+ // Current dirty rectangle
+ int minx, maxx;
+ int miny, maxy;
+
+ // Config properties
+ int orientation;
+ int backlight;
+} dpf;
+
+
+// Convert RGBA pixel to RGB565 pixel(s)
+
+#define _RGB565_0(p) (( ((p.R) & 0xf8) ) | (((p.G) & 0xe0) >> 5))
+#define _RGB565_1(p) (( ((p.G) & 0x1c) << 3 ) | (((p.B) & 0xf8) >> 3))
+
+/*
+ * Set one pixel in lcdBuf.
+ *
+ * Respects orientation and updates dirty rectangle.
+ *
+ * in: x, y - pixel coordinates
+ * pix - RGBA pixel value
+ * out: -
+ */
+static void drv_set_pixel(int x, int y, RGBA pix)
+{
+ int changed = 0;
+
+ int sx = DCOLS;
+ int sy = DROWS;
+ int lx = x % sx;
+ int ly = y % sy;
+
+ if (dpf.flip) {
+ // upside down orientation
+ lx = DCOLS - 1 - lx;
+ ly = DROWS - 1 - ly;
+ }
+
+ if (dpf.rotate90) {
+ // wrong Orientation, rotate
+ int i = ly;
+ ly = dpf.pheight - 1 - lx;
+ lx = i;
+ }
+
+ if (lx < 0 || lx >= (int) dpf.pwidth || ly < 0 || ly >= (int) dpf.pheight) {
+ error("dpf: x/y out of bounds (x=%d, y=%d, rot=%d, flip=%d, lx=%d, ly=%d)\n", x, y, dpf.rotate90, dpf.flip, lx,
+ ly);
+ return;
+ }
+
+ unsigned char c1 = _RGB565_0(pix);
+ unsigned char c2 = _RGB565_1(pix);
+ unsigned int i = (ly * dpf.pwidth + lx) * DPF_BPP;
+ if (dpf.lcdBuf[i] != c1 || dpf.lcdBuf[i + 1] != c2) {
+ dpf.lcdBuf[i] = c1;
+ dpf.lcdBuf[i + 1] = c2;
+ changed = 1;
+ }
+
+ if (changed) {
+ if (lx < dpf.minx)
+ dpf.minx = lx;
+ if (lx > dpf.maxx)
+ dpf.maxx = lx;
+ if (ly < dpf.miny)
+ dpf.miny = ly;
+ if (ly > dpf.maxy)
+ dpf.maxy = ly;
+ }
+}
+
+/*
+ * Send pixel data to dpf
+ */
+static void drv_dpf_blit(const int row, const int col, const int height, const int width)
+{
+ int x, y;
+
+ // Set pixels one by one
+ // Note: here is room for optimization :-)
+ for (y = row; y < row + height; y++)
+ for (x = col; x < col + width; x++)
+ drv_set_pixel(x, y, drv_generic_graphic_rgb(y, x));
+
+ // If nothing has changed, skip transfer
+ if (dpf.minx > dpf.maxx || dpf.miny > dpf.maxy)
+ return;
+
+ // Copy data in dirty rectangle from data buffer to temp transfer buffer
+ unsigned int cpylength = (dpf.maxx - dpf.minx + 1) * DPF_BPP;
+ unsigned char *ps = dpf.lcdBuf + (dpf.miny * dpf.pwidth + dpf.minx) * DPF_BPP;
+ unsigned char *pd = dpf.xferBuf;
+ for (y = dpf.miny; y <= dpf.maxy; y++) {
+ memcpy(pd, ps, cpylength);
+ ps += dpf.pwidth * DPF_BPP;
+ pd += cpylength;
+ }
+
+ // Send the buffer
+ short rect[4];
+ rect[0] = dpf.minx;
+ rect[1] = dpf.miny;
+ rect[2] = dpf.maxx + 1;
+ rect[3] = dpf.maxy + 1;
+ dpf_ax_screen_blit(dpf.dpfh, dpf.xferBuf, rect);
+
+ // Reset dirty rectangle
+ dpf.minx = dpf.pwidth - 1;
+ dpf.maxx = 0;
+ dpf.miny = dpf.pheight - 1;
+ dpf.maxy = 0;
+}
+
+
+/* start graphic display */
+static int drv_dpf_start(const char *section)
+{
+ int i;
+ char *dev;
+ char *s;
+
+ // Check if config is valid
+
+ // Get the device
+ dev = cfg_get(section, "Port", NULL);
+ if (dev == NULL || *dev == '\0') {
+ error("dpf: no '%s.Port' entry from %s", section, cfg_source());
+ return -1;
+ }
+ // Get font
+ s = cfg_get(section, "Font", "6x8");
+ if (s == NULL || *s == '\0') {
+ error("%s: no '%s.Font' entry from %s", Name, section, cfg_source());
+ return -1;
+ }
+
+ XRES = -1;
+ YRES = -1;
+ if (sscanf(s, "%dx%d", &XRES, &YRES) != 2 || XRES < 1 || YRES < 1) {
+ error("%s: bad Font '%s' from %s", Name, s, cfg_source());
+ return -1;
+ }
+
+ /* we dont want fonts below 6 width */
+ if (XRES < 6) {
+ error("%s: bad Font '%s' width '%d' using minimum of 6)", Name, s, XRES);
+ XRES = 6;
+ }
+
+ /* we dont want fonts below 8 height */
+ if (YRES < 8) {
+ error("%s: bad Font '%s' height '%d' using minimum of 8)", Name, s, YRES);
+ YRES = 8;
+ }
+ // Get the logical orientation (0 = landscape, 1 = portrait, 2 = reverse landscape, 3 = reverse portrait)
+ if (cfg_number(section, "Orientation", 0, 0, 3, &i) > 0)
+ dpf.orientation = i;
+ else
+ dpf.orientation = 0;
+
+ // Get the backlight value (0 = off, 7 = max brightness)
+ if (cfg_number(section, "Backlight", 0, 0, 7, &i) > 0)
+ dpf.backlight = i;
+ else
+ dpf.backlight = 7;
+
+ /* open communication with the display */
+ dpf.dpfh = dpf_ax_open(dev);
+ if (dpf.dpfh == NULL) {
+ error("dpf: cannot open dpf device %s", dev);
+ return -1;
+ }
+ // Get dpfs physical dimensions
+ dpf.pwidth = dpf_ax_getwidth(dpf.dpfh);
+ dpf.pheight = dpf_ax_getheight(dpf.dpfh);
+
+
+ // See, if we have to rotate the display
+ dpf.isPortrait = dpf.pwidth < dpf.pheight;
+ if (dpf.isPortrait) {
+ if (dpf.orientation == 0 || dpf.orientation == 2)
+ dpf.rotate90 = 1;
+ } else if (dpf.orientation == 1 || dpf.orientation == 3)
+ dpf.rotate90 = 1;
+ dpf.flip = (!dpf.isPortrait && dpf.rotate90); // adjust to make rotate por/land = physical por/land
+ if (dpf.orientation > 1)
+ dpf.flip = !dpf.flip;
+
+ // allocate display buffer + temp transfer buffer
+ dpf.lcdBuf = malloc(dpf.pwidth * dpf.pheight * DPF_BPP);
+ dpf.xferBuf = malloc(dpf.pwidth * dpf.pheight * DPF_BPP);
+
+ // clear display buffer + set it to "dirty"
+ memset(dpf.lcdBuf, 0, dpf.pwidth * dpf.pheight * DPF_BPP); //Black
+ dpf.minx = 0;
+ dpf.maxx = dpf.pwidth - 1;
+ dpf.miny = 0;
+ dpf.maxy = dpf.pheight - 1;
+
+ // set the logical width/height for lcd4linux
+ DCOLS = ((!dpf.rotate90) ? dpf.pwidth : dpf.pheight);
+ DROWS = ((!dpf.rotate90) ? dpf.pheight : dpf.pwidth);
+
+ // Set backlight (brightness)
+ dpf_ax_setbacklight(dpf.dpfh, dpf.backlight);
+
+ return 0;
+}
+
+
+/****************************************/
+/*** plugins ***/
+/****************************************/
+
+static void plugin_backlight(RESULT * result, RESULT * arg1)
+{
+ int b = R2N(arg1);
+ if (b < 0)
+ b = 0;
+ if (b > 7)
+ b = 7;
+
+ dpf_ax_setbacklight(dpf.dpfh, b);
+ SetResult(&result, R_NUMBER, &b);
+}
+
+
+/****************************************/
+/*** exported functions ***/
+/****************************************/
+
+
+/* list models */
+int drv_dpf_list(void)
+{
+ printf("Hacked dpf-ax digital photo frame");
+ return 0;
+}
+
+
+/* initialize driver & display */
+int drv_dpf_init(const char *section, const int quiet)
+{
+ int ret;
+
+ /* real worker functions */
+ drv_generic_graphic_real_blit = drv_dpf_blit;
+
+ /* start display */
+ if ((ret = drv_dpf_start(section)) != 0)
+ return ret;
+
+ /* initialize generic graphic driver */
+ if ((ret = drv_generic_graphic_init(section, Name)) != 0)
+ return ret;
+
+ if (!quiet) {
+ char buffer[40];
+ qprintf(buffer, sizeof(buffer), "%s %dx%d", Name, DCOLS, DROWS);
+ if (drv_generic_graphic_greet(buffer, NULL)) {
+ sleep(3);
+ drv_generic_graphic_clear();
+ }
+ }
+
+ /* register plugins */
+ AddFunction("LCD::backlight", 1, plugin_backlight);
+
+ return 0;
+}
+
+
+/* close driver & display */
+int drv_dpf_quit(const int quiet)
+{
+ info("%s: shutting down.", Name);
+
+ /* clear display */
+ drv_generic_graphic_clear();
+
+ /* say goodbye... */
+ if (!quiet) {
+ drv_generic_graphic_greet("goodbye!", NULL);
+ }
+
+ drv_generic_graphic_quit();
+
+ debug("closing connection");
+ dpf_ax_close(dpf.dpfh);
+
+ return (0);
+}
+
+
+DRIVER drv_DPF = {
+ .name = Name,
+ .list = drv_dpf_list,
+ .init = drv_dpf_init,
+ .quit = drv_dpf_quit,
+};
+
+//###################################################################
+// Start dpfcore4driver.c
+// See http://dpf-ax.sourceforge.net/
+//###################################################################
+
+#include <usb.h>
+
+#define AX206_VID 0x1908 // Hacked frames USB Vendor ID
+#define AX206_PID 0x0102 // Hacked frames USB Product ID
+
+#define USBCMD_SETPROPERTY 0x01 // USB command: Set property
+#define USBCMD_BLIT 0x12 // USB command: Blit to screen
+
+/* Generic SCSI device stuff */
+
+#define DIR_IN 0
+#define DIR_OUT 1
+
+/* The DPF context structure */
+typedef
+ struct dpf_context {
+ usb_dev_handle *udev;
+ unsigned int width;
+ unsigned int height;
+} DPFContext;
+
+static int wrap_scsi(DPFContext * h, unsigned char *cmd, int cmdlen, char out,
+ unsigned char *data, unsigned long block_len);
+
+/**
+ * Open DPF device.
+ *
+ * Device must be string in the form "usbX" or "dpfX", with X = 0 .. number of connected dpfs.
+ * The open function will scan the USB bus and return a handle to access dpf #X.
+ * If dpf #X is not found, returns NULL.
+ *
+ * \param dev device name to open
+ * \return device handle or NULL
+ */
+DPFAXHANDLE dpf_ax_open(const char *dev)
+{
+ DPFContext *dpf;
+ int index = -1;
+ usb_dev_handle *u;
+
+ if (dev && strlen(dev) == 4 && (strncmp(dev, "usb", 3) == 0 || strncmp(dev, "dpf", 3) == 0))
+ index = dev[3] - '0';
+
+ if (index < 0 || index > 9) {
+ fprintf(stderr, "dpf_ax_open: wrong device '%s'. Please specify a string like 'usb0'\n", dev);
+ return NULL;
+ }
+
+ usb_init();
+ usb_find_busses();
+ usb_find_devices();
+
+ struct usb_bus *b = usb_get_busses();
+ struct usb_device *d = NULL;
+ int enumeration = 0;
+ int found = 0;
+
+ while (b && !found) {
+ d = b->devices;
+ while (d) {
+ if ((d->descriptor.idVendor == AX206_VID) && (d->descriptor.idProduct == AX206_PID)) {
+ fprintf(stderr, "dpf_ax_open: found AX206 #%d\n", enumeration + 1);
+ if (enumeration == index) {
+ found = 1;
+ break;
+ } else
+ enumeration++;
+ }
+ d = d->next;
+ }
+ b = b->next;
+ }
+
+ if (!d) {
+ fprintf(stderr, "dpf_ax_open: no matching USB device '%s' found!\n", dev);
+ return NULL;
+ }
+
+ dpf = (DPFContext *) malloc(sizeof(DPFContext));
+ if (!dpf) {
+ fprintf(stderr, "dpf_ax_open: error allocation memory.\n");
+ return NULL;
+ }
+
+ u = usb_open(d);
+ if (u == NULL) {
+ fprintf(stderr, "dpf_ax_open: failed to open usb device '%s'!\n", dev);
+ free(dpf);
+ return NULL;
+ }
+
+ if (usb_claim_interface(u, 0) < 0) {
+ fprintf(stderr, "dpf_ax_open: failed to claim usb device!\n");
+ usb_close(u);
+ free(dpf);
+ return NULL;
+ }
+
+ dpf->udev = u;
+
+ static unsigned char buf[5];
+ static unsigned char cmd[16] = {
+ 0xcd, 0, 0, 0,
+ 0, 2, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0
+ };
+ cmd[5] = 2; // get LCD parameters
+ if (wrap_scsi(dpf, cmd, sizeof(cmd), DIR_IN, buf, 5) == 0) {
+ dpf->width = (buf[0]) | (buf[1] << 8);
+ dpf->height = (buf[2]) | (buf[3] << 8);
+ fprintf(stderr, "dpf_ax_open: got LCD dimensions: %dx%d\n", dpf->width, dpf->height);
+ } else {
+ fprintf(stderr, "dpf_ax_open: error reading LCD dimensions!\n");
+ dpf_ax_close(dpf);
+ return NULL;
+ }
+ return (DPFAXHANDLE) dpf;
+}
+
+/**
+ * Close DPF device
+ */
+
+void dpf_ax_close(DPFAXHANDLE h)
+{
+ DPFContext *dpf = (DPFContext *) h;
+
+ usb_release_interface(dpf->udev, 0);
+ usb_close(dpf->udev);
+ free(dpf);
+}
+
+/** Get screen width.
+ *
+ * \return width in pixel
+ */
+int dpf_ax_getwidth(DPFAXHANDLE h)
+{
+ return ((DPFContext *) h)->width;
+}
+
+/** Get screen height.
+ *
+ * \return height in pixel
+ */
+int dpf_ax_getheight(DPFAXHANDLE h)
+{
+ return ((DPFContext *) h)->height;
+}
+
+static
+unsigned char g_excmd[16] = {
+ 0xcd, 0, 0, 0,
+ 0, 6, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0
+};
+
+/** Blit data to screen.
+ *
+ * \param buf buffer to 16 bpp RGB 565 image data
+ * \param rect rectangle tuple: [x0, y0, x1, y1]
+ */
+void dpf_ax_screen_blit(DPFAXHANDLE h, const unsigned char *buf, short rect[4])
+{
+ unsigned long len = (rect[2] - rect[0]) * (rect[3] - rect[1]);
+ len <<= 1;
+ unsigned char *cmd = g_excmd;
+
+ cmd[6] = USBCMD_BLIT;
+ cmd[7] = rect[0];
+ cmd[8] = rect[0] >> 8;
+ cmd[9] = rect[1];
+ cmd[10] = rect[1] >> 8;
+ cmd[11] = rect[2] - 1;
+ cmd[12] = (rect[2] - 1) >> 8;
+ cmd[13] = rect[3] - 1;
+ cmd[14] = (rect[3] - 1) >> 8;
+ cmd[15] = 0;
+
+ wrap_scsi((DPFContext *) h, cmd, sizeof(g_excmd), DIR_OUT, (unsigned char *) buf, len);
+}
+
+/** Set backlight
+ *
+ * \param value Backlight value 0..7 (0 = off, 7 = max brightness)
+ */
+void dpf_ax_setbacklight(DPFAXHANDLE h, int b)
+{
+ unsigned char *cmd = g_excmd;
+
+ if (b < 0)
+ b = 0;
+ if (b > 7)
+ b = 7;
+
+ cmd[6] = USBCMD_SETPROPERTY;
+ cmd[7] = 0x01; // PROPERTY_BRIGHTNESS
+ cmd[8] = 0x00; //PROPERTY_BRIGHTNESS >> 8;
+ cmd[9] = b;
+ cmd[10] = b >> 8;
+
+ wrap_scsi((DPFContext *) h, cmd, sizeof(g_excmd), DIR_OUT, NULL, 0);
+}
+
+
+static unsigned char g_buf[] = {
+ 0x55, 0x53, 0x42, 0x43, // dCBWSignature
+ 0xde, 0xad, 0xbe, 0xef, // dCBWTag
+ 0x00, 0x80, 0x00, 0x00, // dCBWLength
+ 0x00, // bmCBWFlags: 0x80: data in (dev to host), 0x00: Data out
+ 0x00, // bCBWLUN
+ 0x10, // bCBWCBLength
+
+ // SCSI cmd:
+ 0xcd, 0x00, 0x00, 0x00,
+ 0x00, 0x06, 0x11, 0xf8,
+ 0x70, 0x00, 0x40, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+};
+
+#define ENDPT_OUT 1
+#define ENDPT_IN 0x81
+
+static int wrap_scsi(DPFContext * h, unsigned char *cmd, int cmdlen, char out,
+ unsigned char *data, unsigned long block_len)
+{
+ int len;
+ int ret;
+ static unsigned char ansbuf[13]; // Do not change size.
+
+ g_buf[14] = cmdlen;
+ memcpy(&g_buf[15], cmd, cmdlen);
+
+ g_buf[8] = block_len;
+ g_buf[9] = block_len >> 8;
+ g_buf[10] = block_len >> 16;
+ g_buf[11] = block_len >> 24;
+
+ ret = usb_bulk_write(h->udev, ENDPT_OUT, (const char *) g_buf, sizeof(g_buf), 1000);
+ if (ret < 0)
+ return ret;
+
+ if (out == DIR_OUT) {
+ if (data) {
+ ret = usb_bulk_write(h->udev, ENDPT_OUT, (const char *) data, block_len, 3000);
+ if (ret != (int) block_len) {
+ fprintf(stderr, "dpf_ax ERROR: bulk write.\n");
+ return ret;
+ }
+ }
+ } else if (data) {
+ ret = usb_bulk_read(h->udev, ENDPT_IN, (char *) data, block_len, 4000);
+ if (ret != (int) block_len) {
+ fprintf(stderr, "dpf_ax ERROR: bulk read.\n");
+ return ret;
+ }
+ }
+ // get ACK:
+ len = sizeof(ansbuf);
+ int retry = 0;
+ int timeout = 0;
+ do {
+ timeout = 0;
+ ret = usb_bulk_read(h->udev, ENDPT_IN, (char *) ansbuf, len, 5000);
+ if (ret != len) {
+ fprintf(stderr, "dpf_ax ERROR: bulk ACK read.\n");
+ timeout = 1;
+ }
+ retry++;
+ } while (timeout && retry < 5);
+ if (strncmp((char *) ansbuf, "USBS", 4)) {
+ fprintf(stderr, "dpf_ax ERROR: got invalid reply\n.");
+ return -1;
+ }
+ // pass back return code set by peer:
+ return ansbuf[12];
+}
+
+//###################################################################
+// End dpfcore4driver.c
+//###################################################################
diff --git a/drv_generic.c b/drv_generic.c
new file mode 100644
index 0000000..e725e04
--- /dev/null
+++ b/drv_generic.c
@@ -0,0 +1,115 @@
+/* $Id: drv_generic.c 840 2007-09-09 12:17:42Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/drv_generic.c $
+ *
+ * generic driver helper
+ *
+ * Copyright (C) 2006 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2006 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ *
+ * exported functions:
+ *
+ * drv_generic_init (void)
+ * initializes generic stuff and registers plugins
+ *
+ */
+
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "debug.h"
+#include "plugin.h"
+#include "drv_generic.h"
+
+#ifdef WITH_DMALLOC
+#include <dmalloc.h>
+#endif
+
+/* these values are chars (text displays) or pixels (graphic displays) */
+
+int LROWS = 0; /* layout size: rows */
+int LCOLS = 0; /* layout size: columns */
+
+int DROWS = 4; /* display size: rows */
+int DCOLS = 20; /* display size: columns */
+
+int XRES = 6; /* pixel widtht of one char */
+int YRES = 8; /* pixel height of one char */
+
+
+void (*drv_generic_blit) () = NULL;
+
+
+static void my_drows(RESULT * result)
+{
+ double value = DROWS;
+ SetResult(&result, R_NUMBER, &value);
+}
+
+static void my_dcols(RESULT * result)
+{
+ double value = DCOLS;
+ SetResult(&result, R_NUMBER, &value);
+}
+
+static void my_xres(RESULT * result)
+{
+ double value = XRES;
+ SetResult(&result, R_NUMBER, &value);
+}
+
+static void my_yres(RESULT * result)
+{
+ double value = YRES;
+ SetResult(&result, R_NUMBER, &value);
+}
+
+static void my_lrows(RESULT * result)
+{
+ double value = LROWS;
+ SetResult(&result, R_NUMBER, &value);
+}
+
+static void my_lcols(RESULT * result)
+{
+ double value = LCOLS;
+ SetResult(&result, R_NUMBER, &value);
+}
+
+int drv_generic_init(void)
+{
+
+ AddFunction("LCD::height", 0, my_drows);
+ AddFunction("LCD::width", 0, my_dcols);
+
+ AddFunction("LCD::xres", 0, my_xres);
+ AddFunction("LCD::yres", 0, my_yres);
+
+ AddFunction("Layout::height", 0, my_lrows);
+ AddFunction("Layout::width", 0, my_lcols);
+
+ return 0;
+}
diff --git a/drv_generic.h b/drv_generic.h
new file mode 100644
index 0000000..d4023d2
--- /dev/null
+++ b/drv_generic.h
@@ -0,0 +1,43 @@
+/* $Id: drv_generic.h 840 2007-09-09 12:17:42Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/drv_generic.h $
+ *
+ * generic driver helper
+ *
+ * Copyright (C) 2006 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2006 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+
+#ifndef _DRV_GENERIC_H_
+#define _DRV_GENERIC_H_
+
+/* these values are chars (text displays) or pixels (graphic displays) */
+
+extern int LROWS, LCOLS; /* layout size */
+extern int DROWS, DCOLS; /* display size */
+
+extern int XRES, YRES; /* pixel width/height of one char */
+
+/* these function must be implemented by the generic driver */
+extern void (*drv_generic_blit) (const int row, const int col, const int height, const int width);
+
+int drv_generic_init(void);
+
+#endif
diff --git a/drv_generic_gpio.c b/drv_generic_gpio.c
new file mode 100644
index 0000000..391d196
--- /dev/null
+++ b/drv_generic_gpio.c
@@ -0,0 +1,246 @@
+/* $Id: drv_generic_gpio.c 1049 2009-11-03 04:59:04Z peterbailey $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/drv_generic_gpio.c $
+ *
+ * generic driver helper for GPO's
+ *
+ * Copyright (C) 2005 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2005 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ *
+ * exported variables:
+ *
+ * extern int GPIS, GPOS; number of Inputs and Outputs
+ *
+ *
+ * these functions must be implemented by the real driver:
+ *
+ * int (*drv_generic_gpio_real_set) (const int num, const int val);
+ * sets GPO num to val, returns the actual value
+ *
+ * int (*drv_generic_gpio_real_get) (const int num);
+ * reads GPI num
+ *
+ *
+ * exported fuctions:
+ *
+ * int drv_generic_gpio_init(const char *section, const char *driver)
+ * initializes the generic GPIO driver
+ *
+ * int drv_generic_gpio_clear(void);
+ * resets all GPO's
+ *
+ * int drv_generic_gpio_get (const int num)
+ * returns value og GPI #num
+ *
+ * int drv_generic_gpio_draw(WIDGET * W)
+ * 'draws' GPO widget
+ * calls drv_generic_gpio_real_set()
+ *
+ * int drv_generic_gpio_quit(void)
+ * closes the generic GPIO driver
+ *
+ */
+
+#include "config.h"
+
+#include <stdio.h>
+
+#include "debug.h"
+#include "plugin.h"
+#include "widget.h"
+#include "widget_gpo.h"
+
+#include "drv_generic_gpio.h"
+
+#ifdef WITH_DMALLOC
+#include <dmalloc.h>
+#endif
+
+#define MAX_GPIS 32
+#define MAX_GPOS 32
+
+
+static char *Section = NULL;
+static char *Driver = NULL;
+
+static int GPI[MAX_GPIS];
+static int GPO[MAX_GPOS];
+
+int GPOS = 0;
+int GPIS = 0;
+
+int (*drv_generic_gpio_real_set) () = NULL;
+int (*drv_generic_gpio_real_get) () = NULL;
+
+
+static void drv_generic_gpio_plugin_gpi(RESULT * result, RESULT * arg1)
+{
+ int num;
+ double val;
+
+ num = R2N(arg1);
+
+ if (num <= 0 || num > GPIS) {
+ error("%s::GPI(%d): GPI out of range (1..%d)", Driver, num, GPIS);
+ SetResult(&result, R_STRING, "");
+ return;
+ }
+
+ val = drv_generic_gpio_get(num - 1);
+ SetResult(&result, R_NUMBER, &val);
+}
+
+
+static void drv_generic_gpio_plugin_gpo(RESULT * result, const int argc, RESULT * argv[])
+{
+ int num, val;
+ double gpo;
+
+ switch (argc) {
+ case 1:
+ num = R2N(argv[0]);
+ if (num <= 0 || num > GPOS) {
+ error("%s::GPO(%d): GPO out of range (1..%d)", Driver, num, GPOS);
+ SetResult(&result, R_STRING, "");
+ return;
+ }
+ gpo = GPO[num - 1];
+ SetResult(&result, R_NUMBER, &gpo);
+ break;
+ case 2:
+ num = R2N(argv[0]);
+ val = R2N(argv[1]);
+ if (num <= 0 || num > GPOS) {
+ error("%s::GPO(%d): GPO out of range (1..%d)", Driver, num, GPOS);
+ SetResult(&result, R_STRING, "");
+ return;
+ }
+ if (GPO[num - 1] != val) {
+ if (drv_generic_gpio_real_set)
+ GPO[num - 1] = drv_generic_gpio_real_set(num - 1, val);
+ }
+ gpo = GPO[num - 1];
+ SetResult(&result, R_NUMBER, &gpo);
+ break;
+ default:
+ error("%s::GPO(): wrong number of parameters", Driver);
+ SetResult(&result, R_STRING, "");
+ }
+}
+
+
+int drv_generic_gpio_init(const char *section, const char *driver)
+{
+ WIDGET_CLASS wc;
+
+ Section = (char *) section;
+ Driver = (char *) driver;
+
+ info("%s: using %d GPI's and %d GPO's", Driver, GPIS, GPOS);
+
+ /* reset all GPO's */
+ drv_generic_gpio_clear();
+
+ /* register gpo widget */
+ wc = Widget_GPO;
+ wc.draw = drv_generic_gpio_draw;
+ widget_register(&wc);
+
+ /* register plugins */
+ AddFunction("LCD::GPI", 1, drv_generic_gpio_plugin_gpi);
+ AddFunction("LCD::GPO", -1, drv_generic_gpio_plugin_gpo);
+
+ return 0;
+}
+
+
+int drv_generic_gpio_clear(void)
+{
+ int i;
+
+ /* clear GPI buffer */
+ for (i = 0; i < MAX_GPIS; i++) {
+ GPI[i] = 0;
+ }
+
+ /* clear GPO buffer */
+ for (i = 0; i < MAX_GPOS; i++) {
+ GPO[i] = 0;
+ }
+
+ /* really clear GPO's */
+ for (i = 0; i < GPOS; i++) {
+ if (drv_generic_gpio_real_set)
+ GPO[i] = drv_generic_gpio_real_set(i, 0);
+
+ }
+
+ return 0;
+}
+
+
+int drv_generic_gpio_get(const int num)
+{
+ int val = 0;
+
+ if (num < 0 || num >= GPIS) {
+ error("%s: gpio_get(%d): GPI out of range (0..%d)", Driver, num + 1, GPIS);
+ return -1;
+ }
+
+ if (drv_generic_gpio_real_get)
+ val = drv_generic_gpio_real_get(num);
+
+ GPI[num] = val;
+
+ return val;
+}
+
+
+int drv_generic_gpio_draw(WIDGET * W)
+{
+ WIDGET_GPO *gpo = W->data;
+ int num, val;
+
+ num = W->row;
+ val = P2N(&gpo->expression);
+
+ if (num < 0 || num >= GPOS) {
+ error("%s: gpio_draw(%d): GPO out of range (0..%d)", Driver, num + 1, GPOS);
+ return -1;
+ }
+
+ if (GPO[num] != val) {
+ if (drv_generic_gpio_real_set)
+ GPO[num] = drv_generic_gpio_real_set(num, val);
+ }
+
+ return 0;
+}
+
+
+int drv_generic_gpio_quit(void)
+{
+ info("%s: shutting down GPIO driver.", Driver);
+ drv_generic_gpio_clear();
+ return 0;
+}
diff --git a/drv_generic_gpio.h b/drv_generic_gpio.h
new file mode 100644
index 0000000..e951f09
--- /dev/null
+++ b/drv_generic_gpio.h
@@ -0,0 +1,47 @@
+/* $Id: drv_generic_gpio.h 1051 2009-11-05 08:02:32Z peterbailey $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/drv_generic_gpio.h $
+ *
+ * generic driver helper for GPIO's
+ *
+ * Copyright (C) 2005 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2005 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+
+#ifndef _DRV_GENERIC_GPO_H_
+#define _DRV_GENERIC_GPO_H_
+
+#include "widget.h"
+
+extern int GPIS; /* number of GPI's */
+extern int GPOS; /* number of GPO's */
+
+/* these function must be implemented by the real driver */
+extern int (*drv_generic_gpio_real_set) (const int num, const int val);
+extern int (*drv_generic_gpio_real_get) (const int num);
+
+/* generic functions and widget callbacks */
+int drv_generic_gpio_init(const char *section, const char *driver);
+int drv_generic_gpio_clear(void);
+int drv_generic_gpio_get(const int num);
+int drv_generic_gpio_draw(WIDGET * W);
+int drv_generic_gpio_quit(void);
+
+#endif
diff --git a/drv_generic_graphic.c b/drv_generic_graphic.c
new file mode 100644
index 0000000..b7a3ec8
--- /dev/null
+++ b/drv_generic_graphic.c
@@ -0,0 +1,731 @@
+/* $Id: drv_generic_graphic.c 1170 2012-01-16 02:50:03Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/drv_generic_graphic.c $
+ *
+ * generic driver helper for graphic displays
+ *
+ * Copyright (C) 1999, 2000 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ *
+ * exported functions:
+ *
+ * int drv_generic_graphic_init (char *section, char *driver);
+ * initializes the generic graphic driver
+ *
+ * int drv_generic_graphic_draw (WIDGET *W);
+ * renders Text widget into framebuffer
+ * calls drv_generic_graphic_real_blit()
+ *
+ * int drv_generic_graphic_icon_draw (WIDGET *W);
+ * renders Icon widget into framebuffer
+ * calls drv_generic_graphic_real_blit()
+ *
+ * int drv_generic_graphic_bar_draw (WIDGET *W);
+ * renders Bar widget into framebuffer
+ * calls drv_generic_graphic_real_blit()
+ *
+ * int drv_generic_graphic_quit (void);
+ * closes generic graphic driver
+ *
+ */
+
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <unistd.h>
+#include <termios.h>
+#include <fcntl.h>
+
+#include "debug.h"
+#include "cfg.h"
+#include "plugin.h"
+#include "layout.h"
+#include "widget.h"
+#include "property.h"
+#include "widget_text.h"
+#include "widget_icon.h"
+#include "widget_bar.h"
+#include "widget_image.h"
+#include "rgb.h"
+#include "drv.h"
+#include "drv_generic.h"
+#include "drv_generic_graphic.h"
+#include "font_6x8.h"
+#include "font_6x8_bold.h"
+
+#ifdef WITH_DMALLOC
+#include <dmalloc.h>
+#endif
+
+/* pixel colors */
+RGBA FG_COL = {.R = 0x00,.G = 0x00,.B = 0x00,.A = 0xff };
+RGBA BG_COL = {.R = 0xff,.G = 0xff,.B = 0xff,.A = 0xff };
+RGBA BL_COL = {.R = 0xff,.G = 0xff,.B = 0xff,.A = 0x00 };
+RGBA NO_COL = {.R = 0x00,.G = 0x00,.B = 0x00,.A = 0x00 };
+
+static char *Section = NULL;
+static char *Driver = NULL;
+
+/* framebuffer */
+static RGBA *drv_generic_graphic_FB[LAYERS] = { NULL, };
+
+/* inverted colors */
+static int INVERTED = 0;
+
+/* must be implemented by the real driver */
+void (*drv_generic_graphic_real_blit) () = NULL;
+
+
+/****************************************/
+/*** generic Framebuffer stuff ***/
+/****************************************/
+
+static void drv_generic_graphic_resizeFB(int rows, int cols)
+{
+ RGBA *newFB;
+ int i, l, row, col;
+
+ /* Layout FB is large enough */
+ if (rows <= LROWS && cols <= LCOLS)
+ return;
+
+ /* get maximum values */
+ if (rows < LROWS)
+ rows = LROWS;
+ if (cols < LCOLS)
+ cols = LCOLS;
+
+ for (l = 0; l < LAYERS; l++) {
+
+ /* allocate and initialize new Layout FB */
+ newFB = malloc(cols * rows * sizeof(*newFB));
+ for (i = 0; i < rows * cols; i++)
+ newFB[i] = NO_COL;
+
+ /* transfer contents */
+ if (drv_generic_graphic_FB[l] != NULL) {
+ for (row = 0; row < LROWS; row++) {
+ for (col = 0; col < LCOLS; col++) {
+ newFB[row * cols + col] = drv_generic_graphic_FB[l][row * LCOLS + col];
+ }
+ }
+ free(drv_generic_graphic_FB[l]);
+ }
+ drv_generic_graphic_FB[l] = newFB;
+ }
+
+ LCOLS = cols;
+ LROWS = rows;
+
+}
+
+static void drv_generic_graphic_window(int pos, int size, int max, int *wpos, int *wsize)
+{
+ int p1 = pos;
+ int p2 = pos + size;
+
+ *wpos = 0;
+ *wsize = 0;
+
+ if (p1 > max || p2 < 0 || size < 1)
+ return;
+
+ if (p1 < 0)
+ p1 = 0;
+
+ if (p2 > max)
+ p2 = max;
+
+ *wpos = p1;
+ *wsize = p2 - p1;
+}
+
+static void drv_generic_graphic_blit(const int row, const int col, const int height, const int width)
+{
+ if (drv_generic_graphic_real_blit) {
+ int r, c, h, w;
+ drv_generic_graphic_window(row, height, DROWS, &r, &h);
+ drv_generic_graphic_window(col, width, DCOLS, &c, &w);
+ if (h > 0 && w > 0) {
+ drv_generic_graphic_real_blit(r, c, h, w);
+ }
+ }
+}
+
+static RGBA drv_generic_graphic_blend(const int row, const int col)
+{
+ int l, o;
+ RGBA p;
+ RGBA ret;
+
+ ret.R = BL_COL.R;
+ ret.G = BL_COL.G;
+ ret.B = BL_COL.B;
+ ret.A = 0x00;
+
+ /* find first opaque layer */
+ /* layers below are fully covered */
+ o = LAYERS - 1;
+ for (l = 0; l < LAYERS; l++) {
+ p = drv_generic_graphic_FB[l][row * LCOLS + col];
+ if (p.A == 255) {
+ o = l;
+ break;
+ }
+ }
+
+ for (l = o; l >= 0; l--) {
+ p = drv_generic_graphic_FB[l][row * LCOLS + col];
+ switch (p.A) {
+ case 0:
+ break;
+ case 255:
+ ret.R = p.R;
+ ret.G = p.G;
+ ret.B = p.B;
+ ret.A = 0xff;
+ break;
+ default:
+ ret.R = (p.R * p.A + ret.R * (255 - p.A)) / 255;
+ ret.G = (p.G * p.A + ret.G * (255 - p.A)) / 255;
+ ret.B = (p.B * p.A + ret.B * (255 - p.A)) / 255;
+ ret.A = 0xff;
+ }
+ }
+ if (INVERTED) {
+ ret.R = 255 - ret.R;
+ ret.G = 255 - ret.G;
+ ret.B = 255 - ret.B;
+ }
+
+ return ret;
+}
+
+
+/****************************************/
+/*** generic text handling ***/
+/****************************************/
+
+static void drv_generic_graphic_render(const int layer, const int row, const int col, const RGBA fg, const RGBA bg,
+ const char *style, const char *txt)
+{
+ int c, r, x, y, len;
+ int bold;
+
+ /* sanity checks */
+ if (layer < 0 || layer >= LAYERS) {
+ error("%s: layer %d out of bounds (0..%d)", Driver, layer, LAYERS - 1);
+ return;
+ }
+
+ len = strlen(txt);
+
+ /* maybe grow layout framebuffer */
+ drv_generic_graphic_resizeFB(row + YRES, col + XRES * len);
+
+ r = row;
+ c = col;
+
+ /* render text into layout FB */
+ bold = 0;
+ while (*txt != '\0') {
+ unsigned char *chr;
+
+ /* magic char to toggle bold */
+ if (*txt == '\a') {
+ bold ^= 1;
+ txt++;
+ continue;
+ }
+ if (bold || strstr(style, "bold") != NULL) {
+ chr = Font_6x8_bold[(int) *(unsigned char *) txt];
+ } else {
+ chr = Font_6x8[(int) *(unsigned char *) txt];
+ }
+
+ for (y = 0; y < YRES; y++) {
+ for (x = 0; x < XRES; x++) {
+ int mask = 1 << 6;
+ mask >>= ((x * 6) / (XRES)) + 1;
+ if (chr[(y * 8) / (YRES)] & mask)
+ drv_generic_graphic_FB[layer][(r + y) * LCOLS + c + x] = fg;
+ else
+ drv_generic_graphic_FB[layer][(r + y) * LCOLS + c + x] = bg;
+ }
+ }
+ c += XRES;
+ txt++;
+ }
+
+ /* flush area */
+ drv_generic_graphic_blit(row, col, YRES, XRES * len);
+
+}
+
+
+/* say hello to the user */
+int drv_generic_graphic_greet(const char *msg1, const char *msg2)
+{
+ char *line1[] = { "* LCD4Linux " VERSION " *",
+ "LCD4Linux " VERSION,
+ "* LCD4Linux *",
+ "LCD4Linux",
+ "L4Linux",
+ NULL
+ };
+
+ char *line2[] = { "http://lcd4linux.bulix.org",
+ "lcd4linux.bulix.org",
+ NULL
+ };
+
+ int i;
+ int flag = 0;
+
+ unsigned int cols = DCOLS / XRES;
+ unsigned int rows = DROWS / YRES;
+
+ for (i = 0; line1[i]; i++) {
+ if (strlen(line1[i]) <= cols) {
+ drv_generic_graphic_render(0, YRES * 0, XRES * ((cols - strlen(line1[i])) / 2), FG_COL, BG_COL, "norm",
+ line1[i]);
+ flag = 1;
+ break;
+ }
+ }
+
+ if (rows >= 2) {
+ for (i = 0; line2[i]; i++) {
+ if (strlen(line2[i]) <= cols) {
+ drv_generic_graphic_render(0, YRES * 1, XRES * ((cols - strlen(line2[i])) / 2), FG_COL, BG_COL, "norm",
+ line2[i]);
+ flag = 1;
+ break;
+ }
+ }
+ }
+
+ if (msg1 && rows >= 3) {
+ unsigned int len = strlen(msg1);
+ if (len <= cols) {
+ drv_generic_graphic_render(0, YRES * 2, XRES * ((cols - len) / 2), FG_COL, BG_COL, "norm", msg1);
+ flag = 1;
+ }
+ }
+
+ if (msg2 && rows >= 4) {
+ unsigned int len = strlen(msg2);
+ if (len <= cols) {
+ drv_generic_graphic_render(0, YRES * 3, XRES * ((cols - len) / 2), FG_COL, BG_COL, "norm", msg2);
+ flag = 1;
+ }
+ }
+
+ return flag;
+}
+
+
+int drv_generic_graphic_draw(WIDGET * W)
+{
+ WIDGET_TEXT *Text = W->data;
+ RGBA fg, bg;
+
+ fg = W->fg_valid ? W->fg_color : FG_COL;
+ bg = W->bg_valid ? W->bg_color : BG_COL;
+
+ drv_generic_graphic_render(W->layer, YRES * W->row, XRES * W->col, fg, bg, P2S(&Text->style), Text->buffer);
+
+ return 0;
+}
+
+
+/****************************************/
+/*** generic icon handling ***/
+/****************************************/
+
+int drv_generic_graphic_icon_draw(WIDGET * W)
+{
+ WIDGET_ICON *Icon = W->data;
+ RGBA fg, bg;
+ unsigned char *bitmap = Icon->bitmap + YRES * Icon->curmap;
+ int layer, row, col;
+ int x, y;
+ int visible;
+
+ layer = W->layer;
+ row = YRES * W->row;
+ col = XRES * W->col;
+
+ fg = W->fg_valid ? W->fg_color : FG_COL;
+ bg = W->bg_valid ? W->bg_color : BG_COL;
+
+ /* sanity check */
+ if (layer < 0 || layer >= LAYERS) {
+ error("%s: layer %d out of bounds (0..%d)", Driver, layer, LAYERS - 1);
+ return -1;
+ }
+
+ /* maybe grow layout framebuffer */
+ drv_generic_graphic_resizeFB(row + YRES, col + XRES);
+
+ /* Icon visible? */
+ visible = P2N(&Icon->visible) > 0;
+
+ /* render icon */
+ for (y = 0; y < YRES; y++) {
+ int mask = 1 << XRES;
+ for (x = 0; x < XRES; x++) {
+ int i = (row + y) * LCOLS + col + x;
+ mask >>= 1;
+ if (visible) {
+ if (bitmap[y] & mask)
+ drv_generic_graphic_FB[layer][i] = fg;
+ else
+ drv_generic_graphic_FB[layer][i] = bg;
+ } else {
+ drv_generic_graphic_FB[layer][i] = BG_COL;
+ }
+ }
+ }
+
+ /* flush area */
+ drv_generic_graphic_blit(row, col, YRES, XRES);
+
+ return 0;
+
+}
+
+
+/****************************************/
+/*** generic bar handling ***/
+/****************************************/
+
+int drv_generic_graphic_bar_draw(WIDGET * W)
+{
+ WIDGET_BAR *Bar = W->data;
+ RGBA fg, bg, bar[2];
+ int layer, row, col, len, res, rev, max, val1, val2;
+ int x, y;
+ DIRECTION dir;
+ STYLE style;
+
+ layer = W->layer;
+ row = YRES * W->row;
+ col = XRES * W->col;
+ dir = Bar->direction;
+ style = Bar->style;
+ len = Bar->length;
+
+ fg = W->fg_valid ? W->fg_color : FG_COL;
+ bg = W->bg_valid ? W->bg_color : BG_COL;
+
+ bar[0] = Bar->color_valid[0] ? Bar->color[0] : fg;
+ bar[1] = Bar->color_valid[1] ? Bar->color[1] : fg;
+
+ /* sanity check */
+ if (layer < 0 || layer >= LAYERS) {
+ error("%s: layer %d out of bounds (0..%d)", Driver, layer, LAYERS - 1);
+ return -1;
+ }
+
+ /* maybe grow layout framebuffer */
+ if (dir & (DIR_EAST | DIR_WEST)) {
+ drv_generic_graphic_resizeFB(row + YRES, col + XRES * len);
+ } else {
+ drv_generic_graphic_resizeFB(row + YRES * len, col + XRES);
+ }
+
+ res = dir & (DIR_EAST | DIR_WEST) ? XRES : YRES;
+ max = len * res;
+ val1 = Bar->val1 * (double) (max);
+ val2 = Bar->val2 * (double) (max);
+
+ if (val1 < 1)
+ val1 = 1;
+ else if (val1 > max)
+ val1 = max;
+
+ if (val2 < 1)
+ val2 = 1;
+ else if (val2 > max)
+ val2 = max;
+
+ rev = 0;
+
+ switch (dir) {
+ case DIR_WEST:
+ val1 = max - val1;
+ val2 = max - val2;
+ rev = 1;
+
+ case DIR_EAST:
+ for (y = 0; y < YRES; y++) {
+ int val = y < YRES / 2 ? val1 : val2;
+ RGBA bc = y < YRES / 2 ? bar[0] : bar[1];
+
+ for (x = 0; x < max; x++) {
+ if (x < val)
+ drv_generic_graphic_FB[layer][(row + y) * LCOLS + col + x] = rev ? bg : bc;
+ else
+ drv_generic_graphic_FB[layer][(row + y) * LCOLS + col + x] = rev ? bc : bg;
+
+ if (style) {
+ drv_generic_graphic_FB[layer][(row + 0) * LCOLS + col + x] = fg;
+ drv_generic_graphic_FB[layer][(row + YRES - 1) * LCOLS + col + x] = fg;
+ }
+ }
+ if (style) {
+ drv_generic_graphic_FB[layer][(row + y) * LCOLS + col] = fg;
+ drv_generic_graphic_FB[layer][(row + y) * LCOLS + col + max - 1] = fg;
+ }
+ }
+ break;
+
+ case DIR_NORTH:
+ val1 = max - val1;
+ val2 = max - val2;
+ rev = 1;
+
+ case DIR_SOUTH:
+ for (x = 0; x < XRES; x++) {
+ int val = x < XRES / 2 ? val1 : val2;
+ RGBA bc = x < XRES / 2 ? bar[0] : bar[1];
+ for (y = 0; y < max; y++) {
+ if (y < val)
+ drv_generic_graphic_FB[layer][(row + y) * LCOLS + col + x] = rev ? bg : bc;
+ else
+ drv_generic_graphic_FB[layer][(row + y) * LCOLS + col + x] = rev ? bc : bg;
+ if (style) {
+ drv_generic_graphic_FB[layer][(row + y) * LCOLS + col + 0] = fg;
+ drv_generic_graphic_FB[layer][(row + y) * LCOLS + col + XRES - 1] = fg;
+ }
+ }
+ if (style) {
+ drv_generic_graphic_FB[layer][(row + 0) * LCOLS + col + x] = fg;
+ drv_generic_graphic_FB[layer][(row + max - 1) * LCOLS + col + x] = fg;
+ }
+ }
+ break;
+ }
+
+ /* flush area */
+ if (dir & (DIR_EAST | DIR_WEST)) {
+ drv_generic_graphic_blit(row, col, YRES, XRES * len);
+ } else {
+ drv_generic_graphic_blit(row, col, YRES * len, XRES);
+ }
+
+ return 0;
+}
+
+
+/****************************************/
+/*** generic image handling ***/
+/****************************************/
+
+int drv_generic_graphic_image_draw(WIDGET * W)
+{
+ WIDGET_IMAGE *Image = W->data;
+ int layer, row, col, width, height;
+ int x, y;
+ int visible;
+
+ layer = W->layer;
+ row = W->row;
+ col = W->col;
+ width = Image->width;
+ height = Image->height;
+
+ /* sanity check */
+ if (layer < 0 || layer >= LAYERS) {
+ error("%s: layer %d out of bounds (0..%d)", Driver, layer, LAYERS - 1);
+ return -1;
+ }
+
+ /* if no size or no image at all, do nothing */
+ if (width <= 0 || height <= 0 || Image->bitmap == NULL) {
+ return 0;
+ }
+
+ /* maybe grow layout framebuffer */
+ drv_generic_graphic_resizeFB(row + height, col + width);
+
+ /* render image */
+ visible = P2N(&Image->visible);
+ for (y = 0; y < height; y++) {
+ for (x = 0; x < width; x++) {
+ int i = (row + y) * LCOLS + col + x;
+ if (visible) {
+ drv_generic_graphic_FB[layer][i] = Image->bitmap[y * width + x];
+ } else {
+ drv_generic_graphic_FB[layer][i] = BG_COL;
+ }
+ }
+ }
+
+ /* flush area */
+ drv_generic_graphic_blit(row, col, height, width);
+
+ return 0;
+
+}
+
+
+/****************************************/
+/*** generic init/quit ***/
+/****************************************/
+
+int drv_generic_graphic_init(const char *section, const char *driver)
+{
+ int i, l;
+ char *color;
+ WIDGET_CLASS wc;
+
+ Section = (char *) section;
+ Driver = (char *) driver;
+
+ /* init layout framebuffer */
+ LROWS = 0;
+ LCOLS = 0;
+
+ for (l = 0; l < LAYERS; l++)
+ drv_generic_graphic_FB[l] = NULL;
+
+ drv_generic_graphic_resizeFB(DROWS, DCOLS);
+
+ /* sanity check */
+ for (l = 0; l < LAYERS; l++) {
+ if (drv_generic_graphic_FB[l] == NULL) {
+ error("%s: framebuffer could not be allocated: malloc() failed", Driver);
+ return -1;
+ }
+ }
+
+ /* init generic driver & register plugins */
+ drv_generic_init();
+
+ /* set default colors */
+ color = cfg_get(Section, "foreground", "000000ff");
+ if (color2RGBA(color, &FG_COL) < 0) {
+ error("%s: ignoring illegal color '%s'", Driver, color);
+ }
+ if (color)
+ free(color);
+
+ color = cfg_get(Section, "background", "ffffff00");
+ if (color2RGBA(color, &BG_COL) < 0) {
+ error("%s: ignoring illegal color '%s'", Driver, color);
+ }
+ if (color)
+ free(color);
+
+ color = cfg_get(Section, "basecolor", "ffffff");
+ if (color2RGBA(color, &BL_COL) < 0) {
+ error("%s: ignoring illegal color '%s'", Driver, color);
+ }
+ if (color)
+ free(color);
+
+ /* inverted display? */
+ cfg_number(section, "inverted", 0, 0, 1, &INVERTED);
+
+ /* register text widget */
+ wc = Widget_Text;
+ wc.draw = drv_generic_graphic_draw;
+ widget_register(&wc);
+
+ /* register icon widget */
+ wc = Widget_Icon;
+ wc.draw = drv_generic_graphic_icon_draw;
+ widget_register(&wc);
+
+ /* register bar widget */
+ wc = Widget_Bar;
+ wc.draw = drv_generic_graphic_bar_draw;
+ widget_register(&wc);
+
+ /* register image widget */
+#ifdef WITH_IMAGE
+ wc = Widget_Image;
+ wc.draw = drv_generic_graphic_image_draw;
+ widget_register(&wc);
+#endif
+
+ /* clear framebuffer but do not blit to display */
+ for (l = 0; l < LAYERS; l++)
+ for (i = 0; i < LCOLS * LROWS; i++)
+ drv_generic_graphic_FB[l][i] = NO_COL;
+
+ return 0;
+}
+
+
+int drv_generic_graphic_clear(void)
+{
+ int i, l;
+
+ for (l = 0; l < LAYERS; l++)
+ for (i = 0; i < LCOLS * LROWS; i++)
+ drv_generic_graphic_FB[l][i] = NO_COL;
+
+ drv_generic_graphic_blit(0, 0, LROWS, LCOLS);
+
+ return 0;
+}
+
+
+RGBA drv_generic_graphic_rgb(const int row, const int col)
+{
+ return drv_generic_graphic_blend(row, col);
+}
+
+
+unsigned char drv_generic_graphic_gray(const int row, const int col)
+{
+ RGBA p = drv_generic_graphic_blend(row, col);
+ return (77 * p.R + 150 * p.G + 28 * p.B) / 255;
+}
+
+
+unsigned char drv_generic_graphic_black(const int row, const int col)
+{
+ return drv_generic_graphic_gray(row, col) < 127;
+}
+
+
+int drv_generic_graphic_quit(void)
+{
+ int l;
+
+ for (l = 0; l < LAYERS; l++) {
+ if (drv_generic_graphic_FB[l]) {
+ free(drv_generic_graphic_FB[l]);
+ drv_generic_graphic_FB[l] = NULL;
+ }
+ }
+ widget_unregister();
+ return (0);
+}
diff --git a/drv_generic_graphic.h b/drv_generic_graphic.h
new file mode 100644
index 0000000..dd16235
--- /dev/null
+++ b/drv_generic_graphic.h
@@ -0,0 +1,58 @@
+/* $Id: drv_generic_graphic.h 959 2009-01-13 12:55:23Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/drv_generic_graphic.h $
+ *
+ * generic driver helper for graphic displays
+ *
+ * Copyright (C) 1999, 2000 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+
+#ifndef _DRV_GENERIC_GRAPHIC_H_
+#define _DRV_GENERIC_GRAPHIC_H_
+
+#include "drv_generic.h"
+#include "widget.h"
+#include "rgb.h"
+
+extern RGBA FG_COL; /* foreground color */
+extern RGBA BG_COL; /* background color */
+extern RGBA BL_COL; /* backlight color */
+extern RGBA NO_COL; /* no color (completely transparent) */
+
+/* these functions must be implemented by the real driver */
+extern void (*drv_generic_graphic_real_blit) (const int row, const int col, const int height, const int width);
+
+/* helper function to get pixel color or gray value */
+extern RGBA drv_generic_graphic_rgb(const int row, const int col);
+extern unsigned char drv_generic_graphic_gray(const int row, const int col);
+extern unsigned char drv_generic_graphic_black(const int row, const int col);
+
+
+/* generic functions and widget callbacks */
+int drv_generic_graphic_init(const char *section, const char *driver);
+int drv_generic_graphic_clear(void);
+int drv_generic_graphic_greet(const char *msg1, const char *msg2);
+int drv_generic_graphic_draw(WIDGET * W);
+int drv_generic_graphic_icon_draw(WIDGET * W);
+int drv_generic_graphic_bar_draw(WIDGET * W);
+int drv_generic_graphic_quit(void);
+
+#endif
diff --git a/drv_generic_i2c.c b/drv_generic_i2c.c
new file mode 100644
index 0000000..8dce073
--- /dev/null
+++ b/drv_generic_i2c.c
@@ -0,0 +1,218 @@
+/* $Id: drv_generic_i2c.c 1202 2015-06-18 16:44:09Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/drv_generic_i2c.c $
+ *
+ * generic driver helper for i2c displays
+ *
+ * Copyright (C) 2005 Luis Correia <lfcorreia@users.sf.net>
+ * Copyright (C) 2005 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+ /*
+ DISCLAIMER!!!!
+
+ The following code is WORK IN PROGRESS, since it basicly 'works for us...'
+
+ (C) 2005 Paul Kamphuis & Luis Correia
+
+ We have removed all of the delays from this code, as the I2C bus is slow enough...
+ (maximum possible speed is 100KHz only)
+
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <unistd.h>
+#include <termios.h>
+#include <fcntl.h>
+#include <time.h>
+#include <signal.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/ioctl.h>
+
+#include "lcd4linux_i2c.h"
+#include "debug.h"
+#include "qprintf.h"
+#include "cfg.h"
+#include "udelay.h"
+#include "drv_generic_i2c.h"
+
+
+static char *Driver = "";
+static char *Section = "";
+static int i2c_device;
+static int ctrldev;
+static int datadev;
+
+static void my_i2c_smbus_write_byte_data(const int device, const unsigned char val)
+{
+ struct i2c_smbus_ioctl_data args;
+ union i2c_smbus_data data;
+ args.read_write = I2C_SMBUS_WRITE;
+ args.command = val;
+ args.size = I2C_SMBUS_BYTE_DATA;
+ data.byte = val;
+ args.data = &data;
+ if (ioctl(device, I2C_SMBUS, &args) < 0) {
+ info("I2C: device %d IOCTL failed !\n", device);
+ }
+}
+
+/* unused, ifdef'ed away to avoid compiler warning */
+#if 0
+static void my_i2c_smbus_read_byte_data(const int device, const unsigned char data)
+{
+ struct i2c_smbus_ioctl_data args;
+ args.read_write = I2C_SMBUS_READ;
+ args.command = data;
+ args.size = I2C_SMBUS_BYTE;
+ args.data = 0;
+ ioctl(device, I2C_SMBUS, &args);
+}
+#endif
+
+int drv_generic_i2c_pre_write(int dev)
+{
+
+ info("%s: selecting slave device 0x%x", Driver, dev);
+ if (ioctl(i2c_device, I2C_SLAVE, dev) < 0) {
+ error("%s: error selecting slave device 0x%x\n", Driver, dev);
+ return -EPIPE;
+ }
+
+ info("%s: initializing I2C slave device 0x%x for output", Driver, dev);
+ if (i2c_smbus_write_byte_data(i2c_device, 3, 0) < 0) {
+ error("%s: error initializing device 0x%x\n", Driver, dev);
+ close(i2c_device);
+ }
+
+ return 0;
+}
+
+int drv_generic_i2c_open(const char *section, const char *driver)
+{
+ char *bus, *device;
+ udelay_init();
+ Section = (char *) section;
+ Driver = (char *) driver;
+ bus = cfg_get(Section, "Port", NULL);
+ device = cfg_get(Section, "Device", NULL);
+ ctrldev = atoi(device);
+ device = cfg_get(Section, "DDevice", NULL);
+ datadev = atoi(device);
+
+ info("%s: initializing I2C bus %s", Driver, bus);
+ if ((i2c_device = open(bus, O_WRONLY)) < 0) {
+ error("%s: I2C bus %s open failed !\n", Driver, bus);
+ goto exit_error;
+ }
+
+ if (datadev) {
+ if (drv_generic_i2c_pre_write(datadev) < 0)
+ goto exit_error;
+ }
+
+ if (drv_generic_i2c_pre_write(ctrldev) < 0)
+ goto exit_error;
+
+ return 0;
+
+ exit_error:
+ free(bus);
+ free(device);
+ close(i2c_device);
+ return -1;
+}
+
+int drv_generic_i2c_close(void)
+{
+ close(i2c_device);
+ return 0;
+}
+
+unsigned char drv_generic_i2c_wire(const char *name, const char *deflt)
+{
+ unsigned char w;
+ char wire[256];
+ char *s;
+ qprintf(wire, sizeof(wire), "Wire.%s", name);
+ s = cfg_get(Section, wire, deflt);
+ if (strlen(s) == 3 && strncasecmp(s, "DB", 2) == 0 && s[2] >= '0' && s[2] <= '7') {
+ w = s[2] - '0';
+ } else if (strcasecmp(s, "GND") == 0) {
+ w = 0;
+ } else {
+ error("%s: unknown signal <%s> for wire <%s>", Driver, s, name);
+ error("%s: should be DB0..7 or GND", Driver);
+ return 0xff;
+ }
+ free(s);
+ if (w == 0) {
+ info("%s: wiring: [DISPLAY:%s]<==>[i2c:GND]", Driver, name);
+ } else {
+ info("%s: wiring: [DISPLAY:%s]<==>[i2c:DB%d]", Driver, name, w);
+ }
+ w = 1 << w;
+ return w;
+}
+
+
+void drv_generic_i2c_byte(const unsigned char data)
+{
+ i2c_smbus_write_byte(i2c_device, data);
+}
+
+
+void drv_generic_i2c_data(const unsigned char data)
+{
+ my_i2c_smbus_write_byte_data(i2c_device, data);
+}
+
+static void i2c_out(int dev, unsigned char val)
+{
+ info("%s: initializing I2C slave device 0x%x", Driver, dev);
+ if (ioctl(i2c_device, I2C_SLAVE, dev) < 0) {
+ error("%s: error selecting slave device 0x%x\n", Driver, dev);
+ return;
+ }
+
+ i2c_smbus_write_byte_data(i2c_device, 1, val);
+}
+
+void drv_generic_i2c_command(const unsigned char command, /*const */ unsigned char *data, const unsigned char length,
+ int bits)
+{
+ if (bits == 4) {
+ i2c_smbus_write_block_data(i2c_device, command, length, data);
+ } else if (bits == 8 && datadev) {
+ /* set data on pins */
+ info("cmd: %08x, data0: %08x, data1: %08x\n", command, data[0], data[1]);
+ i2c_out(datadev, data[0]);
+ /* set enable pin including optional rs and rw */
+ i2c_out(ctrldev, command | data[1]);
+ /* unset enable pin including optional rs and rw */
+ i2c_out(ctrldev, command);
+ }
+
+}
diff --git a/drv_generic_i2c.h b/drv_generic_i2c.h
new file mode 100644
index 0000000..ab1dc7b
--- /dev/null
+++ b/drv_generic_i2c.h
@@ -0,0 +1,63 @@
+/* $Id: drv_generic_i2c.h 1202 2015-06-18 16:44:09Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/drv_generic_i2c.h $
+ *
+ * generic driver helper for i2c displays
+ *
+ * Copyright (C) 2005 Luis Correia <lfcorreia@users.sf.net>
+ * Copyright (C) 2005 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ *
+ * exported fuctions:
+ *
+ * int drv_generic_i2c_open (void)
+ * reads 'Port' entry from config and opens
+ * the i2c port
+ * returns 0 if ok, -1 on failure
+ *
+ * int drv_generic_i2c_close (void)
+ * closes i2c port
+ * returns 0 if ok, -1 on failure
+ *
+ * unsigned char drv_generic_i2c_wire (char *name, char *deflt)
+ * reads wiring for one data signal from config
+ * returns 1<<bitpos or 255 on error
+ *
+ * void drv_generic_i2c_data (unsigned char value)
+ * put data bits on DB1..DB8
+ *
+ * void drv_generic_i2c_command(unsigned char command, unsigned char *data,unsigned char length)
+ * send command and the data to the i2c device
+ *
+ */
+
+#ifndef _DRV_GENERIC_I2C_H_
+#define _DRV_GENERIC_I2C_H_
+
+int drv_generic_i2c_open(const char *section, const char *driver);
+int drv_generic_i2c_close(void);
+unsigned char drv_generic_i2c_wire(const char *name, const char *deflt);
+void drv_generic_i2c_byte(const unsigned char data);
+void drv_generic_i2c_data(const unsigned char data);
+void drv_generic_i2c_command(const unsigned char command, /*const */ unsigned char *data, const unsigned char length,
+ int bits);
+
+#endif
diff --git a/drv_generic_keypad.c b/drv_generic_keypad.c
new file mode 100644
index 0000000..d798ccb
--- /dev/null
+++ b/drv_generic_keypad.c
@@ -0,0 +1,76 @@
+/* $Id: drv_generic_keypad.c 1091 2010-01-21 04:26:24Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/drv_generic_keypad.c $
+ *
+ * generic driver helper for keypads
+ *
+ * Copyright (C) 2006 Chris Maj <cmaj@freedomcorpse.com>
+ * Copyright (C) 2006 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+
+#include "config.h"
+
+#include <stdio.h>
+
+#include "debug.h"
+#include "widget.h"
+#include "widget_keypad.h"
+
+#include "drv_generic_keypad.h"
+
+static char *Section = NULL;
+static char *Driver = NULL;
+
+int (*drv_generic_keypad_real_press) () = NULL;
+
+int drv_generic_keypad_init(const char *section, const char *driver)
+{
+ WIDGET_CLASS wc;
+
+ Section = (char *) section;
+ Driver = (char *) driver;
+
+ /* register keypad widget */
+ wc = Widget_Keypad;
+ widget_register(&wc);
+
+ return 0;
+}
+
+int drv_generic_keypad_press(const int num)
+{
+ WIDGET *w;
+ int val = 0;
+
+ if (drv_generic_keypad_real_press)
+ val = drv_generic_keypad_real_press(num);
+
+ w = widget_find(WIDGET_TYPE_KEYPAD, &val);
+
+ if (w && w->class->draw)
+ w->class->draw(w);
+
+ return val;
+}
+
+int drv_generic_keypad_quit(void)
+{
+ return 0;
+}
diff --git a/drv_generic_keypad.h b/drv_generic_keypad.h
new file mode 100644
index 0000000..57a61d8
--- /dev/null
+++ b/drv_generic_keypad.h
@@ -0,0 +1,38 @@
+/* $Id: drv_generic_keypad.h 856 2008-03-03 16:54:18Z michux $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/drv_generic_keypad.h $
+ *
+ * generic driver helper for keypads
+ *
+ * Copyright (C) 2006 Chris Maj <cmaj@freedomcorpse.com>
+ * Copyright (C) 2006 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+#ifndef _DRV_GENERIC_KEYPAD_H_
+#define _DRV_GENERIC_KEYPAD_H_
+
+#include "widget.h"
+
+/* these functions must be implemented by the real driver */
+extern int (*drv_generic_keypad_real_press) (const int num);
+
+/* generic functions and widget callbacks */
+int drv_generic_keypad_init(const char *section, const char *driver);
+int drv_generic_keypad_press(const int num);
+int drv_generic_keypad_quit(void);
+
+#endif
diff --git a/drv_generic_parport.c b/drv_generic_parport.c
new file mode 100644
index 0000000..3b5a36d
--- /dev/null
+++ b/drv_generic_parport.c
@@ -0,0 +1,566 @@
+/* $Id: drv_generic_parport.c 1165 2011-12-26 06:28:05Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/drv_generic_parport.c $
+ *
+ * generic driver helper for serial and parport access
+ *
+ * Copyright (C) 1999, 2000 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <unistd.h>
+#include <termios.h>
+#include <fcntl.h>
+#include <time.h>
+#include <signal.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/ioctl.h>
+
+#ifdef WITH_OUTB
+#ifdef HAVE_SYS_IO_H
+#include <sys/io.h>
+#else
+#ifdef HAVE_ASM_IO_H
+#include <asm/io.h>
+#else
+#warning neither sys/io.h nor asm/io.h exists.
+#warning raw port I/O will be disabled.
+#undef WITH_OUTB
+#endif
+#endif
+#endif
+
+#if defined (HAVE_LINUX_PARPORT_H) && defined (HAVE_LINUX_PPDEV_H)
+#define WITH_PPDEV
+#include <linux/parport.h>
+#include <linux/ppdev.h>
+#else
+#define PARPORT_CONTROL_STROBE 0x1
+#define PARPORT_CONTROL_AUTOFD 0x2
+#define PARPORT_CONTROL_INIT 0x4
+#define PARPORT_CONTROL_SELECT 0x8
+#define PARPORT_STATUS_ERROR 0x8
+#define PARPORT_STATUS_SELECT 0x10
+#define PARPORT_STATUS_PAPEROUT 0x20
+#define PARPORT_STATUS_ACK 0x40
+#define PARPORT_STATUS_BUSY 0x80
+#endif
+
+/* these signals are inverted by hardware on the parallel port */
+#define PARPORT_CONTROL_INVERTED (PARPORT_CONTROL_STROBE | PARPORT_CONTROL_SELECT | PARPORT_CONTROL_AUTOFD)
+
+#if !defined(WITH_OUTB) && !defined(WITH_PPDEV)
+#error neither outb() nor ppdev() possible
+#error cannot compile parallel port driver
+#endif
+
+#include "debug.h"
+#include "qprintf.h"
+#include "cfg.h"
+#include "udelay.h"
+#include "drv_generic_parport.h"
+
+
+static char *Driver = "";
+static char *Section = "";
+static unsigned short Port = 0;
+static char *PPdev = NULL;
+
+/* Any bits set here will have their logic inverted at the parallel port */
+static unsigned char inverted_control_bits = 0;
+
+#ifdef WITH_OUTB
+/* initial value taken from linux/parport_pc.c */
+static unsigned char ctr = 0xc;
+#endif
+
+#ifdef WITH_PPDEV
+static int PPfd = -1;
+#endif
+
+
+int drv_generic_parport_open(const char *section, const char *driver)
+{
+ char *s, *e;
+
+ Section = (char *) section;
+ Driver = (char *) driver;
+
+ udelay_init();
+
+#ifndef WITH_PPDEV
+ error("The files include/linux/parport.h and/or include/linux/ppdev.h");
+ error("were missing at compile time. Even if your system supports");
+ error("ppdev, it will not be used.");
+ error("You *really* should install these files and recompile LCD4linux!");
+#endif
+
+ s = cfg_get(Section, "Port", NULL);
+ if (s == NULL || *s == '\0') {
+ error("%s: no '%s.Port' entry from %s", Driver, Section, cfg_source());
+ return -1;
+ }
+
+ PPdev = NULL;
+ if ((Port = strtol(s, &e, 0)) == 0 || *e != '\0') {
+#ifdef WITH_PPDEV
+ Port = 0;
+ PPdev = s;
+#else
+ error("%s: bad %s.Port '%s' from %s", Driver, Section, s, cfg_source());
+ free(s);
+ return -1;
+#endif
+ }
+#ifdef WITH_PPDEV
+ if (PPdev) {
+ info("%s: using ppdev %s", Driver, PPdev);
+ PPfd = open(PPdev, O_RDWR);
+ if (PPfd == -1) {
+ error("%s: open(%s) failed: %s", Driver, PPdev, strerror(errno));
+ return -1;
+ }
+#if 0
+ /* PPEXCL fails if someone else uses the port (e.g. lp.ko) */
+ if (ioctl(PPfd, PPEXCL)) {
+ info("%s: ioctl(%s, PPEXCL) failed: %s", PPdev, Driver, strerror(errno));
+ info("%s: could not get exclusive access to %s.", Driver, PPdev);
+ } else {
+ info("%s: got exclusive access to %s.", Driver, PPdev);
+ }
+#endif
+ if (ioctl(PPfd, PPCLAIM)) {
+ error("%s: ioctl(%s, PPCLAIM) failed: %d %s", Driver, PPdev, errno, strerror(errno));
+ return -1;
+ }
+ }
+#endif
+
+#ifdef WITH_OUTB
+ if (Port) {
+ error("using raw port 0x%x (deprecated!)", Port);
+ error("You *really* should change your setup and use ppdev!");
+ if ((Port + 3) <= 0x3ff) {
+ if (ioperm(Port, 3, 1) != 0) {
+ error("%s: ioperm(0x%x) failed: %s", Driver, Port, strerror(errno));
+ return -1;
+ }
+ } else {
+ if (iopl(3) != 0) {
+ error("%s: iopl(1) failed: %s", Driver, strerror(errno));
+ return -1;
+ }
+ }
+ }
+#endif
+ return 0;
+}
+
+
+int drv_generic_parport_close(void)
+{
+#ifdef WITH_PPDEV
+ if (PPdev) {
+ debug("closing ppdev %s", PPdev);
+ if (ioctl(PPfd, PPRELEASE)) {
+ error("%s: ioctl(%s, PPRELEASE) failed: %s", Driver, PPdev, strerror(errno));
+ }
+ if (close(PPfd) == -1) {
+ error("%s: close(%s) failed: %s", Driver, PPdev, strerror(errno));
+ return -1;
+ }
+ free(PPdev);
+ }
+#endif
+
+#ifdef WITH_OUTB
+ if (Port) {
+ debug("closing raw port 0x%x", Port);
+ if ((Port + 3) <= 0x3ff) {
+ if (ioperm(Port, 3, 0) != 0) {
+ error("%s: ioperm(0x%x) failed: %s", Driver, Port, strerror(errno));
+ return -1;
+ }
+ } else {
+ if (iopl(0) != 0) {
+ error("%s: iopl(0) failed: %s", Driver, strerror(errno));
+ return -1;
+ }
+ }
+ }
+#endif
+
+ return 0;
+}
+
+
+static unsigned char drv_generic_parport_signal_ctrl(const char *name, const char *signal)
+{
+ unsigned char wire;
+ int invert = 0;
+
+ /* Prefixing a signal name with '-' inverts the logic */
+ if (signal[0] == '-') {
+ invert = 1;
+ signal++;
+ }
+
+ if (strcasecmp(signal, "STROBE") == 0) {
+ wire = PARPORT_CONTROL_STROBE;
+ info("%s: wiring: DISPLAY:%-9s - PARPORT:STROBE (Pin 1)%s", Driver, name, invert ? " [inverted]" : "");
+ } else if (strcasecmp(signal, "AUTOFD") == 0) {
+ wire = PARPORT_CONTROL_AUTOFD;
+ info("%s: wiring: DISPLAY:%-9s - PARPORT:AUTOFD (Pin 14)%s", Driver, name, invert ? " [inverted]" : "");
+ } else if (strcasecmp(signal, "INIT") == 0) {
+ wire = PARPORT_CONTROL_INIT;
+ info("%s: wiring: DISPLAY:%-9s - PARPORT:INIT (Pin 16)%s", Driver, name, invert ? " [inverted]" : "");
+ } else if (strcasecmp(signal, "SLCTIN") == 0) {
+ wire = PARPORT_CONTROL_SELECT;
+ info("%s: wiring: DISPLAY:%-9s - PARPORT:SLCTIN (Pin 17)%s", Driver, name, invert ? " [inverted]" : "");
+ } else if (strcasecmp(signal, "SELECT") == 0) {
+ wire = PARPORT_CONTROL_SELECT;
+ error("%s: SELECT is deprecated. Please use SLCTIN instead!", Driver);
+ info("%s: wiring: DISPLAY:%-9s - PARPORT:SLCTIN (Pin 17)%s", Driver, name, invert ? " [inverted]" : "");
+ } else if (strcasecmp(signal, "GND") == 0) {
+ wire = 0;
+ info("%s: wiring: DISPLAY:%-9s - PARPORT:GND", Driver, name);
+ } else {
+ error("%s: unknown signal <%s> for control line <%s>", Driver, signal, name);
+ error("%s: should be STROBE, AUTOFD, INIT, SLCTIN or GND", Driver);
+ return 0xff;
+ }
+
+ if (invert) {
+ inverted_control_bits |= wire;
+ }
+
+ return wire;
+}
+
+
+unsigned char drv_generic_parport_wire_ctrl(const char *name, const char *deflt)
+{
+ unsigned char wire;
+ char key[256];
+ char *val;
+
+ qprintf(key, sizeof(key), "Wire.%s", name);
+ val = cfg_get(Section, key, deflt);
+
+ wire = drv_generic_parport_signal_ctrl(name, val);
+
+ free(val);
+
+ return wire;
+}
+
+
+unsigned char drv_generic_parport_hardwire_ctrl(const char *name, const char *signal)
+{
+ unsigned char wire;
+ char key[256];
+ char *val;
+
+ qprintf(key, sizeof(key), "Wire.%s", name);
+ val = cfg_get(Section, key, "");
+
+ /* maybe warn the user */
+ if (*val != '\0' && strcasecmp(signal, val) != 0) {
+ error("%s: ignoring configured signal <%s> for control line <%s>", Driver, val, name);
+ }
+ free(val);
+
+ wire = drv_generic_parport_signal_ctrl(name, signal);
+
+ return wire;
+}
+
+
+static unsigned char drv_generic_parport_signal_status(const char *name, const char *signal)
+{
+ unsigned char wire;
+
+ if (strcasecmp(signal, "ERROR") == 0) {
+ wire = PARPORT_STATUS_ERROR;
+ info("%s: wiring: DISPLAY:%-9s - PARPORT:ERROR (Pin 15)", Driver, name);
+ } else if (strcasecmp(signal, "SELECT") == 0) {
+ wire = PARPORT_STATUS_SELECT;
+ info("%s: wiring: DISPLAY:%-9s - PARPORT:SELECT (Pin 13)", Driver, name);
+ } else if (strcasecmp(signal, "PAPEROUT") == 0) {
+ wire = PARPORT_STATUS_PAPEROUT;
+ info("%s: wiring: DISPLAY:%-9s - PARPORT:PAPEROUT (Pin 12)", Driver, name);
+ } else if (strcasecmp(signal, "ACK") == 0) {
+ wire = PARPORT_STATUS_ACK;
+ info("%s: wiring: DISPLAY:%-9s - PARPORT:ACK (Pin 10)", Driver, name);
+ } else if (strcasecmp(signal, "BUSY") == 0) {
+ wire = PARPORT_STATUS_BUSY;
+ info("%s: wiring: DISPLAY:%-9s - PARPORT:BUSY (Pin 11)", Driver, name);
+ } else if (strcasecmp(signal, "GND") == 0) {
+ wire = 0;
+ info("%s: wiring: DISPLAY:%-9s - PARPORT:GND", Driver, name);
+ } else {
+ error("%s: unknown signal <%s> for status line <%s>", Driver, signal, name);
+ error("%s: should be ERROR, SELECT, PAPEROUT, ACK, BUSY or GND", Driver);
+ return 0xff;
+ }
+
+ return wire;
+}
+
+
+unsigned char drv_generic_parport_wire_status(const char *name, const char *deflt)
+{
+ unsigned char wire;
+ char key[256];
+ char *val;
+
+ qprintf(key, sizeof(key), "Wire.%s", name);
+ val = cfg_get(Section, key, deflt);
+
+ wire = drv_generic_parport_signal_status(name, val);
+
+ free(val);
+
+ return wire;
+}
+
+
+unsigned char drv_generic_parport_wire_data(const char *name, const char *deflt)
+{
+ unsigned char w;
+ char wire[256];
+ char *s;
+
+ qprintf(wire, sizeof(wire), "Wire.%s", name);
+ s = cfg_get(Section, wire, deflt);
+ if (strlen(s) == 3 && strncasecmp(s, "DB", 2) == 0 && s[2] >= '0' && s[2] <= '7') {
+ w = s[2] - '0';
+ } else if (strcasecmp(s, "GND") == 0) {
+ w = 0;
+ } else {
+ error("%s: unknown signal <%s> for data line <%s>", Driver, s, name);
+ error("%s: should be DB0..7 or GND", Driver);
+ return 0xff;
+ }
+ free(s);
+ if (w == 0) {
+ info("%s: wiring: DISPLAY:%-9s - PARPORT:GND", Driver, name);
+ } else {
+ info("%s: wiring: DISPLAY:%-9s - PARPORT:DB%d (Pin %2d)", Driver, name, w, w + 2);
+ }
+
+ w = 1 << w;
+
+ return w;
+}
+
+
+void drv_generic_parport_direction(const int direction)
+{
+#ifdef WITH_PPDEV
+ if (PPdev) {
+ ioctl(PPfd, PPDATADIR, &direction);
+ }
+#endif
+
+#ifdef WITH_OUTB
+ if (Port) {
+ /* code stolen from linux/parport_pc.h */
+ ctr = (ctr & ~0x20) ^ (direction ? 0x20 : 0x00);
+ outb(ctr, Port + 2);
+ }
+#endif
+}
+
+
+unsigned char drv_generic_parport_status(void)
+{
+ unsigned char mask =
+ PARPORT_STATUS_ERROR | PARPORT_STATUS_SELECT | PARPORT_STATUS_PAPEROUT | PARPORT_STATUS_ACK |
+ PARPORT_STATUS_BUSY;
+
+ unsigned char data;
+
+#ifdef WITH_PPDEV
+ if (PPdev) {
+ ioctl(PPfd, PPRSTATUS, &data);
+ }
+#endif
+
+#ifdef WITH_OUTB
+ if (Port) {
+ data = inb(Port + 1);
+ }
+#endif
+
+ /* clear unused bits */
+ data &= mask;
+
+ return data;
+}
+
+
+void drv_generic_parport_control(const unsigned char mask, const unsigned char value)
+{
+ unsigned char val;
+
+ /* any signal affected? */
+ /* Note: this may happen in case a signal is hardwired to GND */
+ if (mask == 0)
+ return;
+
+ /* Strobe, Select and AutoFeed are inverted! */
+ val = mask & (value ^ PARPORT_CONTROL_INVERTED ^ inverted_control_bits);
+
+#ifdef WITH_PPDEV
+ if (PPdev) {
+ struct ppdev_frob_struct frob;
+ frob.mask = mask;
+ frob.val = val;
+ ioctl(PPfd, PPFCONTROL, &frob);
+ }
+#endif
+
+#ifdef WITH_OUTB
+ if (Port) {
+ /* code stolen from linux/parport_pc.h */
+ ctr = (ctr & ~mask) ^ val;
+ outb(ctr, Port + 2);
+ }
+#endif
+}
+
+
+void drv_generic_parport_toggle(const unsigned char bits, const int level, const unsigned long delay)
+{
+ unsigned char value1, value2;
+
+ /* any signal affected? */
+ /* Note: this may happen in case a signal is hardwired to GND */
+ if (bits == 0)
+ return;
+
+ /* prepare value */
+ value1 = level ? bits : 0;
+ value2 = level ? 0 : bits;
+
+ /* Strobe, Select and AutoFeed are inverted! */
+ value1 = bits & (value1 ^ PARPORT_CONTROL_INVERTED ^ inverted_control_bits);
+ value2 = bits & (value2 ^ PARPORT_CONTROL_INVERTED ^ inverted_control_bits);
+
+#ifdef WITH_PPDEV
+ if (PPdev) {
+ struct ppdev_frob_struct frob;
+ frob.mask = bits;
+
+ /* rise */
+ frob.val = value1;
+ ioctl(PPfd, PPFCONTROL, &frob);
+
+ /* pulse width */
+ ndelay(delay);
+
+ /* lower */
+ frob.val = value2;
+ ioctl(PPfd, PPFCONTROL, &frob);
+
+ }
+#endif
+
+#ifdef WITH_OUTB
+ if (Port) {
+ /* rise */
+ ctr = (ctr & ~bits) ^ value1;
+ outb(ctr, Port + 2);
+
+ /* pulse width */
+ ndelay(delay);
+
+ /* lower */
+ ctr = (ctr & ~bits) ^ value2;
+ outb(ctr, Port + 2);
+ }
+#endif
+}
+
+
+void drv_generic_parport_data(const unsigned char data)
+{
+#ifdef WITH_PPDEV
+ if (PPdev) {
+ ioctl(PPfd, PPWDATA, &data);
+ }
+#endif
+
+#ifdef WITH_OUTB
+ if (Port) {
+ outb(data, Port);
+ }
+#endif
+}
+
+unsigned char drv_generic_parport_read(void)
+{
+ unsigned char data = 0;
+
+#ifdef WITH_PPDEV
+ if (PPdev) {
+ ioctl(PPfd, PPRDATA, &data);
+ }
+#endif
+
+#ifdef WITH_OUTB
+ if (Port) {
+ data = inb(Port);
+ }
+#endif
+
+ return data;
+}
+
+
+void drv_generic_parport_debug(void)
+{
+ unsigned char control = 0;
+
+#ifdef WITH_PPDEV
+ if (PPdev) {
+ ioctl(PPfd, PPRCONTROL, &control);
+ }
+#endif
+
+#ifdef WITH_OUTB
+ if (Port) {
+ control = ctr;
+ }
+#endif
+
+ debug("%cSTROBE %cAUTOFD %cINIT %cSLCTIN",
+ control & PARPORT_CONTROL_STROBE ? '-' : '+',
+ control & PARPORT_CONTROL_AUTOFD ? '-' : '+', control & PARPORT_CONTROL_INIT ? '+' : '-',
+ control & PARPORT_CONTROL_SELECT ? '-' : '+');
+
+}
diff --git a/drv_generic_parport.h b/drv_generic_parport.h
new file mode 100644
index 0000000..603badb
--- /dev/null
+++ b/drv_generic_parport.h
@@ -0,0 +1,100 @@
+/* $Id: drv_generic_parport.h 840 2007-09-09 12:17:42Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/drv_generic_parport.h $
+ *
+ * generic driver helper for parallel port displays
+ *
+ * Copyright (C) 1999, 2000 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ *
+ * exported fuctions:
+ *
+ * int drv_generic_parport_open (void)
+ * reads 'Port' entry from config and opens
+ * the parallel port
+ * returns 0 if ok, -1 on failure
+ *
+ * int drv_generic_parport_close (void)
+ * closes parallel port
+ * returns 0 if ok, -1 on failure
+ *
+ * unsigned char drv_generic_parport_wire_ctrl (char *name, char *deflt)
+ * reads wiring for one control signal from config
+ * returns DRV_GENERIC_PARPORT_CONTROL_* or 255 on error
+ *
+ * unsigned char drv_generic_parport_hardwire_ctrl (char *name)
+ * returns hardwiring for one control signal
+ * same as above, but does not read from config,
+ * but checks the config and emits a warning that the config
+ * entry will be ignored
+ * returns DRV_GENERIC_PARPORT_CONTROL_* or 255 on error
+ *
+ * unsigned char drv_generic_parport_wire_status (char *name, char *deflt)
+ * reads wiring for one status signal from config
+ * returns DRV_GENERIC_PARPORT_STATUS_* or 255 on error
+ *
+ * unsigned char drv_generic_parport_wire_data (char *name, char *deflt)
+ * reads wiring for one data signal from config
+ * returns 1<<bitpos or 255 on error
+ *
+ * void drv_generic_parport_direction (int direction)
+ * 0 - write to parport
+ * 1 - read from parport
+ *
+ * unsigned char drv_generic_parport_status (void)
+ * reads control lines
+ *
+ * void drv_generic_parport_control (unsigned char mask, unsigned char value)
+ * frobs control line and takes care of inverted signals
+ *
+ * void drv_generic_parport_toggle (unsigned char bit, int level, int delay)
+ * toggles the line <bit> to <level> for <delay> nanoseconds
+ *
+ * void drv_generic_parport_data (unsigned char value)
+ * put data bits on DB1..DB8
+ *
+ * unsigned char drv_generic_parport_read (void)
+ * reads a byte from the parallel port
+ *
+ * void drv_generic_parport_debug(void)
+ * prints status of control lines
+ *
+ */
+
+#ifndef _DRV_GENERIC_PARPORT_H_
+#define _DRV_GENERIC_PARPORT_H_
+
+int drv_generic_parport_open(const char *section, const char *driver);
+int drv_generic_parport_close(void);
+unsigned char drv_generic_parport_wire_ctrl(const char *name, const char *deflt);
+unsigned char drv_generic_parport_hardwire_ctrl(const char *name, const char *deflt);
+unsigned char drv_generic_parport_wire_status(const char *name, const char *deflt);
+unsigned char drv_generic_parport_wire_data(const char *name, const char *deflt);
+void drv_generic_parport_direction(const int direction);
+unsigned char drv_generic_parport_status(void);
+void drv_generic_parport_control(const unsigned char mask, const unsigned char value);
+void drv_generic_parport_toggle(const unsigned char bit, const int level, const unsigned long delay);
+void drv_generic_parport_data(const unsigned char data);
+unsigned char drv_generic_parport_read(void);
+void drv_generic_parport_debug(void);
+
+#endif
diff --git a/drv_generic_serial.c b/drv_generic_serial.c
new file mode 100644
index 0000000..1ab2c97
--- /dev/null
+++ b/drv_generic_serial.c
@@ -0,0 +1,415 @@
+/* $Id: drv_generic_serial.c 1171 2012-01-16 02:53:14Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/drv_generic_serial.c $
+ *
+ * generic driver helper for serial and usbserial displays
+ *
+ * Copyright (C) 1999, 2000 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ *
+ * exported fuctions:
+ *
+ * int drv_generic_serial_open (char *section, char *driver, unsigned int flags)
+ * opens the serial port
+ *
+ * int drv_generic_serial_poll (char *string, int len)
+ * reads from the serial or USB port
+ * without retry
+ *
+ * int drv_generic_serial_read (char *string, int len);
+ * reads from the serial or USB port
+ * with retry
+ *
+ * void drv_generic_serial_write (char *string, int len);
+ * writes to the serial or USB port
+ *
+ * int drv_generic_serial_close (void);
+ * closes the serial port
+ *
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <unistd.h>
+#include <termios.h>
+#include <fcntl.h>
+#include <time.h>
+#include <signal.h>
+#include <linux/serial.h>
+#include <sys/ioctl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#include "debug.h"
+#include "qprintf.h"
+#include "cfg.h"
+#include "drv_generic_serial.h"
+
+
+extern int got_signal;
+
+static char *Section;
+static char *Driver;
+static char *Port;
+static speed_t Speed;
+static int Device = -1;
+
+
+#define LOCK "/var/lock/LCK..%s"
+
+
+/****************************************/
+/*** generic serial/USB communication ***/
+/****************************************/
+
+static pid_t drv_generic_serial_lock_port(const char *Port)
+{
+ char lockfile[256];
+ char tempfile[256];
+ char buffer[16];
+ char *port, *p;
+ int fd, len, pid;
+
+ if (strncmp(Port, "/dev/", 5) == 0) {
+ port = strdup(Port + 5);
+ } else {
+ port = strdup(Port);
+ }
+
+ while ((p = strchr(port, '/')) != NULL) {
+ *p = '_';
+ }
+
+ qprintf(lockfile, sizeof(lockfile), LOCK, port);
+ qprintf(tempfile, sizeof(tempfile), LOCK, "TMP.XXXXXX");
+
+ free(port);
+
+ if ((fd = mkstemp(tempfile)) == -1) {
+ error("mkstemp(%s) failed: %s", tempfile, strerror(errno));
+ return -1;
+ }
+
+ if (fchmod(fd, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH) == -1) {
+ error("fchmod(%s) failed: %s", tempfile, strerror(errno));
+ close(fd);
+ unlink(tempfile);
+ return -1;
+ }
+
+ snprintf(buffer, sizeof(buffer), "%10d\n", (int) getpid());
+ len = strlen(buffer);
+ if (write(fd, buffer, len) != len) {
+ error("write(%s) failed: %s", tempfile, strerror(errno));
+ close(fd);
+ unlink(tempfile);
+ return -1;
+ }
+ close(fd);
+
+
+ while (link(tempfile, lockfile) == -1) {
+
+ if (errno != EEXIST) {
+ error("link(%s, %s) failed: %s", tempfile, lockfile, strerror(errno));
+ unlink(tempfile);
+ return -1;
+ }
+
+ if ((fd = open(lockfile, O_RDONLY)) == -1) {
+ if (errno == ENOENT)
+ continue; /* lockfile disappared */
+ error("open(%s) failed: %s", lockfile, strerror(errno));
+ unlink(tempfile);
+ return -1;
+ }
+
+ len = read(fd, buffer, sizeof(buffer) - 1);
+ if (len < 0) {
+ error("read(%s) failed: %s", lockfile, strerror(errno));
+ unlink(tempfile);
+ return -1;
+ }
+
+ buffer[len] = '\0';
+ if (sscanf(buffer, "%d", &pid) != 1 || pid == 0) {
+ error("scan(%s) failed.", lockfile);
+ unlink(tempfile);
+ return -1;
+ }
+
+ if (pid == getpid()) {
+ error("%s already locked by us. uh-oh...", lockfile);
+ unlink(tempfile);
+ return 0;
+ }
+
+ if ((kill(pid, 0) == -1) && errno == ESRCH) {
+ error("removing stale lockfile %s", lockfile);
+ if (unlink(lockfile) == -1 && errno != ENOENT) {
+ error("unlink(%s) failed: %s", lockfile, strerror(errno));
+ unlink(tempfile);
+ return pid;
+ }
+ continue;
+ }
+ unlink(tempfile);
+ return pid;
+ }
+
+ unlink(tempfile);
+ return 0;
+}
+
+
+static pid_t drv_generic_serial_unlock_port(const char *Port)
+{
+ char lockfile[256];
+ char *port, *p;
+
+ if (strncmp(Port, "/dev/", 5) == 0) {
+ port = strdup(Port + 5);
+ } else {
+ port = strdup(Port);
+ }
+
+ while ((p = strchr(port, '/')) != NULL) {
+ *p = '_';
+ }
+
+ qprintf(lockfile, sizeof(lockfile), LOCK, port);
+ unlink(lockfile);
+ free(port);
+
+ return 0;
+}
+
+int drv_generic_serial_open_handshake(const char *section, const char *driver, const unsigned int flags)
+{
+ int fd;
+ struct termios portset;
+ struct serial_struct serinfo;
+ fd = drv_generic_serial_open(section, driver, flags); /* Open the Port with the original function */
+
+ /* We activate the Usage of the Handshake Pins */
+ tcgetattr(fd, &portset); /* Get Port Attributes */
+ portset.c_cflag |= CRTSCTS; /* Set Handshake */
+ tcsetattr(fd, TCSANOW, &portset); /* Set Port Attrributes */
+
+ /* This sets the UART-Type to the simplest one: 8250. No Fifos or other Features */
+ /* Fifo destroys Handshake so needs to be disabled */
+ ioctl(fd, TIOCGSERIAL, &serinfo); /* Get Serial Info */
+ serinfo.type = PORT_8250; /* Set to super-simple Port Type */
+ ioctl(fd, TIOCSSERIAL, &serinfo); /* Write Back modified Info */
+ return fd;
+}
+
+int drv_generic_serial_open(const char *section, const char *driver, const unsigned int flags)
+{
+ int i, fd;
+ pid_t pid;
+ struct termios portset;
+
+ Section = (char *) section;
+ Driver = (char *) driver;
+
+ Port = cfg_get(section, "Port", NULL);
+ if (Port == NULL || *Port == '\0') {
+ error("%s: no '%s.Port' entry from %s", Driver, section, cfg_source());
+ return -1;
+ }
+
+ if (cfg_number(section, "Speed", 19200, 1200, 230400, &i) < 0)
+ return -1;
+ switch (i) {
+ case 1200:
+ Speed = B1200;
+ break;
+ case 2400:
+ Speed = B2400;
+ break;
+ case 4800:
+ Speed = B4800;
+ break;
+ case 9600:
+ Speed = B9600;
+ break;
+ case 19200:
+ Speed = B19200;
+ break;
+ case 38400:
+ Speed = B38400;
+ break;
+ case 57600:
+ Speed = B57600;
+ break;
+ case 115200:
+ Speed = B115200;
+ break;
+#ifdef B230400
+ case 230400:
+ Speed = B230400;
+ break;
+#endif
+ default:
+ error("%s: unsupported speed '%d' from %s", Driver, i, cfg_source());
+ return -1;
+ }
+
+ info("%s: using port '%s' at %d baud", Driver, Port, i);
+
+ if ((pid = drv_generic_serial_lock_port(Port)) != 0) {
+ if (pid == -1)
+ error("%s: port %s could not be locked", Driver, Port);
+ else
+ error("%s: port %s is locked by process %d", Driver, Port, pid);
+ return -1;
+ }
+
+ fd = open(Port, O_RDWR | O_NOCTTY | O_NDELAY);
+ if (fd == -1) {
+ error("%s: open(%s) failed: %s", Driver, Port, strerror(errno));
+ drv_generic_serial_unlock_port(Port);
+ return -1;
+ }
+
+ if (tcgetattr(fd, &portset) == -1) {
+ error("%s: tcgetattr(%s) failed: %s", Driver, Port, strerror(errno));
+ drv_generic_serial_unlock_port(Port);
+ return -1;
+ }
+
+ cfmakeraw(&portset);
+ portset.c_cflag |= flags;
+ cfsetispeed(&portset, Speed);
+ cfsetospeed(&portset, Speed);
+ if (tcsetattr(fd, TCSANOW, &portset) == -1) {
+ error("%s: tcsetattr(%s) failed: %s", Driver, Port, strerror(errno));
+ drv_generic_serial_unlock_port(Port);
+ return -1;
+ }
+
+ Device = fd;
+ return Device;
+}
+
+
+int drv_generic_serial_poll(char *string, const int len)
+{
+ int ret;
+ if (Device == -1)
+ return -1;
+ ret = read(Device, string, len);
+ if (ret < 0 && errno != EAGAIN) {
+ error("%s: read(%s) failed: %s", Driver, Port, strerror(errno));
+ }
+ return ret;
+}
+
+
+int drv_generic_serial_read(char *string, const int len)
+{
+ int count, run, ret;
+
+ count = len < 0 ? -len : len;
+
+ for (run = 0; run < 10; run++) {
+ ret = drv_generic_serial_poll(string, count);
+ if (ret >= 0 || errno != EAGAIN)
+ break;
+ info("%s: read(%s): EAGAIN", Driver, Port);
+ usleep(1000);
+ }
+
+ if (ret > 0 && ret != count && len > 0) {
+ error("%s: partial read(%s): len=%d ret=%d", Driver, Port, len, ret);
+ }
+
+ return ret;
+}
+
+void drv_generic_serial_write_rts(const char *string, const int len)
+{
+ int serial, p, tocnt;
+
+ for (p = 0; p < len; p++) { /* Send Byte-by-Byte checking RTS-Line */
+ /* Timeout is 500ms */
+ tocnt = 250; /* 250 * 2 */
+ ioctl(Device, TIOCMGET, &serial); /* Get status of Control Lines */
+ while (!(serial & TIOCM_RTS) && tocnt) { /* Wait until RTS is set or timeout */
+ tocnt--; /* decrease timeout counter */
+ usleep(2000); /* Wait two milliseconds */
+ ioctl(Device, TIOCMGET, &serial);
+ }
+ drv_generic_serial_write(&string[p], 1); /* Actually send one byte */
+ }
+}
+
+void drv_generic_serial_write(const char *string, const int len)
+{
+ static int error = 0;
+ int run, ret;
+
+ if (Device == -1) {
+ error("%s: write to closed port %s failed!", Driver, Port);
+ return;
+ }
+
+ for (run = 0; run < 10; run++) {
+ ret = write(Device, string, len);
+ if (ret >= 0 || errno != EAGAIN) {
+ break;
+ }
+ /* EAGAIN: retry 10 times, emit message after 2nd retry */
+ if (run > 0) {
+ info("%s: write(%s): EAGAIN #%d", Driver, Port, run);
+ }
+ usleep(1000);
+ }
+
+ if (ret < 0) {
+ error("%s: write(%s) failed: %s", Driver, Port, strerror(errno));
+ if (++error > 10) {
+ error("%s: too much errors, giving up", Driver);
+ got_signal = -1;
+ }
+ } else if (ret != len) {
+ error("%s: partial write(%s): len=%d ret=%d", Driver, Port, len, ret);
+ } else {
+ error = 0;
+ }
+ return;
+}
+
+
+int drv_generic_serial_close(void)
+{
+ info("%s: closing port %s", Driver, Port);
+ close(Device);
+ drv_generic_serial_unlock_port(Port);
+ free(Port);
+ return 0;
+}
diff --git a/drv_generic_serial.h b/drv_generic_serial.h
new file mode 100644
index 0000000..7ac3dde
--- /dev/null
+++ b/drv_generic_serial.h
@@ -0,0 +1,39 @@
+/* $Id: drv_generic_serial.h 1188 2012-05-12 13:24:40Z jmccrohan $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/drv_generic_serial.h $
+ *
+ * generic driver helper for serial and usbserial displays
+ *
+ * Copyright (C) 1999, 2000 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+
+#ifndef _DRV_GENERIC_SERIAL_H_
+#define _DRV_GENERIC_SERIAL_H_
+
+int drv_generic_serial_open(const char *section, const char *driver, const unsigned int flags);
+int drv_generic_serial_open_handshake(const char *section, const char *driver, const unsigned int flags);
+int drv_generic_serial_poll(char *string, const int len);
+int drv_generic_serial_read(char *string, const int len);
+void drv_generic_serial_write(const char *string, const int len);
+void drv_generic_serial_write_rts(const char *string, const int len);
+int drv_generic_serial_close(void);
+
+#endif
diff --git a/drv_generic_text.c b/drv_generic_text.c
new file mode 100644
index 0000000..b216be8
--- /dev/null
+++ b/drv_generic_text.c
@@ -0,0 +1,1001 @@
+/* $Id: drv_generic_text.c 840 2007-09-09 12:17:42Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/drv_generic_text.c $
+ *
+ * generic driver helper for text-based displays
+ *
+ * Copyright (C) 1999, 2000 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ *
+ * exported variables:
+ *
+ * extern int CHARS, CHAR0; number of user-defineable characters, ASCII of first char
+ * extern int ICONS; number of user-defineable characters reserved for icons
+ * extern int GOTO_COST; number of bytes a goto command requires
+ * extern int INVALIDATE; re-send a modified userdefined char?
+ *
+ *
+ * these functions must be implemented by the real driver:
+ *
+ * void (*drv_generic_text_real_write)(int row, int col, unsigned char *data, int len);
+ * writes a text of specified length at position (row, col)
+ *
+ * void (*drv_generic_text_real_defchar)(int ascii, unsigned char *buffer);
+ * defines the bitmap of a user-defined character
+ *
+ *
+ * exported fuctions:
+ *
+ * int drv_generic_text_init (char *section, char *driver);
+ * initializes the generic text driver
+ *
+ * int drv_generic_text_draw (WIDGET *W);
+ * renders Text widget into framebuffer
+ * calls drv_generic_text_real_write()
+ *
+ * int drv_generic_text_icon_init (void);
+ * initializes the generic icon driver
+ *
+ * int drv_generic_text_icon_draw (WIDGET *W);
+ * renders Icon widget into framebuffer
+ * calls drv_generic_text_real_write() and drv_generic_text_real_defchar()
+ *
+ * int drv_generic_text_bar_init (int single_segments);
+ * initializes the generic icon driver
+ *
+ * void drv_generic_text_bar_add_segment (int val1, int val2, DIRECTION dir, int ascii);
+ * adds a 'fixed' character to the bar-renderer
+ *
+ * int drv_generic_text_bar_draw (WIDGET *W);
+ * renders Bar widget into framebuffer
+ * calls drv_generic_text_real_write() and drv_generic_text_real_defchar()
+ *
+ * int drv_generic_text_quit (void);
+ * closes the generic text driver
+ *
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <unistd.h>
+#include <termios.h>
+#include <fcntl.h>
+
+#include "debug.h"
+#include "cfg.h"
+#include "plugin.h"
+#include "widget.h"
+#include "widget_text.h"
+#include "widget_icon.h"
+#include "widget_bar.h"
+#include "drv.h"
+#include "drv_generic.h"
+#include "drv_generic_text.h"
+
+#ifdef WITH_DMALLOC
+#include <dmalloc.h>
+#endif
+
+
+typedef struct {
+ int val1;
+ int val2;
+ DIRECTION dir;
+ STYLE style;
+ int segment;
+ int invalid;
+} BAR;
+
+typedef struct {
+ int val1;
+ int val2;
+ DIRECTION dir;
+ STYLE style;
+ int used;
+ int ascii;
+} SEGMENT;
+
+static char *Section = NULL;
+static char *Driver = NULL;
+
+int CHARS = 0; /* number of user-defineable characters */
+int CHAR0 = 0; /* ASCII of first user-defineable char */
+int ICONS = 0; /* number of user-defineable characters reserved for icons */
+
+int GOTO_COST = 0; /* number of bytes a goto command requires */
+int INVALIDATE = 0; /* re-send a modified userdefined char? */
+
+
+void (*drv_generic_text_real_write) () = NULL;
+void (*drv_generic_text_real_defchar) () = NULL;
+
+
+static char *LayoutFB = NULL;
+static char *DisplayFB = NULL;
+static int *L2D = NULL;
+
+static int Single_Segments = 0;
+
+static int nSegment = 0;
+static int fSegment = 0;
+static SEGMENT Segment[128];
+static BAR *BarFB = NULL;
+
+
+/****************************************/
+/*** generic Framebuffer stuff ***/
+/****************************************/
+
+static void drv_generic_text_resizeFB(int rows, int cols)
+{
+ char *newFB;
+ int *newL2D;
+ BAR *newBar;
+ int i, row, col;
+
+ /* Layout FB is large enough */
+ if (rows <= LROWS && cols <= LCOLS)
+ return;
+
+ /* get maximum values */
+ if (rows < LROWS)
+ rows = LROWS;
+ if (cols < LCOLS)
+ cols = LCOLS;
+
+ /* allocate new Layout FB */
+ newFB = malloc(cols * rows * sizeof(*newFB));
+ memset(newFB, ' ', rows * cols * sizeof(*newFB));
+
+ /* transfer contents */
+ if (LayoutFB != NULL) {
+ for (row = 0; row < LROWS; row++) {
+ for (col = 0; col < LCOLS; col++) {
+ newFB[row * cols + col] = LayoutFB[row * LCOLS + col];
+ }
+ }
+ free(LayoutFB);
+ }
+ LayoutFB = newFB;
+
+ /* allocate new transformer */
+ newL2D = malloc(cols * rows * sizeof(*newL2D));
+
+ /* intitialize translator */
+ for (row = 0; row < rows; row++) {
+ for (col = 0; col < cols; col++) {
+ newL2D[row * cols + col] = row * DCOLS + col;
+ }
+ }
+
+ /* transfer transformer */
+ if (L2D != NULL) {
+ for (row = 0; row < LROWS; row++) {
+ for (col = 0; col < LCOLS; col++) {
+ newL2D[row * cols + col] = L2D[row * LCOLS + col];
+ }
+ }
+ free(L2D);
+ }
+ L2D = newL2D;
+
+ /* resize Bar buffer */
+ if (BarFB) {
+
+ newBar = malloc(rows * cols * sizeof(BAR));
+
+ for (i = 0; i < rows * cols; i++) {
+ newBar[i].val1 = -1;
+ newBar[i].val2 = -1;
+ newBar[i].dir = 0;
+ newBar[i].segment = -1;
+ newBar[i].invalid = 0;
+ }
+
+ /* transfer contents */
+ for (row = 0; row < LROWS; row++) {
+ for (col = 0; col < LCOLS; col++) {
+ newBar[row * cols + col] = BarFB[row * LCOLS + col];
+ }
+ }
+
+ free(BarFB);
+ BarFB = newBar;
+ }
+
+ LCOLS = cols;
+ LROWS = rows;
+}
+
+
+static void drv_generic_text_blit(const int row, const int col, const int height, const int width)
+{
+ int lr, lc; /* layout row/col */
+ int dr, dc; /* display row/col */
+ int p1, p2; /* start/end positon of changed area */
+ int eq; /* counter for equal contents */
+
+ /* loop over layout rows */
+ for (lr = row; lr < LROWS && lr < row + height; lr++) {
+ /* transform layout to display row */
+ dr = lr;
+ /* sanity check */
+ if (dr < 0 || dr >= DROWS)
+ continue;
+ /* loop over layout cols */
+ for (lc = col; lc < LCOLS && lc < col + width; lc++) {
+ /* transform layout to display column */
+ dc = lc;
+ /* sanity check */
+ if (dc < 0 || dc >= DCOLS)
+ continue;
+ /* find start of difference */
+ if (DisplayFB[dr * DCOLS + dc] == LayoutFB[lr * LCOLS + lc])
+ continue;
+ /* find end of difference */
+ for (p1 = dc, p2 = p1, eq = 0, lc++; lc < LCOLS && lc < col + width; lc++) {
+ /* transform layout to display column */
+ dc = lc;
+ /* sanity check */
+ if (dc < 0 || dc >= DCOLS)
+ continue;
+ if (DisplayFB[dr * DCOLS + dc] == LayoutFB[lr * LCOLS + lc]) {
+ if (++eq > GOTO_COST)
+ break;
+ } else {
+ p2 = dc;
+ eq = 0;
+ }
+ }
+ /* send to display */
+ memcpy(DisplayFB + dr * DCOLS + p1, LayoutFB + lr * LCOLS + p1, p2 - p1 + 1);
+ if (drv_generic_text_real_write)
+ drv_generic_text_real_write(dr, p1, DisplayFB + dr * DCOLS + p1, p2 - p1 + 1);
+ }
+ }
+}
+
+
+/****************************************/
+/*** generic text handling ***/
+/****************************************/
+
+int drv_generic_text_init(const char *section, const char *driver)
+{
+
+ Section = (char *) section;
+ Driver = (char *) driver;
+
+ /* init display framebuffer */
+ DisplayFB = (char *) malloc(DCOLS * DROWS * sizeof(*DisplayFB));
+ memset(DisplayFB, ' ', DROWS * DCOLS * sizeof(*DisplayFB));
+
+ /* init layout framebuffer */
+ LROWS = 0;
+ LCOLS = 0;
+ LayoutFB = NULL;
+ L2D = NULL;
+ drv_generic_text_resizeFB(DROWS, DCOLS);
+
+ /* sanity check */
+ if (DisplayFB == NULL || LayoutFB == NULL || L2D == NULL) {
+ error("%s: framebuffer could not be allocated: malloc() failed", Driver);
+ return -1;
+ }
+
+ /* init generic driver & register plugins */
+ drv_generic_blit = drv_generic_text_blit;
+ drv_generic_init();
+
+ return 0;
+}
+
+
+/* say hello to the user */
+int drv_generic_text_greet(const char *msg1, const char *msg2)
+{
+ int i;
+ int flag = 0;
+
+ char *line1[] = { "* LCD4Linux " VERSION " *",
+ "LCD4Linux " VERSION,
+ "* LCD4Linux *",
+ "LCD4Linux",
+ "L4Linux",
+ NULL
+ };
+
+ char *line2[] = { "http://lcd4linux.bulix.org",
+ "lcd4linux.bulix.org",
+ NULL
+ };
+
+
+ for (i = 0; line1[i]; i++) {
+ if (strlen(line1[i]) <= (unsigned) DCOLS) {
+ if (drv_generic_text_real_write)
+ drv_generic_text_real_write(0, (DCOLS - strlen(line1[i])) / 2, line1[i], strlen(line1[i]));
+ flag = 1;
+ break;
+ }
+ }
+
+ if (DROWS >= 2) {
+ for (i = 0; line2[i]; i++) {
+ if (strlen(line2[i]) <= (unsigned) DCOLS) {
+ if (drv_generic_text_real_write)
+ drv_generic_text_real_write(1, (DCOLS - strlen(line2[i])) / 2, line2[i], strlen(line2[i]));
+ flag = 1;
+ break;
+ }
+ }
+ }
+
+ if (msg1 && DROWS >= 3) {
+ int len = strlen(msg1);
+ if (len <= DCOLS) {
+ if (drv_generic_text_real_write)
+ drv_generic_text_real_write(2, (DCOLS - len) / 2, msg1, len);
+ flag = 1;
+ }
+ }
+
+ if (msg2 && DROWS >= 4) {
+ int len = strlen(msg2);
+ if (len <= DCOLS) {
+ if (drv_generic_text_real_write)
+ drv_generic_text_real_write(3, (DCOLS - len) / 2, msg2, len);
+ flag = 1;
+ }
+ }
+
+ return flag;
+}
+
+
+int drv_generic_text_draw(WIDGET * W)
+{
+ WIDGET_TEXT *Text = W->data;
+ char *txt;
+ int row, col, len;
+
+ row = W->row;
+ col = W->col;
+ txt = Text->buffer;
+ len = strlen(txt);
+
+ /* maybe grow layout framebuffer */
+ drv_generic_text_resizeFB(row + 1, col + len);
+
+ /* transfer new text into layout buffer */
+ memcpy(LayoutFB + row * LCOLS + col, txt, len);
+
+ /* blit it */
+ drv_generic_text_blit(row, col, 1, len);
+
+ return 0;
+}
+
+
+int drv_generic_text_quit(void)
+{
+
+ if (DisplayFB) {
+ free(DisplayFB);
+ DisplayFB = NULL;
+ }
+
+ if (LayoutFB) {
+ free(LayoutFB);
+ LayoutFB = NULL;
+ }
+
+ if (L2D) {
+ free(L2D);
+ L2D = NULL;
+ }
+
+ if (BarFB) {
+ free(BarFB);
+ BarFB = NULL;
+ }
+
+ widget_unregister();
+
+ return (0);
+}
+
+
+/****************************************/
+/*** generic icon handling ***/
+/****************************************/
+
+int drv_generic_text_icon_init(void)
+{
+ if (cfg_number(Section, "Icons", 0, 0, CHARS, &ICONS) < 0)
+ return -1;
+ if (ICONS > 0) {
+ info("%s: reserving %d of %d user-defined characters for icons", Driver, ICONS, CHARS);
+ }
+ return 0;
+}
+
+
+int drv_generic_text_icon_draw(WIDGET * W)
+{
+ static int icon_counter = 0;
+ WIDGET_ICON *Icon = W->data;
+ int row, col;
+ int visible;
+ int invalidate = 0;
+ unsigned char ascii;
+
+ row = W->row;
+ col = W->col;
+
+ /* maybe grow layout framebuffer */
+ drv_generic_text_resizeFB(row + 1, col + 1);
+
+ /* icon deactivated? */
+ if (Icon->ascii == -2)
+ return 0;
+
+ /* ASCII already assigned? */
+ if (Icon->ascii == -1) {
+ if (icon_counter >= ICONS) {
+ error("cannot process icon '%s': out of icons", W->name);
+ Icon->ascii = -2;
+ return -1;
+ }
+ icon_counter++;
+ Icon->ascii = CHAR0 + CHARS - icon_counter;
+ }
+
+ /* Icon visible? */
+ visible = P2N(&Icon->visible) > 0;
+
+ /* maybe redefine icon */
+ if (Icon->curmap != Icon->prvmap && visible) {
+ Icon->prvmap = Icon->curmap;
+ if (drv_generic_text_real_defchar)
+ drv_generic_text_real_defchar(Icon->ascii, Icon->bitmap + YRES * Icon->curmap);
+ invalidate = INVALIDATE;
+ }
+
+ /* use blank if invisible */
+ ascii = visible ? Icon->ascii : ' ';
+
+ /* transfer icon into layout buffer */
+ LayoutFB[row * LCOLS + col] = ascii;
+
+ /* ugly invalidation: change display FB to a wrong value so blit() will really send it */
+ if (invalidate) {
+ DisplayFB[row * DCOLS + col] = ~ascii;
+ }
+
+ /* blit it */
+ drv_generic_text_blit(row, col, 1, 1);
+
+ return 0;
+
+}
+
+
+/****************************************/
+/*** generic bar handling ***/
+/****************************************/
+
+static void drv_generic_text_bar_clear(void)
+{
+ int i;
+
+ for (i = 0; i < LROWS * LCOLS; i++) {
+ BarFB[i].val1 = -1;
+ BarFB[i].val2 = -1;
+ BarFB[i].dir = 0;
+ BarFB[i].style = 0;
+ BarFB[i].segment = -1;
+ BarFB[i].invalid = 0;
+ }
+
+ for (i = 0; i < nSegment; i++) {
+ Segment[i].used = 0;
+ }
+}
+
+
+int drv_generic_text_bar_init(const int single_segments)
+{
+ if (BarFB)
+ free(BarFB);
+
+ if ((BarFB = malloc(LROWS * LCOLS * sizeof(BAR))) == NULL) {
+ error("bar buffer allocation failed: out of memory");
+ return -1;
+ }
+
+ Single_Segments = single_segments;
+
+ nSegment = 0;
+ fSegment = 0;
+
+ drv_generic_text_bar_clear();
+
+ return 0;
+}
+
+
+void drv_generic_text_bar_add_segment(const int val1, const int val2, const DIRECTION dir, const int ascii)
+{
+ Segment[fSegment].val1 = val1;
+ Segment[fSegment].val2 = val2;
+ Segment[fSegment].dir = dir;
+ if (val1 == 0 && val2 == 0)
+ Segment[fSegment].style = 0;
+ else
+ Segment[fSegment].style = 255;
+ Segment[fSegment].used = 0;
+ Segment[fSegment].ascii = ascii;
+
+ fSegment++;
+ nSegment = fSegment;
+}
+
+
+static void drv_generic_text_bar_create_bar(int row, int col, const DIRECTION dir, STYLE style, int len, int val1,
+ int val2)
+{
+ int rev = 0, max;
+ if (style)
+ BarFB[row * LCOLS + col].style = STYLE_FIRST;
+
+ switch (dir) {
+ case DIR_WEST:
+ max = len * XRES;
+ val1 = max - val1;
+ val2 = max - val2;
+ rev = 1;
+
+ case DIR_EAST:
+ while (len > 0 && col < LCOLS) {
+ BarFB[row * LCOLS + col].dir = dir;
+ BarFB[row * LCOLS + col].segment = -1;
+ if (style && BarFB[row * LCOLS + col].style == 0)
+ BarFB[row * LCOLS + col].style = style;
+ if (val1 >= XRES) {
+ BarFB[row * LCOLS + col].val1 = rev ? 0 : XRES;
+ val1 -= XRES;
+ } else {
+ BarFB[row * LCOLS + col].val1 = rev ? XRES - val1 : val1;
+ val1 = 0;
+ }
+ if (val2 >= XRES) {
+ BarFB[row * LCOLS + col].val2 = rev ? 0 : XRES;
+ val2 -= XRES;
+ } else {
+ BarFB[row * LCOLS + col].val2 = rev ? XRES - val2 : val2;
+ val2 = 0;
+ }
+ len--;
+ col++;
+ }
+ if (style)
+ BarFB[row * LCOLS + col - 1].style = STYLE_LAST;
+ break;
+
+ case DIR_NORTH:
+ max = len * YRES;
+ val1 = max - val1;
+ val2 = max - val2;
+ rev = 1;
+
+ case DIR_SOUTH:
+ while (len > 0 && row < LROWS) {
+ BarFB[row * LCOLS + col].dir = dir;
+ BarFB[row * LCOLS + col].segment = -1;
+ if (val1 >= YRES) {
+ BarFB[row * LCOLS + col].val1 = rev ? 0 : YRES;
+ val1 -= YRES;
+ } else {
+ BarFB[row * LCOLS + col].val1 = rev ? YRES - val1 : val1;
+ val1 = 0;
+ }
+ if (val2 >= YRES) {
+ BarFB[row * LCOLS + col].val2 = rev ? 0 : YRES;
+ val2 -= YRES;
+ } else {
+ BarFB[row * LCOLS + col].val2 = rev ? YRES - val2 : val2;
+ val2 = 0;
+ }
+ len--;
+ row++;
+ }
+ break;
+ }
+}
+
+
+static void drv_generic_text_bar_create_segments(void)
+{
+ int i, j, n;
+ int res, l1, l2;
+
+ /* find first unused segment */
+ for (i = fSegment; i < nSegment && Segment[i].used; i++);
+
+ /* pack unused segments */
+ for (j = i + 1; j < nSegment; j++) {
+ if (Segment[j].used)
+ Segment[i++] = Segment[j];
+ }
+ nSegment = i;
+
+ /* create needed segments */
+ for (n = 0; n < LROWS * LCOLS; n++) {
+ if (BarFB[n].dir == 0)
+ continue;
+ res = BarFB[n].dir & (DIR_EAST | DIR_WEST) ? XRES : YRES;
+ for (i = 0; i < nSegment; i++) {
+ l1 = Segment[i].val1;
+ if (l1 > res)
+ l1 = res;
+ l2 = Segment[i].val2;
+ if (l2 > res)
+ l2 = res;
+
+ /* same value */
+ if (l1 == BarFB[n].val1 && l2 == BarFB[n].val2) {
+ /* empty block, only style is interesting */
+ if (l1 == 0 && l2 == 0 && Segment[i].style == BarFB[n].style)
+ break;
+ /* full block, style doesn't matter */
+ if (l1 == res && l2 == res)
+ break;
+ /* half upper block */
+ if (l1 == res && l2 == 0 && Segment[i].style == BarFB[n].style)
+ break;
+ /* half lower block */
+ if (l1 == 0 && l2 == res && Segment[i].style == BarFB[n].style)
+ break;
+ /* same style, same direction */
+ if (Segment[i].style == BarFB[n].style && Segment[i].dir & BarFB[n].dir)
+ break;
+#if 0
+ /* hollow style, val(1,2) == 1, like '[' */
+ if (l1 == 1 && l2 == 1 && Segment[i].style == STYLE_FIRST && BarFB[n].style == STYLE_HOLLOW)
+ break;
+ /* hollow style, val(1,2) == 1, like ']' */
+ if (l1 == 1 && l2 == 1 && Segment[i].style == STYLE_LAST && BarFB[n].style == STYLE_HOLLOW)
+ break;
+#endif
+ }
+ }
+ if (i == nSegment) {
+ nSegment++;
+ Segment[i].val1 = BarFB[n].val1;
+ Segment[i].val2 = BarFB[n].val2;
+ Segment[i].dir = BarFB[n].dir;
+ Segment[i].style = BarFB[n].style;
+ Segment[i].used = 0;
+ Segment[i].ascii = -1;
+ }
+ BarFB[n].segment = i;
+ }
+}
+
+
+static int drv_generic_text_bar_segment_error(const int i, const int j)
+{
+ int res;
+ int i1, i2, j1, j2;
+
+ if (i == j)
+ return 65535;
+ if (!(Segment[i].dir & Segment[j].dir))
+ return 65535;
+ if (Segment[i].style != Segment[j].style)
+ return 65535;
+
+ res = Segment[i].dir & (DIR_EAST | DIR_WEST) ? XRES : YRES;
+
+ i1 = Segment[i].val1;
+ if (i1 > res)
+ i1 = res;
+ i2 = Segment[i].val2;
+ if (i2 > res)
+ i2 = res;
+ j1 = Segment[j].val1;
+ if (j1 > res)
+ j1 = res;
+ j2 = Segment[j].val2;
+ if (j2 > res)
+ j2 = res;
+
+ /* do not replace empty with non-empty */
+ if (i1 == 0 && j1 != 0)
+ return 65535;
+ if (i2 == 0 && j2 != 0)
+ return 65535;
+
+ /* do not replace full with non-full */
+ if (i1 == res && j1 < res)
+ return 65535;
+ if (i2 == res && j2 < res)
+ return 65535;
+
+ /* do not replace start line */
+ /* but only if there are at least some chars available */
+ if (CHARS - ICONS > 0) {
+ if (i1 == 1 && j1 != 1 && i2 > 0)
+ return 65535;
+ if (i2 == 1 && j2 != 1 && j1 > 0)
+ return 65535;
+ }
+
+ /* do not replace equal length with non-equal length */
+ if (i1 == i2 && j1 != j2)
+ return 65535;
+
+ return (i1 - j1) * (i1 - j1) + (i2 - j2) * (i2 - j2);
+}
+
+
+static void drv_generic_text_bar_pack_segments(void)
+{
+ int i, j, n, min;
+ int pack_i, pack_j;
+ int pass1 = 1;
+ int error[nSegment][nSegment];
+
+ if (nSegment <= fSegment + CHARS - ICONS) {
+ return;
+ }
+
+ for (i = 0; i < nSegment; i++) {
+ for (j = 0; j < nSegment; j++) {
+ error[i][j] = drv_generic_text_bar_segment_error(i, j);
+ /* debug ("[%d][%d] = %d", i, j, error[i][j]); */
+ }
+ }
+
+ while (nSegment > fSegment + CHARS - ICONS) {
+
+ min = 65535;
+ pack_i = -1;
+ pack_j = -1;
+ for (i = fSegment; i < nSegment; i++) {
+ if (pass1 && Segment[i].used)
+ continue;
+ for (j = 0; j < nSegment; j++) {
+ if (error[i][j] < min) {
+ min = error[i][j];
+ pack_i = i;
+ pack_j = j;
+ }
+ }
+ }
+ if (pack_i == -1) {
+ if (pass1) {
+ pass1 = 0;
+ continue;
+ } else {
+ error("unable to compact bar characters");
+ error("nSegment=%d fSegment=%d CHARS=%d ICONS=%d", nSegment, fSegment, CHARS, ICONS);
+ error("Segment[0].val1=%d val2=%d", Segment[0].val1, Segment[0].val2);
+ error("Segment[1].val1=%d val2=%d", Segment[1].val1, Segment[1].val2);
+ error("Segment[2].val1=%d val2=%d", Segment[2].val1, Segment[2].val2);
+ nSegment = CHARS - ICONS;
+ break;
+ }
+ }
+#if 0
+ debug("pack_segment: n=%d i=%d j=%d min=%d", nSegment, pack_i, pack_j, min);
+ debug("Pack_segment: i1=%d i2=%d j1=%d j2=%d\n", Segment[pack_i].val1, Segment[pack_i].val2,
+ Segment[pack_j].val1, Segment[pack_j].val2);
+#endif
+
+ nSegment--;
+ Segment[pack_i] = Segment[nSegment];
+
+ for (i = 0; i < nSegment; i++) {
+ error[pack_i][i] = error[nSegment][i];
+ error[i][pack_i] = error[i][nSegment];
+ }
+
+ for (n = 0; n < LROWS * LCOLS; n++) {
+ if (BarFB[n].segment == pack_i)
+ BarFB[n].segment = pack_j;
+ if (BarFB[n].segment == nSegment)
+ BarFB[n].segment = pack_i;
+ }
+ }
+}
+
+
+static void drv_generic_text_bar_define_chars(void)
+{
+ int c, i, j;
+ unsigned char buffer[8];
+
+ for (i = fSegment; i < nSegment; i++) {
+ if (Segment[i].used)
+ continue;
+ if (Segment[i].ascii != -1)
+ continue;
+ for (c = 0; c < CHARS - ICONS; c++) {
+ for (j = fSegment; j < nSegment; j++) {
+ if (Segment[j].ascii == c)
+ break;
+ }
+ if (j == nSegment)
+ break;
+ }
+ Segment[i].ascii = c;
+ switch (Segment[i].dir) {
+ case DIR_WEST:
+ if (Segment[i].style) {
+ buffer[0] = 255;
+ buffer[7] = 255;
+ if (Segment[i].style & (STYLE_FIRST | STYLE_LAST))
+ for (j = 1; j < 7; j++) {
+ buffer[j] |= Segment[i].style & STYLE_FIRST ? 16 : 1;
+ }
+ }
+ break;
+ case DIR_EAST:
+ for (j = 0; j < 4; j++) {
+ buffer[j] = 255 << (XRES - Segment[i].val1);
+ buffer[j + 4] = 255 << (XRES - Segment[i].val2);
+ }
+ if (Segment[i].style) {
+ buffer[0] = 255;
+ buffer[7] = 255;
+ if (Segment[i].style & (STYLE_FIRST | STYLE_LAST))
+ for (j = 1; j < 7; j++) {
+ buffer[j] |= Segment[i].style & STYLE_FIRST ? 16 : 1;
+ }
+ }
+ break;
+ case DIR_NORTH:
+ for (j = 0; j < Segment[i].val1; j++) {
+ buffer[7 - j] = (1 << XRES) - 1;
+ }
+ for (; j < YRES; j++) {
+ buffer[7 - j] = 0;
+ }
+ break;
+ case DIR_SOUTH:
+ for (j = 0; j < Segment[i].val1; j++) {
+ buffer[j] = (1 << XRES) - 1;
+ }
+ for (; j < YRES; j++) {
+ buffer[j] = 0;
+ }
+ break;
+ }
+ if (drv_generic_text_real_defchar)
+ drv_generic_text_real_defchar(CHAR0 + c, buffer);
+
+ /* maybe invalidate framebuffer */
+ if (INVALIDATE) {
+ for (j = 0; j < LROWS * LCOLS; j++) {
+ if (BarFB[j].segment == i) {
+ BarFB[j].invalid = 1;
+ }
+ }
+ }
+ }
+}
+
+
+int drv_generic_text_bar_draw(WIDGET * W)
+{
+ WIDGET_BAR *Bar = W->data;
+ int row, col, len, res, max, val1, val2;
+ int c, n, s;
+ DIRECTION dir;
+ STYLE style;
+
+ row = W->row;
+ col = W->col;
+ dir = Bar->direction;
+ style = Bar->style;
+ len = Bar->length;
+
+ /* maybe grow layout framebuffer */
+ /* bars *always* grow heading North or East! */
+ if (dir & (DIR_EAST | DIR_WEST)) {
+ drv_generic_text_resizeFB(row + 1, col + len);
+ } else {
+ drv_generic_text_resizeFB(row + 1, col + 1);
+ }
+
+ res = dir & (DIR_EAST | DIR_WEST) ? XRES : YRES;
+ max = len * res;
+ val1 = Bar->val1 * (double) (max);
+ val2 = Bar->val2 * (double) (max);
+
+ if (val1 < 1)
+ val1 = 1;
+ else if (val1 > max)
+ val1 = max;
+
+ if (val2 < 1)
+ val2 = 1;
+ else if (val2 > max)
+ val2 = max;
+
+ if (Single_Segments)
+ val2 = val1;
+
+ /* create this bar */
+ drv_generic_text_bar_create_bar(row, col, dir, style, len, val1, val2);
+
+ /* process all bars */
+ drv_generic_text_bar_create_segments();
+ drv_generic_text_bar_pack_segments();
+ drv_generic_text_bar_define_chars();
+
+ /* reset usage flags */
+ for (s = 0; s < nSegment; s++) {
+ Segment[s].used = 0;
+ }
+
+ /* set usage flags */
+ for (n = 0; n < LROWS * LCOLS; n++) {
+ if ((s = BarFB[n].segment) != -1)
+ Segment[s].used = 1;
+ }
+
+ /* transfer bars into layout buffer */
+ for (row = 0; row < LROWS; row++) {
+ for (col = 0; col < LCOLS; col++) {
+ n = row * LCOLS + col;
+ s = BarFB[n].segment;
+ if (s == -1)
+ continue;
+ c = Segment[s].ascii;
+ if (c == -1)
+ continue;
+ if (s >= fSegment)
+ c += CHAR0; /* ascii offset for user-defineable chars */
+ LayoutFB[n] = c;
+ /* maybe invalidate display framebuffer */
+ if (BarFB[n].invalid) {
+ BarFB[n].invalid = 0;
+ /* ugly invalidation: change display FB to a wrong value so blit() will really send it */
+ DisplayFB[row * DCOLS + col] = ~LayoutFB[n];
+ }
+ }
+ }
+
+ /* blit whole layout FB */
+ drv_generic_text_blit(0, 0, LROWS, LCOLS);
+
+
+ return 0;
+
+}
diff --git a/drv_generic_text.h b/drv_generic_text.h
new file mode 100644
index 0000000..86a1574
--- /dev/null
+++ b/drv_generic_text.h
@@ -0,0 +1,57 @@
+/* $Id: drv_generic_text.h 1164 2011-12-22 10:48:01Z mjona $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/drv_generic_text.h $
+ *
+ * generic driver helper for text-based displays
+ *
+ * Copyright (C) 1999, 2000 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+
+#ifndef _DRV_GENERIC_TEXT_H_
+#define _DRV_GENERIC_TEXT_H_
+
+
+#include "drv_generic.h"
+#include "widget.h"
+#include "widget_bar.h"
+
+extern int CHARS, CHAR0; /* number of user-defineable characters, ASCII of first char */
+extern int ICONS; /* number of user-defineable characters reserved for icons */
+extern int GOTO_COST; /* number of bytes a goto command requires */
+extern int INVALIDATE; /* re-send a modified userdefined char? */
+
+/* these functions must be implemented by the real driver */
+extern void (*drv_generic_text_real_write) (const int row, const int col, const char *data, const int len);
+extern void (*drv_generic_text_real_defchar) (const int ascii, const unsigned char *matrix);
+
+/* generic functions and widget callbacks */
+int drv_generic_text_init(const char *section, const char *driver);
+int drv_generic_text_greet(const char *msg1, const char *msg2);
+int drv_generic_text_draw(WIDGET * W);
+int drv_generic_text_icon_init(void);
+int drv_generic_text_icon_draw(WIDGET * W);
+int drv_generic_text_bar_init(const int single_segments);
+void drv_generic_text_bar_add_segment(const int val1, const int val2, const DIRECTION dir, const int ascii);
+int drv_generic_text_bar_draw(WIDGET * W);
+int drv_generic_text_quit(void);
+
+
+#endif
diff --git a/drv_mdm166a.c b/drv_mdm166a.c
new file mode 100644
index 0000000..6538ae3
--- /dev/null
+++ b/drv_mdm166a.c
@@ -0,0 +1,594 @@
+/* $Id$
+ * $URL$
+ *
+ * driver for Futaba MDM166A Graphic(96x16) vf-displays
+ *
+ * Copyright (C) 2005 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2005, 2006, 2007 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * Copyright (C) 2011 Andreas Brachold <anbr at users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ *
+ * exported fuctions:
+ *
+ * struct DRIVER drv_MDM166A
+ *
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+
+#include <libusb-1.0/libusb.h>
+
+#include "debug.h"
+#include "cfg.h"
+#include "qprintf.h"
+#include "plugin.h"
+#include "timer.h"
+#include "drv.h"
+#include "drv_generic_graphic.h"
+#include "drv_generic_gpio.h"
+
+// Values for transaction's data packet.
+static const int CONTROL_REQUEST_TYPE_OUT =
+ LIBUSB_ENDPOINT_OUT | LIBUSB_REQUEST_TYPE_CLASS | LIBUSB_RECIPIENT_INTERFACE;
+
+// From the HID spec:
+static const int HID_SET_REPORT = 0x09;
+static const int HID_REPORT_TYPE_OUTPUT = 0x02;
+
+static const int MAX_CONTROL_OUT_TRANSFER_SIZE = 62;
+
+static const int INTERFACE_NUMBER = 0;
+static const int TIMEOUT_MS = 5000;
+
+// Defines from display datasheet
+static const int VENDOR_ID = 0x019c2;
+static const int PRODUCT_ID = 0x06a11;
+
+static const unsigned char ICON_PLAY = 0x00; //Play
+static const unsigned char ICON_PAUSE = 0x01; //Pause
+static const unsigned char ICON_RECORD = 0x02; //Record
+static const unsigned char ICON_MESSAGE = 0x03; //Message symbol (without the inner @)
+static const unsigned char ICON_MSGAT = 0x04; //Message @
+static const unsigned char ICON_MUTE = 0x05; //Mute
+static const unsigned char ICON_WLAN1 = 0x06; //WLAN (tower base)
+static const unsigned char ICON_WLAN2 = 0x07; //WLAN strength (1 of 3)
+static const unsigned char ICON_WLAN3 = 0x08; //WLAN strength (2 of 3)
+static const unsigned char ICON_WLAN4 = 0x09; //WLAN strength (3 of 3)
+static const unsigned char ICON_VOLUME = 0x0A; //Volume (the word)
+static const unsigned char ICON_VOL1 = 0x0B; //Volume level 1 of 14
+static const unsigned char ICON_VOL2 = 0x0C; //Volume level 2 of 14
+static const unsigned char ICON_VOL3 = 0x0D; //Volume level 3 of 14
+static const unsigned char ICON_VOL4 = 0x0E; //Volume level 4 of 14
+static const unsigned char ICON_VOL5 = 0x0F; //Volume level 5 of 14
+static const unsigned char ICON_VOL6 = 0x10; //Volume level 6 of 14
+static const unsigned char ICON_VOL7 = 0x11; //Volume level 7 of 14
+static const unsigned char ICON_VOL8 = 0x12; //Volume level 8 of 14
+static const unsigned char ICON_VOL9 = 0x13; //Volume level 9 of 14
+static const unsigned char ICON_VOL10 = 0x14; //Volume level 10 of 14
+static const unsigned char ICON_VOL11 = 0x15; //Volume level 11 of 14
+static const unsigned char ICON_VOL12 = 0x16; //Volume level 12 of 14
+static const unsigned char ICON_VOL13 = 0x17; //Volume level 13 of 14
+static const unsigned char ICON_VOL14 = 0x18; //Volume level 14 of 14
+static const unsigned char ICON_LAST = 0x19; //Marker size of icon
+
+static const unsigned char STATE_OFF = 0x00; //Symbol off
+static const unsigned char STATE_ON = 0x01; //Symbol on
+static const unsigned char STATE_ONHIGH = 0x02; //Symbol on, high intensity, can only be used with the volume symbols
+
+static const unsigned char CMD_PREFIX = 0x1b;
+static const unsigned char CMD_SETCLOCK = 0x00; //Actualize the time of the display
+static const unsigned char CMD_SMALLCLOCK = 0x01; //Display small clock on display
+static const unsigned char CMD_BIGCLOCK = 0x02; //Display big clock on display
+static const unsigned char CMD_SETSYMBOL = 0x30; //Enable or disable symbol
+static const unsigned char CMD_SETDIMM = 0x40; //Set the dimming level of the display
+static const unsigned char CMD_RESET = 0x50; //Reset all configuration data to default and clear
+static const unsigned char CMD_SETRAM = 0x60; //Set the actual graphics RAM offset for next data write
+static const unsigned char CMD_SETPIXEL = 0x70; //Write pixel data to RAM of the display
+static const unsigned char CMD_TEST1 = 0xf0; //Show vertical test pattern
+static const unsigned char CMD_TEST2 = 0xf1; //Show horizontal test pattern
+
+static const unsigned char TIME_12 = 0x00; //12 hours format
+static const unsigned char TIME_24 = 0x01; //24 hours format
+
+static const unsigned char BRIGHT_OFF = 0x00; //Display off
+static const unsigned char BRIGHT_DIMM = 0x01; //Display dimmed
+
+static int nSizeYb = 2;
+static int SCREEN_H = 16;
+static int SCREEN_W = 96;
+static int NeedRefresh = 0;
+static int minX = 1;
+static int maxX = 0;
+static unsigned int lastIconState = 0;
+
+#if 1
+#define DEBUG(x) debug("%s(): %s", __FUNCTION__, x);
+#else
+#define DEBUG(x)
+#endif
+
+static char Name[] = "MDM166A";
+static unsigned char *mdm166a_framebuffer;
+
+/* used to display white text on black background or inverse */
+static unsigned char nDrawInverted = 1;
+
+static struct libusb_device_handle *devh = NULL;
+static int mdm166a_nQueue = 0;
+static unsigned char *mdm166a_Queue;
+static const int mdm166a_nQueueMax = 1024;
+
+
+static const char *usberror(int ret)
+{
+ switch (ret) {
+ case LIBUSB_SUCCESS:
+ return "Success (no error).";
+
+ case LIBUSB_ERROR_IO:
+ return "Input/output error.";
+
+ case LIBUSB_ERROR_INVALID_PARAM:
+ return "Invalid parameter.";
+
+ case LIBUSB_ERROR_ACCESS:
+ return "Access denied (insufficient permissions).";
+
+ case LIBUSB_ERROR_NO_DEVICE:
+ return "No such device (it may have been disconnected).";
+
+ case LIBUSB_ERROR_NOT_FOUND:
+ return "Entity not found.";
+
+ case LIBUSB_ERROR_BUSY:
+ return "Resource busy.";
+
+ case LIBUSB_ERROR_TIMEOUT:
+ return "Operation timed out.";
+
+ case LIBUSB_ERROR_OVERFLOW:
+ return "Overflow.";
+
+ case LIBUSB_ERROR_PIPE:
+ return "Pipe error.";
+
+ case LIBUSB_ERROR_INTERRUPTED:
+ return "System call interrupted (perhaps due to signal).";
+
+ case LIBUSB_ERROR_NO_MEM:
+ return "Insufficient memory.";
+
+ case LIBUSB_ERROR_NOT_SUPPORTED:
+ return "Operation not supported or unimplemented on this platform.";
+
+ case LIBUSB_ERROR_OTHER:
+ return "Other error. ";
+ }
+ return "unknown error";
+}
+
+/****************************************/
+/*** hardware dependant functions ***/
+/****************************************/
+
+static int drv_MDM166A_open(void)
+{
+ int result;
+ int ready = -1;
+
+ info("%s: scanning for display...", Name);
+
+ //Initialize libusb
+ result = libusb_init(NULL);
+ if (result >= 0) {
+ devh = libusb_open_device_with_vid_pid(NULL, VENDOR_ID, PRODUCT_ID);
+ if (devh != NULL) {
+ // a targavfd has been detected.
+ // Detach the hidusb driver from the HID to enable using libusb.
+ libusb_detach_kernel_driver(devh, INTERFACE_NUMBER);
+ {
+ result = libusb_claim_interface(devh, INTERFACE_NUMBER);
+ if (result >= 0) {
+ ready = 0;
+ } else {
+ error("%s: libusb_claim_interface error! %s (%d)", Name, usberror(result), result);
+ }
+ }
+ } else {
+ error("%s: Unable to find the device!", Name);
+ }
+ } else {
+ error("%s: Unable to initialize libusb! %s (%d)", Name, usberror(result), result);
+ }
+ if (ready != 0) {
+ if (devh)
+ libusb_release_interface(devh, 0);
+ devh = NULL;
+ }
+ return ready;
+}
+
+static int drv_MDM166A_close(void)
+{
+ if (devh != NULL) {
+ int result = libusb_release_interface(devh, 0);
+ if (result < 0) {
+ error("%s: libusb_release_interface failed! %s (%d)", Name, usberror(result), result);
+ }
+ libusb_close(devh);
+ devh = NULL;
+ }
+ // Deinitialize libusb
+ libusb_exit(NULL);
+
+ return 0;
+}
+
+static int drv_MDM166A_QueueFlush()
+{
+ int sent, i, frame;
+ unsigned char buf[MAX_CONTROL_OUT_TRANSFER_SIZE + 1];
+
+ int cnt = 0;
+ int length = mdm166a_nQueue;
+
+ while (length > 0) {
+
+ frame = (length > MAX_CONTROL_OUT_TRANSFER_SIZE ? MAX_CONTROL_OUT_TRANSFER_SIZE : length);
+ buf[0] = (unsigned char) frame;
+ for (i = 0; i < MAX_CONTROL_OUT_TRANSFER_SIZE && length > 0; ++i) {
+ buf[i + 1] = mdm166a_Queue[cnt++];
+ length--;
+ }
+ sent = libusb_control_transfer(devh,
+ CONTROL_REQUEST_TYPE_OUT,
+ HID_SET_REPORT,
+ (HID_REPORT_TYPE_OUTPUT << 8) | 0x00,
+ INTERFACE_NUMBER, buf, frame + 1, TIMEOUT_MS);
+ if (sent <= 0) {
+ error("%s: libusb_control_transfer failed : %s (%d)", Name, usberror(sent), sent);
+ mdm166a_nQueue = 0;
+ return -1;
+ }
+ }
+ mdm166a_nQueue = 0;
+ return 0;
+}
+
+
+static void drv_MDM166A_QueueCmd(unsigned char cmd)
+{
+
+ if (mdm166a_nQueue + 2 >= mdm166a_nQueueMax) {
+ drv_MDM166A_QueueFlush();
+ }
+ mdm166a_Queue[mdm166a_nQueue++] = CMD_PREFIX;
+ mdm166a_Queue[mdm166a_nQueue++] = cmd;
+}
+
+static void drv_MDM166A_QueueData(unsigned char data)
+{
+
+ if (mdm166a_nQueue + 1 >= mdm166a_nQueueMax) {
+ drv_MDM166A_QueueFlush();
+ }
+ mdm166a_Queue[mdm166a_nQueue++] = data;
+}
+
+/* for graphic displays only */
+static void drv_MDM166A_blit(const int row, const int col, const int height, const int width)
+{
+ int n, x, y, yb;
+ unsigned char c;
+
+ if (NeedRefresh == 0) {
+ minX = width;
+ maxX = 0;
+ }
+
+ for (y = row; y < row + height && y < SCREEN_H; ++y)
+ for (x = col; x < col + width && x < SCREEN_W; ++x) {
+ yb = (y / 8);
+ n = x + (yb * SCREEN_W);
+
+ c = *(mdm166a_framebuffer + n);
+ if (drv_generic_graphic_black(y, x) ^ nDrawInverted)
+ c |= 0x80 >> (y % 8);
+ else
+ c &= ~(0x80 >> (y % 8));
+
+ if (c != *(mdm166a_framebuffer + n)) {
+ *(mdm166a_framebuffer + n) = c;
+ minX = (minX < x) ? minX : x;
+ maxX = (maxX > (x + 1)) ? maxX : (x + 1);
+ NeedRefresh = 1;
+ }
+ }
+}
+
+static void drv_MDM166A_Flush()
+{
+
+ int n, x, yb;
+ if (NeedRefresh) {
+
+ maxX = (maxX < SCREEN_W) ? maxX : SCREEN_W;
+
+ unsigned int nData = (maxX - minX) * nSizeYb;
+ if (nData) {
+ // send data to display, controller
+ drv_MDM166A_QueueCmd(CMD_SETRAM);
+ drv_MDM166A_QueueData(minX * nSizeYb);
+ drv_MDM166A_QueueCmd(CMD_SETPIXEL);
+ drv_MDM166A_QueueData(nData);
+
+ for (x = minX; x < maxX; ++x)
+ for (yb = 0; yb < nSizeYb; ++yb) {
+ n = x + (yb * SCREEN_W);
+ drv_MDM166A_QueueData((*(mdm166a_framebuffer + n)));
+ }
+ }
+ drv_MDM166A_QueueFlush();
+ NeedRefresh = 0;
+ }
+}
+
+void drv_MDM166A_clear(void)
+{
+ debug("In %s", __FUNCTION__);
+
+ drv_MDM166A_QueueCmd(CMD_RESET);
+ drv_MDM166A_QueueFlush();
+}
+
+/**
+ * Sets the brightness of the display.
+ *
+ * \param nBrightness The value the brightness (0 = off
+ * 1 = half brightness; 2 = highest brightness).
+ */
+void drv_MDM166A_QueueBrightness(int nBrightness)
+{
+ if (nBrightness < 0) {
+ nBrightness = 0;
+ } else if (nBrightness > 2) {
+ nBrightness = 2;
+ }
+ drv_MDM166A_QueueCmd(CMD_SETDIMM);
+ drv_MDM166A_QueueData((unsigned char) (nBrightness));
+}
+
+static int drv_MDM166A_Brightness(int nBrightness)
+{
+ debug("In %s", __FUNCTION__);
+
+ int n = nBrightness;
+ if (n < 0) {
+ n = 0;
+ } else if (n > 2) {
+ n = 2;
+ }
+ drv_MDM166A_QueueBrightness(n);
+ drv_MDM166A_QueueFlush();
+
+ return n;
+}
+
+static void drv_MDM166A_icons(const int num, const int val)
+{
+ unsigned int state = lastIconState;
+ if (val > 0)
+ state |= 1 << num;
+ else
+ state &= ~(1 << num);
+
+ if (state != lastIconState) {
+ drv_MDM166A_QueueCmd(CMD_SETSYMBOL);
+ drv_MDM166A_QueueData(num);
+ drv_MDM166A_QueueData((val > 0) ? STATE_ON : STATE_OFF);
+ drv_MDM166A_QueueFlush();
+ }
+ lastIconState = state;
+}
+
+static int drv_MDM166A_start(const char *section, const int quiet)
+{
+ int value = 0;
+ char *s;
+
+ if (sscanf(s = cfg_get(section, "Size", "96x16"), "%dx%d", &SCREEN_W, &SCREEN_H) != 2 || SCREEN_W < 1
+ || SCREEN_H < 1) {
+ error("%s: bad %s.Size '%s' from %s", Name, section, s, cfg_source());
+ free(s);
+ return -1;
+ }
+ free(s);
+
+ if (sscanf(s = cfg_get(section, "Font", "6x8"), "%dx%d", &XRES, &YRES) != 2 || XRES < 1 || YRES < 1) {
+ error("%s: bad %s.Font '%s' from %s", Name, section, s, cfg_source());
+ free(s);
+ return -1;
+ }
+ free(s);
+
+ if (cfg_number(section, "Inverted", 0, 0, 1, &value) > 0) {
+ info("Setting display inverted to %d", value);
+ if (value > 0)
+ nDrawInverted = 1;
+ else
+ nDrawInverted = 0;
+ }
+
+ GPOS = ICON_LAST; /* Icons on display */
+ DROWS = SCREEN_H;
+ DCOLS = SCREEN_W;
+ nSizeYb = ((SCREEN_H + 7) / 8);
+
+ /* Init the command queue */
+ mdm166a_Queue = (unsigned char *) malloc(mdm166a_nQueueMax * sizeof(unsigned char));
+ if (mdm166a_Queue == NULL) {
+ error("%s: command queue could not be allocated: malloc() failed", Name);
+ return -1;
+ }
+
+ /* Init framebuffer buffer */
+ mdm166a_framebuffer = (unsigned char *) malloc(SCREEN_W * nSizeYb * sizeof(unsigned char));
+ if (!mdm166a_framebuffer)
+ return -1;
+
+ memset(mdm166a_framebuffer, 0, SCREEN_W * nSizeYb);
+ if (drv_MDM166A_open() < 0) {
+ return -1;
+ }
+
+ drv_MDM166A_clear(); /* clear display */
+
+ if (cfg_number(section, "Brightness", 1, 0, 2, &value) > 0) {
+ info("Setting brightness to %d", value);
+ drv_MDM166A_Brightness(value);
+ }
+
+ if (!quiet) {
+ char buffer[40];
+ qprintf(buffer, sizeof(buffer), "%s %dx%d", Name, SCREEN_W, SCREEN_H);
+ if (drv_generic_graphic_greet(buffer, NULL)) {
+ sleep(3);
+ drv_MDM166A_clear();
+ }
+ }
+
+ /* setup a timer that regularly redraws the display from the frame */
+ timer_add(drv_MDM166A_Flush, NULL, 250, 0);
+
+ return 0;
+}
+
+
+/****************************************/
+/*** plugins ***/
+/****************************************/
+
+static void plugin_brightness(RESULT * result, RESULT * arg1)
+{
+ double brightness;
+
+ brightness = drv_MDM166A_Brightness(R2N(arg1));
+ SetResult(&result, R_NUMBER, &brightness);
+}
+
+static int drv_MDM166A_icons_set(const int num, const int val)
+{
+
+ //debug("%s: num %d set %d)", Name, num, val);
+ if (num < 0 || num >= GPOS) {
+ info("%s: num %d out of range (GPO1..%d)", Name, num, GPOS);
+ return -1;
+ }
+ drv_MDM166A_icons(num, val);
+ return 0;
+}
+
+/****************************************/
+/*** exported functions ***/
+/****************************************/
+
+
+/* list models */
+int drv_MDM166A_list(void)
+{
+ printf("MDM166A 96x16 Graphic LCD");
+ return 0;
+}
+
+/* initialize driver & display */
+int drv_MDM166A_init(const char *section, const int quiet)
+{
+ int ret;
+
+ info("%s: %s", Name, "$Rev$");
+
+ /* real worker functions */
+ drv_generic_graphic_real_blit = drv_MDM166A_blit;
+ drv_generic_gpio_real_set = drv_MDM166A_icons_set;
+
+ /* start display */
+ if ((ret = drv_MDM166A_start(section, quiet)) != 0)
+ return ret;
+
+ /* initialize generic graphic driver */
+ if ((ret = drv_generic_graphic_init(section, Name)) != 0)
+ return ret;
+
+ /* initialize generic GPIO driver */
+ if ((ret = drv_generic_gpio_init(section, Name)) != 0)
+ return ret;
+
+ /* register plugins */
+ AddFunction("LCD::brightness", 1, plugin_brightness);
+
+ return 0;
+}
+
+
+/* close driver & display */
+int drv_MDM166A_quit(const int quiet)
+{
+ info("%s: shutting down.", Name);
+
+ /* clear display */
+ drv_MDM166A_clear();
+
+ /* say goodbye... */
+ if (!quiet) {
+ drv_generic_graphic_greet("goodbye!", NULL);
+ }
+
+ drv_MDM166A_close();
+ drv_generic_graphic_quit();
+
+ if (mdm166a_Queue) {
+ free(mdm166a_Queue);
+ mdm166a_Queue = NULL;
+ }
+
+ if (mdm166a_framebuffer) {
+ free(mdm166a_framebuffer);
+ mdm166a_framebuffer = NULL;
+ }
+
+ return (0);
+}
+
+
+DRIVER drv_MDM166A = {
+ .name = Name,
+ .list = drv_MDM166A_list,
+ .init = drv_MDM166A_init,
+ .quit = drv_MDM166A_quit,
+};
diff --git a/drv_picoLCD.c b/drv_picoLCD.c
new file mode 100644
index 0000000..311958e
--- /dev/null
+++ b/drv_picoLCD.c
@@ -0,0 +1,492 @@
+/* $Id: drv_picoLCD.c 1143 2011-02-12 22:46:19Z mzuther $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/drv_picoLCD.c $
+ *
+ * driver for picoLCD displays from mini-box.com
+ *
+ * Copyright (C) 2005 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2005, 2006, 2007 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * Copyright (C) 2007 Nicu Pavel, Mini-Box.com <npavel@mini-box.com>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ *
+ * exported fuctions:
+ *
+ * struct DRIVER drv_picoLCD
+ *
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <unistd.h>
+#include <termios.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <sys/time.h>
+
+#include <usb.h>
+
+#include "debug.h"
+#include "cfg.h"
+#include "qprintf.h"
+#include "udelay.h"
+#include "plugin.h"
+#include "widget.h"
+#include "widget_text.h"
+#include "widget_icon.h"
+#include "widget_bar.h"
+#include "drv.h"
+#include "drv_generic_text.h"
+#include "drv_generic_gpio.h"
+#include "drv_generic_keypad.h"
+
+
+
+#define picoLCD_VENDOR 0x04d8
+#define picoLCD_DEVICE 0x0002
+
+static char Name[] = "picoLCD";
+
+static unsigned int gpo = 0;
+
+static char *Buffer;
+static char *BufPtr;
+
+static usb_dev_handle *lcd;
+
+
+
+/****************************************/
+/*** hardware dependant functions ***/
+/****************************************/
+
+static int drv_pL_open(void)
+{
+ struct usb_bus *busses, *bus;
+ struct usb_device *dev;
+ char driver[1024];
+ char product[1024];
+ char manufacturer[1024];
+ char serialnumber[1024];
+ int ret;
+
+ lcd = NULL;
+
+ info("%s: scanning for picoLCD...", Name);
+
+ usb_set_debug(0);
+
+ usb_init();
+ usb_find_busses();
+ usb_find_devices();
+ busses = usb_get_busses();
+
+ for (bus = busses; bus; bus = bus->next) {
+ for (dev = bus->devices; dev; dev = dev->next) {
+ if ((dev->descriptor.idVendor == picoLCD_VENDOR) && (dev->descriptor.idProduct == picoLCD_DEVICE)) {
+
+ info("%s: found picoLCD on bus %s device %s", Name, bus->dirname, dev->filename);
+
+ lcd = usb_open(dev);
+
+ ret = usb_get_driver_np(lcd, 0, driver, sizeof(driver));
+
+ if (ret == 0) {
+ info("%s: interface 0 already claimed by '%s'", Name, driver);
+ info("%s: attempting to detach driver...", Name);
+ if (usb_detach_kernel_driver_np(lcd, 0) < 0) {
+ error("%s: usb_detach_kernel_driver_np() failed!", Name);
+ return -1;
+ }
+ }
+
+ usb_set_configuration(lcd, 1);
+ usleep(100);
+
+ if (usb_claim_interface(lcd, 0) < 0) {
+ error("%s: usb_claim_interface() failed!", Name);
+ return -1;
+ }
+
+ usb_set_altinterface(lcd, 0);
+
+ usb_get_string_simple(lcd, dev->descriptor.iProduct, product, sizeof(product));
+ usb_get_string_simple(lcd, dev->descriptor.iManufacturer, manufacturer, sizeof(manufacturer));
+ usb_get_string_simple(lcd, dev->descriptor.iSerialNumber, serialnumber, sizeof(serialnumber));
+
+ info("%s: Manufacturer='%s' Product='%s' SerialNumber='%s'", Name, manufacturer, product, serialnumber);
+
+ return 0;
+ }
+ }
+ }
+ error("%s: could not find a picoLCD", Name);
+ return -1;
+}
+
+
+static int drv_pL_close(void)
+{
+ usb_release_interface(lcd, 0);
+ usb_close(lcd);
+
+ return 0;
+}
+
+
+static void drv_pL_send(unsigned char *data, int size)
+{
+ usb_interrupt_write(lcd, USB_ENDPOINT_OUT + 1, (char *) data, size, 1000);
+}
+
+static int drv_pL_read(unsigned char *data, int size)
+{
+ return usb_interrupt_read(lcd, USB_ENDPOINT_OUT + 1, (char *) data, size, 1000);
+}
+
+
+
+static void drv_pL_clear(void)
+{
+ unsigned char cmd[1] = { 0x94 }; /* clear display */
+ drv_pL_send(cmd, 1);
+}
+
+static int drv_pL_contrast(int contrast)
+{
+ unsigned char cmd[2] = { 0x92 }; /* set contrast */
+
+ if (contrast < 0)
+ contrast = 0;
+ if (contrast > 255)
+ contrast = 255;
+
+ cmd[1] = contrast;
+ drv_pL_send(cmd, 2);
+
+ return contrast;
+}
+
+
+static int drv_pL_backlight(int backlight)
+{
+ unsigned char cmd[2] = { 0x91 }; /* set backlight */
+
+ if (backlight < 0)
+ backlight = 0;
+ if (backlight > 1)
+ backlight = 1;
+
+ cmd[1] = backlight;
+ drv_pL_send(cmd, 2);
+
+ return backlight;
+}
+
+#define _USBLCD_MAX_DATA_LEN 24
+#define IN_REPORT_KEY_STATE 0x11
+static int drv_pL_gpi( __attribute__ ((unused))
+ int num)
+{
+ int ret;
+ unsigned char read_packet[_USBLCD_MAX_DATA_LEN];
+ ret = drv_pL_read(read_packet, _USBLCD_MAX_DATA_LEN);
+ if ((ret > 0) && (read_packet[0] == IN_REPORT_KEY_STATE)) {
+ debug("picoLCD: pressed key= 0x%02x\n", read_packet[1]);
+ return read_packet[1];
+ }
+ return 0;
+}
+
+static int drv_pL_gpo(int num, int val)
+{
+ unsigned char cmd[2] = { 0x81 }; /* set GPO */
+
+ if (num < 0)
+ num = 0;
+ if (num > 7)
+ num = 7;
+
+ if (val < 0)
+ val = 0;
+ if (val > 1)
+ val = 1;
+
+ /* set led bit to 1 or 0 */
+ if (val)
+ gpo |= 1 << num;
+ else
+ gpo &= ~(1 << num);
+
+ cmd[1] = gpo;
+ drv_pL_send(cmd, 2);
+
+ return val;
+}
+
+
+static void drv_pL_write(const int row, const int col, const char *data, int len)
+{
+ unsigned char cmd[64];
+ int i;
+
+ cmd[0] = 0x98; /* goto/write */
+ cmd[1] = row;
+ cmd[2] = col;
+ cmd[3] = len;
+
+ i = 4;
+ while (len--) {
+ cmd[i++] = *data++;
+ }
+
+ drv_pL_send(cmd, i);
+}
+
+static void drv_pL_defchar(const int ascii, const unsigned char *matrix)
+{
+ unsigned char cmd[10] = { 0x9c }; /* define character */
+ int i;
+
+ cmd[1] = ascii;
+ for (i = 0; i < 8; i++) {
+ cmd[i + 2] = *matrix++ & 0x1f;
+ }
+
+ drv_pL_send(cmd, 10);
+}
+
+
+static int drv_pL_start(const char *section, const int quiet)
+{
+ int rows = -1, cols = -1;
+ int value;
+ char *s;
+
+ s = cfg_get(section, "Size", NULL);
+ if (s == NULL || *s == '\0') {
+ error("%s: no '%s.Size' entry from %s", Name, section, cfg_source());
+ return -1;
+ }
+ if (sscanf(s, "%dx%d", &cols, &rows) != 2 || rows < 1 || cols < 1) {
+ error("%s: bad %s.Size '%s' from %s", Name, section, s, cfg_source());
+ free(s);
+ return -1;
+ }
+
+ DROWS = rows;
+ DCOLS = cols;
+
+ if (drv_pL_open() < 0) {
+ return -1;
+ }
+
+ /* Init the command buffer */
+ Buffer = (char *) malloc(1024);
+ if (Buffer == NULL) {
+ error("%s: command buffer could not be allocated: malloc() failed", Name);
+ return -1;
+ }
+ BufPtr = Buffer;
+
+ if (cfg_number(section, "Contrast", 0, 0, 255, &value) > 0) {
+ info("Setting contrast to %d", value);
+ drv_pL_contrast(value);
+ }
+
+ if (cfg_number(section, "Backlight", 0, 0, 1, &value) > 0) {
+ info("Setting backlight to %d", value);
+ drv_pL_backlight(value);
+ }
+
+ drv_pL_clear(); /* clear display */
+
+ if (!quiet) {
+ char buffer[40];
+ qprintf(buffer, sizeof(buffer), "%s %dx%d", Name, DCOLS, DROWS);
+ if (drv_generic_text_greet(buffer, "http://www.picolcd.com")) {
+ sleep(3);
+ drv_pL_clear();
+ }
+ }
+
+ return 0;
+}
+
+
+/****************************************/
+/*** plugins ***/
+/****************************************/
+
+static void plugin_contrast(RESULT * result, RESULT * arg1)
+{
+ double contrast;
+
+ contrast = drv_pL_contrast(R2N(arg1));
+ SetResult(&result, R_NUMBER, &contrast);
+}
+
+static void plugin_backlight(RESULT * result, RESULT * arg1)
+{
+ double backlight;
+
+ backlight = drv_pL_backlight(R2N(arg1));
+ SetResult(&result, R_NUMBER, &backlight);
+}
+
+static void plugin_gpo(RESULT * result, RESULT * argv[])
+{
+ double gpo;
+ gpo = drv_pL_gpo(R2N(argv[0]), R2N(argv[1]));
+ SetResult(&result, R_NUMBER, &gpo);
+}
+
+/****************************************/
+/*** widget callbacks ***/
+/****************************************/
+
+
+/* using drv_generic_text_draw(W) */
+/* using drv_generic_text_icon_draw(W) */
+/* using drv_generic_text_bar_draw(W) */
+
+
+/****************************************/
+/*** exported functions ***/
+/****************************************/
+
+
+/* list models */
+int drv_pL_list(void)
+{
+ printf("picoLCD 20x2 Text LCD");
+ return 0;
+}
+
+
+/* initialize driver & display */
+int drv_pL_init(const char *section, const int quiet)
+{
+ WIDGET_CLASS wc;
+ int ret;
+
+ info("%s: %s", Name, "$Rev: 1143 $");
+
+ /* display preferences */
+ XRES = 5; /* pixel width of one char */
+ YRES = 8; /* pixel height of one char */
+ CHARS = 8; /* number of user-defineable characters */
+ CHAR0 = 0; /* ASCII of first user-defineable char */
+ GPOS = 8;
+ GPIS = 1;
+ INVALIDATE = 1;
+ GOTO_COST = 2; /* number of bytes a goto command requires */
+
+ /* real worker functions */
+ drv_generic_text_real_write = drv_pL_write;
+ drv_generic_text_real_defchar = drv_pL_defchar;
+ drv_generic_gpio_real_set = drv_pL_gpo;
+ drv_generic_gpio_real_get = drv_pL_gpi;
+
+ /* start display */
+ if ((ret = drv_pL_start(section, quiet)) != 0)
+ return ret;
+
+ /* initialize generic text driver */
+ if ((ret = drv_generic_text_init(section, Name)) != 0)
+ return ret;
+
+ /* initialize generic icon driver */
+ if ((ret = drv_generic_text_icon_init()) != 0)
+ return ret;
+
+ /* initialize generic bar driver */
+ if ((ret = drv_generic_text_bar_init(0)) != 0)
+ return ret;
+
+ drv_generic_text_bar_add_segment(0, 0, 255, 32);
+
+ /* GPO's init */
+ if ((ret = drv_generic_gpio_init(section, Name)) != 0)
+ return ret;
+
+ /* register text widget */
+ wc = Widget_Text;
+ wc.draw = drv_generic_text_draw;
+ widget_register(&wc);
+
+ /* register icon widget */
+ wc = Widget_Icon;
+ wc.draw = drv_generic_text_icon_draw;
+ widget_register(&wc);
+
+ /* register bar widget */
+ wc = Widget_Bar;
+ wc.draw = drv_generic_text_bar_draw;
+ widget_register(&wc);
+
+ /* register plugins */
+ AddFunction("LCD::contrast", -1, plugin_contrast);
+ AddFunction("LCD::backlight", -1, plugin_backlight);
+ AddFunction("LCD::gpo", -1, plugin_gpo);
+
+ return 0;
+}
+
+
+/* close driver & display */
+int drv_pL_quit(const int quiet)
+{
+
+ info("%s: shutting down.", Name);
+
+ drv_generic_text_quit();
+
+ /* clear display */
+ drv_pL_clear();
+
+ /* say goodbye... */
+ if (!quiet) {
+ drv_generic_text_greet("goodbye!", NULL);
+ }
+
+ drv_pL_close();
+
+ if (Buffer) {
+ free(Buffer);
+ Buffer = NULL;
+ BufPtr = Buffer;
+ }
+
+ return (0);
+}
+
+
+DRIVER drv_picoLCD = {
+ .name = Name,
+ .list = drv_pL_list,
+ .init = drv_pL_init,
+ .quit = drv_pL_quit,
+};
diff --git a/drv_picoLCDGraphic.c b/drv_picoLCDGraphic.c
new file mode 100644
index 0000000..244cc5b
--- /dev/null
+++ b/drv_picoLCDGraphic.c
@@ -0,0 +1,749 @@
+/* $Id: drv_picoLCDGraphic.c 1181 2012-03-15 03:48:49Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/drv_picoLCDGraphic.c $
+ *
+ * driver for picoLCD Graphic(256x64) displays from mini-box.com
+ *
+ * Copyright (C) 2005 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2005, 2006, 2007 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * Copyright (C) 2009 Nicu Pavel, Mini-Box.com <npavel@mini-box.com>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ *
+ * exported fuctions:
+ *
+ * struct DRIVER drv_picoLCDGraphic
+ *
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <unistd.h>
+#include <termios.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <sys/time.h>
+
+#include <usb.h>
+
+#include "debug.h"
+#include "cfg.h"
+#include "qprintf.h"
+#include "udelay.h"
+#include "plugin.h"
+#include "timer.h"
+#include "widget.h"
+#include "widget_text.h"
+#include "widget_icon.h"
+#include "widget_bar.h"
+#include "widget_keypad.h"
+#include "drv.h"
+#include "drv_generic_gpio.h"
+#include "drv_generic_keypad.h"
+#include "drv_generic_graphic.h"
+
+
+
+#define picoLCD_VENDOR 0x04d8
+#define picoLCD_DEVICE 0xc002
+
+#define OUT_REPORT_LED_STATE 0x81
+#define OUT_REPORT_LCD_BACKLIGHT 0x91
+#define OUT_REPORT_LCD_CONTRAST 0x92
+
+#define OUT_REPORT_CMD 0x94
+#define OUT_REPORT_DATA 0x95
+#define OUT_REPORT_CMD_DATA 0x96
+
+#define SCREEN_H 64
+#define SCREEN_W 256
+
+
+#if 1
+#define DEBUG(x) debug("%s(): %s", __FUNCTION__, x);
+#else
+#define DEBUG(x)
+#endif
+
+/* "dirty" marks the display to be redrawn from frame buffer */
+static int dirty = 1;
+
+/* timer for display redraw (set to zero for "direct updates") */
+static int update = 0;
+
+/* USB read timeout in ms (the picoLCD 256x64 times out on every read
+ unless a key has been pressed!) */
+static int read_timeout = 0;
+
+static char Name[] = "picoLCDGraphic";
+static unsigned char *pLG_framebuffer;
+
+/* used to display white text on black background or inverse */
+unsigned char inverted = 0;
+
+static unsigned int gpo = 0;
+
+static char *Buffer;
+static char *BufPtr;
+
+static usb_dev_handle *lcd;
+//extern int usb_debug;
+int usb_debug;
+
+
+/****************************************/
+/*** hardware dependant functions ***/
+/****************************************/
+
+static int drv_pLG_open(void)
+{
+ struct usb_bus *busses, *bus;
+ struct usb_device *dev;
+ char driver[1024];
+ char product[1024];
+ char manufacturer[1024];
+ char serialnumber[1024];
+ int ret;
+
+ lcd = NULL;
+
+ info("%s: scanning for picoLCD 256x64...", Name);
+
+ usb_debug = 0;
+
+ usb_init();
+ usb_find_busses();
+ usb_find_devices();
+ busses = usb_get_busses();
+
+ for (bus = busses; bus; bus = bus->next) {
+ for (dev = bus->devices; dev; dev = dev->next) {
+ if ((dev->descriptor.idVendor == picoLCD_VENDOR) && (dev->descriptor.idProduct == picoLCD_DEVICE)) {
+
+ info("%s: found picoLCD on bus %s device %s", Name, bus->dirname, dev->filename);
+
+ lcd = usb_open(dev);
+
+ ret = usb_get_driver_np(lcd, 0, driver, sizeof(driver));
+
+ if (ret == 0) {
+ info("%s: interface 0 already claimed by '%s'", Name, driver);
+ info("%s: attempting to detach driver...", Name);
+ if (usb_detach_kernel_driver_np(lcd, 0) < 0) {
+ error("%s: usb_detach_kernel_driver_np() failed!", Name);
+ return -1;
+ }
+ }
+
+ usb_set_configuration(lcd, 1);
+ usleep(100);
+
+ if (usb_claim_interface(lcd, 0) < 0) {
+ error("%s: usb_claim_interface() failed!", Name);
+ return -1;
+ }
+
+ usb_set_altinterface(lcd, 0);
+
+ usb_get_string_simple(lcd, dev->descriptor.iProduct, product, sizeof(product));
+ usb_get_string_simple(lcd, dev->descriptor.iManufacturer, manufacturer, sizeof(manufacturer));
+ usb_get_string_simple(lcd, dev->descriptor.iSerialNumber, serialnumber, sizeof(serialnumber));
+
+ info("%s: Manufacturer='%s' Product='%s' SerialNumber='%s'", Name, manufacturer, product, serialnumber);
+
+ return 0;
+ }
+ }
+ }
+ error("%s: could not find a picoLCD", Name);
+ return -1;
+}
+
+static int drv_pLG_read(unsigned char *data, int size)
+{
+ return usb_interrupt_read(lcd, USB_ENDPOINT_IN + 1, (char *) data, size, read_timeout);
+}
+
+
+static void drv_pLG_send(unsigned char *data, int size)
+{
+ int __attribute__ ((unused)) ret;
+ ret = usb_interrupt_write(lcd, USB_ENDPOINT_OUT + 1, (char *) data, size, 1000);
+ //fprintf(stderr, "%s written %d bytes\n", __FUNCTION__, ret);
+}
+
+static int drv_pLG_close(void)
+{
+ usb_release_interface(lcd, 0);
+ usb_close(lcd);
+
+ return 0;
+}
+
+static void drv_pLG_update_img()
+{
+ unsigned char cmd3[64] = { OUT_REPORT_CMD_DATA }; /* send command + data */
+ unsigned char cmd4[64] = { OUT_REPORT_DATA }; /* send data only */
+
+ int index, bit, x, y;
+ unsigned char cs, line;
+ unsigned char pixel;
+
+ /* do not redraw display if frame buffer has not changed, unless
+ "direct updates" have been requested (update is zero) */
+ if ((!dirty) && (update > 0)) {
+ debug("Skipping %s\n", __FUNCTION__);
+ return;
+ }
+
+ debug("In %s\n", __FUNCTION__);
+
+ for (cs = 0; cs < 4; cs++) {
+ unsigned char chipsel = (cs << 2); //chipselect
+ for (line = 0; line < 8; line++) {
+ //ha64_1.setHIDPkt(OUT_REPORT_CMD_DATA, 8+3+32, 8, chipsel, 0x02, 0x00, 0x00, 0xb8|j, 0x00, 0x00, 0x40);
+ cmd3[0] = OUT_REPORT_CMD_DATA;
+ cmd3[1] = chipsel;
+ cmd3[2] = 0x02;
+ cmd3[3] = 0x00;
+ cmd3[4] = 0x00;
+ cmd3[5] = 0xb8 | line;
+ cmd3[6] = 0x00;
+ cmd3[7] = 0x00;
+ cmd3[8] = 0x40;
+ cmd3[9] = 0x00;
+ cmd3[10] = 0x00;
+ cmd3[11] = 32;
+
+ //ha64_2.setHIDPkt(OUT_REPORT_DATA, 4+32, 4, chipsel | 0x01, 0x00, 0x00, 32);
+
+ cmd4[0] = OUT_REPORT_DATA;
+ cmd4[1] = chipsel | 0x01;
+ cmd4[2] = 0x00;
+ cmd4[3] = 0x00;
+ cmd4[4] = 32;
+
+ for (index = 0; index < 32; index++) {
+ pixel = 0x00;
+
+ for (bit = 0; bit < 8; bit++) {
+ x = cs * 64 + index;
+ y = (line * 8 + bit + 0) % SCREEN_H;
+
+ if (pLG_framebuffer[y * 256 + x] ^ inverted)
+ pixel |= (1 << bit);
+ }
+ cmd3[12 + index] = pixel;
+ }
+
+ for (index = 32; index < 64; index++) {
+ pixel = 0x00;
+
+ for (bit = 0; bit < 8; bit++) {
+ x = cs * 64 + index;
+ y = (line * 8 + bit + 0) % SCREEN_H;
+ if (pLG_framebuffer[y * 256 + x] ^ inverted)
+ pixel |= (1 << bit);
+ }
+
+ cmd4[5 + (index - 32)] = pixel;
+ }
+
+ drv_pLG_send(cmd3, 44);
+ drv_pLG_send(cmd4, 38);
+ }
+ }
+
+ /* mark display as up-to-date */
+ dirty = 0;
+ //drv_pLG_clear();
+}
+
+
+#define _USBLCD_MAX_DATA_LEN 24
+#define IN_REPORT_KEY_STATE 0x11
+static void drv_pLG_update_keypad()
+{
+ static int pressed_key = 0;
+
+ int ret;
+ unsigned char read_packet[_USBLCD_MAX_DATA_LEN];
+ ret = drv_pLG_read(read_packet, _USBLCD_MAX_DATA_LEN);
+ if ((ret > 0) && (read_packet[0] == IN_REPORT_KEY_STATE)) {
+ debug("picoLCD: pressed key= 0x%02x\n", read_packet[1]);
+ int new_pressed_key = read_packet[1];
+ if (pressed_key != new_pressed_key) {
+ /* negative values mark a key release */
+ drv_generic_keypad_press(-pressed_key);
+ drv_generic_keypad_press(new_pressed_key);
+ pressed_key = new_pressed_key;
+ }
+ }
+}
+
+
+/* for graphic displays only */
+static void drv_pLG_blit(const int row, const int col, const int height, const int width)
+{
+ int r, c;
+
+ //DEBUG(fprintf(stderr, "In %s called with row %d col %d height %d width %d\n", __FUNCTION__, row, col, height, width));
+
+ for (r = row; r < row + height; r++) {
+ for (c = col; c < col + width; c++) {
+ pLG_framebuffer[r * 256 + c] = drv_generic_graphic_black(r, c);
+ //fprintf(stderr, "%d", pLG_framebuffer[r * 256 + c]);
+ }
+ //fprintf(stderr, "\n");
+ }
+
+ /*
+ for (r = 0; r < 64; r++) {
+ for(c = 0; c < 256; c++) {
+ fprintf(stderr, "%d", pLG_framebuffer[r * 256 + c]);
+ }
+ fprintf(stderr, "\n");
+ }
+ */
+
+ /* display needs to be redrawn from frame buffer */
+ dirty = 1;
+
+ /* if "direct updates" have been requested, redraw now */
+ if (update <= 0)
+ drv_pLG_update_img();
+}
+
+
+void drv_pLG_clear(void)
+{
+ unsigned char cmd[3] = { 0x93, 0x01, 0x00 }; /* init display */
+ unsigned char cmd2[9] = { OUT_REPORT_CMD }; /* init display */
+ unsigned char cmd3[64] = { OUT_REPORT_CMD_DATA }; /* clear screen */
+ unsigned char cmd4[64] = { OUT_REPORT_CMD_DATA }; /* clear screen */
+
+ int init, index;
+ unsigned char cs, line;
+
+
+ debug("In %s\n", __FUNCTION__);
+ drv_pLG_send(cmd, 3);
+
+ for (init = 0; init < 4; init++) {
+ unsigned char cs = ((init << 2) & 0xFF);
+
+ cmd2[0] = OUT_REPORT_CMD;
+ cmd2[1] = cs;
+ cmd2[2] = 0x02;
+ cmd2[3] = 0x00;
+ cmd2[4] = 0x64;
+ cmd2[5] = 0x3F;
+ cmd2[6] = 0x00;
+ cmd2[7] = 0x64;
+ cmd2[8] = 0xC0;
+
+ drv_pLG_send(cmd2, 9);
+ }
+
+
+ for (cs = 0; cs < 4; cs++) {
+ unsigned char chipsel = (cs << 2); //chipselect
+ for (line = 0; line < 8; line++) {
+ //ha64_1.setHIDPkt(OUT_REPORT_CMD_DATA, 8+3+32, 8, cs, 0x02, 0x00, 0x00, 0xb8|j, 0x00, 0x00, 0x40);
+ cmd3[0] = OUT_REPORT_CMD_DATA;
+ cmd3[1] = chipsel;
+ cmd3[2] = 0x02;
+ cmd3[3] = 0x00;
+ cmd3[4] = 0x00;
+ cmd3[5] = 0xb8 | line;
+ cmd3[6] = 0x00;
+ cmd3[7] = 0x00;
+ cmd3[8] = 0x40;
+ cmd3[9] = 0x00;
+ cmd3[10] = 0x00;
+ cmd3[11] = 32;
+
+ unsigned char temp = 0;
+
+ for (index = 0; index < 32; index++) {
+ cmd3[12 + index] = temp;
+ }
+
+ drv_pLG_send(cmd3, 64);
+
+ //ha64_2.setHIDPkt(OUT_REPORT_DATA, 4+32, 4, cs | 0x01, 0x00, 0x00, 32);
+
+ cmd4[0] = OUT_REPORT_DATA;
+ cmd4[1] = chipsel | 0x01;
+ cmd4[2] = 0x00;
+ cmd4[3] = 0x00;
+ cmd4[4] = 32;
+
+ for (index = 32; index < 64; index++) {
+ temp = 0x00;
+ cmd4[5 + (index - 32)] = temp;
+ }
+ drv_pLG_send(cmd4, 64);
+ }
+ }
+}
+
+static int drv_pLG_contrast(int contrast)
+{
+ unsigned char cmd[2] = { 0x92 }; /* set contrast */
+
+ if (contrast < 0)
+ contrast = 0;
+ if (contrast > 255)
+ contrast = 255;
+
+ cmd[1] = contrast;
+ drv_pLG_send(cmd, 2);
+
+ return contrast;
+}
+
+
+static int drv_pLG_backlight(int backlight)
+{
+ unsigned char cmd[2] = { 0x91 }; /* set backlight */
+
+ if (backlight < 0)
+ backlight = 0;
+ if (backlight > 255)
+ backlight = 255;
+
+ cmd[1] = backlight;
+ drv_pLG_send(cmd, 2);
+
+ return backlight;
+}
+
+static int drv_pLG_gpi( __attribute__ ((unused))
+ int num)
+{
+ int ret;
+ unsigned char read_packet[_USBLCD_MAX_DATA_LEN];
+ ret = drv_pLG_read(read_packet, _USBLCD_MAX_DATA_LEN);
+ if ((ret > 0) && (read_packet[0] == IN_REPORT_KEY_STATE)) {
+ debug("picoLCD: pressed key= 0x%02x\n", read_packet[1]);
+ return read_packet[1];
+ }
+ return 0;
+}
+
+
+static int drv_pLG_gpo(int num, int val)
+{
+ unsigned char cmd[2] = { 0x81 }; /* set GPO */
+
+ if (num < 0)
+ num = 0;
+ if (num > 7)
+ num = 7;
+
+ if (val < 0)
+ val = 0;
+ if (val > 1)
+ val = 1;
+
+ /* set led bit to 1 or 0 */
+ if (val)
+ gpo |= 1 << num;
+ else
+ gpo &= ~(1 << num);
+
+ cmd[1] = gpo;
+ drv_pLG_send(cmd, 2);
+
+ return val;
+}
+
+static int drv_pLG_start(const char *section, const int quiet)
+{
+ int rows = -1, cols = -1;
+ int value;
+ char *s;
+
+ /* set display redraw interval (set to zero for "direct updates") */
+ cfg_number(section, "update", 200, 0, -1, &update);
+
+ /* USB read timeout in ms (the picoLCD 256x64 times out on every
+ read unless a key has been pressed!) */
+ cfg_number(section, "Timeout", 5, 1, 1000, &read_timeout);
+
+ s = cfg_get(section, "Size", NULL);
+ if (s == NULL || *s == '\0') {
+ error("%s: no '%s.Size' entry from %s", Name, section, cfg_source());
+ return -1;
+ }
+ if (sscanf(s, "%dx%d", &cols, &rows) != 2 || rows < 1 || cols < 1) {
+ error("%s: bad %s.Size '%s' from %s", Name, section, s, cfg_source());
+ free(s);
+ return -1;
+ }
+
+ if (cfg_number(section, "Inverted", 0, 0, 1, &value) > 0) {
+ info("Setting display inverted to %d", value);
+ inverted = value;
+ }
+
+ DROWS = SCREEN_H;
+ DCOLS = SCREEN_W;
+
+ if (drv_pLG_open() < 0) {
+ return -1;
+ }
+
+ /* Init the command buffer */
+ Buffer = (char *) malloc(1024);
+ if (Buffer == NULL) {
+ error("%s: command buffer could not be allocated: malloc() failed", Name);
+ return -1;
+ }
+ BufPtr = Buffer;
+
+ /* Init framebuffer buffer */
+ pLG_framebuffer = malloc(SCREEN_W * SCREEN_H * sizeof(unsigned char));
+ if (!pLG_framebuffer)
+ return -1;
+
+ DEBUG("allocated");
+ memset(pLG_framebuffer, 0, SCREEN_W * SCREEN_H);
+ DEBUG("zeroed");
+
+ if (cfg_number(section, "Contrast", 0, 0, 255, &value) > 0) {
+ info("Setting contrast to %d", value);
+ drv_pLG_contrast(value);
+ }
+
+ if (cfg_number(section, "Backlight", 0, 0, 1, &value) > 0) {
+ info("Setting backlight to %d", value);
+ drv_pLG_backlight(value);
+ }
+
+ drv_pLG_clear(); /* clear display */
+
+ if (!quiet) {
+ char buffer[40];
+ qprintf(buffer, sizeof(buffer), "%s %dx%d", Name, SCREEN_W, SCREEN_H);
+ if (drv_generic_graphic_greet(buffer, "http://www.picolcd.com")) {
+ sleep(3);
+ drv_pLG_clear();
+ }
+ }
+
+ /* setup a timer that regularly redraws the display from the frame
+ buffer (unless "direct updates" have been requested */
+ if (update > 0)
+ timer_add(drv_pLG_update_img, NULL, update, 0);
+
+ /* setup a timer that regularly checks the keypad for pressed or
+ released keys */
+ /* FIXME: make 100msec configurable */
+ timer_add(drv_pLG_update_keypad, NULL, 100, 0);
+
+ return 0;
+}
+
+
+/****************************************/
+/*** plugins ***/
+/****************************************/
+
+static void plugin_contrast(RESULT * result, RESULT * arg1)
+{
+ double contrast;
+
+ contrast = drv_pLG_contrast(R2N(arg1));
+ SetResult(&result, R_NUMBER, &contrast);
+}
+
+static void plugin_backlight(RESULT * result, RESULT * arg1)
+{
+ double backlight;
+
+ backlight = drv_pLG_backlight(R2N(arg1));
+ SetResult(&result, R_NUMBER, &backlight);
+}
+
+static void plugin_gpo(RESULT * result, RESULT * argv[])
+{
+ double gpo;
+ gpo = drv_pLG_gpo(R2N(argv[0]), R2N(argv[1]));
+ SetResult(&result, R_NUMBER, &gpo);
+}
+
+
+/****************************************/
+/*** widget callbacks ***/
+/****************************************/
+
+
+/* using drv_generic_text_draw(W) */
+/* using drv_generic_text_icon_draw(W) */
+/* using drv_generic_text_bar_draw(W) */
+
+
+/****************************************/
+/*** exported functions ***/
+/****************************************/
+
+
+/* list models */
+int drv_pLG_list(void)
+{
+ printf("picoLCD 256x64 Graphic LCD");
+ return 0;
+}
+
+
+static int drv_pLG_keypad(const int num)
+{
+ int val;
+ int new_num = num;
+
+ if (new_num == 0)
+ return 0;
+ else if (new_num > 0)
+ val = WIDGET_KEY_PRESSED;
+ else {
+ /* negative values mark a key release */
+ new_num = -num;
+ val = WIDGET_KEY_RELEASED;
+ }
+
+ switch (new_num) {
+ case 1:
+ val += WIDGET_KEY_CANCEL;
+ break;
+ case 2:
+ val += WIDGET_KEY_LEFT;
+ break;
+ case 3:
+ val += WIDGET_KEY_RIGHT;
+ break;
+ case 5:
+ val += WIDGET_KEY_UP;
+ break;
+ case 6:
+ val += WIDGET_KEY_CONFIRM;
+ break;
+ case 7:
+ val += WIDGET_KEY_DOWN;
+ break;
+ default:
+ error("%s: unknown keypad value %d", Name, num);
+ }
+
+ return val;
+}
+
+
+/* initialize driver & display */
+int drv_pLG_init(const char *section, const int quiet)
+{
+ int ret;
+
+ info("%s: %s", Name, "$Rev: 1181 $");
+
+ info("PICOLCD Graphic initialization\n");
+
+ /* display preferences */
+ XRES = 6; /* pixel width of one char */
+ YRES = 8; /* pixel height of one char */
+ GPOS = 8;
+ GPIS = 1;
+ /* real worker functions */
+ drv_generic_graphic_real_blit = drv_pLG_blit;
+ drv_generic_keypad_real_press = drv_pLG_keypad;
+ drv_generic_gpio_real_set = drv_pLG_gpo;
+ drv_generic_gpio_real_get = drv_pLG_gpi;
+
+
+ /* start display */
+ if ((ret = drv_pLG_start(section, quiet)) != 0)
+ return ret;
+
+
+ /* initialize generic graphic driver */
+ if ((ret = drv_generic_graphic_init(section, Name)) != 0)
+ return ret;
+
+
+ /* initialize generic key pad driver */
+ if ((ret = drv_generic_keypad_init(section, Name)) != 0)
+ return ret;
+
+
+ /* GPO's init */
+
+ if ((ret = drv_generic_gpio_init(section, Name)) != 0)
+ return ret;
+
+ /* register plugins */
+
+ AddFunction("LCD::contrast", 1, plugin_contrast);
+ AddFunction("LCD::backlight", 1, plugin_backlight);
+ AddFunction("LCD::gpo", -1, plugin_gpo);
+
+ return 0;
+}
+
+
+/* close driver & display */
+int drv_pLG_quit(const int quiet)
+{
+
+ info("%s: shutting down.", Name);
+
+ /* clear display */
+ drv_pLG_clear();
+
+ /* say goodbye... */
+ if (!quiet) {
+ drv_generic_graphic_greet("goodbye!", NULL);
+ }
+
+ drv_pLG_close();
+
+ if (Buffer) {
+ free(Buffer);
+ BufPtr = NULL;
+ }
+
+ drv_generic_graphic_quit();
+ drv_generic_keypad_quit();
+
+ return (0);
+}
+
+
+DRIVER drv_picoLCDGraphic = {
+ .name = Name,
+ .list = drv_pLG_list,
+ .init = drv_pLG_init,
+ .quit = drv_pLG_quit,
+};
diff --git a/drv_serdisplib.c b/drv_serdisplib.c
new file mode 100644
index 0000000..cc4cf62
--- /dev/null
+++ b/drv_serdisplib.c
@@ -0,0 +1,388 @@
+/* $Id: drv_serdisplib.c 1199 2013-05-23 03:07:28Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/drv_serdisplib.c $
+ *
+ * driver for serdisplib displays
+ *
+ * Copyright (C) 2005 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2005 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ *
+ * exported fuctions:
+ *
+ * struct DRIVER drv_serdisplib
+ *
+ */
+
+#include "config.h"
+#include "debug.h" // verbose_level
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <serdisplib/serdisp.h>
+
+/* Fixme: This should be removed as soon as serdisp.h
+ * contains this macros
+ */
+#ifndef SERDISP_VERSION_GET_MAJOR
+#define SERDISP_VERSION_GET_MAJOR(_c) ((int)( (_c) >> 8 ))
+#define SERDISP_VERSION_GET_MINOR(_c) ((int)( (_c) & 0xFF ))
+#endif
+
+
+#include "debug.h"
+#include "cfg.h"
+#include "qprintf.h"
+#include "plugin.h"
+#include "drv.h"
+#include "drv_generic_graphic.h"
+
+#ifdef WITH_DMALLOC
+#include <dmalloc.h>
+#endif
+
+static char Name[] = "serdisplib";
+
+static serdisp_CONN_t *sdcd;
+static serdisp_t *dd;
+
+int NUMCOLS = 1;
+
+
+/****************************************/
+/*** hardware dependant functions ***/
+/****************************************/
+
+static void drv_SD_blit(const int row, const int col, const int height, const int width)
+{
+ int r, c;
+ RGBA p;
+
+ for (r = row; r < row + height; r++) {
+ for (c = col; c < col + width; c++) {
+ p = drv_generic_graphic_rgb(r, c);
+ // printf("blit (%d,%d) A%d.R%d.G%d.B%d\n", c, r, p.A, p.R, p.G, p.B);
+ serdisp_setcolour(dd, c, r, serdisp_pack2ARGB(0xff, p.R, p.G, p.B));
+ }
+ }
+
+ serdisp_update(dd);
+}
+
+
+static int drv_SD_contrast(int contrast)
+{
+ if (contrast < 0)
+ contrast = 0;
+ if (contrast > MAX_CONTRASTSTEP)
+ contrast = MAX_CONTRASTSTEP;
+
+ serdisp_feature(dd, FEATURE_CONTRAST, contrast);
+
+ return contrast;
+}
+
+
+static int drv_SD_backlight(int backlight)
+{
+ if (backlight < FEATURE_NO)
+ backlight = FEATURE_NO;
+ if (backlight > FEATURE_YES)
+ backlight = FEATURE_YES;
+
+ serdisp_feature(dd, FEATURE_BACKLIGHT, backlight);
+
+ return backlight;
+}
+
+
+static int drv_SD_reverse(int reverse)
+{
+ if (reverse < FEATURE_NO)
+ reverse = FEATURE_NO;
+ if (reverse > FEATURE_YES)
+ reverse = FEATURE_YES;
+
+ serdisp_feature(dd, FEATURE_REVERSE, reverse);
+
+ return reverse;
+}
+
+
+static int drv_SD_rotate(int rotate)
+{
+ if (rotate < 0)
+ rotate = 0;
+ if (rotate > 3)
+ rotate = 3;
+
+ serdisp_feature(dd, FEATURE_ROTATE, rotate);
+
+ return rotate;
+}
+
+
+
+static int drv_SD_start(const char *section)
+{
+ long version;
+ char *port, *model, *options, *s;
+ int contrast, backlight, reverse, rotate;
+
+ version = serdisp_getversioncode();
+ info("%s: header version %d.%d", Name, SERDISP_VERSION_MAJOR, SERDISP_VERSION_MINOR);
+ info("%s: library version %d.%d", Name, SERDISP_VERSION_GET_MAJOR(version), SERDISP_VERSION_GET_MINOR(version));
+
+ port = cfg_get(section, "Port", NULL);
+ if (port == NULL || *port == '\0') {
+ error("%s: no '%s.Port' entry from %s", Name, section, cfg_source());
+ return -1;
+ }
+
+ /* opening the output device */
+ sdcd = SDCONN_open(port);
+ if (sdcd == NULL) {
+ error("%s: open(%s) failed: %s", Name, port, sd_geterrormsg());
+ info("%s: examples:\n serraw:/dev/ttyS0\n par:/dev/parport0\n USB:<vendor>/<product>", Name);
+ return -1;
+ }
+
+
+ model = cfg_get(section, "Model", "");
+ if (model == NULL || *model == '\0') {
+ error("%s: no '%s.Model' entry from %s", Name, section, cfg_source());
+ return -1;
+ }
+ info("%s: using model '%s'", Name, model);
+
+ options = cfg_get(section, "Options", "");
+ info("%s: using options '%s'", Name, options);
+
+ /* opening and initialising the display */
+ dd = serdisp_init(sdcd, model, options);
+ if (dd == NULL) {
+ error("%s: init(%s, %s, %s) failed: %s", Name, port, model, options, sd_geterrormsg());
+ SDCONN_close(sdcd);
+ return -1;
+ }
+
+ /* print supported options by display */
+ info("%s: options supported by display %s:", Name, model);
+ serdisp_options_t optiondesc;
+ optiondesc.name = ""; /* start the iteration with assigning an empty string before the first call */
+ while (serdisp_nextoptiondescription(dd, &optiondesc)) {
+ info(" %s", optiondesc.name);
+ }
+
+
+ DROWS = serdisp_getheight(dd);
+ DCOLS = serdisp_getwidth(dd);
+ NUMCOLS = serdisp_getcolours(dd);
+ info("%s: display size %dx%d, %d colors", Name, DCOLS, DROWS, NUMCOLS);
+
+ XRES = -1;
+ YRES = -1;
+ s = cfg_get(section, "Font", "6x8");
+ if (s == NULL || *s == '\0') {
+ error("%s: no '%s.Font' entry from %s", Name, section, cfg_source());
+ return -1;
+ }
+ if (sscanf(s, "%dx%d", &XRES, &YRES) != 2 || XRES < 1 || YRES < 1) {
+ error("%s: bad Font '%s' from %s", Name, s, cfg_source());
+ return -1;
+ }
+
+ /* Fixme: provider other fonts someday... */
+ if (XRES != 6 && YRES != 8) {
+ error("%s: bad Font '%s' from %s (only 6x8 at the moment)", Name, s, cfg_source());
+ return -1;
+ }
+
+ /* clear display */
+ serdisp_clear(dd);
+
+ if (cfg_number(section, "Contrast", 0, 0, MAX_CONTRASTSTEP, &contrast) > 0) {
+ drv_SD_contrast(contrast);
+ }
+
+ if (cfg_number(section, "Backlight", 0, 0, 1, &backlight) > 0) {
+ drv_SD_backlight(backlight);
+ }
+
+ if (cfg_number(section, "Reverse", 0, 0, 1, &reverse) > 0) {
+ drv_SD_reverse(reverse);
+ }
+
+ if (cfg_number(section, "Rotate", 0, 0, 3, &rotate) > 0) {
+ drv_SD_rotate(rotate);
+ }
+
+ return 0;
+}
+
+
+/****************************************/
+/*** plugins ***/
+/****************************************/
+
+static void plugin_contrast(RESULT * result, RESULT * arg1)
+{
+ double contrast;
+
+ contrast = drv_SD_contrast(R2N(arg1));
+ SetResult(&result, R_NUMBER, &contrast);
+}
+
+
+static void plugin_backlight(RESULT * result, RESULT * arg1)
+{
+ double backlight;
+
+ backlight = drv_SD_backlight(R2N(arg1));
+ SetResult(&result, R_NUMBER, &backlight);
+}
+
+
+static void plugin_reverse(RESULT * result, RESULT * arg1)
+{
+ double reverse;
+
+ reverse = drv_SD_reverse(R2N(arg1));
+ SetResult(&result, R_NUMBER, &reverse);
+}
+
+
+static void plugin_rotate(RESULT * result, RESULT * arg1)
+{
+ double rotate;
+
+ rotate = drv_SD_rotate(R2N(arg1));
+ SetResult(&result, R_NUMBER, &rotate);
+}
+
+
+/****************************************/
+/*** exported functions ***/
+/****************************************/
+
+
+/* list models */
+int drv_SD_list(void)
+{
+ serdisp_display_t displaydesc;
+
+ displaydesc.dispname = "";
+ while (serdisp_nextdisplaydescription(&displaydesc)) {
+ printf("%s ", displaydesc.dispname);
+ }
+
+ return 0;
+}
+
+
+/* verbosely list models (special case for serdisplib) */
+int drv_SD_list_verbose(void)
+{
+ serdisp_display_t displaydesc;
+ long version;
+
+ version = serdisp_getversioncode();
+ printf("%s: header version %d.%d, library version %d.%d, available sub-drivers:\n\n", Name,
+ SERDISP_VERSION_MAJOR, SERDISP_VERSION_MINOR,
+ SERDISP_VERSION_GET_MAJOR(version), SERDISP_VERSION_GET_MINOR(version));
+
+ printf("display name alias names description\n");
+ printf("------------------ -------------------- -----------------------------------\n");
+ displaydesc.dispname = "";
+ while (serdisp_nextdisplaydescription(&displaydesc)) {
+ printf(" %-15s %-20s %-35s\n", displaydesc.dispname, displaydesc.aliasnames, displaydesc.description);
+ }
+
+ return 0;
+}
+
+
+/* initialize driver & display */
+int drv_SD_init(const char *section, const int quiet)
+{
+ int ret;
+
+ info("%s: %s", Name, "$Rev: 1199 $");
+
+ /* real worker functions */
+ drv_generic_graphic_real_blit = drv_SD_blit;
+
+ /* start display */
+ if ((ret = drv_SD_start(section)) != 0)
+ return ret;
+
+ /* initialize generic graphic driver */
+ if ((ret = drv_generic_graphic_init(section, Name)) != 0)
+ return ret;
+
+ if (!quiet) {
+ char buffer[40];
+ qprintf(buffer, sizeof(buffer), "%s %dx%d", Name, DCOLS, DROWS);
+ if (drv_generic_graphic_greet(buffer, NULL)) {
+ sleep(3);
+ drv_generic_graphic_clear();
+ }
+ }
+
+ /* register plugins */
+ AddFunction("LCD::contrast", 1, plugin_contrast);
+ AddFunction("LCD::backlight", 1, plugin_backlight);
+ AddFunction("LCD::reverse", 1, plugin_reverse);
+ AddFunction("LCD::rotate", 1, plugin_rotate);
+
+ return 0;
+}
+
+
+/* close driver & display */
+int drv_SD_quit(const int quiet)
+{
+
+ info("%s: shutting down.", Name);
+
+ drv_generic_graphic_clear();
+
+ if (!quiet) {
+ drv_generic_graphic_greet("goodbye!", NULL);
+ }
+
+ drv_generic_graphic_quit();
+
+ serdisp_quit(dd);
+
+ return (0);
+}
+
+
+DRIVER drv_serdisplib = {
+ .name = Name,
+ .list = drv_SD_list,
+ .init = drv_SD_init,
+ .quit = drv_SD_quit,
+};
diff --git a/drv_st2205.c b/drv_st2205.c
new file mode 100644
index 0000000..ac758e0
--- /dev/null
+++ b/drv_st2205.c
@@ -0,0 +1,247 @@
+/* $Id: drv_st2205.c 1147 2011-07-27 02:20:51Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/drv_st2205.c $
+ *
+ * ST2205U-driven hacked picture frame driver.
+ * See http://picframe.spritesserver.nl/ for more info.
+ *
+ * Copyright (C) 2008 Jeroen Domburg <picframe@spritesmods.com>
+ * Modified from sample code by:
+ * Copyright (C) 2005 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2005, 2006, 2007 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ *
+ * exported fuctions:
+ *
+ * struct DRIVER drv_st2205
+ *
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+
+#include <st2205.h>
+
+#include "debug.h"
+#include "cfg.h"
+#include "qprintf.h"
+#include "udelay.h"
+#include "plugin.h"
+#include "widget.h"
+#include "widget_text.h"
+#include "widget_icon.h"
+#include "widget_bar.h"
+#include "drv.h"
+
+#include "drv_generic_graphic.h"
+
+static char Name[] = "st2205";
+/* libst2205 handle */
+static st2205_handle *h;
+/* Display data */
+static unsigned char *fb;
+
+static int drv_st2205_open(const char *section)
+{
+ char *dev;
+
+ dev = cfg_get(section, "Port", NULL);
+ if (dev == NULL || *dev == '\0') {
+ error("st2205: no '%s.Port' entry from %s", section, cfg_source());
+ return -1;
+ }
+
+ h = st2205_open(dev);
+ if (h == NULL) {
+ error("st2205: cannot open st2205 device %s", dev);
+ return -1;
+ }
+
+ return 0;
+}
+
+
+static int drv_st2205_close(void)
+{
+ st2205_close(h);
+
+ return 0;
+}
+
+
+static void drv_st2205_blit(const int row, const int col, const int height, const int width)
+{
+ int r, c;
+ RGBA p;
+ for (r = row; r < row + height; r++) {
+ for (c = col; c < col + width; c++) {
+ p = drv_generic_graphic_rgb(r, c);
+ fb[(r * h->width + c) * 3 + 0] = p.R;
+ fb[(r * h->width + c) * 3 + 1] = p.G;
+ fb[(r * h->width + c) * 3 + 2] = p.B;
+ }
+ }
+ st2205_send_data(h, fb);
+}
+
+
+/* start graphic display */
+static int drv_st2205_start2(const char *section)
+{
+ char *s;
+
+ s = cfg_get(section, "Font", "6x8");
+ if (s == NULL || *s == '\0') {
+ error("%s: no '%s.Font' entry from %s", Name, section, cfg_source());
+ return -1;
+ }
+
+ XRES = -1;
+ YRES = -1;
+ if (sscanf(s, "%dx%d", &XRES, &YRES) != 2 || XRES < 1 || YRES < 1) {
+ error("%s: bad Font '%s' from %s", Name, s, cfg_source());
+ return -1;
+ }
+
+ /* Fixme: provider other fonts someday... */
+ if (XRES != 6 && YRES != 8) {
+ error("%s: bad Font '%s' from %s (only 6x8 at the moment)", Name, s, cfg_source());
+ return -1;
+ }
+
+
+ /* open communication with the display */
+ if (drv_st2205_open(section) < 0) {
+ return -1;
+ }
+
+ /* you surely want to allocate a framebuffer or something... */
+ fb = malloc(h->height * h->width * 3);
+
+ /* set width/height from st2205 firmware specs */
+ DROWS = h->height;
+ DCOLS = h->width;
+
+ return 0;
+}
+
+/****************************************/
+/*** plugins ***/
+/****************************************/
+
+static void plugin_backlight(RESULT * result, RESULT * arg1)
+{
+ int bl_on;
+ bl_on = (R2N(arg1) == 0 ? 0 : 1);
+ st2205_backlight(h, bl_on);
+ SetResult(&result, R_NUMBER, &bl_on);
+}
+
+
+/****************************************/
+/*** widget callbacks ***/
+/****************************************/
+
+
+/* using drv_generic_text_draw(W) */
+/* using drv_generic_text_icon_draw(W) */
+/* using drv_generic_text_bar_draw(W) */
+/* using drv_generic_gpio_draw(W) */
+
+
+/****************************************/
+/*** exported functions ***/
+/****************************************/
+
+
+/* list models */
+int drv_st2205_list(void)
+{
+ printf("generic hacked photo frame");
+ return 0;
+}
+
+
+/* initialize driver & display */
+int drv_st2205_init2(const char *section, const int quiet)
+{
+ int ret;
+
+ /* real worker functions */
+ drv_generic_graphic_real_blit = drv_st2205_blit;
+
+ /* start display */
+ if ((ret = drv_st2205_start2(section)) != 0)
+ return ret;
+
+ /* initialize generic graphic driver */
+ if ((ret = drv_generic_graphic_init(section, Name)) != 0)
+ return ret;
+
+ if (!quiet) {
+ char buffer[40];
+ qprintf(buffer, sizeof(buffer), "%s %dx%d", Name, DCOLS, DROWS);
+ if (drv_generic_graphic_greet(buffer, NULL)) {
+ sleep(3);
+ drv_generic_graphic_clear();
+ }
+ }
+
+ /* register plugins */
+ AddFunction("LCD::backlight", 1, plugin_backlight);
+
+ return 0;
+}
+
+
+/* close driver & display */
+int drv_st2205_quit2(const int quiet)
+{
+ info("%s: shutting down.", Name);
+
+ /* clear display */
+ drv_generic_graphic_clear();
+
+ /* say goodbye... */
+ if (!quiet) {
+ drv_generic_graphic_greet("goodbye!", NULL);
+ }
+
+ drv_generic_graphic_quit();
+
+ debug("closing connection");
+ drv_st2205_close();
+
+ return (0);
+}
+
+
+DRIVER drv_st2205 = {
+ .name = Name,
+ .list = drv_st2205_list,
+ .init = drv_st2205_init2,
+ .quit = drv_st2205_quit2,
+};
diff --git a/drv_ula200.c b/drv_ula200.c
new file mode 100644
index 0000000..7c71995
--- /dev/null
+++ b/drv_ula200.c
@@ -0,0 +1,791 @@
+/* $Id: drv_ula200.c 1126 2010-07-13 03:25:44Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/drv_ula200.c $
+ *
+ * ULA200 driver for lcd4linux
+ *
+ * Copyright (C) 2008 Bernhard Walle <bernhard.walle@gmx.de>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ * Driver for the ELV ULA200 USB device. The device can control one
+ * HD44780 display up to 4x20 characters.
+ *
+ * Implemented functions:
+ * - displaying characters :-)
+ * - controlling the backlight
+ *
+ * Todo:
+ * - input buttons
+ *
+ * Configuration:
+ * - Size (XxY): size of the display (e.g. '20x4')
+ * - Backlight (0/1): initial state of the backlight
+ *
+ * Author:
+ * Bernhard Walle <bernhard.walle@gmx.de>
+ *
+ * exported fuctions:
+ * struct DRIVER drv_ula200
+ *
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+
+#include <ftdi.h>
+
+#include "debug.h"
+#include "cfg.h"
+#include "qprintf.h"
+#include "udelay.h"
+#include "plugin.h"
+#include "widget.h"
+#include "widget_text.h"
+#include "widget_icon.h"
+#include "widget_bar.h"
+#include "drv.h"
+
+/* text mode display? */
+#include "drv_generic_text.h"
+
+/****************************************/
+/*** Global variables ***/
+/****************************************/
+
+static char Name[] = "ULA200";
+static struct ftdi_context *Ftdi = NULL;
+
+
+/****************************************/
+/*** Constants ***/
+/****************************************/
+
+/* USB connection */
+#define ULA200_VENDOR_ID 0x0403
+#define ULA200_PRODUCT_ID 0xf06d
+
+/* connection parameters */
+#define ULA200_BAUDRATE 19200
+#define ULA200_DATABITS BITS_8
+#define ULA200_STOPBITS STOP_BIT_1
+#define ULA200_PARITY EVEN
+
+/* character constants used for the communication */
+#define ULA200_CH_STX 0x02
+#define ULA200_CH_ETX 0x03
+#define ULA200_CH_ENQ 0x05
+#define ULA200_CH_ACK 0x06
+#define ULA200_CH_NAK 0x15
+#define ULA200_CH_DC2 0x12
+#define ULA200_CH_DC3 0x13
+
+/* commands used for the communication (names are German) */
+#define ULA200_CMD_POSITION 'p' /* 'position' */
+#define ULA200_CMD_STRING 's' /* 'string' */
+#define ULA200_CMD_CLEAR 'l' /* 'loeschen' */
+#define ULA200_CMD_BACKLIGHT 'h' /* 'hintergrund' */
+#define ULA200_CMD_CHAR 'c' /* 'character' */
+
+/* raw register access */
+#define ULA200_RS_DATA 0x00 /* data */
+#define ULA200_RS_INSTR 0x01 /* instruction */
+#define ULA200_SETCHAR 0x40 /* set user-defined character */
+
+/* character sizes */
+#define ULA200_CELLWIDTH 5
+#define ULA200_CELLHEIGHT 8
+
+/* internal implementation constants */
+#define ULA200_BUFFER_LENGTH 1024
+#define ULA200_MAXLEN 512
+#define ULA200_MAX_REPEATS 20
+
+/* define TRUE and FALSE for better code readability if not already defined */
+#ifndef TRUE
+#define TRUE 1
+#endif
+#ifndef FALSE
+#define FALSE 0
+#endif
+
+
+/****************************************/
+/*** Macros ***/
+/****************************************/
+
+#define ULA200_ERROR(msg, ...) \
+ error("%s: In %s():%d: " msg, Name, \
+ __FUNCTION__, __LINE__, ##__VA_ARGS__)
+
+#define ULA200_INFO(msg, ...) \
+ info("%s: " msg, Name, ##__VA_ARGS__)
+
+#define ULA200_DEBUG(msg, ...) \
+ debug("%s: In %s():%d: " msg, Name, \
+ __FUNCTION__, __LINE__, ##__VA_ARGS__)
+
+#define ULA200_TRACE() \
+ debug("%s: Calling %s()", Name, __FUNCTION__)
+
+
+/****************************************/
+/*** Prototypes ***/
+/****************************************/
+
+static int drv_ula200_ftdi_read_response(void);
+static int drv_ula200_ftdi_usb_read(void);
+static int drv_ula200_ftdi_write_command(const unsigned char *, int);
+static int drv_ula200_backlight(int);
+static int drv_ula200_close(void);
+
+static void plugin_backlight(RESULT *, RESULT *);
+
+/****************************************/
+/*** Internal (helper) funcs ***/
+/****************************************/
+
+/**
+ * Write a command to the display. Adds the STX and ETX header/trailer.
+ *
+ * @param[in] data the data bytes
+ * @param[in] length the number of bytes in data which are valid
+ * @return 0 on success, negative value on error
+ */
+static int drv_ula200_ftdi_write_command(const unsigned char *data, int length)
+{
+ int i, err;
+ int repeat_count = 0;
+ int pos = 0;
+ unsigned char buffer[ULA200_BUFFER_LENGTH];
+
+ /* check for the maximum length */
+ if (length > ULA200_MAXLEN) {
+ return -EINVAL;
+ }
+
+ /* fill the array */
+ buffer[pos++] = ULA200_CH_STX;
+ for (i = 0; i < length; i++) {
+ if (data[i] == ULA200_CH_STX) {
+ buffer[pos++] = ULA200_CH_ENQ;
+ buffer[pos++] = ULA200_CH_DC2;
+ } else if (data[i] == ULA200_CH_ETX) {
+ buffer[pos++] = ULA200_CH_ENQ;
+ buffer[pos++] = ULA200_CH_DC3;
+ } else if (data[i] == ULA200_CH_ENQ) {
+ buffer[pos++] = ULA200_CH_ENQ;
+ buffer[pos++] = ULA200_CH_NAK;
+ } else {
+ buffer[pos++] = data[i];
+ }
+ }
+ buffer[pos++] = ULA200_CH_ETX;
+
+ do {
+ /* ULA200_DEBUG("ftdi_write_data(%p, %d)", buffer, pos); */
+ err = ftdi_write_data(Ftdi, buffer, pos);
+ if (err < 0) {
+ ULA200_ERROR("ftdi_write_data() failed");
+ return -1;
+ }
+ }
+ while (!drv_ula200_ftdi_read_response() && (repeat_count++ < ULA200_MAX_REPEATS));
+
+ return 0;
+}
+
+/**
+ * Reads a character from USB.
+ *
+ * @return a positive value between 0 and 255 indicates the character that
+ * has been read successfully, -1 indicates an error
+ */
+static int drv_ula200_ftdi_usb_read(void)
+{
+ unsigned char buffer[1];
+ int err;
+
+ while ((err = ftdi_read_data(Ftdi, buffer, 1)) == 0);
+ return err >= 0 ? buffer[0] : -1;
+}
+
+
+/**
+ * Reads the response of the display. Currently, key input is ignored
+ * and only ACK / NACK is read.
+ *
+ * @return TRUE on success (ACK), FALSE on failure (NACK)
+ */
+static int drv_ula200_ftdi_read_response(void)
+{
+ int result = FALSE;
+ int answer_read = FALSE;
+ int ret;
+ int ch;
+
+ while (!answer_read) {
+ /* wait until STX */
+ do {
+ ret = drv_ula200_ftdi_usb_read();
+ /* ULA200_DEBUG("STX drv_ula200_ftdi_usb_read = %d", ret); */
+ } while ((ret != ULA200_CH_STX) && (ret > 0));
+
+ if (ret < 0) {
+ return FALSE;
+ }
+
+ /* read next char */
+ ch = drv_ula200_ftdi_usb_read();
+ /* ULA200_DEBUG("drv_ula200_ftdi_usb_read = %d", ch); */
+
+ switch (ch) {
+ case 't':
+ ch = drv_ula200_ftdi_usb_read();
+ /* ULA200_DEBUG("drv_ula200_ftdi_usb_read = %d", ch); */
+ /* ignore currently */
+ break;
+
+ case ULA200_CH_ACK:
+ answer_read = TRUE;
+ result = TRUE;
+ break;
+
+ case ULA200_CH_NAK:
+ answer_read = TRUE;
+ result = FALSE;
+ break;
+
+ default:
+ answer_read = TRUE;
+ ULA200_ERROR("Read invalid answer");
+ }
+
+ /* wait until ETX */
+ do {
+ ret = drv_ula200_ftdi_usb_read();
+ /* ULA200_DEBUG("ETX drv_ula200_ftdi_usb_read = %d", ret); */
+ } while ((ret != ULA200_CH_ETX) && (ret > 0));
+
+ if (ret < 0) {
+ return FALSE;
+ }
+ }
+
+ return result;
+}
+
+static int drv_ula200_ftdi_enable_raw_mode(void)
+{
+ unsigned char command[3];
+
+ command[0] = 'R';
+ command[1] = 'E';
+ command[2] = '1';
+ return drv_ula200_ftdi_write_command(command, 3);
+}
+
+
+/**
+ * Writes raw data (access the HD44780 registers directly.
+ *
+ * @param[in] flags ULA200_RS_DATA or ULA200_RS_INSTR
+ * @param[in] ch the real data
+ * @return 0 on success, a negative value on error
+ */
+static int drv_ula200_ftdi_rawdata(unsigned char flags, unsigned char ch)
+{
+ unsigned char command[3];
+ int err;
+
+ command[0] = 'R';
+ command[1] = flags == ULA200_RS_DATA ? '2' : '0';
+ command[2] = ch;
+ err = drv_ula200_ftdi_write_command(command, 3);
+ if (err < 0) {
+ ULA200_ERROR("ula200_ftdi_write_command() failed");
+ return -1;
+ }
+
+ return 0;
+}
+
+/**
+ * Sets the cursor position.
+ *
+ * @param[in] x the x coordinate of the position
+ * @param[in] y the y coordinate of the position
+ * @return 0 on success, a negative value on error
+ */
+static int drv_ula200_set_position(int x, int y)
+{
+ unsigned char command[3];
+ int err;
+
+ if (y >= 2) {
+ y -= 2;
+ x += DCOLS; /* XXX: multiply by 2? */
+ }
+
+ command[0] = ULA200_CMD_POSITION;
+ command[1] = x;
+ command[2] = y;
+ err = drv_ula200_ftdi_write_command(command, 3);
+ if (err < 0) {
+ ULA200_ERROR("ula200_ftdi_write_command() failed");
+ }
+
+ return err;
+}
+
+/**
+ * Sends the text
+ *
+ * @param[in] data the data bytes
+ * @param[in] len the number of valid bytes in @p data
+ * @return 0 on success, a negative value on error
+ */
+static int drv_ula200_send_text(const unsigned char *data, int len)
+{
+ unsigned char buffer[ULA200_BUFFER_LENGTH];
+ int err;
+
+ if (len > ULA200_MAXLEN) {
+ return -EINVAL;
+ }
+
+ buffer[0] = ULA200_CMD_STRING;
+ buffer[1] = len;
+ memcpy(buffer + 2, data, len);
+ buffer[2 + len] = 0; /* only necessary for the debug message */
+
+ /* ULA200_DEBUG("Text: =%s= (%d)", buffer+2, len); */
+
+ err = drv_ula200_ftdi_write_command(buffer, len + 2);
+ if (err < 0) {
+ ULA200_ERROR("ula200_ftdi_write_command() failed");
+ return -1;
+ }
+
+ return 0;
+}
+
+/**
+ * Sends one character.
+ *
+ * @param[in] ch the character to send
+ * @return 0 on success, a negative value on error
+ */
+static int drv_ula200_send_char(char ch)
+{
+ unsigned char buffer[2];
+ int err;
+
+ buffer[0] = ULA200_CMD_CHAR;
+ buffer[1] = ch;
+
+ err = drv_ula200_ftdi_write_command(buffer, 2);
+ if (err < 0) {
+ ULA200_ERROR("ula200_ftdi_write_command() failed");
+ return -1;
+ }
+
+ return 0;
+}
+
+/**
+ * Opens the ULA200 display. Uses libftdi to initialise the USB communication to
+ * the display.
+ *
+ @ @return a value less then zero on failure, 0 on success
+ */
+static int drv_ula200_open(void)
+{
+ int err;
+
+ /* check if the device was already open */
+ if (Ftdi != NULL) {
+ ULA200_ERROR("open called although device was already open");
+ drv_ula200_close();
+ }
+
+ /* get memory for the device descriptor */
+ Ftdi = malloc(sizeof(struct ftdi_context));
+ if (Ftdi == NULL) {
+ ULA200_ERROR("Memory allocation failed");
+ return -1;
+ }
+
+ /* open the ftdi library */
+ ftdi_init(Ftdi);
+ Ftdi->usb_write_timeout = 20;
+ Ftdi->usb_read_timeout = 20;
+
+ /* open the device */
+ err = ftdi_usb_open(Ftdi, ULA200_VENDOR_ID, ULA200_PRODUCT_ID);
+ if (err < 0) {
+ ULA200_ERROR("ftdi_usb_open() failed");
+ free(Ftdi);
+ Ftdi = NULL;
+ return -1;
+ }
+
+ /* set the baudrate */
+ err = ftdi_set_baudrate(Ftdi, ULA200_BAUDRATE);
+ if (err < 0) {
+ ULA200_ERROR("ftdi_set_baudrate() failed");
+ ftdi_usb_close(Ftdi);
+ free(Ftdi);
+ Ftdi = NULL;
+ return -1;
+ }
+ /* set communication parameters */
+ err = ftdi_set_line_property(Ftdi, ULA200_DATABITS, ULA200_STOPBITS, ULA200_PARITY);
+ if (err < 0) {
+ ULA200_ERROR("ftdi_set_line_property() failed");
+ ftdi_usb_close(Ftdi);
+ free(Ftdi);
+ Ftdi = NULL;
+ return -1;
+ }
+
+ return 0;
+}
+
+/**
+ * Closes the display.
+ *
+ * @return 0 on success, a negative value on failure
+ */
+static int drv_ula200_close(void)
+{
+ ULA200_TRACE();
+
+ ftdi_usb_purge_buffers(Ftdi);
+ ftdi_usb_close(Ftdi);
+ ftdi_deinit(Ftdi);
+
+ free(Ftdi);
+ Ftdi = NULL;
+
+ return 0;
+}
+
+/**
+ * Clears the contents of the display.
+ *
+ * @return 0 on success, a negative value on error
+ */
+static void drv_ula200_clear(void)
+{
+ unsigned const char command[] = { ULA200_CMD_CLEAR };
+ int err;
+
+ ULA200_TRACE();
+
+ err = drv_ula200_ftdi_write_command(command, 1);
+ if (err < 0) {
+ ULA200_ERROR("ula200_ftdi_write_command() failed");
+ }
+}
+
+/**
+ * Writes data to the display.
+ *
+ * @param[in] row the row where the data should be written to
+ * @param[in] col the column where the data should be written to
+ * @param[in] data the data that should actually be written
+ * @param[in] len the number of valid bytes in @p data
+ */
+static void drv_ula200_write(const int row, const int col, const char *data, int len)
+{
+ int ret;
+
+ /* do the cursor positioning here */
+ ret = drv_ula200_set_position(col, row);
+ if (ret < 0) {
+ ULA200_ERROR("drv_ula200_set_position() failed");
+ return;
+ }
+
+ /* send string to the display */
+ if (len == 1) {
+ ret = drv_ula200_send_char(data[0]);
+ } else {
+ ret = drv_ula200_send_text((unsigned char *) data, len);
+ }
+ if (ret < 0) {
+ ULA200_ERROR("drv_ula200_send_text() failed");
+ return;
+ }
+}
+
+/* text mode displays only */
+static void drv_ula200_defchar(const int ascii, const unsigned char *matrix)
+{
+ int err, i;
+
+ if (ascii >= 8) {
+ ULA200_ERROR("Invalid value in drv_ula200_defchar");
+ return;
+ }
+
+ /* Tell the HD44780 we will redefine char number 'ascii' */
+ err = drv_ula200_ftdi_rawdata(ULA200_RS_INSTR, ULA200_SETCHAR | (ascii * 8));
+ if (err < 0) {
+ ULA200_ERROR("drv_ula200_ftdi_rawdata() failed");
+ return;
+ }
+
+ /* Send the subsequent rows */
+ for (i = 0; i < YRES; i++) {
+ err = drv_ula200_ftdi_rawdata(ULA200_RS_DATA, *matrix++ & 0x1f);
+ if (err < 0) {
+ ULA200_ERROR("ula200_ftdi_rawdata() failed");
+ return;
+ }
+ }
+}
+
+/**
+ * Controls the backlight of the ULA200 display.
+ *
+ * @param[in] backlight a negative value if the backlight should be turned off,
+ * a positive value if it should be turned on
+ * @return 0 on success, any other value on failure
+ */
+static int drv_ula200_backlight(int backlight)
+{
+ unsigned char cmd[2] = { ULA200_CMD_BACKLIGHT };
+ int ret;
+
+ if (backlight <= 0) {
+ backlight = '0';
+ } else {
+ backlight = '1';
+ }
+
+ cmd[1] = backlight;
+ ret = drv_ula200_ftdi_write_command(cmd, 2);
+ if (ret < 0) {
+ ULA200_ERROR("ula200_ftdi_write_command() failed");
+ }
+
+ return backlight == '1';
+}
+
+/**
+ * Starts the display.
+ *
+ * @param[in] section the section of the configuration file
+ * @return 0 on success, a negative value on failure
+ */
+static int drv_ula200_start(const char *section)
+{
+ int rows = -1, cols = -1;
+ char *s;
+ int backlight = 0;
+ int err;
+
+ s = cfg_get(section, "Size", NULL);
+ if (s == NULL || *s == '\0') {
+ ULA200_ERROR("No '%s.Size' entry from %s", section, cfg_source());
+ return -1;
+ }
+ if (sscanf(s, "%dx%d", &cols, &rows) != 2 || rows < 1 || cols < 1) {
+ ULA200_ERROR("Bad %s.Size '%s' from %s", section, s, cfg_source());
+ free(s);
+ return -1;
+ }
+
+ DROWS = rows;
+ DCOLS = cols;
+
+ /* open communication with the display */
+ err = drv_ula200_open();
+ if (err < 0) {
+ return -1;
+ }
+
+ cfg_number(section, "Backlight", 0, 0, 1, &backlight);
+ err = drv_ula200_backlight(backlight);
+ if (err < 0) {
+ ULA200_ERROR("drv_ula200_backlight() failed");
+ return -1;
+ }
+
+ /* clear display */
+ drv_ula200_clear();
+
+ /* enable raw mode for defining own chars */
+ drv_ula200_ftdi_enable_raw_mode();
+
+ return 0;
+}
+
+/****************************************/
+/*** plugins ***/
+/****************************************/
+
+/**
+ * Backlight plugin
+ */
+static void plugin_backlight(RESULT * result, RESULT * arg1)
+{
+ double backlight;
+
+ backlight = drv_ula200_backlight(R2N(arg1));
+ SetResult(&result, R_NUMBER, &backlight);
+}
+
+/****************************************/
+/*** exported functions ***/
+/****************************************/
+
+/**
+ * list models
+ *
+ * @return 0 on success, a negative value on failure
+ */
+int drv_ula200_list(void)
+{
+ printf("ULA200");
+ return 0;
+}
+
+/**
+ * initialize driver & display
+ *
+ * @param[in] section the name of the section in the configuration file
+ * @param[in] quiet TRUE on quiet mode
+ * @return 0 on success, any negative error value on failure
+ */
+/* use this function for a text display */
+int drv_ula200_init(const char *section, const int quiet)
+{
+ WIDGET_CLASS wc;
+ int ret;
+
+ ULA200_INFO("%s", "$Rev: 1126 $");
+
+ /* display preferences */
+ XRES = ULA200_CELLWIDTH; /* pixel width of one char */
+ YRES = ULA200_CELLHEIGHT; /* pixel height of one char */
+ CHARS = 7; /* number of user-defineable characters */
+ CHAR0 = 1; /* ASCII of first user-defineable char */
+ GOTO_COST = 4; /* number of bytes a goto command requires */
+
+ /* real worker functions */
+ drv_generic_text_real_write = drv_ula200_write;
+ drv_generic_text_real_defchar = drv_ula200_defchar;
+
+ /* start display */
+ if ((ret = drv_ula200_start(section)) != 0) {
+ return ret;
+ }
+
+ if (!quiet) {
+ char buffer[40];
+ qprintf(buffer, sizeof(buffer), "%s %dx%d", Name, DCOLS, DROWS);
+ if (drv_generic_text_greet(buffer, "ULA 200")) {
+ sleep(3);
+ drv_ula200_clear();
+ }
+ }
+
+ /* initialize generic text driver */
+ if ((ret = drv_generic_text_init(section, Name)) != 0)
+ return ret;
+
+ /* initialize generic icon driver */
+ if ((ret = drv_generic_text_icon_init()) != 0)
+ return ret;
+
+ /* initialize generic bar driver */
+ if ((ret = drv_generic_text_bar_init(0)) != 0)
+ return ret;
+
+ /* add fixed chars to the bar driver */
+ drv_generic_text_bar_add_segment(0, 0, 255, 32); /* ASCII 32 = blank */
+
+ /* register text widget */
+ wc = Widget_Text;
+ wc.draw = drv_generic_text_draw;
+ widget_register(&wc);
+
+ /* register icon widget */
+ wc = Widget_Icon;
+ wc.draw = drv_generic_text_icon_draw;
+ widget_register(&wc);
+
+ /* register bar widget */
+ wc = Widget_Bar;
+ wc.draw = drv_generic_text_bar_draw;
+ widget_register(&wc);
+
+ /* register plugins */
+ AddFunction("LCD::backlight", -1, plugin_backlight);
+
+ return 0;
+}
+
+/**
+ * close driver & display
+ *
+ * @param[in] quiet TRUE on quiet mode
+ * @return 0 on success, any negative error value on failure
+ */
+/* use this function for a text display */
+int drv_ula200_quit(int quiet)
+{
+ ULA200_INFO("shutting down.");
+
+ drv_generic_text_quit();
+
+ /* turn backlight off */
+ drv_ula200_backlight(0);
+
+ /* clear display */
+ drv_ula200_clear();
+
+ /* say goodbye... */
+ if (!quiet) {
+ drv_generic_text_greet("goodbye!", NULL);
+ }
+
+ debug("closing connection");
+ drv_ula200_close();
+
+ return 0;
+}
+
+/* use this one for a text display */
+DRIVER drv_ula200 = {
+ .name = Name,
+ .list = drv_ula200_list,
+ .init = drv_ula200_init,
+ .quit = drv_ula200_quit,
+};
+
+/* :indentSize=4:tabSize=8:noTabs=false: */
diff --git a/drv_vnc.c b/drv_vnc.c
new file mode 100644
index 0000000..5249206
--- /dev/null
+++ b/drv_vnc.c
@@ -0,0 +1,547 @@
+/* $Id: drv_vnc.c 1031 2009-04-15 21:34:51Z michux $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/drv_vnc.c $
+ *
+ * Libvncserver driver
+ *
+ * Copyright (C) 2009 Michael Vogt <michu@neophob.com>
+ * Modified from sample code by:
+ * Copyright (C) 2005 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2005, 2006, 2007, 2008, 2009 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ *
+ * exported fuctions:
+ *
+ * struct DRIVER drv_vnc
+ *
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+
+#include <rfb/rfb.h>
+
+/* struct timeval */
+#include <sys/time.h>
+
+#include "debug.h"
+#include "cfg.h"
+#include "qprintf.h"
+#include "udelay.h"
+#include "plugin.h"
+#include "widget.h"
+#include "widget_text.h"
+#include "widget_icon.h"
+#include "widget_bar.h"
+#include "widget_keypad.h"
+#include "drv.h"
+#include "drv_generic_graphic.h"
+#include "drv_generic_keypad.h"
+
+//todo: key widget text
+
+#define NO_MOUSE_BUTTON_PRESSED 0
+#define LEFT_MOUSE_BUTTON_PRESSED 1
+#define SLEEP_STEPS 1000
+
+static char Name[] = "VNC";
+
+static int xres = 320; /* screen settings */
+static int yres = 200;
+static int BPP = 4;
+static int max_clients = 2; /* max connected clients */
+static int osd_showtime = 2000; /* time to display the osd in ms */
+static int buttons = 2; /* number of keypad buttons */
+static int buttonsize = 50; /* size of keypad buttons */
+static int keypadxofs = 0;
+static int keypadyofs = 0;
+static int keypadgap = 0;
+static int port = 5900;
+static int httpPort = 5800;
+static unsigned char framer = 0;
+static unsigned char frameg = 0;
+static unsigned char frameb = 0;
+
+static rfbScreenInfoPtr server; /* vnc device */
+static struct timeval osd_timestamp;
+static int show_keypad_osd = 0; /* is the osd active? */
+static int clientCount = 0; /* currently connected clients */
+static int mouse_x = 0;
+static int mouse_y = 0;
+static int mouse_stat_old = 0;
+static int process_event = 0;
+static long frames = 0;
+static char *password;
+static char *javaClassFiles;
+static struct timeval startDriver;
+static int maxfps = -1;
+
+/* draws a simple rect, used to display keypad */
+int draw_rect(int x, int y, int size, unsigned char col, char *buffer)
+{
+ int ofs, ofs2, i, ret;
+ unsigned char colr, colg;
+ colr = colg = col;
+ ret = 0;
+
+ /* check if mouse is in current rect */
+ if (mouse_x > x && mouse_x < (x + size))
+ if (mouse_y > y && mouse_y < (y + size)) {
+ colr = framer;
+ colg = frameg;
+ col = frameb;
+ ret = 1;
+ }
+
+ ofs2 = size * xres * BPP;
+ for (i = x; i < x + size; i++) {
+ ofs = (i + xres * y) * BPP;
+ buffer[ofs + ofs2] = colr;
+ buffer[ofs++] = colr;
+ buffer[ofs + ofs2] = colg;
+ buffer[ofs++] = colg;
+ buffer[ofs + ofs2] = col;
+ buffer[ofs++] = col;
+ }
+
+ ofs2 = size * BPP;
+ for (i = y; i <= y + size; i++) {
+ ofs = (i * xres + x) * BPP;
+ buffer[ofs + ofs2] = colr;
+ buffer[ofs++] = colr;
+ buffer[ofs + ofs2] = colg;
+ buffer[ofs++] = colg;
+ buffer[ofs + ofs2] = col;
+ buffer[ofs++] = col;
+ }
+ return ret;
+}
+
+void display_keypad()
+{
+ int i, rectx, recty;
+ int active;
+ for (i = 0; i < buttons; i++) {
+ rectx = keypadxofs + (i * (buttonsize + keypadgap));
+ recty = keypadyofs /*+ (i*(buttonsize+gap)) */ ;
+ active = draw_rect(rectx, recty, buttonsize, 0, server->frameBuffer);
+
+ /* if the lmb button is pressed and we didnt processed the event yet - do it now */
+ if (active == 1 && process_event == 1) {
+ drv_generic_keypad_press(i + 1);
+ //debug("mouse in keypad nr %d", i);
+ process_event = 0;
+ }
+ }
+}
+
+/* called if a vnc client disconnects */
+static void clientgone( __attribute__ ((unused)) rfbClientPtr cl)
+{
+ if (clientCount > 0)
+ clientCount--;
+ debug("%d clients connected", clientCount);
+}
+
+/* called if a vnc client connect */
+static enum rfbNewClientAction hook_newclient(rfbClientPtr cl)
+{
+ if (clientCount < max_clients) {
+ clientCount++;
+ cl->clientGoneHook = clientgone;
+ debug("%d clients connected", clientCount);
+ return RFB_CLIENT_ACCEPT;
+ } else {
+ info("client refused due max. client connections (%d)", clientCount);
+ return RFB_CLIENT_REFUSE;
+ }
+}
+
+/* handle mouse action */
+static void hook_mouseaction(int buttonMask, int x, int y, rfbClientPtr cl)
+{
+ if (x >= 0 && y >= 0 && x < xres && y < yres) {
+ process_event = 0;
+
+ /* process ONLY if mouse button is released. */
+ if (buttonMask == NO_MOUSE_BUTTON_PRESSED && mouse_stat_old == LEFT_MOUSE_BUTTON_PRESSED) {
+ gettimeofday(&osd_timestamp, NULL);
+ process_event = 1;
+ mouse_x = x;
+ mouse_y = y;
+ }
+ //debug("btnMask: %d, old state: %d, processevent: %d", buttonMask, mouse_stat_old, process_event);
+
+ /* show osd display if mouse is pressed */
+ if (buttonMask == 1) {
+ gettimeofday(&osd_timestamp, NULL);
+ mouse_x = x;
+ mouse_y = y;
+ if (show_keypad_osd == 0) {
+ /* no osd until yet, activate osd keypad ... */
+ show_keypad_osd = 1;
+ }
+ }
+
+ }
+
+ mouse_stat_old = buttonMask;
+ rfbDefaultPtrAddEvent(buttonMask, x, y, cl);
+}
+
+static int drv_vnc_keypad(const int num)
+{
+ int val = WIDGET_KEY_PRESSED;
+
+ switch (num) {
+ case 1:
+ val += WIDGET_KEY_UP;
+ break;
+ case 2:
+ val += WIDGET_KEY_DOWN;
+ break;
+ case 3:
+ val += WIDGET_KEY_LEFT;
+ break;
+ case 4:
+ val += WIDGET_KEY_RIGHT;
+ break;
+ case 5:
+ val += WIDGET_KEY_CONFIRM;
+ break;
+ case 6:
+ val += WIDGET_KEY_CANCEL;
+ break;
+ default:
+ error("%s: unknown keypad value %d", Name, num);
+ }
+
+ return val;
+}
+
+/* init the driver, read config */
+static int drv_vnc_open(const char *Section)
+{
+ int keypadcol;
+ if (cfg_number(Section, "Xres", 320, 32, 2048, &xres) < 1) {
+ info("[DRV_VNC] no '%s.Xres' entry from %s using default %d", Section, cfg_source(), xres);
+ }
+ if (cfg_number(Section, "Yres", 200, 32, 2048, &yres) < 1) {
+ info("[DRV_VNC] no '%s.Yres' entry from %s using default %d", Section, cfg_source(), yres);
+ }
+ if (cfg_number(Section, "Bpp", 4, 1, 4, &BPP) < 1) {
+ info("[DRV_VNC] no '%s.Bpp' entry from %s using default %d", Section, cfg_source(), BPP);
+ }
+ if (cfg_number(Section, "Maxclients", 2, 1, 64, &max_clients) < 1) {
+ info("[DRV_VNC] no '%s.Maxclients' entry from %s using default %d", Section, cfg_source(), max_clients);
+ }
+ if (cfg_number(Section, "Osd_showtime", 2000, 500, 60000, &osd_showtime) < 1) {
+ info("[DRV_VNC] no '%s.Osd_showtime' entry from %s using default %d", Section, cfg_source(), osd_showtime);
+ }
+ if (cfg_number(Section, "Buttons", 2, 0, 6, &buttons) < 1) {
+ info("[DRV_VNC] no '%s.Buttons' entry from %s using default %d", Section, cfg_source(), buttons);
+ }
+ if (cfg_number(Section, "Buttonsize", 50, 8, 256, &buttonsize) < 1) {
+ info("[DRV_VNC] no '%s.Buttonsize' entry from %s using default %d", Section, cfg_source(), buttonsize);
+ }
+ if (cfg_number(Section, "Keypadxofs", 0, 0, 4096, &keypadxofs) < 1) {
+ info("[DRV_VNC] no '%s.Keypadxofs' entry from %s using default %d", Section, cfg_source(), keypadxofs);
+ }
+ if (cfg_number(Section, "Keypadyofs", 0, 0, 4096, &keypadyofs) < 1) {
+ info("[DRV_VNC] no '%s.Keypadyofs' entry from %s using default %d", Section, cfg_source(), keypadyofs);
+ }
+ if (cfg_number(Section, "Keypadgap", 10, 0, 2048, &keypadgap) < 1) {
+ info("[DRV_VNC] no '%s.Keypadgap' entry from %s using default %d", Section, cfg_source(), keypadgap);
+ }
+ if (cfg_number(Section, "Keypadcol", 255, 0, 0xffffff, &keypadcol) < 1) {
+ info("[DRV_VNC] no '%s.Keypadcol' entry from %s using default red", Section, cfg_source());
+ framer = 255;
+ } else {
+ framer = keypadcol & 0xff;
+ frameg = (keypadcol & 0xff00) >> 8;
+ frameb = (keypadcol & 0xff0000) >> 16;
+ }
+ if (cfg_number(Section, "Port", 5900, 1, 65535, &port) < 1) {
+ info("[DRV_VNC] no '%s.Port' entry from %s using default %d", Section, cfg_source(), port);
+ }
+ if (cfg_number(Section, "HttpPort", 5800, 1, 65535, &httpPort) < 1) {
+ info("[DRV_VNC] no '%s.HttpPort' entry from %s using default %d", Section, cfg_source(), httpPort);
+ }
+ if (cfg_number(Section, "Maxfps", -1, -1, 512, &maxfps) < 1) {
+ info("[DRV_VNC] no '%s.Maxfps' entry from %s using default %d", Section, cfg_source(), maxfps);
+ }
+ password = cfg_get(Section, "Password", NULL);
+ if (password != NULL) {
+ info("[DRV_VNC] password enabled");
+ }
+ javaClassFiles = cfg_get(Section, "HttpDir", NULL);
+ if (javaClassFiles != NULL) {
+ info("[DRV_VNC] HTTP server enabled");
+ }
+ return 0;
+}
+
+/* shutdown driver, release allocated stuff */
+static int drv_vnc_close(void)
+{
+ rfbShutdownServer(server, TRUE);
+ free(server->frameBuffer);
+ return 0;
+}
+
+
+/* actual blitting method */
+static void drv_vnc_blit_it(const int row, const int col, const int height, const int width, unsigned char *buffer)
+{
+ static int sleep = 0;
+ int r, c, ofs;
+ RGBA p;
+
+ for (r = row; r < row + height; r++) {
+ for (c = col; c < col + width; c++) {
+ p = drv_generic_graphic_rgb(r, c);
+ ofs = (r * xres + c) * BPP;
+ buffer[ofs++] = p.R;
+ buffer[ofs++] = p.G;
+ buffer[ofs++] = p.B;
+ buffer[ofs] = 255;
+ }
+ }
+
+ /* display osd keypad */
+ if (show_keypad_osd == 1) {
+ display_keypad();
+
+ /* check if the osd should be disabled after the waittime */
+ struct timeval now;
+ gettimeofday(&now, NULL);
+ int timedelta = (now.tv_sec - osd_timestamp.tv_sec) * 1000 + (now.tv_usec - osd_timestamp.tv_usec) / 1000;
+
+ if (timedelta > osd_showtime) {
+ show_keypad_osd = 0;
+ }
+ }
+ frames++;
+ if ((frames % 10) == 0 && maxfps > 0) {
+ struct timeval blittime;
+ gettimeofday(&blittime, NULL);
+ int time_since_start =
+ (blittime.tv_sec - startDriver.tv_sec) * 1000 + (blittime.tv_usec - startDriver.tv_usec) / 1000;
+
+ /* if time changed since start of lcd4linux */
+ if (time_since_start < 0) {
+ gettimeofday(&startDriver, NULL);
+ time_since_start =
+ (blittime.tv_sec - startDriver.tv_sec) * 1000 + (blittime.tv_usec - startDriver.tv_usec) / 1000;
+ if (time_since_start == 0)
+ time_since_start = 1;
+ }
+ //info("time :%d, frames: %d, sleep: %d", time_since_start, frames, sleep);
+
+ int fps = (int) (1000 * frames / time_since_start);
+
+ if (fps > maxfps) {
+ sleep += SLEEP_STEPS;
+ }
+
+ if (fps < maxfps && sleep >= SLEEP_STEPS) {
+ sleep -= SLEEP_STEPS;
+ }
+ }
+ usleep(sleep);
+
+}
+
+
+static void drv_vnc_blit(const int row, const int col, const int height, const int width)
+{
+
+ if (rfbIsActive(server)) {
+ drv_vnc_blit_it(row, col, height, width, (unsigned char *) server->frameBuffer);
+
+ if (clientCount > 0) {
+ rfbMarkRectAsModified(server, 0, 0, xres, yres);
+ }
+ rfbProcessEvents(server, server->deferUpdateTime * 500);
+ }
+}
+
+/* start graphic display */
+static int drv_vnc_start(const char *section)
+{
+ char *s;
+
+ s = cfg_get(section, "Font", "6x8");
+ if (s == NULL || *s == '\0') {
+ error("%s: no '%s.Font' entry from %s", Name, section, cfg_source());
+ return -1;
+ }
+
+ XRES = -1;
+ YRES = -1;
+ if (sscanf(s, "%dx%d", &XRES, &YRES) != 2 || XRES < 1 || YRES < 1) {
+ error("%s: bad Font '%s' from %s", Name, s, cfg_source());
+ return -1;
+ }
+
+ /* Fixme: provider other fonts someday... */
+ if (XRES != 6 && YRES != 8) {
+ error("%s: bad Font '%s' from %s (only 6x8 at the moment)", Name, s, cfg_source());
+ return -1;
+ }
+
+ /* open communication with the display */
+ if (drv_vnc_open(section) < 0) {
+ return -1;
+ }
+
+ /* you surely want to allocate a framebuffer or something... */
+ server = rfbGetScreen(0, NULL, xres, yres, 8, 3, BPP);
+ server->desktopName = "LCD4Linux VNC Driver";
+ server->frameBuffer = (char *) malloc(xres * yres * BPP);
+ server->alwaysShared = (1 == 1);
+ server->port = port;
+ server->ptrAddEvent = hook_mouseaction;
+ server->newClientHook = hook_newclient;
+
+ if (password != NULL) {
+ char **passwds = malloc(sizeof(char **) * 2);
+ passwds[0] = password;
+ passwds[1] = 0;
+ server->authPasswdData = (void *) passwds;
+ server->passwordCheck = rfbCheckPasswordByList;
+ }
+ if (javaClassFiles != NULL) {
+ server->httpDir = javaClassFiles;
+ server->httpEnableProxyConnect = TRUE;
+ server->httpPort = httpPort;
+ }
+ /* Initialize the server */
+ rfbInitServer(server);
+
+ /* set width/height */
+ DROWS = yres;
+ DCOLS = xres;
+
+ /* set timestamp */
+ gettimeofday(&startDriver, NULL);
+
+ return 0;
+}
+
+/****************************************/
+/*** widget callbacks ***/
+/****************************************/
+
+
+/* using drv_generic_text_draw(W) */
+/* using drv_generic_text_icon_draw(W) */
+/* using drv_generic_text_bar_draw(W) */
+/* using drv_generic_gpio_draw(W) */
+
+
+/****************************************/
+/*** exported functions ***/
+/****************************************/
+
+
+/* list models */
+int drv_vnc_list(void)
+{
+ printf("vnc server");
+ return 0;
+}
+
+
+/* initialize driver & display */
+int drv_vnc_init(const char *section, const int quiet)
+{
+ int ret;
+
+ /* real worker functions */
+ drv_generic_graphic_real_blit = drv_vnc_blit;
+ drv_generic_keypad_real_press = drv_vnc_keypad;
+
+ /* start display */
+ if ((ret = drv_vnc_start(section)) != 0)
+ return ret;
+
+ /* initialize generic graphic driver */
+ if ((ret = drv_generic_graphic_init(section, Name)) != 0)
+ return ret;
+
+ /* initialize generic key pad driver */
+ if ((ret = drv_generic_keypad_init(section, Name)) != 0)
+ return ret;
+
+ if (!quiet) {
+ char buffer[40];
+ qprintf(buffer, sizeof(buffer), "%s %dx%d", Name, DCOLS, DROWS);
+ if (drv_generic_graphic_greet(buffer, NULL)) {
+ sleep(3);
+ drv_generic_graphic_clear();
+ }
+ }
+
+ return 0;
+}
+
+
+/* close driver & display */
+int drv_vnc_quit(const int quiet)
+{
+ info("%s: shutting down.", Name);
+
+ /* clear display */
+ drv_generic_graphic_clear();
+
+ /* say goodbye... */
+ if (!quiet) {
+ drv_generic_graphic_greet("goodbye!", NULL);
+ }
+
+ drv_generic_graphic_quit();
+ drv_generic_keypad_quit();
+ if (password != NULL) {
+ free(password);
+ }
+ if (javaClassFiles != NULL) {
+ free(javaClassFiles);
+ }
+
+ debug("closing connection");
+ drv_vnc_close();
+
+ return (0);
+}
+
+
+DRIVER drv_vnc = {
+ .name = Name,
+ .list = drv_vnc_list,
+ .init = drv_vnc_init,
+ .quit = drv_vnc_quit,
+};
diff --git a/evaluator.c b/evaluator.c
new file mode 100644
index 0000000..7f20ac0
--- /dev/null
+++ b/evaluator.c
@@ -0,0 +1,1468 @@
+/* $Id: evaluator.c 1186 2012-04-09 04:45:07Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/evaluator.c $
+ *
+ * expression evaluation
+ *
+ * Copyright (C) 1999, 2000 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+
+/*
+ * exported functions:
+ *
+ * int SetVariable (char *name, RESULT *value)
+ * adds a generic variable to the evaluator
+ *
+ * int SetVariableNumeric (char *name, double value)
+ * adds a numerical variable to the evaluator
+ *
+ * int SetVariableString (char *name, char *value)
+ * adds a numerical variable to the evaluator
+ *
+ * int AddFunction (char *name, int argc, void (*func)())
+ * adds a function to the evaluator
+ *
+ * void DeleteVariables (void);
+ * frees all allocated variables
+ *
+ * void DeleteFunctions (void);
+ * frees all allocated functions
+ *
+ * void DelResult (RESULT *result)
+ * sets a result to none
+ * frees a probably allocated memory
+ *
+ * RESULT* SetResult (RESULT **result, int type, void *value)
+ * initializes a result
+ *
+ * double R2N (RESULT *result)
+ * converts a result into a number
+ *
+ * char* R2S (RESULT *result)
+ * converts a result into a string
+ *
+ *
+ * int Compile (char* expression, void **tree)
+ * compiles a expression into a tree
+ *
+ * int Eval (void *tree, RESULT *result)
+ * evaluates an expression
+ *
+ * void DelTree (void *tree)
+ * frees a compiled tree
+ */
+
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+#include <math.h>
+#include <setjmp.h>
+
+#include "debug.h"
+#include "evaluator.h"
+
+#ifdef WITH_DMALLOC
+#include <dmalloc.h>
+#endif
+
+/* string buffer chunk size */
+#define CHUNK_SIZE 16
+
+typedef enum {
+ T_UNDEF,
+ T_NAME,
+ T_NUMBER,
+ T_STRING,
+ T_OPERATOR,
+ T_VARIABLE,
+ T_FUNCTION
+} TOKEN;
+
+typedef enum {
+ O_UNDEF, /* undefined */
+ O_LST, /* expression lists */
+ O_SET, /* variable assignements */
+ O_CND, /* conditional a?b:c */
+ O_COL, /* colon in a?b:c */
+ O_OR, /* logical OR */
+ O_AND, /* logical AND */
+ O_NEQ, /* numeric equal */
+ O_NNE, /* numeric not equal */
+ O_NLT, /* numeric less than */
+ O_NLE, /* numeric less or equal */
+ O_NGT, /* numeric greater than */
+ O_NGE, /* numeric greater or equal */
+ O_SEQ, /* string equal */
+ O_SNE, /* string not equal */
+ O_SLT, /* string less than */
+ O_SLE, /* string less or equal */
+ O_SGT, /* string greater than */
+ O_SGE, /* string greater or equal */
+ O_ADD, /* addition */
+ O_SUB, /* subtraction */
+ O_SGN, /* sign '-' */
+ O_CAT, /* string concatenation */
+ O_MUL, /* multiplication */
+ O_DIV, /* division */
+ O_MOD, /* modulo */
+ O_POW, /* power */
+ O_NOT, /* logical NOT */
+ O_BRO, /* open brace */
+ O_COM, /* comma (argument seperator) */
+ O_BRC /* closing brace */
+} OPERATOR;
+
+typedef struct {
+ char *pattern;
+ int len;
+ OPERATOR op;
+} PATTERN;
+
+typedef struct {
+ char *name;
+ RESULT *value;
+} VARIABLE;
+
+typedef struct {
+ char *name;
+ int argc;
+ void (*func) ();
+} FUNCTION;
+
+typedef struct _NODE {
+ TOKEN Token;
+ OPERATOR Operator;
+ RESULT *Result;
+ VARIABLE *Variable;
+ FUNCTION *Function;
+ int Children;
+ struct _NODE **Child;
+} NODE;
+
+
+
+/* non-alphanumeric operators */
+/* IMPORTANT! list must be sorted by length! */
+static PATTERN Pattern1[] = {
+ {";", 1, O_LST}, /* expression lists */
+ {"=", 1, O_SET}, /* variable assignements */
+ {"?", 1, O_CND}, /* conditional a?b:c */
+ {":", 1, O_COL}, /* colon a?b:c */
+ {"|", 1, O_OR}, /* logical OR */
+ {"&", 1, O_AND}, /* logical AND */
+ {"<", 1, O_NLT}, /* numeric less than */
+ {">", 1, O_NGT}, /* numeric greater than */
+ {"+", 1, O_ADD}, /* addition */
+ {"-", 1, O_SUB}, /* subtraction or sign */
+ {".", 1, O_CAT}, /* string concatenation */
+ {"*", 1, O_MUL}, /* multiplication */
+ {"/", 1, O_DIV}, /* division */
+ {"%", 1, O_MOD}, /* modulo */
+ {"^", 1, O_POW}, /* power */
+ {"!", 1, O_NOT}, /* logical NOT */
+ {"(", 1, O_BRO}, /* open brace */
+ {",", 1, O_COM}, /* comma (argument seperator) */
+ {")", 1, O_BRC}, /* closing brace */
+ {"==", 2, O_NEQ}, /* numeric equal */
+ {"!=", 2, O_NNE}, /* numeric not equal */
+ {"<=", 2, O_NLE}, /* numeric less or equal */
+ {">=", 2, O_NGE} /* numeric greater or equal */
+};
+
+/* alphanumeric operators */
+/* IMPORTANT! list must be sorted by length! */
+static PATTERN Pattern2[] = {
+ {"eq", 2, O_SEQ}, /* string equal */
+ {"ne", 2, O_SNE}, /* string not equal */
+ {"lt", 2, O_SLT}, /* string less than */
+ {"le", 2, O_SLE}, /* string less or equal */
+ {"gt", 2, O_SGT}, /* string greater than */
+ {"ge", 2, O_SGE} /* string greater or equal */
+};
+
+
+static char *Expression = NULL;
+static char *ExprPtr = NULL;
+static char *Word = NULL;
+static TOKEN Token = T_UNDEF;
+static OPERATOR Operator = O_UNDEF;
+
+static VARIABLE Variable[255];
+static unsigned int nVariable = 0;
+
+static FUNCTION *Function = NULL;
+static unsigned int nFunction = 0;
+
+
+/* strndup() may be not available on several platforms */
+#ifndef HAVE_STRNDUP
+char *strndup(const char *source, size_t len)
+{
+ char *tmp = NULL;
+
+ if (source == NULL)
+ return NULL;
+
+ if (len >= strlen(source))
+ return strdup(source);
+
+ tmp = malloc(len + 1);
+ if (tmp == 0)
+ return NULL;
+
+ strncpy(tmp, source, len);
+ tmp[len] = '\0';
+
+ return (tmp);
+}
+#endif
+
+
+void DelResult(RESULT * result)
+{
+ result->type = 0;
+ result->size = 0;
+ result->number = 0.0;
+ if (result->string) {
+ free(result->string);
+ result->string = NULL;
+ }
+}
+
+
+static void FreeResult(RESULT * result)
+{
+ if (result != NULL) {
+ DelResult(result);
+ free(result);
+ }
+}
+
+
+static RESULT *NewResult(void)
+{
+ RESULT *result = malloc(sizeof(RESULT));
+ if (result == NULL) {
+ error("Evaluator: cannot allocate result: out of memory!");
+ return NULL;
+ }
+ result->type = 0;
+ result->size = 0;
+ result->number = 0.0;
+ result->string = NULL;
+
+ return result;
+}
+
+
+RESULT *SetResult(RESULT ** result, const int type, const void *value)
+{
+ if (*result == NULL) {
+ if ((*result = NewResult()) == NULL)
+ return NULL;
+ } else if (type == R_NUMBER) {
+ DelResult(*result);
+ }
+
+ if (type == R_NUMBER) {
+ (*result)->type = R_NUMBER;
+ (*result)->size = 0;
+ (*result)->number = *(double *) value;
+ (*result)->string = NULL;
+ }
+
+ else if (type == R_STRING) {
+ int len = strlen((char *) value);
+ (*result)->type = R_STRING;
+ (*result)->number = 0.0;
+ if ((*result)->string == NULL || len >= (*result)->size) {
+ /* buffer is either empty or too small */
+ if ((*result)->string)
+ free((*result)->string);
+ /* allocate memory in multiples of CHUNK_SIZE */
+ (*result)->size = CHUNK_SIZE * ((len + 1) / CHUNK_SIZE + 1);
+ (*result)->string = malloc((*result)->size);
+ }
+ strcpy((*result)->string, value);
+ } else {
+ error("Evaluator: internal error: invalid result type %d", type);
+ return NULL;
+ }
+
+ return *result;
+}
+
+
+RESULT *CopyResult(RESULT ** result, RESULT * value)
+{
+ if (*result == NULL) {
+ if ((*result = NewResult()) == NULL)
+ return NULL;
+ }
+
+ (*result)->type = value->type;
+ (*result)->number = value->number;
+
+ if (value->string == NULL) {
+ (*result)->size = 0;
+ if ((*result)->string)
+ free((*result)->string);
+ (*result)->string = NULL;
+ } else {
+ /* is buffer large enough? */
+ if ((*result)->string == NULL || value->size > (*result)->size) {
+ if ((*result)->string)
+ free((*result)->string);
+ (*result)->size = value->size;
+ (*result)->string = malloc((*result)->size);
+ }
+ strcpy((*result)->string, value->string);
+ }
+ return *result;
+}
+
+
+double R2N(RESULT * result)
+{
+ if (result == NULL) {
+ error("Evaluator: internal error: NULL result");
+ return 0.0;
+ }
+
+ if (result->type == 0) {
+ return 0.0;
+ }
+
+ if (result->type & R_NUMBER) {
+ return result->number;
+ }
+
+ if (result->type & R_STRING) {
+ result->type |= R_NUMBER;
+ result->number = atof(result->string);
+ return result->number;
+ }
+
+ error("Evaluator: internal error: invalid result type %d", result->type);
+ return 0.0;
+}
+
+
+char *R2S(RESULT * result)
+{
+ if (result == NULL) {
+ error("Evaluator: internal error: NULL result");
+ return NULL;
+ }
+
+ if (result->type == 0) {
+ return NULL;
+ }
+
+ if (result->type & R_STRING) {
+ return result->string;
+ }
+
+ if (result->type & R_NUMBER) {
+ result->type |= R_STRING;
+ if (result->string)
+ free(result->string);
+ result->size = CHUNK_SIZE;
+ result->string = malloc(result->size);
+ snprintf(result->string, result->size, "%g", result->number);
+ return result->string;
+ }
+
+ error("Evaluator: internal error: invalid result type %d", result->type);
+ return NULL;
+
+}
+
+
+static VARIABLE *FindVariable(const char *name)
+{
+ unsigned int i;
+
+ for (i = 0; i < nVariable; i++) {
+ if (strcmp(name, Variable[i].name) == 0) {
+ return &Variable[i];
+ }
+ }
+ return NULL;
+}
+
+
+int SetVariable(const char *name, RESULT * value)
+{
+ VARIABLE *V;
+
+ V = FindVariable(name);
+ if (V != NULL) {
+ CopyResult(&V->value, value);
+ return 1;
+ }
+
+ if (nVariable >= sizeof(Variable) / sizeof(Variable[0])) {
+ error("Evaluator: cannot set variable <%s>: out of slots", name);
+ return -1;
+ }
+
+ nVariable++;
+ Variable[nVariable - 1].name = strdup(name);
+ Variable[nVariable - 1].value = NULL;
+ CopyResult(&Variable[nVariable - 1].value, value);
+
+ return 0;
+}
+
+
+int SetVariableNumeric(const char *name, const double value)
+{
+ RESULT result = { 0, 0, 0, NULL };
+ RESULT *rp = &result;
+
+ SetResult(&rp, R_NUMBER, &value);
+
+ return SetVariable(name, rp);
+}
+
+
+int SetVariableString(const char *name, const char *value)
+{
+ RESULT result = { 0, 0, 0, NULL };
+ RESULT *rp = &result;
+
+ SetResult(&rp, R_STRING, value);
+
+ return SetVariable(name, rp);
+}
+
+
+void DeleteVariables(void)
+{
+ unsigned int i;
+
+ for (i = 0; i < nVariable; i++) {
+ free(Variable[i].name);
+ FreeResult(Variable[i].value);
+ }
+ nVariable = 0;
+}
+
+
+/* bsearch compare function for functions */
+static int LookupFunction(const void *a, const void *b)
+{
+ char *n = (char *) a;
+ FUNCTION *f = (FUNCTION *) b;
+
+ return strcmp(n, f->name);
+}
+
+
+/* qsort compare function for functions */
+static int SortFunction(const void *a, const void *b)
+{
+ FUNCTION *fa = (FUNCTION *) a;
+ FUNCTION *fb = (FUNCTION *) b;
+
+ return strcmp(fa->name, fb->name);
+}
+
+
+static FUNCTION *FindFunction(const char *name)
+{
+ return bsearch(name, Function, nFunction, sizeof(FUNCTION), LookupFunction);
+}
+
+
+int AddFunction(const char *name, const int argc, void (*func) ())
+{
+ nFunction++;
+ Function = realloc(Function, nFunction * sizeof(FUNCTION));
+ Function[nFunction - 1].name = strdup(name);
+ Function[nFunction - 1].argc = argc;
+ Function[nFunction - 1].func = func;
+
+ qsort(Function, nFunction, sizeof(FUNCTION), SortFunction);
+
+ return 0;
+}
+
+
+void DeleteFunctions(void)
+{
+ unsigned int i;
+
+ for (i = 0; i < nFunction; i++) {
+ free(Function[i].name);
+ }
+ free(Function);
+ Function = NULL;
+ nFunction = 0;
+}
+
+
+#define is_space(c) ((c) == ' ' || (c) == '\t')
+#define is_digit(c) ((c) >= '0' && (c) <= '9')
+#define is_alpha(c) (((c) >= 'A' && (c) <= 'Z') || ((c) >= 'a' && (c) <= 'z') || ((c) == '_'))
+#define is_alnum(c) (is_alpha(c) || is_digit(c))
+
+static void Parse(void)
+{
+ Token = T_UNDEF;
+ Operator = O_UNDEF;
+
+ if (Word) {
+ free(Word);
+ Word = NULL;
+ }
+
+ /* NULL expression? */
+ if (ExprPtr == NULL) {
+ Word = strdup("");
+ return;
+ }
+
+ /* skip leading whitespace */
+ while (is_space(*ExprPtr))
+ ExprPtr++;
+
+ /* names */
+ if (is_alpha(*ExprPtr)) {
+ int i;
+ char *start = ExprPtr;
+ while (is_alnum(*ExprPtr))
+ ExprPtr++;
+ if (*ExprPtr == ':' && *(ExprPtr + 1) == ':' && is_alpha(*(ExprPtr + 2))) {
+ ExprPtr += 3;
+ while (is_alnum(*ExprPtr))
+ ExprPtr++;
+ }
+ Word = strndup(start, ExprPtr - start);
+ Token = T_NAME;
+
+ /* check for alphanumeric operators */
+ for (i = sizeof(Pattern2) / sizeof(Pattern2[0]) - 1; i >= 0; i--) {
+ if (strcmp(Word, Pattern2[i].pattern) == 0) {
+ Token = T_OPERATOR;
+ Operator = Pattern2[i].op;
+ break;
+ }
+ }
+
+ }
+
+ /* numbers */
+ else if (is_digit(*ExprPtr) || (*ExprPtr == '.' && is_digit(*(ExprPtr + 1)))) {
+ char *start = ExprPtr;
+ while (is_digit(*ExprPtr))
+ ExprPtr++;
+ if (*ExprPtr == '.') {
+ ExprPtr++;
+ while (is_digit(*ExprPtr))
+ ExprPtr++;
+ }
+ Word = strndup(start, ExprPtr - start);
+ Token = T_NUMBER;
+ }
+
+ /* strings */
+ else if (*ExprPtr == '\'') {
+ size_t length = 0;
+ size_t size = CHUNK_SIZE;
+ Word = malloc(size);
+ ExprPtr++;
+ while (*ExprPtr != '\0' && *ExprPtr != '\'') {
+ if (*ExprPtr == '\\') {
+ switch (*(ExprPtr + 1)) {
+ case '\\':
+ case '\'':
+ Word[length++] = *(ExprPtr + 1);
+ ExprPtr += 2;
+ break;
+ case 'a':
+ Word[length++] = '\a';
+ ExprPtr += 2;
+ break;
+ case 'b':
+ Word[length++] = '\b';
+ ExprPtr += 2;
+ break;
+ case 't':
+ Word[length++] = '\t';
+ ExprPtr += 2;
+ break;
+ case 'n':
+ Word[length++] = '\n';
+ ExprPtr += 2;
+ break;
+ case 'v':
+ Word[length++] = '\v';
+ ExprPtr += 2;
+ break;
+ case 'f':
+ Word[length++] = '\f';
+ ExprPtr += 2;
+ break;
+ case 'r':
+ Word[length++] = '\r';
+ ExprPtr += 2;
+ break;
+ case 'x':
+ {
+ int i;
+ char hexC;
+ int hex[2];
+
+ for (i = 0; i < 2; i++) {
+ hexC = *(ExprPtr + 2 + i);
+ if (hexC >= '0' && hexC <= '9')
+ hex[i] = hexC - '0';
+ else if (hexC >= 'a' && hexC <= 'f')
+ hex[i] = hexC - 'a' + 10;
+ else if (hexC >= 'A' && hexC <= 'F')
+ hex[i] = hexC - 'A' + 10;
+ else
+ break;
+ }
+ switch (i) {
+ case 1:
+ Word[length] = hex[0];
+ ExprPtr += 3;
+ break;
+ case 2:
+ Word[length] = hex[0] * 16 + hex[1];
+ ExprPtr += 4;
+ break;
+ default:
+ error("Evaluator: Illegal hex sequence '\\x%c' in <%s> keeps unchanged.",
+ *(ExprPtr + 2), Expression);
+ Word[length] = '\\';
+ ExprPtr += 1;
+ }
+ if (Word[length] == 0)
+ error("Evaluator: Null character(s) in <%s> will be ignored.", Expression);
+ else
+ length++;
+ }
+ break;
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ if (*(ExprPtr + 2) >= '0' && *(ExprPtr + 2) <= '7' &&
+ *(ExprPtr + 3) >= '0' && *(ExprPtr + 3) <= '7') {
+ Word[length++] =
+ (*(ExprPtr + 1) - '0') * 64 + (*(ExprPtr + 2) - '0') * 8 + (*(ExprPtr + 3) - '0');
+ ExprPtr += 4;
+ } else {
+ error("Evaluator: illegal octal sequence '\\%c%c%c' in <%s>",
+ *(ExprPtr + 1), *(ExprPtr + 2), *(ExprPtr + 3), Expression);
+ Word[length++] = *ExprPtr++;
+ }
+ break;
+ default:
+ error("Evaluator: unknown escape sequence '\\%c' in <%s>", *(ExprPtr + 1), Expression);
+ Word[length++] = *ExprPtr++;
+ }
+ } else {
+ Word[length++] = *ExprPtr++;
+ }
+ if (length >= size) {
+ size += CHUNK_SIZE;
+ Word = realloc(Word, size);
+ }
+ }
+ Word[length] = '\0';
+ Token = T_STRING;
+ if (*ExprPtr == '\'') {
+ ExprPtr++;
+ } else {
+ error("Evaluator: unterminated string in <%s>", Expression);
+ }
+ }
+
+ /* non-alpha operators */
+ else {
+ int i;
+ for (i = sizeof(Pattern1) / sizeof(Pattern1[0]) - 1; i >= 0; i--) {
+ int len = Pattern1[i].len;
+ if (strncmp(ExprPtr, Pattern1[i].pattern, Pattern1[i].len) == 0) {
+ Word = strndup(ExprPtr, len);
+ Token = T_OPERATOR;
+ Operator = Pattern1[i].op;
+ ExprPtr += len;
+ break;
+ }
+ }
+ }
+
+ /* syntax check */
+ if (Token == T_UNDEF && *ExprPtr != '\0') {
+ error("Evaluator: parse error in <%s>: garbage <%s>", Expression, ExprPtr);
+ }
+
+ /* skip trailing whitespace */
+ while (is_space(*ExprPtr))
+ ExprPtr++;
+
+ /* empty token */
+ if (Word == NULL)
+ Word = strdup("");
+}
+
+
+static NODE *NewNode(NODE * Child)
+{
+ NODE *N;
+
+ N = malloc(sizeof(NODE));
+ if (N == NULL)
+ return NULL;
+
+ memset(N, 0, sizeof(NODE));
+ N->Token = Token;
+ N->Operator = Operator;
+
+ if (Child != NULL) {
+ N->Children = 1;
+ N->Child = malloc(sizeof(NODE *));
+ N->Child[0] = Child;
+ }
+
+ return N;
+
+}
+
+
+static NODE *JunkNode(void)
+{
+ NODE *Junk;
+
+ Junk = NewNode(NULL);
+ Junk->Token = T_STRING;
+ SetResult(&Junk->Result, R_STRING, "");
+
+ return Junk;
+}
+
+
+static void LinkNode(NODE * Root, NODE * Child)
+{
+
+ if (Child == NULL)
+ return;
+
+ Root->Children++;
+ Root->Child = realloc(Root->Child, Root->Children * sizeof(NODE *));
+ if (Root->Child == NULL)
+ return;
+ Root->Child[Root->Children - 1] = Child;
+}
+
+
+/* forward declaration */
+static NODE *Level01(void);
+
+
+/* literal numbers, variables, functions */
+static NODE *Level12(void)
+{
+ NODE *Root = NULL;
+
+ if (Token == T_OPERATOR && Operator == O_BRO) {
+ Parse();
+ Root = Level01();
+ if (Token != T_OPERATOR || Operator != O_BRC) {
+ error("Evaluator: unbalanced parentheses in <%s>", Expression);
+ LinkNode(Root, JunkNode());
+ }
+ }
+
+ else if (Token == T_NUMBER) {
+ double value = atof(Word);
+ Root = NewNode(NULL);
+ SetResult(&Root->Result, R_NUMBER, &value);
+ }
+
+ else if (Token == T_STRING) {
+ Root = NewNode(NULL);
+ SetResult(&Root->Result, R_STRING, Word);
+ }
+
+ else if (Token == T_NAME) {
+
+ /* look-ahead for opening brace */
+ if (*ExprPtr == '(') {
+ int argc = 0;
+ Root = NewNode(NULL);
+ Root->Token = T_FUNCTION;
+ Root->Result = NewResult();
+ Root->Function = FindFunction(Word);
+ if (Root->Function == NULL) {
+ error("Evaluator: unknown function '%s' in <%s>", Word, Expression);
+ Root->Token = T_STRING;
+ SetResult(&Root->Result, R_STRING, "");
+ }
+
+ /* opening brace */
+ Parse();
+ do {
+ Parse(); /* read argument */
+ if (Token == T_OPERATOR && Operator == O_BRC) {
+ break;
+ } else if (Token == T_OPERATOR && Operator == O_COM) {
+ error("Evaluator: empty argument in <%s>", Expression);
+ LinkNode(Root, JunkNode());
+ } else {
+ LinkNode(Root, Level01());
+ }
+ argc++;
+ } while (Token == T_OPERATOR && Operator == O_COM);
+
+ /* check for closing brace */
+ if (Token != T_OPERATOR || Operator != O_BRC) {
+ error("Evaluator: missing closing brace in <%s>", Expression);
+ }
+
+ /* check number of arguments */
+ if (Root->Function != NULL && Root->Function->argc >= 0 && Root->Function->argc != argc) {
+ error("Evaluator: wrong number of arguments in <%s>", Expression);
+ while (argc < Root->Function->argc) {
+ LinkNode(Root, JunkNode());
+ argc++;
+ }
+ }
+
+ } else {
+ Root = NewNode(NULL);
+ Root->Token = T_VARIABLE;
+ Root->Result = NewResult();
+ Root->Variable = FindVariable(Word);
+ if (Root->Variable == NULL) {
+ SetVariableString(Word, "");
+ Root->Variable = FindVariable(Word);
+ }
+ }
+ }
+
+ else {
+ error("Evaluator: syntax error in <%s>: <%s>", Expression, Word);
+ Root = NewNode(NULL);
+ Root->Token = T_STRING;
+ SetResult(&Root->Result, R_STRING, "");
+ }
+
+ Parse();
+ return Root;
+
+}
+
+
+/* unary + or - signs or logical 'not' */
+static NODE *Level11(void)
+{
+ NODE *Root;
+ OPERATOR sign = O_UNDEF;
+
+ if (Token == T_OPERATOR && (Operator == O_ADD || Operator == O_SUB || Operator == O_NOT)) {
+ sign = Operator;
+ if (sign == O_SUB)
+ sign = O_SGN;
+ Parse();
+ }
+
+ Root = Level12();
+
+ if (sign == O_SGN || sign == O_NOT) {
+ Root = NewNode(Root);
+ Root->Token = T_OPERATOR;
+ Root->Operator = sign;
+ }
+
+ return Root;
+}
+
+
+/* x^y */
+static NODE *Level10(void)
+{
+ NODE *Root;
+
+ Root = Level11();
+
+ while (Token == T_OPERATOR && Operator == O_POW) {
+ Root = NewNode(Root);
+ Parse();
+ LinkNode(Root, Level11());
+ }
+
+ return Root;
+}
+
+
+/* multiplication, division, modulo */
+static NODE *Level09(void)
+{
+ NODE *Root;
+
+ Root = Level10();
+
+ while (Token == T_OPERATOR && (Operator == O_MUL || Operator == O_DIV || Operator == O_MOD)) {
+ Root = NewNode(Root);
+ Parse();
+ LinkNode(Root, Level10());
+ }
+
+ return Root;
+}
+
+
+/* addition, subtraction, string concatenation */
+static NODE *Level08(void)
+{
+ NODE *Root;
+
+ Root = Level09();
+
+ while (Token == T_OPERATOR && (Operator == O_ADD || Operator == O_SUB || Operator == O_CAT)) {
+ Root = NewNode(Root);
+ Parse();
+ LinkNode(Root, Level09());
+ }
+
+ return Root;
+}
+
+
+/* relational operators */
+static NODE *Level07(void)
+{
+ NODE *Root;
+
+ Root = Level08();
+
+ while (Token == T_OPERATOR && (Operator == O_NGT || Operator == O_NGE || Operator == O_NLT || Operator == O_NLE ||
+ Operator == O_SGT || Operator == O_SGE || Operator == O_SLT || Operator == O_SLE)) {
+ Root = NewNode(Root);
+ Parse();
+ LinkNode(Root, Level08());
+ }
+
+ return Root;
+}
+
+
+/* equal, not equal */
+static NODE *Level06(void)
+{
+ NODE *Root;
+
+ Root = Level07();
+
+ while (Token == T_OPERATOR && (Operator == O_NEQ || Operator == O_NNE || Operator == O_SEQ || Operator == O_SNE)) {
+ Root = NewNode(Root);
+ Parse();
+ LinkNode(Root, Level07());
+ }
+
+ return Root;
+}
+
+/* logical 'and' */
+static NODE *Level05(void)
+{
+ NODE *Root;
+
+ Root = Level06();
+
+ while (Token == T_OPERATOR && Operator == O_AND) {
+ Root = NewNode(Root);
+ Parse();
+ LinkNode(Root, Level06());
+ }
+
+ return Root;
+}
+
+
+/* logical 'or' */
+static NODE *Level04(void)
+{
+ NODE *Root;
+
+ Root = Level05();
+
+ while (Token == T_OPERATOR && Operator == O_OR) {
+ Root = NewNode(Root);
+ Parse();
+ LinkNode(Root, Level05());
+ }
+
+ return Root;
+}
+
+
+/* conditional expression a?b:c */
+static NODE *Level03(void)
+{
+ NODE *Root;
+
+ Root = Level04();
+
+ if (Token == T_OPERATOR && Operator == O_CND) {
+ Root = NewNode(Root);
+ Parse();
+ LinkNode(Root, Level04());
+ if (Token == T_OPERATOR && Operator == O_COL) {
+ Parse();
+ LinkNode(Root, Level04());
+ } else {
+ error("Evaluator: syntax error in <%s>: expecting ':' got '%s'", Expression, Word);
+ LinkNode(Root, JunkNode());
+ }
+ }
+
+ return Root;
+}
+
+
+/* variable assignments */
+static NODE *Level02(void)
+{
+ NODE *Root;
+
+ /* we have to do a look-ahead if it's really an assignment */
+ if ((Token == T_NAME) && (*ExprPtr == '=') && (*(ExprPtr + 1) != '=')) {
+ char *name = strdup(Word);
+ VARIABLE *V = FindVariable(name);
+ if (V == NULL) {
+ SetVariableString(name, "");
+ V = FindVariable(name);
+ }
+ Parse();
+ Root = NewNode(NULL);
+ Root->Variable = V;
+ Parse();
+ LinkNode(Root, Level03());
+ free(name);
+ } else {
+ Root = Level03();
+ }
+
+ return Root;
+}
+
+
+/* expression lists */
+static NODE *Level01(void)
+{
+ NODE *Root;
+
+ Root = Level02();
+
+ while (Token == T_OPERATOR && Operator == O_LST) {
+ Root = NewNode(Root);
+ Parse();
+ LinkNode(Root, Level02());
+ }
+
+ return Root;
+}
+
+
+static int EvalTree(NODE * Root)
+{
+ int i;
+ int argc;
+ int type = -1;
+ double number = 0.0;
+ double dummy;
+ int freeme = 0;
+ char *string = NULL;
+ char *s1, *s2;
+ RESULT *param[10];
+
+ switch (Root->Token) {
+
+ case T_NUMBER:
+ case T_STRING:
+ /* Root->Result already contains the value */
+ return 0;
+
+ case T_VARIABLE:
+ CopyResult(&Root->Result, Root->Variable->value);
+ return 0;
+
+ case T_FUNCTION:
+ DelResult(Root->Result);
+ /* prepare parameter list */
+ argc = Root->Children;
+ if (argc > 10) {
+ error("evaluator: more than 10 children (operands) not supported!");
+ argc = 10;
+ }
+ for (i = 0; i < argc; i++) {
+ EvalTree(Root->Child[i]);
+ param[i] = Root->Child[i]->Result;
+ }
+ if (Root->Function->argc < 0) {
+ /* Function with variable argument list: */
+ /* pass number of arguments as first parameter */
+ Root->Function->func(Root->Result, argc, &param);
+ } else {
+ Root->Function->func(Root->Result, param[0], param[1], param[2], param[3], param[4], param[5], param[6],
+ param[7], param[8], param[9]);
+ }
+ return 0;
+
+ case T_OPERATOR:
+ switch (Root->Operator) {
+
+ case O_LST: /* expression list: result is last expression */
+ for (i = 0; i < Root->Children; i++) {
+ EvalTree(Root->Child[i]);
+ }
+ i = Root->Children - 1;
+ type = Root->Child[i]->Result->type;
+ number = Root->Child[i]->Result->number;
+ string = Root->Child[i]->Result->string;
+ break;
+
+ case O_SET: /* variable assignment */
+ EvalTree(Root->Child[0]);
+ CopyResult(&Root->Variable->value, Root->Child[0]->Result);
+ type = Root->Child[0]->Result->type;
+ number = Root->Child[0]->Result->number;
+ string = Root->Child[0]->Result->string;
+ break;
+
+ case O_CND: /* conditional expression */
+ EvalTree(Root->Child[0]);
+ i = 1 + (R2N(Root->Child[0]->Result) == 0.0);
+ EvalTree(Root->Child[i]);
+ type = Root->Child[i]->Result->type;
+ number = Root->Child[i]->Result->number;
+ string = Root->Child[i]->Result->string;
+ break;
+
+ case O_OR: /* logical OR */
+ type = R_NUMBER;
+ EvalTree(Root->Child[0]);
+ if (R2N(Root->Child[0]->Result) == 0.0) {
+ EvalTree(Root->Child[1]);
+ number = (R2N(Root->Child[1]->Result) != 0.0);
+ } else {
+ number = 1.0;
+ }
+ break;
+
+ case O_AND: /* logical AND */
+ type = R_NUMBER;
+ EvalTree(Root->Child[0]);
+ if (R2N(Root->Child[0]->Result) != 0.0) {
+ EvalTree(Root->Child[1]);
+ number = (R2N(Root->Child[1]->Result) != 0.0);
+ } else {
+ number = 0.0;
+ }
+ break;
+
+ case O_NEQ: /* numeric equal */
+ type = R_NUMBER;
+ EvalTree(Root->Child[0]);
+ EvalTree(Root->Child[1]);
+ number = (R2N(Root->Child[0]->Result) == R2N(Root->Child[1]->Result));
+ break;
+
+ case O_NNE: /* numeric not equal */
+ type = R_NUMBER;
+ EvalTree(Root->Child[0]);
+ EvalTree(Root->Child[1]);
+ number = (R2N(Root->Child[0]->Result) != R2N(Root->Child[1]->Result));
+ break;
+
+ case O_NLT: /* numeric less than */
+ type = R_NUMBER;
+ EvalTree(Root->Child[0]);
+ EvalTree(Root->Child[1]);
+ number = (R2N(Root->Child[0]->Result) < R2N(Root->Child[1]->Result));
+ break;
+
+ case O_NLE: /* numeric less equal */
+ type = R_NUMBER;
+ EvalTree(Root->Child[0]);
+ EvalTree(Root->Child[1]);
+ number = (R2N(Root->Child[0]->Result) <= R2N(Root->Child[1]->Result));
+ break;
+
+ case O_NGT: /* numeric greater than */
+ type = R_NUMBER;
+ EvalTree(Root->Child[0]);
+ EvalTree(Root->Child[1]);
+ number = (R2N(Root->Child[0]->Result) > R2N(Root->Child[1]->Result));
+ break;
+
+ case O_NGE: /* numeric greater equal */
+ type = R_NUMBER;
+ EvalTree(Root->Child[0]);
+ EvalTree(Root->Child[1]);
+ number = (R2N(Root->Child[0]->Result) >= R2N(Root->Child[1]->Result));
+ break;
+
+ case O_SEQ: /* string equal */
+ type = R_NUMBER;
+ EvalTree(Root->Child[0]);
+ EvalTree(Root->Child[1]);
+ number = (strcmp(R2S(Root->Child[0]->Result), R2S(Root->Child[1]->Result)) == 0);
+ break;
+
+ case O_SNE: /* string not equal */
+ type = R_NUMBER;
+ EvalTree(Root->Child[0]);
+ EvalTree(Root->Child[1]);
+ number = (strcmp(R2S(Root->Child[0]->Result), R2S(Root->Child[1]->Result)) != 0);
+ break;
+
+ case O_SLT: /* string less than */
+ type = R_NUMBER;
+ EvalTree(Root->Child[0]);
+ EvalTree(Root->Child[1]);
+ number = (strcmp(R2S(Root->Child[0]->Result), R2S(Root->Child[1]->Result)) < 0);
+ break;
+
+ case O_SLE: /* string less equal */
+ type = R_NUMBER;
+ EvalTree(Root->Child[0]);
+ EvalTree(Root->Child[1]);
+ number = (strcmp(R2S(Root->Child[0]->Result), R2S(Root->Child[1]->Result)) <= 0);
+ break;
+
+ case O_SGT: /* string greater than */
+ type = R_NUMBER;
+ EvalTree(Root->Child[0]);
+ EvalTree(Root->Child[1]);
+ number = (strcmp(R2S(Root->Child[0]->Result), R2S(Root->Child[1]->Result)) > 0);
+ break;
+
+ case O_SGE: /* string greater equal */
+ type = R_NUMBER;
+ EvalTree(Root->Child[0]);
+ EvalTree(Root->Child[1]);
+ number = (strcmp(R2S(Root->Child[0]->Result), R2S(Root->Child[1]->Result)) >= 0);
+ break;
+
+ case O_ADD: /* addition */
+ type = R_NUMBER;
+ EvalTree(Root->Child[0]);
+ EvalTree(Root->Child[1]);
+ number = R2N(Root->Child[0]->Result) + R2N(Root->Child[1]->Result);
+ break;
+
+ case O_SUB: /* subtraction */
+ type = R_NUMBER;
+ EvalTree(Root->Child[0]);
+ EvalTree(Root->Child[1]);
+ number = R2N(Root->Child[0]->Result) - R2N(Root->Child[1]->Result);
+ break;
+
+ case O_SGN: /* sign */
+ type = R_NUMBER;
+ EvalTree(Root->Child[0]);
+ number = -R2N(Root->Child[0]->Result);
+ break;
+
+ case O_CAT: /* string concatenation */
+ type = R_STRING;
+ EvalTree(Root->Child[0]);
+ EvalTree(Root->Child[1]);
+ s1 = R2S(Root->Child[0]->Result);
+ s2 = R2S(Root->Child[1]->Result);
+ string = malloc(strlen(s1) + strlen(s2) + 1);
+ strcpy(string, s1);
+ strcat(string, s2);
+ freeme = 1;
+ break;
+
+ case O_MUL: /* multiplication */
+ type = R_NUMBER;
+ EvalTree(Root->Child[0]);
+ EvalTree(Root->Child[1]);
+ number = R2N(Root->Child[0]->Result) * R2N(Root->Child[1]->Result);
+ break;
+
+ case O_DIV: /* division */
+ type = R_NUMBER;
+ EvalTree(Root->Child[0]);
+ EvalTree(Root->Child[1]);
+ dummy = R2N(Root->Child[1]->Result);
+ if (dummy == 0) {
+ error("Evaluator: warning: division by zero");
+ number = 0.0;
+ } else {
+ number = R2N(Root->Child[0]->Result) / R2N(Root->Child[1]->Result);
+ }
+ break;
+
+ case O_MOD: /* modulo */
+ type = R_NUMBER;
+ EvalTree(Root->Child[0]);
+ EvalTree(Root->Child[1]);
+ dummy = R2N(Root->Child[1]->Result);
+ if (dummy == 0) {
+ error("Evaluator: warning: division by zero");
+ number = 0.0;
+ } else {
+ number = fmod(R2N(Root->Child[0]->Result), R2N(Root->Child[1]->Result));
+ }
+ break;
+
+ case O_POW: /* x^y */
+ type = R_NUMBER;
+ EvalTree(Root->Child[0]);
+ EvalTree(Root->Child[1]);
+ number = pow(R2N(Root->Child[0]->Result), R2N(Root->Child[1]->Result));
+ break;
+
+ case O_NOT: /* logical NOT */
+ type = R_NUMBER;
+ EvalTree(Root->Child[0]);
+ number = (R2N(Root->Child[0]->Result) == 0.0);
+ break;
+
+ default:
+ error("Evaluator: internal error: unhandled operator <%d>", Root->Operator);
+ SetResult(&Root->Result, R_STRING, "");
+ return -1;
+ }
+
+ if (type == R_NUMBER) {
+ SetResult(&Root->Result, R_NUMBER, &number);
+ return 0;
+ }
+ if (type == R_STRING) {
+ SetResult(&Root->Result, R_STRING, string);
+ if (freeme)
+ free(string);
+ return 0;
+ }
+ error("Evaluator: internal error: unhandled type <%d>", type);
+ SetResult(&Root->Result, R_STRING, "");
+ return -1;
+
+ default:
+ error("Evaluator: internal error: unhandled token <%d>", Root->Token);
+ SetResult(&Root->Result, R_STRING, "");
+ return -1;
+
+ }
+
+ return 0;
+}
+
+
+int Compile(const char *expression, void **tree)
+{
+ NODE *Root;
+
+ *tree = NULL;
+
+ Expression = (char *) expression;
+ ExprPtr = Expression;
+
+ Parse();
+ if (*Word == '\0') {
+ /* error ("Evaluator: empty expression <%s>", Expression); */
+ free(Word);
+ Word = NULL;
+ return -1;
+ }
+
+ Root = Level01();
+
+ if (*Word != '\0') {
+ error("Evaluator: syntax error in <%s>: garbage <%s>", Expression, Word);
+ free(Word);
+ Word = NULL;
+ return -1;
+ }
+
+ free(Word);
+ Word = NULL;
+
+ *(NODE **) tree = Root;
+
+ return 0;
+}
+
+
+int Eval(void *tree, RESULT * result)
+{
+ int ret;
+ NODE *Tree = (NODE *) tree;
+
+ DelResult(result);
+
+ if (Tree == NULL) {
+ SetResult(&result, R_STRING, "");
+ return 0;
+ }
+
+ ret = EvalTree(Tree);
+
+ result->type = Tree->Result->type;
+ result->size = Tree->Result->size;
+ result->number = Tree->Result->number;
+ if (result->size > 0) {
+ result->string = malloc(result->size);
+ if (Tree->Result->string != NULL) {
+ strcpy(result->string, Tree->Result->string);
+ } else
+ result->string[0] = '\0';
+ } else {
+ result->string = NULL;
+ }
+
+ return ret;
+}
+
+
+void DelTree(void *tree)
+{
+ int i;
+ NODE *Tree = (NODE *) tree;
+
+ if (Tree == NULL)
+ return;
+
+ for (i = 0; i < Tree->Children; i++) {
+ DelTree(Tree->Child[i]);
+ }
+
+ if (Tree->Result)
+ FreeResult(Tree->Result);
+ free(Tree);
+}
diff --git a/evaluator.h b/evaluator.h
new file mode 100644
index 0000000..76b4912
--- /dev/null
+++ b/evaluator.h
@@ -0,0 +1,69 @@
+/* $Id: evaluator.h 1092 2010-01-23 12:04:55Z volker $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/evaluator.h $
+ *
+ * expression evaluation
+ *
+ * Copyright (C) 2003 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+
+#ifndef _EVALUATOR_H_
+#define _EVALUATOR_H_
+
+
+/* RESULT bitmask */
+#define R_NUMBER 1
+#define R_STRING 2
+
+typedef struct {
+ int type;
+ int size;
+ double number;
+ char *string;
+} RESULT;
+
+/* strndup() may be not available on several platforms */
+#ifndef HAVE_STRNDUP
+#include <string.h>
+char *strndup(const char *source, size_t len);
+#endif
+
+int SetVariable(const char *name, RESULT * value);
+int SetVariableNumeric(const char *name, const double value);
+int SetVariableString(const char *name, const char *value);
+
+int AddFunction(const char *name, const int argc, void (*func) ());
+
+void DeleteVariables(void);
+void DeleteFunctions(void);
+
+void DelResult(RESULT * result);
+RESULT *SetResult(RESULT ** result, const int type, const void *value);
+RESULT *CopyResult(RESULT ** result, RESULT * value);
+
+double R2N(RESULT * result);
+char *R2S(RESULT * result);
+
+int Compile(const char *expression, void **tree);
+int Eval(void *tree, RESULT * result);
+void DelTree(void *tree);
+
+#endif
diff --git a/event.c b/event.c
new file mode 100644
index 0000000..bff2a96
--- /dev/null
+++ b/event.c
@@ -0,0 +1,302 @@
+/* $Id: event.c 1040 2009-09-23 04:14:17Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/event.c $
+ *
+ * generic timer handling
+ *
+ * Copyright (C) 2009 Ed Martin <edman007@edman007.com>
+ * Copyright (C) 2004, 2009 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ * exported functions:
+ *
+ * int event_add(void (*callback) (void *data), void *data, const int fd, const int read, const int write);
+ * Adds a file description to watch
+ *
+ * int event_del(const int fd);
+ * Remove an event
+ *
+ * int event_modify(const int fd, const int read, const int write, const int active);
+ * Modify an event
+ *
+ * int named_event_add(char *event, void (*callback) (void *data), void *data);
+ * Add an event identified by a string
+ *
+ * int named_event_del(char *event, void (*callback) (void *data), void *data);
+ * delete the event identified by this string/callback/data
+ *
+ * int named_event_trigger(char *event); //call all calbacks for this event
+ * call the callbacks of all events that have identified as this string
+ *
+ * int event_process(const struct timespec *delay);
+ * process the event list
+ *
+ * void event_exit();
+ * releases all events
+ *
+ */
+
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+
+
+#include <poll.h>
+
+#include "debug.h"
+#include "cfg.h"
+#include "event.h"
+
+#ifdef WITH_DMALLOC
+#include <dmalloc.h>
+#endif
+
+typedef struct {
+ void (*callback) (event_flags_t flags, void *data);
+ void *data;
+ int fd;
+ int read;
+ int write;
+ int active;
+ int fds_id;
+} event_t;
+
+
+//our set of FDs
+static event_t *events = NULL;
+static int event_count = 0;
+static void free_events(void);
+
+int event_add(void (*callback) (event_flags_t flags, void *data), void *data, const int fd, const int read,
+ const int write, const int active)
+{
+ event_count++;
+ events = realloc(events, sizeof(event_t) * event_count);
+
+ int i = event_count - 1;
+ events[i].callback = callback;
+ events[i].data = data;
+ events[i].fd = fd;
+ events[i].read = read;
+ events[i].write = write;
+ events[i].active = active;
+ events[i].fds_id = -1;
+ return 0;
+}
+
+
+int event_process(const struct timespec *timeout)
+{
+ int i, j;
+ struct pollfd *fds = malloc(sizeof(struct pollfd) * event_count);
+ for (i = 0, j = 0; i < event_count; i++) {
+ events[i].fds_id = -1;
+ if (events[i].active) {
+ events[i].fds_id = j;
+ fds[j].events = 0;
+ fds[j].fd = events[i].fd;
+ if (events[i].read) {
+ fds[j].events |= POLLIN;
+ }
+ if (events[i].write) {
+ fds[j].events |= POLLOUT;
+ }
+ j++;
+ }
+ }
+#if (__GLIBC__ >= 2 && __GLIBC_MINOR__ >= 4)
+ int ready = ppoll(fds, j, timeout, NULL);
+#else
+ int ready = poll(fds, j, timeout->tv_sec * 1000 + timeout->tv_nsec / 1000000);
+#endif
+
+ if (ready > 0) {
+ //search the file descriptors, call all relavant callbacks
+ for (i = 0, j = 0; i < event_count; i++) {
+ if (events[i].fds_id != j) {
+ continue;
+ }
+ if (fds[j].revents) {
+ int flags = 0;
+ if (fds[j].revents & POLLIN) {
+ flags |= EVENT_READ;
+ }
+ if (fds[j].revents & POLLOUT) {
+ flags |= EVENT_WRITE;
+ }
+ if (fds[j].revents & POLLHUP) {
+ flags |= EVENT_HUP;
+ }
+ if (fds[j].revents & POLLERR) {
+ flags |= EVENT_ERR;
+ }
+ events[i].callback(flags, events[i].data);
+
+ }
+ j++;
+ }
+ }
+ free(fds);
+ return 0;
+
+}
+
+int event_del(const int fd)
+{
+ int i;
+ for (i = 0; i < event_count; i++) {
+ if (events[i].fd == fd) {
+ events[i] = events[event_count - 1];
+ break;
+ }
+ }
+ event_count--;
+ events = realloc(events, sizeof(event_t) * event_count);
+ return 0;
+}
+
+int event_modify(const int fd, const int read, const int write, const int active)
+{
+ int i;
+ for (i = 0; i < event_count; i++) {
+ if (events[i].fd == fd) {
+ events[i].read = read;
+ events[i].write = write;
+ events[i].active = active;
+ break;
+ }
+ }
+ event_count--;
+ events = realloc(events, sizeof(event_t) * event_count);
+ return 0;
+}
+
+static void free_events(void)
+{
+ if (events != NULL) {
+ free(events);
+ }
+ event_count = 0;
+ events = NULL;
+
+}
+
+void event_exit(void)
+{
+ free_events();
+}
+
+/*
+ * Named events are the user facing side of the event subsystem
+ *
+ */
+
+
+//we rely on "=" working for copying these structs (no pointers except the callers)
+typedef struct {
+ void (*callback) (void *data);
+ void *data;
+} event_callback_t;
+
+typedef struct {
+ char *name;
+ event_callback_t *c;
+ int callback_count;
+} named_event_list_t;
+
+
+static named_event_list_t *ev_names = NULL;
+static int ev_count = 0;
+
+int named_event_add(char *event, void (*callback) (void *data), void *data)
+{
+ if (event == NULL || strlen(event) == 0) {
+ return 1;
+ }
+ if (callback == NULL) {
+ return 2;
+ }
+ int i;
+ for (i = 0; i < ev_count; i++) {
+ if (0 == strcmp(event, ev_names[i].name)) {
+ break;
+ }
+ }
+ if (i >= ev_count) {
+ //create the entry
+ ev_count++;
+ ev_names = realloc(ev_names, sizeof(named_event_list_t) * ev_count);
+ ev_names[i].name = strdup(event);
+ ev_names[i].callback_count = 0;
+ ev_names[i].c = NULL;
+ }
+ int j = ev_names[i].callback_count;
+ ev_names[i].callback_count++;
+ ev_names[i].c = realloc(ev_names[i].c, sizeof(event_callback_t) * ev_names[i].callback_count);
+
+ ev_names[i].c[j].callback = callback;
+ ev_names[i].c[j].data = data;
+ return 0;
+}
+
+int named_event_del(char *event, void (*callback) (void *data), void *data)
+{
+ int i, j;
+ for (i = 0; i < ev_count; i++) {
+ if (0 == strcmp(event, ev_names[i].name)) {
+ break;
+ }
+ }
+ if (i >= ev_count) {
+ return 1; //nothing removed
+ }
+ for (j = 0; j < ev_names[i].callback_count; j++) {
+ if (ev_names[i].c[j].callback == callback && ev_names[i].c[j].data == data) {
+ ev_names[i].callback_count--;
+ ev_names[i].c[j] = ev_names[i].c[ev_names[i].callback_count];
+ ev_names[i].c = realloc(ev_names[i].c, sizeof(event_callback_t) * ev_names[i].callback_count);
+ if (ev_names[i].callback_count == 0) {
+ //drop this event
+ free(ev_names[i].name);
+ ev_count--;
+ ev_names[i] = ev_names[ev_count];
+ ev_names = realloc(ev_names, sizeof(named_event_list_t) * ev_count);
+ }
+ return 0;
+ }
+ }
+ return 2;
+}
+
+int named_event_trigger(char *event)
+{
+ int i, j;
+ for (i = 0; i < ev_count; i++) {
+ if (0 == strcmp(event, ev_names[i].name)) {
+ for (j = 0; j < ev_names[i].callback_count; j++) {
+ ev_names[i].c[j].callback(ev_names[i].c[j].data);
+ }
+ return 0;
+ }
+ }
+ return 1;
+}
diff --git a/event.h b/event.h
new file mode 100644
index 0000000..6486a54
--- /dev/null
+++ b/event.h
@@ -0,0 +1,68 @@
+/* $Id: event.h 840 2007-09-09 12:17:42Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/event.h $
+ *
+ * generic timer handling
+ *
+ * Copyright (C) 2009 Ed Martin <edman007@edman007.com>
+ * Copyright (C) 2009 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+
+#ifndef _EVENT_H_
+#define _EVENT_H_
+
+#include <time.h>
+
+//events are identified by their file descriptor only
+
+/*
+ * these functions allow plugins to add event hooks
+ * (and thus break out of the main loop when sleeping)
+ * these callbacks than then trigger named events to propagate
+ * the event to the screen
+ */
+
+typedef enum {
+ EVENT_READ = 1,
+ EVENT_WRITE = 2,
+ EVENT_HUP = 4,
+ EVENT_ERR = 8
+} event_flags_t;
+
+
+int event_add(void (*callback) (event_flags_t flags, void *data), void *data, const int fd, const int read,
+ const int write, const int active);
+int event_del(const int fd);
+int event_modify(const int fd, const int read, const int write, const int active);
+int event_process(const struct timespec *timeout);
+void event_exit(void);
+
+/*
+ * These fuctions keep a list of the events to trigger on allowing multiple
+ * things to trigger an event and multiple things to receive the event
+ */
+
+//add an event to be triggered
+int named_event_add(char *event, void (*callback) (void *data), void *data);
+//remove an event from the list of events
+int named_event_del(char *event, void (*callback) (void *data), void *data);
+int named_event_trigger(char *event); //call all calbacks for this event
+
+#endif
diff --git a/font_6x8.h b/font_6x8.h
new file mode 100644
index 0000000..ec70ff4
--- /dev/null
+++ b/font_6x8.h
@@ -0,0 +1,870 @@
+/* $Id: font_6x8.h 840 2007-09-09 12:17:42Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/font_6x8.h $
+ *
+ * 6x8 font
+ *
+ * Copyright (C) 1999, 2000, 2004 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+#define ______ 0x00
+#define _____O 0x01
+#define ____O_ 0x02
+#define ____OO 0x03
+#define ___O__ 0x04
+#define ___O_O 0x05
+#define ___OO_ 0x06
+#define ___OOO 0x07
+#define __O___ 0x08
+#define __O__O 0x09
+#define __O_O_ 0x0a
+#define __O_OO 0x0b
+#define __OO__ 0x0c
+#define __OO_O 0x0d
+#define __OOO_ 0x0e
+#define __OOOO 0x0f
+#define _O____ 0x10
+#define _O___O 0x11
+#define _O__O_ 0x12
+#define _O__OO 0x13
+#define _O_O__ 0x14
+#define _O_O_O 0x15
+#define _O_OO_ 0x16
+#define _O_OOO 0x17
+#define _OO___ 0x18
+#define _OO__O 0x19
+#define _OO_O_ 0x1a
+#define _OO_OO 0x1b
+#define _OOO__ 0x1c
+#define _OOO_O 0x1d
+#define _OOOO_ 0x1e
+#define _OOOOO 0x1f
+
+unsigned char Font_6x8[256][8] = {
+ [0x20] = {______,
+ ______,
+ ______,
+ ______,
+ ______,
+ ______,
+ ______,
+ ______},
+ [0x21] = {___O__,
+ ___O__,
+ ___O__,
+ ___O__,
+ ______,
+ ______,
+ ___O__,
+ ______},
+ [0x22] = {__O_O_,
+ __O_O_,
+ __O_O_,
+ ______,
+ ______,
+ ______,
+ ______,
+ ______},
+ [0x23] = {__O_O_,
+ __O_O_,
+ _OOOOO,
+ __O_O_,
+ _OOOOO,
+ __O_O_,
+ __O_O_,
+ ______},
+ [0x24] = {___O__,
+ __OOOO,
+ _O_O__,
+ __OOO_,
+ ___O_O,
+ _OOOO_,
+ ___O__,
+ ______},
+ [0x25] = {_OO___,
+ _OO__O,
+ ____O_,
+ ___O__,
+ __O___,
+ _O__OO,
+ ____OO,
+ ______},
+ [0x26] = {__OO__,
+ _O__O_,
+ _O_O__,
+ __O___,
+ _O_O_O,
+ _O__O_,
+ __OO_O,
+ ______},
+ [0x27] = {__OO__,
+ ___O__,
+ __O___,
+ ______,
+ ______,
+ ______,
+ ______,
+ ______},
+ [0x28] = {____O_,
+ ___O__,
+ __O___,
+ __O___,
+ __O___,
+ ___O__,
+ ____O_,
+ ______},
+ [0x29] = {__O___,
+ ___O__,
+ ____O_,
+ ____O_,
+ ____O_,
+ ___O__,
+ __O___,
+ ______},
+ [0x2a] = {______,
+ ___O__,
+ _O_O_O,
+ __OOO_,
+ _O_O_O,
+ ___O__,
+ ______,
+ ______},
+ [0x2b] = {______,
+ ___O__,
+ ___O__,
+ _OOOOO,
+ ___O__,
+ ___O__,
+ ______,
+ ______},
+ [0x2c] = {______,
+ ______,
+ ______,
+ ______,
+ __OO__,
+ ___O__,
+ __O___,
+ ______},
+ [0x2d] = {______,
+ ______,
+ ______,
+ _OOOOO,
+ ______,
+ ______,
+ ______,
+ ______},
+ [0x2e] = {______,
+ ______,
+ ______,
+ ______,
+ ______,
+ __OO__,
+ __OO__,
+ ______},
+ [0x2f] = {______,
+ _____O,
+ ____O_,
+ ___O__,
+ __O___,
+ _O____,
+ ______,
+ ______},
+ [0x30] = {__OOO_,
+ _O___O,
+ _O__OO,
+ _O_O_O,
+ _OO__O,
+ _O___O,
+ __OOO_,
+ ______},
+ [0x31] = {___O__,
+ __OO__,
+ ___O__,
+ ___O__,
+ ___O__,
+ ___O__,
+ __OOO_,
+ ______},
+ [0x32] = {__OOO_,
+ _O___O,
+ _____O,
+ ____O_,
+ ___O__,
+ __O___,
+ _OOOOO,
+ ______},
+ [0x33] = {_OOOOO,
+ ____O_,
+ ___O__,
+ ____O_,
+ _____O,
+ _O___O,
+ __OOO_,
+ ______},
+ [0x34] = {____O_,
+ ___OO_,
+ __O_O_,
+ _O__O_,
+ _OOOOO,
+ ____O_,
+ ____O_,
+ ______},
+ [0x35] = {_OOOOO,
+ _O____,
+ _O____,
+ _OOOO_,
+ _____O,
+ _O___O,
+ __OOO_,
+ ______},
+ [0x36] = {___OO_,
+ __O___,
+ _O____,
+ _OOOO_,
+ _O___O,
+ _O___O,
+ __OOO_,
+ ______},
+ [0x37] = {_OOOOO,
+ _____O,
+ ____O_,
+ ___O__,
+ __O___,
+ __O___,
+ __O___,
+ ______},
+ [0x38] = {__OOO_,
+ _O___O,
+ _O___O,
+ __OOO_,
+ _O___O,
+ _O___O,
+ __OOO_,
+ ______},
+ [0x39] = {__OOO_,
+ _O___O,
+ _O___O,
+ __OOOO,
+ _____O,
+ ____O_,
+ __OO__,
+ ______},
+ [0x3a] = {______,
+ __OO__,
+ __OO__,
+ ______,
+ __OO__,
+ __OO__,
+ ______,
+ ______},
+ [0x3b] = {______,
+ __OO__,
+ __OO__,
+ ______,
+ __OO__,
+ ___O__,
+ __O___,
+ ______},
+ [0x3c] = {____O_,
+ ___O__,
+ __O___,
+ _O____,
+ __O___,
+ ___O__,
+ ____O_,
+ ______},
+ [0x3d] = {______,
+ ______,
+ _OOOOO,
+ ______,
+ _OOOOO,
+ ______,
+ ______,
+ ______},
+ [0x3e] = {_O____,
+ __O___,
+ ___O__,
+ ____O_,
+ ___O__,
+ __O___,
+ _O____,
+ ______},
+ [0x3f] = {__OOO_,
+ _O___O,
+ _____O,
+ ____O_,
+ ___O__,
+ ______,
+ ___O__,
+ ______},
+ [0x40] = {__OOO_,
+ _O___O,
+ _____O,
+ __OO_O,
+ _O_O_O,
+ _O_O_O,
+ __OOO_,
+ ______},
+ [0x41] = {__OOO_,
+ _O___O,
+ _O___O,
+ _O___O,
+ _OOOOO,
+ _O___O,
+ _O___O,
+ ______},
+ [0x42] = {_OOOO_,
+ _O___O,
+ _O___O,
+ _OOOO_,
+ _O___O,
+ _O___O,
+ _OOOO_,
+ ______},
+ [0x43] = {__OOO_,
+ _O___O,
+ _O____,
+ _O____,
+ _O____,
+ _O___O,
+ __OOO_,
+ ______},
+ [0x44] = {_OOO__,
+ _O__O_,
+ _O___O,
+ _O___O,
+ _O___O,
+ _O__O_,
+ _OOO__,
+ ______},
+ [0x45] = {_OOOOO,
+ _O____,
+ _O____,
+ _OOOO_,
+ _O____,
+ _O____,
+ _OOOOO,
+ ______},
+ [0x46] = {_OOOOO,
+ _O____,
+ _O____,
+ _OOOO_,
+ _O____,
+ _O____,
+ _O____,
+ ______},
+ [0x47] = {__OOO_,
+ _O___O,
+ _O____,
+ _O_OOO,
+ _O___O,
+ _O___O,
+ __OOOO,
+ ______},
+ [0x48] = {_O___O,
+ _O___O,
+ _O___O,
+ _OOOOO,
+ _O___O,
+ _O___O,
+ _O___O,
+ ______},
+ [0x49] = {__OOO_,
+ ___O__,
+ ___O__,
+ ___O__,
+ ___O__,
+ ___O__,
+ __OOO_,
+ ______},
+ [0x4a] = {___OOO,
+ ____O_,
+ ____O_,
+ ____O_,
+ ____O_,
+ _O__O_,
+ __OO__,
+ ______},
+ [0x4b] = {_O___O,
+ _O__O_,
+ _O_O__,
+ _OO___,
+ _O_O__,
+ _O__O_,
+ _O___O,
+ ______},
+ [0x4c] = {_O____,
+ _O____,
+ _O____,
+ _O____,
+ _O____,
+ _O____,
+ _OOOOO,
+ ______},
+ [0x4d] = {_O___O,
+ _OO_OO,
+ _O_O_O,
+ _O_O_O,
+ _O___O,
+ _O___O,
+ _O___O,
+ ______},
+ [0x4e] = {_O___O,
+ _O___O,
+ _OO__O,
+ _O_O_O,
+ _O__OO,
+ _O___O,
+ _O___O,
+ ______},
+ [0x4f] = {__OOO_,
+ _O___O,
+ _O___O,
+ _O___O,
+ _O___O,
+ _O___O,
+ __OOO_,
+ ______},
+ [0x50] = {_OOOO_,
+ _O___O,
+ _O___O,
+ _OOOO_,
+ _O____,
+ _O____,
+ _O____,
+ ______},
+ [0x51] = {__OOO_,
+ _O___O,
+ _O___O,
+ _O___O,
+ _O_O_O,
+ _O__O_,
+ __OO_O,
+ ______},
+ [0x52] = {_OOOO_,
+ _O___O,
+ _O___O,
+ _OOOO_,
+ _O_O__,
+ _O__O_,
+ _O___O,
+ ______},
+ [0x53] = {__OOOO,
+ _O____,
+ _O____,
+ __OOO_,
+ _____O,
+ _____O,
+ _OOOO_,
+ ______},
+ [0x54] = {_OOOOO,
+ ___O__,
+ ___O__,
+ ___O__,
+ ___O__,
+ ___O__,
+ ___O__,
+ ______},
+ [0x55] = {_O___O,
+ _O___O,
+ _O___O,
+ _O___O,
+ _O___O,
+ _O___O,
+ __OOO_,
+ ______},
+ [0x56] = {_O___O,
+ _O___O,
+ _O___O,
+ _O___O,
+ _O___O,
+ __O_O_,
+ ___O__,
+ ______},
+ [0x57] = {_O___O,
+ _O___O,
+ _O___O,
+ _O_O_O,
+ _O_O_O,
+ _O_O_O,
+ __O_O_,
+ ______},
+ [0x58] = {_O___O,
+ _O___O,
+ __O_O_,
+ ___O__,
+ __O_O_,
+ _O___O,
+ _O___O,
+ ______},
+ [0x59] = {_O___O,
+ _O___O,
+ _O___O,
+ __O_O_,
+ ___O__,
+ ___O__,
+ ___O__,
+ ______},
+ [0x5a] = {_OOOOO,
+ _____O,
+ ____O_,
+ ___O__,
+ __O___,
+ _O____,
+ _OOOOO,
+ ______},
+ [0x5b] = {__OOO_,
+ __O___,
+ __O___,
+ __O___,
+ __O___,
+ __O___,
+ __OOO_,
+ ______},
+ [0x5c] = {_O___O,
+ __O_O_,
+ _OOOOO,
+ ___O__,
+ _OOOOO,
+ ___O__,
+ ___O__,
+ ______},
+ [0x5d] = {__OOO_,
+ ____O_,
+ ____O_,
+ ____O_,
+ ____O_,
+ ____O_,
+ __OOO_,
+ ______},
+ [0x5e] = {___O__,
+ __O_O_,
+ _O___O,
+ ______,
+ ______,
+ ______,
+ ______,
+ ______},
+ [0x5f] = {______,
+ ______,
+ ______,
+ ______,
+ ______,
+ ______,
+ _OOOOO,
+ ______},
+ [0x60] = {__O___,
+ ___O__,
+ ____O_,
+ ______,
+ ______,
+ ______,
+ ______,
+ ______},
+ [0x61] = {______,
+ ______,
+ __OOO_,
+ _____O,
+ __OOOO,
+ _O___O,
+ __OOOO,
+ ______},
+ [0x62] = {_O____,
+ _O____,
+ _O_OO_,
+ _OO__O,
+ _O___O,
+ _O___O,
+ _OOOO_,
+ ______},
+ [0x63] = {______,
+ ______,
+ __OOO_,
+ _O____,
+ _O____,
+ _O___O,
+ __OOO_,
+ ______},
+ [0x64] = {_____O,
+ _____O,
+ __OO_O,
+ _O__OO,
+ _O___O,
+ _O___O,
+ __OOOO,
+ ______},
+ [0x65] = {______,
+ ______,
+ __OOO_,
+ _O___O,
+ _OOOOO,
+ _O____,
+ __OOO_,
+ ______},
+ [0x66] = {___OO_,
+ __O__O,
+ __O___,
+ _OOO__,
+ __O___,
+ __O___,
+ __O___,
+ ______},
+ [0x67] = {______,
+ ______,
+ __OOOO,
+ _O___O,
+ _O___O,
+ __OOOO,
+ _____O,
+ __OOO_},
+ [0x68] = {_O____,
+ _O____,
+ _O_OO_,
+ _OO__O,
+ _O___O,
+ _O___O,
+ _O___O,
+ ______},
+ [0x69] = {___O__,
+ ______,
+ __OO__,
+ ___O__,
+ ___O__,
+ ___O__,
+ __OOO_,
+ ______},
+ [0x6a] = {____O_,
+ ______,
+ ___OO_,
+ ____O_,
+ ____O_,
+ _O__O_,
+ __OO__,
+ ______},
+ [0x6b] = {__O___,
+ __O___,
+ __O__O,
+ __O_O_,
+ __OO__,
+ __O_O_,
+ __O__O,
+ ______},
+ [0x6c] = {__OO__,
+ ___O__,
+ ___O__,
+ ___O__,
+ ___O__,
+ ___O__,
+ __OOO_,
+ ______},
+ [0x6d] = {______,
+ ______,
+ _OO_O_,
+ _O_O_O,
+ _O_O_O,
+ _O___O,
+ _O___O,
+ ______},
+ [0x6e] = {______,
+ ______,
+ _OOOO_,
+ _O___O,
+ _O___O,
+ _O___O,
+ _O___O,
+ ______},
+ [0x6f] = {______,
+ ______,
+ __OOO_,
+ _O___O,
+ _O___O,
+ _O___O,
+ __OOO_,
+ ______},
+ [0x70] = {______,
+ ______,
+ _OOOO_,
+ _O___O,
+ _O___O,
+ _OOOO_,
+ _O____,
+ _O____},
+ [0x71] = {______,
+ ______,
+ __OO_O,
+ _O__OO,
+ _O___O,
+ __OOOO,
+ _____O,
+ _____O},
+ [0x72] = {______,
+ ______,
+ _O_OO_,
+ _OO__O,
+ _O____,
+ _O____,
+ _O____,
+ ______},
+ [0x73] = {______,
+ ______,
+ __OOO_,
+ _O____,
+ __OOO_,
+ _____O,
+ _OOOO_,
+ ______},
+ [0x74] = {__O___,
+ __O___,
+ _OOO__,
+ __O___,
+ __O___,
+ __O__O,
+ ___OO_,
+ ______},
+ [0x75] = {______,
+ ______,
+ _O___O,
+ _O___O,
+ _O___O,
+ _O__OO,
+ __OO_O,
+ ______},
+ [0x76] = {______,
+ ______,
+ _O___O,
+ _O___O,
+ _O___O,
+ __O_O_,
+ ___O__,
+ ______},
+ [0x77] = {______,
+ ______,
+ _O___O,
+ _O___O,
+ _O___O,
+ _O_O_O,
+ __O_O_,
+ ______},
+ [0x78] = {______,
+ ______,
+ _O___O,
+ __O_O_,
+ ___O__,
+ __O_O_,
+ _O___O,
+ ______},
+ [0x79] = {______,
+ ______,
+ _O___O,
+ _O___O,
+ __OOOO,
+ _____O,
+ __OOO_,
+ ______},
+ [0x7a] = {______,
+ ______,
+ _OOOOO,
+ ____O_,
+ ___O__,
+ __O___,
+ _OOOOO,
+ ______},
+ [0x7b] = {____O_,
+ ___O__,
+ ___O__,
+ __O___,
+ ___O__,
+ ___O__,
+ ____O_,
+ ______},
+ [0x7c] = {___O__,
+ ___O__,
+ ___O__,
+ ___O__,
+ ___O__,
+ ___O__,
+ ___O__,
+ ______},
+ [0x7d] = {__O___,
+ ___O__,
+ ___O__,
+ ____O_,
+ ___O__,
+ ___O__,
+ __O___,
+ ______},
+ [0x7e] = {______,
+ ___O__,
+ ____O_,
+ _OOOOO,
+ ____O_,
+ ___O__,
+ ______,
+ ______},
+
+ [0x7f] = {______,
+ ___O__,
+ __O___,
+ _OOOOO,
+ __O___,
+ ___O__,
+ ______,
+ ______},
+ [0xb0] = {__OOO_,
+ __O_O_,
+ __OOO_,
+ ______,
+ ______,
+ ______,
+ ______,
+ ______},
+ [0xe1] = {__O_O_,
+ ______,
+ __OOO_,
+ _____O,
+ __OOOO,
+ _O___O,
+ __OOOO,
+ ______},
+ [0xe2] = {__OOO_,
+ _O___O,
+ _OOOO_,
+ _O___O,
+ _O___O,
+ _O_OO_,
+ _O____,
+ ______},
+ [0xef] = {__O_O_,
+ ______,
+ __OOO_,
+ _O___O,
+ _O___O,
+ _O___O,
+ __OOO_,
+ ______},
+ [0xf5] = {__O_O_,
+ ______,
+ _O___O,
+ _O___O,
+ _O___O,
+ _O__OO,
+ __OO_O,
+ ______},
+};
diff --git a/font_6x8_bold.h b/font_6x8_bold.h
new file mode 100644
index 0000000..83449a3
--- /dev/null
+++ b/font_6x8_bold.h
@@ -0,0 +1,902 @@
+/* $Id: font_6x8_bold.h 771 2007-02-25 12:27:26Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/font_6x8_bold.h $
+ *
+ * 6x8 bold font
+ *
+ * Copyright (C) 2006 Till Harbaum <till@harbaum.org>
+ * Copyright (C) 2006 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+#define ______ 0x00
+#define _____O 0x01
+#define ____O_ 0x02
+#define ____OO 0x03
+#define ___O__ 0x04
+#define ___O_O 0x05
+#define ___OO_ 0x06
+#define ___OOO 0x07
+#define __O___ 0x08
+#define __O__O 0x09
+#define __O_O_ 0x0a
+#define __O_OO 0x0b
+#define __OO__ 0x0c
+#define __OO_O 0x0d
+#define __OOO_ 0x0e
+#define __OOOO 0x0f
+#define _O____ 0x10
+#define _O___O 0x11
+#define _O__O_ 0x12
+#define _O__OO 0x13
+#define _O_O__ 0x14
+#define _O_O_O 0x15
+#define _O_OO_ 0x16
+#define _O_OOO 0x17
+#define _OO___ 0x18
+#define _OO__O 0x19
+#define _OO_O_ 0x1a
+#define _OO_OO 0x1b
+#define _OOO__ 0x1c
+#define _OOO_O 0x1d
+#define _OOOO_ 0x1e
+#define _OOOOO 0x1f
+#define O_____ 0x20
+#define O____O 0x21
+#define O___O_ 0x22
+#define O___OO 0x23
+#define O__O__ 0x24
+#define O__O_O 0x25
+#define O__OO_ 0x26
+#define O__OOO 0x27
+#define O_O___ 0x28
+#define O_O__O 0x29
+#define O_O_O_ 0x2a
+#define O_O_OO 0x2b
+#define O_OO__ 0x2c
+#define O_OO_O 0x2d
+#define O_OOO_ 0x2e
+#define O_OOOO 0x2f
+#define OO____ 0x30
+#define OO___O 0x31
+#define OO__O_ 0x32
+#define OO__OO 0x33
+#define OO_O__ 0x34
+#define OO_O_O 0x35
+#define OO_OO_ 0x36
+#define OO_OOO 0x37
+#define OOO___ 0x38
+#define OOO__O 0x39
+#define OOO_O_ 0x3a
+#define OOO_OO 0x3b
+#define OOOO__ 0x3c
+#define OOOO_O 0x3d
+#define OOOOO_ 0x3e
+#define OOOOOO 0x3f
+
+unsigned char Font_6x8_bold[256][8] = {
+ [0x20] = {______,
+ ______,
+ ______,
+ ______,
+ ______,
+ ______,
+ ______,
+ ______},
+ [0x21] = {__OO__,
+ __OO__,
+ __OO__,
+ __OO__,
+ ______,
+ ______,
+ __OO__,
+ ______},
+ [0x22] = {_OO_OO,
+ _OO_OO,
+ _OO_OO,
+ ______,
+ ______,
+ ______,
+ ______,
+ ______},
+ [0x23] = {__O_O_,
+ __O_O_,
+ _OOOOO,
+ __O_O_,
+ _OOOOO,
+ __O_O_,
+ __O_O_,
+ ______},
+ [0x24] = {___O__,
+ __OOOO,
+ _O_O__,
+ __OOO_,
+ ___O_O,
+ _OOOO_,
+ ___O__,
+ ______},
+ [0x25] = {_OO___,
+ _OO_OO,
+ ___OO_,
+ __OO__,
+ _OO___,
+ OO__OO,
+ ____OO,
+ ______},
+ [0x26] = {__OO__,
+ _OO_OO,
+ _OO_OO,
+ __OO__,
+ _OOO_O,
+ _OO_OO,
+ __OO_O,
+ ______},
+ [0x27] = {__OO__,
+ __OO__,
+ _OO___,
+ ______,
+ ______,
+ ______,
+ ______,
+ ______},
+ [0x28] = {___OO_,
+ __OO__,
+ _OO___,
+ _OO___,
+ _OO___,
+ __OO__,
+ ___OO_,
+ ______},
+ [0x29] = {_OO___,
+ __OO__,
+ ___OO_,
+ ___OO_,
+ ___OO_,
+ __OO__,
+ _OO___,
+ ______},
+ [0x2a] = {______,
+ ___O__,
+ _O_O_O,
+ __OOO_,
+ _O_O_O,
+ ___O__,
+ ______,
+ ______},
+ [0x2b] = {______,
+ __OO__,
+ __OO__,
+ _OOOO_,
+ __OO__,
+ __OO__,
+ ______,
+ ______},
+ [0x2c] = {______,
+ ______,
+ ______,
+ ______,
+ ___OO_,
+ ___OO_,
+ __OO__,
+ ______},
+ [0x2d] = {______,
+ ______,
+ ______,
+ _OOOOO,
+ ______,
+ ______,
+ ______,
+ ______},
+ [0x2e] = {______,
+ ______,
+ ______,
+ ______,
+ ______,
+ __OO__,
+ __OO__,
+ ______},
+ [0x2f] = {______,
+ ____OO,
+ ___OO_,
+ __OO__,
+ _OO___,
+ OO____,
+ ______,
+ ______},
+ [0x30] = {__OOO_,
+ _OO_OO,
+ _OO_OO,
+ _OO_OO,
+ _OO_OO,
+ _OO_OO,
+ __OOO_,
+ ______},
+ [0x31] = {___OO_,
+ __OOO_,
+ ___OO_,
+ ___OO_,
+ ___OO_,
+ ___OO_,
+ __OOOO,
+ ______},
+ [0x32] = {__OOO_,
+ _OO_OO,
+ ____OO,
+ ___OO_,
+ __OO__,
+ _OO___,
+ _OOOOO,
+ ______},
+ [0x33] = {_OOOOO,
+ ____OO,
+ ___OO_,
+ ____OO,
+ ____OO,
+ _OO_OO,
+ __OOO_,
+ ______},
+ [0x34] = {____OO,
+ ___OO_,
+ __OO__,
+ _OO_OO,
+ _OOOOO,
+ ____OO,
+ ____OO,
+ ______},
+ [0x35] = {_OOOOO,
+ _OO___,
+ _OO___,
+ _OOOO_,
+ ____OO,
+ _OO_OO,
+ __OOO_,
+ ______},
+ [0x36] = {___OO_,
+ __OO__,
+ _OO___,
+ _OOOO_,
+ _OO_OO,
+ _OO_OO,
+ __OOO_,
+ ______},
+ [0x37] = {_OOOOO,
+ ____OO,
+ ___OO_,
+ __OO__,
+ __OO__,
+ __OO__,
+ __OO__,
+ ______},
+ [0x38] = {__OOO_,
+ _OO_OO,
+ _OO_OO,
+ __OOO_,
+ _OO_OO,
+ _OO_OO,
+ __OOO_,
+ ______},
+ [0x39] = {__OOO_,
+ _OO_OO,
+ _OO_OO,
+ __OOOO,
+ ____OO,
+ ___OO_,
+ _OOO__,
+ ______},
+ [0x3a] = {______,
+ __OO__,
+ __OO__,
+ ______,
+ __OO__,
+ __OO__,
+ ______,
+ ______},
+ [0x3b] = {______,
+ __OO__,
+ __OO__,
+ ______,
+ __OO__,
+ __OO__,
+ _OO___,
+ ______},
+ [0x3c] = {____OO,
+ ___OO_,
+ __OO__,
+ _OO___,
+ __OO__,
+ ___OO_,
+ ____OO,
+ ______},
+ [0x3d] = {______,
+ ______,
+ _OOOOO,
+ ______,
+ _OOOOO,
+ ______,
+ ______,
+ ______},
+ [0x3e] = {_OO___,
+ __OO__,
+ ___OO_,
+ ____OO,
+ ___OO_,
+ __OO__,
+ _OO___,
+ ______},
+ [0x3f] = {__OOO_,
+ _OO_OO,
+ ____OO,
+ ___OO_,
+ __OO__,
+ ______,
+ __OO__,
+ ______},
+ [0x40] = {__OOO_,
+ _OO_OO,
+ ____OO,
+ __O_OO,
+ _OO_OO,
+ _OO_OO,
+ __OOO_,
+ ______},
+ [0x41] = {__OOO_,
+ _OO_OO,
+ _OO_OO,
+ _OO_OO,
+ _OOOOO,
+ _OO_OO,
+ _OO_OO,
+ ______},
+ [0x42] = {_OOOO_,
+ _OO_OO,
+ _OO_OO,
+ _OOOO_,
+ _OO_OO,
+ _OO_OO,
+ _OOOO_,
+ ______},
+ [0x43] = {__OOO_,
+ _OO_OO,
+ _OO___,
+ _OO___,
+ _OO___,
+ _OO_OO,
+ __OOO_,
+ ______},
+ [0x44] = {_OOO__,
+ _OOOO_,
+ _OO_OO,
+ _OO_OO,
+ _OO_OO,
+ _OOOO_,
+ _OOO__,
+ ______},
+ [0x45] = {_OOOOO,
+ _OO___,
+ _OO___,
+ _OOOO_,
+ _OO___,
+ _OO___,
+ _OOOOO,
+ ______},
+ [0x46] = {_OOOOO,
+ _OO___,
+ _OO___,
+ _OOOO_,
+ _OO___,
+ _OO___,
+ _OO___,
+ ______},
+ [0x47] = {__OOO_,
+ _OO_OO,
+ _OO___,
+ _OO_OO,
+ _OO_OO,
+ _OO_OO,
+ __OOOO,
+ ______},
+ [0x48] = {_OO_OO,
+ _OO_OO,
+ _OO_OO,
+ _OOOOO,
+ _OO_OO,
+ _OO_OO,
+ _OO_OO,
+ ______},
+ [0x49] = {_OOOO_,
+ __OO__,
+ __OO__,
+ __OO__,
+ __OO__,
+ __OO__,
+ _OOOO_,
+ ______},
+ [0x4a] = {___OOO,
+ ____OO,
+ ____OO,
+ ____OO,
+ ____OO,
+ _OO_OO,
+ __OOO_,
+ ______},
+ [0x4b] = {_OO_OO,
+ _OO_OO,
+ _OOOO_,
+ _OOO__,
+ _OOOO_,
+ _OO_OO,
+ _OO_OO,
+ ______},
+ [0x4c] = {_OO___,
+ _OO___,
+ _OO___,
+ _OO___,
+ _OO___,
+ _OO___,
+ _OOOOO,
+ ______},
+ [0x4d] = {_O___O,
+ _OO_OO,
+ _OOOOO,
+ _OOOOO,
+ _OO_OO,
+ _OO_OO,
+ _OO_OO,
+ ______},
+ [0x4e] = {_O__OO,
+ _OO_OO,
+ _OO_OO,
+ _OOOOO,
+ _OO_OO,
+ _OO_OO,
+ _OO__O,
+ ______},
+ [0x4f] = {__OOO_,
+ _OO_OO,
+ _OO_OO,
+ _OO_OO,
+ _OO_OO,
+ _OO_OO,
+ __OOO_,
+ ______},
+ [0x50] = {_OOOO_,
+ _OO_OO,
+ _OO_OO,
+ _OOOO_,
+ _OO___,
+ _OO___,
+ _OO___,
+ ______},
+ [0x51] = {__OOO_,
+ _OO_OO,
+ _OO_OO,
+ _OO_OO,
+ _OO_O_,
+ _OO_OO,
+ __OO_O,
+ ______},
+ [0x52] = {_OOOO_,
+ _OO_OO,
+ _OO_OO,
+ _OOOO_,
+ _OOOO_,
+ _OO_OO,
+ _OO_OO,
+ ______},
+ [0x53] = {__OOOO,
+ _OO___,
+ _OO___,
+ __OOO_,
+ ____OO,
+ ____OO,
+ _OOOO_,
+ ______},
+ [0x54] = {OOOOOO,
+ __OO__,
+ __OO__,
+ __OO__,
+ __OO__,
+ __OO__,
+ __OO__,
+ ______},
+ [0x55] = {_OO_OO,
+ _OO_OO,
+ _OO_OO,
+ _OO_OO,
+ _OO_OO,
+ _OO_OO,
+ __OOO_,
+ ______},
+ [0x56] = {_OO_OO,
+ _OO_OO,
+ _OO_OO,
+ _OO_OO,
+ _OO_OO,
+ __OOO_,
+ ___O__,
+ ______},
+ [0x57] = {_OO_OO,
+ _OO_OO,
+ _OO_OO,
+ _OOOOO,
+ _OOOOO,
+ _OO_OO,
+ _O___O,
+ ______},
+ [0x58] = {_OO_OO,
+ _OO_OO,
+ _OO_OO,
+ __OOO_,
+ _OO_OO,
+ _OO_OO,
+ _OO_OO,
+ ______},
+ [0x59] = {_OO_OO,
+ _OO_OO,
+ _OO_OO,
+ __O_OO,
+ ___OOO,
+ ___OO_,
+ _OOO__,
+ ______},
+ [0x5a] = {_OOOOO,
+ ____OO,
+ ___OO_,
+ __OOO_,
+ __OO__,
+ _OO___,
+ _OOOOO,
+ ______},
+ [0x5b] = {_OOOO_,
+ _OO___,
+ _OO___,
+ _OO___,
+ _OO___,
+ _OO___,
+ _OOOO_,
+ ______},
+ [0x5c] = {_O___O,
+ __O_O_,
+ _OOOOO,
+ ___O__,
+ _OOOOO,
+ ___O__,
+ ___O__,
+ ______},
+ [0x5d] = {__OOOO,
+ ____OO,
+ ____OO,
+ ____OO,
+ ____OO,
+ ____OO,
+ __OOOO,
+ ______},
+ [0x5e] = {___O__,
+ __OOO_,
+ _OO_OO,
+ ______,
+ ______,
+ ______,
+ ______,
+ ______},
+ [0x5f] = {______,
+ ______,
+ ______,
+ ______,
+ ______,
+ ______,
+ _OOOOO,
+ ______},
+ [0x60] = {_OO___,
+ __OO__,
+ ___OO_,
+ ______,
+ ______,
+ ______,
+ ______,
+ ______},
+ [0x61] = {______,
+ ______,
+ __OOO_,
+ ____OO,
+ __OOOO,
+ _OO_OO,
+ __OOOO,
+ ______},
+ [0x62] = {_OO___,
+ _OO___,
+ _OOOO_,
+ _OO_OO,
+ _OO_OO,
+ _OO_OO,
+ _OOOO_,
+ ______},
+ [0x63] = {______,
+ ______,
+ __OOO_,
+ _OO_OO,
+ _OO___,
+ _OO_OO,
+ __OOO_,
+ ______},
+ [0x64] = {____OO,
+ ____OO,
+ __OOOO,
+ _OO_OO,
+ _OO_OO,
+ _OO_OO,
+ __OOOO,
+ ______},
+ [0x65] = {______,
+ ______,
+ __OOO_,
+ _OO_OO,
+ _OOOOO,
+ _OO___,
+ __OOO_,
+ ______},
+ [0x66] = {___OOO,
+ __OO__,
+ __OO__,
+ _OOOO_,
+ __OO__,
+ __OO__,
+ __OO__,
+ ______},
+ [0x67] = {______,
+ ______,
+ __OOOO,
+ _OO_OO,
+ _OO_OO,
+ __OOOO,
+ ____OO,
+ __OOO_},
+ [0x68] = {_OO___,
+ _OO___,
+ _OOOO_,
+ _OO_OO,
+ _OO_OO,
+ _OO_OO,
+ _OO_OO,
+ ______},
+ [0x69] = {__OO__,
+ ______,
+ _OOO__,
+ __OO__,
+ __OO__,
+ __OO__,
+ _OOOO_,
+ ______},
+ [0x6a] = {____OO,
+ ______,
+ ___OOO,
+ ____OO,
+ ____OO,
+ _OO_OO,
+ __OOO_,
+ ______},
+ [0x6b] = {_OO___,
+ _OO___,
+ _OO_OO,
+ _OO_OO,
+ _OOOO_,
+ _OO_OO,
+ _OO_OO,
+ ______},
+ [0x6c] = {_OOO__,
+ __OO__,
+ __OO__,
+ __OO__,
+ __OO__,
+ __OO__,
+ _OOOO_,
+ ______},
+ [0x6d] = {______,
+ ______,
+ _OO_O_,
+ _OOOOO,
+ _OOOOO,
+ _OO_OO,
+ _OO_OO,
+ ______},
+ [0x6e] = {______,
+ ______,
+ _OOOO_,
+ _OO_OO,
+ _OO_OO,
+ _OO_OO,
+ _OO_OO,
+ ______},
+ [0x6f] = {______,
+ ______,
+ __OOO_,
+ _OO_OO,
+ _OO_OO,
+ _OO_OO,
+ __OOO_,
+ ______},
+ [0x70] = {______,
+ ______,
+ _OOOO_,
+ _OO_OO,
+ _OO_OO,
+ _OOOO_,
+ _OO___,
+ _OO___},
+ [0x71] = {______,
+ ______,
+ __OOOO,
+ _OO_OO,
+ _OO_OO,
+ __OOOO,
+ ____OO,
+ ____OO},
+ [0x72] = {______,
+ ______,
+ _OO_OO,
+ _OOOO_,
+ _OO___,
+ _OO___,
+ _OO___,
+ ______},
+ [0x73] = {______,
+ ______,
+ __OOOO,
+ _OO___,
+ __OOO_,
+ ____OO,
+ _OOOO_,
+ ______},
+ [0x74] = {__OO__,
+ __OO__,
+ _OOOO_,
+ __OO__,
+ __OO__,
+ __OO__,
+ ___OO_,
+ ______},
+ [0x75] = {______,
+ ______,
+ _OO_OO,
+ _OO_OO,
+ _OO_OO,
+ _OO_OO,
+ __OOOO,
+ ______},
+ [0x76] = {______,
+ ______,
+ _OO_OO,
+ _OO_OO,
+ _OO_OO,
+ __OOO_,
+ ___O__,
+ ______},
+ [0x77] = {______,
+ ______,
+ _OO_OO,
+ _OO_OO,
+ _OOOOO,
+ _OO_OO,
+ _O___O,
+ ______},
+ [0x78] = {______,
+ ______,
+ _OO_OO,
+ _OO_OO,
+ __OOO_,
+ _OO_OO,
+ _OO_OO,
+ ______},
+ [0x79] = {______,
+ ______,
+ _OO_OO,
+ _OO_OO,
+ __OOOO,
+ ____OO,
+ __OOO_,
+ ______},
+ [0x7a] = {______,
+ ______,
+ _OOOOO,
+ ___OO_,
+ __OO__,
+ _OO___,
+ _OOOOO,
+ ______},
+ [0x7b] = {___OO_,
+ __OO__,
+ __OO__,
+ _OO___,
+ __OO__,
+ __OO__,
+ ___OO_,
+ ______},
+ [0x7c] = {__OO__,
+ __OO__,
+ __OO__,
+ __OO__,
+ __OO__,
+ __OO__,
+ __OO__,
+ ______},
+ [0x7d] = {__OO__,
+ ___OO_,
+ ___OO_,
+ ____OO,
+ ___OO_,
+ ___OO_,
+ __OO__,
+ ______},
+ [0x7e] = {______,
+ __OO__,
+ ___OO_,
+ _OOOOO,
+ ___OO_,
+ __OO__,
+ ______,
+ ______},
+
+ [0x7f] = {______,
+ ___OO_,
+ __OO__,
+ _OOOOO,
+ __OO__,
+ ___OO_,
+ ______,
+ ______},
+ [0xb0] = {_OOOOO,
+ _OO_OO,
+ _OOOOO,
+ ______,
+ ______,
+ ______,
+ ______,
+ ______},
+ [0xe1] = {_OO_OO,
+ ______,
+ __OOO_,
+ ____OO,
+ __OOOO,
+ _OO_OO,
+ __OOOO,
+ ______},
+ [0xe2] = {__OOO_,
+ _OO_OO,
+ _OOOO_,
+ _OO_OO,
+ _OO_OO,
+ _OOOO_,
+ _OO___,
+ ______},
+ [0xef] = {_OO_OO,
+ ______,
+ __OOO_,
+ _OO_OO,
+ _OO_OO,
+ _OO_OO,
+ __OOO_,
+ ______},
+ [0xf5] = {_OO_OO,
+ ______,
+ _OO_OO,
+ _OO_OO,
+ _OO_OO,
+ _OO_OO,
+ __OOOO,
+ ______},
+};
diff --git a/glcd2usb.h b/glcd2usb.h
new file mode 100644
index 0000000..9ee8813
--- /dev/null
+++ b/glcd2usb.h
@@ -0,0 +1,34 @@
+/*
+ * glcd2usb.h - glcd2usb interface definitions
+ */
+
+#ifndef GLCD2USB_H
+#define GLCD2USB_H
+
+#define FLAG_SIX_BIT (1<<0)
+#define FLAG_VERTICAL_UNITS (1<<1)
+#define FLAG_BOTTOM_START (1<<2)
+#define FLAG_VERTICAL_INC (1<<3)
+#define FLAG_BACKLIGHT (1<<4)
+
+#define GLCD2USB_RID_GET_INFO 1 /* get display info */
+#define GLCD2USB_RID_SET_ALLOC 2 /* allocate/free display */
+#define GLCD2USB_RID_GET_BUTTONS 3 /* get state of the four buttons */
+#define GLCD2USB_RID_SET_BL 4 /* set backlight brightness */
+#define GLCD2USB_RID_GET_IR 5 /* get last ir message */
+#define GLCD2USB_RID_WRITE 8 /* write some bitmap data to the display */
+#define GLCD2USB_RID_WRITE_4 (GLCD2USB_RID_WRITE+0)
+#define GLCD2USB_RID_WRITE_8 (GLCD2USB_RID_WRITE+1)
+#define GLCD2USB_RID_WRITE_16 (GLCD2USB_RID_WRITE+2)
+#define GLCD2USB_RID_WRITE_32 (GLCD2USB_RID_WRITE+3)
+#define GLCD2USB_RID_WRITE_64 (GLCD2USB_RID_WRITE+4)
+#define GLCD2USB_RID_WRITE_128 (GLCD2USB_RID_WRITE+5)
+
+typedef struct {
+ unsigned char report_id;
+ char name[32];
+ unsigned short width, height;
+ unsigned char flags;
+} __attribute__ ((packed)) display_info_t;
+
+#endif // GLCD2USB_H
diff --git a/hash.c b/hash.c
new file mode 100644
index 0000000..b3fccca
--- /dev/null
+++ b/hash.c
@@ -0,0 +1,505 @@
+/* $Id: hash.c 840 2007-09-09 12:17:42Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/hash.c $
+ *
+ * hashes (associative arrays)
+ *
+ * Copyright (C) 2003 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ * exported functions:
+ *
+ * void hash_create (HASH *Hash);
+ * initializes hash
+ *
+ * int hash_age (HASH *Hash, char *key, char **value);
+ * return time of last hash_put
+ *
+ * void hash_put (HASH *Hash, char *key, char *val);
+ * set an entry in the hash
+ *
+ * void hash_put_delta (HASH *Hash, char *key, char *val);
+ * set a delta entry in the hash
+ *
+ * char *hash_get (HASH *Hash, char *key);
+ * fetch an entry from the hash
+ *
+ * double hash_get_delta (HASH *Hash, char *key, int delay);
+ * fetch a delta antry from the hash
+ *
+ * double hash_get_regex (HASH *Hash, char *key, int delay);
+ * fetch one or more entries from the hash
+ *
+ * void hash_destroy (HASH *Hash);
+ * releases hash
+ *
+ */
+
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <regex.h>
+
+#include "debug.h"
+#include "hash.h"
+
+#ifdef WITH_DMALLOC
+#include <dmalloc.h>
+#endif
+
+/* number of slots for delta processing */
+#define DELTA_SLOTS 64
+
+/* string buffer chunk size */
+#define CHUNK_SIZE 16
+
+
+/* initialize a new hash table */
+void hash_create(HASH * Hash)
+{
+ Hash->sorted = 0;
+
+ Hash->timestamp.tv_sec = 0;
+ Hash->timestamp.tv_usec = 0;
+
+ Hash->nItems = 0;
+ Hash->Items = NULL;
+
+ Hash->nColumns = 0;
+ Hash->Columns = NULL;
+
+ Hash->delimiter = strdup(" \t\n");
+}
+
+
+/* bsearch compare function for hash items */
+static int hash_lookup_item(const void *a, const void *b)
+{
+ char *key = (char *) a;
+ HASH_ITEM *item = (HASH_ITEM *) b;
+
+ return strcasecmp(key, item->key);
+}
+
+
+/* qsort compare function for hash items */
+static int hash_sort_item(const void *a, const void *b)
+{
+ HASH_ITEM *ha = (HASH_ITEM *) a;
+ HASH_ITEM *hb = (HASH_ITEM *) b;
+
+ return strcasecmp(ha->key, hb->key);
+}
+
+
+/* bsearch compare function for hash headers */
+static int hash_lookup_column(const void *a, const void *b)
+{
+ char *key = (char *) a;
+ HASH_COLUMN *column = (HASH_COLUMN *) b;
+
+ return strcasecmp(key, column->key);
+}
+
+
+/* qsort compare function for hash headers */
+static int hash_sort_column(const void *a, const void *b)
+{
+ HASH_COLUMN *ha = (HASH_COLUMN *) a;
+ HASH_COLUMN *hb = (HASH_COLUMN *) b;
+
+ return strcasecmp(ha->key, hb->key);
+}
+
+
+/* split a value into columns and */
+/* return the nth column in a string */
+/* WARNING: does return a pointer to a static string!! */
+static char *split(const char *val, const int column, const char *delimiter)
+{
+ static char buffer[256];
+ int num;
+ size_t len;
+ const char *beg, *end;
+
+ if (column < 0)
+ return (char *) val;
+ if (val == NULL)
+ return NULL;
+
+ num = 0;
+ len = 0;
+ beg = val;
+ end = beg;
+ while (beg && *beg) {
+ while (strchr(delimiter, *beg))
+ beg++;
+ end = strpbrk(beg, delimiter);
+ if (num++ == column)
+ break;
+ beg = end ? end + 1 : NULL;
+ }
+ if (beg != NULL) {
+ len = end ? (size_t) (end - beg) : strlen(beg);
+ if (len >= sizeof(buffer))
+ len = sizeof(buffer) - 1;
+ strncpy(buffer, beg, len);
+ }
+
+ buffer[len] = '\0';
+ return buffer;
+}
+
+
+/* search an entry in the hash table: */
+/* If the table is flagged "sorted", the entry is looked */
+/* up using the bsearch function. If the table is */
+/* unsorted, it will be searched in a linear way */
+static HASH_ITEM *hash_lookup(HASH * Hash, const char *key, const int do_sort)
+{
+ HASH_ITEM *Item = NULL;
+
+ /* maybe sort the array */
+ if (do_sort && !Hash->sorted) {
+ qsort(Hash->Items, Hash->nItems, sizeof(HASH_ITEM), hash_sort_item);
+ Hash->sorted = 1;
+ }
+
+ /* no key was passed */
+ if (key == NULL)
+ return NULL;
+
+ /* lookup using bsearch */
+ if (Hash->sorted) {
+ Item = bsearch(key, Hash->Items, Hash->nItems, sizeof(HASH_ITEM), hash_lookup_item);
+ }
+
+ /* linear search */
+ if (Item == NULL) {
+ int i;
+ for (i = 0; i < Hash->nItems; i++) {
+ if (strcmp(key, Hash->Items[i].key) == 0) {
+ Item = &(Hash->Items[i]);
+ break;
+ }
+ }
+ }
+
+ return Item;
+
+}
+
+
+/* return the age in milliseconds of an entry from the hash table */
+/* or from the hash table itself if key is NULL */
+/* returns -1 if entry does not exist */
+int hash_age(HASH * Hash, const char *key)
+{
+ HASH_ITEM *Item;
+ struct timeval now, *timestamp;
+
+ if (key == NULL) {
+ timestamp = &(Hash->timestamp);
+ } else {
+ Item = hash_lookup(Hash, key, 1);
+ if (Item == NULL)
+ return -1;
+ timestamp = &(Item->Slot[Item->index].timestamp);
+ }
+
+ gettimeofday(&now, NULL);
+
+ return (now.tv_sec - timestamp->tv_sec) * 1000 + (now.tv_usec - timestamp->tv_usec) / 1000;
+}
+
+
+/* add an entry to the column header table */
+void hash_set_column(HASH * Hash, const int number, const char *column)
+{
+ if (Hash == NULL)
+ return;
+
+ Hash->nColumns++;
+ Hash->Columns = realloc(Hash->Columns, Hash->nColumns * sizeof(HASH_COLUMN));
+ Hash->Columns[Hash->nColumns - 1].key = strdup(column);
+ Hash->Columns[Hash->nColumns - 1].val = number;
+
+ qsort(Hash->Columns, Hash->nColumns, sizeof(HASH_COLUMN), hash_sort_column);
+
+}
+
+
+/* fetch a column number by column header */
+static int hash_get_column(HASH * Hash, const char *key)
+{
+ HASH_COLUMN *Column;
+
+ if (key == NULL || *key == '\0')
+ return -1;
+
+ Column = bsearch(key, Hash->Columns, Hash->nColumns, sizeof(HASH_COLUMN), hash_lookup_column);
+ if (Column == NULL)
+ return -1;
+
+ return Column->val;
+}
+
+
+/* set column delimiters */
+void hash_set_delimiter(HASH * Hash, const char *delimiter)
+{
+ if (Hash->delimiter != NULL)
+ free(Hash->delimiter);
+ Hash->delimiter = strdup(delimiter);
+}
+
+
+/* get a string from the hash table */
+char *hash_get(HASH * Hash, const char *key, const char *column)
+{
+ HASH_ITEM *Item;
+ int c;
+
+ Item = hash_lookup(Hash, key, 1);
+ if (Item == NULL)
+ return NULL;
+
+ c = hash_get_column(Hash, column);
+ return split(Item->Slot[Item->index].value, c, Hash->delimiter);
+}
+
+
+/* get a delta value from the delta table */
+double hash_get_delta(HASH * Hash, const char *key, const char *column, const int delay)
+{
+ HASH_ITEM *Item;
+ HASH_SLOT *Slot1, *Slot2;
+ int i, c;
+ double v1, v2;
+ double dv, dt;
+ struct timeval now, end;
+
+ /* lookup item */
+ Item = hash_lookup(Hash, key, 1);
+ if (Item == NULL)
+ return 0.0;
+
+ /* this is the "current" Slot */
+ Slot1 = &(Item->Slot[Item->index]);
+
+ /* fetch column number */
+ c = hash_get_column(Hash, column);
+
+ /* if delay is zero, return absolute value */
+ if (delay == 0)
+ return atof(split(Slot1->value, c, Hash->delimiter));
+
+ /* prepare timing values */
+ now = Slot1->timestamp;
+ end.tv_sec = now.tv_sec;
+ end.tv_usec = now.tv_usec - 1000 * delay;
+ while (end.tv_usec < 0) {
+ end.tv_sec--;
+ end.tv_usec += 1000000;
+ }
+
+ /* search delta slot */
+ Slot2 = &(Item->Slot[Item->index]);
+ for (i = 1; i < Item->nSlot; i++) {
+ Slot2 = &(Item->Slot[(Item->index + i) % Item->nSlot]);
+ if (Slot2->timestamp.tv_sec == 0)
+ break;
+ if (timercmp(&(Slot2->timestamp), &end, <))
+ break;
+ }
+
+ /* empty slot => try the one before */
+ if (Slot2->timestamp.tv_sec == 0) {
+ i--;
+ Slot2 = &(Item->Slot[(Item->index + i) % Item->nSlot]);
+ }
+
+ /* not enough slots available... */
+ if (i == 0)
+ return 0.0;
+
+ /* delta value, delta time */
+ v1 = atof(split(Slot1->value, c, Hash->delimiter));
+ v2 = atof(split(Slot2->value, c, Hash->delimiter));
+ dv = v1 - v2;
+ dt = (Slot1->timestamp.tv_sec - Slot2->timestamp.tv_sec)
+ + (Slot1->timestamp.tv_usec - Slot2->timestamp.tv_usec) / 1000000.0;
+
+ if (dt > 0.0 && dv >= 0.0)
+ return dv / dt;
+ return 0.0;
+}
+
+
+/* get a delta value from the delta table */
+/* key may contain regular expressions, and the sum */
+/* of all matching entries is returned. */
+double hash_get_regex(HASH * Hash, const char *key, const char *column, const int delay)
+{
+ double sum;
+ regex_t preg;
+ int i, err;
+
+ err = regcomp(&preg, key, REG_ICASE | REG_NOSUB);
+ if (err != 0) {
+ char buffer[32];
+ regerror(err, &preg, buffer, sizeof(buffer));
+ error("error in regular expression: %s", buffer);
+ regfree(&preg);
+ return 0.0;
+ }
+
+ /* force the table to be sorted by requesting anything */
+ hash_lookup(Hash, NULL, 1);
+
+ sum = 0.0;
+ for (i = 0; i < Hash->nItems; i++) {
+ if (regexec(&preg, Hash->Items[i].key, 0, NULL, 0) == 0) {
+ sum += hash_get_delta(Hash, Hash->Items[i].key, column, delay);
+ }
+ }
+ regfree(&preg);
+ return sum;
+}
+
+
+/* insert a key/val pair into the hash table */
+/* If the entry does already exist, it will be overwritten, */
+/* and the table stays sorted (if it has been before). */
+/* Otherwise, the entry is appended at the end, and */
+/* the table will be flagged 'unsorted' afterwards */
+
+static HASH_ITEM *hash_set(HASH * Hash, const char *key, const char *value, const int delta)
+{
+ HASH_ITEM *Item;
+ HASH_SLOT *Slot;
+ int size;
+
+ Item = hash_lookup(Hash, key, 0);
+
+ if (Item == NULL) {
+
+ /* add entry */
+ Hash->sorted = 0;
+ Hash->nItems++;
+ Hash->Items = realloc(Hash->Items, Hash->nItems * sizeof(HASH_ITEM));
+
+ Item = &(Hash->Items[Hash->nItems - 1]);
+ Item->key = strdup(key);
+ Item->index = 0;
+ Item->nSlot = delta;
+ Item->Slot = malloc(Item->nSlot * sizeof(HASH_SLOT));
+ memset(Item->Slot, 0, Item->nSlot * sizeof(HASH_SLOT));
+
+ } else {
+
+ /* maybe enlarge delta table */
+ if (Item->nSlot < delta) {
+ Item->nSlot = delta;
+ Item->Slot = realloc(Item->Slot, Item->nSlot * sizeof(HASH_SLOT));
+ }
+
+ }
+
+ if (Item->nSlot > 1) {
+ /* move the pointer to the next free slot, wrap around if necessary */
+ if (--Item->index < 0)
+ Item->index = Item->nSlot - 1;
+ }
+
+ /* create entry */
+ Slot = &(Item->Slot[Item->index]);
+ size = strlen(value) + 1;
+
+ /* maybe enlarge value buffer */
+ if (size > Slot->size) {
+ /* buffer is either empty or too small */
+ /* allocate memory in multiples of CHUNK_SIZE */
+ Slot->size = CHUNK_SIZE * (size / CHUNK_SIZE + 1);
+ Slot->value = realloc(Slot->value, Slot->size);
+ }
+
+ /* set value */
+ strcpy(Slot->value, value);
+
+ /* set timestamps */
+ gettimeofday(&(Hash->timestamp), NULL);
+ Slot->timestamp = Hash->timestamp;
+
+ return Item;
+}
+
+
+/* insert a string into the hash table */
+/* without delta processing */
+void hash_put(HASH * Hash, const char *key, const char *value)
+{
+ hash_set(Hash, key, value, 1);
+}
+
+
+/* insert a string into the hash table */
+/* with delta processing */
+void hash_put_delta(HASH * Hash, const char *key, const char *value)
+{
+ hash_set(Hash, key, value, DELTA_SLOTS);
+}
+
+
+void hash_destroy(HASH * Hash)
+{
+ int i;
+
+ if (Hash->Items) {
+
+ /* free all headers */
+ for (i = 0; i < Hash->nColumns; i++) {
+ if (Hash->Columns[i].key)
+ free(Hash->Columns[i].key);
+ }
+
+ /* free header table */
+ free(Hash->Columns);
+
+ /* free all items */
+ for (i = 0; i < Hash->nItems; i++) {
+ if (Hash->Items[i].key)
+ free(Hash->Items[i].key);
+ if (Hash->Items[i].Slot)
+ free(Hash->Items[i].Slot);
+ }
+
+ /* free items table */
+ free(Hash->Items);
+ }
+
+ Hash->sorted = 0;
+ Hash->nItems = 0;
+ Hash->Items = NULL;
+}
diff --git a/hash.h b/hash.h
new file mode 100644
index 0000000..e6a1e17
--- /dev/null
+++ b/hash.h
@@ -0,0 +1,83 @@
+/* $Id: hash.h 840 2007-09-09 12:17:42Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/hash.h $
+ *
+ * hashes (associative arrays)
+ *
+ * Copyright (C) 2003 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+#ifndef _HASH_H_
+#define _HASH_H_
+
+/* struct timeval */
+#include <sys/time.h>
+
+
+typedef struct {
+ int size;
+ char *value;
+ struct timeval timestamp;
+} HASH_SLOT;
+
+
+typedef struct {
+ char *key;
+ int val;
+} HASH_COLUMN;
+
+typedef struct {
+ char *key;
+ int index;
+ int nSlot;
+ HASH_SLOT *Slot;
+} HASH_ITEM;
+
+
+typedef struct {
+ int sorted;
+ struct timeval timestamp;
+ int nItems;
+ HASH_ITEM *Items;
+ int nColumns;
+ HASH_COLUMN *Columns;
+ char *delimiter;
+} HASH;
+
+
+
+void hash_create(HASH * Hash);
+
+int hash_age(HASH * Hash, const char *key);
+
+void hash_set_column(HASH * Hash, const int number, const char *column);
+void hash_set_delimiter(HASH * Hash, const char *delimiter);
+
+char *hash_get(HASH * Hash, const char *key, const char *column);
+double hash_get_delta(HASH * Hash, const char *key, const char *column, const int delay);
+double hash_get_regex(HASH * Hash, const char *key, const char *column, const int delay);
+
+void hash_put(HASH * Hash, const char *key, const char *value);
+void hash_put_delta(HASH * Hash, const char *key, const char *value);
+
+void hash_destroy(HASH * Hash);
+
+
+#endif
diff --git a/indent.sh b/indent.sh
new file mode 100755
index 0000000..012434e
--- /dev/null
+++ b/indent.sh
@@ -0,0 +1,20 @@
+#! /bin/bash
+
+# $Id: indent.sh 1136 2010-11-28 16:07:16Z mzuther $
+# $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/indent.sh $
+
+
+# -kr Use Kernighan & Ritchie coding style.
+# -l120 Set maximum line length for non-comment lines to 150.
+# -npro Do not read ‘.indent.pro’ files.
+
+rm *.c~ *.h~ 2>/dev/null # trash "no such file or directory" warning messages
+indent -kr -l120 -npro *.c *.h
+
+for i in *.c *.h; do
+ if !(diff -q $i $i~); then
+ rm $i~
+ else
+ mv $i~ $i
+ fi
+done
diff --git a/install-sh b/install-sh
new file mode 100755
index 0000000..a5897de
--- /dev/null
+++ b/install-sh
@@ -0,0 +1,519 @@
+#!/bin/sh
+# install - install a program, script, or datafile
+
+scriptversion=2006-12-25.00
+
+# This originates from X11R5 (mit/util/scripts/install.sh), which was
+# later released in X11R6 (xc/config/util/install.sh) with the
+# following copyright and license.
+#
+# Copyright (C) 1994 X Consortium
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to
+# deal in the Software without restriction, including without limitation the
+# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+# sell copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
+# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+# Except as contained in this notice, the name of the X Consortium shall not
+# be used in advertising or otherwise to promote the sale, use or other deal-
+# ings in this Software without prior written authorization from the X Consor-
+# tium.
+#
+#
+# FSF changes to this file are in the public domain.
+#
+# Calling this script install-sh is preferred over install.sh, to prevent
+# `make' implicit rules from creating a file called install from it
+# when there is no Makefile.
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch.
+
+nl='
+'
+IFS=" "" $nl"
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit=${DOITPROG-}
+if test -z "$doit"; then
+ doit_exec=exec
+else
+ doit_exec=$doit
+fi
+
+# Put in absolute file names if you don't have them in your path;
+# or use environment vars.
+
+chgrpprog=${CHGRPPROG-chgrp}
+chmodprog=${CHMODPROG-chmod}
+chownprog=${CHOWNPROG-chown}
+cmpprog=${CMPPROG-cmp}
+cpprog=${CPPROG-cp}
+mkdirprog=${MKDIRPROG-mkdir}
+mvprog=${MVPROG-mv}
+rmprog=${RMPROG-rm}
+stripprog=${STRIPPROG-strip}
+
+posix_glob='?'
+initialize_posix_glob='
+ test "$posix_glob" != "?" || {
+ if (set -f) 2>/dev/null; then
+ posix_glob=
+ else
+ posix_glob=:
+ fi
+ }
+'
+
+posix_mkdir=
+
+# Desired mode of installed file.
+mode=0755
+
+chgrpcmd=
+chmodcmd=$chmodprog
+chowncmd=
+mvcmd=$mvprog
+rmcmd="$rmprog -f"
+stripcmd=
+
+src=
+dst=
+dir_arg=
+dst_arg=
+
+copy_on_change=false
+no_target_directory=
+
+usage="\
+Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
+ or: $0 [OPTION]... SRCFILES... DIRECTORY
+ or: $0 [OPTION]... -t DIRECTORY SRCFILES...
+ or: $0 [OPTION]... -d DIRECTORIES...
+
+In the 1st form, copy SRCFILE to DSTFILE.
+In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
+In the 4th, create DIRECTORIES.
+
+Options:
+ --help display this help and exit.
+ --version display version info and exit.
+
+ -c (ignored)
+ -C install only if different (preserve the last data modification time)
+ -d create directories instead of installing files.
+ -g GROUP $chgrpprog installed files to GROUP.
+ -m MODE $chmodprog installed files to MODE.
+ -o USER $chownprog installed files to USER.
+ -s $stripprog installed files.
+ -t DIRECTORY install into DIRECTORY.
+ -T report an error if DSTFILE is a directory.
+
+Environment variables override the default commands:
+ CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
+ RMPROG STRIPPROG
+"
+
+while test $# -ne 0; do
+ case $1 in
+ -c) ;;
+
+ -C) copy_on_change=true;;
+
+ -d) dir_arg=true;;
+
+ -g) chgrpcmd="$chgrpprog $2"
+ shift;;
+
+ --help) echo "$usage"; exit $?;;
+
+ -m) mode=$2
+ case $mode in
+ *' '* | *' '* | *'
+'* | *'*'* | *'?'* | *'['*)
+ echo "$0: invalid mode: $mode" >&2
+ exit 1;;
+ esac
+ shift;;
+
+ -o) chowncmd="$chownprog $2"
+ shift;;
+
+ -s) stripcmd=$stripprog;;
+
+ -t) dst_arg=$2
+ shift;;
+
+ -T) no_target_directory=true;;
+
+ --version) echo "$0 $scriptversion"; exit $?;;
+
+ --) shift
+ break;;
+
+ -*) echo "$0: invalid option: $1" >&2
+ exit 1;;
+
+ *) break;;
+ esac
+ shift
+done
+
+if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
+ # When -d is used, all remaining arguments are directories to create.
+ # When -t is used, the destination is already specified.
+ # Otherwise, the last argument is the destination. Remove it from $@.
+ for arg
+ do
+ if test -n "$dst_arg"; then
+ # $@ is not empty: it contains at least $arg.
+ set fnord "$@" "$dst_arg"
+ shift # fnord
+ fi
+ shift # arg
+ dst_arg=$arg
+ done
+fi
+
+if test $# -eq 0; then
+ if test -z "$dir_arg"; then
+ echo "$0: no input file specified." >&2
+ exit 1
+ fi
+ # It's OK to call `install-sh -d' without argument.
+ # This can happen when creating conditional directories.
+ exit 0
+fi
+
+if test -z "$dir_arg"; then
+ trap '(exit $?); exit' 1 2 13 15
+
+ # Set umask so as not to create temps with too-generous modes.
+ # However, 'strip' requires both read and write access to temps.
+ case $mode in
+ # Optimize common cases.
+ *644) cp_umask=133;;
+ *755) cp_umask=22;;
+
+ *[0-7])
+ if test -z "$stripcmd"; then
+ u_plus_rw=
+ else
+ u_plus_rw='% 200'
+ fi
+ cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
+ *)
+ if test -z "$stripcmd"; then
+ u_plus_rw=
+ else
+ u_plus_rw=,u+rw
+ fi
+ cp_umask=$mode$u_plus_rw;;
+ esac
+fi
+
+for src
+do
+ # Protect names starting with `-'.
+ case $src in
+ -*) src=./$src;;
+ esac
+
+ if test -n "$dir_arg"; then
+ dst=$src
+ dstdir=$dst
+ test -d "$dstdir"
+ dstdir_status=$?
+ else
+
+ # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
+ # might cause directories to be created, which would be especially bad
+ # if $src (and thus $dsttmp) contains '*'.
+ if test ! -f "$src" && test ! -d "$src"; then
+ echo "$0: $src does not exist." >&2
+ exit 1
+ fi
+
+ if test -z "$dst_arg"; then
+ echo "$0: no destination specified." >&2
+ exit 1
+ fi
+
+ dst=$dst_arg
+ # Protect names starting with `-'.
+ case $dst in
+ -*) dst=./$dst;;
+ esac
+
+ # If destination is a directory, append the input filename; won't work
+ # if double slashes aren't ignored.
+ if test -d "$dst"; then
+ if test -n "$no_target_directory"; then
+ echo "$0: $dst_arg: Is a directory" >&2
+ exit 1
+ fi
+ dstdir=$dst
+ dst=$dstdir/`basename "$src"`
+ dstdir_status=0
+ else
+ # Prefer dirname, but fall back on a substitute if dirname fails.
+ dstdir=`
+ (dirname "$dst") 2>/dev/null ||
+ expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$dst" : 'X\(//\)[^/]' \| \
+ X"$dst" : 'X\(//\)$' \| \
+ X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
+ echo X"$dst" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'
+ `
+
+ test -d "$dstdir"
+ dstdir_status=$?
+ fi
+ fi
+
+ obsolete_mkdir_used=false
+
+ if test $dstdir_status != 0; then
+ case $posix_mkdir in
+ '')
+ # Create intermediate dirs using mode 755 as modified by the umask.
+ # This is like FreeBSD 'install' as of 1997-10-28.
+ umask=`umask`
+ case $stripcmd.$umask in
+ # Optimize common cases.
+ *[2367][2367]) mkdir_umask=$umask;;
+ .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
+
+ *[0-7])
+ mkdir_umask=`expr $umask + 22 \
+ - $umask % 100 % 40 + $umask % 20 \
+ - $umask % 10 % 4 + $umask % 2
+ `;;
+ *) mkdir_umask=$umask,go-w;;
+ esac
+
+ # With -d, create the new directory with the user-specified mode.
+ # Otherwise, rely on $mkdir_umask.
+ if test -n "$dir_arg"; then
+ mkdir_mode=-m$mode
+ else
+ mkdir_mode=
+ fi
+
+ posix_mkdir=false
+ case $umask in
+ *[123567][0-7][0-7])
+ # POSIX mkdir -p sets u+wx bits regardless of umask, which
+ # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
+ ;;
+ *)
+ tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
+ trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
+
+ if (umask $mkdir_umask &&
+ exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
+ then
+ if test -z "$dir_arg" || {
+ # Check for POSIX incompatibilities with -m.
+ # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
+ # other-writeable bit of parent directory when it shouldn't.
+ # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
+ ls_ld_tmpdir=`ls -ld "$tmpdir"`
+ case $ls_ld_tmpdir in
+ d????-?r-*) different_mode=700;;
+ d????-?--*) different_mode=755;;
+ *) false;;
+ esac &&
+ $mkdirprog -m$different_mode -p -- "$tmpdir" && {
+ ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
+ test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
+ }
+ }
+ then posix_mkdir=:
+ fi
+ rmdir "$tmpdir/d" "$tmpdir"
+ else
+ # Remove any dirs left behind by ancient mkdir implementations.
+ rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
+ fi
+ trap '' 0;;
+ esac;;
+ esac
+
+ if
+ $posix_mkdir && (
+ umask $mkdir_umask &&
+ $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
+ )
+ then :
+ else
+
+ # The umask is ridiculous, or mkdir does not conform to POSIX,
+ # or it failed possibly due to a race condition. Create the
+ # directory the slow way, step by step, checking for races as we go.
+
+ case $dstdir in
+ /*) prefix='/';;
+ -*) prefix='./';;
+ *) prefix='';;
+ esac
+
+ eval "$initialize_posix_glob"
+
+ oIFS=$IFS
+ IFS=/
+ $posix_glob set -f
+ set fnord $dstdir
+ shift
+ $posix_glob set +f
+ IFS=$oIFS
+
+ prefixes=
+
+ for d
+ do
+ test -z "$d" && continue
+
+ prefix=$prefix$d
+ if test -d "$prefix"; then
+ prefixes=
+ else
+ if $posix_mkdir; then
+ (umask=$mkdir_umask &&
+ $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
+ # Don't fail if two instances are running concurrently.
+ test -d "$prefix" || exit 1
+ else
+ case $prefix in
+ *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
+ *) qprefix=$prefix;;
+ esac
+ prefixes="$prefixes '$qprefix'"
+ fi
+ fi
+ prefix=$prefix/
+ done
+
+ if test -n "$prefixes"; then
+ # Don't fail if two instances are running concurrently.
+ (umask $mkdir_umask &&
+ eval "\$doit_exec \$mkdirprog $prefixes") ||
+ test -d "$dstdir" || exit 1
+ obsolete_mkdir_used=true
+ fi
+ fi
+ fi
+
+ if test -n "$dir_arg"; then
+ { test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
+ { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
+ { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
+ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
+ else
+
+ # Make a couple of temp file names in the proper directory.
+ dsttmp=$dstdir/_inst.$$_
+ rmtmp=$dstdir/_rm.$$_
+
+ # Trap to clean up those temp files at exit.
+ trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
+
+ # Copy the file name to the temp name.
+ (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
+
+ # and set any options; do chmod last to preserve setuid bits.
+ #
+ # If any of these fail, we abort the whole thing. If we want to
+ # ignore errors from any of these, just make sure not to ignore
+ # errors from the above "$doit $cpprog $src $dsttmp" command.
+ #
+ { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
+ { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
+ { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
+ { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
+
+ # If -C, don't bother to copy if it wouldn't change the file.
+ if $copy_on_change &&
+ old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
+ new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
+
+ eval "$initialize_posix_glob" &&
+ $posix_glob set -f &&
+ set X $old && old=:$2:$4:$5:$6 &&
+ set X $new && new=:$2:$4:$5:$6 &&
+ $posix_glob set +f &&
+
+ test "$old" = "$new" &&
+ $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
+ then
+ rm -f "$dsttmp"
+ else
+ # Rename the file to the real destination.
+ $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
+
+ # The rename failed, perhaps because mv can't rename something else
+ # to itself, or perhaps because mv is so ancient that it does not
+ # support -f.
+ {
+ # Now remove or move aside any old file at destination location.
+ # We try this two ways since rm can't unlink itself on some
+ # systems and the destination file might be busy for other
+ # reasons. In this case, the final cleanup might fail but the new
+ # file should still install successfully.
+ {
+ test ! -f "$dst" ||
+ $doit $rmcmd -f "$dst" 2>/dev/null ||
+ { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
+ { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
+ } ||
+ { echo "$0: cannot unlink or rename $dst" >&2
+ (exit 1); exit 1
+ }
+ } &&
+
+ # Now rename the file to the real destination.
+ $doit $mvcmd "$dsttmp" "$dst"
+ }
+ fi || exit 1
+
+ trap '' 0
+ fi
+done
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
diff --git a/layout.c b/layout.c
new file mode 100644
index 0000000..1d91f0b
--- /dev/null
+++ b/layout.c
@@ -0,0 +1,203 @@
+/* $Id: layout.c 1057 2009-11-17 01:47:43Z edman007 $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/layout.c $
+ *
+ * new layouter framework
+ *
+ * Copyright (C) 2003 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ * exported functions:
+ *
+ * layout_init (char *section)
+ * initializes the layouter
+ *
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+
+#include "debug.h"
+#include "cfg.h"
+#include "widget.h"
+#include "layout.h"
+
+#ifdef WITH_DMALLOC
+#include <dmalloc.h>
+#endif
+
+
+/* rename old-style widgets without layer */
+static int layout_migrate(const char *section)
+{
+ char *list, *old, *new;
+ int row, col;
+
+ /* get a list of all keys in this section */
+ list = cfg_list(section);
+
+ /* map to lower char for scanf() */
+ for (old = list; *old != '\0'; old++)
+ *old = tolower(*old);
+
+ old = list;
+ while (old != NULL) {
+
+ char *p;
+ int i, n;
+
+ /* list is delimited by | */
+ while (*old == '|')
+ old++;
+ if ((p = strchr(old, '|')) != NULL)
+ *p = '\0';
+
+ /* row/col widgets w/o layer */
+ i = sscanf(old, "row%d.col%d%n", &row, &col, &n);
+ if (i == 2 && old[n] == '\0') {
+
+ /* prepare new key */
+ /* strlen("Layer:1.")=8 */
+ new = malloc(strlen(old) + 9);
+ strcpy(new, "Layer:1.");
+ strcat(new, old);
+
+ debug("%s: migrating '%s' to '%s'", section, old, new);
+ if (cfg_rename(section, old, new) < 0) {
+ error("WARNING: %s: both keys '%s' and '%s' may not exist!", section, old, new);
+ }
+ free(new);
+ }
+
+ /* next field */
+ old = p ? p + 1 : NULL;
+ }
+ free(list);
+ return 0;
+}
+
+
+int layout_init(const char *layout)
+{
+ char *section;
+ char *list, *l;
+ char *widget;
+ int lay, row, col, num;
+
+ info("initializing layout '%s'", layout);
+
+ /* prepare config section */
+ /* strlen("Layout:")=7 */
+ section = malloc(strlen(layout) + 8);
+ strcpy(section, "Layout:");
+ strcat(section, layout);
+
+ /* mirate layout to common format */
+ layout_migrate(section);
+
+ /* get a list of all keys in this section */
+ list = cfg_list(section);
+
+ /* map to lower char for scanf() */
+ for (l = list; *l != '\0'; l++)
+ *l = tolower(*l);
+
+ l = list;
+ while (l != NULL) {
+
+ char *p;
+ int i, n;
+
+ /* list is delimited by | */
+ while (*l == '|')
+ l++;
+ if ((p = strchr(l, '|')) != NULL)
+ *p = '\0';
+
+ /* layer/x/y widgets */
+ i = sscanf(l, "layer:%d.x%d.y%d%n", &lay, &row, &col, &n);
+ if (i == 3 && l[n] == '\0') {
+ if (lay < 0 || lay >= LAYERS) {
+ error("%s: layer %d out of bounds (0..%d)", section, lay, LAYERS - 1);
+ } else {
+ widget = cfg_get(section, l, NULL);
+ if (widget != NULL && *widget != '\0') {
+ widget_add(widget, WIDGET_TYPE_XY, lay, row - 1, col - 1);
+ }
+ free(widget);
+ }
+ }
+
+ /* layer/row/col widgets */
+ i = sscanf(l, "layer:%d.row%d.col%d%n", &lay, &row, &col, &n);
+ if (i == 3 && l[n] == '\0') {
+ if (lay < 0 || lay >= LAYERS) {
+ error("%s: layer %d out of bounds (0..%d)", section, lay, LAYERS - 1);
+ } else {
+ widget = cfg_get(section, l, NULL);
+ if (widget != NULL && *widget != '\0') {
+ widget_add(widget, WIDGET_TYPE_RC, lay, row - 1, col - 1);
+ }
+ free(widget);
+ }
+ }
+
+ /* GPO widgets */
+ i = sscanf(l, "gpo%d%n", &num, &n);
+ if (i == 1 && l[n] == '\0') {
+ widget = cfg_get(section, l, NULL);
+ if (widget != NULL && *widget != '\0') {
+ widget_add(widget, WIDGET_TYPE_GPO, 0, num - 1, 0);
+ }
+ free(widget);
+ }
+
+ /* timer widgets */
+ i = sscanf(l, "timer%d%n", &num, &n);
+ if (i == 1 && l[n] == '\0') {
+ widget = cfg_get(section, l, NULL);
+ if (widget != NULL && *widget != '\0') {
+ widget_add(widget, WIDGET_TYPE_TIMER, 0, num - 1, 0);
+ }
+ free(widget);
+ }
+
+ /* keypad widget */
+ i = sscanf(l, "keypad%d%n", &num, &n);
+ if (i == 1 && l[n] == '\0') {
+ widget = cfg_get(section, l, NULL);
+ if (widget != NULL && *widget != '\0') {
+ widget_add(widget, WIDGET_TYPE_KEYPAD, 0, num - 1, 0);
+ }
+ free(widget);
+ }
+
+ /* next field */
+ l = p ? p + 1 : NULL;
+ }
+ free(list);
+ free(section);
+ return 0;
+}
diff --git a/layout.h b/layout.h
new file mode 100644
index 0000000..1f3bd07
--- /dev/null
+++ b/layout.h
@@ -0,0 +1,35 @@
+/* $Id: layout.h 840 2007-09-09 12:17:42Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/layout.h $
+ *
+ * new layouter framework
+ *
+ * Copyright (C) 2003 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+#ifndef _LAYOUT_H_
+#define _LAYOUT_H_
+
+/* number of layers */
+#define LAYERS 3
+
+int layout_init(const char *section);
+
+#endif
diff --git a/lcd4kde.conf b/lcd4kde.conf
new file mode 100644
index 0000000..19ead74
--- /dev/null
+++ b/lcd4kde.conf
@@ -0,0 +1,19 @@
+Display X11
+size 6x5
+font 6x8
+pixel 1+0
+gap 1x0
+border 3
+foreground \#102000
+halfground \#90c000
+background \#a0d000
+
+Row1 "$u5l1$u5cb$u5cs$u5dr+dw$u5nr+nw$u5ii+io"
+Row2 ""
+Row3 ""
+Row4 ""
+Row5 ""
+
+Tick 100
+Tack 400
+Tau 500
diff --git a/lcd4linux.c b/lcd4linux.c
new file mode 100644
index 0000000..842f653
--- /dev/null
+++ b/lcd4linux.c
@@ -0,0 +1,440 @@
+/* $Id: lcd4linux.c 1106 2010-02-07 14:03:46Z mzuther $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/lcd4linux.c $
+ *
+ * LCD4Linux
+ *
+ * Copyright (C) 1999, 2000, 2001, 2002, 2003 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <signal.h>
+#include <time.h>
+#include <sys/types.h> /* umask() */
+#include <sys/stat.h> /* umask() */
+
+#include "svn_version.h"
+#include "cfg.h"
+#include "debug.h"
+#include "qprintf.h"
+#include "pid.h"
+#include "udelay.h"
+#include "drv.h"
+#include "timer.h"
+#include "timer_group.h"
+#include "layout.h"
+#include "plugin.h"
+#include "thread.h"
+#include "event.h"
+#include "widget.h"
+#include "widget_timer.h"
+
+#ifdef WITH_DMALLOC
+#include <dmalloc.h>
+#endif
+
+#define PIDFILE "/var/run/lcd4linux.pid"
+
+static char *release = "LCD4Linux " VERSION "-" SVN_VERSION;
+static char *copyright =
+ "Copyright (C) 2005, 2006, 2007, 2008, 2009 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>";
+static char **my_argv;
+extern char *output;
+
+int got_signal = 0;
+
+
+static void usage(void)
+{
+ printf("%s\n", release);
+ printf("%s\n", copyright);
+ printf("\n");
+ printf("usage:\n");
+ printf(" lcd4linux [-h]\n");
+ printf(" lcd4linux [-l]\n");
+ printf(" lcd4linux [-c key=value] [-i] [-f config-file] [-v] [-p pid-file]\n");
+ printf(" lcd4linux [-c key=value] [-F] [-f config-file] [-o output-file] [-q] [-v]\n");
+ printf("\n");
+ printf("options:\n");
+ printf(" -h help\n");
+ printf(" -l list available display drivers and plugins\n");
+ printf(" -c <key>=<value> overwrite entries from the config-file\n");
+ printf(" -i enter interactive mode (after display initialisation)\n");
+ printf(" -ii enter interactive mode (before display initialisation)\n");
+ printf(" -f <config-file> use configuration from <config-file> instead of /etc/lcd4linux.conf\n");
+ printf(" -v generate info messages\n");
+ printf(" -vv generate debugging messages\n");
+ printf(" -p <pid-file> specify a different pid-file location (default is /var/run/lcd4linux.pid)\n");
+ printf(" -F do not fork and detach (run in foreground)\n");
+ printf(" -o <output-file> write picture to file (raster driver only)\n");
+ printf(" -q suppress startup and exit splash screen\n");
+#ifdef WITH_X11
+ printf("special X11 options:\n");
+ printf(" -display <X11 display name> preceeds X connection given in $DISPLAY\n");
+ printf(" -synchronous use synchronized communication with X server (for debugging)\n");
+ printf("\n");
+ printf("\n");
+ printf("\n");
+#endif
+}
+
+static void interactive_mode(void)
+{
+ char line[1024];
+ void *tree;
+ RESULT result = { 0, 0, 0, NULL };
+
+ printf("\neval> ");
+ for (fgets(line, sizeof(line), stdin); !feof(stdin); fgets(line, sizeof(line), stdin)) {
+ if (line[strlen(line) - 1] == '\n')
+ line[strlen(line) - 1] = '\0';
+ if (strlen(line) > 0) {
+ if (Compile(line, &tree) != -1) {
+ Eval(tree, &result);
+ if (result.type == R_NUMBER) {
+ printf("%g\n", R2N(&result));
+ } else if (result.type == R_STRING) {
+ printf("'%s'\n", R2S(&result));
+ } else if (result.type == (R_NUMBER | R_STRING)) {
+ printf("'%s' (%g)\n", R2S(&result), R2N(&result));
+ } else {
+ printf("internal error: unknown result type %d\n", result.type);
+ }
+ DelResult(&result);
+ }
+ DelTree(tree);
+ }
+ printf("eval> ");
+ }
+ printf("\n");
+}
+
+
+void handler(int signal)
+{
+ debug("got signal %d", signal);
+ got_signal = signal;
+}
+
+
+static void daemonize(void)
+{
+
+ /* thanks to Petri Damsten, we now follow the guidelines from the UNIX Programming FAQ */
+ /* 1.7 How do I get my program to act like a daemon? */
+ /* http://www.erlenstar.demon.co.uk/unix/faq_2.html#SEC16 */
+ /* especially the double-fork solved the 'lcd4linux dying when called from init' problem */
+
+ pid_t i;
+ int fd;
+
+
+ /* Step 1: fork() so that the parent can exit */
+ i = fork();
+ if (i < 0) {
+ error("fork(#1) failed: %s", strerror(errno));
+ exit(1);
+ }
+ if (i != 0)
+ exit(0);
+
+ /* Step 2: setsid() to become a process group and session group leader */
+ setsid();
+
+ /* Step 3: fork() again so the parent (the session group leader) can exit */
+ i = fork();
+ if (i < 0) {
+ error("fork(#2) failed: %s", strerror(errno));
+ exit(1);
+ }
+ if (i != 0)
+ exit(0);
+
+ /* Step 4: chdir("/") to ensure that our process doesn't keep any directory in use */
+ if (chdir("/") != 0) {
+ error("chdir(\"/\") failed: %s", strerror(errno));
+ exit(1);
+ }
+
+ /* Step 5: umask(0) so that we have complete control over the permissions of anything we write */
+ umask(0);
+
+ /* Step 6: Establish new open descriptors for stdin, stdout and stderr */
+ /* detach stdin */
+ if (freopen("/dev/null", "r", stdin) == NULL) {
+ error("freopen (/dev/null) failed: %s", strerror(errno));
+ exit(1);
+ }
+
+ /* detach stdout and stderr */
+ fd = open("/dev/null", O_WRONLY, 0666);
+ if (fd == -1) {
+ error("open (/dev/null) failed: %s", strerror(errno));
+ exit(1);
+ }
+ fflush(stdout);
+ dup2(fd, STDOUT_FILENO);
+ fflush(stderr);
+ dup2(fd, STDERR_FILENO);
+ close(fd);
+
+}
+
+
+int main(int argc, char *argv[])
+{
+ char *cfg = "/etc/lcd4linux.conf";
+ char *pidfile = PIDFILE;
+ char *display, *driver, *layout;
+ char section[32];
+ int c;
+ int quiet = 0;
+ int interactive = 0;
+ int list_mode = 0;
+ int pid;
+
+ /* save arguments for restart */
+ my_argv = malloc(sizeof(char *) * (argc + 1));
+ for (c = 0; c < argc; c++) {
+ my_argv[c] = strdup(argv[c]);
+ }
+ my_argv[c] = NULL;
+
+ /* save original arguments pointer for threads */
+ thread_argv = argv;
+ thread_argc = argc;
+
+ running_foreground = 0;
+ running_background = 0;
+
+#ifdef WITH_X11
+ drv_X11_parseArgs(&argc, argv);
+ if (argc != thread_argc) {
+ /* info() will not work here because verbose level is not known */
+ printf("recognized special X11 parameters\n");
+ }
+#endif
+ while ((c = getopt(argc, argv, "c:Ff:hilo:qvp:")) != EOF) {
+
+ switch (c) {
+ case 'c':
+ if (cfg_cmd(optarg) < 0) {
+ fprintf(stderr, "%s: illegal argument -c '%s'\n", argv[0], optarg);
+ exit(2);
+ }
+ break;
+ case 'F':
+ running_foreground++;
+ break;
+ case 'f':
+ cfg = optarg;
+ break;
+ case 'h':
+ usage();
+ exit(0);
+ case 'i':
+ interactive++;
+ break;
+ case 'l':
+ list_mode++;
+ break;
+ case 'o':
+ output = optarg;
+ break;
+ case 'q':
+ quiet++;
+ break;
+ case 'v':
+ verbose_level++;
+ break;
+ case 'p':
+ pidfile = optarg;
+ break;
+ default:
+ exit(2);
+ }
+ }
+
+ if (optind < argc) {
+ fprintf(stderr, "%s: illegal option %s\n", argv[0], argv[optind]);
+ exit(2);
+ }
+
+ /* do not fork in interactive mode */
+ if (interactive) {
+ running_foreground = 1;
+ }
+
+ if (list_mode > 0) {
+ printf("%s\n", release);
+ printf("%s\n", copyright);
+ printf("\n");
+ drv_list();
+ printf("\n");
+ plugin_list();
+ printf("\n");
+ exit(0);
+ }
+
+ info("%s starting", release);
+ if (!running_foreground && (my_argv[0] == NULL || my_argv[0][0] != '/')) {
+ info("invoked without full path; restart may not work!");
+ }
+
+ if (cfg_init(cfg) == -1) {
+ error("Error reading configuration. Exit!");
+ exit(1);
+ }
+
+ if (plugin_init() == -1) {
+ error("Error initializing plugins. Exit!");
+ exit(1);
+ }
+
+ display = cfg_get(NULL, "Display", NULL);
+ if (display == NULL || *display == '\0') {
+ error("missing 'Display' entry in %s!", cfg_source());
+ exit(1);
+ }
+
+ qprintf(section, sizeof(section), "Display:%s", display);
+ free(display);
+ driver = cfg_get(section, "Driver", NULL);
+ if (driver == NULL || *driver == '\0') {
+ error("missing '%s.Driver' entry in %s!", section, cfg_source());
+ exit(1);
+ }
+
+ if (!running_foreground) {
+
+ debug("going background...");
+
+ daemonize();
+
+ /* ignore nasty signals */
+ signal(SIGINT, SIG_IGN);
+ signal(SIGQUIT, SIG_IGN);
+
+ /* create PID file */
+ if ((pid = pid_init(pidfile)) != 0) {
+ error("lcd4linux already running as process %d", pid);
+ exit(1);
+ }
+
+ /* now we are a daemon */
+ running_background = 1;
+ }
+
+ /* go into interactive mode before display initialization */
+ if (interactive >= 2) {
+ interactive_mode();
+ pid_exit(pidfile);
+ cfg_exit();
+ exit(0);
+ }
+
+ /* check the conf to see if quiet startup is wanted */
+ if (!quiet) {
+ cfg_number(NULL, "Quiet", 0, 0, 1, &quiet);
+ }
+
+ debug("initializing driver %s", driver);
+ if (drv_init(section, driver, quiet) == -1) {
+ error("Error initializing driver %s: Exit!", driver);
+ pid_exit(pidfile);
+ exit(1);
+ }
+ free(driver);
+
+ /* register timer widget */
+ widget_timer_register();
+
+ /* go into interactive mode (display has been initialized) */
+ if (interactive >= 1) {
+ interactive_mode();
+ drv_quit(quiet);
+ pid_exit(pidfile);
+ cfg_exit();
+ exit(0);
+ }
+
+ /* check for new-style layout */
+ layout = cfg_get(NULL, "Layout", NULL);
+ if (layout == NULL || *layout == '\0') {
+ error("missing 'Layout' entry in %s!", cfg_source());
+ exit(1);
+ }
+
+ layout_init(layout);
+ free(layout);
+
+ debug("starting main loop");
+
+
+ /* now install our own signal handler */
+ signal(SIGHUP, handler);
+ signal(SIGINT, handler);
+ signal(SIGQUIT, handler);
+ signal(SIGTERM, handler);
+
+ while (got_signal == 0) {
+ struct timespec delay;
+ if (timer_process(&delay) < 0)
+ break;
+ event_process(&delay);
+ }
+
+ debug("leaving main loop");
+
+ drv_quit(quiet);
+ pid_exit(pidfile);
+ cfg_exit();
+ plugin_exit();
+ timer_exit_group();
+ timer_exit();
+
+ if (got_signal == SIGHUP) {
+ long fd;
+ debug("restarting...");
+ /* close all files on exec */
+ for (fd = sysconf(_SC_OPEN_MAX); fd > 2; fd--) {
+ int flag;
+ if ((flag = fcntl(fd, F_GETFD, 0)) != -1)
+ fcntl(fd, F_SETFD, flag | FD_CLOEXEC);
+ }
+ execv(my_argv[0], my_argv);
+ error("execv() failed: %s", strerror(errno));
+ exit(1);
+ }
+
+ for (c = 0; my_argv[c] != NULL; c++) {
+ free(my_argv[c]);
+ }
+ free(my_argv);
+
+ exit(0);
+}
diff --git a/lcd4linux.conf.sample b/lcd4linux.conf.sample
new file mode 100644
index 0000000..095cfc1
--- /dev/null
+++ b/lcd4linux.conf.sample
@@ -0,0 +1,1376 @@
+# $Id: lcd4linux.conf.sample 1194 2013-02-13 15:15:34Z volker $
+# $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/lcd4linux.conf.sample $
+
+
+Variables {
+ tick 500
+ tack 100
+ minute 60000
+}
+
+Display ACool {
+ Driver 'serdisplib'
+ Port 'USB:060c/04eb'
+ Model 'ALPHACOOL'
+}
+
+Display G15 {
+ Driver 'G-15'
+ Font '6x8'
+ Contrast 10
+ Inverted 0
+ UInput '/dev/input/uinput'
+ SingleKeyPress 1
+}
+
+
+Display SerDispLib {
+ Driver 'serdisplib'
+ Port 'PAR:/dev/parports/0'
+ #Port '/dev/tts/0'
+ Model 'OPTREX323'
+ Options ''
+}
+
+
+Display TeakLCM {
+ Driver 'TeakLCM'
+ Size '20x2'
+ Port '/dev/ttyS1'
+ Speed 38400
+ Backlight 1
+ Icons 0
+}
+
+
+Display Trefon {
+ Driver 'TREFON'
+ Size '16x2'
+ Backlight 1
+ Icons 1
+}
+
+
+Display LCD-Linux {
+ Driver 'LCD-Linux'
+ Size '20x2'
+ UseBusy 0
+}
+
+Display IRLCD {
+ Driver 'IRLCD'
+ Size '16x2'
+ Backlight 0
+ Icons 1
+}
+
+Display LCD2USB {
+ Driver 'LCD2USB'
+ Size '20x2'
+ Backlight 1
+ Icons 1
+}
+
+Display GLCD2USB {
+ Driver 'GLCD2USB'
+ Brightness 255
+}
+
+Display ABP08-16x3 {
+ Driver 'LW_ABP'
+ Port '/dev/tts/0'
+ Speed 19200
+ Size '16x3'
+}
+
+Display LCD2041 {
+ Driver 'MatrixOrbital'
+ Model 'LCD2041'
+ Port '/dev/tts/0'
+ Speed 19200
+ Contrast 160
+}
+
+Display LK202 {
+ Driver 'MatrixOrbital'
+ Model 'LK202-24-USB'
+ Port '/dev/tts/USB0'
+ Speed 19200
+ Contrast 256/2
+}
+
+Display LK204 {
+ Driver 'MatrixOrbital'
+ Model 'LK204-24-USB'
+ Port '/dev/usb/tts/0'
+# Port '/dev/tts/0'
+ Speed 19200
+ Contrast 256/2
+}
+
+
+Display MDM166A {
+ Driver 'MDM166A'
+ Brightness 1
+ Inverted 0
+ Size '96x16'
+ Font '6x8'
+}
+
+
+Display MI240 {
+ Driver 'MilfordInstruments'
+ Model 'MI240'
+ Port '/dev/tts/0'
+ Speed 19200
+}
+
+
+Display CW12232 {
+ Driver 'Cwlinux'
+ Model 'CW12232'
+ Port '/dev/ttyUSB0'
+ Speed 19200
+ Brightness 2
+ Icons 1
+}
+
+Display NULL {
+ Driver 'NULL'
+ Size '20x4'
+}
+
+Display CF631 {
+ Driver 'Crystalfontz'
+ Model '631'
+ Port '/dev/tts/USB0'
+ Speed 115200
+ Contrast 95
+ Backlight 50
+ Icons 1
+}
+
+Display CF632 {
+ Driver 'Crystalfontz'
+ Model '632'
+ Port '/dev/tts/0'
+ Speed 19200
+ Icons 1
+}
+
+Display CF633 {
+ Icons 1
+ Driver 'Crystalfontz'
+ Model '633'
+ Port '/dev/tts/0'
+ Speed 19200
+ Contrast 16
+ Backlight 50
+}
+
+Display CF635 {
+ Icons 1
+ Driver 'Crystalfontz'
+ Model '635'
+ Port '/dev/ttyUSB0'
+ Speed 115200
+ Contrast 100
+ Backlight 128
+}
+
+Display Curses {
+ Driver 'Curses'
+ Size '20x6'
+}
+
+# generic HD44780 display (LCD4Linux wiring)
+Display HD44780-generic {
+ Driver 'HD44780'
+ Model 'generic'
+ Port '/dev/parports/0'
+ Size '8x2'
+ asc255bug 0
+ GPOs 8
+ Wire {
+ RW 'GND'
+ RS 'AUTOFD'
+ ENABLE 'STROBE'
+ ENABLE2 'GND'
+ GPO 'INIT'
+ POWER 'GND'
+ }
+}
+
+# generic HD44780 display (WinAmp wiring)
+Display HD44780-winamp {
+ Driver 'HD44780'
+ Model 'generic'
+ UseBusy 1
+ Port '/dev/parports/0'
+ Size '20x4'
+ asc255bug 1
+ Wire {
+ RW 'AUTOFD'
+ RS 'INIT'
+ ENABLE 'STROBE'
+ ENABLE2 'GND'
+ GPO 'GND'
+ POWER 'GND'
+ }
+ Timing {
+ # fuzz timings by value (100 = no change)
+ fuzz 100
+ # low-level communication [ns]
+ CY 1000 # Enable cycle time
+ PW 450 # Enable pulse width
+ AS 140 # Address setup time
+ AH 20 # Address hold time
+ # HD44780 execution timings [us]
+ INIT1 4100 # first init sequence: 4.1 msec
+ INIT2 100 # second init sequence: 100 usec
+ EXEC 80 # normal execution time
+ WRCG 120 # CG RAM Write
+ CLEAR 2250 # Clear Display
+ HOME 2250 # Return Cursor Home
+ ONOFF 2250 # Display On/Off Control
+ # GPO timing [ns]
+ GPO_ST 20 # 74HCT573 set-up time
+ GPO_PW 230 # 74HCT573 enable pulse width
+ # Power supply timing [ms]
+ POWER 500 # power-on delay
+ }
+}
+
+# HD44780 display 4-Bit mode
+Display HD44780-4bit {
+ Driver 'HD44780'
+ Model 'generic'
+ Port '/dev/parports/0'
+ Size '16x1'
+ Bits 4
+ UseBusy 0
+ asc255bug 0
+ Wire {
+ RW 'GND'
+ RS 'DB4'
+ ENABLE 'DB6'
+ GPO 'GND'
+ }
+}
+
+# Dual-HD44780 display from Pollin
+Display WDC2704M {
+ Driver 'HD44780'
+ Model 'generic'
+ Controllers 2
+ UseBusy 1
+ Port '/dev/parports/0'
+ Size '27x4'
+ Wire {
+ RW 'AUTOFD'
+ RS 'INIT'
+ ENABLE 'STROBE'
+ ENABLE2 'SLCTIN'
+ GPO 'GND'
+ POWER 'GND'
+ }
+}
+
+# HD44780 display from www.kernelconcepts.de
+Display HD44780-kernelconcepts {
+ Driver 'HD44780'
+ Model 'HD66712'
+ UseBusy 1
+ Port '/dev/parports/0'
+ Size '20x4'
+ Wire {
+ RW 'AUTOFD'
+ RS 'INIT'
+ ENABLE 'STROBE'
+ ENABLE2 'GND'
+ GPO 'GND'
+ POWER 'GND'
+ }
+}
+
+Display picoLCD {
+ Driver 'picoLCD'
+ Size '20x2'
+ Contrast 0
+ Backlight 1
+ Icons 1
+}
+
+Display picoLCDGraphic {
+ Driver 'picoLCDGraphic'
+ Size '256x64'
+ Contrast 0
+ Backlight 100
+}
+
+Display SC1602D {
+ Driver 'HD44780'
+ Port '/dev/parports/0'
+ Bits '8'
+ Size '16x2'
+ asc255bug 0
+ Icons 1
+ Wire {
+ RW 'GND'
+ RS 'AUTOFD'
+ ENABLE 'STROBE'
+ GPO 'INIT'
+ POWER 'GND'
+ }
+}
+
+
+Display LCM-162 {
+ Driver 'HD44780'
+ Model 'LCM-162'
+# Bus 'parport'
+ Port '/dev/parports/0'
+ Size '16x2'
+ UseBusy 1
+ asc255bug 0
+ Icons 1
+}
+
+
+Display HD44780-I2C {
+ Driver 'HD44780'
+ Model 'generic'
+ Bus 'i2c'
+ Port '/dev/i2c-0'
+ Device '70'
+ Bits '4'
+ Size '20x4'
+ asc255bug 0
+ Icons 1
+ Wire {
+ RW 'DB5'
+ RS 'DB4'
+ ENABLE 'DB6'
+ GPO 'GND'
+ }
+}
+
+
+Display LCDTerm {
+ Driver 'LCDTerm'
+ Port '/dev/tts/0'
+ Speed 19200
+ Size '20x4'
+ Icons 1
+}
+
+Display SimpleLCD {
+ Driver 'SimpleLCD'
+ Port '/dev/tts/0'
+ Speed 1200
+ Options 0
+ Size '20x2'
+}
+
+Display PHAnderson {
+ Driver 'PHAnderson'
+ Port '/dev/tts/0'
+ Speed 19200
+ Size '24x2'
+ Blackligth 100
+ Bootscreen '123456789012345678901234ABCDEFGHIJKLMNOPQRSTUVWX'
+}
+
+Display BA63 {
+ Driver 'WincorNixdorf'
+ Model 'BA63'
+ Port '/dev/tts/0'
+# Port '/dev/tts/USB0'
+ Speed 9600
+ BarChar 219
+ SelfTest 0
+}
+
+Display M50530-24x8 {
+ Driver 'M50530'
+ Port '/dev/parports/0'
+# Port '0x378'
+ Size '24x8'
+ Font '5x7'
+ Duty 2
+ Wire.RW 'INIT'
+ Wire.EX 'STROBE'
+ Wire.IOC1 'SLCTIN'
+ Wire.IOC2 'AUTOFD'
+ Wire.GPO 'GND'
+ UseBusy 1
+ Timing.fuzz 100
+}
+
+
+Display CT20x4 {
+ Driver 'Beckmann+Egle'
+ Model 'CT20x4'
+ Port '/dev/tts/0'
+# Size '16x2'
+# Contrast 7
+# Backlight 1
+ Icons 1
+}
+
+
+Display ULA200 {
+ Driver 'ULA200'
+ Size '20x4'
+ Icons 0
+ Backlight 1
+}
+
+Display USBLCD {
+ Driver 'USBLCD'
+# Port '/dev/lcd0'
+ Port 'libusb'
+ Size '20x4'
+ asc255bug 1
+ Icons 1
+}
+
+
+Display BWCT {
+ Driver 'BWCT'
+ Size '20x4'
+ Contrast 220
+ asc255bug 1
+ Icons 1
+}
+
+
+Display T6963-240x64 {
+ Driver 'T6963'
+ Port '/dev/parports/0'
+ Size '240x64'
+ DualScan 0
+ Cell 6
+ Wire.CE 'STROBE'
+ Wire.CD 'SLCTIN'
+ Wire.RD 'AUTOFD'
+ Wire.WR 'INIT'
+ Timing.fuzz 120
+ Font '6x8'
+}
+
+Display T6963-240x128 {
+ Driver 'T6963'
+ Port '/dev/parports/0'
+ Size '240x128'
+ DualScan 0
+ Cell 6
+ Wire.CE 'STROBE'
+ Wire.CD 'SLCTIN'
+ Wire.RD 'AUTOFD'
+ Wire.WR 'INIT'
+ Timing.fuzz 120
+ Font '6x8'
+}
+
+Display T6963-240x128D {
+ Driver 'T6963'
+ Port '/dev/parports/0'
+ Size '240x128'
+ DualScan 1
+ Cell 6
+ Wire.CE 'STROBE'
+ Wire.CD 'SLCTIN'
+ Wire.RD 'AUTOFD'
+ Wire.WR 'INIT'
+ Timing.fuzz 120
+ Font '6x8'
+}
+
+
+Display LPH7508 {
+ Driver 'LPH7508'
+ Port '/dev/parports/0'
+ Font '6x8'
+ Contrast 15
+ Inverted 0
+}
+
+Display LPH7508-serdisplib {
+ Driver 'serdisplib'
+ Port 'PAR:/dev/parports/0'
+ Model 'LPH7508'
+}
+
+Display ctinclud {
+ Driver 'serdisplib'
+ Port 'USB:7c0/1501'
+ Model 'CTINCLUD'
+ Options ''
+ Inverted 0
+}
+
+Display ASTUSB {
+ Driver 'ASTUSB'
+ Size '20x4'
+ Backlight 1
+}
+
+Display XWindow {
+ Driver 'X11'
+ Size '120x32'
+ Font '5x8'
+ Pixel '4+1'
+ Gap '-1x-1'
+ Border 20
+ Buttons 2
+ Foreground '000000cc'
+ Background '00000022'
+ Basecolor '80d000'
+ Bordercolor '90e000'
+}
+
+Display Image {
+ Driver 'Image'
+# Format 'PPM'
+ Format 'PNG'
+ Size '120x32'
+ Font '6x8'
+ Pixel '4+1'
+ Gap '-1x-1'
+ Border 20
+# Foreground '#000000'
+# Background '#80d000'
+# Halfground '#70c000'
+ Foreground '000000cc'
+ Background '00000022'
+ Basecolor '80d000'
+}
+
+Display VNC {
+ Driver 'VNC'
+ Font '6x8'
+ Port '5900'
+ Xres '320'
+ Yres '140'
+ Bpp '4'
+ Maxclients '2'
+ Buttons '4'
+ Keypadxofs '40'
+ Keypadyofs '70'
+ Keypadygap '10'
+ Keypadcol '8745877'
+ Osd_showtime '2000'
+# Password 'password'
+ Maxfps '25'
+# HttpDir '/path/to/classfiles'
+ HttpPort '5800'
+}
+
+
+Display FutabaVFD {
+ Driver 'FutabaVFD'
+ Port '/dev/parport0'
+ Size '40x2'
+ Brightness 3
+ Wire {
+ RW 'STROBE'
+ TEST 'AUTOFD'
+ SELECT 'SLCTIN'
+ BUSY 'BUSY'
+ }
+}
+
+
+#Plugin KVV {
+# StationID '12_701'
+# Refresh 30
+# Proxy 'igate'
+# Port 8080;
+#}
+
+Plugin Seti {
+ Directory '/root/setiathome-3.08.i686-pc-linux-gnu'
+}
+
+
+Plugin MySQL {
+ server 'gsmlandia.com' # if none, localhost assumed
+ port 3306 # if none, MySQL default assumed
+ user 'lcd4linux' # if none, lcd4linux unix owner assumed
+ password 'lcd4linux' # if none, empty password assumed
+ database 'lcd4linux' # MUST be specified
+}
+
+Plugin Pop3 {
+ server1 'localhost'
+ port1 110
+ user1 'michael'
+ password1 'secret'
+}
+
+
+Plugin DBus {
+ # signal 0 is displayed IM msg
+ #
+ signal0sender 'im.pidgin.purple.PurpleService' # should be in the form com.domain.app.service,
+ # the :1.23 form given by dbus-monitor will NOT work,
+ # if unsure skip it
+ signal0path '/im/pidgin/purple/PurpleObject' # find using dbus-monitor
+ signal0interface 'im.pidgin.purple.PurpleInterface' # find using dbus-monitor
+ signal0member 'DisplayedImMsg' # find using dbus-monitor
+ signal0eventname 'got_im' # make something up, all Text widgets with an
+ # event option matching this will be updated
+}
+
+
+#this example prints the second argument of signal# 0
+#(in this case it prints the message displayed)
+Widget Pidgin {
+ class 'Text'
+ expression dbus::argument(0, 1) . ': ' . dbus::argument(0, 2))
+ width 20
+ align 'R'
+ event 'got_im'
+}
+
+
+Widget OS {
+ class 'Text'
+ expression '*** '.uname('sysname').' '.uname('release').' ***'
+ width 20
+ align 'M'
+ style 'bold'
+ speed 250
+ update tick
+}
+
+Widget CPU {
+ class 'Text'
+ expression uname('machine')
+ prefix 'CPU '
+ width 9
+ align 'L'
+ style test::onoff(7)>0?'bold':'norm'
+ update tick
+}
+
+
+Widget CPUinfo {
+ class 'Text'
+ expression cpuinfo('model name')
+ prefix ''
+ width 20
+ align 'M'
+ speed 100
+ update tick
+}
+
+
+Widget RAM {
+ class 'Text'
+ expression meminfo('MemTotal')/1024
+ postfix ' MB RAM'
+ width 11
+ precision 0
+ align 'R'
+ update tick
+}
+
+Widget Busy {
+ class 'Text'
+ expression proc_stat::cpu('busy', 500)
+ prefix 'Busy'
+ postfix '%'
+ width 9
+ precision 1
+ align 'R'
+ update tick
+}
+
+Widget BusyBar {
+ class 'Bar'
+ expression proc_stat::cpu('busy', 500)
+ expression2 proc_stat::cpu('system', 500)
+ length 10
+ direction 'E'
+ update tack
+}
+
+Widget Load {
+ class 'Text'
+ expression loadavg(1)
+ prefix 'Load'
+ postfix loadavg(1)>1.0?'!':' '
+ width 10
+ precision 1
+ align 'R'
+ update tick
+}
+
+Widget LoadBar {
+ class 'Bar'
+ expression loadavg(1)
+ max 2.0
+ length 10
+ direction 'E'
+ update tack
+}
+
+
+Widget Disk {
+ class 'Text'
+ # disk.[rw]blk return blocks, we assume a blocksize of 512
+ # to get the number in kB/s we would do blk*512/1024, which is blk/2
+ # expression (proc_stat::disk('.*', 'rblk', 500)+proc_stat::disk('.*', 'wblk', 500))/2
+ # with kernel 2.6, disk_io disappeared from /proc/stat but moved to /proc/diskstat
+ # therefore you have to use another function called 'diskstats':
+ expression diskstats('hd.', 'read_sectors', 500) + diskstats('hd.', 'write_sectors', 500)
+ prefix 'disk'
+ postfix ' '
+ width 10
+ precision 0
+ align 'R'
+ update tick
+}
+
+Widget DiskBar {
+ class 'Bar'
+ #expression proc_stat::disk('.*', 'rblk', 500)
+ #expression2 proc_stat::disk('.*', 'wblk', 500)
+ # for kernel 2.6:
+ expression diskstats('hd.', 'read_sectors', 500)
+ expression2 diskstats('hd.', 'write_sectors', 500)
+ length 14
+ direction 'E'
+ update tack
+}
+
+Widget Eth0 {
+ class 'Text'
+ expression (netdev('eth0', 'Rx_bytes', 500)+netdev('eth0', 'Tx_bytes', 500))/1024
+ prefix 'eth0'
+ postfix ' '
+ width 10
+ precision 0
+ align 'R'
+ update tick
+}
+
+Widget Eth0Bar {
+ class 'Bar'
+ expression netdev('eth0', 'Rx_bytes', 500)
+ expression2 netdev('eth0', 'Tx_bytes', 500)
+ length 14
+ direction 'E'
+ update tack
+}
+
+Widget PPP {
+ class 'Text'
+ expression (ppp('Rx:0', 500)+ppp('Tx:0', 500))
+ prefix 'PPP'
+ width 9
+ precision 0
+ align 'R'
+ update tick
+}
+
+Widget Temp {
+ class 'Text'
+ expression i2c_sensors('temp_input3')*1.0324-67
+ prefix 'Temp'
+ width 9
+ precision 1
+ align 'R'
+ update tick
+}
+
+Widget TempBar {
+ class 'Bar'
+ expression i2c_sensors('temp_input3')*1.0324-67
+ min 40
+ max 80
+ length 10
+ direction 'E'
+ update tack
+}
+
+Widget MySQLtest1 {
+ class 'Text'
+ expression MySQL::query('SELECT id FROM table1')
+ width 20
+ align 'R'
+ prefix 'MySQL test:'
+ update minute
+}
+
+Widget MySQLtest2 {
+ class 'Text'
+ expression MySQL::status()
+ width 20
+ align 'M'
+ prefix 'Status: '
+ update minute
+}
+
+Widget Uptime {
+ class 'Text'
+ expression uptime('%d days %H:%M:%S')
+ width 20
+ align 'R'
+ prefix 'Up '
+ update 1000
+}
+
+Widget mpris_TrackPosition_bar {
+ class 'Bar'
+ expression mpris_dbus::method_PositionGet('org.kde.amarok')
+ length 40
+ min 0
+ max 100
+ direction 'E'
+ style 'H'
+ update 200
+}
+
+# debugging widgets
+
+Widget BarTest {
+ class 'Bar'
+ # test::bar(barno,maxval,startval,delta) - move a test value between 0 and max.
+ # delta= step to change value by each time it's read.
+ # barno - ten different test bar values can be set up, with barno=0..9
+ # if delta=0, just returns the value of bar n instead of changing it.
+ expression test::bar(0,30,25,1)
+ expression2 test::bar(1,30,0,1)
+ length 8
+ # max 50
+ direction 'E'
+ update 10
+}
+
+Widget BarTestVal {
+ class 'Text'
+ expression test::bar(0,100,50,0)
+ prefix 'Test '
+ width 9
+ update 200
+}
+
+Widget LightningTest {
+ class 'icon'
+ speed 500
+ visible test::onoff(0)
+ bitmap {
+ row1 '...***'
+ row2 '..***.'
+ row3 '.***..'
+ row4 '.****.'
+ row5 '..**..'
+ row6 '.**...'
+ row7 '**....'
+ row8 '*.....'
+ }
+}
+
+
+# Icons
+
+Widget Heartbeat {
+ class 'Icon'
+ speed 800
+ Bitmap {
+ Row1 '.....|.....'
+ Row2 '.*.*.|.*.*.'
+ Row3 '*****|*.*.*'
+ Row4 '*****|*...*'
+ Row5 '.***.|.*.*.'
+ Row6 '.***.|.*.*.'
+ Row7 '..*..|..*..'
+ Row8 '.....|.....'
+ }
+}
+
+Widget EKG {
+ class 'Icon'
+ speed 50
+ Bitmap {
+ Row1 '.....|.....|.....|.....|.....|.....|.....|.....'
+ Row2 '.....|....*|...*.|..*..|.*...|*....|.....|.....'
+ Row3 '.....|....*|...*.|..*..|.*...|*....|.....|.....'
+ Row4 '.....|....*|...**|..**.|.**..|**...|*....|.....'
+ Row5 '.....|....*|...**|..**.|.**..|**...|*....|.....'
+ Row6 '.....|....*|...*.|..*.*|.*.*.|*.*..|.*...|*....'
+ Row7 '*****|*****|****.|***..|**..*|*..**|..***|.****'
+ Row8 '.....|.....|.....|.....|.....|.....|.....|.....'
+ }
+}
+Widget Karo {
+ class 'Icon'
+ speed 200
+ Bitmap {
+ Row1 '.....|.....|.....|.....|..*..|.....|.....|.....'
+ Row2 '.....|.....|.....|..*..|.*.*.|..*..|.....|.....'
+ Row3 '.....|.....|..*..|.*.*.|*...*|.*.*.|..*..|.....'
+ Row4 '.....|..*..|.*.*.|*...*|.....|*...*|.*.*.|..*..'
+ Row5 '.....|.....|..*..|.*.*.|*...*|.*.*.|..*..|.....'
+ Row6 '.....|.....|.....|..*..|.*.*.|..*..|.....|.....'
+ Row7 '.....|.....|.....|.....|..*..|.....|.....|.....'
+ Row8 '.....|.....|.....|.....|.....|.....|.....|.....'
+ }
+}
+Widget Heart {
+ class 'Icon'
+ speed 250
+ Bitmap {
+ Row1 '.....|.....|.....|.....|.....|.....'
+ Row2 '.*.*.|.....|.*.*.|.....|.....|.....'
+ Row3 '*****|.*.*.|*****|.*.*.|.*.*.|.*.*.'
+ Row4 '*****|.***.|*****|.***.|.***.|.***.'
+ Row5 '.***.|.***.|.***.|.***.|.***.|.***.'
+ Row6 '.***.|..*..|.***.|..*..|..*..|..*..'
+ Row7 '..*..|.....|..*..|.....|.....|.....'
+ Row8 '.....|.....|.....|.....|.....|.....'
+ }
+}
+Widget Blob {
+ class 'Icon'
+ speed 250
+ Bitmap {
+ Row1 '.....|.....|.....'
+ Row2 '.....|.....|.***.'
+ Row3 '.....|.***.|*...*'
+ Row4 '..*..|.*.*.|*...*'
+ Row5 '.....|.***.|*...*'
+ Row6 '.....|.....|.***.'
+ Row7 '.....|.....|.....'
+ Row8 '.....|.....|.....'
+ }
+}
+Widget Wave {
+ class 'Icon'
+ speed 100
+ Bitmap {
+ Row1 '..**.|.**..|**...|*....|.....|.....|.....|.....|....*|...**'
+ Row2 '.*..*|*..*.|..*..|.*...|*....|.....|.....|....*|...*.|..*..'
+ Row3 '*....|....*|...*.|..*..|.*...|*....|....*|...*.|..*..|.*...'
+ Row4 '*....|....*|...*.|..*..|.*...|*....|....*|...*.|..*..|.*...'
+ Row5 '*....|....*|...*.|..*..|.*...|*....|....*|...*.|..*..|.*...'
+ Row6 '.....|.....|....*|...*.|..*..|.*..*|*..*.|..*..|.*...|*....'
+ Row7 '.....|.....|.....|....*|...**|..**.|.**..|**...|*....|.....'
+ Row8 '.....|.....|.....|.....|.....|.....|.....|.....|.....|.....'
+ }
+}
+Widget Squirrel {
+ class 'Icon'
+ speed 100
+ Bitmap {
+ Row1 '.....|.....|.....|.....|.....|.....'
+ Row2 '.....|.....|.....|.....|.....|.....'
+ Row3 '.....|.....|.....|.....|.....|.....'
+ Row4 '**...|.**..|..**.|...**|....*|.....'
+ Row5 '*****|*****|*****|*****|*****|*****'
+ Row6 '...**|..**.|.**..|**...|*....|.....'
+ Row7 '.....|.....|.....|.....|.....|.....'
+ Row8 '.....|.....|.....|.....|.....|.....'
+ }
+}
+
+Widget Lightning {
+ class 'icon'
+ speed 100
+ visible cpu('busy', 500)-50
+ bitmap {
+ row1 '...***'
+ row2 '..***.'
+ row3 '.***..'
+ row4 '.****.'
+ row5 '..**..'
+ row6 '.**...'
+ row7 '**....'
+ row8 '*.....'
+ }
+}
+
+Widget Rain {
+ class 'icon'
+ speed 200
+ bitmap {
+ row1 '...*.|.....|.....|.*...|....*|..*..|.....|*....'
+ row2 '*....|...*.|.....|.....|.*...|....*|..*..|.....'
+ row3 '.....|*....|...*.|.....|.....|.*...|....*|..*..'
+ row4 '..*..|.....|*....|...*.|.....|.....|.*...|....*'
+ row5 '....*|..*..|.....|*....|...*.|.....|.....|.*...'
+ row6 '.*...|....*|..*..|.....|*....|...*.|.....|.....'
+ row7 '.....|.*...|....*|..*..|.....|*....|...*.|.....'
+ row8 '.....|.....|.*...|....*|..*..|.....|*....|...*.'
+ }
+}
+
+Widget Timer {
+ class 'Icon'
+ speed 50
+ Bitmap {
+ Row1 '.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|'
+ Row2 '.***.|.*+*.|.*++.|.*++.|.*++.|.*++.|.*++.|.*++.|.*++.|.*++.|.*++.|.*++.|.+++.|.+*+.|.+**.|.+**.|.+**.|.+**.|.+**.|.+**.|.+**.|.+**.|.+**.|.+**.|'
+ Row3 '*****|**+**|**++*|**+++|**++.|**++.|**+++|**+++|**+++|**+++|**+++|+++++|+++++|++*++|++**+|++***|++**.|++**.|++***|++***|++***|++***|++***|*****|'
+ Row4 '*****|**+**|**+**|**+**|**+++|**+++|**+++|**+++|**+++|**+++|+++++|+++++|+++++|++*++|++*++|++*++|++***|++***|++***|++***|++***|++***|*****|*****|'
+ Row5 '*****|*****|*****|*****|*****|***++|***++|**+++|*++++|+++++|+++++|+++++|+++++|+++++|+++++|+++++|+++++|+++**|+++**|++***|+****|*****|*****|*****|'
+ Row6 '.***.|.***.|.***.|.***.|.***.|.***.|.**+.|.*++.|.+++.|.+++.|.+++.|.+++.|.+++.|.+++.|.+++.|.+++.|.+++.|.+++.|.++*.|.+**.|.***.|.***.|.***.|.***.|'
+ Row7 '.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|'
+ Row8 '.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|'
+
+
+ }
+}
+
+Widget Test {
+ class 'Text'
+ expression '1234567890123456789012345678901234567890'
+ width 40
+ foreground 'ff0000ff'
+}
+
+Widget Test1 {
+ class 'Text'
+ expression 'ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890'
+ width 40
+ align 'M'
+ speed 100
+}
+
+Widget Test2 {
+ class 'Text'
+ expression '1234567890abcdefghijklmnopqrstuvwxyz'
+ width 40
+ align 'M'
+ speed 150
+}
+
+Widget GPO_Val1 {
+ class 'Text'
+ expression LCD::GPO(1)
+ prefix 'GPO#1'
+ width 10
+ precision 0
+ align 'R'
+ update tick
+}
+
+Widget GPI_Val1 {
+ class 'Text'
+ expression LCD::GPI(1)
+ prefix 'GPI#1'
+ width 10
+ precision 0
+ align 'R'
+ update tick
+}
+
+Widget GPO_Val4 {
+ class 'Text'
+ expression LCD::GPO(4)
+ prefix 'GPO#4'
+ width 10
+ precision 0
+ align 'R'
+ update tick
+}
+
+Widget GPO_Test1 {
+ class 'GPO'
+ expression 255*test::onoff(1)
+ update 300
+}
+
+Widget GPO_Test255 {
+ class 'GPO'
+ expression test::bar(0,255, 0, 1)
+ update 100
+}
+
+Widget ImageTest {
+ class 'Image'
+ file 'tux.png'
+ update 1000
+ visible 1
+ inverted 0
+}
+
+Widget KVV {
+ class 'Text'
+ expression kvv::line(0).' '.kvv::station(0)
+ width 11
+
+ align 'L'
+ update tick
+ Foreground 'ffff00'
+ style 'bold'
+}
+
+Widget KVV_TIME {
+ class 'Text'
+ expression kvv::time_str(0)
+ width 2
+
+ align 'R'
+ update tick
+ foreground kvv::time(0) < 2 ? 'FF0000' : ( kvv::time(0) < 5 ? 'FFFF00' : '00FF00' )
+ style 'bold'
+}
+
+Layout Default {
+ Row1 {
+ Col1 'OS'
+ }
+ Row2 {
+ Col1 'CPU'
+ Col10 'RAM'
+ }
+ Row3 {
+ Col1 'Busy'
+ Col10 'Rain'
+ Col11 'BusyBar'
+ }
+ Row4 {
+ Col1 'Load'
+ Col11 'LoadBar'
+ }
+ Row5 {
+ Col1 'Disk'
+ Col11 'DiskBar'
+ }
+ Row6 {
+ Col1 'Eth0'
+ Col11 'Eth0Bar'
+ }
+}
+
+Layout TestLayer {
+ Row1 {
+ Col1 'OS'
+ }
+ Row2 {
+ Col1 'CPU'
+ Col10 'RAM'
+ }
+ Row3 {
+ Col1 'Busy'
+ Col10 'Rain'
+ Col11 'BusyBar'
+ }
+ Row4 {
+ Col1 'Load'
+ Col11 'LoadBar'
+ }
+ Row5 {
+ Col1 'Disk'
+ Col11 'DiskBar'
+ }
+ Row6 {
+ Col1 'Eth0'
+ Col11 'Eth0Bar'
+ }
+ Layer 2 {
+ X1.Y1 'ImageTest'
+ }
+}
+
+Layout TestImage {
+ Layer 2 {
+ X1.Y1 'ImageTest'
+ }
+}
+
+Layout L24x8 {
+ Row1 {
+ Col1 'Load'
+ Col11 'BusyBar'
+ }
+ Row2 {
+ }
+}
+
+Layout L8x2 {
+ Row1 {
+ Col1 'Busy'
+ }
+ Row2 {
+ Col1 'BarTest'
+ }
+}
+
+Layout L16x1 {
+ Row1 {
+ Col1 'Busy'
+ Col11 'BusyBar'
+ }
+}
+
+Layout L16x2 {
+ Row1 {
+ Col1 'Busy'
+ Col11 'BusyBar'
+ }
+ Row2 {
+ Col1 'Disk'
+ #Col11 'DiskBar'
+ Col11 'BarTest'
+ }
+}
+
+Layout L20x2 {
+ Row1 {
+ Col1 'CPUinfo'
+ }
+ Row2 {
+ Col1 'Busy'
+ Col11 'BusyBar'
+ }
+}
+
+Layout L40x2 {
+ Row1 {
+ Col1 'OS'
+ Col21 'Busy'
+ Col31 'BusyBar'
+ }
+ Row2 {
+ Col1 'CPU'
+ Col10 'RAM'
+ Col21 'Load'
+ Col31 'LoadBar'
+ }
+}
+
+Layout Test {
+ Row01.Col1 'Test1'
+ Row02.Col1 'Test1'
+ Row03.Col1 'Test1'
+ Row04.Col1 'Test1'
+ Row05.Col1 'Test1'
+ Row06.Col1 'Test1'
+ Row07.Col1 'Test1'
+ Row08.Col1 'Test1'
+ Row09.Col1 'Test1'
+ Row10.Col1 'Test1'
+ Row11.Col1 'Test1'
+ Row12.Col1 'Test1'
+ Row13.Col1 'Test1'
+ Row14.Col1 'Test1'
+ Row15.Col1 'Test1'
+ Row16.Col1 'Test1'
+ Row17.Col1 'Test1'
+ Row18.Col1 'Test1'
+ Row19.Col1 'Test1'
+ Row20.Col1 'Test1'
+ Row21.Col1 'Test1'
+ Row22.Col1 'Test1'
+ Row23.Col1 'Test1'
+ Row24.Col1 'Test1'
+}
+
+Layout Test2 {
+ Row01.Col1 'Test1'
+ #Row02.Col1 'Rain'
+ Row02.Col1 'Test2'
+ Row03.Col1 'Test1'
+ Row04.Col1 'Test2'
+ Row05.Col1 'Test1'
+ Row06.Col1 'Test2'
+ Row07.Col1 'Test1'
+ Row08.Col1 'Test2'
+}
+
+Layout TestGPO {
+ Row1.Col1 'GPO_Val1'
+ Row1.Col10 'GPI_Val1'
+ Row2.Col1 'GPO_Val4'
+ GPO1 'GPO_Test255'
+ GPO4 'GPO_Test1'
+}
+
+Layout TestIcons {
+ Row1.Col1 'Timer'
+ Row1.Col2 'Rain'
+ Row1.Col3 'Squirrel'
+ Row1.Col4 'Wave'
+ Row1.Col5 'Blob'
+ Row1.Col6 'Heart'
+ Row1.Col7 'Karo'
+ Row1.Col8 'EKG'
+}
+
+Layout testMySQL {
+ Row1 {
+ Col1 'MySQLtest1'
+ }
+ Row2 {
+ Col1 'MySQLtest2'
+ }
+}
+
+Layout Debug {
+ #Row09.Col1 'Test'
+ Row09.Col1 'Heartbeat'
+}
+
+
+
+Display 'ACool'
+#Display 'SerDispLib'
+#Display 'LCD-Linux'
+#Display 'LCD2041'
+#Display 'LK202'
+#Display 'LK204'
+#Display 'MI240'
+#Display 'CW12232'
+#Display 'NULL'
+#Display 'HD44780-generic'
+#Display 'HD44780-WinAmp'
+#Display 'HD44780-4bit'
+#Display 'WDC2704M'
+#Display 'SC1602D'
+#Display 'LCM-162'
+#Display 'CF631'
+#Display 'CF632'
+#Display 'CF633'
+#Display 'Curses'
+#Display 'M50530-24x8'
+#Display 'LCDTerm'
+#Display 'SimpleLCD'
+#Display 'BA63'
+#Display 'CT20x4'
+#Display 'T6963-240x64'
+#Display 'T6963-240x128'
+#Display 'T6963-240x128D'
+#Display 'XWindow'
+#Display 'IRLCD'
+#Display 'USBLCD'
+#Display 'BWCT'
+#Display 'Image'
+#Display 'TeakLCD'
+#Display 'Trefon'
+#Display 'LCD2USB'
+#Display 'LPH7508-serdisplib'
+#Display 'LPH7508'
+#Display 'ctinclud'
+#Display 'picoLCD'
+#Display 'VNC'
+#Display 'FutabaVFD'
+#Display 'GLCD2USB'
+
+#Layout 'Default'
+Layout 'TestLayer'
+#Layout 'TestImage'
+#Layout 'L8x2'
+#Layout 'L16x1'
+#Layout 'L16x2'
+#Layout 'L20x2'
+#Layout 'L40x2'
+#Layout 'Test'
+#Layout 'Test2'
+#Layout 'TestGPO'
+#Layout 'Debug'
+#Layout 'TestIcons'
diff --git a/lcd4linux.kdelnk b/lcd4linux.kdelnk
new file mode 100644
index 0000000..357cd38
--- /dev/null
+++ b/lcd4linux.kdelnk
@@ -0,0 +1,14 @@
+# KDE Config File
+[KDE Desktop Entry]
+Comment[C]=LCD4Linux
+SwallowExec=lcd4linux -f /etc/lcd4kde.conf
+SwallowTitle=XLCD4Linux
+BinaryPattern=
+Name=LCD4Linux
+Name[C]=LCD4Linux
+MimeType=
+Comment=LCD4Linux
+Exec=lcd4linux -f /etc/lcd4X11.conf
+Icon=lcd4linux.xpm
+Type=Application
+Terminal=0
diff --git a/lcd4linux.lsm b/lcd4linux.lsm
new file mode 100644
index 0000000..22fc5b3
--- /dev/null
+++ b/lcd4linux.lsm
@@ -0,0 +1,16 @@
+Begin4
+Title: lcd4linux
+Version: 0.95
+Entered-date: 2000-03-28
+Description: system and ISDN information is shown on
+ an external display or in a X11 window.
+Keywords: LCD
+Author: michael@reinelt.co.at (Michael Reinelt)
+Maintained-by: michael@reinelt.co.at (Michael Reinelt)
+Primary-site: download.sourceforge.net /pub/sourceforge/lcd4linux
+ 54k lcd4linux-0.95.tar.gz
+Alternate-site: http://lcd4linux.sourceforge.net
+Original-site:
+Platforms:
+Copying-policy: GPL
+End
diff --git a/lcd4linux.xpm b/lcd4linux.xpm
new file mode 100644
index 0000000..7db7f02
--- /dev/null
+++ b/lcd4linux.xpm
@@ -0,0 +1,62 @@
+/* XPM */
+
+/*
+ * Copyright 1999 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+static char *lcd4linux[] = {
+"38 32 3 1",
+" c None",
+"# c #102000",
+". c #a0d000",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+"......................................",
+"..##............######....######......",
+"..##............######....######......",
+"..##..........##......##..##....##....",
+"..##..........##......##..##....##....",
+"..##..........##..........##......##..",
+"..##..........##..........##......##..",
+"..##..........##..........##......##..",
+"..##..........##..........##......##..",
+"..##..........##..........##......##..",
+"..##..........##..........##......##..",
+"..##..........##......##..##....##....",
+"..##..........##......##..##....##....",
+"..##########....######....######......",
+"..##########....######....######......",
+"......................................",
+"......................................",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+};
diff --git a/lcd4linux_i2c.h b/lcd4linux_i2c.h
new file mode 100644
index 0000000..f6820b3
--- /dev/null
+++ b/lcd4linux_i2c.h
@@ -0,0 +1,611 @@
+/* $Id: lcd4linux_i2c.h 1164 2011-12-22 10:48:01Z mjona $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/lcd4linux_i2c.h $
+ *
+ * user space i2c sturctures and defines, taken from the official kernel i2c
+ * includes to solve the problem when compiling user space application
+ * (lcd4linux) with kernel space includes.
+ * Should be removed when the kernel team decides on how to solve this
+ * user space/kernel space compilation problem in kernel 2.8 or so.
+ *
+ * Copyright (C) 2005 Paul Kamphuis <pk_richman@users.sourceforge.net>
+ * Copyright (C) 2005 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * taken from kernel includes i2c.h and i2c-dev.h to prevent using kernel includes
+ * Copyright (C) 1995-2000 Simon G. Vogl
+ * With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and
+ * Frodo Looijaard <frodol@dds.nl>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+#ifndef _LCD4LINUX_I2C_H
+#define _LCD4LINUX_I2C_H
+
+typedef signed int s32;
+typedef signed int __s32;
+typedef unsigned char u8;
+typedef unsigned short u16;
+typedef unsigned char __u8;
+typedef unsigned short __u16;
+typedef unsigned int u32;
+typedef unsigned int __u32;
+
+/* --- General options ------------------------------------------------ */
+
+struct i2c_msg;
+struct i2c_algorithm;
+struct i2c_adapter;
+struct i2c_client;
+struct i2c_driver;
+struct i2c_client_address_data;
+union i2c_smbus_data;
+
+/*
+ * The master routines are the ones normally used to transmit data to devices
+ * on a bus (or read from them). Apart from two basic transfer functions to
+ * transmit one message at a time, a more complex version can be used to
+ * transmit an arbitrary number of messages without interruption.
+ */
+extern int i2c_master_send(struct i2c_client *, const char *, int);
+extern int i2c_master_recv(struct i2c_client *, char *, int);
+
+/* Transfer num messages.
+ */
+extern int i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msg, int num);
+
+/*
+ * Some adapter types (i.e. PCF 8584 based ones) may support slave behaviuor.
+ * This is not tested/implemented yet and will change in the future.
+ */
+extern int i2c_slave_send(struct i2c_client *, char *, int);
+extern int i2c_slave_recv(struct i2c_client *, char *, int);
+
+
+
+/* This is the very generalized SMBus access routine. You probably do not
+ want to use this, though; one of the functions below may be much easier,
+ and probably just as fast.
+ Note that we use i2c_adapter here, because you do not need a specific
+ smbus adapter to call this function. */
+extern s32 i2c_smbus_xfer(struct i2c_adapter *adapter, u16 addr,
+ unsigned short flags, char read_write, u8 command, int size, union i2c_smbus_data *data);
+
+/* Now follow the 'nice' access routines. These also document the calling
+ conventions of smbus_access. */
+/*
+extern s32 i2c_smbus_write_quick(struct i2c_client * client, u8 value);
+extern s32 i2c_smbus_read_byte(struct i2c_client * client);
+extern s32 i2c_smbus_write_byte(struct i2c_client * client, u8 value);
+extern s32 i2c_smbus_read_byte_data(struct i2c_client * client, u8 command);
+extern s32 i2c_smbus_write_byte_data(struct i2c_client * client,
+ u8 command, u8 value);
+extern s32 i2c_smbus_read_word_data(struct i2c_client * client, u8 command);
+extern s32 i2c_smbus_write_word_data(struct i2c_client * client,
+ u8 command, u16 value);
+*/
+/* Returns the number of bytes transferred */
+/*
+extern s32 i2c_smbus_write_block_data(struct i2c_client * client,
+ u8 command, u8 length,
+ u8 *values);
+extern s32 i2c_smbus_read_i2c_block_data(struct i2c_client * client,
+ u8 command, u8 *values);
+*/
+
+/*
+ * A driver is capable of handling one or more physical devices present on
+ * I2C adapters. This information is used to inform the driver of adapter
+ * events.
+ */
+
+/*flags for the driver struct: */
+#define I2C_DF_NOTIFY 0x01 /* notify on bus (de/a)ttaches */
+
+/*flags for the client struct: */
+#define I2C_CLIENT_ALLOW_USE 0x01 /* Client allows access */
+#define I2C_CLIENT_ALLOW_MULTIPLE_USE 0x02 /* Allow multiple access-locks */
+ /* on an i2c_client */
+#define I2C_CLIENT_PEC 0x04 /* Use Packet Error Checking */
+#define I2C_CLIENT_TEN 0x10 /* we have a ten bit chip address */
+ /* Must equal I2C_M_TEN below */
+
+/* i2c adapter classes (bitmask) */
+#define I2C_CLASS_HWMON (1<<0) /* lm_sensors, ... */
+#define I2C_CLASS_TV_ANALOG (1<<1) /* bttv + friends */
+#define I2C_CLASS_TV_DIGITAL (1<<2) /* dvb cards */
+#define I2C_CLASS_DDC (1<<3) /* i2c-matroxfb ? */
+#define I2C_CLASS_CAM_ANALOG (1<<4) /* camera with analog CCD */
+#define I2C_CLASS_CAM_DIGITAL (1<<5) /* most webcams */
+#define I2C_CLASS_SOUND (1<<6) /* sound devices */
+#define I2C_CLASS_ALL (UINT_MAX) /* all of the above */
+
+/* i2c_client_address_data is the struct for holding default client
+ * addresses for a driver and for the parameters supplied on the
+ * command line
+ */
+struct i2c_client_address_data {
+ unsigned short *normal_i2c;
+ unsigned short *normal_i2c_range;
+ unsigned short *probe;
+ unsigned short *probe_range;
+ unsigned short *ignore;
+ unsigned short *ignore_range;
+ unsigned short *force;
+};
+
+/* Internal numbers to terminate lists */
+#define I2C_CLIENT_END 0xfffe
+#define I2C_CLIENT_ISA_END 0xfffefffe
+
+/* The numbers to use to set I2C bus address */
+#define ANY_I2C_BUS 0xffff
+#define ANY_I2C_ISA_BUS 9191
+
+/* The length of the option lists */
+#define I2C_CLIENT_MAX_OPTS 48
+
+
+/* ----- functions exported by i2c.o */
+
+/* administration...
+ */
+extern int i2c_add_adapter(struct i2c_adapter *);
+extern int i2c_del_adapter(struct i2c_adapter *);
+
+extern int i2c_add_driver(struct i2c_driver *);
+extern int i2c_del_driver(struct i2c_driver *);
+
+extern int i2c_attach_client(struct i2c_client *);
+extern int i2c_detach_client(struct i2c_client *);
+
+/* New function: This is to get an i2c_client-struct for controlling the
+ client either by using i2c_control-function or having the
+ client-module export functions that can be used with the i2c_client
+ -struct. */
+extern struct i2c_client *i2c_get_client(int driver_id, int adapter_id, struct i2c_client *prev);
+
+/* Should be used with new function
+ extern struct i2c_client *i2c_get_client(int,int,struct i2c_client *);
+ to make sure that client-struct is valid and that it is okay to access
+ the i2c-client.
+ returns -EACCES if client doesn't allow use (default)
+ returns -EBUSY if client doesn't allow multiple use (default) and
+ usage_count >0 */
+extern int i2c_use_client(struct i2c_client *);
+extern int i2c_release_client(struct i2c_client *);
+
+/* call the i2c_client->command() of all attached clients with
+ * the given arguments */
+extern void i2c_clients_command(struct i2c_adapter *adap, unsigned int cmd, void *arg);
+
+/* returns -EBUSY if address has been taken, 0 if not. Note that the only
+ other place at which this is called is within i2c_attach_client; so
+ you can cheat by simply not registering. Not recommended, of course! */
+extern int i2c_check_addr(struct i2c_adapter *adapter, int addr);
+
+/* Detect function. It iterates over all possible addresses itself.
+ * It will only call found_proc if some client is connected at the
+ * specific address (unless a 'force' matched);
+ */
+extern int i2c_probe(struct i2c_adapter *adapter, struct i2c_client_address_data *address_data,
+ int (*found_proc) (struct i2c_adapter *, int, int));
+
+/* An ioctl like call to set div. parameters of the adapter.
+ */
+extern int i2c_control(struct i2c_client *, unsigned int, unsigned long);
+
+/* This call returns a unique low identifier for each registered adapter,
+ * or -1 if the adapter was not registered.
+ */
+extern int i2c_adapter_id(struct i2c_adapter *adap);
+extern struct i2c_adapter *i2c_get_adapter(int id);
+extern void i2c_put_adapter(struct i2c_adapter *adap);
+
+
+/* Return the functionality mask */
+extern u32 i2c_get_functionality(struct i2c_adapter *adap);
+
+/* Return 1 if adapter supports everything we need, 0 if not. */
+extern int i2c_check_functionality(struct i2c_adapter *adap, u32 func);
+
+/*
+ * I2C Message - used for pure i2c transaction, also from /dev interface
+ */
+struct i2c_msg {
+ __u16 addr; /* slave address */
+ __u16 flags;
+#define I2C_M_TEN 0x10 /* we have a ten bit chip address */
+#define I2C_M_RD 0x01
+#define I2C_M_NOSTART 0x4000
+#define I2C_M_REV_DIR_ADDR 0x2000
+#define I2C_M_IGNORE_NAK 0x1000
+#define I2C_M_NO_RD_ACK 0x0800
+ __u16 len; /* msg length */
+ __u8 *buf; /* pointer to msg data */
+};
+
+/* To determine what functionality is present */
+
+#define I2C_FUNC_I2C 0x00000001
+#define I2C_FUNC_10BIT_ADDR 0x00000002
+#define I2C_FUNC_PROTOCOL_MANGLING 0x00000004 /* I2C_M_{REV_DIR_ADDR,NOSTART,..} */
+#define I2C_FUNC_SMBUS_HWPEC_CALC 0x00000008 /* SMBus 2.0 */
+#define I2C_FUNC_SMBUS_READ_WORD_DATA_PEC 0x00000800 /* SMBus 2.0 */
+#define I2C_FUNC_SMBUS_WRITE_WORD_DATA_PEC 0x00001000 /* SMBus 2.0 */
+#define I2C_FUNC_SMBUS_PROC_CALL_PEC 0x00002000 /* SMBus 2.0 */
+#define I2C_FUNC_SMBUS_BLOCK_PROC_CALL_PEC 0x00004000 /* SMBus 2.0 */
+#define I2C_FUNC_SMBUS_BLOCK_PROC_CALL 0x00008000 /* SMBus 2.0 */
+#define I2C_FUNC_SMBUS_QUICK 0x00010000
+#define I2C_FUNC_SMBUS_READ_BYTE 0x00020000
+#define I2C_FUNC_SMBUS_WRITE_BYTE 0x00040000
+#define I2C_FUNC_SMBUS_READ_BYTE_DATA 0x00080000
+#define I2C_FUNC_SMBUS_WRITE_BYTE_DATA 0x00100000
+#define I2C_FUNC_SMBUS_READ_WORD_DATA 0x00200000
+#define I2C_FUNC_SMBUS_WRITE_WORD_DATA 0x00400000
+#define I2C_FUNC_SMBUS_PROC_CALL 0x00800000
+#define I2C_FUNC_SMBUS_READ_BLOCK_DATA 0x01000000
+#define I2C_FUNC_SMBUS_WRITE_BLOCK_DATA 0x02000000
+#define I2C_FUNC_SMBUS_READ_I2C_BLOCK 0x04000000 /* I2C-like block xfer */
+#define I2C_FUNC_SMBUS_WRITE_I2C_BLOCK 0x08000000 /* w/ 1-byte reg. addr. */
+#define I2C_FUNC_SMBUS_READ_I2C_BLOCK_2 0x10000000 /* I2C-like block xfer */
+#define I2C_FUNC_SMBUS_WRITE_I2C_BLOCK_2 0x20000000 /* w/ 2-byte reg. addr. */
+#define I2C_FUNC_SMBUS_READ_BLOCK_DATA_PEC 0x40000000 /* SMBus 2.0 */
+#define I2C_FUNC_SMBUS_WRITE_BLOCK_DATA_PEC 0x80000000 /* SMBus 2.0 */
+
+#define I2C_FUNC_SMBUS_BYTE I2C_FUNC_SMBUS_READ_BYTE | \
+ I2C_FUNC_SMBUS_WRITE_BYTE
+#define I2C_FUNC_SMBUS_BYTE_DATA I2C_FUNC_SMBUS_READ_BYTE_DATA | \
+ I2C_FUNC_SMBUS_WRITE_BYTE_DATA
+#define I2C_FUNC_SMBUS_WORD_DATA I2C_FUNC_SMBUS_READ_WORD_DATA | \
+ I2C_FUNC_SMBUS_WRITE_WORD_DATA
+#define I2C_FUNC_SMBUS_BLOCK_DATA I2C_FUNC_SMBUS_READ_BLOCK_DATA | \
+ I2C_FUNC_SMBUS_WRITE_BLOCK_DATA
+#define I2C_FUNC_SMBUS_I2C_BLOCK I2C_FUNC_SMBUS_READ_I2C_BLOCK | \
+ I2C_FUNC_SMBUS_WRITE_I2C_BLOCK
+#define I2C_FUNC_SMBUS_I2C_BLOCK_2 I2C_FUNC_SMBUS_READ_I2C_BLOCK_2 | \
+ I2C_FUNC_SMBUS_WRITE_I2C_BLOCK_2
+#define I2C_FUNC_SMBUS_BLOCK_DATA_PEC I2C_FUNC_SMBUS_READ_BLOCK_DATA_PEC | \
+ I2C_FUNC_SMBUS_WRITE_BLOCK_DATA_PEC
+#define I2C_FUNC_SMBUS_WORD_DATA_PEC I2C_FUNC_SMBUS_READ_WORD_DATA_PEC | \
+ I2C_FUNC_SMBUS_WRITE_WORD_DATA_PEC
+
+#define I2C_FUNC_SMBUS_READ_BYTE_PEC I2C_FUNC_SMBUS_READ_BYTE_DATA
+#define I2C_FUNC_SMBUS_WRITE_BYTE_PEC I2C_FUNC_SMBUS_WRITE_BYTE_DATA
+#define I2C_FUNC_SMBUS_READ_BYTE_DATA_PEC I2C_FUNC_SMBUS_READ_WORD_DATA
+#define I2C_FUNC_SMBUS_WRITE_BYTE_DATA_PEC I2C_FUNC_SMBUS_WRITE_WORD_DATA
+#define I2C_FUNC_SMBUS_BYTE_PEC I2C_FUNC_SMBUS_BYTE_DATA
+#define I2C_FUNC_SMBUS_BYTE_DATA_PEC I2C_FUNC_SMBUS_WORD_DATA
+
+#define I2C_FUNC_SMBUS_EMUL I2C_FUNC_SMBUS_QUICK | \
+ I2C_FUNC_SMBUS_BYTE | \
+ I2C_FUNC_SMBUS_BYTE_DATA | \
+ I2C_FUNC_SMBUS_WORD_DATA | \
+ I2C_FUNC_SMBUS_PROC_CALL | \
+ I2C_FUNC_SMBUS_WRITE_BLOCK_DATA | \
+ I2C_FUNC_SMBUS_WRITE_BLOCK_DATA_PEC | \
+ I2C_FUNC_SMBUS_I2C_BLOCK
+
+/*
+ * Data for SMBus Messages
+ */
+#define I2C_SMBUS_BLOCK_MAX 32 /* As specified in SMBus standard */
+#define I2C_SMBUS_I2C_BLOCK_MAX 32 /* Not specified but we use same structure */
+union i2c_smbus_data {
+ __u8 byte;
+ __u16 word;
+ __u8 block[I2C_SMBUS_BLOCK_MAX + 3]; /* block[0] is used for length */
+ /* one more for read length in block process call */
+ /* and one more for PEC */
+};
+
+/* smbus_access read or write markers */
+#define I2C_SMBUS_READ 1
+#define I2C_SMBUS_WRITE 0
+
+/* SMBus transaction types (size parameter in the above functions)
+ Note: these no longer correspond to the (arbitrary) PIIX4 internal codes! */
+#define I2C_SMBUS_QUICK 0
+#define I2C_SMBUS_BYTE 1
+#define I2C_SMBUS_BYTE_DATA 2
+#define I2C_SMBUS_WORD_DATA 3
+#define I2C_SMBUS_PROC_CALL 4
+#define I2C_SMBUS_BLOCK_DATA 5
+#define I2C_SMBUS_I2C_BLOCK_DATA 6
+#define I2C_SMBUS_BLOCK_PROC_CALL 7 /* SMBus 2.0 */
+#define I2C_SMBUS_BLOCK_DATA_PEC 8 /* SMBus 2.0 */
+#define I2C_SMBUS_PROC_CALL_PEC 9 /* SMBus 2.0 */
+#define I2C_SMBUS_BLOCK_PROC_CALL_PEC 10 /* SMBus 2.0 */
+#define I2C_SMBUS_WORD_DATA_PEC 11 /* SMBus 2.0 */
+
+
+/* ----- commands for the ioctl like i2c_command call:
+ * note that additional calls are defined in the algorithm and hw
+ * dependent layers - these can be listed here, or see the
+ * corresponding header files.
+ */
+ /* -> bit-adapter specific ioctls */
+#define I2C_RETRIES 0x0701 /* number of times a device address */
+ /* should be polled when not */
+ /* acknowledging */
+#define I2C_TIMEOUT 0x0702 /* set timeout - call with int */
+
+
+/* this is for i2c-dev.c */
+#define I2C_SLAVE 0x0703 /* Change slave address */
+ /* Attn.: Slave address is 7 or 10 bits */
+#define I2C_SLAVE_FORCE 0x0706 /* Change slave address */
+ /* Attn.: Slave address is 7 or 10 bits */
+ /* This changes the address, even if it */
+ /* is already taken! */
+#define I2C_TENBIT 0x0704 /* 0 for 7 bit addrs, != 0 for 10 bit */
+
+#define I2C_FUNCS 0x0705 /* Get the adapter functionality */
+#define I2C_RDWR 0x0707 /* Combined R/W transfer (one stop only) */
+#define I2C_PEC 0x0708 /* != 0 for SMBus PEC */
+#if 0
+#define I2C_ACK_TEST 0x0710 /* See if a slave is at a specific address */
+#endif
+
+#define I2C_SMBUS 0x0720 /* SMBus-level access */
+
+/* ... algo-bit.c recognizes */
+#define I2C_UDELAY 0x0705 /* set delay in microsecs between each */
+ /* written byte (except address) */
+#define I2C_MDELAY 0x0706 /* millisec delay between written bytes */
+
+/* ----- I2C-DEV: char device interface stuff ------------------------- */
+
+#define I2C_MAJOR 89 /* Device major number */
+
+/* These defines are used for probing i2c client addresses */
+/* Default fill of many variables */
+#define I2C_CLIENT_DEFAULTS {I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
+ I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
+ I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
+ I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
+ I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
+ I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
+ I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
+ I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
+ I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
+ I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
+ I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
+ I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
+ I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
+ I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
+ I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
+ I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END}
+
+/* This is ugly. We need to evaluate I2C_CLIENT_MAX_OPTS before it is
+ stringified */
+#define I2C_CLIENT_MODPARM_AUX1(x) "1-" #x "h"
+#define I2C_CLIENT_MODPARM_AUX(x) I2C_CLIENT_MODPARM_AUX1(x)
+#define I2C_CLIENT_MODPARM I2C_CLIENT_MODPARM_AUX(I2C_CLIENT_MAX_OPTS)
+
+/* I2C_CLIENT_MODULE_PARM creates a module parameter, and puts it in the
+ module header */
+
+#define I2C_CLIENT_MODULE_PARM(var,desc) \
+ static unsigned short var[I2C_CLIENT_MAX_OPTS] = I2C_CLIENT_DEFAULTS; \
+ static unsigned int var##_num; \
+ /*MODULE_PARM(var,I2C_CLIENT_MODPARM);*/ \
+ module_param_array(var, short, &var##_num, 0); \
+ MODULE_PARM_DESC(var,desc)
+
+/* This is the one you want to use in your own modules */
+#define I2C_CLIENT_INSMOD \
+ I2C_CLIENT_MODULE_PARM(probe, \
+ "List of adapter,address pairs to scan additionally"); \
+ I2C_CLIENT_MODULE_PARM(probe_range, \
+ "List of adapter,start-addr,end-addr triples to scan " \
+ "additionally"); \
+ I2C_CLIENT_MODULE_PARM(ignore, \
+ "List of adapter,address pairs not to scan"); \
+ I2C_CLIENT_MODULE_PARM(ignore_range, \
+ "List of adapter,start-addr,end-addr triples not to " \
+ "scan"); \
+ I2C_CLIENT_MODULE_PARM(force, \
+ "List of adapter,address pairs to boldly assume " \
+ "to be present"); \
+ static struct i2c_client_address_data addr_data = { \
+ .normal_i2c = normal_i2c, \
+ .normal_i2c_range = normal_i2c_range, \
+ .probe = probe, \
+ .probe_range = probe_range, \
+ .ignore = ignore, \
+ .ignore_range = ignore_range, \
+ .force = force, \
+ }
+
+/* Detect whether we are on the isa bus. If this returns true, all i2c
+ access will fail! */
+#define i2c_is_isa_client(clientptr) \
+ ((clientptr)->adapter->algo->id == I2C_ALGO_ISA)
+#define i2c_is_isa_adapter(adapptr) \
+ ((adapptr)->algo->id == I2C_ALGO_ISA)
+
+
+/* Some IOCTL commands are defined in <linux/i2c.h> */
+/* Note: 10-bit addresses are NOT supported! */
+
+/* This is the structure as used in the I2C_SMBUS ioctl call */
+struct i2c_smbus_ioctl_data {
+ __u8 read_write;
+ __u8 command;
+ __u32 size;
+ union i2c_smbus_data *data;
+};
+
+/* This is the structure as used in the I2C_RDWR ioctl call */
+struct i2c_rdwr_ioctl_data {
+ struct i2c_msg *msgs; /* pointers to i2c_msgs */
+ __u32 nmsgs; /* number of i2c_msgs */
+};
+
+#define I2C_RDRW_IOCTL_MAX_MSGS 42
+
+#include <stdlib.h>
+#include <sys/ioctl.h>
+
+static inline __s32 i2c_smbus_access(int file, char read_write, __u8 command, int size, union i2c_smbus_data *data)
+{
+ struct i2c_smbus_ioctl_data args;
+
+ args.read_write = read_write;
+ args.command = command;
+ args.size = size;
+ args.data = data;
+ return ioctl(file, I2C_SMBUS, &args);
+}
+
+
+static inline __s32 i2c_smbus_write_quick(int file, __u8 value)
+{
+ return i2c_smbus_access(file, value, 0, I2C_SMBUS_QUICK, NULL);
+}
+
+static inline __s32 i2c_smbus_read_byte(int file)
+{
+ union i2c_smbus_data data;
+ if (i2c_smbus_access(file, I2C_SMBUS_READ, 0, I2C_SMBUS_BYTE, &data))
+ return -1;
+ else
+ return 0x0FF & data.byte;
+}
+
+static inline __s32 i2c_smbus_write_byte(int file, __u8 value)
+{
+ return i2c_smbus_access(file, I2C_SMBUS_WRITE, value, I2C_SMBUS_BYTE, NULL);
+}
+
+static inline __s32 i2c_smbus_read_byte_data(int file, __u8 command)
+{
+ union i2c_smbus_data data;
+ if (i2c_smbus_access(file, I2C_SMBUS_READ, command, I2C_SMBUS_BYTE_DATA, &data))
+ return -1;
+ else
+ return 0x0FF & data.byte;
+}
+
+static inline __s32 i2c_smbus_write_byte_data(int file, __u8 command, __u8 value)
+{
+ union i2c_smbus_data data;
+ data.byte = value;
+ return i2c_smbus_access(file, I2C_SMBUS_WRITE, command, I2C_SMBUS_BYTE_DATA, &data);
+}
+
+static inline __s32 i2c_smbus_read_word_data(int file, __u8 command)
+{
+ union i2c_smbus_data data;
+ if (i2c_smbus_access(file, I2C_SMBUS_READ, command, I2C_SMBUS_WORD_DATA, &data))
+ return -1;
+ else
+ return 0x0FFFF & data.word;
+}
+
+static inline __s32 i2c_smbus_write_word_data(int file, __u8 command, __u16 value)
+{
+ union i2c_smbus_data data;
+ data.word = value;
+ return i2c_smbus_access(file, I2C_SMBUS_WRITE, command, I2C_SMBUS_WORD_DATA, &data);
+}
+
+static inline __s32 i2c_smbus_process_call(int file, __u8 command, __u16 value)
+{
+ union i2c_smbus_data data;
+ data.word = value;
+ if (i2c_smbus_access(file, I2C_SMBUS_WRITE, command, I2C_SMBUS_PROC_CALL, &data))
+ return -1;
+ else
+ return 0x0FFFF & data.word;
+}
+
+
+/* Returns the number of read bytes */
+static inline __s32 i2c_smbus_read_block_data(int file, __u8 command, __u8 * values)
+{
+ union i2c_smbus_data data;
+ int i;
+ if (i2c_smbus_access(file, I2C_SMBUS_READ, command, I2C_SMBUS_BLOCK_DATA, &data))
+ return -1;
+ else {
+ for (i = 1; i <= data.block[0]; i++)
+ values[i - 1] = data.block[i];
+ return data.block[0];
+ }
+}
+
+static inline __s32 i2c_smbus_write_block_data(int file, __u8 command, __u8 length, __u8 * values)
+{
+ union i2c_smbus_data data;
+ int i;
+ if (length > 32)
+ length = 32;
+ for (i = 1; i <= length; i++)
+ data.block[i] = values[i - 1];
+ data.block[0] = length;
+ return i2c_smbus_access(file, I2C_SMBUS_WRITE, command, I2C_SMBUS_BLOCK_DATA, &data);
+}
+
+/* Returns the number of read bytes */
+static inline __s32 i2c_smbus_read_i2c_block_data(int file, __u8 command, __u8 * values)
+{
+ union i2c_smbus_data data;
+ int i;
+ if (i2c_smbus_access(file, I2C_SMBUS_READ, command, I2C_SMBUS_I2C_BLOCK_DATA, &data))
+ return -1;
+ else {
+ for (i = 1; i <= data.block[0]; i++)
+ values[i - 1] = data.block[i];
+ return data.block[0];
+ }
+}
+
+static inline __s32 i2c_smbus_write_i2c_block_data(int file, __u8 command, __u8 length, __u8 * values)
+{
+ union i2c_smbus_data data;
+ int i;
+ if (length > 32)
+ length = 32;
+ for (i = 1; i <= length; i++)
+ data.block[i] = values[i - 1];
+ data.block[0] = length;
+ return i2c_smbus_access(file, I2C_SMBUS_WRITE, command, I2C_SMBUS_I2C_BLOCK_DATA, &data);
+}
+
+/* Returns the number of read bytes */
+static inline __s32 i2c_smbus_block_process_call(int file, __u8 command, __u8 length, __u8 * values)
+{
+ union i2c_smbus_data data;
+ int i;
+ if (length > 32)
+ length = 32;
+ for (i = 1; i <= length; i++)
+ data.block[i] = values[i - 1];
+ data.block[0] = length;
+ if (i2c_smbus_access(file, I2C_SMBUS_WRITE, command, I2C_SMBUS_BLOCK_PROC_CALL, &data))
+ return -1;
+ else {
+ for (i = 1; i <= data.block[0]; i++)
+ values[i - 1] = data.block[i];
+ return data.block[0];
+ }
+}
+
+
+#endif /* _LCD4LINUX_I2C_H */
diff --git a/missing b/missing
new file mode 100755
index 0000000..1c8ff70
--- /dev/null
+++ b/missing
@@ -0,0 +1,367 @@
+#! /bin/sh
+# Common stub for a few missing GNU programs while installing.
+
+scriptversion=2006-05-10.23
+
+# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006
+# Free Software Foundation, Inc.
+# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+if test $# -eq 0; then
+ echo 1>&2 "Try \`$0 --help' for more information"
+ exit 1
+fi
+
+run=:
+sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
+sed_minuso='s/.* -o \([^ ]*\).*/\1/p'
+
+# In the cases where this matters, `missing' is being run in the
+# srcdir already.
+if test -f configure.ac; then
+ configure_ac=configure.ac
+else
+ configure_ac=configure.in
+fi
+
+msg="missing on your system"
+
+case $1 in
+--run)
+ # Try to run requested program, and just exit if it succeeds.
+ run=
+ shift
+ "$@" && exit 0
+ # Exit code 63 means version mismatch. This often happens
+ # when the user try to use an ancient version of a tool on
+ # a file that requires a minimum version. In this case we
+ # we should proceed has if the program had been absent, or
+ # if --run hadn't been passed.
+ if test $? = 63; then
+ run=:
+ msg="probably too old"
+ fi
+ ;;
+
+ -h|--h|--he|--hel|--help)
+ echo "\
+$0 [OPTION]... PROGRAM [ARGUMENT]...
+
+Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
+error status if there is no known handling for PROGRAM.
+
+Options:
+ -h, --help display this help and exit
+ -v, --version output version information and exit
+ --run try to run the given command, and emulate it if it fails
+
+Supported PROGRAM values:
+ aclocal touch file \`aclocal.m4'
+ autoconf touch file \`configure'
+ autoheader touch file \`config.h.in'
+ autom4te touch the output file, or create a stub one
+ automake touch all \`Makefile.in' files
+ bison create \`y.tab.[ch]', if possible, from existing .[ch]
+ flex create \`lex.yy.c', if possible, from existing .c
+ help2man touch the output file
+ lex create \`lex.yy.c', if possible, from existing .c
+ makeinfo touch the output file
+ tar try tar, gnutar, gtar, then tar without non-portable flags
+ yacc create \`y.tab.[ch]', if possible, from existing .[ch]
+
+Send bug reports to <bug-automake@gnu.org>."
+ exit $?
+ ;;
+
+ -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
+ echo "missing $scriptversion (GNU Automake)"
+ exit $?
+ ;;
+
+ -*)
+ echo 1>&2 "$0: Unknown \`$1' option"
+ echo 1>&2 "Try \`$0 --help' for more information"
+ exit 1
+ ;;
+
+esac
+
+# Now exit if we have it, but it failed. Also exit now if we
+# don't have it and --version was passed (most likely to detect
+# the program).
+case $1 in
+ lex|yacc)
+ # Not GNU programs, they don't have --version.
+ ;;
+
+ tar)
+ if test -n "$run"; then
+ echo 1>&2 "ERROR: \`tar' requires --run"
+ exit 1
+ elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
+ exit 1
+ fi
+ ;;
+
+ *)
+ if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
+ # We have it, but it failed.
+ exit 1
+ elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
+ # Could not run --version or --help. This is probably someone
+ # running `$TOOL --version' or `$TOOL --help' to check whether
+ # $TOOL exists and not knowing $TOOL uses missing.
+ exit 1
+ fi
+ ;;
+esac
+
+# If it does not exist, or fails to run (possibly an outdated version),
+# try to emulate it.
+case $1 in
+ aclocal*)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified \`acinclude.m4' or \`${configure_ac}'. You might want
+ to install the \`Automake' and \`Perl' packages. Grab them from
+ any GNU archive site."
+ touch aclocal.m4
+ ;;
+
+ autoconf)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified \`${configure_ac}'. You might want to install the
+ \`Autoconf' and \`GNU m4' packages. Grab them from any GNU
+ archive site."
+ touch configure
+ ;;
+
+ autoheader)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified \`acconfig.h' or \`${configure_ac}'. You might want
+ to install the \`Autoconf' and \`GNU m4' packages. Grab them
+ from any GNU archive site."
+ files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
+ test -z "$files" && files="config.h"
+ touch_files=
+ for f in $files; do
+ case $f in
+ *:*) touch_files="$touch_files "`echo "$f" |
+ sed -e 's/^[^:]*://' -e 's/:.*//'`;;
+ *) touch_files="$touch_files $f.in";;
+ esac
+ done
+ touch $touch_files
+ ;;
+
+ automake*)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
+ You might want to install the \`Automake' and \`Perl' packages.
+ Grab them from any GNU archive site."
+ find . -type f -name Makefile.am -print |
+ sed 's/\.am$/.in/' |
+ while read f; do touch "$f"; done
+ ;;
+
+ autom4te)
+ echo 1>&2 "\
+WARNING: \`$1' is needed, but is $msg.
+ You might have modified some files without having the
+ proper tools for further handling them.
+ You can get \`$1' as part of \`Autoconf' from any GNU
+ archive site."
+
+ file=`echo "$*" | sed -n "$sed_output"`
+ test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
+ if test -f "$file"; then
+ touch $file
+ else
+ test -z "$file" || exec >$file
+ echo "#! /bin/sh"
+ echo "# Created by GNU Automake missing as a replacement of"
+ echo "# $ $@"
+ echo "exit 0"
+ chmod +x $file
+ exit 1
+ fi
+ ;;
+
+ bison|yacc)
+ echo 1>&2 "\
+WARNING: \`$1' $msg. You should only need it if
+ you modified a \`.y' file. You may need the \`Bison' package
+ in order for those modifications to take effect. You can get
+ \`Bison' from any GNU archive site."
+ rm -f y.tab.c y.tab.h
+ if test $# -ne 1; then
+ eval LASTARG="\${$#}"
+ case $LASTARG in
+ *.y)
+ SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
+ if test -f "$SRCFILE"; then
+ cp "$SRCFILE" y.tab.c
+ fi
+ SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
+ if test -f "$SRCFILE"; then
+ cp "$SRCFILE" y.tab.h
+ fi
+ ;;
+ esac
+ fi
+ if test ! -f y.tab.h; then
+ echo >y.tab.h
+ fi
+ if test ! -f y.tab.c; then
+ echo 'main() { return 0; }' >y.tab.c
+ fi
+ ;;
+
+ lex|flex)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified a \`.l' file. You may need the \`Flex' package
+ in order for those modifications to take effect. You can get
+ \`Flex' from any GNU archive site."
+ rm -f lex.yy.c
+ if test $# -ne 1; then
+ eval LASTARG="\${$#}"
+ case $LASTARG in
+ *.l)
+ SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
+ if test -f "$SRCFILE"; then
+ cp "$SRCFILE" lex.yy.c
+ fi
+ ;;
+ esac
+ fi
+ if test ! -f lex.yy.c; then
+ echo 'main() { return 0; }' >lex.yy.c
+ fi
+ ;;
+
+ help2man)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified a dependency of a manual page. You may need the
+ \`Help2man' package in order for those modifications to take
+ effect. You can get \`Help2man' from any GNU archive site."
+
+ file=`echo "$*" | sed -n "$sed_output"`
+ test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
+ if test -f "$file"; then
+ touch $file
+ else
+ test -z "$file" || exec >$file
+ echo ".ab help2man is required to generate this page"
+ exit 1
+ fi
+ ;;
+
+ makeinfo)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified a \`.texi' or \`.texinfo' file, or any other file
+ indirectly affecting the aspect of the manual. The spurious
+ call might also be the consequence of using a buggy \`make' (AIX,
+ DU, IRIX). You might want to install the \`Texinfo' package or
+ the \`GNU make' package. Grab either from any GNU archive site."
+ # The file to touch is that specified with -o ...
+ file=`echo "$*" | sed -n "$sed_output"`
+ test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
+ if test -z "$file"; then
+ # ... or it is the one specified with @setfilename ...
+ infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
+ file=`sed -n '
+ /^@setfilename/{
+ s/.* \([^ ]*\) *$/\1/
+ p
+ q
+ }' $infile`
+ # ... or it is derived from the source name (dir/f.texi becomes f.info)
+ test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
+ fi
+ # If the file does not exist, the user really needs makeinfo;
+ # let's fail without touching anything.
+ test -f $file || exit 1
+ touch $file
+ ;;
+
+ tar)
+ shift
+
+ # We have already tried tar in the generic part.
+ # Look for gnutar/gtar before invocation to avoid ugly error
+ # messages.
+ if (gnutar --version > /dev/null 2>&1); then
+ gnutar "$@" && exit 0
+ fi
+ if (gtar --version > /dev/null 2>&1); then
+ gtar "$@" && exit 0
+ fi
+ firstarg="$1"
+ if shift; then
+ case $firstarg in
+ *o*)
+ firstarg=`echo "$firstarg" | sed s/o//`
+ tar "$firstarg" "$@" && exit 0
+ ;;
+ esac
+ case $firstarg in
+ *h*)
+ firstarg=`echo "$firstarg" | sed s/h//`
+ tar "$firstarg" "$@" && exit 0
+ ;;
+ esac
+ fi
+
+ echo 1>&2 "\
+WARNING: I can't seem to be able to run \`tar' with the given arguments.
+ You may want to install GNU tar or Free paxutils, or check the
+ command line arguments."
+ exit 1
+ ;;
+
+ *)
+ echo 1>&2 "\
+WARNING: \`$1' is needed, and is $msg.
+ You might have modified some files without having the
+ proper tools for further handling them. Check the \`README' file,
+ it often tells you about the needed prerequisites for installing
+ this package. You may also peek at any GNU archive site, in case
+ some other package would contain this missing \`$1' program."
+ exit 1
+ ;;
+esac
+
+exit 0
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
diff --git a/mkinstalldirs b/mkinstalldirs
new file mode 100755
index 0000000..ef7e16f
--- /dev/null
+++ b/mkinstalldirs
@@ -0,0 +1,161 @@
+#! /bin/sh
+# mkinstalldirs --- make directory hierarchy
+
+scriptversion=2006-05-11.19
+
+# Original author: Noah Friedman <friedman@prep.ai.mit.edu>
+# Created: 1993-05-16
+# Public domain.
+#
+# This file is maintained in Automake, please report
+# bugs to <bug-automake@gnu.org> or send patches to
+# <automake-patches@gnu.org>.
+
+nl='
+'
+IFS=" "" $nl"
+errstatus=0
+dirmode=
+
+usage="\
+Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ...
+
+Create each directory DIR (with mode MODE, if specified), including all
+leading file name components.
+
+Report bugs to <bug-automake@gnu.org>."
+
+# process command line arguments
+while test $# -gt 0 ; do
+ case $1 in
+ -h | --help | --h*) # -h for help
+ echo "$usage"
+ exit $?
+ ;;
+ -m) # -m PERM arg
+ shift
+ test $# -eq 0 && { echo "$usage" 1>&2; exit 1; }
+ dirmode=$1
+ shift
+ ;;
+ --version)
+ echo "$0 $scriptversion"
+ exit $?
+ ;;
+ --) # stop option processing
+ shift
+ break
+ ;;
+ -*) # unknown option
+ echo "$usage" 1>&2
+ exit 1
+ ;;
+ *) # first non-opt arg
+ break
+ ;;
+ esac
+done
+
+for file
+do
+ if test -d "$file"; then
+ shift
+ else
+ break
+ fi
+done
+
+case $# in
+ 0) exit 0 ;;
+esac
+
+# Solaris 8's mkdir -p isn't thread-safe. If you mkdir -p a/b and
+# mkdir -p a/c at the same time, both will detect that a is missing,
+# one will create a, then the other will try to create a and die with
+# a "File exists" error. This is a problem when calling mkinstalldirs
+# from a parallel make. We use --version in the probe to restrict
+# ourselves to GNU mkdir, which is thread-safe.
+case $dirmode in
+ '')
+ if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
+ echo "mkdir -p -- $*"
+ exec mkdir -p -- "$@"
+ else
+ # On NextStep and OpenStep, the `mkdir' command does not
+ # recognize any option. It will interpret all options as
+ # directories to create, and then abort because `.' already
+ # exists.
+ test -d ./-p && rmdir ./-p
+ test -d ./--version && rmdir ./--version
+ fi
+ ;;
+ *)
+ if mkdir -m "$dirmode" -p --version . >/dev/null 2>&1 &&
+ test ! -d ./--version; then
+ echo "mkdir -m $dirmode -p -- $*"
+ exec mkdir -m "$dirmode" -p -- "$@"
+ else
+ # Clean up after NextStep and OpenStep mkdir.
+ for d in ./-m ./-p ./--version "./$dirmode";
+ do
+ test -d $d && rmdir $d
+ done
+ fi
+ ;;
+esac
+
+for file
+do
+ case $file in
+ /*) pathcomp=/ ;;
+ *) pathcomp= ;;
+ esac
+ oIFS=$IFS
+ IFS=/
+ set fnord $file
+ shift
+ IFS=$oIFS
+
+ for d
+ do
+ test "x$d" = x && continue
+
+ pathcomp=$pathcomp$d
+ case $pathcomp in
+ -*) pathcomp=./$pathcomp ;;
+ esac
+
+ if test ! -d "$pathcomp"; then
+ echo "mkdir $pathcomp"
+
+ mkdir "$pathcomp" || lasterr=$?
+
+ if test ! -d "$pathcomp"; then
+ errstatus=$lasterr
+ else
+ if test ! -z "$dirmode"; then
+ echo "chmod $dirmode $pathcomp"
+ lasterr=
+ chmod "$dirmode" "$pathcomp" || lasterr=$?
+
+ if test ! -z "$lasterr"; then
+ errstatus=$lasterr
+ fi
+ fi
+ fi
+ fi
+
+ pathcomp=$pathcomp/
+ done
+done
+
+exit $errstatus
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
diff --git a/nph-png b/nph-png
new file mode 100755
index 0000000..0240b64
--- /dev/null
+++ b/nph-png
@@ -0,0 +1,41 @@
+#!/usr/bin/perl
+
+use strict;
+use vars qw ($file $DELAY);
+########## CONFIG
+ $file = "lcd4linux"; # .png is appended
+ $DELAY = 0; # delay in seconds
+ # if delay is zero, file is sent when modified.
+#################
+
+use CGI qw/:push -nph/;
+$| = 1;
+my ($mtime, $nmtime, $size, $nsize);
+(undef, undef, undef, undef, undef, undef, undef, $size, undef,
+ $mtime) = stat "$file.png";
+print multipart_init(-boundary=>'----------------here we go!');
+while (1) {
+ print multipart_start(-type=>'image/png');
+ undef $/;
+ open(IN, "$file.png") or die("Can't read '$file.png'");
+ $_ = <IN>;
+ print $_;
+ close(IN);
+ print multipart_end;
+ if ($DELAY) {
+ sleep $DELAY;
+ }
+ else {
+ W: while (1) {
+ # sleep(1);
+ (undef, undef, undef, undef, undef, undef, undef, $nsize, undef,
+ $nmtime) = stat "$file.png";
+ if($mtime != $nmtime || $size != $nsize) {
+ $mtime = $nmtime;
+ $size = $nsize;
+ last W;
+ }
+ }
+ }
+}
+
diff --git a/pid.c b/pid.c
new file mode 100644
index 0000000..f431b5e
--- /dev/null
+++ b/pid.c
@@ -0,0 +1,150 @@
+/* $Id: pid.c 840 2007-09-09 12:17:42Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/pid.c $
+ *
+ * PID file handling
+ *
+ * Copyright (C) 1999, 2000 Michael Reinelt <michael@reinelt.co.at>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ * exported functions:
+ *
+ * int pid_init (const char *pidfile)
+ * returns 0 if PID file could be successfully created
+ * returns PID of an already running process
+ * returns -1 in case of an error
+
+ * int pid_exit (const char *pidfile)
+ * returns 0 if PID file could be successfully deleted
+ * otherwise returns error from unlink() call
+ *
+ */
+
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <signal.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#include "debug.h"
+#include "pid.h"
+#include "qprintf.h"
+
+#ifdef WITH_DMALLOC
+#include <dmalloc.h>
+#endif
+
+
+int pid_init(const char *pidfile)
+{
+ char tmpfile[256];
+ char buffer[16];
+ int fd, len, pid;
+
+ qprintf(tmpfile, sizeof(tmpfile), "%s.%s", pidfile, "XXXXXX");
+
+ if ((fd = mkstemp(tmpfile)) == -1) {
+ error("mkstemp(%s) failed: %s", tmpfile, strerror(errno));
+ return -1;
+ }
+
+ if (fchmod(fd, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH) == -1) {
+ error("fchmod(%s) failed: %s", tmpfile, strerror(errno));
+ close(fd);
+ unlink(tmpfile);
+ return -1;
+ }
+
+ qprintf(buffer, sizeof(buffer), "%d\n", (int) getpid());
+ len = strlen(buffer);
+ if (write(fd, buffer, len) != len) {
+ error("write(%s) failed: %s", tmpfile, strerror(errno));
+ close(fd);
+ unlink(tmpfile);
+ return -1;
+ }
+ close(fd);
+
+
+ while (link(tmpfile, pidfile) == -1) {
+
+ if (errno != EEXIST) {
+ error("link(%s, %s) failed: %s", tmpfile, pidfile, strerror(errno));
+ unlink(tmpfile);
+ return -1;
+ }
+
+ if ((fd = open(pidfile, O_RDONLY)) == -1) {
+ if (errno == ENOENT)
+ continue; /* pidfile disappared */
+ error("open(%s) failed: %s", pidfile, strerror(errno));
+ unlink(tmpfile);
+ return -1;
+ }
+
+ len = read(fd, buffer, sizeof(buffer) - 1);
+ if (len < 0) {
+ error("read(%s) failed: %s", pidfile, strerror(errno));
+ unlink(tmpfile);
+ return -1;
+ }
+
+ buffer[len] = '\0';
+ if (sscanf(buffer, "%d", &pid) != 1 || pid == 0) {
+ error("scan(%s) failed.", pidfile);
+ unlink(tmpfile);
+ return -1;
+ }
+
+ if (pid == getpid()) {
+ error("%s already locked by us. uh-oh...", pidfile);
+ unlink(tmpfile);
+ return 0;
+ }
+
+ if ((kill(pid, 0) == -1) && errno == ESRCH) {
+ error("removing stale PID file %s", pidfile);
+ if (unlink(pidfile) == -1 && errno != ENOENT) {
+ error("unlink(%s) failed: %s", pidfile, strerror(errno));
+ unlink(tmpfile);
+ return pid;
+ }
+ continue;
+ }
+ unlink(tmpfile);
+ return pid;
+ }
+
+ unlink(tmpfile);
+ return 0;
+}
+
+
+int pid_exit(const char *pidfile)
+{
+ return unlink(pidfile);
+}
diff --git a/pid.h b/pid.h
new file mode 100644
index 0000000..c28341e
--- /dev/null
+++ b/pid.h
@@ -0,0 +1,33 @@
+/* $Id: pid.h 840 2007-09-09 12:17:42Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/pid.h $
+ *
+ * PID file handling
+ *
+ * Copyright (C) 2003 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+#ifndef _PID_H_
+#define _PID_H_
+
+int pid_init(const char *pidfile);
+int pid_exit(const char *pidfile);
+
+#endif
diff --git a/plugin.c b/plugin.c
new file mode 100644
index 0000000..7329985
--- /dev/null
+++ b/plugin.c
@@ -0,0 +1,538 @@
+/* $Id: plugin.c 1195 2013-02-19 23:17:43Z volker $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/plugin.c $
+ *
+ * plugin handler for the Evaluator
+ *
+ * Copyright (C) 2003 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ * exported functions:
+ *
+ * int plugin_init (void)
+ * initializes the expression evaluator
+ * adds some handy constants and functions
+ *
+ */
+
+
+#include "config.h"
+
+#include "plugin.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "debug.h"
+
+
+char *Plugins[] = {
+ "cfg",
+ "math",
+ "string",
+ "test",
+ "time",
+#ifdef PLUGIN_APM
+ "apm",
+#endif
+#ifdef PLUGIN_ASTERISK
+ "asterisk",
+#endif
+#ifdef PLUGIN_BUTTON_EXEC
+ "button_exec",
+#endif
+#ifdef PLUGIN_CPUINFO
+ "cpuinfo",
+#endif
+#ifdef PLUGIN_DBUS
+ "dbus",
+#endif
+#ifdef PLUGIN_DISKSTATS
+ "diskstats",
+#endif
+#ifdef PLUGIN_DVB
+ "dvb",
+#endif
+#ifdef PLUGIN_EXEC
+ "exec",
+#endif
+#ifdef PLUGIN_EVENT
+ "event",
+#endif
+#ifdef PLUGIN_FIFO
+ "fifo",
+#endif
+#ifdef PLUGIN_FILE
+ "file",
+#endif
+#ifdef PLUGIN_GPS
+ "gps",
+#endif
+#ifdef PLUGIN_HDDTEMP
+ "hddtemp",
+#endif
+#ifdef PLUGIN_HUAWEI
+ "huawei",
+#endif
+#ifdef PLUGIN_I2C_SENSORS
+ "i2c_sensors",
+#endif
+#ifdef PLUGIN_ICONV
+ "iconv",
+#endif
+#ifdef PLUGIN_IMON
+ "imon",
+#endif
+#ifdef PLUGIN_ISDN
+ "isdn",
+#endif
+#ifdef PLUGIN_KVV
+ "kvv",
+#endif
+#ifdef PLUGIN_LOADAVG
+ "loadavg",
+#endif
+#ifdef PLUGIN_MEMINFO
+ "meminfo",
+#endif
+#ifdef PLUGIN_MPD
+ "mpd",
+#endif
+#ifdef PLUGIN_MPRIS_DBUS
+ "mpris_dbus",
+#endif
+#ifdef PLUGIN_MYSQL
+ "mysql",
+#endif
+#ifdef PLUGIN_NETDEV
+ "netdev",
+#endif
+#ifdef PLUGIN_NETINFO
+ "netinfo",
+#endif
+#ifdef PLUGIN_POP3
+ "pop3",
+#endif
+#ifdef PLUGIN_PPP
+ "ppp",
+#endif
+#ifdef PLUGIN_PROC_STAT
+ "proc_stat",
+#endif
+#ifdef PLUGIN_PYTHON
+ "python",
+#endif
+#ifdef PLUGIN_RASPI
+ "raspi",
+#endif
+#ifdef PLUGIN_SAMPLE
+ "sample",
+#endif
+#ifdef PLUGIN_SETI
+ "seti",
+#endif
+#ifdef PLUGIN_STATFS
+ "statfs",
+#endif
+#ifdef PLUGIN_UNAME
+ "uname",
+#endif
+#ifdef PLUGIN_UPTIME
+ "uptime",
+#endif
+#ifdef PLUGIN_W1RETAP
+ "w1retap",
+#endif
+#ifdef PLUGIN_WIRELESS
+ "wireless",
+#endif
+#ifdef PLUGIN_XMMS
+ "xmms",
+#endif
+ NULL,
+};
+
+
+/* Prototypes */
+int plugin_init_cfg(void);
+void plugin_exit_cfg(void);
+int plugin_init_math(void);
+void plugin_exit_math(void);
+int plugin_init_string(void);
+void plugin_exit_string(void);
+int plugin_init_test(void);
+void plugin_exit_test(void);
+int plugin_init_time(void);
+void plugin_exit_time(void);
+
+int plugin_init_apm(void);
+void plugin_exit_apm(void);
+int plugin_init_asterisk(void);
+void plugin_exit_asterisk(void);
+int plugin_init_button_exec(void);
+void plugin_exit_button_exec(void);
+int plugin_init_cpuinfo(void);
+void plugin_exit_cpuinfo(void);
+int plugin_init_dbus(void);
+void plugin_exit_dbus(void);
+int plugin_init_diskstats(void);
+void plugin_exit_diskstats(void);
+int plugin_init_dvb(void);
+void plugin_exit_dvb(void);
+int plugin_init_exec(void);
+void plugin_exit_exec(void);
+int plugin_init_event(void);
+void plugin_exit_event(void);
+int plugin_init_fifo(void);
+void plugin_exit_fifo(void);
+int plugin_init_file(void);
+void plugin_exit_file(void);
+int plugin_init_gps(void);
+void plugin_exit_gps(void);
+int plugin_init_hddtemp(void);
+void plugin_exit_hddtemp(void);
+int plugin_init_huawei(void);
+void plugin_exit_huawei(void);
+int plugin_init_i2c_sensors(void);
+void plugin_exit_i2c_sensors(void);
+int plugin_init_imon(void);
+void plugin_exit_imon(void);
+int plugin_init_iconv(void);
+void plugin_exit_iconv(void);
+int plugin_init_isdn(void);
+void plugin_exit_isdn(void);
+int plugin_init_kvv(void);
+void plugin_exit_kvv(void);
+int plugin_init_loadavg(void);
+void plugin_exit_loadavg(void);
+int plugin_init_meminfo(void);
+void plugin_exit_meminfo(void);
+int plugin_init_mpd(void);
+void plugin_exit_mpd(void);
+int plugin_init_mpris_dbus(void);
+void plugin_exit_mpris_dbus(void);
+int plugin_init_mysql(void);
+void plugin_exit_mysql(void);
+int plugin_init_netdev(void);
+void plugin_exit_netdev(void);
+int plugin_init_netinfo(void);
+void plugin_exit_netinfo(void);
+int plugin_init_pop3(void);
+void plugin_exit_pop3(void);
+int plugin_init_ppp(void);
+void plugin_exit_ppp(void);
+int plugin_init_proc_stat(void);
+void plugin_exit_proc_stat(void);
+int plugin_init_python(void);
+void plugin_exit_python(void);
+int plugin_init_raspi(void);
+void plugin_exit_raspi(void);
+int plugin_init_sample(void);
+void plugin_exit_sample(void);
+int plugin_init_seti(void);
+void plugin_exit_seti(void);
+int plugin_init_statfs(void);
+void plugin_exit_statfs(void);
+int plugin_init_uname(void);
+void plugin_exit_uname(void);
+int plugin_init_uptime(void);
+void plugin_exit_uptime(void);
+int plugin_init_w1retap(void);
+void plugin_exit_w1retap(void);
+int plugin_init_wireless(void);
+void plugin_exit_wireless(void);
+int plugin_init_xmms(void);
+void plugin_exit_xmms(void);
+
+
+int plugin_list(void)
+{
+ int i;
+
+ printf("available plugins:\n ");
+
+ for (i = 0; Plugins[i]; i++) {
+ printf("%s", Plugins[i]);
+ if (Plugins[i + 1])
+ printf(", ");
+ }
+ printf("\n");
+ return 0;
+}
+
+
+int plugin_init(void)
+{
+ plugin_init_cfg();
+ plugin_init_math();
+ plugin_init_string();
+ plugin_init_test();
+ plugin_init_time();
+
+#ifdef PLUGIN_APM
+ plugin_init_apm();
+#endif
+#ifdef PLUGIN_ASTERISK
+ plugin_init_asterisk();
+#endif
+#ifdef PLUGIN_BUTTON_EXEC
+ plugin_init_button_exec();
+#endif
+#ifdef PLUGIN_CPUINFO
+ plugin_init_cpuinfo();
+#endif
+#ifdef PLUGIN_DBUS
+ plugin_init_dbus();
+#endif
+#ifdef PLUGIN_DISKSTATS
+ plugin_init_diskstats();
+#endif
+#ifdef PLUGIN_DVB
+ plugin_init_dvb();
+#endif
+#ifdef PLUGIN_EXEC
+ plugin_init_exec();
+#endif
+#ifdef PLUGIN_EVENT
+ plugin_init_event();
+#endif
+#ifdef PLUGIN_FIFO
+ plugin_init_fifo();
+#endif
+#ifdef PLUGIN_FILE
+ plugin_init_file();
+#endif
+#ifdef PLUGIN_GPS
+ plugin_init_gps();
+#endif
+#ifdef PLUGIN_HDDTEMP
+ plugin_init_hddtemp();
+#endif
+#ifdef PLUGIN_HUAWEI
+ plugin_init_huawei();
+#endif
+#ifdef PLUGIN_I2C_SENSORS
+ plugin_init_i2c_sensors();
+#endif
+#ifdef PLUGIN_ICONV
+ plugin_init_iconv();
+#endif
+#ifdef PLUGIN_IMON
+ plugin_init_imon();
+#endif
+#ifdef PLUGIN_ISDN
+ plugin_init_isdn();
+#endif
+#ifdef PLUGIN_KVV
+ plugin_init_kvv();
+#endif
+#ifdef PLUGIN_LOADAVG
+ plugin_init_loadavg();
+#endif
+#ifdef PLUGIN_MEMINFO
+ plugin_init_meminfo();
+#endif
+#ifdef PLUGIN_MPD
+ plugin_init_mpd();
+#endif
+#ifdef PLUGIN_MPRIS_DBUS
+ plugin_init_mpris_dbus();
+#endif
+#ifdef PLUGIN_MYSQL
+ plugin_init_mysql();
+#endif
+#ifdef PLUGIN_NETDEV
+ plugin_init_netdev();
+#endif
+#ifdef PLUGIN_NETINFO
+ plugin_init_netinfo();
+#endif
+#ifdef PLUGIN_POP3
+ plugin_init_pop3();
+#endif
+#ifdef PLUGIN_PPP
+ plugin_init_ppp();
+#endif
+#ifdef PLUGIN_PROC_STAT
+ plugin_init_proc_stat();
+#endif
+#ifdef PLUGIN_PYTHON
+ plugin_init_python();
+#endif
+#ifdef PLUGIN_RASPI
+ plugin_init_raspi();
+#endif
+#ifdef PLUGIN_SAMPLE
+ plugin_init_sample();
+#endif
+#ifdef PLUGIN_SETI
+ plugin_init_seti();
+#endif
+#ifdef PLUGIN_STATFS
+ plugin_init_statfs();
+#endif
+#ifdef PLUGIN_UNAME
+ plugin_init_uname();
+#endif
+#ifdef PLUGIN_UPTIME
+ plugin_init_uptime();
+#endif
+#ifdef PLUGIN_W1RETAP
+ plugin_init_w1retap();
+#endif
+#ifdef PLUGIN_WIRELESS
+ plugin_init_wireless();
+#endif
+#ifdef PLUGIN_XMMS
+ plugin_init_xmms();
+#endif
+
+ return 0;
+}
+
+
+void plugin_exit(void)
+{
+#ifdef PLUGIN_APM
+ plugin_exit_apm();
+#endif
+#ifdef PLUGIN_ASTERISK
+ plugin_exit_asterisk();
+#endif
+#ifdef PLUGIN_BUTTON_EXEC
+ plugin_exit_button_exec();
+#endif
+#ifdef PLUGIN_CPUINFO
+ plugin_exit_cpuinfo();
+#endif
+#ifdef PLUGIN_DBUS
+ plugin_exit_dbus();
+#endif
+#ifdef PLUGIN_DISKSTATS
+ plugin_exit_diskstats();
+#endif
+#ifdef PLUGIN_DVB
+ plugin_exit_dvb();
+#endif
+#ifdef PLUGIN_EXEC
+ plugin_exit_exec();
+#endif
+#ifdef PLUGIN_EVENT
+ plugin_exit_event();
+#endif
+#ifdef PLUGIN_FIFO
+ plugin_exit_fifo();
+#endif
+#ifdef PLUGIN_FILE
+ plugin_exit_file();
+#endif
+#ifdef PLUGIN_GPS
+ plugin_exit_gps();
+#endif
+#ifdef PLUGIN_HUAWEI
+ plugin_exit_huawei();
+#endif
+#ifdef PLUGIN_I2C_SENSORS
+ plugin_exit_i2c_sensors();
+#endif
+#ifdef PLUGIN_ICONV
+ plugin_exit_iconv();
+#endif
+#ifdef PLUGIN_IMON
+ plugin_exit_imon();
+#endif
+#ifdef PLUGIN_ISDN
+ plugin_exit_isdn();
+#endif
+#ifdef PLUGIN_KVV
+ plugin_exit_kvv();
+#endif
+#ifdef PLUGIN_LOADAVG
+ plugin_exit_loadavg();
+#endif
+#ifdef PLUGIN_MEMINFO
+ plugin_exit_meminfo();
+#endif
+#ifdef PLUGIN_MPD
+ plugin_exit_mpd();
+#endif
+#ifdef PLUGIN_MPRIS_DBUS
+ plugin_exit_mpris_dbus();
+#endif
+#ifdef PLUGIN_MYSQL
+ plugin_exit_mysql();
+#endif
+#ifdef PLUGIN_NETDEV
+ plugin_exit_netdev();
+#endif
+#ifdef PLUGIN_NETINFO
+ plugin_exit_netinfo();
+#endif
+#ifdef PLUGIN_POP3
+ plugin_exit_pop3();
+#endif
+#ifdef PLUGIN_PPP
+ plugin_exit_ppp();
+#endif
+#ifdef PLUGIN_PROC_STAT
+ plugin_exit_proc_stat();
+#endif
+#ifdef PLUGIN_PYTHON
+ plugin_exit_python();
+#endif
+#ifdef PLUGIN_RASPI
+ plugin_exit_raspi();
+#endif
+#ifdef PLUGIN_SAMPLE
+ plugin_exit_sample();
+#endif
+#ifdef PLUGIN_SETI
+ plugin_exit_seti();
+#endif
+#ifdef PLUGIN_STATFS
+ plugin_exit_statfs();
+#endif
+#ifdef PLUGIN_UNAME
+ plugin_exit_uname();
+#endif
+#ifdef PLUGIN_UPTIME
+ plugin_exit_uptime();
+#endif
+#ifdef PLUGIN_W1RETAP
+ plugin_exit_w1retap();
+#endif
+#ifdef PLUGIN_WIRELESS
+ plugin_exit_wireless();
+#endif
+#ifdef PLUGIN_XMMS
+ plugin_exit_xmms();
+#endif
+
+ plugin_exit_cfg();
+ plugin_exit_math();
+ plugin_exit_string();
+ plugin_exit_test();
+ plugin_exit_time();
+
+ DeleteFunctions();
+ DeleteVariables();
+}
diff --git a/plugin.h b/plugin.h
new file mode 100644
index 0000000..c4e87e7
--- /dev/null
+++ b/plugin.h
@@ -0,0 +1,36 @@
+/* $Id: plugin.h 1087 2010-01-19 22:59:24Z mzuther $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/plugin.h $
+ *
+ * plugin handler for the Evaluator
+ *
+ * Copyright (C) 2003 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+#include "config.h"
+#include "evaluator.h"
+
+#ifndef _PLUGIN_H_
+#define _PLUGIN_H_
+
+int plugin_list(void);
+int plugin_init(void);
+void plugin_exit(void);
+#endif
diff --git a/plugin_apm.c b/plugin_apm.c
new file mode 100644
index 0000000..0ae7c70
--- /dev/null
+++ b/plugin_apm.c
@@ -0,0 +1,199 @@
+/* $Id: plugin_apm.c 840 2007-09-09 12:17:42Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/plugin_apm.c $
+ *
+ * plugin for APM (battery status)
+ *
+ * Copyright (C) 2003 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * based on the old 'battery.c' which is
+ * Copyright (C) 2001 Leopold Tötsch <lt@toetsch.at>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ * exported functions:
+ *
+ * int plugin_init_apm (void)
+ * adds apm() function
+ *
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+#include <sys/ioctl.h>
+#include <sys/types.h>
+#include <asm/types.h>
+
+#include "debug.h"
+#include "plugin.h"
+#include "hash.h"
+
+static int fd = -2;
+static HASH APM;
+
+/* from /usr/src/linux/arch/i386/kernel/apm.c:
+ *
+ * Arguments, with symbols from linux/apm_bios.h. Information is
+ * from the Get Power Status (0x0a) call unless otherwise noted.
+ *
+ * 0) Linux driver version (this will change if format changes)
+ * 1) APM BIOS Version. Usually 1.0, 1.1 or 1.2.
+ * 2) APM flags from APM Installation Check (0x00):
+ * bit 0: APM_16_BIT_SUPPORT
+ * bit 1: APM_32_BIT_SUPPORT
+ * bit 2: APM_IDLE_SLOWS_CLOCK
+ * bit 3: APM_BIOS_DISABLED
+ * bit 4: APM_BIOS_DISENGAGED
+ * 3) AC line status
+ * 0x00: Off-line
+ * 0x01: On-line
+ * 0x02: On backup power (BIOS >= 1.1 only)
+ * 0xff: Unknown
+ * 4) Battery status
+ * 0x00: High
+ * 0x01: Low
+ * 0x02: Critical
+ * 0x03: Charging
+ * 0x04: Selected battery not present (BIOS >= 1.2 only)
+ * 0xff: Unknown
+ * 5) Battery flag
+ * bit 0: High
+ * bit 1: Low
+ * bit 2: Critical
+ * bit 3: Charging
+ * bit 7: No system battery
+ * 0xff: Unknown
+ * 6) Remaining battery life (percentage of charge):
+ * 0-100: valid
+ * -1: Unknown
+ * 7) Remaining battery life (time units):
+ * Number of remaining minutes or seconds
+ * -1: Unknown
+ * 8) min = minutes; sec = seconds
+ *
+ * p+= sprintf(p, "%s %d.%d 0x%02x 0x%02x 0x%02x 0x%02x %d%% %d %s\n",
+ * driver_version,
+ * (apm_info.bios.version >> 8) & 0xff,
+ * apm_info.bios.version & 0xff,
+ * apm_info.bios.flags,
+ * ac_line_status,
+ * battery_status,
+ * battery_flag,
+ * percentage,
+ * time_units,
+ * units);
+ */
+
+
+static int parse_proc_apm(void)
+{
+ char *key[] = { "driver_version",
+ "bios_version",
+ "bios_flags",
+ "line_status",
+ "battery_status",
+ "battery_flag",
+ "battery_percent",
+ "battery_remaining",
+ "time_units"
+ };
+
+ char buffer[128], *beg, *end;
+ int age, i;
+
+ /* reread every 10 msec only */
+ age = hash_age(&APM, NULL);
+ if (age > 0 && age <= 10)
+ return 0;
+
+ if (fd == -2) {
+ fd = open("/proc/apm", O_RDONLY | O_NDELAY);
+ if (fd == -1) {
+ error("open(/proc/apm) failed: %s", strerror(errno));
+ return -1;
+ }
+ }
+
+ if (lseek(fd, 0L, SEEK_SET) != 0) {
+ error("lseek(/proc/apm) failed: %s", strerror(errno));
+ fd = -1;
+ return -1;
+ }
+
+ if (read(fd, &buffer, sizeof(buffer) - 1) == -1) {
+ error("read(/proc/apm) failed: %s", strerror(errno));
+ fd = -1;
+ return -1;
+ }
+
+ beg = buffer;
+ for (i = 0; i < 9 && beg != NULL; i++) {
+ while (*beg == ' ')
+ beg++;
+ if ((end = strpbrk(beg, " \n")))
+ *end = '\0';
+ hash_put(&APM, key[i], beg);
+ beg = end ? end + 1 : NULL;
+ }
+
+ return 0;
+}
+
+
+static void my_apm(RESULT * result, RESULT * arg1)
+{
+ char *val;
+
+ if (parse_proc_apm() < 0) {
+ SetResult(&result, R_STRING, "");
+ return;
+ }
+
+ val = hash_get(&APM, R2S(arg1), NULL);
+ if (val == NULL)
+ val = "";
+
+ SetResult(&result, R_STRING, val);
+}
+
+int plugin_init_apm(void)
+{
+ hash_create(&APM);
+
+ AddFunction("apm", 1, my_apm);
+
+ return 0;
+}
+
+void plugin_exit_apm(void)
+{
+ if (fd > -1) {
+ close(fd);
+ }
+ fd = -2;
+
+ hash_destroy(&APM);
+}
diff --git a/plugin_asterisk.c b/plugin_asterisk.c
new file mode 100644
index 0000000..07fec40
--- /dev/null
+++ b/plugin_asterisk.c
@@ -0,0 +1,304 @@
+/* $Id: plugin_asterisk.c 1153 2011-07-27 05:12:30Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/plugin_asterisk.c $
+ *
+ * plugin for asterisk
+ *
+ * Copyright (C) 2003 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2004, 2005, 2006, 2007 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ * exported functions:
+ *
+ * int plugin_init_sample (void)
+ * adds various functions
+ *
+ */
+
+
+/* define the include files you need */
+#include "config.h"
+#include <string.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <stdio.h>
+#include "debug.h"
+#include "plugin.h"
+
+#ifdef WITH_DMALLOC
+#include <dmalloc.h>
+#endif
+
+struct Line {
+ char Channel[25]; /* Zap Channel */
+ char EndPoint[25];
+ unsigned char active;
+};
+
+static char *rtrim(char *string, char junk)
+{
+ char *original = string + strlen(string);
+ while (*--original == junk);
+ *(original + 1) = '\0';
+
+ return string;
+}
+
+static void zapstatus(RESULT * result, RESULT * arg1)
+{
+ FILE *infile;
+ int skipline = 0; // Skip the first in the file, it throws off the detection
+ char line[100], *SipLoc, Channel[25], Location[25], __attribute__ ((unused)) State[9], Application[25], EndPoint[8],
+ Ret[50];
+ int i = 0, ChannelInt = 0, ZapLine = 0;
+ struct Line Lines[32]; // Setup 32 lines, ZAP 1-32 (memory is cheap)
+
+ ZapLine = R2N(arg1);
+
+ // Set all the lines status's default to inactive
+ for (i = 0; i < 32; i++) {
+ strcpy(Lines[i].Channel, "ZAP/");
+ Lines[i].Channel[4] = (char) (i + 49);
+ Lines[i].Channel[5] = '\0';
+ Lines[i].active = 0;
+ }
+
+ system("touch /tmp/asterisk.state"); // Touch the file in it's naughty place
+ system("chmod 744 /tmp/asterisk.state");
+ system("asterisk -rx \"show channels\" > /tmp/asterisk.state"); // Crappy CLI way to do it
+
+ infile = fopen("/tmp/asterisk.state", "r");
+
+ for (i = 0; i < 100; i++) {
+ line[i] = ' ';
+ }
+ line[99] = '\0';
+
+ while (fgets(line, 100, infile) != NULL) {
+ if (strstr(line, "Zap") != NULL) {
+ for (i = 0; i < (int) strlen(line); i++) {
+ if (i < 20) {
+ Channel[i] = line[i];
+ } else if (i < 42) {
+ Location[i - 21] = line[i];
+ } else if (i < 50) {
+ State[i - 42] = line[i];
+ } else {
+ Application[i - 50] = line[i];
+ }
+ }
+ strncpy(Channel, Channel, 7);
+ Channel[7] = '\0';
+ strcpy(Location, rtrim(Location, ' '));
+ State[4] = '\0';
+ memcpy(EndPoint, Application + 13, 7);
+ EndPoint[7] = '\0';
+
+ if (strstr(Application, "Bridged Call") != NULL) {
+ // Subtract 48 from the character value to get the int
+ // value. Subtract one more because arrays start at 0.
+ ChannelInt = (int) (Channel[4]) - 49;
+ strcpy(Lines[ChannelInt].Channel, Channel);
+ strncpy(Lines[ChannelInt].EndPoint, EndPoint, 8);
+ Lines[ChannelInt].active = 1;
+ } else {
+ SipLoc = strstr(Application, "SIP");
+ if (SipLoc != NULL) {
+ strncpy(EndPoint, SipLoc, 7);
+ } else {
+ EndPoint[0] = '\0';
+ }
+ ChannelInt = (int) (Channel[4]) - 49;
+ strcpy(Lines[ChannelInt].Channel, Channel);
+ Lines[ChannelInt].active = 1;
+ }
+ } else {
+ if (strlen(line) > 54 && skipline > 1) {
+ for (i = 55; i < 88; i++) {
+ if (i < 80) {
+ Channel[i - 55] = line[i];
+ } else {
+ EndPoint[i - 80] = line[i];
+ }
+ }
+ strncpy(Channel, rtrim(Channel, ' '), 5);
+ strncpy(EndPoint, rtrim(EndPoint, ' '), 7);
+
+ ChannelInt = (int) (Channel[4]) - 49;
+ strcpy(Lines[ChannelInt].Channel, Channel);
+ strcpy(Lines[ChannelInt].EndPoint, EndPoint);
+ Lines[ChannelInt].active = 1;
+ }
+ }
+ skipline += 1;
+ }
+ fclose(infile);
+
+ ZapLine -= 1;
+ if (ZapLine < 0 || ZapLine > 31) {
+ memset(Ret, ' ', 50);
+ Ret[0] = '\0';
+ strcat(Ret, "Invalid ZAP #");
+ SetResult(&result, R_STRING, &Ret);
+ } else if (Lines[ZapLine].active == 1) {
+ memset(Ret, ' ', 50);
+ Ret[0] = '\0';
+ strcat(Ret, Lines[ZapLine].Channel);
+ strcat(Ret, " -> ");
+ strncat(Ret, Lines[ZapLine].EndPoint, 8);
+ SetResult(&result, R_STRING, &Ret);
+ } else {
+ memset(Ret, ' ', 50);
+ Ret[0] = '\0';
+ strcat(Ret, Lines[ZapLine].Channel);
+ strcat(Ret, ": inactive");
+ SetResult(&result, R_STRING, &Ret);
+ }
+ return;
+}
+
+static void corecalls(RESULT * result)
+{
+ FILE *infile;
+ char line[100];
+ int calls;
+
+ system("asterisk -rx 'core show channels' > /tmp/asterisk.calls");
+
+ infile = fopen("/tmp/asterisk.state", "r");
+ line[0] = '\0';
+ while (fgets(line, 100, infile) != NULL) {
+ if (strstr(line, "active calls") != NULL) {
+ break;
+ }
+ }
+ fclose(infile);
+
+ if (line[0] != '\0') {
+ sscanf(line, "%d active calls", &calls);
+ } else {
+ calls = 0;
+ }
+
+ SetResult(&result, R_NUMBER, &calls);
+ return;
+}
+
+int sipinfo(int type)
+{
+ FILE *infile;
+ char line[100];
+ int peers, online;
+
+ system("asterisk -rx 'sip show peers' > /tmp/asterisk.sip");
+
+ infile = fopen("/tmp/asterisk.sip", "r");
+ line[0] = '\0';
+ while (fgets(line, 100, infile) != NULL) {
+ } // Get the last line
+ fclose(infile);
+
+ if (line[0] != '\0') {
+ sscanf(line, "%d sip peers [Monitored: %d online,", &peers, &online);
+ } else {
+ peers = 0;
+ online = 0;
+ }
+
+ return (type == 1) ? peers : online;
+}
+
+static void sippeers(RESULT * result)
+{
+ int peers;
+ peers = sipinfo(1);
+ SetResult(&result, R_NUMBER, &peers);
+ return;
+}
+
+static void siponline(RESULT * result)
+{
+ int online;
+ online = sipinfo(2);
+ SetResult(&result, R_NUMBER, &online);
+ return;
+}
+
+static void uptime(RESULT * result)
+{
+ FILE *infile;
+ char line[100], *tok;
+ int fields[5], toknum = 0, num, s = 0;
+
+ fields[0] = fields[1] = fields[2] = fields[3] = fields[4] = 0;
+
+ system("asterisk -rx 'core show uptime' > /tmp/asterisk.uptime");
+
+ infile = fopen("/tmp/asterisk.uptime", "r");
+ line[0] = '\0';
+ while (fgets(line, 100, infile) != NULL) {
+ if (strstr(line, "System uptime") != NULL) {
+ break;
+ }
+ }
+ fclose(infile);
+
+ if (line[0] != '\0') {
+ for (tok = strtok(line, " "); tok != NULL; tok = strtok(NULL, " ")) {
+ toknum++;
+ if (toknum == 3 || toknum == 5 || toknum == 7 || toknum == 9 || toknum == 11) {
+ sscanf(tok, "%d", &num);
+ } else if (toknum == 4 || toknum == 6 || toknum == 8 || toknum == 10 || toknum == 12) {
+ if (strstr(tok, "weeks") != NULL || (strstr(tok, "week") != NULL)) {
+ fields[4] = num;
+ } else if (strstr(tok, "days") != NULL || (strstr(tok, "day") != NULL)) {
+ fields[3] = num;
+ } else if (strstr(tok, "hours") != NULL || (strstr(tok, "hour") != NULL)) {
+ fields[2] = num;
+ } else if (strstr(tok, "minutes") != NULL || (strstr(tok, "minute") != NULL)) {
+ fields[1] = num;
+ } else {
+ fields[0] = num;
+ }
+ }
+ }
+ s = (fields[4] * 604800) + (fields[3] * 86400) + (fields[2] * 3600) + (fields[1] * 60) + fields[0];
+ }
+
+ SetResult(&result, R_NUMBER, &s);
+ return;
+}
+
+int plugin_init_asterisk(void)
+{
+ AddFunction("asterisk::zapstatus", 1, zapstatus);
+ AddFunction("asterisk::corecalls", 0, corecalls);
+ AddFunction("asterisk::sippeers", 0, sippeers);
+ AddFunction("asterisk::siponline", 0, siponline);
+ AddFunction("asterisk::uptime", 0, uptime);
+ return 0;
+}
+
+void plugin_exit_asterisk(void)
+{
+ /* free any allocated memory */
+ /* close filedescriptors */
+}
diff --git a/plugin_button_exec.c b/plugin_button_exec.c
new file mode 100644
index 0000000..bf1fec8
--- /dev/null
+++ b/plugin_button_exec.c
@@ -0,0 +1,111 @@
+/* $Id: plugin_button_exec.c 1189 2012-05-19 12:46:24Z jmccrohan $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/plugin_button_exec.c $
+ *
+ * plugin that forks and exec's once a key is pressed. the difference to the exec plugin is: this can also only be done once!
+ *
+ * Copyright (C) 2008, Wolfgang Henerbichler <wogri@wogri.com>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ * exported functions:
+ *
+ * int plugin_init_button_exec(void)
+ * adds various functions
+ *
+ */
+
+
+/* define the include files you need */
+#include "config.h"
+
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <unistd.h>
+#include <signal.h>
+#include <errno.h>
+
+/* these should always be included */
+#include "debug.h"
+#include "plugin.h"
+
+#ifdef WITH_DMALLOC
+#include <dmalloc.h>
+#endif
+
+
+
+/* sample function 'button_exec' */
+/* takes as many arguments as you want, first arguemnt is the command that will be called via exec, all the following are parameters you want to add to your command - you won't know what has happened after forking - no return codes available */
+/* Note: all local functions should be declared 'static' */
+
+static void my_button_exec(RESULT * result, int argc, RESULT * argv[])
+{
+ int pid;
+ int i;
+ int errsv;
+ char *args[argc + 1];
+ char *arg;
+ char *prog;
+
+ signal(SIGCHLD, SIG_IGN);
+ prog = R2S(argv[0]);
+ info("%s", prog);
+ for (i = 1; i < argc; i++) {
+ arg = R2S(argv[i]);
+ args[i] = arg;
+ info("%s", arg);
+ }
+ args[0] = prog;
+ args[i] = (char *) 0;
+ pid = fork();
+ if (pid == 0) { /* child-process */
+ /* char *args[] = {"-r", "-t", "-l", (char *) 0 }; */
+ info("executing program");
+ execvp(prog, args);
+ errsv = errno;
+ info("executing program failed");
+ info("%s", strerror(errsv));
+ exit(0);
+ } else if (pid == -1) {
+ info("weird error has occurred. couldn't fork.");
+ } else {
+ SetResult(&result, R_STRING, "0");
+ }
+}
+
+
+/* plugin initialization */
+/* MUST NOT be declared 'static'! */
+int plugin_init_button_exec(void)
+{
+
+ /* register all our cool functions */
+ /* the second parameter is the number of arguments */
+ /* -1 stands for variable argument list */
+ AddFunction("button_exec", -1, my_button_exec);
+ return 0;
+}
+
+void plugin_exit_button_exec(void)
+{
+ /* free any allocated memory */
+ /* close filedescriptors */
+}
diff --git a/plugin_cfg.c b/plugin_cfg.c
new file mode 100644
index 0000000..66a9636
--- /dev/null
+++ b/plugin_cfg.c
@@ -0,0 +1,140 @@
+/* $Id: plugin_cfg.c 840 2007-09-09 12:17:42Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/plugin_cfg.c $
+ *
+ * plugin for config file access
+ *
+ * Copyright (C) 2003, 2004 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ * exported functions:
+ *
+ * int plugin_init_cfg (void)
+ * adds cfg() function for config access
+ * initializes variables from the config file
+ *
+ */
+
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "debug.h"
+#include "evaluator.h"
+#include "plugin.h"
+#include "cfg.h"
+
+#ifdef WITH_DMALLOC
+#include <dmalloc.h>
+#endif
+
+
+static void load_variables(void)
+{
+ char *section = "Variables";
+ char *list, *l, *p;
+ char *expression;
+ void *tree;
+ RESULT result = { 0, 0, 0, NULL };
+
+ list = cfg_list(section);
+ l = list;
+ while (l != NULL) {
+ while (*l == '|')
+ l++;
+ if ((p = strchr(l, '|')) != NULL)
+ *p = '\0';
+ if (strchr(l, '.') != NULL || strchr(l, ':') != 0) {
+ error("ignoring variable '%s' from %s: structures not allowed", l, cfg_source());
+ } else {
+ expression = cfg_get_raw(section, l, "");
+ if (expression != NULL && *expression != '\0') {
+ tree = NULL;
+ if (Compile(expression, &tree) == 0 && Eval(tree, &result) == 0) {
+ SetVariable(l, &result);
+ debug("Variable %s = '%s' (%g)", l, R2S(&result), R2N(&result));
+ DelResult(&result);
+ } else {
+ error("error evaluating variable '%s' from %s", list, cfg_source());
+ }
+ DelTree(tree);
+ }
+ }
+ l = p ? p + 1 : NULL;
+ }
+ free(list);
+
+}
+
+
+static void my_cfg(RESULT * result, const int argc, RESULT * argv[])
+{
+ int i, len;
+ char *value;
+ char *buffer;
+
+ /* calculate key length */
+ len = 0;
+ for (i = 0; i < argc; i++) {
+ len += strlen(R2S(argv[i])) + 1;
+ }
+
+ /* allocate key buffer */
+ buffer = malloc(len + 1);
+
+ /* prepare key buffer */
+ *buffer = '\0';
+ for (i = 0; i < argc; i++) {
+ strcat(buffer, ".");
+ strcat(buffer, R2S(argv[i]));
+ }
+
+ /* buffer starts with '.', so cut off first char */
+ value = cfg_get("", buffer + 1, "");
+
+ /* store result */
+ SetResult(&result, R_STRING, value);
+
+ /* free buffer again */
+ free(buffer);
+
+ free(value);
+}
+
+
+int plugin_init_cfg(void)
+{
+ /* load "Variables" section from cfg */
+ load_variables();
+
+ /* register plugin */
+ AddFunction("cfg", -1, my_cfg);
+
+ return 0;
+}
+
+void plugin_exit_cfg(void)
+{
+ /* empty */
+}
diff --git a/plugin_cpuinfo.c b/plugin_cpuinfo.c
new file mode 100644
index 0000000..0e4b647
--- /dev/null
+++ b/plugin_cpuinfo.c
@@ -0,0 +1,166 @@
+/* $Id: plugin_cpuinfo.c 1153 2011-07-27 05:12:30Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/plugin_cpuinfo.c $
+ *
+ * plugin for /proc/cpuinfo parsing
+ *
+ * Copyright (C) 2003 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ * exported functions:
+ *
+ * int plugin_init_cpuinfo (void)
+ * adds functions to access /proc/cpuinfo
+ *
+ */
+
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+#include <errno.h>
+
+#include "debug.h"
+#include "plugin.h"
+#include "hash.h"
+
+#ifdef __MAC_OS_X_VERSION_10_3
+#include <sys/types.h>
+#include <sys/sysctl.h>
+#endif
+
+static HASH CPUinfo;
+static FILE *stream = NULL;
+
+static int parse_cpuinfo(char __attribute__ ((unused)) * oid)
+{
+ int age;
+
+ /* reread every second only */
+ age = hash_age(&CPUinfo, NULL);
+ if (age > 0 && age <= 1000)
+ return 0;
+
+#ifndef __MAC_OS_X_VERSION_10_3
+
+ /* Linux Kernel, /proc-filesystem */
+
+ if (stream == NULL)
+ stream = fopen("/proc/cpuinfo", "r");
+ if (stream == NULL) {
+ error("fopen(/proc/cpuinfo) failed: %s", strerror(errno));
+ return -1;
+ }
+ rewind(stream);
+ while (!feof(stream)) {
+ char buffer[256];
+ char *c, *key, *val;
+ fgets(buffer, sizeof(buffer), stream);
+ c = strchr(buffer, ':');
+ if (c == NULL)
+ continue;
+ key = buffer;
+ val = c + 1;
+ /* strip leading blanks from key */
+ while (isspace(*key))
+ *key++ = '\0';
+ /* strip trailing blanks from key */
+ do
+ *c = '\0';
+ while (isspace(*--c));
+ /* strip leading blanks from value */
+ while (isspace(*val))
+ *val++ = '\0';
+ /* strip trailing blanks from value */
+ for (c = val; *c != '\0'; c++);
+ while (isspace(*--c))
+ *c = '\0';
+
+ /* add entry to hash table */
+ hash_put(&CPUinfo, key, val);
+
+ }
+
+#else
+
+ /* MACH Kernel, MacOS X */
+
+ char val_ret[256];
+ int *val;
+ size_t val_len;
+
+ if (sysctlbyname(oid, NULL, &val_len, NULL, 0) != 0) {
+ error("Error %d by sysctl(%s): %s", errno, oid, strerror(errno));
+ return -1;
+ }
+ if (val_len > sizeof(val_ret)) {
+ error("Error: Result of sysctl(%s) too big (%zd > %zd)!", oid, val_len, sizeof(val_ret));
+ return -1;
+ }
+ sysctlbyname(oid, &val_ret, &val_len, NULL, 0);
+ if (val_len == sizeof(int)) {
+ /* we got an integer instead of a string */
+ val = (int *) val_ret;
+ snprintf(val_ret, sizeof(val_ret), "%d", *val);
+ }
+ hash_put(&CPUinfo, oid, val_ret);
+#endif
+
+ return 0;
+}
+
+
+static void my_cpuinfo(RESULT * result, RESULT * arg1)
+{
+ char *key, *val;
+
+ key = R2S(arg1);
+ if (parse_cpuinfo(key) < 0) {
+ SetResult(&result, R_STRING, "");
+ return;
+ }
+
+ val = hash_get(&CPUinfo, key, NULL);
+ if (val == NULL)
+ val = "";
+
+ SetResult(&result, R_STRING, val);
+}
+
+
+int plugin_init_cpuinfo(void)
+{
+ hash_create(&CPUinfo);
+ AddFunction("cpuinfo", 1, my_cpuinfo);
+ return 0;
+}
+
+void plugin_exit_cpuinfo(void)
+{
+ if (stream != NULL) {
+ fclose(stream);
+ stream = NULL;
+ }
+ hash_destroy(&CPUinfo);
+}
diff --git a/plugin_dbus.c b/plugin_dbus.c
new file mode 100644
index 0000000..0647e1c
--- /dev/null
+++ b/plugin_dbus.c
@@ -0,0 +1,857 @@
+/* $Id: plugin_dbus.c -1 $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/plugin_dbus.c $
+ *
+ * plugin template
+ *
+ * Copyright (C) 2009 Edward Martin <edman007@edman007.com>
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ * exported functions:
+ *
+ * int plugin_init_dbus (void)
+ * adds various functions
+ *
+ */
+
+
+/* define the include files you need */
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdint.h>
+#include <string.h>
+#include <ctype.h>
+#include <unistd.h>
+
+/* these should always be included */
+#include "debug.h"
+#include "plugin.h"
+#include "cfg.h"
+#include "timer.h"
+
+#ifdef WITH_DMALLOC
+#include <dmalloc.h>
+#endif
+
+#include "event.h"
+#include <dbus/dbus.h>
+#include <stdio.h>
+#include <assert.h>
+/*
+ * Internal Text Storage (to catch the events)
+ */
+
+//a buffer of the most recent results (store the strings you see on the screen)
+typedef struct {
+ int argc;
+ char **arguments;
+} dbus_signal_t;
+
+static struct {
+ int signals;
+ dbus_signal_t *a;
+} dbus_results = {
+0, NULL};
+
+//free all resources for the text of a signal
+static int clear_signal_txt(const int sig);
+
+//return a pointer to the struct of text for the signal
+static dbus_signal_t *get_signal_txt(const int sig);
+
+//set the struct of text for the signal
+static int set_signal_txt(const int sig, const dbus_signal_t * data);
+
+
+/*
+ * DBus Functions/types
+ */
+
+
+//the max that a message may be in characters (if you have a screen that fits more go crazy)
+static const int LCD_MAX_MSG_LEN = 255;
+#define DBUS_MAX_SIGNALS 64
+static const char *DBUS_PLUGIN_SECTION = "Plugin:DBus";
+
+
+
+/*
+ * This connects to dbus and gets relavant things for the LCD
+ */
+
+typedef struct lcd_sig_t lcd_sig_t;
+//do not look inside, its private!
+struct lcd_sig_t {
+ void *user_data;
+ void (*callback) (void *user_data, int argc, char **argv);
+ void (*user_free) (void *);
+ char *sender;
+ char *path;
+ char *interface;
+ char *member;
+ char *rule;
+};
+
+
+typedef struct {
+ int id;
+ char *event_name;
+} handle_signal_t;
+
+static DBusConnection *sessconn;
+static DBusConnection *sysconn;
+static DBusError err;
+
+static lcd_sig_t *lcd_registered_signals[DBUS_MAX_SIGNALS]; //used mostly for freeing resources
+static int registered_sig_count = 0;
+
+//takes the signal, matches it against a rule, and sends the correct agrument, as a string, to the screen
+static DBusHandlerResult lcd_sig_received(DBusConnection * connection, DBusMessage * message, void *sigv);
+
+//frees all resources for a signal (use lcd_unregister_signal instead)
+static void free_signal(lcd_sig_t * sig);
+//unregisters a signal and frees its resources
+static void lcd_unregister_signal(lcd_sig_t * sig);
+
+//these copy data in/out of dbus
+static void fill_args(DBusMessage * message, int *argcount, char ***argv);
+static void free_args(int argc, char **argv);
+
+//returns 0 on error (no connection opened)
+// 1 when only the system connection was opened
+// 2 when only the session connection was opened
+// 3 both connections were opened
+static int lcd_dbus_init(void);
+
+static void handle_inbound_signal(void *signal, int argc, char **argv);
+static void free_handle_signal(handle_signal_t * sig);
+
+//given a signal, will add a hook so when the signal appears your callback is called
+static lcd_sig_t *lcd_register_signal(const char *sender, const char *path,
+ const char *interface, const char *member,
+ void (*callback) (void *user_data, int argc, char **argv), void *user_data,
+ void (*user_free) (void *));
+
+static void setup_dbus_events(DBusConnection * conn);
+
+//to handle watches through the main loop
+static dbus_bool_t add_watch(DBusWatch * w, void *data);
+static void remove_watch(DBusWatch * w, void *data);
+static void toggle_watch(DBusWatch * w, void *data);
+static void watch_handle(event_flags_t f, void *data);
+
+static void dispatch_dbus(void); //tell dbus to read something
+
+
+//to handle timers through the main loop
+static void timeout_dbus_handle(void *data);
+static dbus_bool_t add_dbus_timeout(DBusTimeout * t, void *data);
+static void remove_dbus_timeout(DBusTimeout * t, void *data);
+static void toggle_dbus_timeout(DBusTimeout * t, void *data);
+
+static lcd_sig_t *create_signal(const char *sender, const char *path,
+ const char *interface, const char *member,
+ void (*callback) (void *user_data, int argc, char **argv), void *user_data,
+ void (*user_free) (void *));
+
+static int clear_signal_txt(const int sig)
+{
+ dbus_signal_t *s = get_signal_txt(sig);
+ if (s == NULL) {
+ return 1;
+ }
+ int i;
+ if (s->arguments != NULL) {
+ for (i = 0; i < s->argc; i++) {
+ if (s->arguments[i] != NULL) {
+ free(s->arguments[i]);
+ }
+ }
+ free(s->arguments);
+ s->arguments = NULL;
+ }
+ s->argc = 0;
+ return 0;
+}
+
+static dbus_signal_t *get_signal_txt(const int sig)
+{
+ if (sig < 0 || sig >= dbus_results.signals) {
+ return NULL;
+ }
+ return &dbus_results.a[sig];
+}
+
+//sets a signal struct for the given data
+static int set_signal_txt(const int sig, const dbus_signal_t * data)
+{
+ if (sig < 0 || sig >= dbus_results.signals) {
+ int new_sigs = sig + 1;
+ //allocate it
+ dbus_results.a = realloc(dbus_results.a, sizeof(dbus_signal_t) * new_sigs);
+ int i;
+ //clear anything just allocated that we are not writing to right now
+ for (i = dbus_results.signals; i < new_sigs; i++) {
+ dbus_results.a[i].argc = 0;
+ dbus_results.a[i].arguments = NULL;
+ }
+ dbus_results.signals = new_sigs;
+ }
+ //free the old version
+ if (dbus_results.a[sig].argc != 0) {
+ clear_signal_txt(sig);
+ }
+ dbus_results.a[sig].argc = data->argc;
+ //need to dup the strings
+ dbus_results.a[sig].arguments = malloc(sizeof(data->arguments) * data->argc);
+ int i;
+ for (i = 0; i < data->argc; i++) {
+ dbus_results.a[sig].arguments[i] = strdup(data->arguments[i]);
+ }
+ return 0;
+}
+
+
+
+/*
+ * lcd4linux interface fucntions
+ */
+
+
+static void get_argument(RESULT * result, RESULT * sig, RESULT * arg)
+{
+ int signal = (int) R2N(sig);
+ int argument = (int) R2N(arg);
+
+ dbus_signal_t *signal_value = get_signal_txt(signal);
+ char *value = "";
+ if (signal_value != NULL && signal_value->argc > argument && signal_value->arguments[argument] != NULL) {
+ value = signal_value->arguments[argument];
+
+ }
+
+ /* store result */
+ SetResult(&result, R_STRING, value);
+
+}
+
+static void clear_arguments(RESULT * result, RESULT * sig)
+{
+ int signal = (int) R2N(sig);
+ dbus_signal_t *signal_value = get_signal_txt(signal);
+ int i;
+ if (signal_value->arguments != NULL) {
+ for (i = 0; i < signal_value->argc; i++) {
+ if (signal_value->arguments[i] != NULL) {
+ free(signal_value->arguments[i]);
+ }
+ }
+ free(signal_value->arguments);
+ signal_value->arguments = NULL;
+ }
+ signal_value->argc = 0;
+
+ /* store result */
+ SetResult(&result, R_STRING, "");
+}
+
+static void load_dbus_cfg(void)
+{
+ char *sender, *path, *interface, *member, *eventname;
+ int i;
+ const char *sender_fmt = "signal%dsender";
+ const char *path_fmt = "signal%dpath";
+ const char *interface_fmt = "signal%dinterface";
+ const char *member_fmt = "signal%dmember";
+ const char *eventname_fmt = "signal%deventname";
+ const int max_cfg_len = 32;
+ char cfg_name[max_cfg_len];
+ for (i = 0; i < DBUS_MAX_SIGNALS; i++) {
+ snprintf(cfg_name, max_cfg_len - 1, sender_fmt, i);
+ sender = cfg_get(DBUS_PLUGIN_SECTION, cfg_name, "");
+
+ snprintf(cfg_name, max_cfg_len - 1, path_fmt, i);
+ path = cfg_get(DBUS_PLUGIN_SECTION, cfg_name, "");
+
+ snprintf(cfg_name, max_cfg_len - 1, interface_fmt, i);
+ interface = cfg_get(DBUS_PLUGIN_SECTION, cfg_name, "");
+
+ snprintf(cfg_name, max_cfg_len - 1, member_fmt, i);
+ member = cfg_get(DBUS_PLUGIN_SECTION, cfg_name, "");
+
+ snprintf(cfg_name, max_cfg_len - 1, eventname_fmt, i);
+ eventname = cfg_get(DBUS_PLUGIN_SECTION, cfg_name, "");
+
+ if (*path == '\0' && *interface == '\0' && *member == '\0') {
+ goto cleanup;
+ } else if (*path == '\0' || *interface == '\0' || *member == '\0') {
+ error("[DBus] Incomplete configuration specified for signal%d", i);
+ goto cleanup;
+ }
+
+ handle_signal_t *sig_info = malloc(sizeof(handle_signal_t));
+ sig_info->id = i;
+ if (*eventname == '\0') {
+ sig_info->event_name = NULL;
+ } else {
+ sig_info->event_name = strdup(eventname);
+ }
+
+ if (!lcd_register_signal(sender, path, interface, member, handle_inbound_signal,
+ sig_info, (void (*)(void *)) free_handle_signal)) {
+ error("[DBus] Error Registering signal %d", i);
+ }
+ cleanup:
+ free(sender);
+ free(path);
+ free(interface);
+ free(member);
+ free(eventname);
+ }
+}
+
+
+static void free_handle_signal(handle_signal_t * sig)
+{
+ if (sig->event_name != NULL) {
+ free(sig->event_name);
+ }
+ free(sig);
+}
+
+/* plugin initialization */
+int plugin_init_dbus(void)
+{
+ if (!lcd_dbus_init()) {
+ error("[DBus] Could not connect to DBus");
+ return 1;
+ }
+ //dbus::argument(<DisplaySignal>, <Argument#>)//displays arg# for signal#
+ AddFunction("dbus::argument", 2, get_argument);
+ //dbus::clear(<signal>)//sets the arguments for signal#
+ AddFunction("dbus::clear", 1, clear_arguments);
+
+ //read out config
+ load_dbus_cfg();
+ return 0;
+}
+
+void plugin_exit_dbus(void)
+{
+ int i;
+ //remove all known signals
+ for (i = registered_sig_count - 1; i >= 0; i--) {
+ lcd_unregister_signal(lcd_registered_signals[i]);
+ }
+ if (sysconn != NULL) {
+ dbus_connection_unref(sysconn);
+ }
+ if (sessconn != NULL) {
+ dbus_connection_unref(sessconn);
+ }
+ //remove all knows signal results
+ for (i = dbus_results.signals - 1; i >= 0; i--) {
+ clear_signal_txt(i);
+ }
+
+#ifdef DEBUG
+ //needs to be called to actually free everything, but might free stuff
+ //mpris_dbus uses and cause a crash on shutdown, enable for leak debugging
+ dbus_shutdown();
+#endif
+}
+
+
+/*
+ * From here one out it is all dbus specific funtions,
+ * should probably be split into a seperate file, but i
+ * keept it here to make the plugin a single file
+ *
+ */
+
+//watch functions
+static dbus_bool_t add_watch(DBusWatch * w, void *data)
+{
+ (void) data; //ignore it
+#if (DBUS_VERSION_MAJOR == 1 && DBUS_VERSION_MINOR == 1 && DBUS_VERSION_MICRO >= 1) || (DBUS_VERSION_MAJOR == 1 && DBUS_VERSION_MINOR > 1) || (DBUS_VERSION_MAJOR > 1)
+ int fd = dbus_watch_get_unix_fd(w);
+#else
+ int fd = dbus_watch_get_fd(w);
+#endif
+ // int fd = dbus_watch_get_unix_fd(w); //we assume we are using unix
+ int flags = dbus_watch_get_flags(w);
+ event_add(watch_handle, w, fd, flags & DBUS_WATCH_READABLE, flags & DBUS_WATCH_WRITABLE, dbus_watch_get_enabled(w));
+ return TRUE;
+}
+
+static void remove_watch(DBusWatch * w, void *data)
+{
+ (void) data; //ignore it
+#if (DBUS_VERSION_MAJOR == 1 && DBUS_VERSION_MINOR == 1 && DBUS_VERSION_MICRO >= 1) || (DBUS_VERSION_MAJOR == 1 && DBUS_VERSION_MINOR > 1) || (DBUS_VERSION_MAJOR > 1)
+ event_del(dbus_watch_get_unix_fd(w));
+#else
+ event_del(dbus_watch_get_fd(w));
+#endif
+ // event_del(dbus_watch_get_unix_fd(w));
+}
+
+static void toggle_watch(DBusWatch * w, void *data)
+{
+ (void) data;
+#if (DBUS_VERSION_MAJOR == 1 && DBUS_VERSION_MINOR == 1 && DBUS_VERSION_MICRO >= 1) || (DBUS_VERSION_MAJOR == 1 && DBUS_VERSION_MINOR > 1) || (DBUS_VERSION_MAJOR > 1)
+ int fd = dbus_watch_get_unix_fd(w);
+#else
+ int fd = dbus_watch_get_fd(w);
+#endif
+ // int fd = dbus_watch_get_unix_fd(w); //we assume we are using unix
+ int flags = dbus_watch_get_flags(w);
+ event_modify(fd, flags & DBUS_WATCH_READABLE, flags & DBUS_WATCH_WRITABLE, dbus_watch_get_enabled(w));
+}
+
+static void watch_handle(event_flags_t f, void *data)
+{
+ DBusWatch *w = (DBusWatch *) data;
+
+ //convert the flags
+ unsigned int flags = 0;
+
+ flags |= (f & EVENT_READ) ? DBUS_WATCH_READABLE : 0;
+ flags |= (f & EVENT_WRITE) ? DBUS_WATCH_WRITABLE : 0;
+ flags |= (f & EVENT_HUP) ? DBUS_WATCH_HANGUP : 0;
+ flags |= (f & EVENT_ERR) ? DBUS_WATCH_ERROR : 0;
+
+ //tell dbus
+ if (!dbus_watch_handle(w, flags)) {
+ info("[DBus] dbus_watch_handle(): Not enough memory!");
+ }
+ dispatch_dbus();
+}
+
+static void dispatch_dbus(void)
+{
+ if (sessconn != NULL && dbus_connection_get_dispatch_status(sessconn) == DBUS_DISPATCH_DATA_REMAINS) {
+ while (DBUS_DISPATCH_DATA_REMAINS == dbus_connection_dispatch(sessconn));
+ }
+ if (sysconn != NULL && dbus_connection_get_dispatch_status(sysconn) == DBUS_DISPATCH_DATA_REMAINS) {
+ while (DBUS_DISPATCH_DATA_REMAINS == dbus_connection_dispatch(sysconn));
+ }
+}
+
+static void timeout_dbus_handle(void *data)
+{
+ DBusTimeout *t = (DBusTimeout *) data;
+ if (!dbus_timeout_handle(t)) {
+ info("[DBus] Not enough memory to handle timeout!");
+ }
+ dispatch_dbus();
+}
+
+static dbus_bool_t add_dbus_timeout(DBusTimeout * t, void *data)
+{
+ (void) data; //ignore warning
+ if (!timer_add_late(timeout_dbus_handle, t, dbus_timeout_get_interval(t), 0)) {
+ return FALSE;
+ }
+ return TRUE;
+}
+
+
+static void remove_dbus_timeout(DBusTimeout * t, void *data)
+{
+ (void) data; //ignore warning
+ timer_remove(timeout_dbus_handle, t);
+}
+
+static void toggle_dbus_timeout(DBusTimeout * t, void *data)
+{
+ remove_dbus_timeout(t, data);
+ add_dbus_timeout(t, data);
+}
+
+//add the proper events/callbacks so we get notified about out messages
+static void setup_dbus_events(DBusConnection * conn)
+{
+ if (!dbus_connection_set_watch_functions(conn, add_watch, remove_watch, toggle_watch, NULL, NULL)) {
+ error("[DBus] dbus_connection_set_watch_functions(): Not enough memory!");
+ }
+ if (!dbus_connection_set_timeout_functions
+ (conn, add_dbus_timeout, remove_dbus_timeout, toggle_dbus_timeout, NULL, NULL)) {
+ error("[DBus] dbus_connection_set_timeout_functions(): Not enough memory!");
+ }
+}
+
+static int lcd_dbus_init(void)
+{
+
+ int success = 3;
+ dbus_error_init(&err); //dbus_error_free(&err);
+ sessconn = dbus_bus_get(DBUS_BUS_SESSION, &err);
+ if (sessconn == NULL) {
+ info("[DBus] Error connecting to the dbus session bus: %s\n", err.message);
+ dbus_error_free(&err);
+ success &= 1;
+ } else {
+#ifdef DEBUG
+ dbus_connection_set_exit_on_disconnect(sessconn, FALSE);
+#endif
+ setup_dbus_events(sessconn);
+ }
+
+ sysconn = dbus_bus_get(DBUS_BUS_SYSTEM, &err);
+ if (sysconn == NULL) {
+ info("[DBus] Error connecting to the dbus system bus: %s\n", err.message);
+ success &= 2;
+ } else {
+#ifdef DEBUG
+ dbus_connection_set_exit_on_disconnect(sysconn, FALSE);
+#endif
+ setup_dbus_events(sysconn);
+ }
+
+ return success;
+}
+
+static lcd_sig_t *create_signal(const char *sender, const char *path,
+ const char *interface, const char *member,
+ void (*callback) (void *user_data, int argc, char **argv), void *user_data,
+ void (*user_free) (void *))
+{
+ lcd_sig_t *sig = malloc(sizeof(lcd_sig_t));
+ sig->callback = callback;
+ sig->user_data = user_data;
+ sig->user_free = user_free;
+ sig->sender = malloc(sizeof(char) * (1 + strlen(sender)));
+ strcpy(sig->sender, sender);
+ sig->path = malloc(sizeof(char) * (1 + strlen(path)));
+ strcpy(sig->path, path);
+ sig->interface = malloc(sizeof(char) * (1 + strlen(interface)));
+ strcpy(sig->interface, interface);
+ sig->member = malloc(sizeof(char) * (1 + strlen(member)));
+ strcpy(sig->member, member);
+
+ size_t len = strlen(sender) + strlen(path) + strlen(interface) + strlen(member);
+ char *format;
+ if (strlen(sig->sender) == 0) {
+ format = "type='signal',path='%s',interface='%s',member='%s'";
+ } else {
+ format = "type='signal',sender='%s',path='%s',interface='%s',member='%s'";
+ }
+ len += strlen(format);
+ len *= sizeof(char);
+ sig->rule = malloc(len);
+ if (strlen(sig->sender) == 0) {
+ sprintf(sig->rule, format, path, interface, member);
+ } else {
+ sprintf(sig->rule, format, sender, path, interface, member);
+ }
+ assert(strlen(sig->rule) < len);
+ return sig;
+}
+
+static void handle_inbound_signal(void *signal, int argc, char **argv)
+{
+ handle_signal_t *signal_info = (handle_signal_t *) signal;
+ dbus_signal_t sig;
+ sig.argc = argc;
+ sig.arguments = argv;
+ set_signal_txt(signal_info->id, &sig);
+
+ if (signal_info->event_name != NULL) {
+ named_event_trigger(signal_info->event_name);
+ }
+}
+
+static lcd_sig_t *lcd_register_signal(const char *sender, const char *path,
+ const char *interface, const char *member,
+ void (*callback) (void *user_data, int argc, char **argv), void *user_data,
+ void (*user_free) (void *))
+{
+ if (__builtin_expect(registered_sig_count >= DBUS_MAX_SIGNALS, 0)) { //gcc >= 2.96
+ //i don't think anything will allow this to ever be hit..in fact It's impossible in the form i wrote the plugin
+ error
+ ("[DBus] Attempted to add more than %d dus signals, if you actually need more than that edit DBUS_MAX_SIGNALS in plugin_dbus.c",
+ DBUS_MAX_SIGNALS);
+ return NULL;
+ }
+ //store everything we need in the singal struct
+ lcd_sig_t *sig = create_signal(sender, path, interface, member, callback, user_data, user_free);
+ int success = 3;
+ if (sessconn != NULL) {
+ dbus_bus_add_match(sessconn, sig->rule, &err);
+ if (dbus_error_is_set(&err)) {
+ info("[DBus] Error adding dbus match to the session bus: %s \n", err.message);
+ dbus_error_free(&err);
+ success ^= 1;
+ }
+
+
+ if (!dbus_connection_add_filter(sessconn, lcd_sig_received, sig, NULL) && (success & 1)) {
+ info("[DBus] Dbus signal registration failed to the session bus!\n");
+ dbus_bus_remove_match(sessconn, sig->rule, &err);
+ success ^= 1;
+ }
+ } else {
+ success ^= 1;
+ }
+ if (sysconn != NULL) {
+ dbus_bus_add_match(sysconn, sig->rule, &err);
+ if (dbus_error_is_set(&err)) {
+ info("[DBus] Error adding dbus match to the system bus: %s \n", err.message);
+ success ^= 2;
+ }
+
+ if (!dbus_connection_add_filter(sysconn, lcd_sig_received, sig, NULL) && (success & 2)) {
+ info("[DBus] Dbus signal registration failed to the system bus!\n");
+ dbus_bus_remove_match(sysconn, sig->rule, &err);
+ success ^= 2;
+ }
+ } else {
+ success ^= 2;
+ }
+ if (!success) {
+ free_signal(sig);
+ return NULL;
+ }
+
+ lcd_registered_signals[registered_sig_count] = sig;
+ registered_sig_count++;
+ return sig;
+}
+
+static void free_signal(lcd_sig_t * sig)
+{
+ if (sig->user_free != NULL) {
+ sig->user_free(sig->user_data);
+ }
+ free(sig->sender);
+ free(sig->path);
+ free(sig->interface);
+ free(sig->member);
+ free(sig->rule);
+ free(sig);
+}
+
+static void lcd_unregister_signal(lcd_sig_t * sig)
+{
+ if (sig == NULL) {
+ return;
+ }
+ //remove filter and match
+ if (sessconn != NULL) {
+ dbus_connection_remove_filter(sessconn, lcd_sig_received, sig);
+ dbus_bus_remove_match(sessconn, sig->rule, NULL);
+ }
+ if (sysconn != NULL) {
+ dbus_connection_remove_filter(sysconn, lcd_sig_received, sig);
+ dbus_bus_remove_match(sysconn, sig->rule, NULL);
+ }
+ //free user data
+ free_signal(sig);
+
+ //drop it off the list
+ int i;
+ for (i = 0; i < registered_sig_count; i++) {
+ if (lcd_registered_signals[i] == sig) {
+ registered_sig_count--;
+ lcd_registered_signals[i] = lcd_registered_signals[registered_sig_count];
+ break;
+ }
+ }
+}
+
+
+static void fill_args(DBusMessage * message, int *argcount, char ***argv)
+{
+ dbus_message_ref(message);
+ int argc = 0;
+ char **args = NULL;
+
+
+ DBusMessageIter iter;
+ int buf_size = 0;
+ dbus_message_iter_init(message, &iter);
+ int current_type;
+
+ //iterate over all arguments, casting all primitaves to strings
+ while ((current_type = dbus_message_iter_get_arg_type(&iter)) != DBUS_TYPE_INVALID) {
+ assert(argc <= buf_size);
+ if (argc >= buf_size) {
+ buf_size = argc * 2;
+ if (buf_size == 0) {
+ buf_size = 1;
+ }
+ args = realloc(args, sizeof(char **) * buf_size);
+ }
+ if (dbus_type_is_basic(current_type)) {
+ args[argc] = malloc(sizeof(char) * (1 + LCD_MAX_MSG_LEN));
+ args[argc][LCD_MAX_MSG_LEN] = '\0';
+ //determine the type
+ switch (current_type) {
+ /* Primitive types */
+ case DBUS_TYPE_BYTE:
+ {
+ char value;
+ dbus_message_iter_get_basic(&iter, &value);
+ snprintf(args[argc], LCD_MAX_MSG_LEN, "%hhx", value);
+ }
+
+ break;
+ case DBUS_TYPE_BOOLEAN:
+ {
+ dbus_bool_t value;
+ dbus_message_iter_get_basic(&iter, &value);
+ if (value) {
+ strcpy(args[argc], "true");
+ } else {
+ strcpy(args[argc], "false");
+ }
+
+ }
+ break;
+ case DBUS_TYPE_INT16:
+ {
+ dbus_int16_t value;
+ dbus_message_iter_get_basic(&iter, &value);
+ snprintf(args[argc], LCD_MAX_MSG_LEN, "%hd", value);
+ }
+ break;
+ case DBUS_TYPE_UINT16:
+ {
+ dbus_uint16_t value;
+ dbus_message_iter_get_basic(&iter, &value);
+ snprintf(args[argc], LCD_MAX_MSG_LEN, "%hu", value);
+ }
+ break;
+ case DBUS_TYPE_INT32:
+ {
+ dbus_int32_t value;
+ dbus_message_iter_get_basic(&iter, &value);
+ snprintf(args[argc], LCD_MAX_MSG_LEN, "%d", value);
+ }
+ break;
+ case DBUS_TYPE_UINT32:
+ {
+ dbus_uint32_t value;
+ dbus_message_iter_get_basic(&iter, &value);
+ snprintf(args[argc], LCD_MAX_MSG_LEN, "%u", value);
+ }
+ break;
+ case DBUS_TYPE_INT64:
+ {
+ dbus_int64_t value;
+ dbus_message_iter_get_basic(&iter, &value);
+ snprintf(args[argc], LCD_MAX_MSG_LEN, "%jd", (intmax_t) value);
+ }
+ break;
+ case DBUS_TYPE_UINT64:
+ {
+ dbus_uint64_t value;
+ dbus_message_iter_get_basic(&iter, &value);
+ snprintf(args[argc], LCD_MAX_MSG_LEN, "%ju", (uintmax_t) value);
+ }
+ break;
+ case DBUS_TYPE_DOUBLE:
+ {
+ double value;
+ dbus_message_iter_get_basic(&iter, &value);
+ snprintf(args[argc], LCD_MAX_MSG_LEN, "%f", value);
+ }
+ break;
+ case DBUS_TYPE_STRING: //all strings
+ case DBUS_TYPE_OBJECT_PATH:
+ case DBUS_TYPE_SIGNATURE:
+ {
+ char *value;
+ dbus_message_iter_get_basic(&iter, &value);
+ snprintf(args[argc], LCD_MAX_MSG_LEN, "%s", value);
+ }
+ break;
+ case DBUS_TYPE_INVALID:
+ default:
+ //not supported
+ free(args[argc]);
+ args[argc] = NULL;
+ assert(0); //should never ever happen...
+
+ break;
+ }
+ } else {
+ args[argc] = NULL;
+ }
+
+ argc++;
+ dbus_message_iter_next(&iter);
+ }
+
+
+ *argcount = argc;
+ *argv = args;
+ dbus_message_unref(message);
+}
+
+
+static DBusHandlerResult lcd_sig_received(DBusConnection * connection, DBusMessage * msg, void *sigv)
+{
+ (void) connection;
+ dbus_message_ref(msg);
+ lcd_sig_t *sig = sigv;
+ //compare the signal to the one we were assigned
+ if (dbus_message_get_type(msg) != DBUS_MESSAGE_TYPE_SIGNAL) {
+ dbus_message_unref(msg);
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ }
+ //we don't check the sender because we (probably) asked by name, not by sender
+ if (!dbus_message_has_member(msg, sig->member) ||
+ !dbus_message_has_path(msg, sig->path) || !dbus_message_has_interface(msg, sig->interface)) {
+ dbus_message_unref(msg);
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ }
+ //call the users function
+ if (sig->callback != NULL) {
+ char **args;
+ int argc;
+ fill_args(msg, &argc, &args);
+ sig->callback(sig->user_data, argc, args);
+ free_args(argc, args);
+ }
+
+ dbus_message_unref(msg);
+ return DBUS_HANDLER_RESULT_HANDLED;
+}
+
+
+
+static void free_args(int argc, char **argv)
+{
+ int i;
+ //free args
+ for (i = 0; i < argc; i++) {
+ if (argv[i] != NULL) {
+ free(argv[i]);
+ }
+ }
+
+ if (argv != NULL && argc != 0) {
+ free(argv);
+ }
+
+}
diff --git a/plugin_diskstats.c b/plugin_diskstats.c
new file mode 100644
index 0000000..bfaaa0e
--- /dev/null
+++ b/plugin_diskstats.c
@@ -0,0 +1,155 @@
+/* $Id: plugin_diskstats.c 840 2007-09-09 12:17:42Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/plugin_diskstats.c $
+ *
+ * plugin for /proc/diskstats parsing
+ *
+ * Copyright (C) 2003 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ * exported functions:
+ *
+ * int plugin_init_diskstats (void)
+ * adds functions to access /proc/stat
+ *
+ */
+
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+#include <errno.h>
+
+#include "debug.h"
+#include "plugin.h"
+#include "hash.h"
+
+
+static HASH DISKSTATS;
+static FILE *stream = NULL;
+
+
+static int parse_diskstats(void)
+{
+ int age;
+
+ /* reread every 10 msec only */
+ age = hash_age(&DISKSTATS, NULL);
+ if (age > 0 && age <= 10)
+ return 0;
+
+ if (stream == NULL)
+ stream = fopen("/proc/diskstats", "r");
+ if (stream == NULL) {
+ error("fopen(/proc/diskstats) failed: %s", strerror(errno));
+ return -1;
+ }
+
+ rewind(stream);
+
+ while (!feof(stream)) {
+ char buffer[1024];
+ char dev[64];
+ char *beg, *end;
+ unsigned int num, len;
+
+ if (fgets(buffer, sizeof(buffer), stream) == NULL)
+ break;
+
+ /* fetch device name (3rd column) as key */
+ num = 0;
+ beg = buffer;
+ end = beg;
+ while (*beg) {
+ while (*beg == ' ')
+ beg++;
+ end = beg + 1;
+ while (*end && *end != ' ')
+ end++;
+ if (num++ == 2)
+ break;
+ beg = end ? end + 1 : NULL;
+ }
+ len = end ? (unsigned) (end - beg) : strlen(beg);
+
+ if (len >= sizeof(dev))
+ len = sizeof(dev) - 1;
+ strncpy(dev, beg, len);
+ dev[len] = '\0';
+
+ hash_put_delta(&DISKSTATS, dev, buffer);
+
+ }
+ return 0;
+}
+
+
+static void my_diskstats(RESULT * result, RESULT * arg1, RESULT * arg2, RESULT * arg3)
+{
+ char *dev, *key;
+ int delay;
+ double value;
+
+ if (parse_diskstats() < 0) {
+ SetResult(&result, R_STRING, "");
+ return;
+ }
+
+ dev = R2S(arg1);
+ key = R2S(arg2);
+ delay = R2N(arg3);
+
+ value = hash_get_regex(&DISKSTATS, dev, key, delay);
+
+ SetResult(&result, R_NUMBER, &value);
+}
+
+
+int plugin_init_diskstats(void)
+{
+ int i;
+ char *header[] = { "major", "minor", "name",
+ "reads", "read_merges", "read_sectors", "read_ticks",
+ "writes", "write_merges", "write_sectors", "write_ticks",
+ "in_flight", "io_ticks", "time_in_queue", ""
+ };
+
+ hash_create(&DISKSTATS);
+ hash_set_delimiter(&DISKSTATS, " \n");
+ for (i = 0; *header[i] != '\0'; i++) {
+ hash_set_column(&DISKSTATS, i, header[i]);
+ }
+
+ AddFunction("diskstats", 3, my_diskstats);
+ return 0;
+}
+
+void plugin_exit_diskstats(void)
+{
+ if (stream != NULL) {
+ fclose(stream);
+ stream = NULL;
+ }
+ hash_destroy(&DISKSTATS);
+}
diff --git a/plugin_dvb.c b/plugin_dvb.c
new file mode 100644
index 0000000..36d515a
--- /dev/null
+++ b/plugin_dvb.c
@@ -0,0 +1,169 @@
+/* $Id: plugin_dvb.c 939 2009-01-04 14:14:31Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/plugin_dvb.c $
+ *
+ * plugin for DVB status
+ *
+ * Copyright (C) 2003 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ * exported functions:
+ *
+ * int plugin_init_dvb (void)
+ * adds dvb() function
+ *
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+#include <sys/ioctl.h>
+#include <sys/types.h>
+#include <asm/types.h>
+
+#ifdef HAVE_LINUX_DVB_FRONTEND_H
+#include <linux/dvb/frontend.h>
+#else
+#warning linux/dvb/frontend.h not found: using hardcoded ioctl definitions
+#define FE_READ_BER _IOR('o', 70, __u32)
+#define FE_READ_SIGNAL_STRENGTH _IOR('o', 71, __u16)
+#define FE_READ_SNR _IOR('o', 72, __u16)
+#define FE_READ_UNCORRECTED_BLOCKS _IOR('o', 73, __u32)
+#endif
+
+#include "debug.h"
+#include "plugin.h"
+#include "hash.h"
+
+static char *frontend = "/dev/dvb/adapter0/frontend0";
+
+static HASH DVB;
+
+static int get_dvb_stats(void)
+{
+ static int ioc_disable = 0;
+
+ int age;
+ int fd;
+ unsigned short snr, sig;
+ unsigned long ber, ucb;
+ char val[16];
+
+ /* reread every 1000 msec only */
+ age = hash_age(&DVB, NULL);
+ if (age > 0 && age <= 1000)
+ return 0;
+
+ /* open frontend */
+ fd = open(frontend, O_RDONLY);
+ if (fd == -1) {
+ error("open(%s) failed: %s", frontend, strerror(errno));
+ return -1;
+ }
+
+ sig = 0;
+ if ((ioc_disable & 0x01) == 0 && ioctl(fd, FE_READ_SIGNAL_STRENGTH, &sig) != 0) {
+ error("ioctl(FE_READ_SIGNAL_STRENGTH) failed: %s", strerror(errno));
+ if (errno == ENOSYS) {
+ ioc_disable |= 0x01;
+ error("ioctl(FE_READ_SIGNAL_STRENGTH) disabled.");
+ }
+ }
+
+ snr = 0;
+ if ((ioc_disable & 0x02) == 0 && ioctl(fd, FE_READ_SNR, &snr) != 0) {
+ error("ioctl(FE_READ_SNR) failed: %s", strerror(errno));
+ if (errno == ENOSYS) {
+ ioc_disable |= 0x02;
+ error("ioctl(FE_READ_SNR) disabled.");
+ }
+ }
+
+ ber = 0;
+ if ((ioc_disable & 0x04) == 0 && ioctl(fd, FE_READ_BER, &ber) != 0) {
+ error("ioctl(FE_READ_BER) failed: %s", strerror(errno));
+ if (errno == ENOSYS) {
+ ioc_disable |= 0x04;
+ error("ioctl(FE_READ_BER) disabled.");
+ }
+ }
+
+ ucb = 0;
+ if ((ioc_disable & 0x08) == 0 && ioctl(fd, FE_READ_UNCORRECTED_BLOCKS, &ucb) != 0) {
+ error("ioctl(FE_READ_UNCORRECTED_BLOCKS) failed: %s", strerror(errno));
+ if (errno == ENOSYS) {
+ ioc_disable |= 0x08;
+ error("ioctl(FE_READ_UNCORRECTED_BLOCKS) disabled.");
+ }
+ }
+
+ close(fd);
+
+ snprintf(val, sizeof(val), "%f", sig / 65535.0);
+ hash_put(&DVB, "signal_strength", val);
+
+ snprintf(val, sizeof(val), "%f", snr / 65535.0);
+ hash_put(&DVB, "snr", val);
+
+ snprintf(val, sizeof(val), "%lu", ber);
+ hash_put(&DVB, "ber", val);
+
+ snprintf(val, sizeof(val), "%lu", ucb);
+ hash_put(&DVB, "uncorrected_blocks", val);
+
+ return 0;
+}
+
+
+static void my_dvb(RESULT * result, RESULT * arg1)
+{
+ char *val;
+
+ if (get_dvb_stats() < 0) {
+ SetResult(&result, R_STRING, "");
+ return;
+ }
+
+ val = hash_get(&DVB, R2S(arg1), NULL);
+ if (val == NULL)
+ val = "";
+
+ SetResult(&result, R_STRING, val);
+}
+
+
+int plugin_init_dvb(void)
+{
+ hash_create(&DVB);
+ AddFunction("dvb", 1, my_dvb);
+ return 0;
+}
+
+
+void plugin_exit_dvb(void)
+{
+ hash_destroy(&DVB);
+}
diff --git a/plugin_event.c b/plugin_event.c
new file mode 100644
index 0000000..05f2bea
--- /dev/null
+++ b/plugin_event.c
@@ -0,0 +1,94 @@
+/* $Id: plugin_event.c -1 $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/plugin_event.c $
+ *
+ * plugin template
+ *
+ * Copyright (C) 2003 Ed Martin <edman007@edman007.com>
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ * exported functions:
+ *
+ * int plugin_init_event (void)
+ * adds various functions
+ *
+ */
+
+
+/* define the include files you need */
+#include "config.h"
+
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+
+/* these should always be included */
+#include "debug.h"
+#include "plugin.h"
+#include "event.h"
+
+#ifdef WITH_DMALLOC
+#include <dmalloc.h>
+#endif
+
+
+
+/* function 'trigger' */
+/* takes one argument, a string */
+/* triggers the event */
+
+static void my_trigger(RESULT * result, RESULT * arg1)
+{
+ char *param;
+
+ /* Get Parameter */
+ /* R2N stands for 'Result to Number' */
+ param = R2S(arg1);
+ named_event_trigger(param);
+
+ char *value = "";
+
+ /* store result */
+ /* when called with R_NUMBER, it assumes the */
+ /* next parameter to be a pointer to double */
+ SetResult(&result, R_NUMBER, &value);
+}
+
+
+/* plugin initialization */
+/* MUST NOT be declared 'static'! */
+int plugin_init_event(void)
+{
+
+ /* register all our cool functions */
+ /* the second parameter is the number of arguments */
+ /* -1 stands for variable argument list */
+ AddFunction("event::trigger", 1, my_trigger);
+
+
+ return 0;
+}
+
+void plugin_exit_event(void)
+{
+ /* free any allocated memory */
+ /* close filedescriptors */
+}
diff --git a/plugin_exec.c b/plugin_exec.c
new file mode 100644
index 0000000..cf5e5ee
--- /dev/null
+++ b/plugin_exec.c
@@ -0,0 +1,284 @@
+/* $Id: plugin_exec.c 840 2007-09-09 12:17:42Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/plugin_exec.c $
+ *
+ * plugin for external processes
+ *
+ * Copyright (C) 2004 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * based on the old 'exec' client which is
+ * Copyright (C) 2001 Leopold Tötsch <lt@toetsch.at>
+ *
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ * exported functions:
+ *
+ * int plugin_init_exec (void)
+ * adds functions to start external pocesses
+ *
+ */
+
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+
+#include "debug.h"
+#include "plugin.h"
+#include "hash.h"
+#include "cfg.h"
+#include "thread.h"
+#include "qprintf.h"
+
+
+#define NUM_THREADS 16
+#define SHM_SIZE 4096
+
+typedef struct {
+ int delay;
+ int mutex;
+ pid_t pid;
+ int shmid;
+ char *cmd;
+ char *key;
+ char *ret;
+} EXEC_THREAD;
+
+static EXEC_THREAD Thread[NUM_THREADS];
+static int max_thread = -1;
+
+static HASH EXEC;
+
+
+/* x^0 + x^5 + x^12 */
+#define CRCPOLY 0x8408
+
+static unsigned short CRC(const char *s)
+{
+ int i;
+ unsigned short crc;
+
+ /* seed value */
+ crc = 0xffff;
+
+ while (*s != '\0') {
+ crc ^= *s++;
+ for (i = 0; i < 8; i++)
+ crc = (crc >> 1) ^ ((crc & 1) ? CRCPOLY : 0);
+ }
+ return crc;
+}
+
+
+static void exec_thread(void *data)
+{
+ EXEC_THREAD *Thread = (EXEC_THREAD *) data;
+ FILE *pipe;
+ char buffer[SHM_SIZE];
+ int len;
+
+ /* use a safe path */
+ putenv("PATH=/usr/local/bin:/usr/bin:/bin");
+
+ /* forever... */
+ while (1) {
+ pipe = popen(Thread->cmd, "r");
+ if (pipe == NULL) {
+ error("exec error: could not run pipe '%s': %s", Thread->cmd, strerror(errno));
+ len = 0;
+ } else {
+ len = fread(buffer, 1, SHM_SIZE - 1, pipe);
+ if (len <= 0) {
+ error("exec error: could not read from pipe '%s': %s", Thread->cmd, strerror(errno));
+ len = 0;
+ }
+ pclose(pipe);
+ }
+
+ /* force trailing zero */
+ buffer[len] = '\0';
+
+ /* remove trailing CR/LF */
+ while (len > 0 && (buffer[len - 1] == '\n' || buffer[len - 1] == '\r')) {
+ buffer[--len] = '\0';
+ }
+
+ /* lock shared memory */
+ mutex_lock(Thread->mutex);
+ /* write data */
+ strncpy(Thread->ret, buffer, SHM_SIZE);
+ /* unlock shared memory */
+ mutex_unlock(Thread->mutex);
+ usleep(Thread->delay);
+ }
+}
+
+
+static void destroy_exec_thread(const int n)
+{
+ thread_destroy(Thread[n].pid);
+
+ if (Thread[n].mutex != 0)
+ mutex_destroy(Thread[n].mutex);
+ if (Thread[n].cmd)
+ free(Thread[n].cmd);
+ if (Thread[n].key)
+ free(Thread[n].key);
+ if (Thread[n].ret)
+ shm_destroy(Thread[n].shmid, Thread[n].ret);
+
+ Thread[n].delay = 0;
+ Thread[n].mutex = 0;
+ Thread[n].pid = 0;
+ Thread[n].shmid = 0;
+ Thread[n].cmd = NULL;
+ Thread[n].key = NULL;
+ Thread[n].ret = NULL;
+}
+
+
+static int create_exec_thread(const char *cmd, const char *key, const int delay)
+{
+ char name[10];
+
+ if (max_thread >= NUM_THREADS) {
+ error("cannot create exec thread <%s>: thread buffer full!", cmd);
+ return -1;
+ }
+
+ max_thread++;
+ Thread[max_thread].delay = delay;
+ Thread[max_thread].mutex = mutex_create();
+ Thread[max_thread].pid = -1;
+ Thread[max_thread].cmd = strdup(cmd);
+ Thread[max_thread].key = strdup(key);
+ Thread[max_thread].ret = NULL;
+
+ /* create communication buffer */
+ Thread[max_thread].shmid = shm_create((void **) &Thread[max_thread].ret, SHM_SIZE);
+
+ /* catch error */
+ if (Thread[max_thread].shmid < 0) {
+ error("cannot create exec thread <%s>: shared memory allocation failed!", cmd);
+ destroy_exec_thread(max_thread--);
+ return -1;
+ }
+
+ /* create thread */
+ qprintf(name, sizeof(name), "exec-%s", key);
+ Thread[max_thread].pid = thread_create(name, exec_thread, &Thread[max_thread]);
+
+ /* catch error */
+ if (Thread[max_thread].pid < 0) {
+ error("cannot create exec thread <%s>: fork failed?!", cmd);
+ destroy_exec_thread(max_thread--);
+ return -1;
+ }
+
+ return 0;
+}
+
+
+static int do_exec(const char *cmd, const char *key, int delay)
+{
+ int i, age;
+
+ age = hash_age(&EXEC, key);
+
+ if (age < 0) {
+ hash_put(&EXEC, key, "");
+ /* first-time call: create thread */
+ if (delay < 10) {
+ error("exec(%s): delay %d is too short! using 10 msec", cmd, delay);
+ delay = 10;
+ }
+ if (create_exec_thread(cmd, key, 1000 * delay)) {
+ return -1;
+ }
+ return 0;
+ }
+
+ /* reread every 10 msec only */
+ if (age > 0 && age <= 10)
+ return 0;
+
+ /* find thread */
+ for (i = 0; i <= max_thread; i++) {
+ if (strcmp(key, Thread[i].key) == 0) {
+ /* lock shared memory */
+ mutex_lock(Thread[i].mutex);
+ /* copy data */
+ hash_put(&EXEC, key, Thread[i].ret);
+ /* unlock shared memory */
+ mutex_unlock(Thread[i].mutex);
+ return 0;
+ }
+ }
+
+ error("internal error: could not find thread exec-%s", key);
+ return -1;
+}
+
+static void my_exec(RESULT * result, RESULT * arg1, RESULT * arg2)
+{
+ char *cmd, key[5], *val;
+ int delay;
+
+ cmd = R2S(arg1);
+ delay = (int) R2N(arg2);
+
+ qprintf(key, sizeof(key), "%x", CRC(cmd));
+
+ if (do_exec(cmd, key, delay) < 0) {
+ SetResult(&result, R_STRING, "");
+ return;
+ }
+
+ val = hash_get(&EXEC, key, NULL);
+ if (val == NULL)
+ val = "";
+
+ SetResult(&result, R_STRING, val);
+}
+
+
+int plugin_init_exec(void)
+{
+ hash_create(&EXEC);
+ AddFunction("exec", 2, my_exec);
+ return 0;
+}
+
+
+void plugin_exit_exec(void)
+{
+ int i;
+
+ for (i = 0; i <= max_thread; i++) {
+ destroy_exec_thread(i);
+ }
+
+ hash_destroy(&EXEC);
+}
diff --git a/plugin_fifo.c b/plugin_fifo.c
new file mode 100644
index 0000000..4166b05
--- /dev/null
+++ b/plugin_fifo.c
@@ -0,0 +1,318 @@
+/* $Id: plugin_fifo.c 1112 2010-02-14 02:47:49Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/plugin_fifo.c $
+ *
+ * Fifo plugin
+ *
+ * Copyright (C) 2008 Michael Vogt <michu@neophob.com>
+ * Copyright (C) 2010 Mattia Jona-Lasinio <mjona@users.sourceforge.net>
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ * Configuration parameters:
+ *
+ * - FifoPath 'string' : use <string> as the fifo complete file path
+ * If absent use /tmp/lcd4linux.fifo)
+ *
+ * - FifoBufSize num : if the plugin is unable to determine the display size then
+ * set the size of the internal buffer to <num> characters
+ * otherwise use the display size (number of columns).
+ * If no display size is available and no FifoBufSize parameter
+ * is specified then arbitrarily set the internal buffer size
+ * to 80 characters.
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <signal.h>
+
+#include "debug.h"
+#include "plugin.h"
+#include "cfg.h"
+
+#ifdef WITH_DMALLOC
+#include <dmalloc.h>
+#endif
+
+#define FIFO_MAXPATH 256
+#define FIFO_DEFAULT_PATH /tmp/lcd4linux.fifo
+#define FIFO_DEFAULT_BUFSIZE 80
+#define str(s) #s
+#define string(s) str(s)
+
+struct FifoData {
+ char *path;
+ char *msg;
+ int msglen;
+ int input;
+ int created;
+};
+
+static struct FifoData fd = {
+ .path = NULL,
+ .msg = NULL,
+ .msglen = -1,
+ .input = -1,
+ .created = -1,
+};
+
+
+static int confFifo(struct FifoData *p)
+{
+ char *path, *disp, *sect, *fifosect = "Plugin:FIFO";
+ unsigned int pathlen;
+
+ info("[FIFO] Reading config file '%s'", cfg_source());
+
+ path = cfg_get(fifosect, "FifoPath", string(FIFO_DEFAULT_PATH));
+ pathlen = strlen(path);
+ if (pathlen == 0) {
+ info("[FIFO] Invalid '%s.FifoPath' entry from '%s'. "
+ "Assuming " string(FIFO_DEFAULT_PATH), fifosect, cfg_source());
+ free(path);
+ path = strdup(string(FIFO_DEFAULT_PATH));
+ pathlen = strlen(path);
+ }
+ if (pathlen > FIFO_MAXPATH) {
+ error("[FIFO] Error: Too long '%s.FifoPath' entry from '%s'. "
+ "(MAX " string(FIFO_MAXPATH) " chars)", fifosect, cfg_source());
+ free(path);
+ return (-1);
+ }
+ info("[FIFO] Read '%s.FifoPath' value is '%s'", fifosect, path);
+
+ disp = cfg_get(NULL, "Display", NULL);
+ if (disp == NULL) {
+ error("[FIFO] Error: Could not get the Display name from '%s'", cfg_source());
+ free(path);
+ return (-1);
+ }
+ if ((sect = malloc(1 + strlen("Display:") + strlen(disp))) == NULL) {
+ error("[FIFO] Error: Memory allocation failed");
+ free(disp);
+ free(path);
+ return (-1);
+ }
+ strcpy(sect, "Display:");
+ strcat(sect, disp);
+ info("[FIFO] Using display '%s'.", disp);
+ free(disp);
+
+ disp = cfg_get(sect, "Size", NULL);
+ if (disp != NULL) {
+ info("[FIFO] Getting the buffer size from '%s.Size'", sect);
+ if (sscanf(disp, "%dx%*d", &p->msglen) != 1) {
+ info("[FIFO] Could not determine the display size. " "Assuming " string(FIFO_DEFAULT_BUFSIZE));
+ p->msglen = FIFO_DEFAULT_BUFSIZE;
+ }
+ free(disp);
+ } else {
+ info("[FIFO] Could not find a '%s.Size' entry.", sect);
+ if (cfg_number(fifosect, "FifoBufSize", FIFO_DEFAULT_BUFSIZE, 0, -1, &p->msglen) > 0) {
+ info("[FIFO] Getting the buffer size from '%s.FifoBufSize'", fifosect);
+ } else {
+ info("[FIFO] Could not find a valid '%s.FifoBufSize' entry. "
+ "Assuming " string(FIFO_DEFAULT_BUFSIZE), fifosect);
+ p->msglen = FIFO_DEFAULT_BUFSIZE;
+ }
+ }
+ info("[FIFO] Read buffer size is '%d'", p->msglen);
+ free(sect);
+
+ if ((p->msg = malloc(2 + pathlen + p->msglen)) == NULL) {
+ error("[FIFO] Error: Memory allocation failed");
+ free(path);
+ return (-1);
+ }
+ p->msg[0] = 0;
+ p->path = p->msg + p->msglen + 1;
+ strcpy(p->path, path);
+ free(path);
+
+ return (0);
+}
+
+
+static int makeFifo(struct FifoData *p)
+{
+ struct stat st;
+
+ if (stat(p->path, &st) < 0) {
+ if (errno == ENOENT) {
+ if (mkfifo(p->path, 0666) == 0) {
+ p->created = 1;
+
+ return (0);
+ }
+ error("Couldn't create FIFO \"%s\": %s\n", p->path, strerror(errno));
+
+ return (-1);
+ }
+ error("Failed to stat FIFO \"%s\": %s\n", p->path, strerror(errno));
+
+ return (-1);
+ }
+
+ if (!S_ISFIFO(st.st_mode)) {
+ error("\"%s\" already exists, but is not a FIFO", p->path);
+
+ return (-1);
+ }
+
+ return (0);
+}
+
+
+static void closeFifo(struct FifoData *p)
+{
+ struct stat st;
+
+ if (p->input >= 0) {
+ close(p->input);
+ p->input = -1;
+ }
+
+ if ((p->created >= 0) && (stat(p->path, &st) == 0)) {
+ debug("Removing FIFO \"%s\"\n", p->path);
+ if (unlink(p->path) < 0) {
+ error("Could not remove FIFO \"%s\": %s\n", p->path, strerror(errno));
+
+ return;
+ }
+ p->created = -1;
+ }
+
+ if (p->msg) {
+ free(p->msg);
+ p->msg = p->path = NULL;
+ p->msglen = -1;
+ }
+}
+
+
+static int openFifo(struct FifoData *p)
+{
+ if (p->created < 0) {
+ error("Error: FIFO \"%s\" does not exist: %s\n", p->path, strerror(errno));
+
+ return (-1);
+ }
+
+ if ((p->input = open(p->path, O_RDONLY | O_NONBLOCK)) < 0) {
+ error("Could not open FIFO \"%s\" for reading: %s\n", p->path, strerror(errno));
+ closeFifo(p);
+
+ return (-1);
+ }
+
+ return (0);
+}
+
+
+static int startFifo(struct FifoData *p)
+{
+ int res;
+
+ if ((res = confFifo(p)))
+ return (res);
+
+ if ((res = makeFifo(p)))
+ return (res);
+
+ if ((res = openFifo(p)))
+ return (res);
+
+ /* ignore broken pipe */
+ signal(SIGPIPE, SIG_IGN);
+
+ return (res);
+}
+
+
+static void readFifo(struct FifoData *p)
+{
+ int bytes;
+
+ bytes = read(p->input, p->msg, p->msglen);
+ if (bytes == 0)
+ return;
+
+ if (bytes > 0) {
+ p->msg[bytes] = 0;
+ while (bytes--)
+ if (p->msg[bytes] < 0x20)
+ p->msg[bytes] = ' ';
+ } else {
+ error("[FIFO] Error %i: %s", errno, strerror(errno));
+ strcpy(p->msg, "ERROR");
+ }
+}
+
+
+static void runFifo(RESULT * result)
+{
+ static int state = 1;
+ struct FifoData *p = &fd;
+ char *s;
+
+ switch (state) {
+ case 1:
+ /* Called for the first time. Set up everything. */
+ state = startFifo(p);
+ s = "";
+ break;
+
+ case 0:
+ /* Init went fine. Now run in normal operation mode. */
+ readFifo(p);
+ s = p->msg;
+ break;
+
+ default:
+ /* There was an error somewhere in init. Do nothing. */
+ s = "ERROR";
+ break;
+ }
+
+ /* Store the result */
+ SetResult(&result, R_STRING, s);
+}
+
+
+/* plugin initialization */
+int plugin_init_fifo(void)
+{
+ AddFunction("fifo::read", 0, runFifo);
+
+ return (0);
+}
+
+
+void plugin_exit_fifo(void)
+{
+ closeFifo(&fd);
+}
diff --git a/plugin_file.c b/plugin_file.c
new file mode 100644
index 0000000..7f39ec2
--- /dev/null
+++ b/plugin_file.c
@@ -0,0 +1,106 @@
+/* $Id: plugin_file.c 1183 2012-03-26 04:31:55Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/plugin_file.c $
+ *
+ * plugin to perform simple file operations
+ *
+ * Copyright (C) 2006 Chris Maj <cmaj@freedomcorpse.com>
+ * Copyright (C) 2006 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ * exported functions:
+ *
+ * int plugin_init_file (void)
+ * adds various functions
+ *
+ */
+
+
+/* define the include files you need */
+#include "config.h"
+
+#include <stdio.h>
+#include <string.h>
+
+/* these should always be included */
+#include "debug.h"
+#include "plugin.h"
+
+#ifdef WITH_DMALLOC
+#include <dmalloc.h>
+#endif
+
+
+/* function 'readline' */
+/* takes two arguments, file name and line number */
+/* returns text of that line */
+
+static void my_readline(RESULT * result, RESULT * arg1, RESULT * arg2)
+{
+ char value[80], val2[80];
+ FILE *fp;
+ int reqline, i, size;
+
+ reqline = R2N(arg2);
+ fp = fopen(R2S(arg1), "r");
+ if (!fp) {
+ info("readline couldn't open file '%s'", R2S(arg1));
+ value[0] = '\0';
+ } else {
+ i = 0;
+ while (!feof(fp) && i++ < reqline) {
+ fgets(val2, sizeof(val2), fp);
+ size = strcspn(val2, "\r\n");
+ strncpy(value, val2, size);
+ value[size] = '\0';
+ /* more than 80 chars, chew up rest of line */
+ while (!feof(fp) && strchr(val2, '\n') == NULL) {
+ fgets(val2, sizeof(val2), fp);
+ }
+ }
+ fclose(fp);
+ if (i <= reqline) {
+ info("readline requested line %d but file only had %d lines", reqline, i - 1);
+ value[0] = '\0';
+ }
+ }
+
+ /* store result */
+ SetResult(&result, R_STRING, &value);
+}
+
+/* plugin initialization */
+/* MUST NOT be declared 'static'! */
+int plugin_init_file(void)
+{
+
+ /* register all our cool functions */
+ /* the second parameter is the number of arguments */
+ /* -1 stands for variable argument list */
+ AddFunction("file::readline", 2, my_readline);
+
+ return 0;
+}
+
+void plugin_exit_file(void)
+{
+ /* free any allocated memory */
+ /* close filedescriptors */
+}
diff --git a/plugin_gps.c b/plugin_gps.c
new file mode 100644
index 0000000..e803c0c
--- /dev/null
+++ b/plugin_gps.c
@@ -0,0 +1,725 @@
+/* $Id: plugin_gps.c 1136 2010-11-28 16:07:16Z mzuther $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/plugin_gps.c $
+ *
+ * gps plugin (nmea), code by michu / www.neophob.com, based on nmeap, http://sourceforge.net/projects/nmeap/
+ *
+ * Copyright (C) 2007 Michu - http://www.neophob.com
+ * Copyright (C) 2004, 2005, 2006, 2007 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ * GPS Plugin for lcd4linux, by michael vogt / http://www.neophob.com
+ * contact: michu@neophob.com
+ *
+ * based on nmeap by daveh, http://www.dmh2000.com/ or http://sourceforge.net/projects/nmeap/
+ * you need a compiled libnmeap to compile this plugin.
+ *
+ * History:
+ * v0.1 -initial release
+ * v0.2 -fix include files, include <termios.h> and <asm/fcntl.h> (embedded devices)
+ * -fixed emulation mode (read only x bytes instead of the whole emulated nmea data)
+ * -improved error handling (if there are no parameters defined, lcd4linx will display "GPS ARG ERR")
+ * -display raw nmea string from the gps receiver
+ * -added support for gps device with 9600 baud (env. variable)
+ * -added the option that the widget graps data from the buffer and not from the gps device (usefull for multible widgets)
+ * v0.3 -improved nmea parsing
+ * -improved gps-emulator
+ * -time is now updated with rmc and gga sentence
+ *
+ * TODO:
+ * -update direction only when speed > 5 kmh
+ * -add more data fields
+ * -dump nmea string to external file
+ *
+ * Exported functions:
+ * int plugin_init_gps (void) - default plugin initialisation
+ * void parse(SHOW-OPTIONS, DISPLAY-OPTIONS)
+ * display option define, what the plugin should display
+ *
+ * OPTION: EXAMPLE:
+ * ------- --------
+ *
+ * PARAMETER 1:
+ * #define SHOW_ALTITUDE 0x000000001 alt:500
+ * #define SHOW_SPEED 0x000000010 spd:30
+ * #define SHOW_COURSE 0x000000100 dir:NO
+ * #define SHOW_SATELLITES 0x000001000 sat:4
+ * #define SHOW_QUALITY 0x000010000 qua:1
+ * #define SHOW_STATUS 0x000100000 sta:V
+ * #define SHOW_TIME_UTC 0x001000000 utc:113459
+ * #define SHOW_DATE 0x010000000 dat:190204 (19.02.2004)
+ *
+ * PARAMETER 2:
+ * #define OPTION_NO_PREFIX 0x000000001 disable prefix (example, instead of "alt:500" it displays "500"
+ * #define OPTION_SPEED_IN_KNOTS 0x000000010 when use the SHOW_SPEED option, display speed in knots instead in km/h
+ * #define OPTION_RAW_NMEA 0x000000100 outputs the parsed nmea string, only valid when EMULATE is not defined!
+ * #define OPTION_GET_BUFFERDATA 0x000001000 when you define more than 1 gps widget
+ * each widget will get updates and cause some ugly side effects, specially when you display the time
+ * by enabling this option, the widget will not read any nmea data from the serial port.
+ * KEEP IN MIND that there must be ONE widget which get buffered data (means read data from the port)
+ *
+ * #define SHOW_NMEA_STATUS 0x010000000 OK:0033/Error:0002/Incomplete:0002
+ *
+ *
+ * Examples:
+ * - gps::parse('0x011','0') will display the altitude and speed -> alt:500 spd:43
+ * - gps::parse('0x01100','0') will display the course and the numbers of satellites -> dir:NO sat:3
+ * - gps::parse('0x01','0x01') will display the speed without prefix -> 50
+ * - gps::parse('0x01','0x01') will display the speed in knots without prefix -> 27
+ *
+ * ENV VARIABLES
+ * To finetune plugin_gps you may define some env variables:
+ * GPS_PORT gps device, default value is /dev/usb/tts/1
+ * GPS_9600 serial port speed, default is 4800 baud, if you define this var speed will be 9600 (export GPS_9600=dummy)
+ */
+
+
+/* define the include files you need */
+#include "config.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <unistd.h>
+#include <termios.h> //used for serial port flags
+#include <asm/fcntl.h>
+
+
+/* these should always be included */
+#include "debug.h"
+#include "plugin.h"
+
+#ifdef WITH_DMALLOC
+#include <dmalloc.h>
+#endif
+
+#include "nmeap.h"
+
+//#define EMULATE //remove comment to enable gps data emulation...
+#define EMU_BUFFER_READ_SIZE 128 //how many bytes are read each loop aka emulation speed
+#define BUFFER_SIZE 256
+
+#define SHOW_ALTITUDE 0x000000001
+#define SHOW_SPEED 0x000000010
+#define SHOW_COURSE 0x000000100
+#define SHOW_SATELLITES 0x000001000
+#define SHOW_QUALITY 0x000010000
+#define SHOW_STATUS 0x000100000
+#define SHOW_TIME_UTC 0x001000000
+#define SHOW_DATE 0x010000000
+
+#define OPTION_NO_PREFIX 0x000000001
+#define OPTION_SPEED_IN_KNOTS 0x000000010
+#define OPTION_RAW_NMEA 0x000000100 //outputs the parsed nmea string, only valid when EMULATE is not defined!
+#define OPTION_GET_BUFFERDATA 0x000001000 //when you define more than 1 gps widget
+ //each widget will get updates and cause some ugly side effects, specially when you display the time
+ //by enabling this option, the widget will not read any nmea data from the serial port.
+ //KEEP IN MIND that there must be ONE widget which does not get buffered data (means read data from the port)
+#define OPTION_DEBUG 0x000010000
+#define SHOW_NMEA_STATUS 0x010000000
+
+static float course = 0.f; //degrees
+static float altitude = 0.f;
+static float speed = 0.f; //Speed over ground in KNOTS!!
+static int satellites = 0; //Number of satellites in use (00-12)
+static int quality = 0; //GPS quality indicator (0 - fix not valid, 1 - GPS fix, 2 - DGPS fix)
+static char gpsStatus = 'V'; //A=active or V=Void
+static unsigned long gpsTime = 0; //UTC of position fix in hhmmss format
+static unsigned long gpsDate = 0; //Date in ddmmyy format
+
+static int msgCounter = 0; //parsed nmea-sentence
+static int errCounter = 0; //parsed error nmea-sentence
+static int incomplCounter = 0; //incomplete parsed nmea-sentence
+/* ---------------------------------------------------------------------------------------*/
+/* STEP 1 : allocate the data structures. be careful if you put them on the stack because */
+/* they need to be live for the duration of the parser */
+/* ---------------------------------------------------------------------------------------*/
+static nmeap_context_t nmea; /* parser context */
+static nmeap_gga_t gga; /* this is where the data from GGA messages will show up */
+static nmeap_rmc_t rmc; /* this is where the data from RMC messages will show up */
+static int user_data; /* user can pass in anything. typically it will be a pointer to some user data */
+
+static int fd_g; /* port handler */
+static unsigned int emu_read_ofs = 0;
+static int debug = 0; //debug flag
+
+static char Name[] = "plugin_gps.c";
+
+static int fndStr = 0; //how many bytes were saved from the last read
+static char backBuffer[BUFFER_SIZE]; //the buffer to save incomplete nmea strings
+
+
+#ifdef EMULATE
+char test_vector[] = {
+/* "$GPGGA,123519,3929.946667,N,11946.086667,E,1,08,0.9,545.4,M,46.9,M,,*4A\r\n" // good
+ "$xyz,1234,asdfadfasdfasdfljsadfkjasdfk\r\n" // junk
+ "$GPRMC,225446,A,4916.45,N,12311.12,W,000.5,054.7,191194,020.3,E*68\r\n" // good
+ "$GPRMC,225446,A,4916.45,N,12311.12,W,000.5,054.7,191194,020.3,E*48\r\n" // checksum error
+ "$GPRMC,165110.000,A,5601.0318,N,01211.3503,E,0.09,28.11,190706,,*35\r\n" //some more data
+ "$GPGGA,165111.000,5601.0318,N,01211.3503,E,1,07,1.2,22.3,M,41.6,M,,0000*65\r\n"
+ "$GPRMC,165111.000,A,5601.0318,N,01211.3503,E,0.08,43.53,190706,,*3E\r\n"
+ "$GPGGA,165112.000,5601.0318,N,01211.3503,E,1,07,1.2,22.3,M,41.6,M,,0000*66\r\n"
+ "$GPRMC,165112.000,A,5601.0318,N,01211.3503,E,0.08,37.38,190706,,*33\r\n"
+ "$GPGGA,165113.000,5601.0318,N,01211.3503,E,1,07,1.2,22.4,M,41.6,M,,0000*60\r\n"
+ "$GPRMC,165113.000,A,5601.0318,N,01211.3503,E,0.11,21.03,190706,,*35\r\n"
+ "$GPGGA,165114.000,5601.0318,N,01211.3504,E,1,07,1.2,22.6,M,41.6,M,,0000*62\r\n"
+ "$GPRMC,165114.000,A,5601.0318,N,01211.3504,E,0.08,45.67,190706,,*3D\r\n"
+ "$GPGGA,165115.000,5601.0318,N,01211.3504,E,1,07,1.2,22.7,M,41.6,M,,0000*62\r\n"
+ "$GPRMC,165115.000,A,5601.0318,N,01211.3504,E,0.10,59.41,190706,,*3C\r\n"
+ "$GPGGA,165116.000,5601.0318,N,01211.3504,E,1,07,1.2,22.8,M,41.6,M,,0000*6E\r\n"
+ "$GPRMC,165116.000,A,5601.0318,N,01211.3504,E,0.06,50.22,190706,,*34\r\n"
+ "$GPGGA,165117.000,5601.0318,N,01211.3505,E,1,07,1.2,22.9,M,41.6,M,,0000*6F\r\n"
+ "$GPRMC,165117.000,A,5601.0318,N,01211.3505,E,0.08,45.32,190706,,*3F\r\n"
+ "$GPGGA,165118.000,5601.0318,N,01211.3505,E,1,07,1.2,23.0,M,41.6,M,,0000*68\r\n"
+ "$GPRMC,165118.000,A,5601.0318,N,01211.3505,E,0.10,37.49,190706,,*30\r\n"*/
+ "$GPGGA,165119.000,5601.0318,N,01211.3504,E,1,06,1.2,23.0,M,41.6,M,,0000*69\r\n"
+ "$GPRMC,165119.000,A,5601.0318,N,01211.3504,E,0.08,27.23,190706,,*34\r\n"
+ "$GPGGA,165120.000,5601.0318,N,01211.3504,E,1,07,1.2,23.0,M,41.6,M,,0000*62\r\n"
+ "$GPRMC,165120.000,A,5601.0318,N,01211.3504,E,0.08,41.52,190706,,*38\r\n"
+ "$GPGGA,165121.000,5601.0319,N,01211.3505,E,1,07,1.2,23.1,M,41.6,M,,0000*62\r\n"
+ "$GPRMC,165121.000,A,5601.0319,N,01211.3505,E,0.09,57.19,190706,,*30\r\n"
+ "$GPGGA,165122.000,5601.0319,N,01211.3505,E,1,07,1.2,23.2,M,41.6,M,,0000*62\r\n"
+ "$GPRMC,165122.000,A,5601.0319,N,01211.3505,E,0.10,30.60,190706,,*34\r\n"
+ "$GPGGA,165123.000,5601.0319,N,01211.3505,E,1,07,1.2,23.3,M,41.6,M,,0000*62\r\n"
+ "$GPRMC,165123.000,A,5601.0319,N,01211.3505,E,0.07,45.49,190706,,*3A\r\n"
+ "$GPGGA,165124.000,5601.0319,N,01211.3505,E,1,07,1.2,23.4,M,41.6,M,,0000*62\r\n"
+ "$GPRMC,165124.000,A,5601.0319,N,01211.3505,E,0.09,34.85,190706,,*35\r\n"
+ "$GPGGA,165125.000,5601.0319,N,01211.3506,E,1,07,1.2,23.4,M,41.6,M,,0000*60\r\n"
+ "$GPRMC,165125.000,A,5601.0319,N,01211.3506,E,0.06,43.06,190706,,*33\r\n"
+ "$GPGGA,165126.000,5601.0319,N,01211.3506,E,1,07,1.2,23.4,M,41.6,M,,0000*63\r\n"
+ "$GPRMC,165126.000,A,5601.0319,N,01211.3506,E,0.10,37.63,190706,,*37\r\n"
+ "$GPGGA,165127.000,5601.0319,N,01211.3505,E,1,07,1.2,23.4,M,41.6,M,,0000*61\r\n"
+ "$GPRMC,165127.000,A,5601.0319,N,01211.3505,E,0.07,42.23,190706,,*35\r\n"
+ "$GPGGA,165128.000,5601.0319,N,01211.3505,E,1,07,1.2,23.4,M,41.6,M,,0000*6E\r\n"
+ "$GPRMC,165128.000,A,5601.0319,N,01211.3505,E,0.09,27.98,190706,,*37\r\n"
+ "$GPGGA,165129.000,5601.0319,N,01211.3505,E,1,07,1.2,23.3,M,41.6,M,,0000*68\r\n"
+ "$GPRMC,165129.000,A,5601.0319,N,01211.3505,E,0.08,51.89,190706,,*36\r\n"
+ "$GPGGA,165130.000,5601.0319,N,01211.3505,E,1,07,1.2,23.2,M,41.6,M,,0000*61\r\n"
+ "$GPRMC,094055.000,A,5409.998645,N,00859.370546,E,0.044,0.00,301206,,,A*55\r\n"
+ "$GPGGA,094056.000,5409.998657,N,00859.370528,E,1,12,0.82,-5.168,M,45.414,M,,*47\r\n"
+ "$GPRMC,094056.000,A,5409.998657,N,00859.370528,E,0.263,0.00,301206,,,A*5A\r\n"
+ "$GPGGA,094057.000,5409.998726,N,00859.370512,E,1,12,0.82,-5.171,M,45.414,M,,*40\r\n"
+ "$GPRMC,094057.000,A,5409.998726,N,00859.370512,E,0.311,0.00,301206,,,A*51\r\n"
+ "$GPGGA,094058.000,5409.998812,N,00859.370518,E,1,12,0.82,-5.172,M,45.414,M,,*4E\r\n"
+ "$GPRMC,094058.000,A,5409.998812,N,00859.370518,E,0.423,0.00,301206,,,A*5A\r\n"
+ "$GPGGA,094059.000,5409.998934,N,00859.370505,E,1,12,0.82,-5.177,M,45.414,M,,*43\r\n"
+ "$GPRMC,094059.000,A,5409.998934,N,00859.370505,E,0.576,0.00,301206,,,A*53\r\n"
+ "$GPGGA,094100.000,5409.999097,N,00859.370542,E,1,12,0.82,-5.177,M,45.414,M,,*4C\r\n"
+ "$GPRMC,094100.000,A,5409.999097,N,00859.370542,E,0.705,0.00,301206,,,A\r\n"
+ "$GPGGA,004037.851,0000.0000,N,00000.0000,E,0,00,50.0,0.0,M,0.0,M,0.0,0000*7A\r\n"
+ "$GPGGA,175218.255,4657.3391,N,00726.2666,E,1,04,9.0,568.6,M,48.0,M,0.0,0000*7B\r\n"
+ "$GPGSA,A,3,26,29,17,12,,,,,,,,,9.5,9.08\r\n"
+ "$GPRMC,175218.255,A,4657.3391,N,00726.2666,E,0.$GPGGA,175219.255,4657.3391,N,00726.2666,E,1,04,9.0,568.5,M,48.0,M,0.0,0000*79\r\n"
+ "$GPGSA,A,3,26,29,17,12,,,,,,,,,9.5,9.0,2.7*38\r\n"
+ "$7,,*06\r\n"
+ "$GPGGA,175220.255,4657.3392,N,00726.2667,E,1,04,9.0,568.4,M,48.0,M,0.0,0000*70\r\n"
+ "$GPGSA,A,3,26,29,17,12,,,,$GPGGA,175221.255,4657.3392,N,00726.2667,E,1,04,9.0,568.3,M,48.0,M,0.0,0000*76\r\n"
+ "$GPGSA,A,3,26,29,17,12,,,,,,,,,9.5,9.0,2.7*38\r\n"
+ "$GPRMC,175221.255,A,4657.3392,N,00726.2667,E,0.14,150.24,230507,,*0A\r\n"
+ "$GPGGA,175222.255,4657.3393,N,00726.2668,E,1,04,9.0,568,29,17,12,,,,,,,,,9.5,9.0,2.7*38\r\n"
+ "$GPGSV,2,1,08,26,71,153,45,29,60,14$GPGGA,175223.255,4657.3393,N,00726.2669,E,1,04,9.0,568.2,M,48.0,M,7.3393,N,00726.2669,E,0.11,141.32,230507,,*05\r\n"
+ "$GPGGA,175224.255,4657.3394,N,00726.2670,E,1,04,9.0,568.0,M,48.0,M,0.0,0000*70\r\n"
+ "$GPGSA,$GPGGA,175225.255,4657.3395,N,00726.2670,E,1,04,9.0,567.8,M,48.0,M,0.0,0000*77\r\n"
+ "$GPGSA,A,3,26,29,17,12,,,,,,,,,9.5,9.0,2.7*38\r\n"
+ "$GPRMC,175225.255,A,4657.3395,N,00726.2670,E,0.10,146.99,230507,,*0A\r\n"
+ "$GPGGA,175226.255,465567.5,M,48.0,M,0.0,0000*7B\r\n"
+ "$GPGSA,A,3,26,29,17,12$GPGGA,175227.255,4657.3397,N,00726.2671,E,1,04,9.0,567.1,M,48.0,M,0.0,0000*7F\r\n"
+ "$.7*38\r\n"
+ "$GPGSV,2,1,08,26,71,153,46,29,60,149,46,09,55,286,00,28,32,051$GPGGA,175228.254,4657.3399,N,00726.2672,E,1,04,9.0,566.8,M,48.0,M,0.0,0000*74\r\n"
+ "$GPGSA,A,3,26,29,17,12,,,,,,,,,9.72,E,0.12,146.43,230507,,*0D\r\n"
+ "$GPGGA,175229.254,4657.3400,N,00726.2673,E,1,04,9.0,566.4,M,48.0,M,0.0,0000*7F\r\n"
+ "$GPGSA,A,3,26,29,17,1$GPGGA,175230.254,4657.3401,N,00726.2675,E,1,04,9.0,566.0,M,48.0,M,0.0,0000*74\r\n"
+ "$GPGSA,A,3,26,29,17,12$GPGGA,175231.254,4657.3402,N,00726.2676,E,1,04,9.0,565.7,M,48.0,M,0.0,0000*71\r\n"
+ "$GPGSA,A,3,26,29,17,12,,,,,,,,,9.5,9.0,2.7*38\r\n"
+ "$GPRMC,175231.2$GPGGA,175232.254,4657.3404,N,00726.2677,E,1,04,9.,153,45,29,60,149,46,09,55,286,00,28,32,051,00*7F\r\n"
+ "$GPGSV,2,2,08,17,32,102,38,18,28,298,00,12,12,21$GPGGA,175233.254,4657.3405,N,00726.2678,E,1,04,9.0,565.1,M,48.0,M,0.0,0000*7C\r\n"
+ "$GPGSA,A,3,26,29,17,12,,,,,,,,,9.5,9.0,2.6*39\r\n"
+ "$,*09\r\n"
+ "$GPGGA,175234.254,4657.3406,N,00726.2679,E,1,04,9.0,564.9,M,48.0,M,0.0,0000*70\r\n"
+ "$GPGSA,A,3,26,29,17,12,,,,,,,,,9.5,9.0,2.6*39\r\n"
+ "$GPRMC,175234.254,A,4657.3$GPGGA,175235.254,4657.3408,N,00726.2680,E,1,04,9.00,M,0.0,0000*76\r\n"
+ "$GPGSA,A,3,26,$GPGGA,175236.254,439\r\n"
+ "$GPRMC,175236.254,A,4657.3409,N,00726.2681,E,0.14,142.56,230507,,*06\r\n"
+ "$GPGGA,175237.254,4657.3410,N,00726.2682,E,1,04,9.0,564.5,M,48.0,M,0.0,0000*7C\r\n"
+ "$GPGSA,A,3,26,29,17,12,,,,00,28,32,051,00*7F\r\n"
+ "$GPGSV,2,2,08,17,32,102,39,18,28,298,00,12,12,218,35,22,09,3$GPGGA,175238.254,4657.3411,N,00726.2682,E,1,04$GPGGA,175239.254,4657.3412,N,00726.2683,E,1,04,9.0,564.7,M,48.0,M,0.0,0000*73\r\n"
+ "$GPGSA,A,3,26,29,17,12,,,,,,,,,9.5,9.0,2.6*39\r\n"
+ "$GPRMC,175239.254,A,4657.3412,N$GPGGA,175240.254,4657.3412,N,00726.2684,E,1,04,9.0,564.8,M,48.0,M,0.0,0000*75\r\n"
+ "$GPGSA,A,3,26,29,17,12,,,,,,,,,9.5,9.0,2.6*39\r\n"
+ "$GPRMC,$GPGGA,175241.254,4657.3413,N,00726.2684,E,1,04,9.0,565.1,M,48.0,M,0.0,0000*7D\r\n"
+ ",,,,,,,,9.5,9.0,2.6*39\r\n"
+ "$GPRMC,175241.254,A,4657.3413,N,00726.2684,E,0.$GPGGA,175242.254,4657.3413,N,00726.2684,E,1,04,9.0,565.3,M,48.0,M,0.0,0000*7C\r\n"
+ "$GPGSA,A,3,26,29,179,60,149,46,09,55,286,00,28,32,051,00*7C\r\n"
+ "$GPGS$GPGGA,175243.254,4657.3414,N,00726.2685,E,1,04,9.0,565.7,M,48.0,M,0.0,0000*7F\r\n"
+ "$GPGSA,A,3$GPGGA,175244.253,4657.3414,N,00726.2685,E,1,04,9.0,566.0,M,48.0,M,0.0,0000*7B\r\n"
+ "$GPGSA,A,3,26,29,17,12,,,,,,,,,9.5,9.0,2.6*39\r\n"
+ "$GPGGA,175245.253,4657.3415,N,00726.2685,E,1,04,9.0,566.3,M,48.0,M,0.0,0000*78\r\n"
+ "$GPGSA,A,3,26,29,17,12,,,,,,,,,9.5,9.0,2.6*39\r\n"
+ "$GPRMC,175245.253,A,4657.3415,N,00726.2685,E,0.2$GPGGA,175246.253,4657.3415,N,00726.2686,E,1,04,9.0,566.5,M,48.0,M,0.0,0000*7E\r\n"
+ ",175246.253,A,4657.3415,N,00726.2686,E,0.13,145$GPGGA,175247.253,4657.3416,N,00726.2686,E,1,04,9.0,566.8,M,48.0,M,0.0,0000*71\r\n"
+ "$GPGSA,A,3,26,17,32,101,39*7D\r\n"
+ "$GPGSV,2,2,08,28,32,051,00,18,$GPGGA,175248.253,4657.3417,N,00726.2686,E,1,04,9.0,567.0,M,48.0,M,0.0,0000*76\r\n"
+ "$GPGSA,A,3,26,29$GPGGA,175249.253,4657.3417,N,00726.2686,E,1,04.3,M,48.0,M,0.0,0000*7$GPGGA,175250.253,4657.3418,N,00726.2686,E,1,04,9.0,567.4,M,48.0,M,0.0,0000*74\r\n"
+ ".5,9.0,2.6*39\r\n"
+ "$GPRMC,175250.253,A,4657.3$GPGGA,175251.253,4657.3418,N,00726.2687,E,1,04,9.0,567.5,M,48.0,M,0.0,0000*75\r\n"
+ "$GPGSA,A,3,26,29,17,12,,,,,,,,,9.5,9.0,2.6*39\r\n"
+ ".2687,E,0.14,146.26,230507,,*05\r\n"
+ "$GPGGA,175252.253,4657.,00,18,28,298,00,12,12,218,36,22,09,326,00*7E\r\n"
+ "$GPRMC,175252.253,A,4657.3419,N,04,9.0,567.9,M,48.0,M,0.0,0000*7A\r\n"
+ "$GPGSA,A,3,26,29,17,12,,,,,,,,,9.5,9.0,2.6*39\r\n"
+ "$GPRMC,175253.253,A,4657.$GPGGA,175254.253,4657.3420,N,00726.2687,E,1,0417,12,,,,,,,,,9.5,9.0,2.6*39\r\n"
+ "$GPRMC,175254.253,A,4657.3420,N,00726.26$GPGGA,175255.253,4657.3421,N,00726.2688,E,1,04,9.0,568.4,M,48.0,M,0.0,0000*7A\r\n"
+ "$GPGSA,A,,E,0.16,151.85,230507,,*09\r\n"
+};
+#endif
+
+
+/*************************************************************************/
+
+/*
+ * open the specified serial port for read/write
+ * @return port file descriptor or -1
+ */
+
+#ifndef EMULATE
+static int openPort(const char *tty, int baud)
+{
+ int status;
+ int fd;
+ struct termios newtio;
+
+ /* open the tty */
+ fd = open(tty, O_RDWR | O_NOCTTY);
+ if (fd < 0) {
+ error("openPort: error open");
+ return fd;
+ }
+
+ /* flush serial port */
+ status = tcflush(fd, TCIFLUSH);
+ if (status < 0) {
+ error("openPort: error tcflush");
+ close(fd);
+ return -1;
+ }
+
+ /* get current terminal state */
+ tcgetattr(fd, &newtio);
+
+ /* set to raw terminal type */
+ newtio.c_cflag = baud | CS8 | CLOCAL | CREAD;
+ newtio.c_iflag = IGNBRK | IGNPAR;
+ newtio.c_oflag = 0;
+
+ /* control parameters */
+ newtio.c_cc[VMIN] = 1; /* block for at least one charater */
+
+ /* set its new attrigutes */
+ status = tcsetattr(fd, TCSANOW, &newtio);
+ if (status < 0) {
+ //error("tcsetattr() failed: %s", strerror(errno));
+ error("tcsetattr() failed: __ERRNO removed due lazy coder");
+ close(fd);
+ fd = -1;
+ return fd;
+ }
+ return fd;
+}
+#endif
+
+/** called when a gpgga message is received and parsed */
+static void gpgga_callout( __attribute__ ((unused)) nmeap_context_t * context, void *data, __attribute__ ((unused))
+ void *user_data)
+{
+ nmeap_gga_t *gga = (nmeap_gga_t *) data;
+
+ altitude = gga->altitude;
+ satellites = gga->satellites;
+ quality = gga->quality;
+ gpsTime = gga->time;
+
+ if (debug == 1)
+ debug("gps:debug: get gga callout\n");
+
+}
+
+
+//search a buffer for a string (forwards)
+int strLastOcc(char *theBuffer, char searchChar, int size)
+{
+ int i, ret;
+
+ ret = -1;
+ for (i = size; i >= 0; i--) {
+ if (theBuffer[i] == searchChar) {
+ ret = i;
+ break;
+ }
+ }
+ return ret;
+}
+
+//search a buffer for a string (backwards)
+int strFirstOcc(char *theBuffer, char searchChar, int size)
+{
+ int i, ret;
+ ret = -1;
+ for (i = 0; i < size; i++) {
+ if (theBuffer[i] == searchChar) {
+ ret = i;
+ break;
+ }
+ }
+ return ret;
+}
+
+
+
+/** called when a gprmc message is received and parsed */
+static void gprmc_callout( __attribute__ ((unused)) nmeap_context_t * context, void *data, __attribute__ ((unused))
+ void *user_data)
+{
+ nmeap_rmc_t *rmc = (nmeap_rmc_t *) data;
+
+ speed = rmc->speed;
+ gpsStatus = rmc->warn;
+ gpsTime = rmc->time;
+ gpsDate = rmc->date;
+
+ if (debug == 1)
+ debug("gps:debug: get rmc callout\n");
+
+}
+
+
+static int prepare_gps_parser()
+{
+ int status;
+ char *port = "/dev/usb/tts/1";
+ char *test;
+ int speed = 0; // 0 = default 4800 baud, 1 is 9600 baud
+
+ if ((test = getenv("GPS_PORT"))) { /* define your port via env variable */
+ port = test;
+ }
+
+ if ((test = getenv("GPS_9600"))) { /* define your port via env variable */
+ speed = 1;
+ }
+
+ /* --------------------------------------- */
+ /* open the serial port device */
+ /* using default 4800 baud for most GPS */
+ /* --------------------------------------- */
+#ifndef EMULATE
+ if (speed == 0)
+ fd_g = openPort(port, B4800);
+ else
+ fd_g = openPort(port, B9600);
+
+ if (fd_g < 0) {
+ /* open failed */
+ error("GPS PLUGIN, Error: openPort %d", fd_g);
+ return fd_g;
+ }
+#endif
+
+ /* --------------------------------------- */
+ /*STEP 2 : initialize the nmea context */
+ /* --------------------------------------- */
+ status = nmeap_init(&nmea, (void *) &user_data);
+ if (status != 0) {
+ error("GPS PLUGIN, Error: nmeap_init %d", status);
+ exit(1);
+ }
+
+ /* --------------------------------------- */
+ /*STEP 3 : add standard GPGGA parser */
+ /* -------------------------------------- */
+ status = nmeap_addParser(&nmea, "GPGGA", nmeap_gpgga, gpgga_callout, &gga);
+ if (status != 0) {
+ error("GPS PLUGIN, Error: nmeap_add GPGGA parser, error:%d", status);
+ return -1;
+ }
+
+ /* --------------------------------------- */
+ /*STEP 4 : add standard GPRMC parser */
+ /* -------------------------------------- */
+ /* status = nmeap_addParser(&nmea,"GPRMC",nmeap_gprmc,gprmc_callout,&rmc); */
+ status = nmeap_addParser(&nmea, "GPRMC", nmeap_gprmc, gprmc_callout, &rmc);
+ if (status != 0) {
+ error("GPS PLUGIN, Error: nmeap_add GPRMC parser, error:%d", status);
+ return -1;
+ }
+
+ return fd_g;
+}
+
+
+
+static void parse(RESULT * result, RESULT * theOptions, RESULT * displayOptions)
+{
+ int rem;
+ int offset;
+ int status;
+ int len;
+
+ long options;
+ long dispOptions;
+
+ char buffer[BUFFER_SIZE];
+ char bufferTmp[BUFFER_SIZE];
+
+ int validStart, validEnd;
+
+ options = R2N(theOptions);
+ dispOptions = R2N(displayOptions);
+ //error("options: %x\n",options);
+
+ if (dispOptions & OPTION_DEBUG)
+ debug = 1;
+
+ if ((dispOptions & OPTION_GET_BUFFERDATA) == 0) {
+
+ /* ---------------------------------------- */
+ /* STEP 6 : get a buffer of input */
+ /* --------------------------------------- */
+
+ memset(buffer, 0, BUFFER_SIZE);
+ if (fndStr > BUFFER_SIZE)
+ fndStr = 0;
+ //copy unfinished nmea strings back
+ if (fndStr > 0) {
+ memcpy(buffer, backBuffer, fndStr);
+ }
+#ifdef EMULATE
+ memcpy(&buffer[fndStr], &test_vector[emu_read_ofs], BUFFER_SIZE - fndStr);
+
+ len = rem = EMU_BUFFER_READ_SIZE;
+ emu_read_ofs += EMU_BUFFER_READ_SIZE;
+ if (emu_read_ofs > (sizeof(test_vector) - BUFFER_SIZE)) {
+ emu_read_ofs = 0;
+ memset(buffer, 0, BUFFER_SIZE);
+ }
+#else
+
+ len = rem = read(fd_g, buffer, BUFFER_SIZE - fndStr);
+ if (len <= 0) {
+ error("GPS Plugin, Error read from port, try using the GPS_PORT env variable (export GPS_PORT=/dev/mydev)");
+ //break;
+ }
+ if (debug == 1)
+ debug("gps:debug: read %d bytes\n", len);
+
+#endif
+ if (dispOptions & OPTION_RAW_NMEA)
+ printf("\n__[%s]", buffer + '\0');
+
+ /* ---------------------------------------------- */
+ /* STEP 7 : process input until buffer is used up */
+ /* ---------------------------------------------- */
+ validStart = strFirstOcc(buffer, '$', len);
+ validEnd = strLastOcc(buffer, '\n', len);
+
+ if (validStart >= 0 && validEnd > 0 && validStart < validEnd) {
+ //valid string found
+ memcpy(bufferTmp, buffer, sizeof(buffer)); //save buffer
+ memset(backBuffer, 0, sizeof(backBuffer)); //clear backup buffer
+ memcpy(backBuffer, buffer + validEnd, len - validEnd); // save incomplete nmea string
+ memset(buffer, 0, sizeof(buffer)); //clean buffer
+ memcpy(buffer, bufferTmp + validStart, validEnd - validStart + 1); //copy valid name string
+ fndStr = len - validEnd + validStart; //save the size of the buffer
+ } else {
+ //no valid nmea string found
+ fndStr = 0;
+ memset(buffer, 0, sizeof(buffer));
+ memset(backBuffer, 0, sizeof(backBuffer));
+ }
+
+ offset = 0;
+ if (debug == 1)
+ debug("backBuffer: %s\n", backBuffer);
+
+ //the nmeap_parseBuffer function needs whole nmea strings, combined string will NOT work!
+ validStart = strFirstOcc(buffer, '$', len);
+ validEnd = strFirstOcc(buffer, '\n', len);
+ while (validStart >= 0 && validEnd > 0 && validStart < validEnd) {
+ memset(bufferTmp, 0, sizeof(bufferTmp)); //empty temp buffer
+ memcpy(bufferTmp, buffer + offset + validStart, validEnd - validStart + 1); //fill temp buffer
+
+ if (debug == 1)
+ debug("submit: %s\n", bufferTmp);
+
+ rem = len - offset;
+ status = nmeap_parseBuffer(&nmea, (const char *) &bufferTmp, &rem); //parse it
+ if (status == -1) {
+ errCounter++;
+ error("parser error occurred! (cnt: %i)\n", errCounter);
+ } else if (status == 0) {
+ incomplCounter++;
+ } else if (status > 0)
+ msgCounter++;
+
+ offset += validEnd - validStart + 1; //update offset
+ validStart = strFirstOcc(buffer + offset, '$', len - offset); //find next sentence
+ validEnd = strFirstOcc(buffer + offset, '\n', len - offset);
+ }
+
+
+/* while (rem > 0) {
+ status = nmeap_parseBuffer(&nmea, &buffer[offset], &rem);
+ debug("\nGPS::debug: remaining: %d bytes\n",rem);
+ offset += (len - rem);
+ }*/
+ } // end of OPTION get bufferdata
+
+
+ /* --------------------------------------- */
+ /* DISPLAY stuff comes here... */
+ /* --------------------------------------- */
+ char *value = " ";
+ char outputStr[80];
+ memset(outputStr, 0, 80);
+
+ if (options & SHOW_ALTITUDE) {
+ if (dispOptions & OPTION_NO_PREFIX)
+ sprintf(outputStr, "%s%.0f ", outputStr, altitude);
+ else
+ sprintf(outputStr, "%salt:%.0f ", outputStr, altitude);
+ }
+ if (options & SHOW_SPEED) {
+ float knotsConvert = 1.852f; //default speed display=km/h
+ if (dispOptions & OPTION_SPEED_IN_KNOTS)
+ knotsConvert = 1.0f; //use knots
+
+ if (dispOptions & OPTION_NO_PREFIX)
+ sprintf(outputStr, "%s%.0f ", outputStr, speed * knotsConvert);
+ else
+ sprintf(outputStr, "%sspd:%.0f ", outputStr, speed * knotsConvert);
+ }
+ if (options & SHOW_COURSE) {
+ char courses[8][3] = { "N ", "NO", "O ", "SO", "S ", "SW", "W ", "NW" };
+ float degrees[8] = { 22.5f, 67.5f, 112.5f, 157.5f, 202.5f, 247.5f, 292.5f, 337.5f };
+ int selectedDegree = 0;
+ int n;
+
+ for (n = 0; n < 8; n++) {
+ if (course < degrees[n]) {
+ selectedDegree = n;
+ break;
+ }
+ }
+ if (dispOptions & OPTION_NO_PREFIX)
+ sprintf(outputStr, "%s%s ", outputStr, courses[selectedDegree]);
+ else
+ sprintf(outputStr, "%sdir:%s ", outputStr, courses[selectedDegree]);
+ }
+ if (options & SHOW_SATELLITES) {
+ if (dispOptions & OPTION_NO_PREFIX)
+ sprintf(outputStr, "%s%d ", outputStr, satellites);
+ else
+ sprintf(outputStr, "%ssat:%d ", outputStr, satellites);
+ }
+ if (options & SHOW_QUALITY) {
+ if (dispOptions & OPTION_NO_PREFIX)
+ sprintf(outputStr, "%s%d ", outputStr, quality);
+ else
+ sprintf(outputStr, "%squa:%d ", outputStr, quality);
+ }
+ if (options & SHOW_STATUS) {
+ if (dispOptions & OPTION_NO_PREFIX)
+ sprintf(outputStr, "%s%c ", outputStr, gpsStatus);
+ else
+ sprintf(outputStr, "%ssta:%c ", outputStr, gpsStatus);
+ }
+ if (options & SHOW_TIME_UTC) {
+ char digitizer[9]; //01:34:67
+ sprintf(digitizer, "%.6ld", gpsTime); //<012345>
+ digitizer[7] = digitizer[5];
+ digitizer[6] = digitizer[4];
+ digitizer[4] = digitizer[3];
+ digitizer[3] = digitizer[2];
+ digitizer[2] = ':';
+ digitizer[5] = ':';
+ digitizer[8] = '\0';
+ if (dispOptions & OPTION_NO_PREFIX)
+ sprintf(outputStr, "%s%s ", outputStr, digitizer);
+ else
+ sprintf(outputStr, "%sutc:%s ", outputStr, digitizer);
+ }
+ if (options & SHOW_DATE) {
+ char digitizer[9]; //01:34:67
+ sprintf(digitizer, "%.6ld", gpsDate); //<012345>
+ digitizer[7] = digitizer[5];
+ digitizer[6] = digitizer[4];
+ digitizer[4] = digitizer[3];
+ digitizer[3] = digitizer[2];
+ digitizer[2] = '/';
+ digitizer[5] = '/';
+ digitizer[8] = '\0';
+ if (dispOptions & OPTION_NO_PREFIX)
+ sprintf(outputStr, "%s%s ", outputStr, digitizer);
+ else
+ sprintf(outputStr, "%sdat:%s ", outputStr, digitizer);
+ }
+
+
+ if (dispOptions & SHOW_NMEA_STATUS) {
+ if (dispOptions & OPTION_NO_PREFIX)
+ sprintf(outputStr, "%s%04d/%04d/%04d ", outputStr, msgCounter, errCounter, incomplCounter);
+ else
+ sprintf(outputStr, "%sOK:%03d/Er:%03d/In:%03d ", outputStr, msgCounter, errCounter, incomplCounter);
+ }
+
+ if (options == 0 && dispOptions == 0) { //error, no parameter defined!
+ error("gps::parse() ERROR, no parameter specified!");
+ value = strdup("GPS ARG ERR");
+ } else {
+ value = strdup(outputStr);
+ }
+
+ SetResult(&result, R_STRING, value);
+ free(value);
+}
+
+
+/* plugin initialization */
+/* MUST NOT be declared 'static'! */
+int plugin_init_gps(void)
+{
+ info("%s: v%s", Name, "0.2");
+ prepare_gps_parser();
+
+ /* register all our cool functions */
+ /* the second parameter is the number of arguments */
+ /* -1 stands for variable argument list */
+ AddFunction("gps::parse", 2, parse);
+
+ return 0;
+}
+
+void plugin_exit_gps(void)
+{
+ info("%s: shutting down plugin.", Name);
+#ifndef EMULATE
+ close(fd_g);
+#endif
+}
diff --git a/plugin_hddtemp.c b/plugin_hddtemp.c
new file mode 100644
index 0000000..6d3d8a1
--- /dev/null
+++ b/plugin_hddtemp.c
@@ -0,0 +1,282 @@
+/* $Id: plugin_hddtemp.c 950 2009-01-08 14:59:24Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/plugin_hddtemp.c $
+ *
+ * plugin hddtemp
+ *
+ * Copyright (C) 2007 Scott Bronson <brons_lcd4linux@rinspin.com>
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/* Example:
+ * (I tried to put this info on the wiki but Akismet claimed it was spam)
+
+ Widget SmallHDDTemp {
+ class 'Text'
+ expression hddtemp('/dev/hda')
+ width 4
+ precision 1
+ align 'R'
+ update tick
+ }
+
+ hddtemp home page: http://www.guzu.net/linux/hddtemp.php
+
+ Quick Examples:
+ * hddtemp() -- return temperature of first drive (order is defined by the hddtemp daemon).
+ * hddtemp('/dev/hda') -- return temperature of /dev/hda on localhost.
+ * hddtemp('ST3400832A') -- return temperature of the drive with the given ID.
+ * hddtemp('burly', '') -- return temperature of the first drive on host burly.
+ * hddtemp('burly', 17634, '/dev/hda') -- return temperature of /dev/hda on burly connecting to the hddtemp daemon listening on port 17634.
+
+You can find out what drives are being monitored by running
+ telnet HOST PORT
+
+i.e.
+
+ $ telnet localhost 7634
+ Trying 127.0.0.1...
+ Connected to localhost.
+ Escape character is '^]'.
+ |/dev/hda|ST3400832A|53|C|Connection closed by foreign host.
+
+This tells me that /dev/hda is a Seagate ST3400832A running at an awfully
+toasty 53 degC.
+
+ */
+
+
+/*
+ * exported functions:
+ *
+ * int plugin_init_hddtemp (void)
+ * adds various functions
+ * void plugin_exit_hddtemp (void)
+ *
+ */
+
+#include "config.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+
+/* network specific includes */
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <netdb.h>
+#include <arpa/inet.h>
+
+/* these should always be included */
+#include "debug.h"
+#include "plugin.h"
+
+
+
+static int socket_open(const char *name, int port)
+{
+ struct sockaddr_in server;
+ struct hostent *host_info;
+ unsigned long addr;
+ int sock;
+
+ sock = socket(PF_INET, SOCK_STREAM, 0);
+ if (sock < 0) {
+ error("[hddtemp] failed to create socket: %s", strerror(errno));
+ return -1;
+ }
+
+ memset(&server, 0, sizeof(server));
+ if ((addr = inet_addr(name)) != INADDR_NONE) {
+ memcpy((char *) &server.sin_addr, &addr, sizeof(addr));
+ } else {
+ host_info = gethostbyname(name);
+ if (NULL == host_info) {
+ error("[hddtemp] Unknown server: %s", name);
+ return -1;
+ }
+ memcpy((char *) &server.sin_addr, host_info->h_addr, host_info->h_length);
+ }
+
+ server.sin_family = AF_INET;
+ server.sin_port = htons(port);
+
+ if (connect(sock, (struct sockaddr *) &server, sizeof(server)) < 0) {
+ error("[hddtemp] can't connect to server %s: %s", name, strerror(errno));
+ return -1;
+ }
+
+ return sock;
+}
+
+
+static size_t hddtemp_read(int socket, char *buffer, size_t size)
+{
+ size_t count = 0;
+ ssize_t len;
+
+ while (count < size) {
+ len = read(socket, buffer + count, size - count);
+ if (len > 0) {
+ count += len;
+ } else if (len < 0) {
+ error("[hddtemp] couldn't read from socket: %s", strerror(errno));
+ return -1;
+ } else {
+ break; /* remote socket has closed */
+ }
+ }
+
+ // null-terminate the string
+ if (count < size) {
+ buffer[count] = '\0';
+ } else {
+ buffer[size - 1] = '\0';
+ }
+
+ return count;
+}
+
+
+static int hddtemp_connect(const char *host, int port, char *buffer, size_t size)
+{
+ int socket, ret;
+
+ socket = socket_open(host, port);
+ if (socket < 0) {
+ error("[hddtemp] Error accessing %s:%d: %s", host, port, strerror(errno));
+ return -1;
+ }
+
+ ret = hddtemp_read(socket, buffer, size);
+ close(socket);
+
+ return ret;
+}
+
+
+/* split a value into columns and return the nth column */
+/* WARNING: does return a pointer to a static string!! */
+static char *split(const char *value, const int column)
+{
+ static char buffer[256];
+ const char *p, *q, *v;
+ size_t l;
+ int c;
+
+ c = 0;
+ p = value;
+ q = NULL;
+ for (v = value; v && *v; v++) {
+ if (*v == '|') {
+ if (c == column) {
+ q = v;
+ break;
+ } else {
+ p = v + 1;
+ }
+ c++;
+ }
+ }
+
+ if (c < column)
+ return NULL;
+
+ l = q ? (size_t) (q - p) : strlen(p);
+ if (l >= sizeof(buffer))
+ l = sizeof(buffer) - 1;
+ strncpy(buffer, p, l);
+
+ buffer[l] = '\0';
+ return buffer;
+}
+
+static char *hddtemp_fetch(const char *host, int port, const char *device)
+{
+ char buffer[4096];
+ char *key;
+ int i;
+
+ /* fetch a buffer of all hddtemps */
+ if (!hddtemp_connect(host, port, buffer, sizeof(buffer))) {
+ return "err";
+ }
+
+ i = 1;
+ while (1) {
+ key = split(buffer, i);
+ if (key == NULL)
+ break;
+ if (strcmp(device, key) == 0) {
+ return split(buffer, i + 2);
+ }
+ i += 5;
+ }
+
+ return "n/a";
+}
+
+
+static void my_hddtemp(RESULT * result, int argc, RESULT * argv[])
+{
+ char *device = "";
+ int port = 7634;
+ char *host = "localhost";
+ char *value;
+
+ switch (argc) {
+ case 0:
+ break;
+ case 1:
+ device = R2S(argv[0]);
+ break;
+ case 2:
+ host = R2S(argv[0]);
+ device = R2S(argv[1]);
+ break;
+ case 3:
+ host = R2S(argv[0]);
+ port = (int) R2N(argv[1]);
+ device = R2S(argv[2]);
+ break;
+ default:
+ error("hddtemp(): too many parameters");
+ SetResult(&result, R_STRING, "");
+ return;
+ }
+
+ value = hddtemp_fetch(host, port, device);
+ SetResult(&result, R_STRING, value);
+}
+
+
+int plugin_init_hddtemp(void)
+{
+ AddFunction("hddtemp", -1, my_hddtemp);
+
+ return 0;
+}
+
+
+void plugin_exit_hddtemp(void)
+{
+}
diff --git a/plugin_huawei.c b/plugin_huawei.c
new file mode 100644
index 0000000..0f815f4
--- /dev/null
+++ b/plugin_huawei.c
@@ -0,0 +1,1162 @@
+/* $Id: plugin_huawei.c 870 2008-04-10 14:55:23Z michux $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/plugin_huawei.c $
+ *
+ * plugin plugin_huawei. Copyright (C) 2010 Jar <jar@pcuf.fi>
+ *
+ * Huawei E220 3G modem statistics via /dev/ttyUSB* user interface. It may (or may not) work well
+ * with other Huawei 3G USB modems too (which uses PPP interface between modem and computer), like
+ * E160, E169, E226, E272, E230 etc. Since they all seem to use same kind of set AT commands and
+ * responses. Tested with Huawei E220, E160E and Vodafone Huawei K3565.
+ *
+ * Thanks to Mikko <vmj@linuxbox.fi> for contributing the scan_uint() function and some other code.
+ *
+ * Based on sample plugin which is
+ * Copyright (C) 2003 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+
+/* define the include files you need */
+#include "config.h"
+
+#include <stdio.h> /* standard buffered input/output */
+#include <stdlib.h> /* standard library definitions */
+#include <stdarg.h> /* for va_start et al */
+#include <string.h> /* string operations */
+#include <unistd.h> /* read(), close() */
+#include <fcntl.h> /* open() */
+#include <termios.h> /* tcflush() */
+#include <sys/types.h> /* data types */
+#include <sys/stat.h> /* stat structure */
+#include <sys/time.h> /* timeval structure */
+#include <errno.h> /* system error numbers */
+
+
+/* these should always be included */
+#include "debug.h"
+#include "plugin.h"
+
+
+#ifdef WITH_DMALLOC
+#include <dmalloc.h>
+#endif
+
+
+#define PORT "/dev/ttyUSB1" /* default port */
+#define BAUDRATE B38400 /* default baudrate */
+#define SEND_BUFFER_SIZE 128 /* send buffer size */
+#define RECV_BUFFER_SIZE 256 /* receive buffer size */
+#define MIN_INTERVAL 100 /* minimum query interval 100 ms */
+
+
+#define INIT_STRING "ATE1 ^CURC=0;^DSFLOWCLR" /* disable unsolicited report codes and reset DS traffic
+ * with local echo enabled
+ */
+#define QUALITY "ATE1 +CSQ" /* signal quality query with local echo enabled */
+#define SYSINFO "ATE1 ^SYSINFO" /* network access query with local echo enabled */
+#define MANUF "ATE1 +GMI" /* manufacturer query with local echo enabled */
+#define MODEL "ATE1 +GMM" /* model query with local echo enabled */
+#define FWVER "ATE1 +CGMR" /* firmware version query with local echo enabled */
+#define FLOWREPORT "ATE1 ^DSFLOWQRY" /* DS traffic query with local echo enabled */
+#define OPERATOR "ATE1 +COPS=3,0;+COPS?" /* gsm/umts operator query (3=set format only, 0=long alphanum. string)
+ * with local echo enabled
+ */
+
+static char name[] = "plugin_huawei.c";
+
+static char *sub_system_mode[] = {
+ "NO CONN", /* no service */
+ "GSM", /* 2G/GSM */
+ "GPRS", /* 2.5G/GPRS */
+ "EDGE", /* 2.75G/EDGE */
+ "WCDMA", /* 3G/UMTS */
+ "HSDPA", /* 3.5G/UMTS */
+ "HSUPA", /* 3.5G/UMTS */
+ "HSPA", /* HSDPA+HSUPA */
+ "UNKNOWN"
+};
+
+static int fd = -2; /* serial fd */
+static char *port = NULL; /* serial device */
+
+/* signal strength query */
+static unsigned int rssi = 0; /* relative rssi 0...31 */
+static unsigned int ber = 0; /* ber (bit error rate, not supported) */
+
+/* manufacturer query */
+static char manuf[32] = ""; /* manufacturer */
+
+/* model query */
+static char model[32] = ""; /* model */
+
+/* fw version query */
+static char fwver[32] = ""; /* firmware version */
+
+/* gsm/umts operator query */
+static char operator[64] = ""; /* current gsm/umts network operator */
+
+/* DS traffic report query */
+static unsigned long int last_ds_time = 0; /* last DS connection time [s] */
+static unsigned long long int last_tx_flow = 0; /* last DS transmiting trafic [Bytes] */
+static unsigned long long int last_rx_flow = 0; /* last DS receiving trafic [Bytes] */
+static unsigned long int total_ds_time = 0; /* total DS connection time [s] */
+static unsigned long long int total_tx_flow = 0; /* total transmitting DS traffic [Bytes] */
+static unsigned long long int total_rx_flow = 0; /* total receiving DS traffic [Bytes] */
+
+static double calc_tx_rate = 0; /* calculated tx rate */
+static double calc_rx_rate = 0; /* calculated rx rate */
+
+/* system information query */
+static unsigned int status = 0; /* system service state */
+static unsigned int domain = 0; /* system service domain */
+static unsigned int roaming_status = 0; /* roaming status */
+static unsigned int mode = 0; /* system mode */
+static unsigned int sim_state = 0; /* SIM card state */
+static unsigned int reserved = 0; /* reserved, E618 used it to indicate the simlock state */
+static unsigned int sub_mode = 0; /* system sub mode */
+
+static int debug = 0; /* enable debug messages */
+
+
+static int age_diff(struct timeval prev_age)
+{
+ int diff;
+ struct timeval now;
+
+ gettimeofday(&now, NULL);
+ diff = (now.tv_sec - prev_age.tv_sec) * 1000 + (now.tv_usec - prev_age.tv_usec) / 1000;
+
+ return diff;
+}
+
+static int scan_uint(const char *str, unsigned int nargs, ...)
+{
+ unsigned int wall = 0;
+ unsigned int i = 0; /* number of parsed numbers */
+ unsigned int *a = NULL; /* pointer to currently parsed number (type
+ must be that of the actual arguments) */
+
+ /* initialize the argument list */
+ va_list argv;
+ va_start(argv, nargs);
+
+ if (nargs > 0) {
+ /* initialize to first argument */
+ a = va_arg(argv, unsigned int *);
+ /* initialize it to zero */
+ *a = 0;
+ }
+
+ /* loop through the argument list and the string */
+ while (str && *str && wall < 1024) {
+ switch (*str) {
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ case '0':
+ /* intent: multiply current value of 'a' with 10 and add
+ numeric value of character str) */
+ if (i < nargs) {
+ *a = ((*a) * 10) + ((*str) - '0');
+ }
+ break;
+
+ case ',':
+ if (++i < nargs) {
+ /* proceed to next argument */
+ a = va_arg(argv, unsigned int *);
+ /* initialize it to zero */
+ *a = 0;
+ } else {
+ /* this was the last number to parse */
+ /* (comma indicates that there are more) */
+ }
+ break;
+
+ default:
+ /* ignore any unknown characters */
+ break;
+ }
+
+ /* proceed to next character */
+ str++;
+ wall++;
+ }
+
+ /* fill any extraneous arguments with zero */
+ if (str && !(*str) && i < nargs - 1) {
+ unsigned int j = i;
+ for (j++; j < nargs; j++) {
+ a = va_arg(argv, unsigned int *);
+ *a = 0;
+ }
+ }
+
+ /* finalize the argument list */
+ va_end(argv);
+
+ /* return the number of parsed numbers */
+ return (int) (i > 0) ? i + 1 : i;
+}
+
+static int huawei_port_exists(const char *device)
+{
+ int ret;
+ struct stat stat_ptr;
+
+ /* check the device is present */
+ ret = stat(device, &stat_ptr);
+ if (ret < 0)
+ return 0;
+
+ /* check the device is character device */
+ return (S_ISCHR(stat_ptr.st_mode));
+}
+
+static void huawei_read_port(void)
+{
+ char *test;
+
+ /* port can be defined via env variable */
+ if ((test = getenv("HUAWEI_PORT"))) {
+ if (port != test) {
+ port = test;
+ info("%s: Using HUAWEI_PORT=%s from env variable for user interface device", name, port);
+ }
+ } else
+ port = PORT;
+
+ return;
+}
+
+static int huawei_configure_port(void)
+{
+ int ret;
+ struct termios options;
+
+ /* open port */
+ fd = open(port, O_RDWR | O_NOCTTY | O_NDELAY);
+ if (fd < 0) {
+ error("%s: ERROR: Problem opening %s. Try using the HUAWEI_PORT env variable (export HUAWEI_PORT=/dev/ttyUSB*)",
+ name, port);
+ return -1;
+ }
+
+ /* enable blocking behavior with timeout */
+ ret = fcntl(fd, F_SETFL, 0);
+ if (ret < 0) {
+ error("%s: ERROR: Problem setting file descriptor status flags %i", name, fd);
+ close(fd);
+ fd = -2;
+ return -1;
+ }
+
+ /* get the current options */
+ ret = tcgetattr(fd, &options);
+ if (ret < 0) {
+ error("%s: ERROR: Problem getting terminal attributes %s", name, port);
+ close(fd);
+ fd = -2;
+ return -1;
+ }
+
+ /* set raw input */
+ options.c_cflag |= (CS8 | CLOCAL | CREAD);
+ options.c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG);
+ options.c_iflag &= ~(IGNBRK | BRKINT | IGNPAR | IGNCR | INLCR | ICRNL |
+ IUCLC | IXANY | IXON | IXOFF | INPCK | ISTRIP);
+ options.c_oflag = 0; /* raw output */
+ options.c_cc[VMIN] = 0;
+ options.c_cc[VTIME] = 1; /* 0.1 second timeout */
+
+ /* set the input baud rate to BAUDRATE */
+ ret = cfsetispeed(&options, BAUDRATE);
+ if (ret < 0) {
+ error("%s: ERROR: Problem setting input baud rate %s", name, port);
+ close(fd);
+ fd = -2;
+ return -1;
+ }
+
+ /* set the output baud rate to BAUDRATE */
+ ret = cfsetospeed(&options, BAUDRATE);
+ if (ret < 0) {
+ error("%s: ERROR: Problem setting output baud rate %s", name, port);
+ close(fd);
+ fd = -2;
+ return -1;
+ }
+
+ /* set the options */
+ ret = tcsetattr(fd, TCSANOW, &options);
+ if (ret < 0) {
+ error("%s: ERROR: Problem setting terminal attributes %s", name, port);
+ close(fd);
+ fd = -2;
+ return -1;
+ }
+
+ /* flush input and output buffers */
+ ret = tcflush(fd, TCIFLUSH);
+ if (ret < 0) {
+ error("%s: ERROR: Problem flushing input and output buffers %s", name, port);
+ close(fd);
+ fd = -2;
+ return -1;
+ }
+
+ return fd;
+}
+
+static int huawei_send(const char *cmd)
+{
+ int len, bytes;
+ char buf[SEND_BUFFER_SIZE];
+
+ sprintf(buf, "%s\r", cmd);
+ len = strlen(buf);
+
+ /* write */
+ bytes = write(fd, buf, len);
+
+ /* force null termination */
+ if (bytes > 0)
+ buf[bytes] = '\0';
+ else
+ buf[0] = '\0';
+
+ if (bytes < 0 && errno != EAGAIN) {
+ error("%s: ERROR: Writing to device %s failed: %s", name, port, strerror(errno));
+ return -1;
+ } else if (bytes != len) {
+ error("%s: ERROR: Partial write when writing to device %s", name, port);
+ return -1;
+ }
+
+ /* remove trailing CR */
+ while (bytes > 0 && buf[bytes - 1] == '\r') {
+ buf[--bytes] = '\0';
+ }
+
+ if (debug)
+ debug("DEBUG: <-Send bytes=%i, send buf=%s", bytes, buf);
+
+ return bytes;
+}
+
+static char *huawei_receive(void)
+{
+ int run, count, bytes;
+ char c[1], *p;
+ static char buf[RECV_BUFFER_SIZE];
+
+ /* skip the plain NL's and CR's (<CR><LF><CR><LF> makes max. 4 pcs. of them) and re-read */
+ for (run = 0; run < 4; run++) {
+
+ /* pointer to the current position in the buffer */
+ p = buf;
+
+ /* set count to buffer size */
+ count = RECV_BUFFER_SIZE;
+
+ /* Read until a NL or a CR is encountered. If 'buf' fills up before newline is seen,
+ * exit the loop when there's still room for zero termination (count == 1).
+ */
+ while (count > 1) {
+ bytes = read(fd, c, 1);
+
+ if (*c == '\n' || *c == '\r' || (bytes < 0 && errno != EAGAIN))
+ break;
+
+ *p = *c;
+ p++;
+ count--;
+ }
+
+ /* force null termination */
+ *p = '\0';
+
+ /* now we have data (when buf len > 0), exit from for-loop and return the data to caller */
+ if (strlen(buf) > 0 || (bytes < 0 && errno != EAGAIN))
+ break;
+ }
+
+ if (bytes < 0 && errno != EAGAIN) {
+ error("%s: ERROR: Reading from device %s failed: %s", name, port, strerror(errno));
+ return ("");
+ }
+
+ /* print bytes read and buffer data when debuging enabled */
+ if (debug)
+ debug("DEBUG: ->Received bytes=%i, receive buf=%s", (int) strlen(buf), buf);
+
+ return (buf);
+}
+
+static int huawei_recv_error(const char *msg)
+{
+ if (strstr(msg, "ERROR") != NULL || strncmp(msg, "NO CARRIER", 10) == 0 ||
+ strncmp(msg, "COMMAND NOT SUPPORT", 19) == 0 || strncmp(msg, "TOO MANY PARAMETERS", 19) == 0)
+ return 1;
+
+ return 0;
+}
+
+static char *huawei_send_receive(const char *cmd)
+{
+ int run, bytes_send, recv_seq;
+ char *tmp;
+ static char reply[RECV_BUFFER_SIZE];
+
+ /* send command to modem */
+ bytes_send = huawei_send(cmd);
+
+ /* start with an empty reply */
+ strcpy(reply, "");
+
+ if (bytes_send > 0) {
+
+ recv_seq = 0;
+
+ /* receive modem responses (currently handle only 3 lines of responses:
+ * request->reply->ok|error)
+ */
+ for (run = 0; run < 3; run++) {
+
+ tmp = huawei_receive();
+
+ /* init cmd */
+ if (strncmp(cmd, INIT_STRING, strlen(INIT_STRING)) == 0) {
+
+ /* waiting local echo back after the init string has been sent */
+ if (recv_seq == 0 && strncmp(tmp, INIT_STRING, strlen(INIT_STRING)) == 0) {
+ recv_seq = 1;
+ }
+
+ /* waiting "OK" after local echo has been received */
+ else if (recv_seq == 1 && strncmp(tmp, "OK", 2) == 0) {
+ strncpy(reply, tmp, sizeof(reply) - 1);
+ break;
+ }
+
+ /* waiting possible "ERROR" after local echo has been received */
+ else if (recv_seq == 1 && huawei_recv_error(tmp) == 1) {
+ strncpy(reply, tmp, sizeof(reply) - 1);
+ break;
+ }
+
+ /* data query cmd */
+ } else {
+
+ /* waiting local echo back after the cmd has been sent */
+ if (recv_seq == 0 && strncmp(tmp, cmd, strlen(cmd)) == 0) {
+ recv_seq = 1;
+ }
+
+ /* waiting data (but not "OK" or "ERROR") after local echo has been received */
+ else if (recv_seq == 1 && strlen(tmp) > 0 && huawei_recv_error(tmp) == 0) {
+ recv_seq = 2;
+ strncpy(reply, tmp, sizeof(reply) - 1);
+ }
+
+ /* waiting "OK" after data has been received */
+ else if (recv_seq == 2 && strncmp(tmp, "OK", 2) == 0) {
+ break;
+ }
+
+ /* waiting possible "ERROR" after local echo has been received */
+ else if (recv_seq == 1 && huawei_recv_error(tmp) == 1) {
+ strncpy(reply, tmp, sizeof(reply) - 1);
+ break;
+ }
+ }
+ }
+ }
+
+ return (reply);
+}
+
+static int huawei_configured(void)
+{
+ int port_exists, ret;
+ static int connected = -1, configured = 0;
+ char *buf;
+
+ /* re-read port because device name may change during plugin execution */
+ huawei_read_port();
+
+ /* check the device exists before reading on it */
+ port_exists = huawei_port_exists(port);
+
+ /* modem removed event */
+ if (port_exists < 1 && (connected == -1 || connected == 1)) {
+ info("%s: Modem doesn't exists or has been removed, device %s is to be closed", name, port);
+ if (fd > 0) {
+ ret = close(fd);
+ if (ret < 0) {
+ error("%s: ERROR: Error when closing device %s after modem removal, ret=%i", name, port, ret);
+ }
+ fd = -2;
+ }
+ connected = 0;
+ }
+
+ /* modem inserted event */
+ if (port_exists > 0 && (connected == -1 || connected == 0)) {
+ info("%s: Modem has been inserted, device %s will be opened", name, port);
+ if (fd < 0) {
+ ret = huawei_configure_port();
+ if (ret > 0) {
+ connected = 1;
+ if (debug)
+ debug("DEBUG: Device %s configured successfully, fd=%i", port, ret);
+ } else {
+ error("%s: ERROR: Device %s configuring failure->retrying..., ret=%i", name, port, ret);
+ }
+ }
+ }
+
+ /* init variables to zero (except tx/rx total flows) when device disconnected */
+ if (connected == 0) {
+ rssi = 0;
+ sub_mode = 0;
+ last_ds_time = 0;
+ total_ds_time = 0;
+ last_tx_flow = 0;
+ last_rx_flow = 0;
+ calc_tx_rate = 0;
+ calc_rx_rate = 0;
+ strcpy(manuf, "");
+ strcpy(model, "");
+ strcpy(fwver, "");
+ strcpy(operator, "");
+ configured = 0;
+ }
+
+ /* modem initialization */
+ if (connected == 1 && configured != 1) {
+ buf = huawei_send_receive(INIT_STRING);
+
+ if (strncmp(buf, "OK", 2) == 0) {
+ configured = 1;
+ info("%s: Modem user inerface successfully initialized to: \'%s\'", name, INIT_STRING);
+ } else {
+ configured = 0;
+ error("%s: ERROR: Invalid or empty response: \'%s\' received for: \'%s\'", name, buf, INIT_STRING);
+ }
+ }
+
+ return configured;
+}
+
+static void huawei_read_quality(const char *cmd)
+{
+ char *buf;
+
+ buf = huawei_send_receive(cmd);
+
+ if (strncmp(buf, "+CSQ: ", 6) == 0) {
+
+ /* Returns relative signal strength (RSSI) and ber (not supported by modems).
+ *
+ * +CSQ: 14,99
+ * rssi,ber
+ *
+ * 0 <= -113 dBm
+ * 1 -111 dBm
+ * 2 to 30 -109 dBm to -53 dBm
+ * 31 >= -51 dBm
+ * 99 unknown or unmeasurable
+ */
+
+ if (scan_uint(buf + 6, 2, &rssi, &ber) != 2)
+ error("%s: ERROR: Cannot parse all +CSQ: data fields, some data may be wrong or missing", name);
+
+ if (debug)
+ debug("DEBUG: Relative rssi value: %u", rssi);
+ } else
+ error("%s: ERROR: Invalid or empty response: \'%s\' received for: \'%s\'", name, buf, cmd);
+
+ return;
+}
+
+static void huawei_read_sysinfo(const char *cmd)
+{
+ char *buf;
+
+ buf = huawei_send_receive(cmd);
+
+ if (strncmp(buf, "^SYSINFO:", 9) == 0) {
+
+ /* Returns system information.
+ *
+ * ^SYSINFO:2,3,0,5,1,,4
+ * status,domain,roaming_status,mode,SIM state,reserved,sub_mode
+ */
+
+ if (scan_uint(buf + 9, 7, &status, &domain, &roaming_status, &mode, &sim_state, &reserved, &sub_mode) != 7)
+ error("%s: ERROR: Cannot parse all ^SYSINFO: data fields, some data may be wrong or missing", name);
+
+ if (debug)
+ debug("DEBUG: Sub mode value: %u", sub_mode);
+ } else
+ error("%s: ERROR: Invalid or empty response: \'%s\' received for: \'%s\'", name, buf, cmd);
+
+ return;
+}
+
+static void huawei_read_manuf(const char *cmd)
+{
+ int bytes;
+ char *buf;
+
+ buf = huawei_send_receive(cmd);
+ bytes = strlen(buf);
+
+ /* accept all but "ERROR" */
+ if (bytes > 0 && huawei_recv_error(buf) == 0) {
+
+ /* Returns manufacturer string.
+ *
+ * huawei
+ */
+ strncpy(manuf, buf, sizeof(manuf) - 1);
+
+ if (debug)
+ debug("DEBUG: Manufacturer string: %s", manuf);
+ } else
+ error("%s: ERROR: Invalid or empty response: \'%s\' received for: \'%s\'", name, buf, cmd);
+
+ return;
+}
+
+static void huawei_read_model(const char *cmd)
+{
+ int bytes;
+ char *buf;
+
+ buf = huawei_send_receive(cmd);
+ bytes = strlen(buf);
+
+ /* accept all but "ERROR" */
+ if (bytes > 0 && huawei_recv_error(buf) == 0) {
+
+ /* Returns model string.
+ *
+ * E220
+ */
+ strncpy(model, buf, sizeof(model) - 1);
+
+ if (debug)
+ debug("DEBUG: Model string: %s", model);
+ } else
+ error("%s: ERROR: Invalid or empty response: \'%s\' received for: \'%s\'", name, buf, cmd);
+
+ return;
+}
+
+static void huawei_read_fwver(const char *cmd)
+{
+ int bytes;
+ char *buf;
+
+ buf = huawei_send_receive(cmd);
+ bytes = strlen(buf);
+
+ /* accept all but "ERROR" */
+ if (bytes > 0 && huawei_recv_error(buf) == 0) {
+
+ /* Returns firmware version string.
+ *
+ * 11.110.03.00.00
+ */
+ strncpy(fwver, buf, sizeof(fwver) - 1);
+
+ if (debug)
+ debug("DEBUG: Firmware version string: %s", fwver);
+ } else
+ error("%s: ERROR: Invalid or empty response: \'%s\' received for: \'%s\'", name, buf, cmd);
+
+ return;
+}
+
+static void huawei_read_operator(const char *cmd)
+{
+ int bytes, i, pos = 0, copy = 0;
+ char *buf;
+
+ buf = huawei_send_receive(cmd);
+ bytes = strlen(buf);
+
+ if (strncmp(buf, "+COPS:", 6) == 0) {
+
+ /* Returns operator string.
+ *
+ * +COPS: 0,0,"vodafone ES",2
+ * reg_mode,format,operator string (based on format),network access type
+ */
+
+ /* parse "operator string" */
+ for (i = 6; i <= bytes; i++) {
+ if (buf[i] == '\"' && copy == 0) {
+ i++;
+ copy = 1;
+ } else if ((buf[i] == '\"') && copy == 1)
+ copy = 0;
+
+ if (copy == 1 && strlen(operator) < sizeof(operator) - 1) {
+ operator[pos] = buf[i];
+ pos++;
+ }
+ }
+
+ if (debug)
+ debug("DEBUG: Operator version string: \'%s\'", operator);
+ } else
+ error("%s: ERROR: Invalid or empty response: \'%s\' received for: \'%s\'", name, buf, cmd);
+
+ return;
+}
+
+static void huawei_read_flowreport(const char *cmd)
+{
+ char *buf;
+ static unsigned long long int prev_tx_flow = 0, prev_rx_flow = 0;
+ static unsigned long int prev_ds_time = 0;
+
+ buf = huawei_send_receive(cmd);
+
+ if (strncmp(buf, "^DSFLOWQRY:", 11) == 0) {
+
+ /* Returns flow report.
+ *
+ * ^DSFLOWQRY:00000E8E,0000000000333ACC,000000000A93E9AD,007B3514,000000007C0E5F69,00000007AD1AE9C6
+ * last_ds_time,last_rx_flow ,last_tx_flow ,total_ds_time,total_tx_flow,total_rx_flow
+ */
+
+ if (sscanf(buf + 11, "%lX,%LX,%LX,%lX,%LX,%LX", &last_ds_time, &last_tx_flow, &last_rx_flow, &total_ds_time,
+ &total_tx_flow, &total_rx_flow) != 6)
+ error("%s: ERROR: Cannot parse all ^DSFLOWQRY: data fields, some data may be wrong or missing", name);
+
+ /* ^DSFLOWQRY: lacks tx_rate and rx_rate values (^DSFLOWRPT has them), we try to calculate them here.
+ * Values comes at 2s interval.
+ */
+
+ /* tx_rate calculation */
+ if (last_ds_time >= prev_ds_time + 2 && last_tx_flow > prev_tx_flow)
+ calc_tx_rate = ((double) (last_tx_flow - prev_tx_flow)) / ((double) (last_ds_time - prev_ds_time));
+ else if (last_ds_time >= prev_ds_time + 2 && last_tx_flow == prev_tx_flow)
+ calc_tx_rate = 0;
+
+ /* rx_rate calculation */
+ if (last_ds_time >= prev_ds_time + 2 && last_rx_flow > prev_rx_flow)
+ calc_rx_rate = ((double) (last_rx_flow - prev_rx_flow)) / ((double) (last_ds_time - prev_ds_time));
+ else if (last_ds_time >= prev_ds_time + 2 && last_rx_flow == prev_rx_flow)
+ calc_rx_rate = 0;
+
+ /* previous values */
+ prev_tx_flow = last_tx_flow;
+ prev_rx_flow = last_rx_flow;
+ prev_ds_time = last_ds_time;
+
+ if (debug) {
+ debug("DEBUG: Last DS connection time [s]: %lu", last_ds_time);
+ debug("DEBUG: Last DS transmiting traffic [bytes]: %llu", last_tx_flow);
+ debug("DEBUG: Last DS receiving traffic [bytes]: %llu", last_rx_flow);
+ debug("DEBUG: Total DS connection time [s]: %lu", total_ds_time);
+ debug("DEBUG: Total DS transmiting trafic [bytes]: %llu", total_tx_flow);
+ debug("DEBUG: Total DS receiving trafic [bytes]: %llu", total_rx_flow);
+ debug("DEBUG: Calculated tx rate [bytes/s]: %lf", calc_tx_rate);
+ debug("DEBUG: Calculated rx rate [bytes/s]: %lf", calc_rx_rate);
+ }
+
+ } else
+ error("%s: ERROR: Invalid or empty response: \'%s\' received for: \'%s\'", name, buf, cmd);
+
+ return;
+}
+
+static void my_quality(RESULT * result, RESULT * arg1)
+{
+ int age;
+ static struct timeval prev_age;
+ static double value;
+
+ age = age_diff(prev_age);
+
+ if (age < 0 || age >= MIN_INTERVAL) {
+ gettimeofday(&prev_age, NULL);
+
+ if (huawei_configured() == 1)
+ huawei_read_quality(QUALITY);
+ }
+
+ /* Note: R2S stands for 'Result to String' */
+ if (strncmp(R2S(arg1), "%", 1) == 0) {
+ /* scale rssi 0...31 to 0..100% value */
+ if (rssi > 0 && rssi < 32)
+ value = (double) rssi *100 / 31;
+ else if (rssi == 0)
+ value = 0;
+
+ } else if (strncmp(R2S(arg1), "dbm", 3) == 0) {
+ /* scale rssi 0...31 to -113 dBm...-51 dBm value */
+ if (rssi > 0 && rssi < 32)
+ value = ((double) rssi * 2) - 113;
+ else if (rssi == 0)
+ value = -113;
+
+ } else if (strncmp(R2S(arg1), "rssi", 4) == 0) {
+ /* pass through relative rssi 0...31 value */
+ if (rssi > 0 && rssi < 32)
+ value = (double) rssi;
+ else if (rssi == 0)
+ value = 0;
+
+ } else {
+ error("%s: ERROR: Argument for huawei::quality() is missing, give: '%%'|'dbm'|'rssi'", name);
+ value = 0;
+ }
+
+ /* store result */
+ SetResult(&result, R_NUMBER, &value);
+
+ return;
+}
+
+static void my_mode(RESULT * result, RESULT * arg1)
+{
+ int age;
+ static struct timeval prev_age;
+ double value_num;
+ char *value_str, *mode_str;
+
+ age = age_diff(prev_age);
+
+ if (age < 0 || age >= MIN_INTERVAL) {
+ gettimeofday(&prev_age, NULL);
+
+ if (huawei_configured() == 1)
+ huawei_read_sysinfo(SYSINFO);
+ }
+
+ if (strncmp(R2S(arg1), "text", 4) == 0) {
+ /* sub modes 8 and 9 are unknown */
+ if (sub_mode > 7)
+ sub_mode = 8;
+
+ /* start with an empty string */
+ value_str = strdup("");
+
+ /* mode string */
+ mode_str = sub_system_mode[sub_mode];
+
+ /* allocate memory for value */
+ value_str = realloc(value_str, strlen(mode_str) + 1);
+
+ /* write mode string to value */
+ strcat(value_str, mode_str);
+
+ /* store result */
+ SetResult(&result, R_STRING, value_str);
+
+ /* free local string */
+ free(value_str);
+
+ } else if (strncmp(R2S(arg1), "number", 6) == 0) {
+ value_num = (double) mode;
+
+ /* store result */
+ SetResult(&result, R_NUMBER, &value_num);
+
+ } else {
+ error("%s: ERROR: Argument for huawei::mode() is missing, give: 'text'|'number'", name);
+
+ value_num = 0;
+
+ /* store result */
+ SetResult(&result, R_NUMBER, &value_num);
+ }
+
+ return;
+}
+
+static void my_manuf(RESULT * result)
+{
+ int age;
+ static struct timeval prev_age;
+ char *value_str;
+
+ age = age_diff(prev_age);
+
+ if (age < 0 || age >= MIN_INTERVAL) {
+ gettimeofday(&prev_age, NULL);
+
+ if (huawei_configured() == 1)
+ huawei_read_manuf(MANUF);
+ }
+
+ /* start with an empty string */
+ value_str = strdup("");
+
+ /* allocate memory for value */
+ value_str = realloc(value_str, strlen(manuf) + 1);
+
+ /* write mode string to value */
+ strcat(value_str, manuf);
+
+ /* store result */
+ SetResult(&result, R_STRING, value_str);
+
+ /* free local string */
+ free(value_str);
+
+ return;
+}
+
+static void my_model(RESULT * result)
+{
+ int age;
+ static struct timeval prev_age;
+ char *value_str;
+
+ age = age_diff(prev_age);
+
+ if (age < 0 || age >= MIN_INTERVAL) {
+ gettimeofday(&prev_age, NULL);
+
+ if (huawei_configured() == 1)
+ huawei_read_model(MODEL);
+ }
+
+ /* start with an empty string */
+ value_str = strdup("");
+
+ /* allocate memory for value */
+ value_str = realloc(value_str, strlen(model) + 1);
+
+ /* write mode string to value */
+ strcat(value_str, model);
+
+ /* store result */
+ SetResult(&result, R_STRING, value_str);
+
+ /* free local string */
+ free(value_str);
+
+ return;
+}
+
+static void my_fwver(RESULT * result)
+{
+ int age;
+ static struct timeval prev_age;
+ char *value_str;
+
+ age = age_diff(prev_age);
+
+ if (age < 0 || age >= MIN_INTERVAL) {
+ gettimeofday(&prev_age, NULL);
+
+ if (huawei_configured() == 1)
+ huawei_read_fwver(FWVER);
+ }
+
+ /* start with an empty string */
+ value_str = strdup("");
+
+ /* allocate memory for value */
+ value_str = realloc(value_str, strlen(fwver) + 1);
+
+ /* write mode string to value */
+ strcat(value_str, fwver);
+
+ /* store result */
+ SetResult(&result, R_STRING, value_str);
+
+ /* free local string */
+ free(value_str);
+
+ return;
+}
+
+static void my_operator(RESULT * result)
+{
+ int age;
+ static struct timeval prev_age;
+ char *value_str;
+
+ age = age_diff(prev_age);
+
+ if (age < 0 || age >= MIN_INTERVAL) {
+ gettimeofday(&prev_age, NULL);
+
+ if (huawei_configured() == 1)
+ huawei_read_operator(OPERATOR);
+ }
+
+ /* start with an empty string */
+ value_str = strdup("");
+
+ /* allocate memory for value */
+ value_str = realloc(value_str, strlen(operator) + 1);
+
+ /* write mode string to value */
+ strcat(value_str, operator);
+
+ /* store result */
+ SetResult(&result, R_STRING, value_str);
+
+ /* free local string */
+ free(value_str);
+
+ return;
+}
+
+static void my_flowreport(RESULT * result, RESULT * arg1)
+{
+ int age;
+ unsigned int days, hours, mins, secs;
+ double value_num;
+ char value_str[32];
+ static struct timeval prev_age;
+
+ age = age_diff(prev_age);
+
+ if (age < 0 || age >= MIN_INTERVAL) {
+ gettimeofday(&prev_age, NULL);
+
+ if (huawei_configured() == 1)
+ huawei_read_flowreport(FLOWREPORT);
+ }
+
+ if (strncmp(R2S(arg1), "uptime", 6) == 0) {
+
+ days = last_ds_time / 86400;
+ hours = (last_ds_time / 3600) - (days * 24);
+ mins = (last_ds_time / 60) - (days * 1440) - (hours * 60);
+ secs = last_ds_time % 60;
+
+ if (days > 0)
+ sprintf(value_str, "%u days %02u:%02u:%02u", days, hours, mins, secs);
+ else
+ sprintf(value_str, "%02u:%02u:%02u", hours, mins, secs);
+
+ /* store result: days, hours, mins, secs */
+ SetResult(&result, R_STRING, value_str);
+
+ return;
+ }
+
+ if (strncmp(R2S(arg1), "uptime_seconds", 14) == 0) {
+ /* uptime in seconds */
+ value_num = (double) last_ds_time;
+
+ /* store result: seconds */
+ SetResult(&result, R_NUMBER, &value_num);
+
+ return;
+ }
+
+ if (strncmp(R2S(arg1), "tx_rate", 7) == 0) {
+ /* tx data in Bytes/s */
+ value_num = calc_tx_rate;
+
+ /* store result */
+ SetResult(&result, R_NUMBER, &value_num);
+
+ return;
+ }
+
+ if (strncmp(R2S(arg1), "rx_rate", 7) == 0) {
+ /* rx data in Bytes/s */
+ value_num = calc_rx_rate;
+
+ /* store result */
+ SetResult(&result, R_NUMBER, &value_num);
+
+ return;
+ }
+
+ if (strncmp(R2S(arg1), "total_tx", 8) == 0) {
+ /* total rx data in Bytes */
+ value_num = (double) total_tx_flow;
+
+ /* store result */
+ SetResult(&result, R_NUMBER, &value_num);
+
+ return;
+ }
+
+ if (strncmp(R2S(arg1), "total_rx", 8) == 0) {
+ /* total rx data in Bytes */
+ value_num = (double) total_rx_flow;
+
+ /* store result */
+ SetResult(&result, R_NUMBER, &value_num);
+
+ return;
+ }
+
+ error
+ ("%s: ERROR: Argument for huawei::flowreport() is missing, give: 'uptime'|'uptime_seconds'|'tx_rate'|'rx_rate'|'total_tx'|'total_rx')",
+ name);
+ value_num = 0;
+
+ /* store result */
+ SetResult(&result, R_NUMBER, &value_num);
+
+ return;
+}
+
+/* plugin initialization. MUST NOT be declared 'static'! */
+int plugin_init_huawei(void)
+{
+ /* register our functions */
+ AddFunction("huawei::quality", 1, my_quality);
+ AddFunction("huawei::mode", 1, my_mode);
+ AddFunction("huawei::model", 0, my_model);
+ AddFunction("huawei::manuf", 0, my_manuf);
+ AddFunction("huawei::fwver", 0, my_fwver);
+ AddFunction("huawei::operator", 0, my_operator);
+ AddFunction("huawei::flowreport", 1, my_flowreport);
+
+ return 0;
+}
+
+void plugin_exit_huawei(void)
+{
+ int ret;
+
+ /* close file descriptor */
+ if (fd > 0) {
+ ret = close(fd);
+ if (ret < 0)
+ error("%s: ERROR: Device %s closing failure on plugin_exit, %i", name, port, ret);
+ }
+ fd = -2;
+}
diff --git a/plugin_i2c_sensors.c b/plugin_i2c_sensors.c
new file mode 100644
index 0000000..397e52c
--- /dev/null
+++ b/plugin_i2c_sensors.c
@@ -0,0 +1,375 @@
+/* $Id: plugin_i2c_sensors.c 1150 2011-07-27 02:53:04Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/plugin_i2c_sensors.c $
+ *
+ * I2C sensors plugin
+ *
+ * Copyright (C) 2003, 2004 Xavier Vello <xavier66@free.fr>
+ * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ * exported functions:
+ *
+ * int plugin_init_i2c_sensors (void)
+ * adds function i2c_sensors() to retrieve informations from
+ * the i2c sensors via sysfs or procfs interface
+ *
+ * -- WARNING --
+ * This plugin should detect where your sensors are at startup.
+ * If you can't get any token to work, ensure you don't get
+ * an error message with "lcd4linux -Fvvv".
+ *
+ * If so, try to force the path to your sensors in the conf like this :
+ * for sysfs: i2c_sensors-path '/sys/bus/i2c/devices/0-6000/'
+ * for procfs: i2c_sensors-path '/proc/sys/dev/sensors/via686a-isa-6000'
+ * /!\ these path are for my system, change the last dir according to yours
+ */
+
+/*
+ * Available tokens : # represents an int from 1 to 3 (or more)
+ * temp_input# -> temperature of sensor # (in ∞C)
+ * temp_max# and temp_hyst# -> max and min of sensor #
+ * in_input#, in_min# and in_max# -> voltages
+ * fan_input# -> speed (in RPM) of fan #
+ * fan_min# and fan_div#
+ *
+ * Tokens avaible only via sysfs if suported by your sensors:
+ * curr_input#, curr_min# and curr_max# -> value of current (in amps)
+ * pwm#
+ * temp_crit# -> critical value of sensor #
+ * vid -> cpu core voltage
+ * and maybe others
+ * (see /usr/src/linux/Documentation/i2c/sysfs-interface on linux 2.6)
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <dirent.h>
+
+#include "debug.h"
+#include "plugin.h"
+#include "cfg.h"
+#include "hash.h"
+#include "qprintf.h"
+#include "evaluator.h" // if strndup() is not available
+
+#ifdef WITH_DMALLOC
+#include <dmalloc.h>
+#endif
+
+static char *path = NULL;
+static HASH I2Csensors;
+
+static const char *procfs_tokens[4][3] = {
+ {"temp_hyst", "temp_max", "temp_input"}, /* for temp# */
+ {"in_min", "in_max", "in_input"}, /* for in# */
+ {"fan_div1", "fan_div2", "fan_div3"}, /* for fan_div */
+ {"fan_min", "fan_input", ""} /* for fan# */
+};
+
+static int (*parse_i2c_sensors) (const char *key);
+
+ /***********************************************\
+ * Parsing for new 2.6 kernels 'sysfs' interface *
+ \***********************************************/
+
+static int parse_i2c_sensors_sysfs(const char *key)
+{
+ char val[32];
+ char buffer[32];
+ char file[64];
+ FILE *stream;
+
+ strcpy(file, path);
+ strcat(file, key);
+
+ stream = fopen(file, "r");
+ if (stream == NULL) {
+ error("i2c_sensors: fopen(%s) failed: %s", file, strerror(errno));
+ return -1;
+ }
+ fgets(buffer, sizeof(buffer), stream);
+ fclose(stream);
+
+ if (buffer[0] == '\0') {
+ error("i2c_sensors: %s empty ?!", file);
+ return -1;
+ }
+
+ /* now the formating stuff, depending on the file : */
+ /* Some values must be divided by 1000, the others */
+ /* are parsed directly (we just remove the \n). */
+ if (!strncmp(key, "temp", 4) || !strncmp(key, "curr", 4) || !strncmp(key, "in", 2) || !strncmp(key, "vid", 3)) {
+ snprintf(val, sizeof(val), "%f", strtod(buffer, NULL) / 1000.0);
+ } else {
+ qprintf(val, sizeof(val), "%s", buffer);
+ /* we supress this nasty \n at the end */
+ val[strlen(val) - 1] = '\0';
+ }
+
+ hash_put(&I2Csensors, key, val);
+
+ return 0;
+
+}
+
+ /************************************************\
+ * Parsing for old 2.4 kernels 'procfs' interface *
+ \************************************************/
+
+static int parse_i2c_sensors_procfs(const char *key)
+{
+ char file[64];
+ FILE *stream;
+ char buffer[32];
+
+ char *value;
+ char *running;
+ int pos = 0;
+ const char delim[3] = " \n";
+ char final_key[32];
+ const char *number = &key[strlen(key) - 1];
+ int tokens_index;
+ /* debug("%s -> %s", key, number); */
+ strcpy(file, path);
+
+ if (!strncmp(key, "temp_", 5)) {
+ tokens_index = 0;
+ strcat(file, "temp");
+ strcat(file, number);
+ } else if (!strncmp(key, "in_", 3)) {
+ tokens_index = 1;
+ strcat(file, "in");
+ strcat(file, number);
+ } else if (!strncmp(key, "fan_div", 7)) {
+ tokens_index = 2;
+ strcat(file, "fan_div");
+ number = "";
+ } else if (!strncmp(key, "fan_", 4)) {
+ tokens_index = 3;
+ strcat(file, "fan");
+ strcat(file, number);
+ } else {
+ return -1;
+ }
+
+ stream = fopen(file, "r");
+ if (stream == NULL) {
+ error("i2c_sensors: fopen(%s) failed: %s", file, strerror(errno));
+ return -1;
+ }
+ fgets(buffer, sizeof(buffer), stream);
+ fclose(stream);
+
+ if (buffer[0] == '\0') {
+ error("i2c_sensors: %s empty ?!", file);
+ return -1;
+ }
+
+ running = strndup(buffer, sizeof(buffer));
+ while (1) {
+ value = strsep(&running, delim);
+ /* debug("%s pos %i -> %s", file, pos , value); */
+ if (!value || !strcmp(value, "")) {
+ /* debug("%s pos %i -> BREAK", file, pos); */
+ break;
+ } else {
+ qprintf(final_key, sizeof(final_key), "%s%s", procfs_tokens[tokens_index][pos], number);
+ /* debug ("%s -> %s", final_key, value); */
+ hash_put(&I2Csensors, final_key, value);
+ pos++;
+ }
+ }
+ free(running);
+ return 0;
+}
+
+ /*****************************************\
+ * Common functions (path search and init) *
+ \*****************************************/
+
+
+static void my_i2c_sensors_path(const char *method)
+{
+ struct dirent *dir;
+ struct dirent *file;
+ const char *base;
+ char dname[64];
+ DIR *fd1;
+ DIR *fd2;
+ int done;
+
+ if (!strcmp(method, "sysfs")) {
+ base = "/sys/class/hwmon/";
+ } else if (!strcmp(method, "sysfs-old")) {
+ base = "/sys/bus/i2c/devices/";
+ } else if (!strcmp(method, "procfs")) {
+ base = "/proc/sys/dev/sensors/";
+ /*base="/sensors_2.4/"; // fake dir to test without rebooting 2.4 ;) */
+ } else {
+ return;
+ }
+
+ fd1 = opendir(base);
+ if (!fd1) {
+ return;
+ }
+
+ while ((dir = readdir(fd1))) {
+ /* Skip non-directories and '.' and '..' */
+ if ((dir->d_type != DT_DIR && dir->d_type != DT_LNK) || strcmp(dir->d_name, ".") == 0
+ || strcmp(dir->d_name, "..") == 0) {
+ continue;
+ }
+
+ /* dname is the absolute path */
+ strcpy(dname, base);
+ strcat(dname, dir->d_name);
+ strcat(dname, "/");
+
+ fd2 = opendir(dname);
+ done = 0;
+ while ((file = readdir(fd2))) {
+ /* FIXME : do all sensors have a temp_input1 ? */
+ if (!strcmp(file->d_name, "temp_input1") || !strcmp(file->d_name, "temp1_input")
+ || !strcmp(file->d_name, "temp1")) {
+ path = realloc(path, strlen(dname) + 1);
+ strcpy(path, dname);
+ done = 1;
+ break;
+ }
+ if (!strcmp(file->d_name, "device")) {
+ char fname[PATH_MAX];
+ snprintf(fname, PATH_MAX, "%sdevice/temp1_input", dname);
+ if (access(fname, R_OK) == 0) {
+ path = realloc(path, strlen(dname) + 7);
+ sprintf(path, "%sdevice/", dname);
+ done = 1;
+ break;
+ }
+ }
+ }
+ closedir(fd2);
+ if (done)
+ break;
+ }
+ closedir(fd1);
+}
+
+
+static int configure_i2c_sensors(void)
+{
+ static int configured = 0;
+ char *path_cfg;
+
+ if (configured != 0)
+ return configured;
+
+ path_cfg = cfg_get(NULL, "i2c_sensors-path", "");
+ if (path_cfg == NULL || *path_cfg == '\0') {
+ /* debug("No path to i2c sensors found in the conf, calling my_i2c_sensors_path()"); */
+ my_i2c_sensors_path("sysfs");
+ if (!path)
+ my_i2c_sensors_path("sysfs-old");
+ if (!path)
+ my_i2c_sensors_path("procfs");
+
+ if (!path) {
+ error("i2c_sensors: unable to autodetect i2c sensors!");
+ configured = -1;
+ return configured;
+ }
+
+ debug("using i2c sensors at %s (autodetected)", path);
+
+ } else {
+ if (path_cfg[strlen(path_cfg) - 1] != '/') {
+ /* the headless user forgot the trailing slash :/ */
+ error("i2c_sensors: please add a trailing slash to %s from %s", path_cfg, cfg_source());
+ path_cfg = realloc(path_cfg, strlen(path_cfg) + 2);
+ strcat(path_cfg, "/");
+ }
+ debug("using i2c sensors at %s (from %s)", path_cfg, cfg_source());
+ path = realloc(path, strlen(path_cfg) + 1);
+ strcpy(path, path_cfg);
+ }
+ if (path_cfg)
+ free(path_cfg);
+
+ /* we activate the function only if there's a possibly path found */
+ if (strncmp(path, "/sys", 4) == 0) {
+ parse_i2c_sensors = parse_i2c_sensors_sysfs;
+ } else if (strncmp(path, "/proc", 5) == 0) {
+ parse_i2c_sensors = parse_i2c_sensors_procfs;
+ } else {
+ error("i2c_sensors: unknown path %s, should start with /sys or /proc", path);
+ configured = -1;
+ return configured;
+ }
+
+ hash_create(&I2Csensors);
+
+ configured = 1;
+ return configured;
+}
+
+
+void my_i2c_sensors(RESULT * result, RESULT * arg)
+{
+ int age;
+ char *key;
+ char *val;
+
+ if (configure_i2c_sensors() < 0) {
+ SetResult(&result, R_STRING, "??");
+ return;
+ }
+
+ key = R2S(arg);
+ age = hash_age(&I2Csensors, key);
+ if (age < 0 || age > 250) {
+ parse_i2c_sensors(key);
+ }
+ val = hash_get(&I2Csensors, key, NULL);
+ if (val) {
+ SetResult(&result, R_STRING, val);
+ } else {
+ SetResult(&result, R_STRING, "??");
+ }
+}
+
+
+int plugin_init_i2c_sensors(void)
+{
+ AddFunction("i2c_sensors", 1, my_i2c_sensors);
+ return 0;
+}
+
+
+void plugin_exit_i2c_sensors(void)
+{
+ hash_destroy(&I2Csensors);
+}
diff --git a/plugin_iconv.c b/plugin_iconv.c
new file mode 100644
index 0000000..6d5a8a6
--- /dev/null
+++ b/plugin_iconv.c
@@ -0,0 +1,142 @@
+/* $Id: plugin_iconv.c 1136 2010-11-28 16:07:16Z mzuther $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/plugin_iconv.c $
+ *
+ * iconv charset conversion plugin
+ *
+ * Copyright (C) 2006 Ernst Bachmann <e.bachmann@xebec.de>
+ * Copyright (C) 2006 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ * exported functions:
+ *
+ * int plugin_init_iconv (void)
+ * int plugin_exit_iconv (void)
+ *
+ */
+
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <iconv.h>
+#include <errno.h>
+
+/* these should always be included */
+#include "debug.h"
+#include "plugin.h"
+
+#ifdef WITH_DMALLOC
+#include <dmalloc.h>
+#endif
+
+
+
+/* iconv function, convert charsets */
+/* valid "to" and "from" charsets can be listed by running "iconv --list" from a shell */
+/* utf16 & utf32 encodings won't work, as they contain null bytes, confusing strlen */
+static void my_iconv(RESULT * result, RESULT * charset_from, RESULT * charset_to, RESULT * arg)
+{
+ char *source;
+ size_t source_left;
+ char *dest;
+ char *dest_pos;
+ size_t dest_left;
+ iconv_t cd;
+
+ source = R2S(arg);
+ source_left = strlen(source);
+
+ /* use twice the memory needed in best case, but save lots of reallocs in worst case */
+ /* increase to 4 if most conversions are to utf32 (quite unlikely) */
+ /* also alloc a "safety byte" so we can always zero-terminate the string. */
+
+ dest_left = 2 * source_left;
+ dest = malloc(dest_left + 1);
+ dest_pos = dest;
+
+ cd = iconv_open(R2S(charset_to), R2S(charset_from));
+ if (cd != (iconv_t) (-1)) {
+
+ do {
+
+ /* quite spammy: debug("plugin_iconv: calling iconv with %ld,[%s]/%ld,%ld", cd, source, source_left, dest_left); */
+ if (iconv(cd, &source, &source_left, &dest_pos, &dest_left) == (size_t) (-1)) {
+ switch (errno) {
+ case EILSEQ:
+ /* illegal bytes in input sequence */
+ /* try to fix by skipping a byte */
+ info("plugin_iconv: illegal character in input string: %c", *source);
+ source_left--;
+ source++;
+ break;
+ case EINVAL:
+ /* input string ends during a multibyte sequence */
+ /* try to fix by simply ignoring */
+ info("plugin_iconv: illegal character at end of input");
+ source_left = 0;
+ break;
+ case E2BIG:
+ /* not enough bytes in outbuf. */
+ /* TODO: Realloc output buffer, probably doubling its size? */
+ /* for now, just bail out. For lcd4linux 99% of all conversions will go to ascii or latin1 anyways */
+ error
+ ("plugin_iconv: out of memory in destination buffer. Seems like Ernst was too lazy, complain to him!");
+ source_left = 0;
+ break;
+ default:
+ error("plugin_iconv: strange errno state (%d) occurred", errno);
+ source_left = 0;
+ }
+ }
+ } while (source_left > 0); /* don't check for == 0, could be negative in EILSEQ case */
+
+ /* terminate the string, we're sure to have that byte left, see above */
+ *dest_pos = 0;
+ dest_pos++;
+
+ iconv_close(cd);
+ } else {
+ error("plugin_iconv: could not open conversion descriptor. Check if your charsets are supported!");
+ /* guaranteed to fit. */
+ strcpy(dest, source);
+ }
+
+ SetResult(&result, R_STRING, dest);
+
+ free(dest);
+}
+
+
+/* plugin initialization */
+int plugin_init_iconv(void)
+{
+
+ AddFunction("iconv", 3, my_iconv);
+
+ return 0;
+}
+
+void plugin_exit_iconv(void)
+{
+ /* nothing to clean */
+}
diff --git a/plugin_imon.c b/plugin_imon.c
new file mode 100644
index 0000000..c0fdc29
--- /dev/null
+++ b/plugin_imon.c
@@ -0,0 +1,629 @@
+/* $Id: plugin_imon.c 782 2007-03-21 05:01:11Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/plugin_imon.c $
+ *
+ * imond/telmond data processing
+ *
+ * Copyright (C) 2003 Nico Wallmeier <nico.wallmeier@post.rwth-aachen.de>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+#include "config.h"
+#include "debug.h"
+#include "plugin.h"
+#include "qprintf.h"
+#include "cfg.h"
+#include "hash.h"
+
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/fcntl.h>
+#include <sys/ioctl.h>
+#include <sys/time.h>
+#include <linux/errno.h>
+#include <sys/stat.h>
+#include <string.h>
+#include <time.h>
+
+#include <netdb.h>
+#include <netinet/in.h>
+#include <netinet/tcp.h>
+#include <arpa/inet.h> /* decl of inet_addr() */
+#include <sys/socket.h>
+
+
+static HASH TELMON;
+static HASH IMON;
+
+static char thost[256];
+static int tport;
+static char phoneb[256];
+
+static char ihost[256];
+static char ipass[256];
+static int iport;
+
+static int fd = 0;
+static int err = 0;
+
+/*----------------------------------------------------------------------------
+ * service_connect (host_name, port) - connect to tcp-service
+ *----------------------------------------------------------------------------
+ */
+static int service_connect(const char *host_name, const int port)
+{
+ struct sockaddr_in addr;
+ struct hostent *host_p;
+ int fd;
+ int opt = 1;
+
+ (void) memset((char *) &addr, 0, sizeof(addr));
+
+ if ((addr.sin_addr.s_addr = inet_addr((char *) host_name)) == INADDR_NONE) {
+ host_p = gethostbyname(host_name);
+ if (!host_p) {
+ error("%s: host not found\n", host_name);
+ return (-1);
+ }
+ (void) memcpy((char *) (&addr.sin_addr), host_p->h_addr, host_p->h_length);
+ }
+
+ addr.sin_family = AF_INET;
+ addr.sin_port = htons((unsigned short) port);
+
+ /* open socket */
+ if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
+ perror("socket");
+ return (-1);
+ }
+
+ (void) setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, (char *) &opt, sizeof(opt));
+
+ if (connect(fd, (struct sockaddr *) &addr, sizeof(addr)) != 0) {
+ (void) close(fd);
+ perror(host_name);
+ return (-1);
+ }
+
+ return (fd);
+} /* service_connect (char * host_name, int port) */
+
+
+/*----------------------------------------------------------------------------
+ * send_command (int fd, char * str) - send command to imond
+ *----------------------------------------------------------------------------
+ */
+static void send_command(const int fd, const char *str)
+{
+ char buf[256];
+ int len = strlen(str);
+
+ sprintf(buf, "%s\r\n", str);
+ write(fd, buf, len + 2);
+
+ return;
+} /* send_command (int fd, char * str) */
+
+
+/*----------------------------------------------------------------------------
+ * get_answer (int fd) - get answer from imond
+ *----------------------------------------------------------------------------
+ */
+static char *get_answer(const int fd)
+{
+ static char buf[8192];
+ int len;
+
+ len = read(fd, buf, 8192);
+
+ if (len <= 0) {
+ return ((char *) NULL);
+ }
+
+ while (len > 1 && (buf[len - 1] == '\n' || buf[len - 1] == '\r')) {
+ buf[len - 1] = '\0';
+ len--;
+ }
+
+ if (!strncmp(buf, "OK ", 3)) { /* OK xxxx */
+ return (buf + 3);
+ } else if (len > 2 && !strcmp(buf + len - 2, "OK")) {
+ *(buf + len - 2) = '\0';
+ return (buf);
+ } else if (len == 2 && !strcmp(buf + len - 2, "OK")) {
+ return (buf);
+ }
+
+ return ((char *) NULL); /* ERR xxxx */
+} /* get_answer (int fd) */
+
+/*----------------------------------------------------------------------------
+ * get_value (char * cmd) - send command, get value
+ *----------------------------------------------------------------------------
+ */
+static char *get_value(const char *cmd)
+{
+ char *answer;
+
+ send_command(fd, cmd);
+
+ answer = get_answer(fd);
+
+ if (answer) {
+ return (answer);
+ }
+
+ return ("");
+} /* get_value (char * cmd, int arg) */
+
+
+static void phonebook(char *number)
+{
+ FILE *fp;
+ char line[256];
+
+ fp = fopen(phoneb, "r");
+
+ if (!fp)
+ return;
+
+ while (fgets(line, sizeof(line), fp)) {
+ if (*line == '#')
+ continue;
+ if (!strncmp(line, number, strlen(number))) {
+ char *komma = strchr(line, ',');
+ char *beginn = strchr(line, '=');
+ if (!beginn)
+ return;
+ while (strrchr(line, '\r'))
+ strrchr(line, '\r')[0] = '\0';
+ while (strrchr(line, '\n'))
+ strrchr(line, '\n')[0] = '\0';
+ if (komma)
+ komma[0] = '\0';
+ strcpy(number, beginn + 1);
+ break;
+ }
+ }
+
+ fclose(fp);
+}
+
+
+static int parse_telmon()
+{
+ static int telmond_fd = -2;
+ static char oldanswer[128];
+ int age;
+
+ /* reread every 1 sec only */
+ age = hash_age(&TELMON, NULL);
+ if (age > 0 && age <= 1000)
+ return 0;
+
+ if (telmond_fd != -1) {
+ char telbuf[128];
+
+ telmond_fd = service_connect(thost, tport);
+ if (telmond_fd >= 0) {
+ int l = read(telmond_fd, telbuf, 127);
+ if ((l > 0) && (strcmp(telbuf, oldanswer))) {
+ char date[11];
+ char time[11];
+ char number[256];
+ char msn[256];
+ sscanf(telbuf, "%s %s %s %s", date, time, number, msn);
+ hash_put(&TELMON, "time", time);
+ date[4] = '\0';
+ date[7] = '\0';
+ qprintf(time, sizeof(time), "%s.%s.%s", date + 8, date + 5, date);
+ hash_put(&TELMON, "number", number);
+ hash_put(&TELMON, "msn", msn);
+ hash_put(&TELMON, "date", time);
+ phonebook(number);
+ phonebook(msn);
+ hash_put(&TELMON, "name", number);
+ hash_put(&TELMON, "msnname", msn);
+ }
+ close(telmond_fd);
+ strcpy(oldanswer, telbuf);
+ }
+ }
+ return 0;
+}
+
+
+static int configure_telmon(void)
+{
+ static int configured = 0;
+
+ char *s;
+
+ if (configured != 0)
+ return configured;
+
+ hash_create(&TELMON);
+
+ s = cfg_get("Plugin:Telmon", "Host", "127.0.0.1");
+ if (*s == '\0') {
+ error("[Telmon] empty 'Host' entry in %s", cfg_source());
+ configured = -1;
+ return configured;
+ }
+ strcpy(thost, s);
+ free(s);
+
+ if (cfg_number("Plugin:Telmon", "Port", 5001, 1, 65536, &tport) < 0) {
+ error("[Telmon] no valid port definition");
+ configured = -1;
+ return configured;
+ }
+
+ s = cfg_get("Plugin:Telmon", "Phonebook", "/etc/phonebook");
+ strcpy(phoneb, s);
+ free(s);
+
+ configured = 1;
+ return configured;
+}
+
+
+static void my_telmon(RESULT * result, RESULT * arg1)
+{
+ char *val = NULL;
+
+ if (configure_telmon() < 0) {
+ SetResult(&result, R_STRING, "");
+ return;
+ }
+
+ if (parse_telmon() < 0) {
+ SetResult(&result, R_STRING, "");
+ return;
+ }
+
+ val = hash_get(&TELMON, R2S(arg1), NULL);
+ if (val == NULL)
+ val = "";
+ SetResult(&result, R_STRING, val);
+}
+
+
+void init()
+{
+ if (fd != 0)
+ return;
+
+ fd = service_connect(ihost, iport);
+
+ if (fd < 0) {
+ err++;
+ } else if ((ipass != NULL) && (*ipass != '\0')) { /* Passwort senden */
+ char buf[40];
+ qprintf(buf, sizeof(buf), "pass %s", ipass);
+ send_command(fd, buf);
+ get_answer(fd);
+ }
+}
+
+
+static int parse_imon(const char *cmd)
+{
+ /* reread every half sec only */
+ int age = hash_age(&IMON, cmd);
+ if (age > 0 && age <= 500)
+ return 0;
+
+ init(); /* establish connection */
+
+ if (err)
+ return -1;
+
+ hash_put(&IMON, cmd, get_value(cmd));
+
+ return 0;
+}
+
+
+static int configure_imon(void)
+{
+ static int configured = 0;
+
+ char *s;
+
+ if (configured != 0)
+ return configured;
+
+ hash_create(&IMON);
+
+ s = cfg_get("Plugin:Imon", "Host", "127.0.0.1");
+ if (*s == '\0') {
+ error("[Imon] empty 'Host' entry in %s", cfg_source());
+ configured = -1;
+ return configured;
+ }
+ strcpy(ihost, s);
+ free(s);
+
+ if (cfg_number("Plugin:Imon", "Port", 5000, 1, 65536, &iport) < 0) {
+ error("[Imon] no valid port definition");
+ configured = -1;
+ return configured;
+ }
+
+ s = cfg_get("Plugin:Imon", "Pass", "");
+ strcpy(ipass, s);
+ free(s);
+
+ configured = 1;
+ return configured;
+}
+
+
+static void my_imon_version(RESULT * result)
+{
+ char *val;
+ int age;
+
+ if (configure_imon() < 0) {
+ SetResult(&result, R_STRING, "");
+ return;
+ }
+
+ /* read only once */
+ age = hash_age(&IMON, "version");
+ if (age < 0) {
+ char *s;
+ init();
+ if (err) {
+ SetResult(&result, R_STRING, "");
+ return;
+ }
+ s = get_value("version");
+ for (;;) { /* interne Versionsnummer killen */
+ if (s[0] == ' ') {
+ s = s + 1;
+ break;
+ }
+ s = s + 1;
+ }
+ hash_put(&IMON, "version", s);
+ }
+
+ val = hash_get(&IMON, "version", NULL);
+ if (val == NULL)
+ val = "";
+ SetResult(&result, R_STRING, val);
+}
+
+
+static int parse_imon_rates(const char *channel)
+{
+ char buf[128], in[25], out[25];
+ char *s;
+ int age;
+
+ qprintf(buf, sizeof(buf), "rate %s in", channel);
+
+ /* reread every half sec only */
+ age = hash_age(&IMON, buf);
+ if (age > 0 && age <= 500)
+ return 0;
+
+ init(); /* establish connection */
+
+ if (err)
+ return -1;
+
+ qprintf(buf, sizeof(buf), "rate %s", channel);
+ s = get_value(buf);
+
+ if (sscanf(s, "%s %s", in, out) != 2)
+ return -1;
+
+ qprintf(buf, sizeof(buf), "rate %s in", channel);
+ hash_put(&IMON, buf, in);
+ qprintf(buf, sizeof(buf), "rate %s out", channel);
+ hash_put(&IMON, buf, out);
+
+ return 0;
+}
+
+
+static void my_imon_rates(RESULT * result, RESULT * arg1, RESULT * arg2)
+{
+ char *val;
+ char buf[128];
+
+ if (configure_imon() < 0) {
+ SetResult(&result, R_STRING, "");
+ return;
+ }
+
+ if (parse_imon_rates(R2S(arg1)) < 0) {
+ SetResult(&result, R_STRING, "");
+ return;
+ }
+
+ qprintf(buf, sizeof(buf), "rate %s %s", R2S(arg1), R2S(arg2));
+
+ val = hash_get(&IMON, buf, NULL);
+ if (val == NULL)
+ val = "";
+ SetResult(&result, R_STRING, val);
+}
+
+static int parse_imon_quantity(const char *channel)
+{
+ char buf[256], fill1[25], in[25], fill2[25], out[25];
+ char *s;
+ int age;
+
+ qprintf(buf, sizeof(buf), "quantity %s in", channel);
+
+ /* reread every half sec only */
+ age = hash_age(&IMON, buf);
+ if (age > 0 && age <= 500)
+ return 0;
+
+ init(); /* establish connection */
+
+ if (err)
+ return -1;
+
+ qprintf(buf, sizeof(buf), "quantity %s", channel);
+ s = get_value(buf);
+
+ if (sscanf(s, "%s %s %s %s", fill1, in, fill2, out) != 4)
+ return -1;
+
+ qprintf(buf, sizeof(buf), "quantity %s in", channel);
+ hash_put(&IMON, buf, in);
+ qprintf(buf, sizeof(buf), "quantity %s out", channel);
+ hash_put(&IMON, buf, out);
+
+ return 0;
+}
+
+static int parse_imon_status(const char *channel)
+{
+ char buf[256], status[25];
+ char *s;
+ int age;
+
+ qprintf(buf, sizeof(buf), "status %s", channel);
+
+ /* reread every half sec only */
+ age = hash_age(&IMON, buf);
+ if (age > 0 && age <= 500)
+ return 0;
+
+ init(); /* establish connection */
+
+ if (err)
+ return -1;
+
+ qprintf(buf, sizeof(buf), "status %s", channel);
+ s = get_value(buf);
+
+ if (sscanf(s, "%s", status) != 1)
+ return -1;
+
+ qprintf(buf, sizeof(buf), "status %s", channel);
+ if (strcasecmp(status, "Online") == 0)
+ hash_put(&IMON, buf, "1");
+ else
+ hash_put(&IMON, buf, "0");
+
+ return 0;
+}
+
+static void my_imon_quantity(RESULT * result, RESULT * arg1, RESULT * arg2)
+{
+ char *val;
+ char buf[256];
+
+ if (configure_imon() < 0) {
+ SetResult(&result, R_STRING, "");
+ return;
+ }
+
+ if (parse_imon_quantity(R2S(arg1)) < 0) {
+ SetResult(&result, R_STRING, "");
+ return;
+ }
+
+ qprintf(buf, sizeof(buf), "quantity %s %s", R2S(arg1), R2S(arg2));
+
+ val = hash_get(&IMON, buf, NULL);
+ if (val == NULL)
+ val = "";
+ SetResult(&result, R_STRING, val);
+}
+
+static void my_imon_status(RESULT * result, RESULT * arg1)
+{
+ char *val;
+ char buf[256];
+
+ if (configure_imon() < 0) {
+ SetResult(&result, R_NUMBER, "-1");
+ return;
+ }
+
+ if (parse_imon_status(R2S(arg1)) < 0) {
+ SetResult(&result, R_STRING, "-1");
+ return;
+ }
+
+ qprintf(buf, sizeof(buf), "status %s", R2S(arg1));
+
+ val = hash_get(&IMON, buf, NULL);
+ if (val == NULL)
+ val = "-1";
+ SetResult(&result, R_STRING, val);
+}
+
+static void my_imon(RESULT * result, RESULT * arg1)
+{
+ char *val;
+ char *cmd;
+
+ if (configure_imon() < 0) {
+ SetResult(&result, R_STRING, "");
+ return;
+ }
+
+ cmd = R2S(arg1);
+ if (parse_imon(cmd) < 0) {
+ SetResult(&result, R_STRING, "");
+ return;
+ }
+
+ val = hash_get(&IMON, cmd, NULL);
+ if (val == NULL)
+ val = "";
+ SetResult(&result, R_STRING, val);
+}
+
+
+int plugin_init_imon(void)
+{
+ AddFunction("imon", 1, my_imon);
+ AddFunction("imon::version", 0, my_imon_version);
+ AddFunction("imon::rates", 2, my_imon_rates);
+ AddFunction("imon::quantity", 2, my_imon_quantity);
+ AddFunction("imon::status", 1, my_imon_status);
+ AddFunction("imon::telmon", 1, my_telmon);
+
+ return 0;
+}
+
+
+void plugin_exit_imon(void)
+{
+ if (fd > 0) {
+ send_command(fd, "quit");
+ close(fd);
+ }
+ hash_destroy(&TELMON);
+ hash_destroy(&IMON);
+}
diff --git a/plugin_isdn.c b/plugin_isdn.c
new file mode 100644
index 0000000..a5e6972
--- /dev/null
+++ b/plugin_isdn.c
@@ -0,0 +1,254 @@
+/* $Id: plugin_isdn.c 840 2007-09-09 12:17:42Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/plugin_isdn.c $
+ *
+ * plugin for ISDN subsystem
+ *
+ * Copyright (C) 2003 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * Based on the old isdn client (isdn.c) which is
+ * Copyright (C) 1999, 2000 Michael Reinelt <michael@reinelt.co.at>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ * exported functions:
+ *
+ * int plugin_init_isdn (void)
+ * adds functions to access ISDN information
+ *
+ */
+
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <sys/types.h>
+
+#ifdef HAVE_LINUX_ISDN_H
+#include <linux/isdn.h>
+#else
+#warning isdn.h not found. CPS support deactivated.
+#endif
+
+#include "debug.h"
+#include "plugin.h"
+#include "qprintf.h"
+#include "hash.h"
+
+
+typedef struct {
+ unsigned long in;
+ unsigned long out;
+} CPS;
+
+
+static HASH ISDN_INFO;
+static HASH ISDN_CPS;
+
+
+static void hash_put_info(const char *name, const int channel, const char *val)
+{
+ char key[16];
+
+ qprintf(key, sizeof(key), "%s[%d]", name, channel);
+ hash_put(&ISDN_INFO, key, val);
+}
+
+static int parse_isdninfo(void)
+{
+ int age;
+ FILE *stream;
+ long flags;
+
+ /* reread every 10 msec only */
+ age = hash_age(&ISDN_INFO, NULL);
+ if (age > 0 && age <= 10)
+ return 0;
+
+ /* open file */
+ stream = fopen("/dev/isdninfo", "r");
+ if (stream == NULL) {
+ error("open(/dev/isdninfo) failed: %s", strerror(errno));
+ return -1;
+ }
+
+ /* get flags */
+ flags = fcntl(fileno(stream), F_GETFL);
+ if (flags < 0) {
+ error("fcntl(/dev/isdninfo, F_GETFL) failed: %s", strerror(errno));
+ return -1;
+ }
+
+ /* set O_NONBLOCK */
+ if (fcntl(fileno(stream), F_SETFL, flags | O_NONBLOCK) < 0) {
+ error("fcntl(/dev/isdninfo, F_SETFL, O_NONBLOCK) failed: %s", strerror(errno));
+ return -1;
+ }
+
+ while (!feof(stream)) {
+ char buffer[4096];
+ char *beg, *end;
+ if (fgets(buffer, sizeof(buffer), stream) == NULL)
+ break;
+ beg = strchr(buffer, ':');
+ if (beg != NULL) {
+ char delim[] = " \t\n";
+ int i = 0;
+ *beg++ = '\0';
+ while (*beg && strchr(delim, *beg))
+ beg++;
+ while (beg && *beg) {
+ if ((end = strpbrk(beg, delim)))
+ *end = '\0';
+ hash_put_info(buffer, i, beg);
+ beg = end ? end + 1 : NULL;
+ while (*beg && strchr(delim, *beg))
+ beg++;
+ i++;
+ }
+ } else {
+ error("Huh? no colon found in <%s>", buffer);
+ }
+ }
+
+ fclose(stream);
+
+ return 0;
+}
+
+
+static void my_isdn_info(RESULT * result, RESULT * arg1, RESULT * arg2)
+{
+ char key[16], *val;
+
+ if (parse_isdninfo() < 0) {
+ SetResult(&result, R_STRING, "");
+ return;
+ }
+
+ qprintf(key, sizeof(key), "%s[%d]", R2S(arg1), (int) R2N(arg2));
+ val = hash_get(&ISDN_INFO, key, NULL);
+ if (val == NULL)
+ val = "";
+ SetResult(&result, R_STRING, val);
+}
+
+
+#ifdef HAVE_LINUX_ISDN_H
+
+static void hash_put_cps(const int channel, const CPS * cps)
+{
+ char key[16], val[16];
+
+ qprintf(key, sizeof(key), channel < 0 ? "i" : "i%d", channel);
+ qprintf(val, sizeof(val), "%u", cps->in);
+ hash_put_delta(&ISDN_CPS, key, val);
+
+ qprintf(key, sizeof(key), channel < 0 ? "o" : "o%d", channel);
+ qprintf(val, sizeof(val), "%u", cps->out);
+ hash_put_delta(&ISDN_CPS, key, val);
+}
+
+
+static int get_cps(void)
+{
+ int age, i;
+ static int fd = -2;
+ CPS cps[ISDN_MAX_CHANNELS];
+ CPS sum;
+
+ /* reread every 10 msec only */
+ age = hash_age(&ISDN_CPS, NULL);
+ if (age > 0 && age <= 10)
+ return 0;
+
+ if (fd == -1)
+ return -1;
+
+ if (fd == -2) {
+ fd = open("/dev/isdninfo", O_RDONLY | O_NDELAY);
+ if (fd == -1) {
+ error("open(/dev/isdninfo) failed: %s", strerror(errno));
+ return -1;
+ }
+ }
+
+ if (ioctl(fd, IIOCGETCPS, &cps)) {
+ error("ioctl(IIOCGETCPS) failed: %s", strerror(errno));
+ fd = -1;
+ return -1;
+ }
+
+ sum.in = 0;
+ sum.out = 0;
+ for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
+ sum.in += cps[i].in;
+ sum.out += cps[i].out;
+ hash_put_cps(i, &cps[i]);
+ }
+ hash_put_cps(-1, &sum);
+
+ return 0;
+}
+
+
+static void my_isdn_cps(RESULT * result, RESULT * arg1, RESULT * arg2)
+{
+ double value;
+
+ if (get_cps() < 0) {
+ SetResult(&result, R_STRING, "");
+ return;
+ }
+
+ value = hash_get_delta(&ISDN_CPS, R2S(arg1), NULL, R2N(arg2));
+ SetResult(&result, R_NUMBER, &value);
+
+}
+
+#endif
+
+
+int plugin_init_isdn(void)
+{
+ hash_create(&ISDN_INFO);
+ hash_create(&ISDN_CPS);
+
+ AddFunction("isdn::info", 2, my_isdn_info);
+
+#ifdef HAVE_LINUX_ISDN_H
+ AddFunction("isdn::cps", 2, my_isdn_cps);
+#endif
+
+ return 0;
+}
+
+
+void plugin_exit_isdn(void)
+{
+ hash_destroy(&ISDN_INFO);
+ hash_destroy(&ISDN_CPS);
+}
diff --git a/plugin_kvv.c b/plugin_kvv.c
new file mode 100644
index 0000000..f0950d3
--- /dev/null
+++ b/plugin_kvv.c
@@ -0,0 +1,814 @@
+/* $Id: plugin_kvv.c 944 2009-01-06 06:46:50Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/plugin_kvv.c $
+ *
+ * plugin kvv (karlsruher verkehrsverbund)
+ *
+ * Copyright (C) 2006 Till Harbaum <till@harbaum.org>
+ * Copyright (C) 2006 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ * exported functions:
+ *
+ * int plugin_init_kvv (void)
+ * adds various functions
+ * void plugin_exit_kvv (void)
+ *
+ */
+
+/* define the include files you need */
+#include "config.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <ctype.h>
+#include <errno.h>
+#include <signal.h>
+
+/* network specific includes */
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <netdb.h>
+#include <arpa/inet.h>
+
+/* these should always be included */
+#include "debug.h"
+#include "plugin.h"
+#include "cfg.h"
+#include "thread.h"
+
+/* these can't be configured as it doesn't make sense to change them */
+#define HTTP_SERVER "www.init-ka.de"
+#define HTTP_REQUEST "/webfgi/StopInfoInplace.aspx?ID=%s"
+#define USER_AGENT "lcd4linux - KVV plugin (http://ssl.bulix.org/projects/lcd4linux/wiki/plugin_kvv)"
+
+#define DEFAULT_STATION_ID "89" /* Hauptbahnhof */
+
+/* example ids:
+ * 89 = Hauptbahnhof
+ * 12_701 = Berufsakademie
+ */
+
+/* total max values to calculate shm size */
+#define MAX_LINES 4
+#define MAX_LINE_LENGTH 8
+#define MAX_STATION_LENGTH 40
+
+typedef struct {
+ char line[MAX_LINE_LENGTH + 1];
+ char station[MAX_STATION_LENGTH + 1];
+ int time;
+} kvv_entry_t;
+
+typedef struct {
+ int entries, error;
+ kvv_entry_t entry[MAX_LINES];
+} kvv_shm_t;
+
+static char *station_id = NULL;
+static char *proxy_name = NULL;
+static int port = 80;
+static pid_t pid = -1;
+static int refresh = 60;
+static int abbreviate = 0;
+
+static int initialized = 0;
+static int mutex = 0;
+static int shmid = -1;
+static kvv_shm_t *shm = NULL;
+
+#define SECTION "Plugin:KVV"
+
+#define TIMEOUT_SHORT 1 /* wait this long for additional data */
+#define TIMEOUT_LONG 10 /* wait this long for initial data */
+
+/* search an element in the result string */
+static int get_element(char *input, char *name, char **data)
+{
+ int skip = 0;
+ int len = 0;
+ int state = 0; /* nothing found yet */
+
+ /* search entire string */
+ while (*input) {
+
+ if (skip == 0) {
+ switch (state) {
+ case 0:
+ if (*input == '<')
+ state = 1;
+ else
+ state = 0;
+ break;
+
+ case 1:
+ /* ignore white spaces */
+ if (*input != ' ') {
+ if (strncasecmp(input, name, strlen(name)) == 0) {
+ state = 2;
+ skip = strlen(name) - 1;
+ } else
+ state = 0;
+ }
+ break;
+
+ case 2:
+ if (*input == ' ') {
+ *data = ++input;
+ while (*input && (*input++ != '>'))
+ len++;
+
+ return len;
+ } else
+ state = 0;
+ break;
+ }
+ } else if (skip)
+ skip--;
+
+ input++;
+ }
+
+ return -1;
+}
+
+/* serach an attribute within an element */
+static int get_attrib(char *input, char *name, char **data)
+{
+ int skip = 0;
+ int len = 0;
+ int state = 0; /* nothing found */
+
+ /* search in this element */
+ while (*input != '>') {
+ /* ignore white spaces */
+ if (((*input != ' ') && (*input != '\t')) && (skip == 0)) {
+ switch (state) {
+ case 0:
+ if (strncasecmp(input, name, strlen(name)) == 0) {
+ state = 1;
+ skip = strlen(name) - 1;
+ }
+ break;
+
+ case 1:
+ if (*input == '=')
+ state = 2;
+ else
+ state = 0;
+ break;
+
+ case 2:
+ if (*input == '\"') {
+ *data = ++input;
+ while (*input++ != '\"')
+ len++;
+
+ return len;
+ } else
+ state = 0;
+
+ break;
+ }
+ } else if (skip)
+ skip--;
+
+ input++;
+ }
+ return -1;
+}
+
+static int http_open(char *name)
+{
+ struct sockaddr_in server;
+ struct hostent *host_info;
+ unsigned long addr;
+ int sock;
+
+ /* create socket */
+ sock = socket(PF_INET, SOCK_STREAM, 0);
+ if (sock < 0) {
+ perror("failed to create socket");
+ return -1;
+ }
+
+ /* Erzeuge die Socketadresse des Servers
+ * Sie besteht aus Typ, IP-Adresse und Portnummer */
+ memset(&server, 0, sizeof(server));
+ if ((addr = inet_addr(name)) != INADDR_NONE) {
+ memcpy((char *) &server.sin_addr, &addr, sizeof(addr));
+ } else {
+ /* Wandle den Servernamen in eine IP-Adresse um */
+ host_info = gethostbyname(name);
+ if (NULL == host_info) {
+ error("[KVV] Unknown server: %s", name);
+ return -1;
+ }
+ memcpy((char *) &server.sin_addr, host_info->h_addr, host_info->h_length);
+ }
+
+ server.sin_family = AF_INET;
+ server.sin_port = htons(port);
+
+ /* Baue die Verbindung zum Server auf */
+ if (connect(sock, (struct sockaddr *) &server, sizeof(server)) < 0) {
+ perror("can't connect to server");
+ return -1;
+ }
+
+ return sock;
+}
+
+static void get_text(char *input, char *end, char *dest, int dlen)
+{
+ int state = 0; /* nothing yet, outside any element */
+ int cnt = 0;
+
+ while (*input) {
+ switch (state) {
+ case 0:
+ if (*input == '<')
+ state = 1;
+ else {
+ if (cnt < (dlen - 1))
+ dest[cnt++] = *input;
+ }
+ break;
+
+ case 1:
+ if (*input == '/')
+ state = 2;
+ else if (*input == '>')
+ state = 0;
+ break;
+
+ case 2:
+ if (strncasecmp(input, end, strlen(end)) == 0) {
+ dest[cnt++] = 0;
+ return;
+ }
+ break;
+ }
+
+ input++;
+ }
+
+}
+
+static void process_station_string(char *str)
+{
+ char *p, *q;
+ int last, i;
+
+ /* some strings to replace */
+ char *repl[] = {
+ "Hauptbahnhof", "Hbf.",
+ "Bahnhof", "Bhf.",
+ "Karlsruhe", "KA",
+ "Schienenersatzverkehr", "Ersatzv.",
+ "Marktplatz", "Marktpl.",
+ };
+
+ /* decode utf8 */
+ p = q = str;
+ last = 0;
+ while (*p) {
+ if (last) {
+ *q++ = (last << 6) | (*p & 0x3f);
+ last = 0;
+ } else if ((*p & 0xe0) == 0xc0) {
+ last = *p & 3;
+ } else
+ *q++ = *p;
+
+ p++;
+ }
+ *q++ = 0;
+
+ /* erase multiple spaces and replace umlauts */
+ p = q = str;
+ last = 1; /* no leading spaces */
+ while (*p) {
+ if ((!last) || (*p != ' ')) {
+
+ /* translate from latin1 to hd44780 */
+ if (*p == (char) 228) /* lower a umlaut */
+ *q++ = (char) 0xe1;
+ else if (*p == (char) 223) /* sz ligature */
+ *q++ = (char) 0xe2;
+ else if (*p == (char) 246) /* lower o umlaut */
+ *q++ = (char) 0xef;
+ else if (*p == (char) 252) /* lower u umlaut */
+ *q++ = (char) 0xf5;
+ else
+ *q++ = *p;
+ }
+
+ last = (*p == ' ');
+ p++;
+ }
+ *q++ = 0;
+
+ /* replace certain (long) words with e.g. abbreviations if enabled */
+ if (abbreviate) {
+
+ for (i = 0; i < (int) (sizeof(repl) / (2 * sizeof(char *))); i++) {
+ if ((p = strstr(str, repl[2 * i])) != NULL) {
+
+ /* move new string */
+ memcpy(p, repl[2 * i + 1], strlen(repl[2 * i + 1]));
+ /* move rest of string down */
+ memmove(p + strlen(repl[2 * i + 1]),
+ p + strlen(repl[2 * i]), strlen(str) - (p - str) - strlen(repl[2 * i]) + 1);
+ }
+ }
+ }
+}
+
+static void kvv_client( __attribute__ ((unused))
+ void *dummy)
+{
+ char ibuffer[8192];
+ char obuffer[1024];
+ int count, i, sock;
+
+ char server_name[] = HTTP_SERVER;
+ char *connect_to;
+
+ /* connect to proxy if given, to server otherwise */
+ if ((proxy_name != NULL) && (strlen(proxy_name) != 0))
+ connect_to = proxy_name;
+ else
+ connect_to = server_name;
+
+ info("[KVV] Connecting to %s", connect_to);
+
+ while (1) {
+
+ sock = http_open(connect_to);
+ if (sock < 0) {
+ error("[KVV] Error accessing server/proxy: %s", strerror(errno));
+ return;
+ }
+ /* create and set get request */
+ if (snprintf(obuffer, sizeof(obuffer),
+ "GET http://%s" HTTP_REQUEST " HTTP/1.1\n"
+ "Host: %s\n" "User-Agent: " USER_AGENT "\n\n", server_name, station_id,
+ server_name) >= (int) sizeof(obuffer)) {
+
+ info("[KVV] Warning, request has been truncated!");
+ }
+
+ info("[KVV] Sending first (GET) request ...");
+ send(sock, obuffer, strlen(obuffer), 0);
+
+ count = 0;
+ do {
+ fd_set rfds;
+ struct timeval tv;
+
+ FD_ZERO(&rfds);
+ FD_SET(sock, &rfds);
+
+ tv.tv_sec = count ? TIMEOUT_SHORT : TIMEOUT_LONG;
+ tv.tv_usec = 0;
+
+ i = select(FD_SETSIZE, &rfds, NULL, NULL, &tv);
+ if (i < 0) {
+ perror("select");
+ exit(1);
+ }
+
+ if (i != 0) {
+ i = recv(sock, ibuffer + count, sizeof(ibuffer) - count - 1, 0);
+ count += i;
+ }
+ }
+ while (i > 0);
+
+ ibuffer[count] = 0; /* terminate string */
+ close(sock);
+
+ if (!count)
+ info("[KVV] empty/no reply");
+
+ if (count > 0) {
+ char *input, *cookie, *name = NULL, *value = NULL;
+ int input_len, cookie_len, name_len, value_len;
+
+ /* buffer to html encode value */
+ char value_enc[512];
+ int value_enc_len;
+
+ /* find cookie */
+ cookie_len = 0;
+ cookie = strstr(ibuffer, "Set-Cookie:");
+ if (cookie) {
+ cookie += strlen("Set-Cookie:");
+
+ while (*cookie == ' ')
+ cookie++;
+
+ while (cookie[cookie_len] != ';')
+ cookie_len++;
+ }
+ /* find input element */
+ input_len = get_element(ibuffer, "input", &input);
+
+
+ if (input_len > 0) {
+ char *input_end = input;
+ while (*input_end != '>')
+ input_end++;
+ while (*input_end != '\"')
+ input_end--;
+ *(input_end + 1) = 0;
+
+ name_len = get_attrib(input, "name", &name);
+ value_len = get_attrib(input, "value", &value);
+
+ for (value_enc_len = 0, i = 0; i < value_len; i++) {
+ if (isalnum(value[i]))
+ value_enc[value_enc_len++] = value[i];
+ else {
+ sprintf(value_enc + value_enc_len, "%%%02X", 0xff & value[i]);
+ value_enc_len += 3;
+ }
+ }
+
+ if (cookie_len >= 0)
+ cookie[cookie_len] = 0;
+ if (name_len >= 0)
+ name[name_len] = 0;
+ if (value_len >= 0)
+ value[value_len] = 0;
+ if (value_enc_len >= 0)
+ value_enc[value_enc_len] = 0;
+
+ sock = http_open(connect_to);
+
+ /* send POST */
+ if (snprintf(obuffer, sizeof(obuffer),
+ "POST http://%s" HTTP_REQUEST " HTTP/1.1\n"
+ "Host: %s\n"
+ "User-Agent: " USER_AGENT "\n"
+ "Cookie: %s\n"
+ "Content-Type: application/x-www-form-urlencoded\n"
+ "Content-Length: %d\n"
+ "\n%s=%s",
+ server_name, station_id, server_name, cookie, name_len + value_enc_len + 1, name,
+ value_enc) >= (int) sizeof(obuffer)) {
+
+ info("[KVV] Warning, request has been truncated!");
+ }
+
+ info("[KVV] Sending second (POST) request ...");
+ send(sock, obuffer, strlen(obuffer), 0);
+
+ count = 0;
+ do {
+ fd_set rfds;
+ struct timeval tv;
+
+ FD_ZERO(&rfds);
+ FD_SET(sock, &rfds);
+
+ tv.tv_sec = count ? TIMEOUT_SHORT : TIMEOUT_LONG;
+ tv.tv_usec = 0;
+
+ i = select(FD_SETSIZE, &rfds, NULL, NULL, &tv);
+ if (i > 0) {
+ i = recv(sock, ibuffer + count, sizeof(ibuffer) - count - 1, 0);
+ count += i;
+ }
+ }
+ while (i > 0); /* leave on select or read error */
+
+ ibuffer[count] = 0;
+
+ /* printf("Result (%d):\n%s\n", count, ibuffer); */
+
+ /* close connection */
+ close(sock);
+
+ if (!count)
+ info("[KVV] empty/no reply");
+
+ if (count > 0) {
+ int last_was_stop = 0;
+ char *td = ibuffer;
+ char str[32];
+ int td_len, i, overflow = 0;
+
+ /* lock shared memory */
+ mutex_lock(mutex);
+
+ /* free allocated memory */
+ shm->entries = 0;
+
+ if (strstr(ibuffer, "Die Daten konnten nicht abgefragt werden.") != NULL) {
+ info("[KVV] Server returned error!");
+ /* printf("%s\n", ibuffer); */
+ shm->error = 1;
+ } else
+ shm->error = 0;
+
+ /* scan through all <td> entries and search the line nums */
+ do {
+ if ((td_len = get_element(td, "td", &td)) > 0) {
+ char *attr, *p;
+ int attr_len;
+
+ /* time does not have a class but comes immediately after stop :-( */
+ if (last_was_stop) {
+ td += td_len + 1;
+ get_text(td, "td", str, sizeof(str));
+
+ /* time needs special treatment */
+ if (strncasecmp(str, "sofort", strlen("sofort")) == 0)
+ i = 0;
+ else {
+ /* skip everything that is not a number */
+ p = str;
+ while (!isdigit(*p))
+ p++;
+
+ /* and convert remaining to number */
+ i = atoi(p);
+ }
+
+ /* save time */
+ if (!overflow)
+ shm->entry[shm->entries - 1].time = i;
+
+ last_was_stop = 0;
+ }
+
+ /* linenum and stopname fields have proper classes */
+ if ((attr_len = get_attrib(td, "class", &attr)) > 0) {
+
+ if (strncasecmp(attr, "lineNum", strlen("lineNum")) == 0) {
+ td += td_len + 1;
+ get_text(td, "td", str, sizeof(str));
+
+ if (shm->entries < MAX_LINES) {
+ /* allocate a new slot */
+ shm->entries++;
+ shm->entry[shm->entries - 1].time = -1;
+ memset(shm->entry[shm->entries - 1].line, 0, MAX_LINE_LENGTH + 1);
+ memset(shm->entry[shm->entries - 1].station, 0, MAX_STATION_LENGTH + 1);
+
+ /* add new lines entry */
+ strncpy(shm->entry[shm->entries - 1].line, str, MAX_LINE_LENGTH);
+ } else
+ overflow = 1; /* don't add further entries */
+ }
+
+ if (strncasecmp(attr, "stopname", strlen("stopname")) == 0) {
+ td += td_len + 1;
+ get_text(td, "td", str, sizeof(str));
+
+
+ /* stopname may need further tuning */
+ process_station_string(str);
+
+ if (!overflow)
+ strncpy(shm->entry[shm->entries - 1].station, str, MAX_STATION_LENGTH);
+
+ last_was_stop = 1;
+ }
+ }
+ }
+ } while (td_len >= 0);
+
+ mutex_unlock(mutex);
+ }
+ }
+ }
+
+ sleep(refresh);
+ }
+}
+
+static int kvv_fork(void)
+{
+ if (initialized)
+ return 0;
+
+ info("[KVV] creating client thread");
+
+ /* set this here to prevent continous retries if init fails */
+ initialized = 1;
+
+ /* create communication buffer */
+ shmid = shm_create((void **) &shm, sizeof(kvv_shm_t));
+
+ /* catch error */
+ if (shmid < 0) {
+ error("[KVV] Shared memory allocation failed!");
+ return -1;
+ }
+
+ /* attach client thread */
+ mutex = mutex_create();
+ pid = thread_create("plugin_kvv", kvv_client, NULL);
+
+ if (pid < 0) {
+ error("[KVV] Unable to fork client: %s", strerror(errno));
+ return -1;
+ }
+
+ info("[KVV] forked client with pid %d", pid);
+ return 0;
+}
+
+static void kvv_start(void)
+{
+ static int started = 0;
+ int val;
+ char *p;
+
+
+ if (started)
+ return;
+
+ started = 1;
+
+ /* parse parameter */
+ if ((p = cfg_get(SECTION, "StationID", DEFAULT_STATION_ID)) != NULL) {
+ station_id = malloc(strlen(p) + 1);
+ strcpy(station_id, p);
+ }
+ info("[KVV] Using station %s", station_id);
+
+ if ((p = cfg_get(SECTION, "Proxy", NULL)) != NULL) {
+ proxy_name = malloc(strlen(p) + 1);
+ strcpy(proxy_name, p);
+ info("[KVV] Using proxy \"%s\"", proxy_name);
+ }
+
+ if (cfg_number(SECTION, "Port", 0, 0, 65535, &val) > 0) {
+ port = val;
+ info("[KVV] Using port %d", port);
+ } else {
+ info("[KVV] Using default port %d", port);
+ }
+
+ if (cfg_number(SECTION, "Refresh", 0, 0, 65535, &val) > 0) {
+ refresh = val;
+ info("[KVV] Using %d seconds refresh interval", refresh);
+ } else {
+ info("[KVV] Using default refresh interval of %d seconds", refresh);
+ }
+
+ if (cfg_number(SECTION, "Abbreviate", 0, 0, 65535, &val) > 0) {
+ abbreviate = val;
+ info("[KVV] Abbreviation enabled: %s", abbreviate ? "on" : "off");
+ } else {
+ info("[KVV] Default abbreviation setting: %s", abbreviate ? "on" : "off");
+ }
+
+}
+
+static void kvv_line(RESULT * result, RESULT * arg1)
+{
+ int index = (int) R2N(arg1);
+
+ kvv_start();
+
+ if (kvv_fork() != 0) {
+ SetResult(&result, R_STRING, "");
+ return;
+ }
+
+ mutex_lock(mutex);
+
+ if (index < shm->entries) {
+ SetResult(&result, R_STRING, shm->entry[index].line);
+ } else
+ SetResult(&result, R_STRING, "");
+
+ mutex_unlock(mutex);
+}
+
+static void kvv_station(RESULT * result, RESULT * arg1)
+{
+ int index = (int) R2N(arg1);
+
+ kvv_start();
+
+ if (kvv_fork() != 0) {
+ SetResult(&result, R_STRING, "");
+ return;
+ }
+
+ mutex_lock(mutex);
+
+ if (shm->error && index == 0)
+ SetResult(&result, R_STRING, "Server Err");
+ else {
+ if (index < shm->entries)
+ SetResult(&result, R_STRING, shm->entry[index].station);
+ else
+ SetResult(&result, R_STRING, "");
+ }
+
+ mutex_unlock(mutex);
+}
+
+static void kvv_time(RESULT * result, RESULT * arg1)
+{
+ int index = (int) R2N(arg1);
+ double value = -1.0;
+
+ kvv_start();
+
+ if (kvv_fork() != 0) {
+ SetResult(&result, R_STRING, "");
+ return;
+ }
+
+ mutex_lock(mutex);
+
+ if (index < shm->entries)
+ value = shm->entry[index].time;
+
+ SetResult(&result, R_NUMBER, &value);
+
+ mutex_unlock(mutex);
+}
+
+static void kvv_time_str(RESULT * result, RESULT * arg1)
+{
+ int index = (int) R2N(arg1);
+
+ kvv_start();
+
+ if (kvv_fork() != 0) {
+ SetResult(&result, R_STRING, "");
+ return;
+ }
+
+ mutex_lock(mutex);
+
+ if (index < shm->entries) {
+ char str[8];
+ sprintf(str, "%d", shm->entry[index].time);
+ SetResult(&result, R_STRING, str);
+ } else
+ SetResult(&result, R_STRING, "");
+
+ mutex_unlock(mutex);
+}
+
+/* plugin initialization */
+int plugin_init_kvv(void)
+{
+ /* register all our cool functions */
+ AddFunction("kvv::line", 1, kvv_line);
+ AddFunction("kvv::station", 1, kvv_station);
+ AddFunction("kvv::time", 1, kvv_time);
+ AddFunction("kvv::time_str", 1, kvv_time_str);
+ return 0;
+}
+
+void plugin_exit_kvv(void)
+{
+ /* kill client thread if it's running */
+ if (initialized) {
+ /* kill client */
+ if (pid != -1)
+ thread_destroy(pid);
+
+ /* free shared mem and its mutex */
+ if (shm) {
+ shm_destroy(shmid, shm);
+ mutex_destroy(mutex);
+ }
+ }
+
+ if (station_id)
+ free(station_id);
+ if (proxy_name)
+ free(proxy_name);
+}
diff --git a/plugin_loadavg.c b/plugin_loadavg.c
new file mode 100644
index 0000000..4f366a8
--- /dev/null
+++ b/plugin_loadavg.c
@@ -0,0 +1,141 @@
+/* $Id: plugin_loadavg.c 840 2007-09-09 12:17:42Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/plugin_loadavg.c $
+ *
+ * plugin for load average
+ *
+ * Copyright (C) 2003 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ * exported functions:
+ *
+ * int plugin_init_loadavg (void)
+ * adds functions for load average
+ *
+ */
+
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/time.h>
+#include <fcntl.h>
+
+#include "debug.h"
+#include "plugin.h"
+
+#ifndef HAVE_GETLOADAVG
+static int fd = -2;
+
+int getloadavg(double loadavg[], int nelem)
+{
+ char buf[65], *p;
+ ssize_t nread;
+ int i;
+
+ if (fd == -2)
+ fd = open("/proc/loadavg", O_RDONLY);
+ if (fd < 0)
+ return -1;
+
+ lseek(fd, 0, SEEK_SET);
+ nread = read(fd, buf, sizeof buf - 1);
+
+ if (nread < 0)
+ return -1;
+ buf[nread - 1] = '\0';
+
+ if (nelem > 3)
+ nelem = 3;
+ p = buf;
+ for (i = 0; i < nelem; ++i) {
+ char *endp;
+ loadavg[i] = strtod(p, &endp);
+ if (endp == NULL || endp == p)
+ /* This should not happen. The format of /proc/loadavg
+ must have changed. Don't return with what we have,
+ signal an error. */
+ return -1;
+ p = endp;
+ }
+
+ return i;
+}
+
+#endif
+
+
+static void my_loadavg(RESULT * result, RESULT * arg1)
+{
+ static int nelem = -1;
+ int index, age;
+ static double loadavg[3];
+ static struct timeval last_value;
+ struct timeval now;
+
+ gettimeofday(&now, NULL);
+
+ age = (now.tv_sec - last_value.tv_sec) * 1000 + (now.tv_usec - last_value.tv_usec) / 1000;
+ /* reread every 10 msec only */
+ if (nelem == -1 || age == 0 || age > 10) {
+
+ nelem = getloadavg(loadavg, 3);
+ if (nelem < 0) {
+ error("getloadavg() failed!");
+ SetResult(&result, R_STRING, "");
+ return;
+ }
+ last_value = now;
+ }
+
+ index = R2N(arg1);
+ if (index < 1 || index > nelem) {
+ error("loadavg(%d): index out of range!", index);
+ SetResult(&result, R_STRING, "");
+ return;
+ }
+
+
+ SetResult(&result, R_NUMBER, &(loadavg[index - 1]));
+ return;
+
+}
+
+int plugin_init_loadavg(void)
+{
+ AddFunction("loadavg", 1, my_loadavg);
+ return 0;
+}
+
+void plugin_exit_loadavg(void)
+{
+#ifndef HAVE_GETLOADAVG
+ if (fd > 0)
+ close(fd);
+ fd = -2;
+#endif
+}
diff --git a/plugin_math.c b/plugin_math.c
new file mode 100644
index 0000000..ee589fd
--- /dev/null
+++ b/plugin_math.c
@@ -0,0 +1,169 @@
+/* $Id: plugin_math.c 840 2007-09-09 12:17:42Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/plugin_math.c $
+ *
+ * math plugin
+ *
+ * Copyright (C) 2003 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ * exported functions:
+ *
+ * int plugin_init_math (void)
+ * adds some handy constants and functions
+ *
+ */
+
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <math.h>
+
+#include "debug.h"
+#include "plugin.h"
+
+
+static void my_sqrt(RESULT * result, RESULT * arg1)
+{
+ double value = sqrt(R2N(arg1));
+ SetResult(&result, R_NUMBER, &value);
+}
+
+static void my_exp(RESULT * result, RESULT * arg1)
+{
+ double value = exp(R2N(arg1));
+ SetResult(&result, R_NUMBER, &value);
+}
+
+static void my_ln(RESULT * result, RESULT * arg1)
+{
+ double value = log(R2N(arg1));
+ SetResult(&result, R_NUMBER, &value);
+}
+
+static void my_log(RESULT * result, RESULT * arg1)
+{
+ double value = log10(R2N(arg1));
+ SetResult(&result, R_NUMBER, &value);
+}
+
+static void my_sin(RESULT * result, RESULT * arg1)
+{
+ double value = sin(R2N(arg1));
+ SetResult(&result, R_NUMBER, &value);
+}
+
+static void my_cos(RESULT * result, RESULT * arg1)
+{
+ double value = cos(R2N(arg1));
+ SetResult(&result, R_NUMBER, &value);
+}
+
+static void my_tan(RESULT * result, RESULT * arg1)
+{
+ double value = tan(R2N(arg1));
+ SetResult(&result, R_NUMBER, &value);
+}
+
+
+static void my_min(RESULT * result, RESULT * arg1, RESULT * arg2)
+{
+ double a1 = R2N(arg1);
+ double a2 = R2N(arg2);
+ double value = a1 < a2 ? a1 : a2;
+ SetResult(&result, R_NUMBER, &value);
+}
+
+static void my_max(RESULT * result, RESULT * arg1, RESULT * arg2)
+{
+ double a1 = R2N(arg1);
+ double a2 = R2N(arg2);
+ double value = a1 > a2 ? a1 : a2;
+ SetResult(&result, R_NUMBER, &value);
+}
+
+static void my_floor(RESULT * result, RESULT * arg)
+{
+ double value = floor(R2N(arg));
+ SetResult(&result, R_NUMBER, &value);
+}
+
+static void my_ceil(RESULT * result, RESULT * arg)
+{
+ double value = ceil(R2N(arg));
+ SetResult(&result, R_NUMBER, &value);
+}
+
+static void my_decode(RESULT * result, int argc, RESULT * argv[])
+{
+ int index;
+
+ if (argc < 2) {
+ error("decode(): wrong number of parameters");
+ SetResult(&result, R_STRING, "");
+ return;
+ }
+
+ index = R2N(argv[0]);
+
+ if (index < 0 || index >= argc - 1) {
+ SetResult(&result, R_STRING, "");
+ return;
+ }
+
+ CopyResult(&result, argv[index + 1]);
+}
+
+
+int plugin_init_math(void)
+{
+ /* set some handy constants */
+ SetVariableNumeric("Pi", M_PI);
+ SetVariableNumeric("e", M_E);
+
+ /* register some basic math functions */
+ AddFunction("sqrt", 1, my_sqrt);
+ AddFunction("exp", 1, my_exp);
+ AddFunction("ln", 1, my_ln);
+ AddFunction("log", 1, my_log);
+ AddFunction("sin", 1, my_sin);
+ AddFunction("cos", 1, my_cos);
+ AddFunction("tan", 1, my_tan);
+
+ /* min, max */
+ AddFunction("min", 2, my_min);
+ AddFunction("max", 2, my_max);
+
+ /* floor, ceil */
+ AddFunction("floor", 1, my_floor);
+ AddFunction("ceil", 1, my_ceil);
+
+ /* decode */
+ AddFunction("decode", -1, my_decode);
+
+ return 0;
+}
+
+void plugin_exit_math(void)
+{
+}
diff --git a/plugin_meminfo.c b/plugin_meminfo.c
new file mode 100644
index 0000000..b7af6dc
--- /dev/null
+++ b/plugin_meminfo.c
@@ -0,0 +1,137 @@
+/* $Id: plugin_meminfo.c 840 2007-09-09 12:17:42Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/plugin_meminfo.c $
+ *
+ * plugin for /proc/meminfo parsing
+ *
+ * Copyright (C) 2003 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ * exported functions:
+ *
+ * int plugin_init_meminfo (void)
+ * adds functions to access /proc/meminfo
+ *
+ */
+
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+#include <errno.h>
+
+#include "debug.h"
+#include "plugin.h"
+
+#include "hash.h"
+
+
+static HASH MemInfo;
+static FILE *stream = NULL;
+
+static int parse_meminfo(void)
+{
+ int age;
+
+ /* reread every 10 msec only */
+ age = hash_age(&MemInfo, NULL);
+ if (age > 0 && age <= 10)
+ return 0;
+
+ if (stream == NULL)
+ stream = fopen("/proc/meminfo", "r");
+ if (stream == NULL) {
+ error("fopen(/proc/meminfo) failed: %s", strerror(errno));
+ return -1;
+ }
+
+ rewind(stream);
+ while (!feof(stream)) {
+ char buffer[256];
+ char *c, *key, *val;
+ fgets(buffer, sizeof(buffer), stream);
+ c = strchr(buffer, ':');
+ if (c == NULL)
+ continue;
+ key = buffer;
+ val = c + 1;
+ /* strip leading blanks from key */
+ while (isspace(*key))
+ *key++ = '\0';
+ /* strip trailing blanks from key */
+ do
+ *c = '\0';
+ while (isspace(*--c));
+ /* strip leading blanks from value */
+ while (isspace(*val))
+ *val++ = '\0';
+ /* strip trailing blanks from value */
+ for (c = val; *c != '\0'; c++);
+ while (isspace(*--c))
+ *c = '\0';
+ /* skip lines that do not end with " kB" */
+ if (*c == 'B' && *(c - 1) == 'k' && *(c - 2) == ' ') {
+ /* strip trailing " kB" from value */
+ *(c - 2) = '\0';
+ /* add entry to hash table */
+ hash_put(&MemInfo, key, val);
+ }
+ }
+ return 0;
+}
+
+static void my_meminfo(RESULT * result, RESULT * arg1)
+{
+ char *key, *val;
+
+ if (parse_meminfo() < 0) {
+ SetResult(&result, R_STRING, "");
+ return;
+ }
+
+ key = R2S(arg1);
+ val = hash_get(&MemInfo, key, NULL);
+ if (val == NULL)
+ val = "";
+
+ SetResult(&result, R_STRING, val);
+}
+
+
+int plugin_init_meminfo(void)
+{
+ hash_create(&MemInfo);
+ AddFunction("meminfo", 1, my_meminfo);
+ return 0;
+}
+
+
+void plugin_exit_meminfo(void)
+{
+ if (stream != NULL) {
+ fclose(stream);
+ stream = NULL;
+ }
+ hash_destroy(&MemInfo);
+}
diff --git a/plugin_mpd.c b/plugin_mpd.c
new file mode 100644
index 0000000..8a4077a
--- /dev/null
+++ b/plugin_mpd.c
@@ -0,0 +1,931 @@
+/* $Id: plugin_mpd.c 1150 2011-07-27 02:53:04Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/plugin_mpd.c $
+ *
+ * mpd informations v0.82
+ *
+ * Copyright (C) 2006 Stefan Kuhne <sk-privat@gmx.net>
+ * Copyright (C) 2007 Robert Buchholz <rbu@gentoo.org>
+ * Copyright (C) 2008 Michael Vogt <michu@neophob.com>
+ * Copyright (C) 2006 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ * changelog v0.5 (20.11.2007):
+ * changed: mpd::artist(), mpd::title(), mpd::album()
+ * init code, call only if a function is used.
+ * removed: "old style" functions, duplicate code
+ * fixed: strdup() mem leaks
+ * added: getstate, function which return player status: play/pause/stop
+ * getVolume, funtcion which returns the mpd volume
+ * getFilename, return current filename
+ *
+ *
+ * changelog v0.6 (05.12.2007):
+ * changed: -connection handling
+ * -verbose "NO TAG" messages
+ * -init code
+ * added: -added password support (MPD_PASSWORD env variable)
+ * -mpd::getSongsInDb - how many songs are in the mpd db?
+ * -mpd::getMpdUptime - uptime of mpd
+ * -mpd::getMpdPlayTime - playtime of mpd
+ * -mpd::getMpdDbPlayTime - playtime of all songs in mpd db
+ * -basic error handler..
+ * -mpd configuration in lcd4linux.conf
+ * -formatTime* - use those functions to format time values
+ * removed: -reprand method
+ *
+ *
+ * changelog v0.7 (14.12.2007):
+ * changed: -connection handling improved, do not disconnect/reconnect for each query
+ * -> uses less ressources
+ *
+ * changelog v0.8 (30.01.2008):
+ * changed: -libmpd is not needed anymore, use libmpdclient.c instead
+ * fixed: -getMpdUptime()
+ * -getMpdPlaytime()
+ * -type definition
+ * added: -mpd::getSamplerateHz
+ * -getAudioChannels
+ *
+ * changelog v0.83 (26.07.2008):
+ * added: -mpd::cmd* commands
+ *
+ */
+
+/*
+
+TODO:
+ -what happens if the db is updating?
+
+*/
+
+#include "config.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <signal.h>
+
+#include "debug.h"
+#include "plugin.h"
+#include "cfg.h"
+/* struct timeval */
+#include <sys/time.h>
+
+#include <locale.h>
+#include <langinfo.h>
+#include <iconv.h>
+
+/* source: http://www.musicpd.org/libmpdclient.shtml */
+#include "mpd/client.h"
+
+#ifdef WITH_DMALLOC
+#include <dmalloc.h>
+#endif
+
+#define TIMEOUT_IN_S 10
+#define ERROR_DISPLAY 5
+
+/* current song */
+
+static int l_totalTimeSec;
+static int l_elapsedTimeSec;
+static int l_bitRate;
+static int l_repeatEnabled;
+static int l_randomEnabled;
+static int l_singleEnabled;
+static int l_consumeEnabled;
+static int l_state;
+static int l_volume;
+static int l_numberOfSongs;
+static unsigned long l_uptime;
+static unsigned long l_playTime;
+static unsigned long l_dbPlayTime;
+static int l_playlistLength;
+/* pos in playlist */
+static int l_currentSongPos;
+static unsigned int l_sampleRate;
+static int l_channels;
+
+static struct mpd_song *currentSong;
+
+/* connection information */
+static char host[255];
+static char pw[255];
+static int iport;
+static int plugin_enabled;
+static int waittime;
+struct timeval timestamp;
+
+static struct mpd_connection *conn;
+static char Section[] = "Plugin:MPD";
+static int errorcnt = 0;
+
+static iconv_t char_conv_iconv;
+static char *char_conv_to;
+static char *char_conv_from;
+
+#define BUFFER_SIZE 1024
+
+static void charset_close(void)
+{
+ if (char_conv_to) {
+ iconv_close(char_conv_iconv);
+ free(char_conv_to);
+ free(char_conv_from);
+ char_conv_to = NULL;
+ char_conv_from = NULL;
+ }
+}
+
+static int charset_set(const char *to, const char *from)
+{
+ if (char_conv_to && strcmp(to, char_conv_to) == 0 && char_conv_from && strcmp(from, char_conv_from) == 0)
+ return 0;
+
+ charset_close();
+
+ if ((char_conv_iconv = iconv_open(to, from)) == (iconv_t) (-1))
+ return -1;
+
+ char_conv_to = strdup(to);
+ char_conv_from = strdup(from);
+ return 0;
+}
+
+static inline size_t deconst_iconv(iconv_t cd,
+ const char **inbuf, size_t * inbytesleft, char **outbuf, size_t * outbytesleft)
+{
+ union {
+ const char **a;
+ char **b;
+ } deconst;
+
+ deconst.a = inbuf;
+
+ return iconv(cd, deconst.b, inbytesleft, outbuf, outbytesleft);
+}
+
+static char *charset_conv_strdup(const char *string)
+{
+ char buffer[BUFFER_SIZE];
+ size_t inleft = strlen(string);
+ char *ret;
+ size_t outleft;
+ size_t retlen = 0;
+ size_t err;
+ char *bufferPtr;
+
+ if (!char_conv_to)
+ return NULL;
+
+ ret = strdup("");
+
+ while (inleft) {
+ bufferPtr = buffer;
+ outleft = BUFFER_SIZE;
+ err = deconst_iconv(char_conv_iconv, &string, &inleft, &bufferPtr, &outleft);
+ if (outleft == BUFFER_SIZE || (err == (size_t) - 1 /* && errno != E2BIG */ )) {
+ free(ret);
+ return NULL;
+ }
+
+ ret = realloc(ret, retlen + BUFFER_SIZE - outleft + 1);
+ memcpy(ret + retlen, buffer, BUFFER_SIZE - outleft);
+ retlen += BUFFER_SIZE - outleft;
+ ret[retlen] = '\0';
+ }
+
+ return ret;
+}
+
+const char *charset_from_utf8(const char *from)
+{
+ static char *to = NULL;
+
+ if (to)
+ free(to);
+
+ charset_set("ISO−8859−1", "UTF-8");
+ to = charset_conv_strdup(from);
+
+ if (to == NULL)
+ return from;
+
+ return to;
+}
+
+static int configure_mpd(void)
+{
+ static int configured = 0;
+
+ char *s;
+
+ if (configured != 0)
+ return configured;
+
+ /* read enabled */
+ if (cfg_number(Section, "enabled", 0, 0, 1, &plugin_enabled) < 1) {
+ plugin_enabled = 0;
+ }
+
+ if (plugin_enabled != 1) {
+ info("[MPD] WARNING: Plugin is not enabled! (set 'enabled 1' to enable this plugin)");
+ configured = 1;
+ return configured;
+ }
+
+ /* read server */
+ s = cfg_get(Section, "server", "localhost");
+ if (!s || *s == '\0') {
+ info("[MPD] empty '%s.server' entry from %s, assuming 'localhost'", Section, cfg_source());
+ strcpy(host, "localhost");
+ } else
+ strcpy(host, s);
+ if (s)
+ free(s);
+
+ /* read port */
+ if (cfg_number(Section, "port", 6600, 1, 65536, &iport) < 1) {
+ info("[MPD] no '%s.port' entry from %s using MPD's default", Section, cfg_source());
+ }
+
+ /* read minUpdateTime in ms */
+ if (cfg_number(Section, "minUpdateTime", 500, 1, 10000, &waittime) < 1) {
+ info("[MPD] no '%s.minUpdateTime' entry from %s using MPD's default", Section, cfg_source());
+ }
+
+
+ /* read password */
+ s = cfg_get(Section, "password", "");
+ if (!s || *s == '\0') {
+ info("[MPD] empty '%s.password' entry in %s, assuming none", Section, cfg_source());
+ memset(pw, 0, sizeof(pw));
+ } else
+ strcpy(pw, s);
+ if (s)
+ free(s);
+
+ debug("[MPD] connection detail: [%s:%d]", host, iport);
+ configured = 1;
+ return configured;
+}
+
+
+static void mpd_printerror(const char *cmd)
+{
+ const char *s;
+ if (conn) {
+ //assert(mpd_connection_get_error(conn) != MPD_ERROR_SUCCESS);
+
+ s = mpd_connection_get_error_message(conn);
+ if (mpd_connection_get_error(conn) == MPD_ERROR_SERVER)
+ /* messages received from the server are UTF-8; the
+ rest is either US-ASCII or locale */
+ s = charset_from_utf8(s);
+
+ error("[MPD] %s to [%s]:[%i] failed : [%s]", cmd, host, iport, s);
+ mpd_connection_free(conn);
+ conn = NULL;
+ }
+}
+
+void mpd_query_status(struct mpd_connection *conn)
+{
+ struct mpd_status *status;
+ struct mpd_song *song;
+ const struct mpd_audio_format *audio;
+
+ if (!conn)
+ return;
+
+ if (!mpd_command_list_begin(conn, true) ||
+ !mpd_send_status(conn) || !mpd_send_current_song(conn) || !mpd_command_list_end(conn)) {
+ mpd_printerror("queue_commands");
+ return;
+ }
+
+ status = mpd_recv_status(conn);
+ if (status == NULL) {
+ mpd_printerror("recv_status");
+ return;
+ }
+ if (currentSong != NULL) {
+ mpd_song_free(currentSong);
+ currentSong = NULL;
+ }
+
+ if (!mpd_response_next(conn)) {
+ mpd_printerror("response_next");
+ return;
+ }
+
+ song = mpd_recv_song(conn);
+ if (song != NULL) {
+ currentSong = mpd_song_dup(song);
+ mpd_song_free(song);
+
+ l_elapsedTimeSec = mpd_status_get_elapsed_time(status);
+ l_totalTimeSec = mpd_status_get_total_time(status);
+ l_bitRate = mpd_status_get_kbit_rate(status);
+ } else {
+ l_elapsedTimeSec = 0;
+ l_totalTimeSec = 0;
+ l_bitRate = 0;
+ }
+ l_state = mpd_status_get_state(status);
+
+ l_repeatEnabled = mpd_status_get_repeat(status);
+ l_randomEnabled = mpd_status_get_random(status);
+ l_singleEnabled = mpd_status_get_single(status);
+ l_consumeEnabled = mpd_status_get_consume(status);
+
+ l_volume = mpd_status_get_volume(status);
+
+ l_currentSongPos = mpd_status_get_song_pos(status) + 1;
+ l_playlistLength = mpd_status_get_queue_length(status);
+
+
+ audio = mpd_status_get_audio_format(status);
+ if (audio) {
+ l_sampleRate = audio->sample_rate;
+ l_channels = audio->channels;
+ } else {
+ l_sampleRate = 0;
+ l_channels = 0;
+ }
+
+ if (mpd_status_get_error(status) != NULL)
+ error("[MPD] query status : %s", charset_from_utf8(mpd_status_get_error(status)));
+
+ mpd_status_free(status);
+
+ if (!mpd_response_finish(conn)) {
+ mpd_printerror("response_finish");
+ return;
+ }
+}
+
+void mpd_query_stats(struct mpd_connection *conn)
+{
+ struct mpd_stats *stats;
+
+ if (!conn)
+ return;
+
+ if (!mpd_command_list_begin(conn, true) || !mpd_send_stats(conn) || !mpd_command_list_end(conn)) {
+ mpd_printerror("queue_commands");
+ return;
+ }
+
+ stats = mpd_recv_stats(conn);
+ if (stats == NULL) {
+ mpd_printerror("recv_stats");
+ return;
+ }
+
+ l_numberOfSongs = mpd_stats_get_number_of_songs(stats);
+ l_uptime = mpd_stats_get_uptime(stats);
+ l_playTime = mpd_stats_get_play_time(stats);
+ l_dbPlayTime = mpd_stats_get_db_play_time(stats);
+
+ mpd_stats_free(stats);
+
+ if (!mpd_response_finish(conn)) {
+ mpd_printerror("response_finish");
+ return;
+ }
+}
+
+static int mpd_update()
+{
+ struct timeval now;
+
+ /* reread every 1000 msec only */
+ gettimeofday(&now, NULL);
+ int timedelta = (now.tv_sec - timestamp.tv_sec) * 1000 + (now.tv_usec - timestamp.tv_usec) / 1000;
+
+ if (timedelta > 0 && timedelta < waittime) {
+ /* debug("[MPD] waittime not reached...\n"); */
+ return 1;
+ }
+
+ /* check if configured */
+ if (configure_mpd() < 0) {
+ return -1;
+ }
+
+ /* check if connected */
+ if (conn == NULL || mpd_connection_get_error(conn) != MPD_ERROR_SUCCESS) {
+ if (conn) {
+ if (errorcnt < ERROR_DISPLAY)
+ mpd_printerror("reconnect");
+ } else
+ debug("[MPD] initialize connect to [%s]:[%i]", host, iport);
+ }
+ if (!conn) {
+ conn = mpd_connection_new(host, iport, TIMEOUT_IN_S * 1000);
+ if (conn == NULL || mpd_connection_get_error(conn) != MPD_ERROR_SUCCESS) {
+ if (conn) {
+ if (errorcnt < ERROR_DISPLAY)
+ mpd_printerror("connect");
+ }
+ if (errorcnt == ERROR_DISPLAY)
+ error("[MPD] stop logging, until connection is fixed!");
+ errorcnt++;
+ gettimeofday(&timestamp, NULL);
+ return -1;
+ }
+
+ if (*pw && !mpd_run_password(conn, pw)) {
+ errorcnt++;
+ mpd_printerror("run_password");
+ return -1;
+ }
+ errorcnt = 0;
+ debug("[MPD] connection fixed...");
+ }
+
+ mpd_query_status(conn);
+ mpd_query_stats(conn);
+
+ gettimeofday(&timestamp, NULL);
+ return 1;
+}
+
+
+static void elapsedTimeSec(RESULT * result)
+{
+ double d;
+ mpd_update();
+ d = (double) l_elapsedTimeSec;
+ SetResult(&result, R_NUMBER, &d);
+}
+
+
+static void totalTimeSec(RESULT * result)
+{
+ double d;
+ mpd_update();
+ d = (double) l_totalTimeSec;
+ SetResult(&result, R_NUMBER, &d);
+}
+
+static void bitRate(RESULT * result)
+{
+ double d;
+ mpd_update();
+ d = (double) l_bitRate;
+ SetResult(&result, R_NUMBER, &d);
+}
+
+
+static void getRepeatInt(RESULT * result)
+{
+ double d;
+ mpd_update();
+ d = (double) l_repeatEnabled;
+ SetResult(&result, R_NUMBER, &d);
+}
+
+
+static void getRandomInt(RESULT * result)
+{
+ double d;
+ mpd_update();
+ d = (double) l_randomEnabled;
+ SetResult(&result, R_NUMBER, &d);
+}
+
+static void getSingleInt(RESULT * result)
+{
+ double d;
+ mpd_update();
+ d = (double) l_singleEnabled;
+ SetResult(&result, R_NUMBER, &d);
+}
+
+static void getConsumeInt(RESULT * result)
+{
+ double d;
+ mpd_update();
+ d = (double) l_consumeEnabled;
+ SetResult(&result, R_NUMBER, &d);
+}
+
+/* if no tag is availabe, use filename */
+static void getArtist(RESULT * result)
+{
+ const char *value = NULL;
+ mpd_update();
+ if (currentSong != NULL) {
+ value = mpd_song_get_tag(currentSong, MPD_TAG_ARTIST, 0);
+ if (!value) {
+ value = mpd_song_get_tag(currentSong, MPD_TAG_ALBUM_ARTIST, 0);
+ }
+ if (!value) {
+ value = mpd_song_get_uri(currentSong);
+ }
+ }
+ if (value)
+ SetResult(&result, R_STRING, charset_from_utf8(value));
+ else
+ SetResult(&result, R_STRING, "");
+}
+
+static void getTitle(RESULT * result)
+{
+ const char *value = NULL;
+ mpd_update();
+ if (currentSong != NULL) {
+ value = mpd_song_get_tag(currentSong, MPD_TAG_TITLE, 0);
+ }
+ if (value)
+ SetResult(&result, R_STRING, charset_from_utf8(value));
+ else
+ SetResult(&result, R_STRING, "");
+}
+
+static void getAlbum(RESULT * result)
+{
+ const char *value = NULL;
+ mpd_update();
+ if (currentSong != NULL) {
+ value = mpd_song_get_tag(currentSong, MPD_TAG_ALBUM, 0);
+ }
+ if (value)
+ SetResult(&result, R_STRING, charset_from_utf8(value));
+ else
+ SetResult(&result, R_STRING, "");
+}
+
+static void getFilename(RESULT * result)
+{
+ const char *value = NULL;
+ mpd_update();
+ if (currentSong != NULL) {
+ value = mpd_song_get_uri(currentSong);
+ }
+ if (value)
+ SetResult(&result, R_STRING, charset_from_utf8(value));
+ else
+ SetResult(&result, R_STRING, "");
+}
+
+/*
+ return player state:
+ 0=unknown
+ 1=play
+ 2=pause
+ 3=stop
+*/
+static void getStateInt(RESULT * result)
+{
+ double ret;
+
+ mpd_update();
+
+ switch (l_state) {
+ case MPD_STATE_PLAY:
+ ret = 1;
+ break;
+ case MPD_STATE_PAUSE:
+ ret = 2;
+ break;
+ case MPD_STATE_STOP:
+ ret = 3;
+ break;
+ default:
+ ret = 0;
+ break;
+ }
+
+ SetResult(&result, R_NUMBER, &ret);
+}
+
+
+static void getVolume(RESULT * result)
+{
+ double d;
+ mpd_update();
+ d = (double) l_volume;
+ /* return 0..100 or < 0 when failed */
+ SetResult(&result, R_NUMBER, &d);
+}
+
+/* return the # of songs in the mpd db .. */
+static void getSongsInDb(RESULT * result)
+{
+ double d;
+ mpd_update();
+ d = (double) l_numberOfSongs;
+ SetResult(&result, R_NUMBER, &d);
+}
+
+static void getMpdUptime(RESULT * result)
+{
+ double d;
+ mpd_update();
+ d = (double) l_uptime;
+ SetResult(&result, R_NUMBER, &d);
+}
+
+static void getMpdPlayTime(RESULT * result)
+{
+ double d;
+ mpd_update();
+ d = (double) l_playTime;
+ SetResult(&result, R_NUMBER, &d);
+}
+
+static void getMpdDbPlayTime(RESULT * result)
+{
+ double d;
+ mpd_update();
+ d = (double) l_dbPlayTime;
+ SetResult(&result, R_NUMBER, &d);
+}
+
+static void getMpdPlaylistLength(RESULT * result)
+{
+ double d;
+ mpd_update();
+ d = (double) l_playlistLength;
+ SetResult(&result, R_NUMBER, &d);
+}
+
+static void getCurrentSongPos(RESULT * result)
+{
+ double d;
+ mpd_update();
+ d = (double) l_currentSongPos;
+ SetResult(&result, R_NUMBER, &d);
+}
+
+static void getAudioChannels(RESULT * result)
+{
+ double d;
+ mpd_update();
+ d = (double) l_channels;
+ SetResult(&result, R_NUMBER, &d);
+}
+
+static void getSamplerateHz(RESULT * result)
+{
+ double d;
+ mpd_update();
+ d = (double) l_sampleRate;
+ SetResult(&result, R_NUMBER, &d);
+}
+
+
+static void nextSong()
+{
+ mpd_update();
+ if (currentSong != NULL) {
+ if ((!mpd_run_next(conn))
+ || (!mpd_response_finish(conn))) {
+ mpd_printerror("run_next");
+ }
+ }
+}
+
+static void prevSong()
+{
+ mpd_update();
+ if (currentSong != NULL) {
+ if ((!mpd_run_previous(conn))
+ || (!mpd_response_finish(conn))) {
+ mpd_printerror("run_previous");
+ }
+ }
+}
+
+static void stopSong()
+{
+ mpd_update();
+ if (currentSong != NULL) {
+ if ((!mpd_run_stop(conn))
+ || (!mpd_response_finish(conn))) {
+ mpd_printerror("run_stop");
+ }
+ }
+}
+
+static void pauseSong()
+{
+ mpd_update();
+ if (currentSong != NULL) {
+ if ((!mpd_send_pause(conn, l_state == MPD_STATE_PAUSE ? 0 : 1))
+ || (!mpd_response_finish(conn))) {
+ mpd_printerror("send_pause");
+ }
+ }
+}
+
+static void volUp()
+{
+ mpd_update();
+ if (currentSong != NULL) {
+ l_volume += 5;
+ if (l_volume > 100)
+ l_volume = 100;
+
+ if ((!mpd_run_set_volume(conn, l_volume))
+ || (!mpd_response_finish(conn))) {
+ mpd_printerror("set_volume");
+ }
+ }
+}
+
+static void volDown()
+{
+ mpd_update();
+ if (currentSong != NULL) {
+ if (l_volume > 5)
+ l_volume -= 5;
+ else
+ l_volume = 0;
+
+ if ((!mpd_run_set_volume(conn, l_volume))
+ || (!mpd_response_finish(conn))) {
+ mpd_printerror("set_volume");
+ }
+ }
+}
+
+static void toggleRepeat()
+{
+ mpd_update();
+ if (currentSong != NULL) {
+ l_repeatEnabled = !l_repeatEnabled;
+ if ((!mpd_run_repeat(conn, l_repeatEnabled))
+ || (!mpd_response_finish(conn))) {
+ mpd_printerror("run_repeat");
+ }
+ }
+}
+
+static void toggleRandom()
+{
+ mpd_update();
+ if (currentSong != NULL) {
+ l_randomEnabled = !l_randomEnabled;
+ if ((!mpd_run_random(conn, l_randomEnabled))
+ || (!mpd_response_finish(conn))) {
+ mpd_printerror("run_random");
+ }
+ }
+}
+
+static void toggleSingle()
+{
+ mpd_update();
+ if (currentSong != NULL) {
+ l_singleEnabled = !l_singleEnabled;
+ if ((!mpd_run_single(conn, l_singleEnabled))
+ || (!mpd_response_finish(conn))) {
+ mpd_printerror("run_single");
+ }
+ }
+}
+
+static void toggleConsume()
+{
+ mpd_update();
+ if (currentSong != NULL) {
+ l_consumeEnabled = !l_consumeEnabled;
+ if ((!mpd_run_consume(conn, l_consumeEnabled))
+ || (!mpd_response_finish(conn))) {
+ mpd_printerror("run_consume");
+ }
+ }
+}
+
+static void formatTimeMMSS(RESULT * result, RESULT * param)
+{
+ long sec;
+ char myTime[6] = " ";
+
+ sec = R2N(param);
+
+ if ((sec >= 0) && (sec < 6000)) {
+ const int minutes = (int) (sec / 60);
+ const int seconds = (int) (sec % 60);
+ sprintf(myTime, "%02d:%02d", minutes, seconds);
+ } else if (sec >= 6000) {
+ strcpy(myTime, "LONG");
+ } else
+ strcpy(myTime, "ERROR");
+
+ /* store result */
+ SetResult(&result, R_STRING, myTime);
+}
+
+static void formatTimeDDHHMM(RESULT * result, RESULT * param)
+{
+ long sec;
+ char myTime[16] = " ";
+
+ sec = R2N(param);
+
+ if (sec >= 0) {
+ int days = sec / 86400;
+ int hours = (sec % 86400) / 3600;
+ int minutes = (sec % 3600) / 60;
+ sprintf(myTime, "%dd%02dh%02dm", days, hours, minutes); /* 3d 12:33h */
+ } else
+ strcpy(myTime, "ERROR");
+
+ /* store result */
+ SetResult(&result, R_STRING, myTime);
+}
+
+
+
+int plugin_init_mpd(void)
+{
+ int check;
+ debug("[MPD] v0.83, check lcd4linux configuration file...");
+
+ check = configure_mpd();
+ if (plugin_enabled != 1)
+ return 0;
+
+ if (check)
+ debug("[MPD] configured!");
+ else
+ debug("[MPD] error, NOT configured!");
+
+ /* when mpd dies, do NOT exit application, ignore it! */
+ signal(SIGPIPE, SIG_IGN);
+ gettimeofday(&timestamp, NULL);
+
+ AddFunction("mpd::artist", 0, getArtist);
+ AddFunction("mpd::title", 0, getTitle);
+ AddFunction("mpd::album", 0, getAlbum);
+ AddFunction("mpd::file", 0, getFilename);
+ AddFunction("mpd::totalTimeSec", 0, totalTimeSec);
+ AddFunction("mpd::elapsedTimeSec", 0, elapsedTimeSec);
+ AddFunction("mpd::bitRate", 0, bitRate);
+ AddFunction("mpd::getSamplerateHz", 0, getSamplerateHz);
+ AddFunction("mpd::getAudioChannels", 0, getAudioChannels);
+ AddFunction("mpd::getRepeatInt", 0, getRepeatInt);
+ AddFunction("mpd::getRandomInt", 0, getRandomInt);
+ AddFunction("mpd::getSingleInt", 0, getSingleInt);
+ AddFunction("mpd::getConsumeInt", 0, getConsumeInt);
+ AddFunction("mpd::getStateInt", 0, getStateInt);
+ AddFunction("mpd::getVolume", 0, getVolume);
+ AddFunction("mpd::getSongsInDb", 0, getSongsInDb);
+ AddFunction("mpd::getMpdUptime", 0, getMpdUptime);
+ AddFunction("mpd::getMpdPlayTime", 0, getMpdPlayTime);
+ AddFunction("mpd::getMpdDbPlayTime", 0, getMpdDbPlayTime);
+ AddFunction("mpd::getMpdPlaylistLength", 0, getMpdPlaylistLength);
+ AddFunction("mpd::getMpdPlaylistGetCurrentId", 0, getCurrentSongPos);
+
+ AddFunction("mpd::cmdNextSong", 0, nextSong);
+ AddFunction("mpd::cmdPrevSong", 0, prevSong);
+ AddFunction("mpd::cmdStopSong", 0, stopSong);
+ AddFunction("mpd::cmdTogglePauseSong", 0, pauseSong);
+ AddFunction("mpd::cmdVolUp", 0, volUp);
+ AddFunction("mpd::cmdVolDown", 0, volDown);
+ AddFunction("mpd::cmdToggleRandom", 0, toggleRandom);
+ AddFunction("mpd::cmdToggleRepeat", 0, toggleRepeat);
+ AddFunction("mpd::cmdToggleSingle", 0, toggleSingle);
+ AddFunction("mpd::cmdToggleConsume", 0, toggleConsume);
+
+ AddFunction("mpd::formatTimeMMSS", 1, formatTimeMMSS);
+ AddFunction("mpd::formatTimeDDHHMM", 1, formatTimeDDHHMM);
+
+ return 0;
+}
+
+
+void plugin_exit_mpd(void)
+{
+ if (plugin_enabled == 1) {
+ debug("[MPD] disconnect from mpd");
+ if (currentSong != NULL)
+ mpd_song_free(currentSong);
+ }
+ if (conn != NULL)
+ mpd_connection_free(conn);
+ charset_close();
+}
diff --git a/plugin_mpris_dbus.c b/plugin_mpris_dbus.c
new file mode 100644
index 0000000..19f7594
--- /dev/null
+++ b/plugin_mpris_dbus.c
@@ -0,0 +1,325 @@
+/* $Id: plugin_mpris_dbus.c 870 2009-04-09 14:55:23Z abbaskosan $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/plugin_mpris_dbus.c $
+ *
+ * plugin mpris dbus
+ *
+ * Copyright (C) 2009 Abbas Kosan <abbaskosan@gmail.com>
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ * exported functions:
+ *
+ * int plugin_init_mpris_dbus (void)
+ * adds various functions
+ *
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdint.h>
+#include <string.h>
+#include <ctype.h>
+
+#include <stdio.h>
+
+// TODO: dbus-1 folder should be added to include path
+#include <dbus/dbus.h>
+
+/* these should always be included */
+#include "debug.h"
+#include "plugin.h"
+#include "hash.h"
+
+#ifdef WITH_DMALLOC
+#include <dmalloc.h>
+#endif
+
+static HASH DBUS;
+
+// D-Bus variables
+static DBusMessage *msg;
+static DBusMessageIter args;
+static DBusConnection *conn;
+static DBusError err;
+static DBusPendingCall *pending;
+
+static void read_MetaData()
+{
+ // put pairs to hash table
+ int current_type;
+ // TODO: check size of char arrays
+ char str_key[255];
+ char str_value[2048];
+ DBusMessageIter subiter1;
+
+ dbus_message_iter_recurse(&args, &subiter1);
+ while ((current_type = dbus_message_iter_get_arg_type(&subiter1)) != DBUS_TYPE_INVALID) {
+ DBusMessageIter subiter2;
+ DBusMessageIter subiter3;
+
+ strcpy(str_key, "");
+ strcpy(str_value, "");
+ dbus_message_iter_recurse(&subiter1, &subiter2);
+ current_type = dbus_message_iter_get_arg_type(&subiter2);
+
+ if (current_type == DBUS_TYPE_INVALID)
+ break;
+ if (current_type == DBUS_TYPE_STRING) {
+ void *str_tmp1;
+ void *str_tmp2;
+ dbus_message_iter_get_basic(&subiter2, &str_tmp1);
+ strcpy(str_key, str_tmp1);
+ dbus_message_iter_next(&subiter2);
+ dbus_message_iter_recurse(&subiter2, &subiter3);
+ current_type = dbus_message_iter_get_arg_type(&subiter3);
+ switch (current_type) {
+ case DBUS_TYPE_STRING:
+ {
+ dbus_message_iter_get_basic(&subiter3, &str_tmp2);
+ strcpy(str_value, str_tmp2);
+ break;
+ }
+ case DBUS_TYPE_INT32:
+ {
+ dbus_int32_t val;
+ dbus_message_iter_get_basic(&subiter3, &val);
+ sprintf(str_value, "%d", val);
+ break;
+ }
+ case DBUS_TYPE_INT64:
+ {
+ dbus_int64_t val;
+ dbus_message_iter_get_basic(&subiter3, &val);
+ sprintf(str_value, "%jd", (intmax_t) val);
+ break;
+ }
+ default:
+ // unexpected type
+ //printf (" (2-dbus-monitor too dumb to decipher arg type '%c')\n", current_type);
+ break;
+ }
+ // add key-value pair to hash
+ hash_put(&DBUS, str_key, str_value);
+ //printf("Key: %s , Value: %s\t",str_key,str_value);
+ }
+ //else
+ // unexpected type
+ //printf (" (2-dbus-monitor too dumb to decipher arg type '%c')\n", current_type);
+ dbus_message_iter_next(&subiter1);
+ }
+}
+
+static int listen_TrackChange(void)
+{
+ // non blocking read of the next available message
+ dbus_connection_read_write(conn, 0);
+ msg = dbus_connection_pop_message(conn);
+
+ // nothing to do if we haven't read a message
+ if (NULL == msg)
+ return 0;
+
+ // check if the message is a signal from the correct interface and with the correct name
+ if (dbus_message_is_signal(msg, "org.freedesktop.MediaPlayer", "TrackChange")) {
+ // read the parameters
+ // TrackChange signal returns an array of string-variant pairs
+ if (!dbus_message_iter_init(msg, &args)) {
+ // No parameter !
+ //fprintf(stderr, "Message Has No Parameters\n");
+ return 0;
+ } else if (DBUS_TYPE_ARRAY != dbus_message_iter_get_arg_type(&args)) {
+ // Argument is not array
+ //fprintf(stderr, "Argument is not array!\n");
+ return 0;
+ } else
+ read_MetaData();
+ //printf("Got Signal\n");
+ }
+ // free message
+ dbus_message_unref(msg);
+ return 1;
+}
+
+static unsigned long int call_PositionGet(char *target)
+{
+ unsigned long int value = 0;
+
+ // create a new method call and check for errors
+ msg = dbus_message_new_method_call(target, //target for the method call e.g "org.kde.amarok"
+ "/Player", // object to call on
+ "org.freedesktop.MediaPlayer", // interface to call on
+ "PositionGet"); // method name
+ if (NULL == msg) {
+ //fprintf(stderr, "Message Null\n");
+ return 0;
+ }
+ // send message and get a handle for a reply
+ if (!dbus_connection_send_with_reply(conn, msg, &pending, -1)) { // -1 is default timeout
+ //fprintf(stderr, "Out Of Memory!\n");
+ return 0;
+ }
+ if (NULL == pending) {
+ //fprintf(stderr, "Pending Call Null\n");
+ return 0;
+ }
+ dbus_connection_flush(conn);
+
+ //printf("Request Sent\n");
+
+ // free message
+ dbus_message_unref(msg);
+
+ // block until we recieve a reply
+ dbus_pending_call_block(pending);
+
+ // get the reply message
+ msg = dbus_pending_call_steal_reply(pending);
+ if (NULL == msg) {
+ //fprintf(stderr, "Reply Null\n");
+ return 0;
+ }
+ // free the pending message handle
+ dbus_pending_call_unref(pending);
+
+ // read the parameters
+ if (!dbus_message_iter_init(msg, &args)) {
+ //fprintf(stderr, "Message has no arguments!\n");
+ return 0;
+ }
+ if (DBUS_TYPE_INT32 != dbus_message_iter_get_arg_type(&args)) {
+ //fprintf(stderr, "Argument is not INT32!\n");
+ return 0;
+ } else
+ dbus_message_iter_get_basic(&args, &value);
+ //printf("\nGot Reply: %d", value);
+
+ // free message
+ dbus_message_unref(msg);
+
+ return value;
+}
+
+static void signal_TrackChange(RESULT * result, RESULT * arg1)
+{
+ char *str_tmp;
+ /*
+ if (listen_TrackChange() < 0) {
+ SetResult(&result, R_STRING, "");
+ return;
+ }
+ */
+ listen_TrackChange();
+ str_tmp = hash_get(&DBUS, R2S(arg1), NULL);
+ if (str_tmp == NULL)
+ str_tmp = "";
+
+ SetResult(&result, R_STRING, str_tmp);
+}
+
+static void method_PositionGet(RESULT * result, RESULT * arg1)
+{
+ unsigned long int mtime = 0;
+ unsigned long int value = 0;
+ double ratio = 0;
+ char *str_tmp;
+
+ value = call_PositionGet(R2S(arg1));
+ //printf("\ncalled :call_PositionGet %d",value);
+
+
+ str_tmp = hash_get(&DBUS, "mtime", NULL);
+ if (str_tmp != NULL)
+ mtime = atoi(str_tmp);
+ if (mtime > 0)
+ ratio = (double) (((float) value / mtime) * 100);
+
+ //printf("\nvalue:%d mtime:%d ratio:%f",value,mtime,ratio);
+ // return actual position as percentage of total length
+ SetResult(&result, R_NUMBER, &ratio);
+}
+
+/* plugin initialization */
+/* MUST NOT be declared 'static'! */
+int plugin_init_mpris_dbus(void)
+{
+ hash_create(&DBUS);
+
+ int ret;
+
+ //printf("Listening for signals\n");
+
+ // initialise the errors
+ dbus_error_init(&err);
+
+ // connect to the bus and check for errors
+ conn = dbus_bus_get(DBUS_BUS_SESSION, &err);
+ /*
+ if (dbus_error_is_set(&err)) {
+ fprintf(stderr, "Connection Error (%s)\n", err.message);
+ dbus_error_free(&err);
+ }
+ */
+ if (NULL == conn)
+ return 0;
+
+ // request our name on the bus and check for errors
+ ret = dbus_bus_request_name(conn, "org.lcd4linux.mpris_dbus", DBUS_NAME_FLAG_REPLACE_EXISTING, &err);
+ /*
+ if (dbus_error_is_set(&err)) {
+ fprintf(stderr, "Name Error (%s)\n", err.message);
+ dbus_error_free(&err);
+ }
+ */
+ if (DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER != ret)
+ return 0;
+
+ // add a rule for which messages we want to see
+ dbus_bus_add_match(conn, "type='signal',interface='org.freedesktop.MediaPlayer'", &err); // see signals from the given interface
+ dbus_connection_flush(conn);
+ /*
+ if (dbus_error_is_set(&err)) {
+ fprintf(stderr, "Match Error (%s)\n", err.message);
+ return 0;
+ }
+ */
+ //printf("Match rule sent\n");
+
+
+ /* register all our cool functions */
+ /* the second parameter is the number of arguments */
+ /* -1 stands for variable argument list */
+ AddFunction("mpris_dbus::signal_TrackChange", 1, signal_TrackChange);
+ AddFunction("mpris_dbus::method_PositionGet", 1, method_PositionGet);
+
+ return 0;
+}
+
+void plugin_exit_mpris_dbus(void)
+{
+ /* free any allocated memory */
+ /* close filedescriptors */
+ hash_destroy(&DBUS);
+
+ if (NULL != msg)
+ dbus_message_unref(msg);
+ dbus_error_free(&err);
+}
diff --git a/plugin_mysql.c b/plugin_mysql.c
new file mode 100644
index 0000000..ca7b2d4
--- /dev/null
+++ b/plugin_mysql.c
@@ -0,0 +1,243 @@
+/* $Id: plugin_mysql.c 771 2007-02-25 12:27:26Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/plugin_mysql.c $
+ *
+ * plugin for execute SQL queries into a MySQL DBSM.
+ *
+ * Copyright (C) 2004 Javier Garcia <javi@gsmlandia.com>
+ * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/* DOC:
+ * To compile the plugin remember to add -lmysqlclient option into Makefile. I.E: CC = gcc -lmysqlclient
+ * or run:
+ * $ gcc -I/usr/include/mysql -L/usr/lib/mysql plugin_mysql.c -lmysqlclient -o plugin_mysql.o
+ *
+ * exported functions:
+ *
+ * int plugin_init_mysql (void)
+ *
+ * adds various functions:
+ * MySQLquery(query)
+ * Returns the number of rows in query.
+ * MySQLstatus()
+ * Returns the current server status:
+ * Uptime in seconds and the number of running threads,
+ * questions, reloads, and open tables.
+ *
+ */
+
+#include "config.h"
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include "debug.h"
+#include "plugin.h"
+#include "cfg.h"
+
+#ifdef HAVE_MYSQL_MYSQL_H
+#include <mysql/mysql.h>
+#else
+#warning mysql/mysql.h not found: plugin deactivated
+#endif
+
+#ifdef WITH_DMALLOC
+#include <dmalloc.h>
+#endif
+
+
+#ifdef HAVE_MYSQL_MYSQL_H
+static MYSQL conex;
+
+static char Section[] = "Plugin:MySQL";
+
+
+static int configure_mysql(void)
+{
+ static int configured = 0;
+
+ char server[256];
+ int port;
+ char user[128];
+ char password[256];
+ char database[256];
+ char *s;
+
+ if (configured != 0)
+ return configured;
+
+ s = cfg_get(Section, "server", "localhost");
+ if (*s == '\0') {
+ info("[MySQL] empty '%s.server' entry from %s, assuming 'localhost'", Section, cfg_source());
+ strcpy(server, "localhost");
+ } else
+ strcpy(server, s);
+ free(s);
+
+ if (cfg_number(Section, "port", 0, 1, 65536, &port) < 1) {
+ /* using 0 as default port because mysql_real_connect() will convert it to real default one */
+ info("[MySQL] no '%s.port' entry from %s using MySQL's default", Section, cfg_source());
+ }
+
+ s = cfg_get(Section, "user", "");
+ if (*s == '\0') {
+ /* If user is NULL or the empty string "", the lcd4linux Unix user is assumed. */
+ info("[MySQL] empty '%s.user' entry from %s, assuming lcd4linux owner", Section, cfg_source());
+ strcpy(user, "");
+ } else
+ strcpy(user, s);
+ free(s);
+
+ s = cfg_get(Section, "password", "");
+ /* Do not encrypt the password because encryption is handled automatically by the MySQL client API. */
+ if (*s == '\0') {
+ info("[MySQL] empty '%s.password' entry in %s, assuming none", Section, cfg_source());
+ strcpy(password, "");
+ } else
+ strcpy(password, s);
+ free(s);
+
+ s = cfg_get(Section, "database", "");
+ if (*s == '\0') {
+ error("[MySQL] no '%s:database' entry from %s, specify one", Section, cfg_source());
+ free(s);
+ configured = -1;
+ return configured;
+ }
+ strcpy(database, s);
+ free(s);
+
+ mysql_init(&conex);
+ if (!mysql_real_connect(&conex, server, user, password, database, port, NULL, 0)) {
+ error("[MySQL] conection error: %s", mysql_error(&conex));
+ configured = -1;
+ return configured;
+ }
+
+ configured = 1;
+ return configured;
+}
+
+static void my_MySQLcount(RESULT * result, RESULT * query)
+{
+ char *q;
+ double value;
+ MYSQL_RES *res;
+
+ if (configure_mysql() < 0) {
+ value = -1;
+ SetResult(&result, R_NUMBER, &value);
+ return;
+ }
+
+ q = R2S(query);
+
+ /* mysql_ping(MYSQL *mysql) checks whether the connection to the server is working. */
+ /* If it has gone down, an automatic reconnection is attempted. */
+ mysql_ping(&conex);
+ if (mysql_real_query(&conex, q, (unsigned int) strlen(q))) {
+ error("[MySQL] query error: %s", mysql_error(&conex));
+ value = -1;
+ } else {
+ /* We don't use res=mysql_use_result(); because mysql_num_rows() will not */
+ /* return the correct value until all the rows in the result set have been retrieved */
+ /* with mysql_fetch_row(), so we use res=mysql_store_result(); instead */
+ res = mysql_store_result(&conex);
+ value = (double) mysql_num_rows(res);
+ mysql_free_result(res);
+ }
+
+ SetResult(&result, R_NUMBER, &value);
+}
+
+
+static void my_MySQLquery(RESULT * result, RESULT * query)
+{
+ char *q;
+ double value;
+ MYSQL_RES *res;
+ MYSQL_ROW row = NULL;
+
+ if (configure_mysql() < 0) {
+ value = -1;
+ SetResult(&result, R_NUMBER, &value);
+ return;
+ }
+
+ q = R2S(query);
+
+ /* mysql_ping(MYSQL *mysql) checks whether the connection to the server is working. */
+ /* If it has gone down, an automatic reconnection is attempted. */
+ mysql_ping(&conex);
+ if (mysql_real_query(&conex, q, (unsigned int) strlen(q))) {
+ error("[MySQL] query error: %s", mysql_error(&conex));
+ value = -1;
+ } else {
+ /* We don't use res=mysql_use_result(); because mysql_num_rows() will not */
+ /* return the correct value until all the rows in the result set have been retrieved */
+ /* with mysql_fetch_row(), so we use res=mysql_store_result(); instead */
+ res = mysql_store_result(&conex);
+ row = mysql_fetch_row(res);
+ mysql_free_result(res);
+ }
+
+ SetResult(&result, R_STRING, row[0]);
+}
+
+
+static void my_MySQLstatus(RESULT * result)
+{
+ const char *value = "";
+ const char *status;
+
+ if (configure_mysql() > 0) {
+
+ mysql_ping(&conex);
+ status = mysql_stat(&conex);
+ if (!status) {
+ error("[MySQL] status error: %s", mysql_error(&conex));
+ value = "error";
+ } else {
+ value = status;
+ }
+ }
+
+ SetResult(&result, R_STRING, value);
+}
+
+
+#endif
+
+
+int plugin_init_mysql(void)
+{
+#ifdef HAVE_MYSQL_MYSQL_H
+ AddFunction("MySQL::count", 1, my_MySQLcount);
+ AddFunction("MySQL::query", 1, my_MySQLquery);
+ AddFunction("MySQL::status", 0, my_MySQLstatus);
+#endif
+ return 0;
+}
+
+void plugin_exit_mysql(void)
+{
+#ifdef HAVE_MYSQL_MYSQL_H
+ mysql_close(&conex);
+#endif
+}
diff --git a/plugin_netdev.c b/plugin_netdev.c
new file mode 100644
index 0000000..2f7e13c
--- /dev/null
+++ b/plugin_netdev.c
@@ -0,0 +1,190 @@
+/* $Id: plugin_netdev.c 840 2007-09-09 12:17:42Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/plugin_netdev.c $
+ *
+ * plugin for /proc/net/dev parsing
+ *
+ * Copyright (C) 2003 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ * exported functions:
+ *
+ * int plugin_init_netdev (void)
+ * adds functions to access /proc/net/dev
+ *
+ */
+
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+#include <errno.h>
+
+#include "debug.h"
+#include "plugin.h"
+#include "qprintf.h"
+#include "hash.h"
+
+
+static HASH NetDev;
+static FILE *Stream = NULL;
+static char *DELIMITER = " :|\t\n";
+
+static int parse_netdev(void)
+{
+ int age;
+ int row, col;
+ static int first_time = 1;
+
+ /* reread every 10 msec only */
+ age = hash_age(&NetDev, NULL);
+ if (age > 0 && age <= 10)
+ return 0;
+
+ if (Stream == NULL)
+ Stream = fopen("/proc/net/dev", "r");
+ if (Stream == NULL) {
+ error("fopen(/proc/net/dev) failed: %s", strerror(errno));
+ return -1;
+ }
+
+ rewind(Stream);
+ row = 0;
+
+ while (!feof(Stream)) {
+ char buffer[256];
+ char dev[16];
+ char *beg, *end;
+ unsigned int len;
+
+ if (fgets(buffer, sizeof(buffer), Stream) == NULL)
+ break;
+
+ switch (++row) {
+
+ case 1:
+ /* skip row 1 */
+ continue;
+
+ case 2:
+ /* row 2 used for headers */
+ if (first_time) {
+ char *RxTx = strrchr(buffer, '|');
+ first_time = 0;
+ col = 0;
+ beg = buffer;
+ while (beg) {
+ char key[32];
+
+ while (strchr(DELIMITER, *beg))
+ beg++;
+ if ((end = strpbrk(beg, DELIMITER)) != NULL)
+ *end = '\0';
+ qprintf(key, sizeof(key), "%s_%s", beg < RxTx ? "Rx" : "Tx", beg);
+ hash_set_column(&NetDev, col++, key);
+ beg = end ? end + 1 : NULL;
+ }
+ }
+ continue;
+
+ default:
+ /* fetch interface name (1st column) as key */
+ beg = buffer;
+ while (*beg && *beg == ' ')
+ beg++;
+ end = beg + 1;
+ while (*end && *end != ':')
+ end++;
+ len = end - beg;
+ if (len >= sizeof(dev))
+ len = sizeof(dev) - 1;
+ strncpy(dev, beg, len);
+ dev[len] = '\0';
+
+ hash_put_delta(&NetDev, dev, buffer);
+ }
+ }
+
+ return 0;
+}
+
+static void my_netdev(RESULT * result, RESULT * arg1, RESULT * arg2, RESULT * arg3)
+{
+ char *dev, *key;
+ int delay;
+ double value;
+
+ if (parse_netdev() < 0) {
+ SetResult(&result, R_STRING, "");
+ return;
+ }
+
+ dev = R2S(arg1);
+ key = R2S(arg2);
+ delay = R2N(arg3);
+
+ value = hash_get_regex(&NetDev, dev, key, delay);
+
+ SetResult(&result, R_NUMBER, &value);
+}
+
+static void my_netdev_fast(RESULT * result, RESULT * arg1, RESULT * arg2, RESULT * arg3)
+{
+ char *dev, *key;
+ int delay;
+ double value;
+
+ if (parse_netdev() < 0) {
+ SetResult(&result, R_STRING, "");
+ return;
+ }
+
+ dev = R2S(arg1);
+ key = R2S(arg2);
+ delay = R2N(arg3);
+
+ value = hash_get_delta(&NetDev, dev, key, delay);
+
+ SetResult(&result, R_NUMBER, &value);
+}
+
+
+int plugin_init_netdev(void)
+{
+ hash_create(&NetDev);
+ hash_set_delimiter(&NetDev, " :|\t\n");
+
+ AddFunction("netdev", 3, my_netdev);
+ AddFunction("netdev::fast", 3, my_netdev_fast);
+ return 0;
+}
+
+void plugin_exit_netdev(void)
+{
+ if (Stream != NULL) {
+ fclose(Stream);
+ Stream = NULL;
+ }
+ hash_destroy(&NetDev);
+}
diff --git a/plugin_netinfo.c b/plugin_netinfo.c
new file mode 100644
index 0000000..34f694d
--- /dev/null
+++ b/plugin_netinfo.c
@@ -0,0 +1,325 @@
+/* $Id: $
+ * $URL: $
+ *
+ * plugin getting information about network devices (IPaddress, MACaddress, ...)
+ *
+ * Copyright (C) 2007 Volker Gering <v.gering@t-online.de>
+ * Copyright (C) 2004, 2005, 2006, 2007 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ * exported functions:
+ *
+ * int plugin_init_netinfo (void)
+ * adds functions to get information about network devices
+ *
+ */
+
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h> /* memcpy() */
+#include <ctype.h>
+#include <math.h> /* rint(), log2l() */
+
+#include "debug.h"
+#include "plugin.h"
+#include "qprintf.h"
+
+#include <sys/types.h> /* socket() */
+#include <sys/socket.h> /* socket() */
+#include <sys/ioctl.h> /* SIOCGIFNAME */
+#include <net/if.h> /* ifreq{} */
+#include <errno.h> /* errno */
+#include <netinet/in.h> /* inet_ntoa() */
+#include <arpa/inet.h> /* inet_ntoa() */
+
+
+/* socket descriptor:
+ * -2 initial state
+ * -1 error: message not printed
+ * -3 error: message printed, deactivate plugin
+ */
+static int socknr = -2;
+
+static int open_net(void)
+{
+
+ if (socknr == -3)
+ return -1;
+ if (socknr == -2) {
+ socknr = socket(PF_INET, SOCK_DGRAM, 0);
+ }
+ if (socknr == -1) {
+ error("%s: socket(PF_INET, SOCK_DGRAM, 0) failed: %s", "plugin_netinfo", strerror(errno));
+ error(" deactivate plugin netinfo");
+ socknr = -3;
+ return -1;
+ }
+
+ return 0;
+}
+
+
+static void my_exists(RESULT * result, RESULT * arg1)
+{
+ char buf[10240];
+ struct ifconf ifcnf;
+ struct ifreq *ifreq;
+ int len;
+ double value = 0.0; // netdev doesn't exists
+ char devname[80];
+
+ if (socknr < 0) {
+ /* no open socket */
+ SetResult(&result, R_NUMBER, &value);
+ return;
+ }
+
+ ifcnf.ifc_len = sizeof(buf);
+ ifcnf.ifc_buf = buf;
+ if (ioctl(socknr, SIOCGIFCONF, &ifcnf) < 0) {
+ /* error getting list of devices */
+ error("%s: ioctl(IFCONF) for %s failed: %s", "plugin_netinfo", R2S(arg1), strerror(errno));
+ SetResult(&result, R_NUMBER, &value);
+ return;
+ }
+ if (0 == ifcnf.ifc_len) {
+ /* no interfaces found */
+ SetResult(&result, R_NUMBER, &value);
+ return;
+ }
+
+ ifreq = (struct ifreq *) buf;
+ len = sizeof(struct ifreq);
+ strncpy(devname, R2S(arg1), sizeof(devname));
+
+ while (ifreq && *((char *) ifreq) && ((char *) ifreq) < buf + ifcnf.ifc_len) {
+ if (*((char *) ifreq) && strncmp(ifreq->ifr_name, devname, sizeof(devname)) == 0) {
+ /* found */
+ value = 1.0;
+ SetResult(&result, R_NUMBER, &value);
+ return;
+ }
+
+ (*(char **) &ifreq) += len;
+ }
+
+ /* device doesn't exists */
+ SetResult(&result, R_NUMBER, &value);
+}
+
+
+/* get MAC address (hardware address) of network device */
+static void my_hwaddr(RESULT * result, RESULT * arg1)
+{
+ static int errcount = 0;
+ struct ifreq ifreq;
+ unsigned char *hw;
+ char value[18];
+
+ if (socknr < 0) {
+ /* no open socket */
+ SetResult(&result, R_STRING, "");
+ return;
+ }
+
+ strncpy(ifreq.ifr_name, R2S(arg1), sizeof(ifreq.ifr_name));
+#ifndef __MAC_OS_X_VERSION_10_3
+ // Linux: get interface MAC address
+ if (ioctl(socknr, SIOCGIFHWADDR, &ifreq) < 0) {
+#else
+ // MacOS: get interface MAC address
+ if (ioctl(socknr, SIOCGLIFPHYADDR, &ifreq) < 0) {
+#endif
+ errcount++;
+ if (1 == errcount % 1000) {
+ error("%s: ioctl(IF_HARDW_ADDR %s) failed: %s", "plugin_netinfo", ifreq.ifr_name, strerror(errno));
+ error(" (skip next 1000 errors)");
+ }
+ SetResult(&result, R_STRING, "");
+ return;
+ }
+#ifndef __MAC_OS_X_VERSION_10_3
+ hw = (unsigned char *) ifreq.ifr_hwaddr.sa_data;
+#else
+ hw = (unsigned char *) ifreq.ifr_data;
+#endif
+ qprintf(value, sizeof(value), "%02x:%02x:%02x:%02x:%02x:%02x",
+ *hw, *(hw + 1), *(hw + 2), *(hw + 3), *(hw + 4), *(hw + 5));
+
+ SetResult(&result, R_STRING, value);
+}
+
+
+/* get ip address of network device */
+static void my_ipaddr(RESULT * result, RESULT * arg1)
+{
+ static int errcount = 0;
+ struct ifreq ifreq;
+ struct sockaddr_in *sin;
+ char value[16];
+
+ if (socknr < 0) {
+ /* no open socket */
+ SetResult(&result, R_STRING, "");
+ return;
+ }
+
+ strncpy(ifreq.ifr_name, R2S(arg1), sizeof(ifreq.ifr_name));
+ if (ioctl(socknr, SIOCGIFADDR, &ifreq) < 0) {
+ errcount++;
+ if (1 == errcount % 1000) {
+ error("%s: ioctl(IFADDR %s) failed: %s", "plugin_netinfo", ifreq.ifr_name, strerror(errno));
+ error(" (skip next 1000 errors)");
+ }
+ SetResult(&result, R_STRING, "");
+ return;
+ }
+ sin = (struct sockaddr_in *) &ifreq.ifr_addr;
+ qprintf(value, sizeof(value), "%s", inet_ntoa(sin->sin_addr));
+
+ SetResult(&result, R_STRING, value);
+}
+
+
+struct sockaddr_in *get_netmask(RESULT * arg1)
+{
+ static int errcount = 0;
+ struct ifreq ifreq;
+ struct sockaddr_in *sin;
+ static struct sockaddr_in sret;
+
+ strncpy(ifreq.ifr_name, R2S(arg1), sizeof(ifreq.ifr_name));
+ if (ioctl(socknr, SIOCGIFNETMASK, &ifreq) < 0) {
+ errcount++;
+ if (1 == errcount % 1000) {
+ error("%s: ioctl(IFNETMASK %s) failed: %s", "plugin_netinfo", ifreq.ifr_name, strerror(errno));
+ error(" (skip next 1000 errors)");
+ }
+ return NULL;
+ }
+#ifndef __MAC_OS_X_VERSION_10_3
+ sin = (struct sockaddr_in *) &ifreq.ifr_netmask;
+#else
+ sin = (struct sockaddr_in *) &ifreq.ifr_data;
+#endif
+
+ memcpy(&sret, sin, sizeof(sret));
+ return &sret;
+}
+
+/* get ip netmask of network device */
+static void my_netmask(RESULT * result, RESULT * arg1)
+{
+ char value[16];
+ struct sockaddr_in *sin;
+
+ if (socknr < 0) {
+ /* no open socket */
+ SetResult(&result, R_STRING, "");
+ return;
+ }
+
+ sin = get_netmask(arg1);
+ qprintf(value, sizeof(value), "%s", NULL != sin ? inet_ntoa(sin->sin_addr) : "?");
+
+ SetResult(&result, R_STRING, value);
+}
+
+
+/* get netmask in short CIDR notation */
+static void my_netmask_short(RESULT * result, RESULT * arg1)
+{
+ char value[16];
+ struct sockaddr_in *sin;
+ int netlen = 0;
+ long double logval = 0.0;
+
+ if (socknr < 0) {
+ /* no open socket */
+ SetResult(&result, R_STRING, "");
+ return;
+ }
+
+ sin = get_netmask(arg1);
+ if (NULL != sin) {
+ logval = (long double) (get_netmask(arg1)->sin_addr.s_addr);
+ netlen = (int) rint(log2l(logval) / log2l(2.0));
+ qprintf(value, sizeof(value), "/%d", netlen);
+ } else {
+ qprintf(value, sizeof(value), "/?");
+ }
+
+ SetResult(&result, R_STRING, value);
+}
+
+
+/* get ip broadcast address of network device */
+static void my_bcaddr(RESULT * result, RESULT * arg1)
+{
+ static int errcount = 0;
+ struct ifreq ifreq;
+ struct sockaddr_in *sin;
+ char value[16];
+
+ if (socknr < 0) {
+ /* no open socket */
+ SetResult(&result, R_STRING, "");
+ return;
+ }
+
+ strncpy(ifreq.ifr_name, R2S(arg1), sizeof(ifreq.ifr_name));
+ if (ioctl(socknr, SIOCGIFBRDADDR, &ifreq) < 0) {
+ errcount++;
+ if (1 == errcount % 1000) {
+ error("%s: ioctl(IFBRDADDR %s) failed: %s", "plugin_netinfo", ifreq.ifr_name, strerror(errno));
+ error(" (skip next 1000 errors)");
+ }
+ SetResult(&result, R_STRING, "");
+ return;
+ }
+ sin = (struct sockaddr_in *) &ifreq.ifr_broadaddr;
+ qprintf(value, sizeof(value), "%s", inet_ntoa(sin->sin_addr));
+
+ SetResult(&result, R_STRING, value);
+}
+
+
+int plugin_init_netinfo(void)
+{
+ open_net();
+
+ AddFunction("netinfo::exists", 1, my_exists);
+ AddFunction("netinfo::hwaddr", 1, my_hwaddr);
+ AddFunction("netinfo::ipaddr", 1, my_ipaddr);
+ AddFunction("netinfo::netmask", 1, my_netmask);
+ AddFunction("netinfo::netmask_short", 1, my_netmask_short);
+ AddFunction("netinfo::bcaddr", 1, my_bcaddr);
+
+ return 0;
+}
+
+void plugin_exit_netinfo(void)
+{
+ close(socknr);
+}
diff --git a/plugin_pop3.c b/plugin_pop3.c
new file mode 100644
index 0000000..9c67dd3
--- /dev/null
+++ b/plugin_pop3.c
@@ -0,0 +1,346 @@
+/* $Id: plugin_pop3.c 1159 2011-08-31 22:00:29Z jmccrohan $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/plugin_pop3.c $
+ *
+ * Plugin to check POP3 mail accounts
+ *
+ * Copyright (C) 2004 Javi Garcia Dominguez (aka Stolz) <javi@gsmlandia.com>
+ * Based on code from pop3check (C) 1999 http://sourceforge.net/projects/pop3check
+ * Simon Liddington <squidly@users.sourceforge.net> is the pop3check current maintainer.
+ * The pop3check original author is Steven Radack <steve@lconn.net>.
+ *
+ * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is a pluging for LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+
+#include "config.h"
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include "debug.h"
+#include "plugin.h"
+#include "cfg.h"
+
+/*added */
+#include <sys/socket.h>
+#include <sys/types.h>
+/*#include <netinet/in.h> */
+#include <netdb.h>
+#include <unistd.h>
+/*#include <pwd.h> */
+#include <stdio.h>
+
+#ifdef WITH_DMALLOC
+#include <dmalloc.h>
+#endif
+
+/*POP 3 */
+#define POPERR "-ERR"
+#define LOCKEDERR "-ERR account is locked by another session or for maintenance, try again."
+#define BUFSIZE 8192
+#define POP3PORT 110
+#define MAX_NUM_ACCOUNTS 3
+
+
+struct check {
+ int id;
+ char *username;
+ char *password;
+ char *server;
+ int port;
+ int messages;
+ struct check *next;
+};
+
+
+/************************ PROTOTYPES ********************************/
+/* list */
+static struct check *check_node_alloc(void);
+static void check_node_add(struct check **head, struct check *new_check);
+static void check_destroy(struct check **head);
+
+/* pop3 */
+static void pop3_check_messages(struct check *hi, int verbose);
+static void pop3_recv_crlf_terminated(int sockfd, char *buf, int size);
+
+/* socket */
+static int tcp_connect(struct check *hi);
+
+
+/************************ GLOBAL ***********************************/
+static char Section[] = "Plugin:POP3";
+static struct check *head = NULL;
+/********************************************************************/
+
+
+/************************ LIST ***********************************/
+
+static struct check *check_node_alloc(void)
+{
+ struct check *new_check;
+ new_check = (struct check *) calloc(1, sizeof(struct check));
+ if (new_check == NULL) {
+ error("[POP3] out of memory\n");
+ }
+ return new_check;
+}
+
+static void check_node_add(struct check **head, struct check *new_check)
+{
+ new_check->next = *head;
+ *head = new_check;
+}
+
+static void check_destroy(struct check **head)
+{
+ struct check *iter;
+ while (*head) {
+ iter = (*head)->next;
+ free((*head)->username);
+ free((*head)->password);
+ free((*head)->server);
+ free(*head);
+ *head = iter;
+ }
+ *head = NULL;
+}
+
+/************************ POP3 ********************************/
+static void pop3_check_messages(struct check *hi, int verbose)
+{
+ char buf[BUFSIZE];
+ int sockfd;
+
+ if ((sockfd = tcp_connect(hi)) < 0) {
+ hi->messages = -1;
+ return;
+ }
+
+ pop3_recv_crlf_terminated(sockfd, buf, sizeof(buf)); /* server greeting */
+ if (verbose)
+ info("[POP3] %s -> %s\n", hi->server, buf);
+
+ snprintf(buf, sizeof(buf), "USER %s\r\n", hi->username);
+ write(sockfd, buf, strlen(buf));
+ buf[strlen(buf) - 1] = '\0';
+ if (verbose)
+ info("[POP3] %s <- %s\n", hi->server, buf);
+ pop3_recv_crlf_terminated(sockfd, buf, sizeof(buf)); /* response from USER command */
+ if (verbose)
+ info("[POP3] %s -> %s\n", hi->server, buf);
+
+ snprintf(buf, sizeof(buf), "PASS %s\r\n", hi->password);
+ write(sockfd, buf, strlen(buf));
+ if (verbose)
+ info("[POP3] %s <- PASS ???\n", hi->server);
+ pop3_recv_crlf_terminated(sockfd, buf, sizeof(buf)); /* response from PASS command */
+ if (verbose)
+ info("[POP3] %s -> %s\n", hi->server, buf);
+
+ if (strncmp(buf, LOCKEDERR, strlen(LOCKEDERR)) == 0) {
+ hi->messages = -2;
+ close(sockfd);
+ return;
+ }
+ if (strncmp(buf, POPERR, strlen(POPERR)) == 0) {
+ error("[POP3] error logging into %s\n", hi->server);
+ error("[POP3] server responded: %s\n", buf);
+ hi->messages = -1;
+ close(sockfd);
+ return;
+ }
+
+ snprintf(buf, sizeof(buf), "STAT\r\n");
+ write(sockfd, buf, strlen(buf));
+ if (verbose)
+ info("[POP3] %s <- STAT\n", hi->server);
+ pop3_recv_crlf_terminated(sockfd, buf, sizeof(buf)); /* response from PASS command */
+ if (verbose)
+ info("[POP3] %s -> %s\n", hi->server, buf);
+
+ strtok(buf, " ");
+ hi->messages = atoi(strtok(NULL, " "));
+
+ snprintf(buf, sizeof(buf), "QUIT\r\n");
+ write(sockfd, buf, strlen(buf));
+ if (verbose)
+ info("[POP3] %s <- QUIT\n", hi->server);
+ pop3_recv_crlf_terminated(sockfd, buf, sizeof(buf)); /* response from QUIT command */
+ if (verbose)
+ info("[POP3] %s -> %s\n", hi->server, buf);
+
+ close(sockfd);
+}
+
+static void pop3_recv_crlf_terminated(int sockfd, char *buf, int size)
+{
+ /* receive one line server responses terminated with CRLF */
+ char *pos;
+ int bytes = 0;
+ memset(buf, 0, size);
+ while ((pos = strstr(buf, "\r\n")) == NULL)
+ bytes += read(sockfd, buf + bytes, size - bytes);
+ *pos = '\0';
+}
+
+/************************ SOCKET ********************************/
+static int tcp_connect(struct check *hi)
+{
+ struct sockaddr_in addr;
+ struct hostent *he = gethostbyname(hi->server);
+ int sockfd;
+
+ if (hi == NULL)
+ return -1;
+
+ if (!he) {
+ error("[POP3] Failed to lookup %s\n", hi->server);
+ return (-1);
+ }
+
+ memset((char *) &addr, 0, sizeof(struct sockaddr_in));
+ addr.sin_family = AF_INET;
+ memcpy(&(addr.sin_addr.s_addr), he->h_addr, he->h_length);
+ addr.sin_port = htons(hi->port);
+
+ if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
+ perror("socket()");
+ return (-1);
+ }
+
+ if (connect(sockfd, (struct sockaddr *) &addr, sizeof(struct sockaddr)) < 0) {
+ perror("connect()");
+ close(sockfd);
+ return (-1);
+ }
+
+ return (sockfd);
+}
+
+
+static int getConfig(void)
+{
+ struct check *node = NULL;
+ int i, n = 0;
+ char *user = (char *) calloc(1, sizeof("user") + sizeof(int));
+ char *password = (char *) calloc(1, sizeof("password") + sizeof(int));
+ char *server = (char *) calloc(1, sizeof("server") + sizeof(int));
+ char *port = (char *) calloc(1, sizeof("port") + sizeof(int));
+
+ for (i = 1; i <= MAX_NUM_ACCOUNTS; i++) {
+ char *x;
+ sprintf(user, "user%d", i);
+ sprintf(password, "password%d", i);
+ sprintf(server, "server%d", i);
+ sprintf(port, "port%d", i);
+
+ x = cfg_get(Section, server, "");
+ if (*x == '\0') {
+ info("[POP3] No '%s.%s' entry from %s, disabling POP3 account #%d", Section, server, cfg_source(), i);
+ free(x);
+ } else {
+ node = check_node_alloc();
+ node->id = i;
+ node->server = x;
+ node->messages = 0;
+ node->next = NULL;
+
+ x = cfg_get(Section, user, "");
+ if (*x == '\0') {
+ info("[POP3] No '%s.%s' entry from %s, disabling POP3 account #%d", Section, user, cfg_source(), i);
+ free(x);
+ } else {
+ node->username = x;
+ x = cfg_get(Section, password, "");
+ if (*x == '\0') {
+ info("[POP3] No '%s.%s' entry from %s, disabling POP3 account #%d", Section, password, cfg_source(),
+ i);
+ free(x);
+ } else {
+ node->password = x;
+ if (cfg_number(Section, port, POP3PORT, 1, 65536, &node->port) < 1) {
+ info("[POP3] No '%s.%s' entry from %s, %d will be used for account #%d", Section, port,
+ cfg_source(), POP3PORT, i);
+ }
+ check_node_add(&head, node);
+ n++;
+ }
+ }
+ }
+ }
+ return (n);
+}
+
+
+static int configure_pop3(void)
+{
+ static int configured = 0;
+ int n;
+
+ if (configured != 0)
+ return configured;
+
+ n = getConfig();
+ /* by now, head should point to a list of all our accounts */
+ if (head) {
+ info("[POP3] %d POP3 accounts have been successfully defined", n);
+ configured = 1;
+ } else {
+ configured = -1;
+ }
+ return configured;
+}
+
+
+static void my_POP3check(RESULT * result, RESULT * check)
+{
+ double param = R2N(check);
+ struct check *node = NULL;
+ double value;
+
+ if (configure_pop3() < 0) {
+ value = -1;
+ SetResult(&result, R_NUMBER, &value);
+ return;
+ }
+
+ for (node = head; node; node = node->next) {
+ if (node->id == param)
+ break;
+ }
+ if (node == NULL) { /*Inexistent account */
+ value = -1;
+ } else {
+ pop3_check_messages(node, 0);
+ value = (double) node->messages;
+ }
+ SetResult(&result, R_NUMBER, &value);
+}
+
+
+int plugin_init_pop3(void)
+{
+ AddFunction("POP3check", 1, my_POP3check);
+ return 0;
+}
+
+void plugin_exit_pop3(void)
+{
+ check_destroy(&head);
+}
diff --git a/plugin_ppp.c b/plugin_ppp.c
new file mode 100644
index 0000000..1d6c56b
--- /dev/null
+++ b/plugin_ppp.c
@@ -0,0 +1,131 @@
+/* $Id: plugin_ppp.c 840 2007-09-09 12:17:42Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/plugin_ppp.c $
+ *
+ * plugin for ppp throughput
+ *
+ * Copyright (C) 2003 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ * exported functions:
+ *
+ * int plugin_init_ppp (void)
+ * adds ppp() function
+ *
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <sys/ioctl.h>
+
+#ifdef HAVE_NET_IF_PPP_H
+#include <net/if_ppp.h>
+#else
+#warning if_ppp.h not found. PPP support deactivated.
+#endif
+
+#include "debug.h"
+#include "plugin.h"
+#include "qprintf.h"
+#include "hash.h"
+
+#ifdef HAVE_NET_IF_PPP_H
+
+static HASH PPP;
+
+static int get_ppp_stats(void)
+{
+ int age;
+ int unit;
+ unsigned ibytes, obytes;
+ static int fd = -2;
+ struct ifpppstatsreq req;
+ char key[16], val[16];
+
+ /* reread every 10 msec only */
+ age = hash_age(&PPP, NULL);
+ if (age > 0 && age <= 10)
+ return 0;
+
+ /* open socket only once */
+ if (fd == -2) {
+ fd = socket(AF_INET, SOCK_DGRAM, 0);
+ if (fd == -1) {
+ error("socket() failed: %s", strerror(errno));
+ return -1;
+ }
+ }
+
+ for (unit = 0; unit < 8; unit++) {
+ memset(&req, 0, sizeof(req));
+ req.stats_ptr = (caddr_t) & req.stats;
+ qprintf(req.ifr__name, sizeof(req.ifr__name), "ppp%d", unit);
+
+ if (ioctl(fd, SIOCGPPPSTATS, &req) == 0) {
+ ibytes = req.stats.p.ppp_ibytes;
+ obytes = req.stats.p.ppp_obytes;
+ } else {
+ ibytes = obytes = 0;
+ }
+ qprintf(key, sizeof(key), "Rx:%d", unit);
+ qprintf(val, sizeof(val), "%d", ibytes);
+ hash_put_delta(&PPP, key, val);
+ qprintf(key, sizeof(key), "Tx:%d", unit);
+ qprintf(val, sizeof(val), "%d", obytes);
+ hash_put_delta(&PPP, key, val);
+
+ }
+ return 0;
+}
+
+
+static void my_ppp(RESULT * result, RESULT * arg1, RESULT * arg2)
+{
+ double value;
+
+ if (get_ppp_stats() < 0) {
+ SetResult(&result, R_STRING, "");
+ return;
+ }
+ value = hash_get_delta(&PPP, R2S(arg1), NULL, R2N(arg2));
+ SetResult(&result, R_NUMBER, &value);
+}
+
+#endif
+
+
+int plugin_init_ppp(void)
+{
+ hash_create(&PPP);
+#ifdef HAVE_NET_IF_PPP_H
+ AddFunction("ppp", 2, my_ppp);
+#endif
+ return 0;
+}
+
+void plugin_exit_ppp(void)
+{
+ hash_destroy(&PPP);
+}
diff --git a/plugin_proc_stat.c b/plugin_proc_stat.c
new file mode 100644
index 0000000..f90b02d
--- /dev/null
+++ b/plugin_proc_stat.c
@@ -0,0 +1,381 @@
+/* $Id: plugin_proc_stat.c 1079 2010-01-15 21:44:04Z volker $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/plugin_proc_stat.c $
+ *
+ * plugin for /proc/stat parsing
+ *
+ * Copyright (C) 2003 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ * exported functions:
+ *
+ * int plugin_init_proc_stat (void)
+ * adds functions to access /proc/stat
+ *
+ */
+
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+#include <errno.h>
+
+#ifdef __MAC_OS_X_VERSION_10_3
+#include <mach/mach_host.h>
+#include <mach/host_info.h>
+#endif
+
+#include "debug.h"
+#include "plugin.h"
+#include "qprintf.h"
+#include "hash.h"
+
+
+static HASH Stat;
+static FILE *stream = NULL;
+
+
+static void hash_put1(const char *key1, const char *val)
+{
+ hash_put_delta(&Stat, key1, val);
+}
+
+
+static void hash_put2(const char *key1, const char *key2, const char *val)
+{
+ char key[32];
+
+ qprintf(key, sizeof(key), "%s.%s", key1, key2);
+ hash_put1(key, val);
+}
+
+
+static void hash_put3(const char *key1, const char *key2, const char *key3, const char *val)
+{
+ char key[32];
+
+ qprintf(key, sizeof(key), "%s.%s.%s", key1, key2, key3);
+ hash_put1(key, val);
+}
+
+
+static int parse_proc_stat(void)
+{
+ int age;
+
+ /* reread every 10 msec only */
+ age = hash_age(&Stat, NULL);
+ if (age > 0 && age <= 10)
+ return 0;
+
+#ifndef __MAC_OS_X_VERSION_10_3
+
+ /* Linux Kernel, /proc-filesystem */
+
+ if (stream == NULL)
+ stream = fopen("/proc/stat", "r");
+ if (stream == NULL) {
+ error("fopen(/proc/stat) failed: %s", strerror(errno));
+ return -1;
+ }
+
+ rewind(stream);
+
+ while (!feof(stream)) {
+ char buffer[1024];
+ if (fgets(buffer, sizeof(buffer), stream) == NULL)
+ break;
+
+ if (strncmp(buffer, "cpu", 3) == 0) {
+ char *key[] = { "user", "nice", "system", "idle", "iow", "irq", "sirq" };
+ char delim[] = " \t\n";
+ char *cpu, *beg, *end;
+ int i;
+
+ cpu = buffer;
+
+ /* skip "cpu" or "cpu0" block */
+ if ((end = strpbrk(buffer, delim)) != NULL)
+ *end = '\0';
+ beg = end ? end + 1 : NULL;
+
+ for (i = 0; i < 7 && beg != NULL; i++) {
+ while (strchr(delim, *beg))
+ beg++;
+ if ((end = strpbrk(beg, delim)))
+ *end = '\0';
+ hash_put2(cpu, key[i], beg);
+ beg = end ? end + 1 : NULL;
+ }
+ }
+
+ else if (strncmp(buffer, "page ", 5) == 0) {
+ char *key[] = { "in", "out" };
+ char delim[] = " \t\n";
+ char *beg, *end;
+ int i;
+
+ for (i = 0, beg = buffer + 5; i < 2 && beg != NULL; i++) {
+ while (strchr(delim, *beg))
+ beg++;
+ if ((end = strpbrk(beg, delim)))
+ *end = '\0';
+ hash_put2("page", key[i], beg);
+ beg = end ? end + 1 : NULL;
+ }
+ }
+
+ else if (strncmp(buffer, "swap ", 5) == 0) {
+ char *key[] = { "in", "out" };
+ char delim[] = " \t\n";
+ char *beg, *end;
+ int i;
+
+ for (i = 0, beg = buffer + 5; i < 2 && beg != NULL; i++) {
+ while (strchr(delim, *beg))
+ beg++;
+ if ((end = strpbrk(beg, delim)))
+ *end = '\0';
+ hash_put2("swap", key[i], beg);
+ beg = end ? end + 1 : NULL;
+ }
+ }
+
+ else if (strncmp(buffer, "intr ", 5) == 0) {
+ char delim[] = " \t\n";
+ char *beg, *end, num[4];
+ int i;
+
+ for (i = 0, beg = buffer + 5; i < 17 && beg != NULL; i++) {
+ while (strchr(delim, *beg))
+ beg++;
+ if ((end = strpbrk(beg, delim)))
+ *end = '\0';
+ if (i == 0)
+ strcpy(num, "sum");
+ else
+ qprintf(num, sizeof(num), "%d", i - 1);
+ hash_put2("intr", num, beg);
+ beg = end ? end + 1 : NULL;
+ }
+ }
+
+ else if (strncmp(buffer, "disk_io:", 8) == 0) {
+ char *key[] = { "io", "rio", "rblk", "wio", "wblk" };
+ char delim[] = " ():,\t\n";
+ char *dev, *beg, *end, *p;
+ int i;
+
+ dev = buffer + 8;
+ while (dev != NULL) {
+ while (strchr(delim, *dev))
+ dev++;
+ if ((end = strchr(dev, ')')))
+ *end = '\0';
+ while ((p = strchr(dev, ',')) != NULL)
+ *p = ':';
+ beg = end ? end + 1 : NULL;
+ for (i = 0; i < 5 && beg != NULL; i++) {
+ while (strchr(delim, *beg))
+ beg++;
+ if ((end = strpbrk(beg, delim)))
+ *end = '\0';
+ hash_put3("disk_io", dev, key[i], beg);
+ beg = end ? end + 1 : NULL;
+ }
+ dev = beg;
+ }
+ }
+
+ else {
+ char delim[] = " \t\n";
+ char *beg, *end;
+
+ beg = buffer;
+ if ((end = strpbrk(beg, delim)))
+ *end = '\0';
+ beg = end ? end + 1 : NULL;
+ if ((end = strpbrk(beg, delim)))
+ *end = '\0';
+ while (strchr(delim, *beg))
+ beg++;
+ hash_put1(buffer, beg);
+ }
+ }
+
+#else
+
+ /* MACH Kernel, MacOS X */
+
+ kern_return_t err;
+ mach_msg_type_number_t count;
+ host_info_t r_load;
+ host_cpu_load_info_data_t cpu_load;
+ char s_val[8];
+
+ r_load = &cpu_load;
+ count = HOST_CPU_LOAD_INFO_COUNT;
+ err = host_statistics(mach_host_self(), HOST_CPU_LOAD_INFO, r_load, &count);
+ if (KERN_SUCCESS != err) {
+ error("Error getting cpu load");
+ return -1;
+ }
+ snprintf(s_val, sizeof(s_val), "%d", cpu_load.cpu_ticks[CPU_STATE_USER]);
+ hash_put2("cpu", "user", s_val);
+ snprintf(s_val, sizeof(s_val), "%d", cpu_load.cpu_ticks[CPU_STATE_NICE]);
+ hash_put2("cpu", "nice", s_val);
+ snprintf(s_val, sizeof(s_val), "%d", cpu_load.cpu_ticks[CPU_STATE_SYSTEM]);
+ hash_put2("cpu", "system", s_val);
+ snprintf(s_val, sizeof(s_val), "%d", cpu_load.cpu_ticks[CPU_STATE_IDLE]);
+ hash_put2("cpu", "idle", s_val);
+
+#endif
+
+ return 0;
+}
+
+
+static void my_proc_stat(RESULT * result, const int argc, RESULT * argv[])
+{
+ char *string;
+ double number;
+
+ if (parse_proc_stat() < 0) {
+ SetResult(&result, R_STRING, "");
+ return;
+ }
+
+ switch (argc) {
+ case 1:
+ string = hash_get(&Stat, R2S(argv[0]), NULL);
+ if (string == NULL)
+ string = "";
+ SetResult(&result, R_STRING, string);
+ break;
+ case 2:
+ number = hash_get_delta(&Stat, R2S(argv[0]), NULL, R2N(argv[1]));
+ SetResult(&result, R_NUMBER, &number);
+ break;
+ default:
+ error("proc_stat(): wrong number of parameters");
+ SetResult(&result, R_STRING, "");
+ }
+}
+
+
+static void my_cpu(RESULT * result, RESULT * arg1, RESULT * arg2)
+{
+ char *key;
+ int delay;
+ double value;
+ double cpu_user, cpu_nice, cpu_system, cpu_idle, cpu_total;
+ double cpu_iow, cpu_irq, cpu_sirq;
+
+ if (parse_proc_stat() < 0) {
+ SetResult(&result, R_STRING, "");
+ return;
+ }
+
+ key = R2S(arg1);
+ delay = R2N(arg2);
+
+ cpu_user = hash_get_delta(&Stat, "cpu.user", NULL, delay);
+ cpu_nice = hash_get_delta(&Stat, "cpu.nice", NULL, delay);
+ cpu_system = hash_get_delta(&Stat, "cpu.system", NULL, delay);
+ cpu_idle = hash_get_delta(&Stat, "cpu.idle", NULL, delay);
+
+ /* new fields for kernel 2.6 */
+ /* even if we dont have this param (ie kernel 2.4) */
+ /* the return is 0.0 and not change the results */
+ cpu_iow = hash_get_delta(&Stat, "cpu.iow", NULL, delay);
+ cpu_irq = hash_get_delta(&Stat, "cpu.irq", NULL, delay);
+ cpu_sirq = hash_get_delta(&Stat, "cpu.sirq", NULL, delay);
+
+ cpu_total = cpu_user + cpu_nice + cpu_system + cpu_idle + cpu_iow + cpu_irq + cpu_sirq;
+
+ if (strcasecmp(key, "user") == 0)
+ value = cpu_user;
+ else if (strcasecmp(key, "nice") == 0)
+ value = cpu_nice;
+ else if (strcasecmp(key, "system") == 0)
+ value = cpu_system;
+ else if (strcasecmp(key, "idle") == 0)
+ value = cpu_idle;
+ else if (strcasecmp(key, "iowait") == 0)
+ value = cpu_iow;
+ else if (strcasecmp(key, "irq") == 0)
+ value = cpu_irq;
+ else if (strcasecmp(key, "softirq") == 0)
+ value = cpu_sirq;
+ else if (strcasecmp(key, "busy") == 0)
+ value = cpu_total - cpu_idle;
+
+ if (cpu_total > 0.0)
+ value = 100 * value / cpu_total;
+ else
+ value = 0.0;
+
+ SetResult(&result, R_NUMBER, &value);
+}
+
+
+static void my_disk(RESULT * result, RESULT * arg1, RESULT * arg2, RESULT * arg3)
+{
+ char *dev, *key, buffer[32];
+ int delay;
+ double value;
+
+ if (parse_proc_stat() < 0) {
+ SetResult(&result, R_STRING, "");
+ return;
+ }
+
+ dev = R2S(arg1);
+ key = R2S(arg2);
+ delay = R2N(arg3);
+
+ qprintf(buffer, sizeof(buffer), "disk_io\\.%s\\.%s", dev, key);
+ value = hash_get_regex(&Stat, buffer, NULL, delay);
+
+ SetResult(&result, R_NUMBER, &value);
+}
+
+
+int plugin_init_proc_stat(void)
+{
+ hash_create(&Stat);
+ AddFunction("proc_stat", -1, my_proc_stat);
+ AddFunction("proc_stat::cpu", 2, my_cpu);
+ AddFunction("proc_stat::disk", 3, my_disk);
+ return 0;
+}
+
+void plugin_exit_proc_stat(void)
+{
+ if (stream != NULL) {
+ fclose(stream);
+ stream = NULL;
+ }
+ hash_destroy(&Stat);
+}
diff --git a/plugin_python.c b/plugin_python.c
new file mode 100644
index 0000000..70ea9dc
--- /dev/null
+++ b/plugin_python.c
@@ -0,0 +1,144 @@
+/* $Id: plugin_python.c 1086 2010-01-19 14:26:33Z mzuther $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/plugin_python.c $
+ *
+ * Python plugin
+ *
+ * Copyright 2005 Dan Fritz
+ * Copyright 2005 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ * exported functions:
+ *
+ * int plugin_init_python (void)
+ * adds a python interpreter
+ *
+ */
+
+#include "config.h"
+#include <Python.h>
+#include "debug.h"
+#include "plugin.h"
+
+/*
+ * Executes a python function specified by function name and module.
+ *
+ * This method is more or less a copy of an example found in the python
+ * documentation. Kudos goes to Guido van Rossum and Fred L. Drake.
+ *
+ * Fixme: this function should be able to accept and receive any types
+ * of arguments supported by the evaluator. Right now only strings are accepted.
+ */
+
+static void pyt_exec_str(RESULT * result, const char *module, const char *function, int argc, const char *argv[])
+{
+
+ PyObject *pName, *pModule, *pDict, *pFunc;
+ PyObject *pArgs, *pValue;
+ const char *rv = NULL;
+ int i;
+
+ pName = PyString_FromString(module);
+ /* Error checking of pName left out */
+
+ pModule = PyImport_Import(pName);
+ Py_DECREF(pName);
+
+ if (pModule != NULL) {
+ pDict = PyModule_GetDict(pModule);
+ /* pDict is a borrowed reference */
+
+ pFunc = PyDict_GetItemString(pDict, function);
+ /* pFun: Borrowed reference */
+
+ if (pFunc && PyCallable_Check(pFunc)) {
+ pArgs = PyTuple_New(argc);
+ for (i = 0; i < argc; ++i) {
+ pValue = PyString_FromString(argv[i]);
+ if (!pValue) {
+ Py_DECREF(pArgs);
+ Py_DECREF(pModule);
+ error("Cannot convert argument \"%s\" to python format", argv[i]);
+ SetResult(&result, R_STRING, "");
+ return;
+ }
+ /* pValue reference stolen here: */
+ PyTuple_SetItem(pArgs, i, pValue);
+ }
+ pValue = PyObject_CallObject(pFunc, pArgs);
+ Py_DECREF(pArgs);
+ if (pValue != NULL) {
+ rv = PyString_AsString(pValue);
+ SetResult(&result, R_STRING, rv);
+ Py_DECREF(pValue);
+ /* rv is now a 'dangling reference' */
+ return;
+ } else {
+ Py_DECREF(pModule);
+ error("Python call failed (\"%s.%s\")", module, function);
+ /* print traceback on stderr */
+ PyErr_PrintEx(0);
+ SetResult(&result, R_STRING, "");
+ return;
+ }
+ /* pDict and pFunc are borrowed and must not be Py_DECREF-ed */
+ } else {
+ error("Can not find python function \"%s.%s\"", module, function);
+ }
+ Py_DECREF(pModule);
+ } else {
+ error("Failed to load python module \"%s\"", module);
+ /* print traceback on stderr */
+ PyErr_PrintEx(0);
+ }
+ SetResult(&result, R_STRING, "");
+ return;
+}
+
+static int python_cleanup_responsibility = 0;
+
+static void my_exec(RESULT * result, RESULT * module, RESULT * function, RESULT * arg)
+{
+ /* Fixme: a plugin should be able to accept any number of arguments, don't know how
+ to code that (yet) */
+ const char *args[] = { R2S(arg) };
+ pyt_exec_str(result, R2S(module), R2S(function), 1, args);
+}
+
+int plugin_init_python(void)
+{
+ if (!Py_IsInitialized()) {
+ Py_Initialize();
+ python_cleanup_responsibility = 1;
+ }
+ AddFunction("python::exec", 3, my_exec);
+ return 0;
+}
+
+void plugin_exit_python(void)
+{
+ /* Make sure NOT to call Py_Finalize() When (and if) the entire lcd4linux process
+ * is started from inside python
+ */
+ if (python_cleanup_responsibility) {
+ python_cleanup_responsibility = 0;
+ Py_Finalize();
+ }
+}
diff --git a/plugin_qnaplog.c b/plugin_qnaplog.c
new file mode 100644
index 0000000..b574b19
--- /dev/null
+++ b/plugin_qnaplog.c
@@ -0,0 +1,427 @@
+/* $Id: plugin_sample.c 733 2007-01-15 05:47:13Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/branches/0.10.1/plugin_qnaplog.c $
+ *
+ * plugin qnaplog
+ *
+ * Copyright (C) 2009 Ralf Tralow <qnaplog@ringwelt.de>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/* DOC:
+ * To compile the plugin remember to add -lsqlite3 option into Makefile. I.E: CC = gcc -lsqlite3
+ * or run:
+ * $ gcc -I/opt/include -L/opt/lib/sqlite3 plugin_qnaplog.c -lsqlite3 -o plugin_qnaplog.o
+ *
+ *
+ * exported functions:
+ *
+ * int plugin_init_qnaplog (void)
+ * void plugin_exit_qnaplog(void)
+ * static void my_status(RESULT * result, RESULT *arg1)
+ * static void my_conn(RESULT *result, RESULT *arg1)
+ * static void my_event(RESULT *result, RESULT *arg1)
+ *
+ *
+ * adds various functions
+ *
+ */
+
+/* define the include files you need */
+#include "config.h"
+#include "cfg.h"
+
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <stdio.h>
+#ifdef HAVE_SQLITE3_H
+#include <sqlite3.h>
+#else
+#warning sqlite3.h not found: plugin deactivated
+#endif
+#include <unistd.h>
+#include <sys/stat.h>
+#include <time.h>
+
+/* these should always be included */
+#include "debug.h"
+#include "plugin.h"
+
+#ifdef WITH_DMALLOC
+#include <dmalloc.h>
+#endif
+
+#ifdef HAVE_SQLITE3_H
+
+#define SQLSTATEMENT_CONN "select * from NASLOG_CONN ORDER BY conn_id DESC LIMIT 1"
+#define SQLSTATEMENT_EVENT "select * from NASLOG_EVENT ORDER BY event_id DESC LIMIT 1"
+
+time_t lastaccesstimeConn = 0;
+time_t lastaccesstimeEvent = 0;
+sqlite3 *connexConn;
+sqlite3 *connexEvent;
+char dbNameConn[256];
+char dbNameEvent[256];
+
+char conn_id[10];
+char conn_type[12];
+char conn_date[12];
+char conn_time[12];
+char conn_user[30];
+char conn_ip[16];
+char conn_comp[30];
+char conn_res[255];
+char conn_serv[10];
+char conn_action[12];
+
+char event_id[10];
+char event_comp[30];
+char event_date[12];
+char event_ip[16];
+char event_time[12];
+char event_type[12];
+char event_user[30];
+char event_desc[255];
+
+#define MAX_IDS_TYPE 3
+char *IDS_TYPE[MAX_IDS_TYPE] = { "Information", "Warning", "Error" };
+
+#define MAX_IDS_SERV 8
+char *IDS_SERV[MAX_IDS_SERV] = { "S0", "Samba", "S2", "HTTP", "S4", "S5", "S6", "SSH" };
+
+#define MAX_IDS_ACTION 16
+char *IDS_ACTION[MAX_IDS_ACTION] =
+ { "C0", "Delete", "Read", "Write", "C4", "C5", "C6", "C7", "C8", "Login fail", "Login ok", "Logout", "C12", "C13",
+ "C14", "Add"
+};
+
+static char Section[] = "Plugin:QnapLog";
+
+
+/** test the connection to conn.log
+ *
+ */
+static int configureConn(void)
+{
+ static int configured = 0;
+ char *s;
+ int rc;
+
+ if (configured != 0)
+ return configured;
+
+ s = cfg_get(Section, "databaseConn", "");
+ if (*s == '\0') {
+ info("[QnapLog] empty '%s.database' entry in %s, assuming none", Section, cfg_source());
+ strcpy(dbNameConn, "/etc/logs/conn.log");
+ } else {
+ snprintf(dbNameConn, sizeof(dbNameConn), "%s", s);
+ }
+ free(s);
+
+ rc = sqlite3_open(dbNameConn, &connexConn);
+ if (rc) {
+ error("[QnapLog] connection error: %s", sqlite3_errmsg(connexConn));
+ configured = -1;
+ sqlite3_close(connexConn);
+ return configured;
+ }
+
+ configured = 1;
+ return configured;
+}
+
+
+/** test the connection to event.log
+ *
+ */
+static int configureEvent(void)
+{
+ static int configured = 0;
+ char *s;
+ int rc;
+
+ if (configured != 0)
+ return configured;
+
+ s = cfg_get(Section, "databaseEvent", "");
+ if (*s == '\0') {
+ info("[QnapLog] empty '%s.database' entry in %s, assuming none", Section, cfg_source());
+ strcpy(dbNameEvent, "/etc/logs/event.log");
+ } else {
+ snprintf(dbNameEvent, sizeof(dbNameEvent), "%s", s);
+ }
+ free(s);
+
+ rc = sqlite3_open(dbNameEvent, &connexEvent);
+ if (rc) {
+ error("[QnapLog] connection error: %s", sqlite3_errmsg(connexEvent));
+ configured = -1;
+ sqlite3_close(connexEvent);
+ return configured;
+ }
+
+ configured = 1;
+ return configured;
+}
+
+
+/** callback function for conn request
+ *
+ */
+static int callbackConn(void *NotUsed, int argc, char **argv, char **azColName)
+{
+ int i;
+ int c;
+
+ for (i = 0; i < argc; i++) {
+ if (strcmp(azColName[i], "conn_id") == 0) {
+ snprintf(conn_id, sizeof(conn_id), "%s", argv[i] ? argv[i] : "NULL");
+ } else if (strcmp(azColName[i], "conn_type") == 0) {
+ c = atoi(argv[i]);
+ if (c < MAX_IDS_TYPE)
+ snprintf(conn_type, sizeof(conn_type), "%s", IDS_TYPE[c]);
+ } else if (strcmp(azColName[i], "conn_date") == 0) {
+ snprintf(conn_date, sizeof(conn_date), "%s", argv[i] ? argv[i]
+ : "NULL");
+ } else if (strcmp(azColName[i], "conn_time") == 0) {
+ snprintf(conn_time, sizeof(conn_time), "%s", argv[i] ? argv[i]
+ : "NULL");
+ } else if (strcmp(azColName[i], "conn_user") == 0) {
+ snprintf(conn_user, sizeof(conn_user), "%s", argv[i] ? argv[i]
+ : "NULL");
+ } else if (strcmp(azColName[i], "conn_ip") == 0) {
+ snprintf(conn_ip, sizeof(conn_ip), "%s", argv[i] ? argv[i] : "NULL");
+ } else if (strcmp(azColName[i], "conn_comp") == 0) {
+ snprintf(conn_comp, sizeof(conn_comp), "%s", argv[i] ? argv[i]
+ : "NULL");
+ } else if (strcmp(azColName[i], "conn_res") == 0) {
+ snprintf(conn_res, sizeof(conn_res), "%s", argv[i] ? argv[i]
+ : "NULL");
+ } else if (strcmp(azColName[i], "conn_serv") == 0) {
+ c = atoi(argv[i]);
+ if (c < MAX_IDS_SERV)
+ snprintf(conn_serv, sizeof(conn_serv), "%s", IDS_SERV[c]);
+ } else if (strcmp(azColName[i], "conn_action") == 0) {
+ c = atoi(argv[i]);
+ if (c < MAX_IDS_ACTION)
+ snprintf(conn_action, sizeof(conn_action), "%s", IDS_ACTION[c]);
+ }
+ }
+
+ return 0;
+}
+
+
+/** callback function for event request
+ *
+ */
+static int callbackEvent(void *NotUsed, int argc, char **argv, char **azColName)
+{
+ int i;
+ int c;
+
+ for (i = 0; i < argc; i++) {
+ if (strcmp(azColName[i], "event_id") == 0) {
+ snprintf(event_id, sizeof(event_id), "%s", argv[i] ? argv[i] : "NULL");
+ } else if (strcmp(azColName[i], "event_type") == 0) {
+ c = *argv[i] & 0x0F;
+ if (c < MAX_IDS_TYPE)
+ snprintf(event_type, sizeof(event_type), "%s", IDS_TYPE[c]);
+ } else if (strcmp(azColName[i], "event_date") == 0) {
+ snprintf(event_date, sizeof(event_date), "%s", argv[i] ? argv[i]
+ : "NULL");
+ } else if (strcmp(azColName[i], "event_time") == 0) {
+ snprintf(event_time, sizeof(event_time), "%s", argv[i] ? argv[i]
+ : "NULL");
+ } else if (strcmp(azColName[i], "event_user") == 0) {
+ snprintf(event_user, sizeof(event_user), "%s", argv[i] ? argv[i]
+ : "NULL");
+ } else if (strcmp(azColName[i], "event_ip") == 0) {
+ snprintf(event_ip, sizeof(event_ip), "%s", argv[i] ? argv[i] : "NULL");
+ } else if (strcmp(azColName[i], "event_comp") == 0) {
+ snprintf(event_comp, sizeof(event_comp), "%s", argv[i] ? argv[i]
+ : "NULL");
+ } else if (strcmp(azColName[i], "event_desc") == 0) {
+ snprintf(event_desc, sizeof(event_desc), "%s", argv[i] ? argv[i]
+ : "NULL");
+ }
+ }
+
+ return 0;
+}
+
+
+/** request last of qnap connection
+ *
+ */
+static void my_conn(RESULT * result, RESULT * arg1)
+{
+ char *key;
+ char *value;
+ char *zErrMsg = 0;
+ int rc;
+ struct stat attrib; // create a file attribute structure
+ time_t accesstime;
+
+
+ value = NULL;
+ key = R2S(arg1);
+
+ if (configureConn() >= 0) {
+ stat(dbNameConn, &attrib); // get the attributes
+ accesstime = attrib.st_mtime; // Get the last modified time and put it into the time structure
+
+ if (accesstime > lastaccesstimeConn) {
+ lastaccesstimeConn = accesstime;
+ rc = sqlite3_exec(connexConn, SQLSTATEMENT_CONN, callbackConn, 0, &zErrMsg);
+ if (rc != SQLITE_OK) {
+ fprintf(stderr, "SQL error: %s\n", zErrMsg);
+ sqlite3_free(zErrMsg);
+ }
+ }
+
+ if (strcasecmp(key, "id") == 0) {
+ value = conn_id;
+ } else if (strcasecmp(key, "type") == 0) {
+ value = conn_type;
+ } else if (strcasecmp(key, "date") == 0) {
+ value = conn_date;
+ } else if (strcasecmp(key, "time") == 0) {
+ value = conn_time;
+ } else if (strcasecmp(key, "user") == 0) {
+ value = conn_user;
+ } else if (strcasecmp(key, "ip") == 0) {
+ value = conn_ip;
+ } else if (strncasecmp(key, "res", 3) == 0) {
+ value = conn_res;
+ } else if (strncasecmp(key, "serv", 4) == 0) {
+ value = conn_serv;
+ } else if (strncasecmp(key, "act", 3) == 0) {
+ value = conn_action;
+ } else if (strncasecmp(key, "comp", 4) == 0) {
+ value = conn_comp;
+ }
+ }
+
+ /* store result */
+ SetResult(&result, R_STRING, value);
+}
+
+/** request last qnap event
+ *
+ */
+static void my_event(RESULT * result, RESULT * arg1)
+{
+ char *key;
+ char *value;
+ char *zErrMsg = 0;
+ int rc;
+ struct stat attrib; // create a file attribute structure
+ time_t accesstime;
+
+
+ value = NULL;
+ key = R2S(arg1);
+
+ if (configureEvent() >= 0) {
+ stat(dbNameEvent, &attrib); // get the attributes
+ accesstime = attrib.st_mtime; // Get the last modified time and put it into the time structure
+
+ if (accesstime > lastaccesstimeEvent) {
+ lastaccesstimeEvent = accesstime;
+ rc = sqlite3_exec(connexEvent, SQLSTATEMENT_EVENT, callbackEvent, 0, &zErrMsg);
+ if (rc != SQLITE_OK) {
+ fprintf(stderr, "SQL error: %s\n", zErrMsg);
+ sqlite3_free(zErrMsg);
+ }
+ }
+
+ if (strcasecmp(key, "id") == 0) {
+ value = event_id;
+ } else if (strncasecmp(key, "comp", 4) == 0) {
+ value = event_comp;
+ } else if (strcasecmp(key, "date") == 0) {
+ value = event_date;
+ } else if (strcasecmp(key, "ip") == 0) {
+ value = event_ip;
+ } else if (strcasecmp(key, "time") == 0) {
+ value = event_time;
+ } else if (strcasecmp(key, "type") == 0) {
+ value = event_type;
+ } else if (strcasecmp(key, "user") == 0) {
+ value = event_user;
+ } else if (strncasecmp(key, "desc", 4) == 0) {
+ value = event_desc;
+ }
+ }
+
+ /* store result */
+ SetResult(&result, R_STRING, value);
+}
+
+/** status for conn or event connection
+ *
+ */
+static void my_status(RESULT * result, RESULT * arg1)
+{
+ const char *value = "";
+ const char *status = "Ok";
+ char *key;
+
+
+ key = R2S(arg1);
+ if (strcmp(key, "conn") == 0) {
+ if (configureConn() > 0) {
+ value = status;
+ }
+ } else if (strcmp(key, "event") == 0) {
+ if (configureEvent() > 0) {
+ value = status;
+ }
+ }
+
+ SetResult(&result, R_STRING, value);
+}
+
+#endif
+
+/* plugin initialization */
+int plugin_init_qnaplog(void)
+{
+#ifdef HAVE_SQLITE3_H
+ /* register all our cool functions */
+ /* the second parameter is the number of arguments */
+ /* -1 stands for variable argument list */
+ AddFunction("qnaplog::status", 1, my_status);
+ AddFunction("qnaplog::conn", 1, my_conn);
+ AddFunction("qnaplog::event", 1, my_event);
+#endif
+ return 0;
+}
+
+void plugin_exit_qnaplog(void)
+{
+#ifdef HAVE_SQLITE3_H
+ /* free any allocated memory */
+ /* close filedescriptors */
+ sqlite3_close(connexConn);
+ sqlite3_close(connexEvent);
+#endif
+}
diff --git a/plugin_raspi.c b/plugin_raspi.c
new file mode 100644
index 0000000..445eff3
--- /dev/null
+++ b/plugin_raspi.c
@@ -0,0 +1,187 @@
+/* $Id: plugin_raspi.c 1199 2013-05-23 03:07:28Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/plugin_raspi.c $
+ *
+ * plugin raspi
+ *
+ * Copyright (C) 2003 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2013 Volker Gerng <v.gering@t-online.de>
+ * Copyright (C) 2013 Jonathan McCrohan <jmccrohan@gmail.com>
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ * exported functions:
+ *
+ * int plugin_init_raspi (void)
+ * adds functions to get information about internal sensors of raspberry pi
+ *
+ */
+
+
+#include "config.h"
+
+/* these should always be included */
+#include "debug.h"
+#include "plugin.h"
+#include "cfg.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <unistd.h>
+
+#ifdef WITH_DMALLOC
+#include <dmalloc.h>
+#endif
+
+
+#define RASPI_FREQ_PATH "/sys/devices/system/cpu/cpu0/cpufreq/"
+#define RASPI_FREQ_VALUE "cpuinfo_cur_freq"
+#define RASPI_FREQ_IDFILE "scaling_driver"
+#define RASPI_FREQ_ID "BCM2835 CPUFreq"
+#define RASPI_TEMP_PATH "/sys/class/thermal/thermal_zone0/"
+#define RASPI_TEMP_VALUE "temp"
+#define RASPI_TEMP_IDFILE "type"
+#define RASPI_TEMP_ID "bcm2835_thermal"
+
+#define _cat(a,b) (a##b)
+#define strings(a, b) "_cat(a,b)"
+
+
+static char Section[] = "Plugin:raspi";
+static int plugin_enabled;
+char tmpstr[128];
+
+
+/* Note: all local functions should be declared 'static' */
+
+/* reading an positive integer value from path, -1 on error */
+static int readValue(char *path)
+{
+ int value = -1;
+ FILE *fp;
+
+ fp = fopen(path, "r");
+ if (NULL != fp) {
+ fgets(tmpstr, sizeof(tmpstr), fp);
+ fclose(fp);
+ if (1 != sscanf(tmpstr, "%i", &value)) {
+ error("[raspi] error reading integer value from %s\n", path);
+ }
+ } else {
+ error("[raspi] error opening %s: %s\n", path, strerror(errno));
+ }
+
+ return value;
+}
+
+
+/* reads a string from path */
+static char *readStr(char *path)
+{
+ FILE *fp;
+
+ memset(tmpstr, 0, sizeof(tmpstr));
+ fp = fopen(path, "r");
+ if (NULL != fp) {
+ fgets(tmpstr, sizeof(tmpstr), fp);
+ fclose(fp);
+ } else {
+ error("[raspi] error reading text value from %s: %s\n", path, strerror(errno));
+ }
+
+ return tmpstr;
+}
+
+
+/* reads the actual cpu frequency of the bcm2708 cpu */
+static void my_cpufreq(RESULT * result)
+{
+ snprintf(tmpstr, sizeof(tmpstr), "%s%s", RASPI_FREQ_PATH, RASPI_FREQ_VALUE);
+ double value = readValue(tmpstr) / 1000.0L;
+
+ info("[raspi] actual cpu frequency: %.2f MHz", value);
+ SetResult(&result, R_NUMBER, &value);
+}
+
+
+/* reads the actual cpu temperature in degree Celsius */
+static void my_cputemp(RESULT * result)
+{
+ snprintf(tmpstr, sizeof(tmpstr), "%s%s", RASPI_TEMP_PATH, RASPI_TEMP_VALUE);
+ double value = readValue(tmpstr) / 1000.0L;
+
+ info("[raspi] actual cpu temperature: %.1f C", value);
+ SetResult(&result, R_NUMBER, &value);
+}
+
+
+/* plugin initialization */
+/* MUST NOT be declared 'static'! */
+int plugin_init_raspi(void)
+{
+ /* Check if raspi plugin section exists in config file */
+ if (cfg_number(Section, "enabled", 0, 0, 1, &plugin_enabled) < 1) {
+ plugin_enabled = 0;
+ }
+
+ /* Disable plugin unless it is explicitly enabled */
+ if (plugin_enabled != 1) {
+ info("[raspi] WARNING: Plugin is not enabled! (set 'enabled 1' to enable this plugin)");
+ return 0;
+ }
+
+ char checkFile[128];
+
+ snprintf(checkFile, sizeof(checkFile), "%s%s", RASPI_TEMP_PATH, RASPI_TEMP_IDFILE);
+ if (strncmp(readStr(checkFile), RASPI_TEMP_ID, strlen(RASPI_TEMP_ID)) != 0) {
+ error("Warning: no raspberry pi thermal sensor found: value of '%s' is '%s', should be '%s'",
+ checkFile, readStr(checkFile), RASPI_TEMP_IDFILE);
+ }
+
+ snprintf(checkFile, sizeof(checkFile), "%s%s", RASPI_TEMP_PATH, RASPI_TEMP_VALUE);
+ if (0 == access(checkFile, R_OK)) {
+ AddFunction("raspi::cputemp", 0, my_cputemp);
+ } else {
+ error("Error: File '%s' not readable, no temperature sensor found", checkFile);
+ }
+
+ snprintf(checkFile, sizeof(checkFile), "%s%s", RASPI_FREQ_PATH, RASPI_FREQ_IDFILE);
+ if (strncmp(readStr(checkFile), RASPI_FREQ_ID, strlen(RASPI_FREQ_ID)) != 0) {
+ error("Warning: no raspberry pi frequence sensor found: value of '%s' is '%s', should be '%s'",
+ checkFile, readStr(checkFile), RASPI_FREQ_IDFILE);
+ }
+
+ snprintf(checkFile, sizeof(checkFile), "%s%s", RASPI_FREQ_PATH, RASPI_FREQ_VALUE);
+ if (0 == access(checkFile, R_OK)) {
+ AddFunction("raspi::cpufreq", 0, my_cpufreq);
+ } else {
+ error("Error: File '%s' not readable, no frequency sensor found", checkFile);
+ }
+
+ return 0;
+}
+
+void plugin_exit_raspi(void)
+{
+ /* free any allocated memory */
+ /* close filedescriptors */
+}
diff --git a/plugin_sample.c b/plugin_sample.c
new file mode 100644
index 0000000..ff0e5eb
--- /dev/null
+++ b/plugin_sample.c
@@ -0,0 +1,220 @@
+/* $Id: plugin_sample.c 1091 2010-01-21 04:26:24Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/plugin_sample.c $
+ *
+ * plugin template
+ *
+ * Copyright (C) 2003 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ * exported functions:
+ *
+ * int plugin_init_sample (void)
+ * adds various functions
+ *
+ */
+
+
+#include "config.h"
+
+/* these should always be included */
+#include "debug.h"
+#include "plugin.h"
+
+/* define the include files you need */
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+
+#ifdef WITH_DMALLOC
+#include <dmalloc.h>
+#endif
+
+
+
+/* sample function 'mul2' */
+/* takes one argument, a number */
+/* multiplies the number by 2.0 */
+/* Note: all local functions should be declared 'static' */
+
+static void my_mul2(RESULT * result, RESULT * arg1)
+{
+ double param;
+ double value;
+
+ /* Get Parameter */
+ /* R2N stands for 'Result to Number' */
+ param = R2N(arg1);
+
+ /* calculate value */
+ value = param * 2.0;
+
+ /* store result */
+ /* when called with R_NUMBER, it assumes the */
+ /* next parameter to be a pointer to double */
+ SetResult(&result, R_NUMBER, &value);
+}
+
+
+/* sample function 'mul3' */
+/* takes one argument, a number */
+/* multiplies the number by 3.0 */
+/* same as 'mul2', but shorter */
+
+static void my_mul3(RESULT * result, RESULT * arg1)
+{
+ /* do it all in one line */
+ double value = R2N(arg1) * 3.0;
+
+ /* store result */
+ SetResult(&result, R_NUMBER, &value);
+}
+
+
+/* sample function 'diff' */
+/* takes two arguments, both numbers */
+/* returns |a-b| */
+
+static void my_diff(RESULT * result, RESULT * arg1, RESULT * arg2)
+{
+ /* do it all in one line */
+ double value = R2N(arg1) - R2N(arg2);
+
+ /* some more calculations... */
+ if (value < 0)
+ value = -value;
+
+ /* store result */
+ SetResult(&result, R_NUMBER, &value);
+}
+
+
+/* sample function 'answer' */
+/* takes no argument! */
+/* returns the answer to all questions */
+
+static void my_answer(RESULT * result)
+{
+ /* we have to declare a variable because */
+ /* SetResult needs a pointer */
+ double value = 42;
+
+ /* store result */
+ SetResult(&result, R_NUMBER, &value);
+}
+
+
+/* sample function 'length' */
+/* takes one argument, a string */
+/* returns the string length */
+
+static void my_length(RESULT * result, RESULT * arg1)
+{
+ /* Note #1: value *must* be double! */
+ /* Note #2: R2S stands for 'Result to String' */
+ double value = strlen(R2S(arg1));
+
+ /* store result */
+ SetResult(&result, R_NUMBER, &value);
+}
+
+
+
+/* sample function 'upcase' */
+/* takes one argument, a string */
+/* returns the string in upper case letters */
+
+static void my_upcase(RESULT * result, RESULT * arg1)
+{
+ char *value, *p;
+
+ /* create a local copy of the argument */
+ /* Do *NOT* try to modify the original string! */
+ value = strdup(R2S(arg1));
+
+ /* process the string */
+ for (p = value; *p != '\0'; p++)
+ *p = toupper(*p);
+
+ /* store result */
+ /* when called with R_STRING, it assumes the */
+ /* next parameter to be a pointer to a string */
+ /* 'value' is already a char*, so use 'value', not '&value' */
+ SetResult(&result, R_STRING, value);
+
+ /* free local copy again */
+ /* Note that SetResult() makes its own string copy */
+ free(value);
+}
+
+
+/* sample function 'cat' */
+/* takes variable number of arguments, all strings */
+/* returns all prameters concatenated */
+
+static void my_concat(RESULT * result, int argc, RESULT * argv[])
+{
+ int i, len;
+ char *value, *part;
+
+ /* start with a empty string */
+ value = strdup("");
+
+ /* process all arguments */
+ for (i = 0; i < argc; i++) {
+ part = R2S(argv[i]);
+ len = strlen(value) + strlen(part);
+ value = realloc(value, len + 1);
+ strcat(value, part);
+ }
+
+ /* store result */
+ SetResult(&result, R_STRING, value);
+
+ /* free local string */
+ free(value);
+}
+
+
+/* plugin initialization */
+/* MUST NOT be declared 'static'! */
+int plugin_init_sample(void)
+{
+
+ /* register all our cool functions */
+ /* the second parameter is the number of arguments */
+ /* -1 stands for variable argument list */
+ AddFunction("sample::mul2", 1, my_mul2);
+ AddFunction("sample::mul3", 1, my_mul3);
+ AddFunction("sample::answer", 0, my_answer);
+ AddFunction("sample::diff", 2, my_diff);
+ AddFunction("sample::length", 1, my_length);
+ AddFunction("sample::upcase", 1, my_upcase);
+ AddFunction("sample::concat", -1, my_concat);
+
+ return 0;
+}
+
+void plugin_exit_sample(void)
+{
+ /* free any allocated memory */
+ /* close filedescriptors */
+}
diff --git a/plugin_seti.c b/plugin_seti.c
new file mode 100644
index 0000000..68b2f5b
--- /dev/null
+++ b/plugin_seti.c
@@ -0,0 +1,163 @@
+/* $Id: plugin_seti.c 1136 2010-11-28 16:07:16Z mzuther $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/plugin_seti.c $
+ *
+ * plugin for seti@home status reporting
+ *
+ * Copyright (C) 2004 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * based on the old seti client which is
+ * Copyright (C) 2001 Axel Ehnert <axel@ehnert.net>
+ *
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ * exported functions:
+ *
+ * int plugin_init_seti (void)
+ * adds functions to access /seti/state.sah
+ *
+ */
+
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+#include <errno.h>
+
+#include "debug.h"
+#include "plugin.h"
+#include "hash.h"
+#include "cfg.h"
+
+#define SECTION "Plugin:Seti"
+#define DIRKEY "Directory"
+#define STATEFILE "state.sah"
+
+static HASH SETI;
+static int fatal = 0;
+
+static int parse_seti(void)
+{
+ static char fn[256] = "";
+ FILE *stream;
+ int age;
+
+ /* if a fatal error occurred, do nothing */
+ if (fatal != 0)
+ return -1;
+
+ /* reread every 100 msec only */
+ age = hash_age(&SETI, NULL);
+ if (age > 0 && age <= 100)
+ return 0;
+
+ if (fn[0] == '\0') {
+ char *dir = cfg_get(SECTION, DIRKEY, NULL);
+ if (dir == NULL || *dir == '\0') {
+ error("no '%s.%s' entry from %s\n", SECTION, DIRKEY, cfg_source());
+ fatal = 1;
+ return -1;
+ }
+ if (strlen(dir) > sizeof(fn) - sizeof(STATEFILE) - 2) {
+ error("entry '%s.%s' too long from %s!\n", SECTION, DIRKEY, cfg_source());
+ fatal = 1;
+ free(dir);
+ return -1;
+ }
+ strcpy(fn, dir);
+ if (fn[strlen(fn) - 1] != '/')
+ strcat(fn, "/");
+ strcat(fn, STATEFILE);
+ free(dir);
+ }
+
+ stream = fopen(fn, "r");
+ if (stream == NULL) {
+ error("fopen(%s) failed: %s", fn, strerror(errno));
+ return -1;
+ }
+
+ while (!feof(stream)) {
+ char buffer[256];
+ char *c, *key, *val;
+ fgets(buffer, sizeof(buffer), stream);
+ c = strchr(buffer, '=');
+ if (c == NULL)
+ continue;
+ key = buffer;
+ val = c + 1;
+ /* strip leading blanks from key */
+ while (isspace(*key))
+ *key++ = '\0';
+ /* strip trailing blanks from key */
+ do
+ *c = '\0';
+ while (isspace(*--c));
+ /* strip leading blanks from value */
+ while (isspace(*val))
+ *val++ = '\0';
+ /* strip trailing blanks from value */
+ for (c = val; *c != '\0'; c++);
+ while (isspace(*--c))
+ *c = '\0';
+ /* add entry to hash table */
+ hash_put(&SETI, key, val);
+ }
+
+ fclose(stream);
+
+ return 0;
+}
+
+
+static void my_seti(RESULT * result, RESULT * arg1)
+{
+ char *key, *val;
+
+ if (parse_seti() < 0) {
+ SetResult(&result, R_STRING, "");
+ return;
+ }
+
+ key = R2S(arg1);
+ val = hash_get(&SETI, key, NULL);
+ if (val == NULL)
+ val = "";
+
+ SetResult(&result, R_STRING, val);
+}
+
+
+int plugin_init_seti(void)
+{
+ hash_create(&SETI);
+ AddFunction("seti", 1, my_seti);
+ return 0;
+}
+
+
+void plugin_exit_seti(void)
+{
+ hash_destroy(&SETI);
+}
diff --git a/plugin_statfs.c b/plugin_statfs.c
new file mode 100644
index 0000000..c75b834
--- /dev/null
+++ b/plugin_statfs.c
@@ -0,0 +1,100 @@
+/* $Id: plugin_statfs.c 840 2007-09-09 12:17:42Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/plugin_statfs.c $
+ *
+ * plugin for statfs() syscall
+ *
+ * Copyright (C) 2005 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2005 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ * exported functions:
+ *
+ * int plugin_init_statfs (void)
+ * adds statfs() functions
+ *
+ */
+
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include <sys/vfs.h>
+
+#include "debug.h"
+#include "plugin.h"
+
+
+
+static void my_statfs(RESULT * result, RESULT * arg1, RESULT * arg2)
+{
+ struct statfs buf;
+ char *path, *key;
+ double value;
+
+ path = R2S(arg1);
+ key = R2S(arg2);
+
+ if (statfs(path, &buf) != 0) {
+ error("statfs(%s) failed: %s", path, strerror(errno));
+ SetResult(&result, R_STRING, "");
+ return;
+ }
+
+ if (strcasecmp(key, "type") == 0) {
+ value = buf.f_type;
+ } else if (strcasecmp(key, "bsize") == 0) {
+ value = buf.f_bsize;
+ } else if (strcasecmp(key, "blocks") == 0) {
+ value = buf.f_blocks;
+ } else if (strcasecmp(key, "bfree") == 0) {
+ value = buf.f_bfree;
+ } else if (strcasecmp(key, "bavail") == 0) {
+ value = buf.f_bavail;
+ } else if (strcasecmp(key, "files") == 0) {
+ value = buf.f_files;
+ } else if (strcasecmp(key, "ffree") == 0) {
+ value = buf.f_ffree;
+#if 0
+ } else if (strcasecmp(key, "fsid") == 0) {
+ value = buf.f_fsid;
+#endif
+ } else if (strcasecmp(key, "namelen") == 0) {
+ value = buf.f_namelen;
+ } else {
+ error("statfs: unknown field '%s'", key);
+ value = -1;
+ }
+
+ SetResult(&result, R_NUMBER, &value);
+}
+
+
+int plugin_init_statfs(void)
+{
+ AddFunction("statfs", 2, my_statfs);
+ return 0;
+}
+
+void plugin_exit_statfs(void)
+{
+}
diff --git a/plugin_string.c b/plugin_string.c
new file mode 100644
index 0000000..ba1c227
--- /dev/null
+++ b/plugin_string.c
@@ -0,0 +1,145 @@
+/* $Id: plugin_string.c 840 2007-09-09 12:17:42Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/plugin_string.c $
+ *
+ * string plugin
+ *
+ * Copyright (C) 2003, 2004 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ * exported functions:
+ *
+ * int plugin_init_string (void)
+ * adds some handy string functions
+ *
+ */
+
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+
+#include "debug.h"
+#include "plugin.h"
+
+
+static void my_strlen(RESULT * result, RESULT * arg1)
+{
+ double value = strlen(R2S(arg1));
+ SetResult(&result, R_NUMBER, &value);
+}
+
+/* 'upcase' function (shamelessly stolen from plugin_sample.c)*/
+/* returns the string in upper case letters */
+static void my_strupper(RESULT * result, RESULT * arg1)
+{
+ char *value, *p;
+
+ value = strdup(R2S(arg1));
+
+ for (p = value; *p != '\0'; p++)
+ *p = toupper(*p);
+
+ SetResult(&result, R_STRING, value);
+ free(value);
+}
+
+static void my_strstr(RESULT * result, RESULT * arg1, RESULT * arg2)
+{
+ char *p;
+ double value;
+
+ char *haystack = R2S(arg1);
+ char *needle = R2S(arg2);
+
+ p = strstr(haystack, needle);
+
+ if (p == NULL) {
+ value = -1;
+ } else {
+ value = p - haystack;
+ }
+
+ SetResult(&result, R_NUMBER, &value);
+}
+
+static void my_substr(RESULT * result, int argc, RESULT * argv[])
+{
+ char *str, *p1, *p2;
+ int pos, len;
+
+ if (argc < 2 || argc > 3) {
+ error("substr(): wrong number of parameters");
+ SetResult(&result, R_STRING, "");
+ return;
+ }
+
+ str = strdup(R2S(argv[0]));
+
+ pos = R2N(argv[1]);
+ if (pos < 0)
+ pos = 0;
+
+ if (argc == 3) {
+ len = R2N(argv[2]);
+ if (len < 0)
+ len = 0;
+ } else {
+ len = -1;
+ }
+
+ p1 = str;
+ while (pos > 0 && *p1 != '\0') {
+ p1++;
+ pos--;
+ }
+
+ if (len >= 0) {
+ p2 = p1;
+ while (len > 0 && *p2 != '\0') {
+ p2++;
+ len--;
+ }
+ *p2 = '\0';
+ }
+
+ SetResult(&result, R_STRING, p1);
+ free(str);
+}
+
+int plugin_init_string(void)
+{
+
+ /* register some basic string functions */
+ AddFunction("strlen", 1, my_strlen);
+ AddFunction("strupper", 1, my_strupper);
+ AddFunction("strstr", 2, my_strstr);
+ AddFunction("substr", -1, my_substr);
+ return 0;
+}
+
+void plugin_exit_string(void)
+{
+ /* empty */
+}
diff --git a/plugin_test.c b/plugin_test.c
new file mode 100644
index 0000000..340854f
--- /dev/null
+++ b/plugin_test.c
@@ -0,0 +1,112 @@
+/* $Id: plugin_test.c 840 2007-09-09 12:17:42Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/plugin_test.c $
+*
+* Handy functions for testing displays and debugging code.
+*
+* Copyright (C) 2004 Andy Baxter.
+*
+* Based on sample plugin which is
+* Copyright (C) 2003 Michael Reinelt <michael@reinelt.co.at>
+* Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+*
+* This file is part of LCD4Linux.
+*
+* LCD4Linux is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation; either version 2, or (at your option)
+* any later version.
+*
+* LCD4Linux is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*
+*/
+
+int plugin_init_test(void);
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <ctype.h>
+
+#include "debug.h"
+#include "plugin.h"
+
+#ifdef WITH_DMALLOC
+#include <dmalloc.h>
+#endif
+
+
+/* used for testing bars - keeps values for a series of 10 bars,
+ * which are incremented and decremented between 0 and rmax by
+ * amount rdelta every time they are read. Starting value is rstart.
+ * rbar gives the number of the test bar.
+ */
+static void my_test_bar(RESULT * result, RESULT * rbar, RESULT * rmax, RESULT * rstart, RESULT * rdelta)
+{
+ static double values[10] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 };
+ static double deltas[10];
+ int bar;
+ double max, delta, value;
+
+ max = R2N(rmax);
+ delta = R2N(rdelta);
+
+ /* the maths is just to stop double rounding errors and bad values. */
+ bar = ((int) floor(R2N(rbar) + 0.1)) % 10;
+ if (fabs(delta) > 0.1) {
+ /* don't move or init the bar if delta=0 (the widget is only browsing) */
+ if (values[bar] == -1) {
+ /* first time called. */
+ values[bar] = R2N(rstart);
+ deltas[bar] = delta;
+ };
+ values[bar] += deltas[bar];
+ };
+ if (values[bar] < 0 || values[bar] > max) {
+ /* turn around. */
+ deltas[bar] = -deltas[bar];
+ values[bar] += deltas[bar];
+ };
+ value = values[bar];
+ SetResult(&result, R_NUMBER, &value);
+}
+
+
+/* like above, but just switches a value between 1 and -1. Can use to test
+ * visibility of icons.
+ */
+static void my_test_onoff(RESULT * result, RESULT * arg1)
+{
+ static int on[10] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 };
+ int i;
+ double val;
+
+ i = ((int) floor(R2N(arg1) + 0.1)) % 10;
+ on[i] = -on[i];
+ val = (double) on[i];
+
+ SetResult(&result, R_NUMBER, &val);
+}
+
+
+int plugin_init_test(void)
+{
+
+ AddFunction("test::bar", 4, my_test_bar);
+ AddFunction("test::onoff", 1, my_test_onoff);
+
+ return 0;
+}
+
+void plugin_exit_test(void)
+{
+ /* empty */
+}
diff --git a/plugin_time.c b/plugin_time.c
new file mode 100644
index 0000000..324f5b8
--- /dev/null
+++ b/plugin_time.c
@@ -0,0 +1,113 @@
+/* $Id: plugin_time.c 897 2008-10-06 04:25:14Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/plugin_time.c $
+ *
+ * time plugin
+ *
+ * Copyright (C) 2003, 2004 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ * exported functions:
+ *
+ * int plugin_init_time (void)
+ * adds some handy time functions
+ *
+ */
+
+
+#include "config.h"
+
+#include <time.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "debug.h"
+#include "plugin.h"
+
+
+static void my_time(RESULT * result)
+{
+ double value = time(NULL);
+ SetResult(&result, R_NUMBER, &value);
+}
+
+
+static void my_strftime(RESULT * result, RESULT * arg1, RESULT * arg2)
+{
+ char value[256];
+ time_t t = R2N(arg2);
+
+ value[0] = '\0';
+ strftime(value, sizeof(value), R2S(arg1), localtime(&t));
+
+ SetResult(&result, R_STRING, value);
+}
+
+static void my_stftime_tz(RESULT * result, RESULT * arg1, RESULT * arg2, RESULT * arg3)
+{
+ char value[256] = "";
+ time_t t = R2N(arg2);
+ char *tz = R2S(arg3);
+ char *old_tz;
+
+ old_tz = getenv("TZ");
+
+ /*
+ * because the next setenv() call may overwrite that string, we
+ * duplicate it here
+ */
+ if (old_tz) {
+ old_tz = strdup(old_tz);
+ }
+
+ setenv("TZ", tz, 1);
+ tzset();
+
+ strftime(value, sizeof(value), R2S(arg1), localtime(&t));
+
+ if (old_tz) {
+ setenv("TZ", old_tz, 1);
+ } else {
+ unsetenv("TZ");
+ }
+ tzset();
+
+ free(old_tz);
+
+ SetResult(&result, R_STRING, value);
+}
+
+
+int plugin_init_time(void)
+{
+
+ /* register some basic time functions */
+ AddFunction("time", 0, my_time);
+ AddFunction("strftime", 2, my_strftime);
+ AddFunction("strftime_tz", 3, my_stftime_tz);
+
+ return 0;
+}
+
+void plugin_exit_time(void)
+{
+ /* empty */
+}
diff --git a/plugin_uname.c b/plugin_uname.c
new file mode 100644
index 0000000..9f1c3b0
--- /dev/null
+++ b/plugin_uname.c
@@ -0,0 +1,92 @@
+/* $Id: plugin_uname.c 1002 2009-03-26 08:06:12Z michux $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/plugin_uname.c $
+ *
+ * plugin for uname() syscall
+ *
+ * Copyright (C) 2003 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ * exported functions:
+ *
+ * int plugin_init_uname (void)
+ * adds uname() functions
+ *
+ */
+
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include <sys/utsname.h>
+
+#include "debug.h"
+#include "plugin.h"
+
+
+
+static void my_uname(RESULT * result, RESULT * arg1)
+{
+ struct utsname utsbuf;
+ char *key, *value;
+
+ key = R2S(arg1);
+
+ if (uname(&utsbuf) != 0) {
+ error("uname() failed: %s", strerror(errno));
+ SetResult(&result, R_STRING, "");
+ return;
+ }
+
+ if (strcasecmp(key, "sysname") == 0) {
+ value = utsbuf.sysname;
+ } else if (strcasecmp(key, "nodename") == 0) {
+ value = utsbuf.nodename;
+ } else if (strcasecmp(key, "release") == 0) {
+ value = utsbuf.release;
+ } else if (strcasecmp(key, "version") == 0) {
+ value = utsbuf.version;
+ } else if (strcasecmp(key, "machine") == 0) {
+ value = utsbuf.machine;
+#if defined(_GNU_SOURCE) && ! defined(__APPLE__) && ! defined(__CYGWIN__)
+ } else if (strcasecmp(key, "domainname") == 0) {
+ value = utsbuf.domainname;
+#endif
+ } else {
+ error("uname: unknown field '%s'", key);
+ value = "";
+ }
+
+ SetResult(&result, R_STRING, value);
+}
+
+
+int plugin_init_uname(void)
+{
+ AddFunction("uname", 1, my_uname);
+ return 0;
+}
+
+void plugin_exit_uname(void)
+{
+}
diff --git a/plugin_uptime.c b/plugin_uptime.c
new file mode 100644
index 0000000..1d0e575
--- /dev/null
+++ b/plugin_uptime.c
@@ -0,0 +1,238 @@
+/* $Id: plugin_uptime.c 840 2007-09-09 12:17:42Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/plugin_uptime.c $
+ *
+ * plugin for uptime
+ *
+ * Copyright (C) 2003 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ * exported functions:
+ *
+ * int plugin_init_uptime (void)
+ * adds functions for uptime
+ *
+ */
+
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/time.h>
+#include <fcntl.h>
+
+#include "debug.h"
+#include "plugin.h"
+
+static int fd = -2;
+
+
+static char *itoa(char *buffer, const size_t size, unsigned int value)
+{
+ char *p;
+
+ /* sanity checks */
+ if (buffer == NULL || size < 2)
+ return (NULL);
+
+ /* p points to last char */
+ p = buffer + size - 1;
+
+ /* set terminating zero */
+ *p = '\0';
+
+ do {
+ *--p = value % 10 + '0';
+ value = value / 10;
+ } while (value != 0 && p > buffer);
+
+ return p;
+}
+
+
+char *struptime(const unsigned int uptime, const char *format)
+{
+ static char string[256];
+ const char *src;
+ char *dst;
+ int len, size;
+
+ src = format;
+ dst = string;
+ len = 0;
+
+ /* leave room for terminating zero */
+ size = sizeof(string) - 1;
+
+ while (len < size) {
+
+ if (*src == '%') {
+ src++;
+
+ if (strchr("sSmMhHd", *src) != NULL) {
+ char buffer[12], *s;
+ unsigned int value = 0;
+ int leading_zero = 0;
+ switch (*src++) {
+ case 's':
+ value = uptime;
+ break;
+ case 'S':
+ value = uptime % 60;
+ leading_zero = 1;
+ break;
+ case 'm':
+ value = uptime / 60;
+ break;
+ case 'M':
+ value = (uptime / 60) % 60;
+ leading_zero = 1;
+ break;
+ case 'h':
+ value = uptime / 60 / 60;
+ break;
+ case 'H':
+ value = (uptime / 60 / 60) % 24;
+ leading_zero = 1;
+ break;
+ case 'd':
+ value = uptime / 60 / 60 / 24;
+ break;
+ }
+
+ if (leading_zero && value < 10) {
+ len++;
+ *dst++ = '0';
+ }
+
+ s = itoa(buffer, sizeof(buffer), value);
+ while (len < size && *s != '\0') {
+ len++;
+ *dst++ = *s++;
+ }
+
+ } else if (*src == '%') {
+ len++;
+ *dst++ = '%';
+
+ } else {
+ len += 2;
+ *dst++ = '%';
+ *dst++ = *src++;
+ }
+
+ } else {
+ len++;
+ *dst++ = *src;
+ if (*src++ == '\0')
+ break;
+ }
+ }
+
+ /* enforce terminating zero */
+ if (len >= size && *(dst - 1) != '\0') {
+ len++;
+ *dst = '\0';
+ }
+
+ return string;
+}
+
+
+double getuptime(void)
+{
+ char buffer[36];
+ int i;
+
+ if (fd == -2)
+ fd = open("/proc/uptime", O_RDONLY);
+ if (fd < 0)
+ return -1;
+
+ lseek(fd, 0, SEEK_SET);
+
+ i = read(fd, buffer, sizeof(buffer) - 1);
+ if (i < 0)
+ return -1;
+
+ buffer[i - 1] = '\0';
+
+ /* ignore the 2nd value from /proc/uptime */
+ return strtod(buffer, NULL);
+}
+
+
+static void my_uptime(RESULT * result, const int argc, RESULT * argv[])
+{
+ int age;
+ static double uptime = 0.0;
+ static struct timeval last_value;
+ struct timeval now;
+
+ if (argc > 1) {
+ error("uptime(): wrong number of parameters");
+ SetResult(&result, R_STRING, "");
+ return;
+ }
+
+ gettimeofday(&now, NULL);
+
+ age = (now.tv_sec - last_value.tv_sec) * 1000 + (now.tv_usec - last_value.tv_usec) / 1000;
+ /* reread every 100 msec only */
+ if (fd == -2 || age == 0 || age > 100) {
+ uptime = getuptime();
+ if (uptime < 0.0) {
+ error("parse(/proc/uptime) failed!");
+ SetResult(&result, R_STRING, "");
+ return;
+ }
+
+ last_value = now;
+ }
+
+ if (argc == 0) {
+ SetResult(&result, R_NUMBER, &uptime);
+ } else {
+ SetResult(&result, R_STRING, struptime(uptime, R2S(argv[0])));
+ }
+
+ return;
+
+}
+
+int plugin_init_uptime(void)
+{
+ AddFunction("uptime", -1, my_uptime);
+ return 0;
+}
+
+void plugin_exit_uptime(void)
+{
+ if (fd > 0)
+ close(fd);
+ fd = -2;
+}
diff --git a/plugin_w1retap.c b/plugin_w1retap.c
new file mode 100644
index 0000000..10fc05e
--- /dev/null
+++ b/plugin_w1retap.c
@@ -0,0 +1,264 @@
+/* $Id: plugin_w1retap.c
+ *
+ * plugin to perform simple file operations for w1retap
+ *
+ * Copyright (C) 2007 Jonathan Hudson <jh+w1retap@daria.co.uk>
+ * Copyright (C) 2006 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ * This module returns a specific value associated with a key from a
+ * file containing one or more lines formatted as KEY=VALUE.
+ *
+ * It is intended for use with the w1retap weather station logging
+ * software <http://www.daria.co.uk/wx/tech.html>, but is applicable
+ * to any similarly formatted file.
+ */
+
+/*
+ * exported functions:
+ *
+ * int plugin_init_file (void)
+ * adds various functions
+ *
+ */
+
+
+#include "config.h"
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <ctype.h>
+
+#include "debug.h"
+#include "plugin.h"
+
+#ifdef WITH_DMALLOC
+#include <dmalloc.h>
+#endif
+
+/* function 'my_readkey' */
+/* takes two arguments, file name and key */
+/* returns value associated with key, trimmed to suitable dec places */
+
+static void my_readkey(RESULT * result, RESULT * arg1, RESULT * arg2)
+{
+ char value[80], val2[80];
+ FILE *fp;
+ char *reqkey, *pval;
+ size_t size;
+
+ *value = 0;
+ pval = value;
+
+ reqkey = R2S(arg2);
+ fp = fopen(R2S(arg1), "r");
+
+ if (!fp) {
+ error("w1retap couldn't open file '%s'", R2S(arg1));
+ value[0] = '\0';
+ } else {
+ size = strlen(reqkey);
+ while (!feof(fp) && pval == value) {
+ fgets(val2, sizeof(val2), fp);
+ if (*(val2 + size) == '=') {
+ if (strncmp(val2, reqkey, size) == 0) {
+ char *p;
+ p = index(val2, ' ');
+ if (p == NULL) {
+ p = index(val2, '\n');
+ }
+
+ if (p) {
+ *p = 0;
+ pval = val2 + size + 1;
+ {
+ double d;
+ char *ep;
+ d = strtod(pval, &ep);
+ if (ep != pval && (*ep == 0 || isspace(*ep))) {
+ if (d > 500)
+ sprintf(val2, "%.0f", d);
+ else
+ sprintf(val2, "%.1f", d);
+ pval = val2;
+ }
+ }
+ }
+ }
+ }
+ }
+ fclose(fp);
+ }
+
+ /* store result */
+ SetResult(&result, R_STRING, pval);
+}
+
+
+/* plugin initialization */
+/* MUST NOT be declared 'static'! */
+int plugin_init_w1retap(void)
+{
+
+ /* register all our cool functions */
+ /* the second parameter is the number of arguments */
+ /* -1 stands for variable argument list */
+ AddFunction("w1retap::readkey", 2, my_readkey);
+
+ return 0;
+}
+
+void plugin_exit_w1retap(void)
+{
+ /* free any allocated memory */
+ /* close filedescriptors */
+}
+
+
+/*
+
+#Sample configuration for w1retap
+#================================
+
+Display Weather {
+ Driver 'Pertelian'
+ Port '/dev/ttyUSB0'
+ Size '20x4'
+ Backlight 1
+ Icons 0
+}
+
+Display XWindow {
+ Driver 'X11'
+ Size '120x32'
+ Font '6x8'
+ Pixel '4+1'
+ Gap '-1x-1'
+ Border 20
+ Foreground '000000ff'
+ Background '00000033'
+ Basecolor '70c000'
+ Buttons 6
+ Brightness 133
+}
+
+Widget LCDTimer {
+ class 'Timer'
+ active 1
+ update 10000
+ expression h=strftime('%H', time()); x=file::readline('/tmp/.lcd',1)+0; b=(h > 5 | h < 23) + x ; LCD::backlight(b)
+}
+
+
+Widget Temp {
+ class 'Text'
+ expression w1retap::readkey(file, 'OTMP0')
+ prefix 'Extr '
+ width 10
+ align 'L'
+ update tick
+}
+
+Widget GHouse {
+ class 'Text'
+ expression w1retap::readkey(file, 'GHT')
+ prefix 'GHT '
+ width 10
+ align 'L'
+ update tick
+}
+
+Widget House {
+ class 'Text'
+ expression w1retap::readkey(file, 'OTMP1')
+ prefix 'Intr '
+ width 10
+ align 'L'
+ update tick
+}
+Widget Garage {
+ class 'Text'
+ expression w1retap::readkey(file, 'OTMP2')
+ prefix 'Gge '
+ width 10
+ align 'L'
+ update tick
+}
+Widget Soil {
+ class 'Text'
+ expression w1retap::readkey(file, 'STMP1')
+ prefix 'Soil '
+ width 10
+ align 'L'
+ update tick
+}
+Widget Press {
+ class 'Text'
+ expression w1retap::readkey(file, 'OPRS')
+ prefix 'Pres '
+ width 10
+ align 'L'
+ update tick
+}
+
+Widget Rain {
+ class 'Text'
+ expression w1retap::readkey(file1, 'RAIN')
+ prefix 'Rain '
+ width 20
+ align 'L'
+ update tick
+}
+
+Layout Default {
+ Timer1 'LCDTimer'
+ Row1 {
+ Col1 'Temp'
+ Col11 'GHouse'
+ }
+
+ Row2 {
+ Col1 'House'
+ Col11 'Garage'
+ }
+
+ Row3 {
+ Col1 'Soil'
+ Col11 'Press'
+ }
+
+ Row4 {
+ Col1 'Rain'
+ }
+}
+
+Variables {
+ tick 120000
+ file '/tmp/.w1retap.dat'
+ file1 '/tmp/.w1rain.txt'
+}
+
+Layout 'Default'
+
+Display 'Weather'
+
+*/
diff --git a/plugin_wireless.c b/plugin_wireless.c
new file mode 100644
index 0000000..8d94dee
--- /dev/null
+++ b/plugin_wireless.c
@@ -0,0 +1,675 @@
+/* $Id: plugin_wireless.c 1153 2011-07-27 05:12:30Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/plugin_wireless.c $
+ *
+ * Wireless Extension plugin
+ *
+ * Copyright (C) 2004 Xavier Vello <xavier66@free.fr>
+ * Copyright (C) 2004 Martin Hejl <martin@hejl.de>
+ * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * Losts of code borrowed from Wireless Tools, which is
+ * Copyright (C) 1997-2002 Jean Tourrilhes <jt@hpl.hp.com>
+ * (avaible at http://web.hpl.hp.com/personal/Jean_Tourrilhes/Linux/)
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+ /*
+ * Exported functions:
+
+ wifi_level
+ wifi_noise
+ wifi_quality
+ wifi_protocol
+ wifi_frequency
+ wifi_bitrate
+ wifi_essid
+ wifi_op_mode
+ wifi_sensitivity
+ wifi_sec_mode
+
+ All Functions take one parameter
+ (the name of the device, like "wlan0", "ath0" and so on)
+
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <errno.h>
+#include <math.h>
+
+#include <sys/ioctl.h>
+#include <net/if_arp.h>
+#include <linux/if.h>
+#include <linux/wireless.h>
+
+#include "debug.h"
+#include "plugin.h"
+#include "cfg.h"
+#include "hash.h"
+#include "qprintf.h"
+
+
+#ifdef WITH_DMALLOC
+#include <dmalloc.h>
+#endif
+
+#define HASH_TTL 100
+
+ /*#define KILO 1e3 */
+ /*#define MEGA 1e6 */
+ /*#define GIGA 1e9 */
+
+
+#define KEY_LEVEL "level"
+#define KEY_QUALITY "quality"
+#define KEY_NOISE "noise"
+#define KEY_PROTO "proto"
+#define KEY_FREQUENCY "frequency"
+#define KEY_BIT_RATE "bit_rate"
+#define KEY_ESSID "essid"
+#define KEY_OP_MODE "op_mode"
+#define KEY_SENS "sens"
+#define KEY_SEC_MODE "sec_mode"
+
+#define FREQ2FLOAT(m,e) (((double) m) * pow(10,e))
+#define MWATT2DBM(in) ((int) (ceil(10.0 * log10((double) in))))
+
+
+static HASH wireless;
+static int sock = -2;
+
+static char *operation_mode[] = {
+ "Auto",
+ "Ad-Hoc",
+ "Managed",
+ "Master",
+ "Repeater",
+ "Secondary",
+ "Monitor",
+ "n/a"
+};
+
+
+static void ioctl_error(const int line)
+{
+ error("IOCTL call to wireless extensions in line %d returned error", line);
+}
+
+int do_ioctl(const int sock, /* Socket to the kernel */
+ const char *ifname, /* Device name */
+ const int request, /* WE ID */
+ struct iwreq *pwrq)
+{ /* Fixed part of the request */
+ int ret;
+
+ /* Set device name */
+ strncpy(pwrq->ifr_name, ifname, IFNAMSIZ);
+
+ /* Do the request */
+ ret = ioctl(sock, request, pwrq);
+ if (ret < 0) {
+ debug("ioctl(0x%04x) failed: %d '%s'", request, errno, strerror(errno));
+ }
+
+ return ret;
+
+}
+
+int get_range_info(const int sock, const char *ifname, struct iw_range *range)
+{
+ struct iwreq req;
+ char buffer[sizeof(struct iw_range) * 2]; /* Large enough */
+
+ if (sock <= 0) {
+ return (-1);
+ }
+
+ /* Cleanup */
+ memset(buffer, 0, sizeof(buffer));
+
+ req.u.data.pointer = (caddr_t) buffer;
+ req.u.data.length = sizeof(buffer);
+ req.u.data.flags = 0;
+ if (do_ioctl(sock, ifname, SIOCGIWRANGE, &req) < 0)
+ return (-1);
+
+ /* Copy stuff at the right place, ignore extra */
+ memcpy((char *) range, buffer, sizeof(struct iw_range));
+
+ return (0);
+}
+
+
+
+static int get_ifname(struct iwreq *preq, const char *dev)
+{
+ /* do not cache this call !!! */
+ struct iwreq req;
+ char key_buffer[32];
+
+ if (sock <= 0) {
+ return (-1);
+ }
+
+ qprintf(key_buffer, sizeof(key_buffer), "%s.%s", dev, KEY_PROTO);
+
+ if (!preq)
+ preq = &req;
+
+ if (do_ioctl(sock, dev, SIOCGIWNAME, preq)) {
+ debug("%s isn't a wirelesss interface !", dev);
+ return -1;
+ }
+
+ hash_put(&wireless, key_buffer, preq->u.name);
+ return (0);
+
+}
+
+static int get_frequency(const char *dev, const char *key)
+{
+ /* Get frequency / channel */
+ struct iwreq req;
+ char qprintf_buffer[1024];
+ char key_buffer[32];
+ double freq;
+ int age;
+
+ qprintf(key_buffer, sizeof(key_buffer), "%s.%s", dev, key);
+ age = hash_age(&wireless, key);
+
+ /* reread every HASH_TTL msec only */
+ if (age > 0 && age <= HASH_TTL) {
+ return (0);
+ }
+
+ if (get_ifname(&req, dev) != 0) {
+ return (-1);
+ }
+
+ req.u.data.length = 0;
+ req.u.data.flags = 1; /* Clear updated flag */
+
+ if (do_ioctl(sock, dev, SIOCGIWFREQ, &req) < 0) {
+ ioctl_error(__LINE__);
+ return -1;
+ }
+
+ freq = FREQ2FLOAT(req.u.freq.m, req.u.freq.e);
+
+ /*if( freq>= GIGA)
+ snprintf(qprintf_buffer,sizeof(qprintf_buffer), "%g GHz", freq / GIGA);
+ else
+ if(freq>= MEGA)
+ snprintf(qprintf_buffer,sizeof(qprintf_buffer), "%g MHz", freq / MEGA);
+ else
+ snprintf(qprintf_buffer,sizeof(qprintf_buffer), "%g kHz", freq / KILO);
+ */
+ snprintf(qprintf_buffer, sizeof(qprintf_buffer), "%g", freq);
+
+ hash_put(&wireless, key_buffer, qprintf_buffer);
+ return (0);
+
+}
+
+static int get_essid(const char *dev, const char *key)
+{
+ /* Get ESSID */
+ struct iwreq req;
+ char key_buffer[32];
+ char essid_buffer[IW_ESSID_MAX_SIZE + 1];
+ int age;
+
+
+ qprintf(key_buffer, sizeof(key_buffer), "%s.%s", dev, key);
+ age = hash_age(&wireless, key);
+
+ /* reread every HASH_TTL msec only */
+ if (age > 0 && age <= HASH_TTL) {
+ return (0);
+ }
+
+ if (get_ifname(&req, dev) != 0) {
+ return (-1);
+ }
+
+ memset(essid_buffer, 0, sizeof(essid_buffer));
+ req.u.essid.pointer = (caddr_t) essid_buffer;
+ req.u.essid.length = IW_ESSID_MAX_SIZE + 1;
+ req.u.essid.flags = 0;
+
+ if (do_ioctl(sock, dev, SIOCGIWESSID, &req) < 0) {
+ ioctl_error(__LINE__);
+ return -1;
+ }
+
+ hash_put(&wireless, key_buffer, essid_buffer);
+ return (0);
+
+}
+
+static int get_op_mode(const char *dev, const char *key)
+{
+ /* Get operation mode */
+ struct iwreq req;
+ char key_buffer[32];
+ int age;
+
+ qprintf(key_buffer, sizeof(key_buffer), "%s.%s", dev, key);
+ age = hash_age(&wireless, key);
+
+ /* reread every HASH_TTL msec only */
+ if (age > 0 && age <= HASH_TTL) {
+ return (0);
+ }
+
+ if (get_ifname(&req, dev) != 0) {
+ return (-1);
+ }
+
+ if (do_ioctl(sock, dev, SIOCGIWMODE, &req) < 0) {
+ ioctl_error(__LINE__);
+ return -1;
+ }
+
+ /* Fixme: req.u.mode is unsigned and therefore never < 0 */
+ /* if((req.u.mode > 6) || (req.u.mode < 0)) { */
+
+ if (req.u.mode > 6) {
+ req.u.mode = 7; /* mode not available */
+ }
+
+ hash_put(&wireless, key_buffer, operation_mode[req.u.mode]);
+ return (0);
+
+}
+
+static int get_bitrate(const char *dev, const char *key)
+{
+ /* Get bit rate */
+ struct iwreq req;
+ char key_buffer[32];
+ char bitrate_buffer[64];
+ int age;
+ double bitrate = 0;
+
+ qprintf(key_buffer, sizeof(key_buffer), "%s.%s", dev, key);
+ age = hash_age(&wireless, key);
+
+ /* reread every HASH_TTL msec only */
+ if (age > 0 && age <= HASH_TTL) {
+ return (0);
+ }
+
+ if (get_ifname(&req, dev) != 0) {
+ return (-1);
+ }
+
+ if (do_ioctl(sock, dev, SIOCGIWRATE, &req) < 0) {
+ ioctl_error(__LINE__);
+ return -1;
+ }
+
+ bitrate_buffer[0] = '\0';
+ bitrate = (double) (req.u.bitrate.value);
+/* if( bitrate>= GIGA)
+ snprintf(bitrate_buffer,sizeof(bitrate_buffer), "%gGb/s", bitrate / GIGA);
+ else
+ if(bitrate >= MEGA)
+ snprintf(bitrate_buffer,sizeof(bitrate_buffer), "%gMb/s", bitrate / MEGA);
+ else
+ snprintf(bitrate_buffer,sizeof(bitrate_buffer), "%gkb/s", bitrate / KILO);
+*/
+ snprintf(bitrate_buffer, sizeof(bitrate_buffer), "%g", bitrate);
+
+ hash_put(&wireless, key_buffer, bitrate_buffer);
+
+ return (0);
+}
+
+static int get_sens(const char *dev, const char *key)
+{
+ /* Get sensitivity */
+ struct iwreq req;
+ struct iw_range range;
+ char key_buffer[32];
+ char buffer[64];
+ int age;
+ int __attribute__ ((unused)) has_sens = 0;
+ int has_range = 0;
+
+ qprintf(key_buffer, sizeof(key_buffer), "%s.%s", dev, key);
+ age = hash_age(&wireless, key);
+
+ /* reread every HASH_TTL msec only */
+ if (age > 0 && age <= HASH_TTL) {
+ return (0);
+ }
+
+ if (get_ifname(&req, dev) != 0) {
+ return (-1);
+ }
+
+ if (do_ioctl(sock, dev, SIOCGIWSENS, &req) >= 0) {
+ has_sens = 1;
+ }
+
+ if (get_range_info(sock, dev, &range) < 0) {
+ memset(&range, 0, sizeof(range));
+ } else {
+ has_range = 1;
+ }
+
+ if (has_range) {
+ if (req.u.sens.value < 0) {
+ qprintf(buffer, sizeof(buffer), "%d dBm", req.u.sens.value);
+ } else {
+ qprintf(buffer, sizeof(buffer), "%d/%d", req.u.sens.value, range.sensitivity);
+ }
+ } else {
+ qprintf(buffer, sizeof(buffer), "%d", req.u.sens.value);
+ }
+
+ hash_put(&wireless, key_buffer, buffer);
+ return (0);
+}
+
+
+static int get_sec_mode(const char *dev, const char *key)
+{
+ /* Get encryption information */
+ struct iwreq req;
+ char key_buffer[32];
+ char encrypt_key[IW_ENCODING_TOKEN_MAX + 1];
+ int age;
+ int has_key = 0;
+ int key_flags = 0;
+ int __attribute__ ((unused)) key_size = 0;
+
+ qprintf(key_buffer, sizeof(key_buffer), "%s.%s", dev, key);
+ age = hash_age(&wireless, key);
+
+ /* reread every HASH_TTL msec only */
+ if (age > 0 && age <= HASH_TTL) {
+ return (0);
+ }
+
+ if (get_ifname(&req, dev) != 0) {
+ return (-1);
+ }
+
+ req.u.data.pointer = (caddr_t) & encrypt_key;
+ req.u.data.length = IW_ENCODING_TOKEN_MAX;
+ req.u.data.flags = 0;
+
+ if (do_ioctl(sock, dev, SIOCGIWENCODE, &req) >= 0) {
+ has_key = 1;
+ key_flags = req.u.data.flags;
+ key_size = req.u.data.length;
+ } else {
+ return (-1);
+ }
+
+ /* Display encryption information */
+ /*if(has_key && (key_flags & IW_ENCODE_INDEX) > 1) */
+ /* printf(" [%d]", info->key_flags & IW_ENCODE_INDEX); */
+
+ if (has_key && (key_flags & IW_ENCODE_RESTRICTED))
+ hash_put(&wireless, key_buffer, "restricted");
+ else if (has_key && (key_flags & IW_ENCODE_OPEN))
+ hash_put(&wireless, key_buffer, "open");
+
+ return (0);
+}
+
+static int get_stats(const char *dev, const char *key)
+{
+ struct iw_statistics stats;
+ struct iwreq req;
+ char qprintf_buffer[1024];
+ char key_buffer[32];
+ int age;
+ struct iw_range range;
+
+ qprintf(key_buffer, sizeof(key_buffer), "%s.%s", dev, key);
+ age = hash_age(&wireless, key);
+
+ /* reread every HASH_TTL msec only */
+ if (age > 0 && age <= HASH_TTL) {
+ return (0);
+ }
+
+ if (get_ifname(&req, dev) != 0) {
+ return (-1);
+ }
+
+ req.u.data.pointer = (caddr_t) & stats;
+ req.u.data.length = sizeof(stats);
+ req.u.data.flags = 1; /* Clear updated flag */
+
+ if (do_ioctl(sock, dev, SIOCGIWSTATS, &req) < 0) {
+ ioctl_error(__LINE__);
+ return -1;
+ }
+
+ if (get_range_info(sock, dev, &range) < 0)
+ memset(&range, 0, sizeof(range));
+
+ if (stats.qual.level > range.max_qual.level) {
+ qprintf(qprintf_buffer, sizeof(qprintf_buffer), "%d", stats.qual.level - 0x100);
+ qprintf(key_buffer, sizeof(key_buffer), "%s.%s", dev, KEY_LEVEL);
+ hash_put(&wireless, key_buffer, qprintf_buffer);
+
+ qprintf(qprintf_buffer, sizeof(qprintf_buffer), "%d", stats.qual.noise - 0x100);
+ qprintf(key_buffer, sizeof(key_buffer), "%s.%s", dev, KEY_NOISE);
+ hash_put(&wireless, key_buffer, qprintf_buffer);
+
+ qprintf(qprintf_buffer, sizeof(qprintf_buffer), "%d/%d", stats.qual.qual, range.max_qual.qual);
+ qprintf(key_buffer, sizeof(key_buffer), "%s.%s", dev, KEY_QUALITY);
+ hash_put(&wireless, key_buffer, qprintf_buffer);
+ } else {
+
+ qprintf(qprintf_buffer, sizeof(qprintf_buffer), "%d/%d", stats.qual.level, range.max_qual.level);
+ qprintf(key_buffer, sizeof(key_buffer), "%s.%s", dev, KEY_LEVEL);
+ hash_put(&wireless, key_buffer, qprintf_buffer);
+
+ qprintf(qprintf_buffer, sizeof(qprintf_buffer), "%d/%d", stats.qual.noise, range.max_qual.noise);
+ qprintf(key_buffer, sizeof(key_buffer), "%s.%s", dev, KEY_NOISE);
+ hash_put(&wireless, key_buffer, qprintf_buffer);
+
+ qprintf(qprintf_buffer, sizeof(qprintf_buffer), "%d/%d", stats.qual.qual, range.max_qual.qual);
+ qprintf(key_buffer, sizeof(key_buffer), "%s.%s", dev, KEY_QUALITY);
+ hash_put(&wireless, key_buffer, qprintf_buffer);
+ }
+
+ return 0;
+}
+
+static int check_socket()
+{
+
+ /* already handled in a previous run */
+ if (sock == -3)
+ return (-1);
+
+ /* socket not initialized */
+ if (sock == -2)
+ sock = socket(AF_INET, SOCK_DGRAM, 0);
+
+ /* error initilalizing socket */
+ if (sock <= 0) {
+ error("Error opening socket for reading wireless stats");
+ sock = -3;
+ return (-1);
+ }
+
+ return (0);
+
+}
+
+static void save_result(RESULT * result, const char *dev, const char *key, const int res)
+{
+ char key_buffer[64];
+ char *val = NULL;
+ qprintf(key_buffer, sizeof(key_buffer), "%s.%s", dev, key);
+
+ if (res < 0) {
+ SetResult(&result, R_STRING, "");
+ return;
+ }
+
+ val = hash_get(&wireless, key_buffer, NULL);
+
+ if (val) {
+ SetResult(&result, R_STRING, val);
+ } else {
+ SetResult(&result, R_STRING, "");
+ }
+
+
+}
+
+/*
+ *functions exported to the evaluator
+*/
+
+static void wireless_quality(RESULT * result, RESULT * arg1)
+{
+ char *dev = R2S(arg1);
+ if (check_socket() != 0)
+ return;
+
+ save_result(result, dev, KEY_QUALITY, get_stats(dev, KEY_QUALITY));
+}
+
+static void wireless_level(RESULT * result, RESULT * arg1)
+{
+ char *dev = R2S(arg1);
+ if (check_socket() != 0)
+ return;
+
+ save_result(result, dev, KEY_LEVEL, get_stats(dev, KEY_LEVEL));
+}
+
+
+static void wireless_noise(RESULT * result, RESULT * arg1)
+{
+ char *dev = R2S(arg1);
+ if (check_socket() != 0)
+ return;
+
+ save_result(result, dev, KEY_NOISE, get_stats(dev, KEY_NOISE));
+}
+
+
+static void wireless_protocol(RESULT * result, RESULT * arg1)
+{
+ char *dev = R2S(arg1);
+ if (check_socket() != 0)
+ return;
+
+ save_result(result, dev, KEY_PROTO, get_ifname(NULL, dev));
+}
+
+static void wireless_frequency(RESULT * result, RESULT * arg1)
+{
+ char *dev = R2S(arg1);
+ if (check_socket() != 0)
+ return;
+
+ save_result(result, dev, KEY_FREQUENCY, get_frequency(dev, KEY_FREQUENCY));
+}
+
+static void wireless_bitrate(RESULT * result, RESULT * arg1)
+{
+ char *dev = R2S(arg1);
+ if (check_socket() != 0)
+ return;
+
+ save_result(result, dev, KEY_BIT_RATE, get_bitrate(dev, KEY_BIT_RATE));
+}
+
+static void wireless_essid(RESULT * result, RESULT * arg1)
+{
+ char *dev = R2S(arg1);
+ if (check_socket() != 0)
+ return;
+
+ save_result(result, dev, KEY_ESSID, get_essid(dev, KEY_ESSID));
+}
+
+static void wireless_op_mode(RESULT * result, RESULT * arg1)
+{
+ char *dev = R2S(arg1);
+ if (check_socket() != 0)
+ return;
+
+ save_result(result, dev, KEY_OP_MODE, get_op_mode(dev, KEY_OP_MODE));
+}
+
+static void wireless_sensitivity(RESULT * result, RESULT * arg1)
+{
+ char *dev = R2S(arg1);
+ if (check_socket() != 0)
+ return;
+
+ save_result(result, dev, KEY_SENS, get_sens(dev, KEY_SENS));
+}
+
+static void wireless_sec_mode(RESULT * result, RESULT * arg1)
+{
+ char *dev = R2S(arg1);
+ if (check_socket() != 0)
+ return;
+
+ save_result(result, dev, KEY_SEC_MODE, get_sec_mode(dev, KEY_SEC_MODE));
+}
+
+/*
+init and cleanup
+*/
+
+int plugin_init_wireless(void)
+{
+ hash_create(&wireless);
+
+ AddFunction("wifi::level", 1, wireless_level);
+ AddFunction("wifi::noise", 1, wireless_noise);
+ AddFunction("wifi::quality", 1, wireless_quality);
+ AddFunction("wifi::protocol", 1, wireless_protocol);
+ AddFunction("wifi::frequency", 1, wireless_frequency);
+ AddFunction("wifi::bitrate", 1, wireless_bitrate);
+ AddFunction("wifi::essid", 1, wireless_essid);
+ AddFunction("wifi::op_mode", 1, wireless_op_mode);
+ AddFunction("wifi::sensitivity", 1, wireless_sensitivity);
+ AddFunction("wifi::sec_mode", 1, wireless_sec_mode);
+
+ return 0;
+}
+
+void plugin_exit_wireless(void)
+{
+ if (sock > 0)
+ close(sock);
+ hash_destroy(&wireless);
+}
diff --git a/plugin_xmms.c b/plugin_xmms.c
new file mode 100644
index 0000000..cb8fedc
--- /dev/null
+++ b/plugin_xmms.c
@@ -0,0 +1,148 @@
+/* $Id: plugin_xmms.c 728 2007-01-14 11:14:38Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/plugin_xmms.c $
+ *
+ * XMMS-Plugin for LCD4Linux
+ * Copyright (C) 2003 Markus Keil <markus_keil@t-online.de>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ * exported functions:
+ *
+ * int plugin_init_xmms (void)
+ * adds parser for /tmp/xmms-info
+ *
+ */
+
+
+/*
+ * The Argument 'arg1' must be one of these Things (without brackets):
+ *
+ * 'Title' - The title of the current song
+ * 'Status' - The status of XMMS (playing, pause, ...)
+ * 'Tunes in playlist' - How many entries are in the playlist
+ * 'Currently playing' - which playlist-entry is playing
+ * 'uSecPosition' - The position of the title in seconds (usefull for bargraphs ;-) )
+ * 'Position' - The position of the title in mm:ss
+ * 'uSecTime' - The length of the current title in seconds
+ * 'Time' - The length of the current title in mm:ss
+ * 'Current bitrate' - The current bitrate in bit
+ * 'Samping Frequency' - The current samplingfreqency in Hz
+ * 'Channels' - The current number of audiochannels
+ * 'File' - The full path of the current file
+ *
+ * These arguments are case-sensitive
+ */
+
+
+#include "config.h"
+
+#include <string.h>
+#include <stdio.h>
+#include <ctype.h>
+
+#include "hash.h"
+#include "debug.h"
+#include "plugin.h"
+
+
+static HASH xmms;
+
+
+static int parse_xmms_info(void)
+{
+ int age;
+ FILE *xmms_stream;
+ char zeile[200];
+
+ /* reread every 100msec only */
+ age = hash_age(&xmms, NULL);
+ if (age >= 0 && age <= 200)
+ return 0;
+ /* Open Filestream for '/tmp/xmms-info' */
+ xmms_stream = fopen("/tmp/xmms-info", "r");
+
+ /* Check for File */
+ if (!xmms_stream) {
+ error("Error: Cannot open XMMS-Info Stream! Is XMMS started?");
+ return -1;
+ }
+
+ /* Read Lines from the Stream */
+ while (fgets(zeile, sizeof(zeile), xmms_stream)) {
+ char *c, *key, *val;
+ c = strchr(zeile, ':');
+ if (c == NULL)
+ continue;
+ key = zeile;
+ val = c + 1;
+ /* strip leading blanks from key */
+ while (isspace(*key))
+ *key++ = '\0';
+ /* strip trailing blanks from key */
+ do
+ *c = '\0';
+ while (isspace(*--c));
+ /* strip leading blanks from value */
+ while (isspace(*val))
+ *val++ = '\0';
+ /* strip trailing blanks from value */
+ for (c = val; *c != '\0'; c++);
+ while (isspace(*--c))
+ *c = '\0';
+ hash_put(&xmms, key, val);
+ }
+
+ fclose(xmms_stream);
+ return 0;
+
+}
+
+static void my_xmms(RESULT * result, RESULT * arg1)
+{
+ char *key, *val;
+
+ if (parse_xmms_info() < 0) {
+ SetResult(&result, R_STRING, "");
+ return;
+ }
+
+ key = R2S(arg1);
+ val = hash_get(&xmms, key, NULL);
+ if (val == NULL)
+ val = "";
+
+ SetResult(&result, R_STRING, val);
+}
+
+
+int plugin_init_xmms(void)
+{
+ hash_create(&xmms);
+
+ /* register xmms info */
+ AddFunction("xmms", 1, my_xmms);
+
+ return 0;
+}
+
+void plugin_exit_xmms(void)
+{
+ hash_destroy(&xmms);
+}
diff --git a/plugins.m4 b/plugins.m4
new file mode 100644
index 0000000..4b75e98
--- /dev/null
+++ b/plugins.m4
@@ -0,0 +1,639 @@
+dnl $Id: plugins.m4 1195 2013-02-19 23:17:43Z volker $
+dnl $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/plugins.m4 $
+
+
+dnl LCD4Linux Plugins conf part
+dnl
+dnl Copyright (C) 1999, 2000, 2001, 2002, 2003 Michael Reinelt <michael@reinelt.co.at>
+dnl Copyright (C) 2004, 2005, 2006, 2007 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+dnl
+dnl This file is part of LCD4Linux.
+dnl
+dnl LCD4Linux is free software; you can redistribute it and/or modify
+dnl it under the terms of the GNU General Public License as published by
+dnl the Free Software Foundation; either version 2, or (at your option)
+dnl any later version.
+dnl
+dnl LCD4Linux is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+dnl GNU General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU General Public License
+dnl along with this program; if not, write to the Free Software
+dnl Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+AC_MSG_CHECKING([which plugins to compile])
+AC_ARG_WITH(
+ plugins,
+ [ --with-plugins=<list> choose which plugins to compile.]
+ [ type --with-plugins=list for a list]
+ [ of avaible plugins]
+ [ plugins may be excluded with 'all,!<plugin>',]
+ [ (try 'all,\!<plugin>' if your shell complains...)],
+ plugins=$withval,
+ plugins=all
+)
+
+plugins=`echo $plugins|sed 's/,/ /g'`
+
+for plugin in $plugins; do
+
+ case $plugin in
+ !*)
+ val="no"
+ plugin=`echo $plugin|cut -c 2-`
+ ;;
+ *)
+ val="yes"
+ ;;
+ esac
+
+ case "$plugin" in
+ list)
+ AC_MSG_RESULT(
+ [available plugins:]
+ [ apm,asterisk,button_exec,cpuinfo,dbus,diskstats,dvb,exec,event,]
+ [ fifo,file,gps,hddtemp,huawei,i2c_sensors,iconv,imon,isdn,kvv,]
+ [ loadavg,meminfo,mpd,mpris_dbus,mysql,netdev,netinfo,pop3,ppp,]
+ [ proc_stat,python,qnaplog,raspi,sample,seti,statfs,uname,uptime,]
+ [ w1retap,wireless,xmms])
+ AC_MSG_ERROR([run ./configure --with-plugins=...])
+ ;;
+ all)
+ PLUGIN_APM="yes"
+ PLUGIN_ASTERISK="yes"
+ PLUGIN_BUTTON_EXEC="yes"
+ PLUGIN_CPUINFO="yes"
+ PLUGIN_DBUS="yes"
+ PLUGIN_DISKSTATS="yes"
+ PLUGIN_DVB="yes"
+ PLUGIN_EXEC="yes"
+ PLUGIN_EVENT="yes"
+ PLUGIN_FIFO="yes"
+ PLUGIN_FILE="yes"
+ PLUGIN_GPS="yes"
+ PLUGIN_HDDTEMP="yes"
+ PLUGIN_HUAWEI="yes"
+ PLUGIN_I2C_SENSORS="yes"
+ PLUGIN_ICONV="yes"
+ PLUGIN_IMON="yes"
+ PLUGIN_ISDN="yes"
+ PLUGIN_KVV="yes"
+ PLUGIN_LOADAVG="yes"
+ PLUGIN_MEMINFO="yes"
+ PLUGIN_MPD="yes"
+ PLUGIN_MPRIS_DBUS="yes"
+ PLUGIN_MYSQL="yes"
+ PLUGIN_NETDEV="yes"
+ PLUGIN_NETINFO="yes"
+ PLUGIN_POP3="yes"
+ PLUGIN_PPP="yes"
+ PLUGIN_PROC_STAT="yes"
+ PLUGIN_PYTHON=$with_python
+ PLUGIN_QNAPLOG="yes"
+ PLUGIN_RASPI="yes"
+ PLUGIN_SAMPLE="yes"
+ PLUGIN_SETI="yes"
+ PLUGIN_STATFS="yes"
+ PLUGIN_UNAME="yes"
+ PLUGIN_UPTIME="yes"
+ PLUGIN_W1RETAP="yes"
+ PLUGIN_WIRELESS="yes"
+ PLUGIN_XMMS="yes"
+ ;;
+ none)
+ PLUGIN_APM="no"
+ PLUGIN_ASTERISK="no"
+ PLUGIN_BUTTON_EXEC="no"
+ PLUGIN_CPUINFO="no"
+ PLUGIN_DBUS="no"
+ PLUGIN_DISKSTATS="no"
+ PLUGIN_DVB="no"
+ PLUGIN_EXEC="no"
+ PLUGIN_EVENT="no"
+ PLUGIN_FIFO="no"
+ PLUGIN_FILE="no"
+ PLUGIN_GPS="no"
+ PLUGIN_HDDTEMP="no"
+ PLUGIN_HUAWEI="no"
+ PLUGIN_I2C_SENSORS="no"
+ PLUGIN_ICONV="no"
+ PLUGIN_IMON="no"
+ PLUGIN_ISDN="no"
+ PLUGIN_KVV="no"
+ PLUGIN_LOADAVG="no"
+ PLUGIN_MEMINFO="no"
+ PLUGIN_MPD="no"
+ PLUGIN_MPRIS_DBUS="no"
+ PLUGIN_MYSQL="no"
+ PLUGIN_NETDEV="no"
+ PLUGIN_NETINFO="no"
+ PLUGIN_POP3="no"
+ PLUGIN_PPP="no"
+ PLUGIN_PROC_STAT="no"
+ PLUGIN_PYTHON="no"
+ PLUGIN_QNAPLOG="no"
+ PLUGIN_RASPI="no"
+ PLUGIN_SAMPLE="no"
+ PLUGIN_SETI="no"
+ PLUGIN_STATFS="no"
+ PLUGIN_UNAME="no"
+ PLUGIN_UPTIME="no"
+ PLUGIN_W1RETAP="no"
+ PLUGIN_WIRELESS="no"
+ PLUGIN_XMMS="no"
+ ;;
+ apm)
+ PLUGIN_APM=$val
+ ;;
+ button_exec)
+ PLUGIN_BUTTON_EXEC=$val
+ ;;
+ asterisk)
+ PLUGIN_ASTERISK=$val
+ ;;
+ cpuinfo)
+ PLUGIN_CPUINFO=$val
+ ;;
+ dbus)
+ PLUGIN_DBUS=$val
+ ;;
+ diskstats)
+ PLUGIN_DISKSTATS=$val
+ ;;
+ dvb)
+ PLUGIN_DVB=$val
+ ;;
+ exec)
+ PLUGIN_EXEC=$val
+ ;;
+ event)
+ PLUGIN_EVENT=$val
+ ;;
+ fifo)
+ PLUGIN_FIFO=$val
+ ;;
+ file)
+ PLUGIN_FILE=$val
+ ;;
+ gps)
+ PLUGIN_GPS=$val
+ ;;
+ hddtemp)
+ PLUGIN_HDDTEMP=$val
+ ;;
+ huawei)
+ PLUGIN_HUAWEI=$val
+ ;;
+ i2c_sensors)
+ PLUGIN_I2C_SENSORS=$val
+ ;;
+ iconv)
+ PLUGIN_ICONV=$val
+ ;;
+ imon)
+ PLUGIN_IMON=$val
+ ;;
+ isdn)
+ PLUGIN_ISDN=$val
+ ;;
+ kvv)
+ PLUGIN_KVV=$val
+ ;;
+ loadavg)
+ PLUGIN_LOADAVG=$val
+ ;;
+ meminfo)
+ PLUGIN_MEMINFO=$val
+ ;;
+ mpd)
+ PLUGIN_MPD=$val
+ ;;
+ mpris_dbus)
+ PLUGIN_MPRIS_DBUS=$val
+ ;;
+ mysql)
+ PLUGIN_MYSQL=$val
+ ;;
+ netdev)
+ PLUGIN_NETDEV=$val
+ ;;
+ netinfo)
+ PLUGIN_NETINFO=$val
+ ;;
+ pop3)
+ PLUGIN_POP3=$val
+ ;;
+ ppp)
+ PLUGIN_PPP=$val
+ ;;
+ proc_stat)
+ PLUGIN_PROC_STAT=$val
+ ;;
+ python)
+ PLUGIN_PYTHON=$val
+ ;;
+ qnaplog)
+ PLUGIN_QNAPLOG=$val
+ ;;
+ raspi)
+ PLUGIN_RASPI=$val
+ ;;
+ sample)
+ PLUGIN_SAMPLE=$val
+ ;;
+ seti)
+ PLUGIN_SETI=$val
+ ;;
+ statfs)
+ PLUGIN_STATFS=$val
+ ;;
+ uname)
+ PLUGIN_UNAME=$val
+ ;;
+ uptime)
+ PLUGIN_UPTIME=$val
+ ;;
+ w1retap)
+ PLUGIN_W1RETAP=$val
+ ;;
+ wireless)
+ PLUGIN_WIRELESS=$val
+ ;;
+ xmms)
+ PLUGIN_XMMS=$val
+ ;;
+ *)
+ AC_MSG_ERROR([Unknown plugin '$plugin'])
+ ;;
+ esac
+done
+
+AC_MSG_RESULT([done])
+
+# Advanced Power Management
+if test "$PLUGIN_APM" = "yes"; then
+ AC_CHECK_HEADERS(asm/types.h, [has_asm_types="true"], [has_asm_types="false"])
+ if test "$has_asm_types" = "true"; then
+ PLUGINS="$PLUGINS plugin_apm.o"
+ AC_DEFINE(PLUGIN_APM,1,[apm plugin])
+ else
+ AC_MSG_WARN(asm/types.h header not found: apm plugin disabled)
+ fi
+fi
+
+if test "$PLUGIN_BUTTON_EXEC" = "yes"; then
+ PLUGINS="$PLUGINS plugin_button_exec.o"
+ AC_DEFINE(PLUGIN_BUTTON_EXEC,1,[button_exec plugin])
+fi
+
+if test "$PLUGIN_ASTERISK" = "yes"; then
+ PLUGINS="$PLUGINS plugin_asterisk.o"
+ AC_DEFINE(PLUGIN_ASTERISK,1,[asterisk plugin])
+fi
+
+# /proc/cpuinfo
+if test "$PLUGIN_CPUINFO" = "yes"; then
+ PLUGINS="$PLUGINS plugin_cpuinfo.o"
+ AC_DEFINE(PLUGIN_CPUINFO,1,[cpuinfo plugin])
+fi
+
+#DBus
+if test "$PLUGIN_DBUS" = "yes"; then
+ PKG_CHECK_MODULES(DBUS, dbus-1 >= 1.0.0, HAVE_DBUS="yes", HAVE_DBUS="no")
+ if test "x$HAVE_DBUS" == "xyes"; then
+ PLUGINS="$PLUGINS plugin_dbus.o"
+ PLUGINLIBS="$PLUGINLIBS $DBUS_LIBS"
+ CPPFLAGS="$CPPFLAGS $DBUS_CFLAGS"
+ AC_DEFINE(PLUGIN_DBUS,1,[dbus plugin])
+
+ DBUS_VERSION=$($PKG_CONFIG --modversion dbus-1)
+ DBUS_VERSION_MAJOR=$(echo $DBUS_VERSION | cut -d . -f 1)
+ DBUS_VERSION_MINOR=$(echo $DBUS_VERSION | cut -d . -f 2)
+ DBUS_VERSION_MICRO=$(echo $DBUS_VERSION | cut -d . -f 3)
+
+ AC_DEFINE_UNQUOTED(DBUS_VERSION_MAJOR, $DBUS_VERSION_MAJOR, [DBus Major Version])
+ AC_DEFINE_UNQUOTED(DBUS_VERSION_MINOR, $DBUS_VERSION_MINOR, [DBus Minor Version])
+ AC_DEFINE_UNQUOTED(DBUS_VERSION_MICRO, $DBUS_VERSION_MICRO, [DBus Micro Version])
+ else
+ AC_MSG_WARN(dbus-1 not found check that PKG_CONFIG_PATH is set correctly: dbus plugin disabled)
+ fi
+fi
+
+# /proc/diskstat
+if test "$PLUGIN_DISKSTATS" = "yes"; then
+ PLUGINS="$PLUGINS plugin_diskstats.o"
+ AC_DEFINE(PLUGIN_DISKSTATS,1,[diskstats plugin])
+fi
+
+# Digital Video Broadcasting
+if test "$PLUGIN_DVB" = "yes"; then
+ AC_CHECK_HEADERS(asm/types.h, [has_asm_types="true"], [has_asm_types="false"])
+ if test "$has_asm_types" = "true"; then
+ AC_CHECK_HEADERS(linux/dvb/frontend.h, [has_dvb_header="true"], [has_dvb_header="false"])
+ if test "$has_dvb_header" = "true"; then
+ PLUGINS="$PLUGINS plugin_dvb.o"
+ AC_DEFINE(PLUGIN_DVB,1,[dvb plugin])
+ else
+ PLUGINS="$PLUGINS plugin_dvb.o"
+ AC_MSG_WARN(linux/dvb/frontend.h header not found: using ioctl)
+ fi
+ else
+ AC_MSG_WARN(asm/types.h header not found: dvb plugin disabled)
+ fi
+fi
+
+# start external commands (exec)
+if test "$PLUGIN_EXEC" = "yes"; then
+ PLUGINS="$PLUGINS plugin_exec.o"
+ AC_DEFINE(PLUGIN_EXEC,1,[exec plugin])
+fi
+
+# event
+if test "$PLUGIN_EVENT" = "yes"; then
+ PLUGINS="$PLUGINS plugin_event.o"
+ AC_DEFINE(PLUGIN_EVENT,1,[event plugin])
+fi
+
+# file
+if test "$PLUGIN_FILE" = "yes"; then
+ PLUGINS="$PLUGINS plugin_file.o"
+ AC_DEFINE(PLUGIN_FILE,1,[file plugin])
+fi
+
+# FIFO
+if test "$PLUGIN_FIFO" = "yes"; then
+ PLUGINS="$PLUGINS plugin_fifo.o"
+ AC_DEFINE(PLUGIN_FIFO,1,[fifo plugin])
+fi
+
+# GPS
+if test "$PLUGIN_GPS" = "yes"; then
+ AC_CHECK_HEADERS(nmeap.h, [has_nmeap_header="true"], [has_nmeap_header="false"])
+ if test "$has_nmeap_header" = "true"; then
+ AC_CHECK_LIB(nmeap, nmeap_init, [has_libnmeap_lib="true"], [has_libnmeap_lib="false"])
+ if test "$has_libnmeap_lib" = "true"; then
+ PLUGINS="$PLUGINS plugin_gps.o"
+ PLUGINLIBS="$PLUGINLIBS -lnmeap"
+ AC_DEFINE(PLUGIN_GPS,1,[gps plugin])
+ else
+ AC_MSG_WARN(libnmeap lib not found: gps plugin disabled)
+ fi
+ else
+ AC_MSG_WARN(nmeap.h header not found: gps plugin disabled)
+ fi
+fi
+
+# hddtemp
+if test "$PLUGIN_HDDTEMP" = "yes"; then
+ PLUGINS="$PLUGINS plugin_hddtemp.o"
+ AC_DEFINE(PLUGIN_HDDTEMP,1,[hddtemp plugin])
+fi
+
+# Huawei
+if test "$PLUGIN_HUAWEI" = "yes"; then
+ PLUGINS="$PLUGINS plugin_huawei.o"
+ AC_DEFINE(PLUGIN_HUAWEI,1,[huawei plugin])
+fi
+
+# I2C
+if test "$PLUGIN_I2C_SENSORS" = "yes"; then
+ PLUGINS="$PLUGINS plugin_i2c_sensors.o"
+ AC_DEFINE(PLUGIN_I2C_SENSORS,1,[i2c sensors plugin])
+fi
+
+# IConv
+if test "$PLUGIN_ICONV" = "yes"; then
+ AM_ICONV
+ if test "$am_cv_func_iconv" = "yes"; then
+ PLUGINS="$PLUGINS plugin_iconv.o"
+ PLUGINLIBS="$PLUGINLIBS $LIBICONV"
+ AC_DEFINE(PLUGIN_ICONV,1,[iconv charset converter plugin])
+ else
+ AC_MSG_WARN(iconv not found: iconv plugin disabled)
+ fi
+fi
+
+# ISDN monitor
+if test "$PLUGIN_IMON" = "yes"; then
+ AC_CHECK_HEADERS(linux/errno.h, [has_linux_errno="true"], [has_linux_errno="false"])
+ if test "$has_linux_errno" = "true"; then
+ PLUGINS="$PLUGINS plugin_imon.o"
+ AC_DEFINE(PLUGIN_IMON,1,[imon plugin])
+ else
+ AC_MSG_WARN(linux/errno.h header not found: imon plugin disabled)
+ fi
+fi
+
+# ISDN
+if test "$PLUGIN_ISDN" = "yes"; then
+ AC_CHECK_HEADERS(linux/isdn.h, [has_isdn_header="true"], [has_isdn_header="false"])
+ if test "$has_dvb_header" = "false"; then
+ AC_MSG_WARN(linux/isdn.h header not found: isdn plugin CPS disabled)
+ fi
+ PLUGINS="$PLUGINS plugin_isdn.o"
+ AC_DEFINE(PLUGIN_ISDN,1,[ISDN plugin])
+fi
+
+# Karlsruher Verkehrsverbund
+if test "$PLUGIN_KVV" = "yes"; then
+ PLUGINS="$PLUGINS plugin_kvv.o"
+ AC_DEFINE(PLUGIN_KVV,1,[kvv plugin])
+fi
+
+# load average
+if test "$PLUGIN_LOADAVG" = "yes"; then
+ PLUGINS="$PLUGINS plugin_loadavg.o"
+ AC_DEFINE(PLUGIN_LOADAVG,1,[loadavg plugin])
+fi
+
+# meminfo
+if test "$PLUGIN_MEMINFO" = "yes"; then
+ PLUGINS="$PLUGINS plugin_meminfo.o"
+ AC_DEFINE(PLUGIN_MEMINFO,1,[meminfo plugin])
+fi
+
+# MPD
+if test "$PLUGIN_MPD" = "yes"; then
+ AC_CHECK_LIB(mpdclient, [mpd_connection_new], [has_mpd_header="true"], [has_mpd_header="false"])
+ if test "$has_mpd_header" = "true"; then
+ PLUGINS="$PLUGINS plugin_mpd.o"
+ PLUGINLIBS="$PLUGINLIBS `pkg-config libmpdclient --libs`"
+ CPPFLAGS="$CPPFLAGS `pkg-config libmpdclient --cflags`"
+ AC_DEFINE(PLUGIN_MPD,1,[mpd plugin])
+ else
+ AC_MSG_WARN(libmpdclient.h header not found: mpd plugin disabled)
+ AC_MSG_WARN(get libmpdclient.h from http://www.musicpd.org/libmpdclient.shtml)
+ AC_MSG_WARN(and copy those 2 files in the lcd4linux directory.)
+ fi
+fi
+
+# MPRIS D-Bus
+if test "$PLUGIN_MPRIS_DBUS" = "yes"; then
+ AC_CHECK_HEADERS(dbus/dbus.h, [has_dbus_header="true"], [has_dbus_header="false"])
+ if test "$has_dbus_header" = "true"; then
+ AC_CHECK_LIB(dbus-1, dbus_bus_get, [has_libdbus1_lib="true"], [has_libdbus1_lib="false"])
+ if test "$has_libdbus1_lib" = "true"; then
+ PLUGINS="$PLUGINS plugin_mpris_dbus.o"
+ PLUGINLIBS="$PLUGINLIBS -ldbus-1"
+ AC_DEFINE(PLUGIN_MPRIS_DBUS,1,[mpris_dbus plugin])
+ else
+ AC_MSG_WARN(libdbus-1 lib not found: mpris_dbus plugin disabled)
+ fi
+ else
+ AC_MSG_WARN(dbus/dbus.h header not found: mpris_dbus plugin disabled)
+ fi
+fi
+
+
+# MySQL
+if test "$PLUGIN_MYSQL" = "yes"; then
+ AC_CHECK_HEADERS(mysql/mysql.h, [has_mysql_header="true"], [has_mysql_header="false"])
+ if test "$has_mysql_header" = "true"; then
+ AC_CHECK_LIB(mysqlclient, mysql_init, [has_mysql_lib="true"], [has_mysql_lib="false"])
+ if test "$has_mysql_lib" = "true"; then
+ PLUGINS="$PLUGINS plugin_mysql.o"
+ PLUGINLIBS="$PLUGINLIBS -lmysqlclient"
+ AC_DEFINE(PLUGIN_MYSQL,1,[mysql plugin])
+ else
+ AC_MSG_WARN(mysqlclient lib not found: mysql plugin disabled)
+ fi
+ else
+ AC_MSG_WARN(mysql/mysql.h header not found: mysql plugin disabled)
+ fi
+fi
+
+# /proc/net/dev
+if test "$PLUGIN_NETDEV" = "yes"; then
+ PLUGINS="$PLUGINS plugin_netdev.o"
+ AC_DEFINE(PLUGIN_NETDEV,1,[netdev plugin])
+fi
+
+# configuration of network devices
+if test "$PLUGIN_NETINFO" = "yes"; then
+ PLUGINS="$PLUGINS plugin_netinfo.o"
+ AC_DEFINE(PLUGIN_NETINFO,1,[netinfo plugin])
+fi
+
+# POP3
+if test "$PLUGIN_POP3" = "yes"; then
+ PLUGINS="$PLUGINS plugin_pop3.o"
+ AC_DEFINE(PLUGIN_POP3,1,[POP3 plugin])
+fi
+
+# PPP
+if test "$PLUGIN_PPP" = "yes"; then
+ AC_CHECK_HEADERS(net/if_ppp.h, [has_ppp_header="true"], [has_ppp_header="false"])
+ if test "$has_ppp_header" = "true"; then
+ PLUGINS="$PLUGINS plugin_ppp.o"
+ AC_DEFINE(PLUGIN_PPP,1,[ppp plugin])
+ else
+ AC_MSG_WARN(net/if_ppp.h header not found: ppp plugin disabled)
+ fi
+fi
+
+# /proc/stat
+if test "$PLUGIN_PROC_STAT" = "yes"; then
+ PLUGINS="$PLUGINS plugin_proc_stat.o"
+ AC_DEFINE(PLUGIN_PROC_STAT,1,[proc_stat plugin])
+fi
+
+# python
+if test "$PLUGIN_PYTHON" = "yes"; then
+ if test "$with_python" != "yes"; then
+ AC_MSG_WARN(python support not enabled: python plugin disabled (use --with-python to enable))
+ else
+ if test -z "$python_path"; then
+ AC_MSG_WARN(python headers not found: python plugin disabled)
+ else
+ PLUGINS="$PLUGINS plugin_python.o"
+ CPPFLAGS="$CPPFLAGS $PYTHON_CPPFLAGS"
+ PLUGINLIBS="$PLUGINLIBS $PYTHON_LDFLAGS $PYTHON_EXTRA_LIBS"
+ AC_DEFINE(PLUGIN_PYTHON,1,[python plugin])
+ fi
+ fi
+fi
+
+# Qnaplog
+if test "$PLUGIN_QNAPLOG" = "yes"; then
+ AC_CHECK_HEADERS(sqlite3.h, [has_sqlite3_header="true"], [has_sqlite3_header="false"])
+ if test "$has_sqlite3_header" = "true"; then
+ AC_CHECK_LIB(sqlite3, sqlite3_initialize, [has_sqlite3_lib="true"], [has_sqlite3_lib="false"])
+ if test "$has_sqlite3_lib" = "true"; then
+ PLUGINS="$PLUGINS plugin_qnaplog.o"
+ PLUGINLIBS="$PLUGINLIBS -lsqlite3"
+ AC_DEFINE(PLUGIN_QNAPLOG,1,[qnaplog plugin])
+ else
+ AC_MSG_WARN(sqlite3 lib not found: qnaplog plugin disabled)
+ fi
+ else
+ AC_MSG_WARN(sqlite3.h header not found: qnaplog plugin disabled)
+ fi
+fi
+
+# raspi (Raspberry PI)
+if test "$PLUGIN_RASPI" = "yes"; then
+ PLUGINS="$PLUGINS plugin_raspi.o"
+ AC_DEFINE(PLUGIN_RASPI,1,[raspi plugin])
+fi
+
+# sample
+if test "$PLUGIN_SAMPLE" = "yes"; then
+ PLUGINS="$PLUGINS plugin_sample.o"
+ AC_DEFINE(PLUGIN_SAMPLE,1,[sample plugin])
+fi
+
+# SETI
+if test "$PLUGIN_SETI" = "yes"; then
+ PLUGINS="$PLUGINS plugin_seti.o"
+ AC_DEFINE(PLUGIN_SETI,1,[seti plugin])
+fi
+
+# statfs()
+if test "$PLUGIN_STATFS" = "yes"; then
+ AC_CHECK_HEADERS(sys/vfs.h, [has_vfs_header="true"], [has_vfs_header="false"])
+ if test "$has_vfs_header" = "true"; then
+ PLUGINS="$PLUGINS plugin_statfs.o"
+ AC_DEFINE(PLUGIN_STATFS,1,[statfs plugin])
+ else
+ AC_MSG_WARN(sys/vfs.h header not found: statfs plugin disabled)
+ fi
+fi
+
+# uname
+if test "$PLUGIN_UNAME" = "yes"; then
+ PLUGINS="$PLUGINS plugin_uname.o"
+ AC_DEFINE(PLUGIN_UNAME,1,[uname plugin])
+fi
+
+# uptime
+if test "$PLUGIN_UPTIME" = "yes"; then
+ PLUGINS="$PLUGINS plugin_uptime.o"
+ AC_DEFINE(PLUGIN_UPTIME,1,[uptime plugin])
+fi
+
+if test "$PLUGIN_W1RETAP" = "yes"; then
+ PLUGINS="$PLUGINS plugin_w1retap.o"
+ AC_DEFINE(PLUGIN_W1RETAP,1,[w1retap plugin])
+fi
+
+# WLAN
+if test "$PLUGIN_WIRELESS" = "yes"; then
+ AC_CHECK_HEADERS(linux/wireless.h, [has_wireless_header="true"], [has_wireless_header="false"], [#include <sys/socket.h>])
+ if test "$has_wireless_header" = "true"; then
+ PLUGINS="$PLUGINS plugin_wireless.o"
+ AC_DEFINE(PLUGIN_WIRELESS,1,[wireless plugin])
+ else
+ AC_MSG_WARN(linux/wireless.h header not found: wireless plugin disabled)
+ fi
+fi
+
+# XMMS
+if test "$PLUGIN_XMMS" = "yes"; then
+ PLUGINS="$PLUGINS plugin_xmms.o"
+ AC_DEFINE(PLUGIN_XMMS,1,[xmms plugin])
+fi
+
+AC_SUBST(PLUGINS)
+AC_SUBST(PLUGINLIBS)
diff --git a/png.html b/png.html
new file mode 100644
index 0000000..5cb914b
--- /dev/null
+++ b/png.html
@@ -0,0 +1,8 @@
+<html><head>
+<title>PNG Test</title>
+</head>
+<body>
+<h1>PNG test</h1>
+<img src=/cgi-bin/nph-png>
+</body>
+</html>
diff --git a/property.c b/property.c
new file mode 100644
index 0000000..960663b
--- /dev/null
+++ b/property.c
@@ -0,0 +1,174 @@
+/* $Id: property.c 840 2007-09-09 12:17:42Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/property.c $
+ *
+ * dynamic properties
+ *
+ * Copyright (C) 2006 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2006 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+
+/*
+ * exported functions:
+ *
+ * void property_load (const char *section, const char *name, const char *defval, PROPERTY *prop)
+ * initializes and loads a property from the config file and pre-compiles it
+ *
+ * void property_free (PROPERTY *prop)
+ * frees all property allocations
+ *
+ * int property_eval(PROPERTY * prop)
+ * evaluates a property; returns 1 if value has changed
+ *
+ * double P2N(PROPERTY * prop)
+ * returns a (already evaluated) property as number
+ *
+ * char *P2S(PROPERTY * prop)
+ * returns a (already evaluated) property as string
+ *
+ */
+
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "debug.h"
+#include "cfg.h"
+#include "evaluator.h"
+#include "property.h"
+
+#ifdef WITH_DMALLOC
+#include <dmalloc.h>
+#endif
+
+
+void property_load(const char *section, const char *name, const char *defval, PROPERTY * prop)
+{
+ char *expression;
+
+ /* initialize structure */
+ prop->valid = 0;
+ prop->name = NULL;
+ prop->expression = NULL;
+ prop->compiled = NULL;
+ DelResult(&prop->result);
+
+ /* remember the name */
+ prop->name = strdup(name);
+
+ /* load expression from config, but do not evaluate it */
+ expression = cfg_get_raw(section, name, NULL);
+
+ if (expression == NULL) {
+ if (defval != NULL && *defval != '\0')
+ debug("Notice: using default value <%s> for property '%s.%s'", defval, section, name);
+ prop->expression = (char *) defval;
+ } else {
+ prop->valid = 1;
+ prop->expression = expression;
+ }
+
+ /* pre-compile the expression */
+ Compile(prop->expression, &prop->compiled);
+
+}
+
+
+int property_valid(PROPERTY * prop)
+{
+ return prop->valid;
+}
+
+
+int property_eval(PROPERTY * prop)
+{
+ RESULT old;
+ int update;
+
+ /* this is a bit ugly: we need to remember the old value */
+ old.type = prop->result.type;
+ old.size = prop->result.size;
+ old.number = prop->result.number;
+ old.string = prop->result.string != NULL ? strdup(prop->result.string) : NULL;
+
+ DelResult(&prop->result);
+ Eval(prop->compiled, &prop->result);
+
+ /* check if property value has changed */
+ update = 1;
+ if (prop->result.type & R_NUMBER && old.type & R_NUMBER && prop->result.number == old.number) {
+ update = 0;
+ }
+ if (prop->result.type & R_STRING && old.type & R_STRING && prop->result.size == old.size) {
+ if (prop->result.string == NULL && old.string == NULL) {
+ update = 0;
+ } else if (prop->result.string != NULL && old.string != NULL && strcmp(prop->result.string, old.string) == 0) {
+ update = 0;
+ }
+ }
+
+ if (old.string)
+ free(old.string);
+
+ return update;
+}
+
+
+double P2N(PROPERTY * prop)
+{
+ if (prop == NULL) {
+ error("Property: internal error: NULL property");
+ return 0.0;
+ }
+ return R2N(&prop->result);
+}
+
+
+char *P2S(PROPERTY * prop)
+{
+ if (prop == NULL) {
+ error("Property: internal error: NULL property");
+ return NULL;
+ }
+ return R2S(&prop->result);
+}
+
+void property_free(PROPERTY * prop)
+{
+ if (prop->name != NULL) {
+ free(prop->name);
+ prop->name = NULL;
+ }
+
+ if (prop->expression != NULL) {
+ /* do *not* free expression */
+ prop->expression = NULL;
+ }
+
+ if (prop->compiled != NULL) {
+ free(prop->compiled);
+ prop->compiled = NULL;
+ }
+
+ DelResult(&prop->result);
+}
diff --git a/property.h b/property.h
new file mode 100644
index 0000000..178768d
--- /dev/null
+++ b/property.h
@@ -0,0 +1,50 @@
+/* $Id: property.h 840 2007-09-09 12:17:42Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/property.h $
+ *
+ * dynamic properties
+ *
+ * Copyright (C) 2006 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2006 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+
+#ifndef _PROPERTY_H_
+#define _PROPERTY_H_
+
+#include "evaluator.h"
+
+
+typedef struct {
+ int valid;
+ char *name;
+ char *expression;
+ void *compiled;
+ RESULT result;
+} PROPERTY;
+
+
+void property_load(const char *section, const char *name, const char *defval, PROPERTY * prop);
+int property_valid(PROPERTY * prop);
+int property_eval(PROPERTY * prop);
+double P2N(PROPERTY * prop);
+char *P2S(PROPERTY * prop);
+void property_free(PROPERTY * prop);
+
+#endif
diff --git a/qprintf.c b/qprintf.c
new file mode 100644
index 0000000..735dabe
--- /dev/null
+++ b/qprintf.c
@@ -0,0 +1,260 @@
+/* $Id: qprintf.c 918 2008-12-31 06:07:29Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/qprintf.c $
+ *
+ * simple but quick snprintf() replacement
+ *
+ * Copyright (C) 2004 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * derived from a patch from Martin Hejl which is
+ * Copyright (C) 2003 Martin Hejl (martin@hejl.de)
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ * exported functions:
+ *
+ * int qprintf(char *str, size_t size, const char *format, ...)
+ * works like snprintf(), but format only knows about %d, %x, %u and %s
+ * and for the numbers an optional length like %<len>d. If <len> beginns
+ * with '0' the free space is filled with '0's, otherwise with ' '
+ */
+
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <stdarg.h>
+#include <string.h>
+
+static char *itoa(char *buffer, const size_t size, int value, unsigned int fixedlen, unsigned int fill0)
+{
+ char *p;
+ int sign;
+
+ /* sanity checks */
+ if (buffer == NULL || size < 2)
+ return (NULL);
+
+ /* remember sign of value */
+ sign = 0;
+ if (value < 0) {
+ sign = 1;
+ if (fill0)
+ fixedlen -= 1;
+ value = -value;
+ }
+
+ /* p points to last char */
+ p = buffer + size - 1;
+
+ /* set terminating zero */
+ *p = '\0';
+
+ do {
+ *--p = value % 10 + '0';
+ value = value / 10;
+ } while (value != 0 && p > buffer);
+
+ if (sign && !fill0 && p > buffer)
+ *--p = '-';
+
+ /* fill fixed length */
+ while (p > buffer && strlen(p) < fixedlen) {
+ if (fill0) {
+ *--p = '0';
+ } else {
+ *--p = ' ';
+ }
+ }
+
+ if (sign && fill0 && p > buffer)
+ *--p = '-';
+
+ return p;
+}
+
+
+static char *utoa(char *buffer, const size_t size, unsigned int value, unsigned int fixedlen, unsigned int fill0)
+{
+ char *p;
+
+ /* sanity checks */
+ if (buffer == NULL || size < 2)
+ return (NULL);
+
+ /* p points to last char */
+ p = buffer + size - 1;
+
+ /* set terminating zero */
+ *p = '\0';
+
+ do {
+ *--p = value % 10 + '0';
+ value = value / 10;
+ } while (value != 0 && p > buffer);
+
+ /* fill fixed length */
+ while (p > buffer && strlen(p) < fixedlen) {
+ if (fill0) {
+ *--p = '0';
+ } else {
+ *--p = ' ';
+ }
+ }
+
+ return p;
+}
+
+
+static char *utox(char *buffer, const size_t size, unsigned int value, unsigned int fixedlen, unsigned int fill0)
+{
+ char *p;
+ int digit;
+
+ /* sanity checks */
+ if (buffer == NULL || size < 2)
+ return (NULL);
+
+ /* p points to last char */
+ p = buffer + size - 1;
+
+ /* set terminating zero */
+ *p = '\0';
+
+ do {
+ digit = value % 16;
+ value = value / 16;
+ *--p = (digit < 10 ? '0' : 'a' - 10) + digit;
+ } while (value != 0 && p > buffer);
+
+ /* fill fixed length */
+ while (p > buffer && strlen(p) < fixedlen) {
+ if (fill0) {
+ *--p = '0';
+ } else {
+ *--p = ' ';
+ }
+ }
+
+ return p;
+}
+
+
+/*!
+ @function qprintf
+ @abstract quick print values into string
+ @discussion similar to snprintf(), but only support for "%s", "%d", "%u", "%x" with optional length for the numbers
+ like "%5d" (filled with ' ') or "%05x" (filled with '0')
+ @param str destination
+ @param size maximum length of destination string
+ @param format (like printf() with reduced number of formats)
+ @result length of produced string
+*/
+int qprintf(char *str, const size_t size, const char *format, ...)
+{
+
+ va_list ap;
+ const char *src;
+ char *dst;
+ unsigned int len;
+
+ src = format;
+ dst = str;
+ len = 0;
+
+ va_start(ap, format);
+
+ /* use size-1 for terminating zero */
+ while (len < size - 1) {
+
+ if (*src == '%') {
+ char buf[12], *s;
+ int d;
+ unsigned int u;
+ unsigned int fixedlen = 0;
+ unsigned int fill0 = 0;
+
+ if (*++src == '0')
+ fill0 = 1;
+ while (*src >= '0' && *src <= '9') {
+ fixedlen = fixedlen * 10 + (*src - '0');
+ src++;
+ }
+
+ switch (*src) {
+ case 's':
+ src++;
+ s = va_arg(ap, char *);
+ while (len < size - 1 && *s != '\0') {
+ len++;
+ *dst++ = *s++;
+ }
+ break;
+ case 'd':
+ src++;
+ d = va_arg(ap, int);
+ s = itoa(buf, sizeof(buf), d, fixedlen, fill0);
+ while (len < size && *s != '\0') {
+ len++;
+ *dst++ = *s++;
+ }
+ break;
+ case 'u':
+ src++;
+ u = va_arg(ap, unsigned int);
+ s = utoa(buf, sizeof(buf), u, fixedlen, fill0);
+ while (len < size - 1 && *s != '\0') {
+ len++;
+ *dst++ = *s++;
+ }
+ break;
+ case 'x':
+ src++;
+ u = va_arg(ap, unsigned int);
+ s = utox(buf, sizeof(buf), u, fixedlen, fill0);
+ while (len < size - 1 && *s != '\0') {
+ len++;
+ *dst++ = *s++;
+ }
+ break;
+ default:
+ len++;
+ *dst++ = '%';
+ }
+ } else {
+ len++;
+ *dst++ = *src;
+ if (*src++ == '\0')
+ break;
+ }
+ }
+
+ va_end(ap);
+
+ /* enforce terminating zero */
+ if (len >= size - 1 && *(dst - 1) != '\0') {
+ len++;
+ *dst = '\0';
+ }
+
+ /* do not count terminating zero */
+ return len - 1;
+}
diff --git a/qprintf.h b/qprintf.h
new file mode 100644
index 0000000..6d5eb94
--- /dev/null
+++ b/qprintf.h
@@ -0,0 +1,38 @@
+/* $Id: qprintf.h 840 2007-09-09 12:17:42Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/qprintf.h $
+ *
+ * simple but quick snprintf() replacement
+ *
+ * Copyright (C) 2004 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * derived from a patch from Martin Hejl which is
+ * Copyright (C) 2003 Martin Hejl (martin@hejl.de)
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+#ifndef _QPRINTF_H_
+#define _QPRINTF_H_
+
+/* size_t */
+#include <stdio.h>
+
+int qprintf(char *str, size_t size, const char *format, ...);
+
+#endif
diff --git a/rgb.c b/rgb.c
new file mode 100644
index 0000000..089635b
--- /dev/null
+++ b/rgb.c
@@ -0,0 +1,64 @@
+/* $Id: rgb.c 1091 2010-01-21 04:26:24Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/rgb.c $
+ *
+ * generic color handling
+ *
+ * Copyright (C) 2005 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2005 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "rgb.h"
+
+
+int color2RGBA(const char *color, RGBA * C)
+{
+ char *e;
+ unsigned long l;
+
+ if (color == NULL || *color == '\0') {
+ return -1;
+ }
+
+ l = strtoul(color, &e, 16);
+ if (e != NULL && *e != '\0') {
+ return -1;
+ }
+
+ if (strlen(color) == 8) {
+ /* RGBA */
+ C->R = (l >> 24) & 0xff;
+ C->G = (l >> 16) & 0xff;
+ C->B = (l >> 8) & 0xff;
+ C->A = (l >> 0) & 0xff;
+ } else {
+ /* RGB */
+ C->R = (l >> 16) & 0xff;
+ C->G = (l >> 8) & 0xff;
+ C->B = l & 0xff;
+ C->A = 0xff;
+ }
+ return 0;
+}
diff --git a/rgb.h b/rgb.h
new file mode 100644
index 0000000..a1ffb92
--- /dev/null
+++ b/rgb.h
@@ -0,0 +1,41 @@
+/* $Id: rgb.h 840 2007-09-09 12:17:42Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/rgb.h $
+ *
+ * generic color handling
+ *
+ * Copyright (C) 2005 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2005 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+
+#ifndef _RGB_H_
+#define _RGB_H_
+
+typedef struct {
+ unsigned char R;
+ unsigned char G;
+ unsigned char B;
+ unsigned char A;
+} RGBA;
+
+
+int color2RGBA(const char *color, RGBA * C);
+
+#endif
diff --git a/smoketest.sh b/smoketest.sh
new file mode 100755
index 0000000..2142277
--- /dev/null
+++ b/smoketest.sh
@@ -0,0 +1,41 @@
+#! /bin/bash
+
+# $Id: smoketest.sh 1177 2012-02-22 03:11:31Z michael $
+# $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/smoketest.sh $
+
+
+rm -f smoketest.log lcd4linux
+
+make distclean
+./bootstrap
+
+for driver in ASTUSB BeckmannEgle BWCT CrystalFontz Curses Cwlinux D4D DPF EA232graphic EFN FutabaVFD G15 GLCD2USB HD44780 IRLCD LCD2USB LCDLinux LCDTerm LEDMatrix LPH7508 LUIse LW_ABP M50530 MatrixOrbital MatrixOrbitalGX MilfordInstruments Noritake NULL Pertelian PHAnderson picoLCD picoLCDGraphic PNG PPM RouterBoard Sample SamsungSPF serdisplib SimpleLCD T6963 TeakLCM Trefon ULA200 USBHUB USBLCD WincorNixdorf X11; do
+
+ make distclean
+ ./configure --with-drivers=$driver
+ make -s -j 8
+
+ if [ -x lcd4linux ]; then
+ echo "Success: drv_$driver" >>smoketest.log
+ else
+ echo "FAILED: drv_$driver" >>smoketest.log
+ fi
+
+done
+
+for plugin in apm asterisk button_exec cpuinfo dbus diskstats dvb exec event fifo file gps hddtemp huawei i2c_sensors iconv imon isdn kvv loadavg meminfo mpd mpris_dbus mysql netdev netinfo pop3 ppp proc_stat python qnaplog sample seti statfs uname uptime w1retap wireless xmms; do
+
+ make distclean
+ ./configure --with-drivers=NULL --with-plugins=$plugin
+ make -s -j 8
+
+ if [ -x lcd4linux ]; then
+ echo "Success: plugin_$plugin" >>smoketest.log
+ else
+ echo "FAILED: plugin_$plugin" >>smoketest.log
+ fi
+
+done
+
+make distclean
+./configure
diff --git a/svn_version.h b/svn_version.h
new file mode 100644
index 0000000..c5c25bc
--- /dev/null
+++ b/svn_version.h
@@ -0,0 +1 @@
+#define SVN_VERSION "1193"
diff --git a/svn_version.sh b/svn_version.sh
new file mode 100755
index 0000000..776793e
--- /dev/null
+++ b/svn_version.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+# $Id: svn_version.sh 756 2007-01-23 04:38:43Z michael $
+# $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/svn_version.sh $
+
+
+OLD_VERSION=`cat svn_version.h 2>/dev/null`
+
+if [ -d .svn ]; then
+ NEW_VERSION="#define SVN_VERSION \"`svnversion -n`\""
+fi
+
+if [ "$NEW_VERSION" != "$OLD_VERSION" ]; then
+ echo $NEW_VERSION >svn_version.h
+fi
diff --git a/thread.c b/thread.c
new file mode 100644
index 0000000..e9972bd
--- /dev/null
+++ b/thread.c
@@ -0,0 +1,193 @@
+/* $Id: thread.c 1153 2011-07-27 05:12:30Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/thread.c $
+ *
+ * thread handling (mutex, shmem, ...)
+ *
+ * Copyright (C) 2004 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * parts of this code are based on the old XWindow driver which is
+ * Copyright (C) 2000 Herbert Rosmanith <herp@wildsau.idv.uni-linz.ac.at>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ * exported functions:
+ *
+ * int mutex_create (void);
+ * creates a mutex and treturns its ID
+ *
+ * void mutex_lock (int semid);
+ * try to lock a mutex
+ *
+ * void mutex_unlock (int semid);
+ * unlock a mutex
+ *
+ * void mutex_destroy (int semid);
+ * release a mutex
+ *
+ *
+ * int shm_create (void **buffer, int size);
+ * create shared memory segment
+ *
+ * void shm_destroy (int shmid, void *buffer) ;
+ * release shared memory segment
+ *
+ * int thread_create (char *name, void (*thread)(void *data), void *data);
+ * create a new thread
+ *
+ */
+
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <errno.h>
+#include <signal.h>
+#include <sys/types.h>
+#include <sys/ipc.h>
+#include <sys/sem.h>
+#include <sys/shm.h>
+
+#include "debug.h"
+#include "thread.h"
+
+
+#ifdef WITH_DMALLOC
+#include <dmalloc.h>
+#endif
+
+
+int thread_argc;
+char **thread_argv;
+
+
+/* glibc 2.1 requires defining semun ourselves */
+#ifdef _SEM_SEMUN_UNDEFINED
+union semun {
+ int val;
+ struct semid_ds *buf;
+ unsigned short int *array;
+ struct seminfo *__buf;
+};
+#endif
+
+
+int mutex_create(void)
+{
+ int semid;
+ union semun semun;
+
+ semid = semget(IPC_PRIVATE, 1, 0);
+ if (semid == -1) {
+ error("fatal error: semget() failed: %s", strerror(errno));
+ return -1;
+ }
+ semun.val = 1;
+ semctl(semid, 0, SETVAL, semun);
+
+ return semid;
+}
+
+
+void mutex_lock(const int semid)
+{
+ struct sembuf sembuf;
+ sembuf.sem_num = 0;
+ sembuf.sem_op = -1;
+ sembuf.sem_flg = 0;
+ semop(semid, &sembuf, 1);
+}
+
+
+void mutex_unlock(const int semid)
+{
+ struct sembuf sembuf;
+ sembuf.sem_num = 0;
+ sembuf.sem_op = 1;
+ sembuf.sem_flg = 0;
+ semop(semid, &sembuf, 1);
+}
+
+
+void mutex_destroy(const int semid)
+{
+ union semun arg;
+ semctl(semid, 0, IPC_RMID, arg);
+}
+
+
+int shm_create(void **buffer, const int size)
+{
+ int shmid;
+
+ shmid = shmget(IPC_PRIVATE, size, SHM_R | SHM_W);
+ if (shmid == -1) {
+ error("fatal error: shmget() failed: %s", strerror(errno));
+ return -1;
+ }
+
+ *buffer = shmat(shmid, NULL, 0);
+ if (*buffer == NULL) {
+ error("fatal error: shmat() failed: %s", strerror(errno));
+ return -1;
+ }
+
+ return shmid;
+}
+
+
+void shm_destroy(const int shmid, const void *buffer)
+{
+ shmdt(buffer);
+ shmctl(shmid, IPC_RMID, NULL);
+}
+
+
+int thread_create(const char *name, void (*thread) (void *data), void *data)
+{
+ pid_t pid;
+
+ switch (pid = fork()) {
+ case -1:
+ error("fatal error: fork(%s) failed: %s", name, strerror(errno));
+ return -1;
+ case 0:
+ info("thread %s starting...", name);
+ if (thread_argc > 0) {
+ strncpy(thread_argv[0], name, strlen(thread_argv[0]));
+ }
+ thread(data);
+ info("thread %s ended.", name);
+ exit(0);
+ default:
+ info("forked process %d for thread %s", pid, name);
+ }
+
+ return pid;
+}
+
+
+int thread_destroy(const int pid)
+{
+ return kill(pid, SIGKILL);
+}
diff --git a/thread.h b/thread.h
new file mode 100644
index 0000000..5ccd991
--- /dev/null
+++ b/thread.h
@@ -0,0 +1,66 @@
+/* $Id: thread.h 1010 2009-03-27 13:13:28Z michux $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/thread.h $
+ *
+ * thread handling (mutex, shmem, ...)
+ *
+ * Copyright (C) 2004 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * parts of this code are based on the old XWindow driver which is
+ * Copyright (C) 2000 Herbert Rosmanith <herp@wildsau.idv.uni-linz.ac.at>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+#ifndef _THREAD_H_
+#define _THREAD_H_
+
+#ifdef __CYGWIN__
+
+#ifndef HAVE_UNION_SEMUN
+union semun {
+ int val;
+ struct semid_ds *buf;
+ unsigned short *array;
+};
+#endif
+
+#ifndef SHM_R
+#define SHM_R 0400
+#endif
+#ifndef SHM_W
+#define SHM_W 0660
+#endif
+
+#endif
+
+extern int thread_argc;
+extern char **thread_argv;
+
+int mutex_create(void);
+void mutex_lock(const int semid);
+void mutex_unlock(const int semid);
+void mutex_destroy(const int semid);
+
+int shm_create(void **buffer, const int size);
+void shm_destroy(const int shmid, const void *buffer);
+
+int thread_create(const char *name, void (*thread) (void *data), void *data);
+int thread_destroy(const int pid);
+
+#endif
diff --git a/timer.c b/timer.c
new file mode 100644
index 0000000..63b223e
--- /dev/null
+++ b/timer.c
@@ -0,0 +1,502 @@
+/* $Id: timer.c 1185 2012-03-26 13:24:37Z mjona $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/timer.c $
+ *
+ * Generic timer handling.
+ *
+ * Copyright (C) 2003, 2004 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ * Exported functions:
+ *
+ * int timer_add(void (*callback) (void *data), void *data, const int
+ * interval, const int one_shot)
+ *
+ * Create a new timer and add it to the timer queue.
+ *
+ *
+ * int timer_add_late(void (*callback) (void *data), void *data, const
+ * int interval, const int one_shot)
+ *
+ * This function creates a new timer and adds it to the timer queue
+ * just as timer_add() does, but the timer will NOT be triggered
+ * immediately (useful for scheduling things).
+ *
+ *
+ * int timer_process(struct timespec *delay)
+ *
+ * Process timer queue.
+ *
+ *
+ * int timer_remove(void (*callback) (void *data), void *data)
+ *
+ * Remove a new timer with given callback and data.
+ *
+ *
+ * void timer_exit(void)
+ *
+ * Release all timers and free the associated memory block.
+ *
+ */
+
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/time.h>
+#include <time.h>
+
+#include "debug.h"
+#include "cfg.h"
+#include "timer.h"
+
+#ifdef WITH_DMALLOC
+#include <dmalloc.h>
+#endif
+
+/* threshold in milliseconds that differentiates between clock skew
+ and clock jitter */
+#define CLOCK_SKEW_DETECT_TIME_IN_MS 1000
+
+/* structure for storing all relevant data of a single timer */
+typedef struct TIMER {
+ /* pointer to function of type void func(void *data) that will be
+ called when the timer is processed; it will also be used to
+ identify a specific timer */
+ void (*callback) (void *data);
+
+ /* pointer to data which will be passed to the callback function;
+ it will also be used to identify a specific timer */
+ void *data;
+
+ /* struct to hold the time (in seconds and milliseconds since the
+ Epoch) when the timer will be processed for the next time */
+ struct timeval when;
+
+ /* specifies the timer's triggering interval in milliseconds */
+ int interval;
+
+ /* specifies whether the timer should trigger indefinitely until
+ it is deleted (value of 0) or only once (all other values) */
+ int one_shot;
+
+ /* marks timer as being active (so it will get processed) or
+ inactive (which means the timer has been deleted and its
+ allocated memory may be re-used) */
+ int active;
+} TIMER;
+
+/* number of allocated timer slots */
+int nTimers = 0;
+
+/* pointer to memory allocated for storing the timer slots */
+TIMER *Timers = NULL;
+
+
+static void timer_inc(const int timer, struct timeval *now)
+/* Update the time a given timer updates next.
+
+ timer (integer): internal ID of timer that is to be updated
+
+ now (timeval pointer): struct holding the "current" time
+
+ return value: void
+ */
+{
+ /* calculate the time difference between the last time the given
+ timer has been processed and the current time */
+ struct timeval diff;
+ timersub(now, &Timers[timer].when, &diff);
+
+ /* convert this time difference to fractional milliseconds */
+ float time_difference = (diff.tv_sec * 1000.0f) + (diff.tv_usec / 1000.0f);
+
+ /* calculate the number of timer intervals that have passed since
+ the last timer the given timer has been processed -- value is
+ truncated (rounded down) to an integer */
+ int number_of_intervals = (int) (time_difference / Timers[timer].interval);
+
+ /* notify the user in case one or more timer intervals have been
+ missed */
+ if (number_of_intervals > 0)
+ info("Timer #%d skipped %d interval(s) or %d ms.", timer, number_of_intervals,
+ number_of_intervals * Timers[timer].interval);
+
+ /* increment the number of passed intervals in order to skip all
+ missed intervals -- thereby avoiding that unprocessed timers
+ stack up, continuously update and are notoriously late (certain
+ railway companies might learn a lesson from us <g>) */
+ number_of_intervals++;
+
+ /* calculate time difference between the last time the timer has
+ been processed and the next time it will be processed */
+ int interval = Timers[timer].interval * number_of_intervals;
+
+ /* convert time difference (in milliseconds) to a "timeval"
+ struct (in seconds and microseconds) */
+ struct timeval tv_interval = {
+ .tv_sec = interval / 1000,
+ .tv_usec = (interval % 1000) * 1000
+ };
+
+ /* finally, add time difference to the timer's trigger */
+ timeradd(&Timers[timer].when, &tv_interval, &Timers[timer].when);
+}
+
+
+int timer_remove(void (*callback) (void *data), void *data)
+/* Remove a timer with given callback and data.
+
+ callback (void pointer): function of type void func(void *data);
+ here, it will be used to identify the timer
+
+ data (void pointer): data which will be passed to the callback
+ function; here, it will be used to identify the timer
+
+ return value (integer): returns a value of 0 on successful timer
+ removal; otherwise returns a value of -1
+*/
+{
+ int timer; /* current timer's ID */
+
+ /* loop through the timer slots and try to find the specified
+ timer slot by looking for its settings */
+ for (timer = 0; timer < nTimers; timer++) {
+ /* skip inactive (i.e. deleted) timers */
+ if (Timers[timer].active == TIMER_INACTIVE)
+ continue;
+
+ if (Timers[timer].callback == callback && Timers[timer].data == data) {
+ /* we have found the timer slot, so mark it as being inactive;
+ we will not actually delete the slot, so its allocated
+ memory may be re-used */
+ Timers[timer].active = TIMER_INACTIVE;
+
+ /* signal successful timer removal */
+ return 0;
+ }
+ }
+
+ /* we have NOT found the timer slot, so signal failure by
+ returning a value of -1 */
+ return -1;
+}
+
+
+int timer_add(void (*callback) (void *data), void *data, const int interval, const int one_shot)
+/* Create a new timer and add it to the timer queue.
+
+ callback (void pointer): function of type void func(void *data)
+ which will be called whenever the timer triggers; this pointer
+ will also be used to identify a specific timer
+
+ data (void pointer): data which will be passed to the callback
+ function; this pointer will also be used to identify a specific
+ timer
+
+ interval (integer): specifies the timer's triggering interval in
+ milliseconds
+
+ one_shot (integer): specifies whether the timer should trigger
+ indefinitely until it is deleted (value of 0) or only once (all
+ other values)
+
+ return value (integer): returns a value of 0 on successful timer
+ creation; otherwise returns a value of -1
+*/
+{
+ int timer; /* current timer's ID */
+ struct timeval now; /* struct to hold current time */
+
+ /* try to minimize memory usage by looping through the timer slots
+ and looking for an inactive timer */
+ for (timer = 0; timer < nTimers; timer++) {
+ if (Timers[timer].active == TIMER_INACTIVE) {
+ /* we've just found one, so let's reuse it ("timer" holds its
+ ID) by breaking the loop */
+ break;
+ }
+ }
+
+ /* no inactive timers (or none at all) found, so we have to add a
+ new timer slot */
+ if (timer == nTimers) {
+ TIMER *tmp;
+
+ if ((tmp = realloc(Timers, (nTimers + 1) * sizeof(*Timers))) == NULL) {
+ /* signal unsuccessful timer creation */
+ return -1;
+ }
+ Timers = tmp;
+ nTimers++;
+ }
+
+ /* get current time so the timer triggers immediately */
+ gettimeofday(&now, NULL);
+
+ /* initialize timer data */
+ Timers[timer].callback = callback;
+ Timers[timer].data = data;
+ Timers[timer].when = now;
+ Timers[timer].interval = interval;
+ Timers[timer].one_shot = one_shot;
+
+ /* set timer to active so that it is processed and not overwritten
+ by the memory optimization routine above */
+ Timers[timer].active = TIMER_ACTIVE;
+
+ /* one-shot timers should NOT fire immediately, so delay them by a
+ single timer interval */
+ if (one_shot) {
+ timer_inc(timer, &now);
+ }
+
+ /* signal successful timer creation */
+ return 0;
+}
+
+
+int timer_add_late(void (*callback) (void *data), void *data, const int interval, const int one_shot)
+/* This function creates a new timer and adds it to the timer queue
+ just as timer_add() does, but the timer will NOT be triggered
+ immediately (useful for scheduling things).
+
+ callback (void pointer): function of type void func(void *data)
+ which will be called whenever the timer triggers; this pointer
+ will also be used to identify a specific timer
+
+ data (void pointer): data which will be passed to the callback
+ function; this pointer will also be used to identify a specific
+ timer
+
+ interval (integer): specifies the timer's triggering interval in
+ milliseconds
+
+ one_shot (integer): specifies whether the timer should trigger
+ indefinitely until it is deleted (value of 0) or only once (all
+ other values)
+
+ return value (integer): returns a value of 0 on successful timer
+ creation; otherwise returns a value of -1
+*/
+{
+ /* create new timer slot and add it to the timer queue; mask it as
+ one-shot timer for now, so the timer will be delayed by a
+ single timer interval */
+ if (!timer_add(callback, data, interval, 1)) {
+ /* signal unsuccessful timer creation */
+ return -1;
+ }
+
+ int timer; /* current timer's ID */
+
+ /* loop through the timer slots and try to find the new timer slot
+ by looking for its settings */
+ for (timer = 0; timer < nTimers; timer++) {
+ /* skip inactive (i.e. deleted) timers */
+ if (Timers[timer].active == TIMER_INACTIVE)
+ continue;
+
+ if (Timers[timer].callback == callback && Timers[timer].data == data && Timers[timer].interval == interval) {
+ /* we have found the new timer slot, so unmask it by setting
+ its "one_shot" variable to the REAL value; then signal
+ successful timer creation */
+ Timers[timer].one_shot = one_shot;
+
+ /* signal successful timer creation */
+ return 0;
+ }
+ }
+
+ /* we have NOT found the new timer slot for some reason, so signal
+ failure by returning a value of -1 */
+ return -1;
+}
+
+
+int timer_process(struct timespec *delay)
+/* Process timer queue.
+
+ delay (timespec pointer): struct holding delay till the next
+ upcoming timer event
+
+ return value (integer): returns a value of 0 when timers have been
+ processed successfully; otherwise returns a value of -1
+*/
+{
+ struct timeval now; /* struct to hold current time */
+
+ /* get current time to check which timers need processing */
+ gettimeofday(&now, NULL);
+
+ /* sanity check; by now, at least one timer should be
+ instantiated */
+ if (nTimers <= 0) {
+ /* otherwise, print an error and return a value of -1 to
+ signal an error */
+ error("Huh? Not even a single timer to process? Dazed and confused...");
+ return -1;
+ }
+
+ int timer; /* current timer's ID */
+
+ /* process all expired timers */
+ for (timer = 0; timer < nTimers; timer++) {
+ /* skip inactive (i.e. deleted) timers */
+ if (Timers[timer].active == TIMER_INACTIVE)
+ continue;
+
+ /* check whether current timer needs to be processed, i.e. the
+ timer's triggering time is less than or equal to the current
+ time; according to the man page of timercmp(), this avoids
+ using the operators ">=", "<=" and "==" which might be broken
+ on some systems */
+ if (!timercmp(&Timers[timer].when, &now, >)) {
+ /* if the timer's callback function has been set, call it and
+ pass the corresponding data */
+ if (Timers[timer].callback != NULL) {
+ Timers[timer].callback(Timers[timer].data);
+ }
+
+ /* check for one-shot timers */
+ if (Timers[timer].one_shot) {
+ /* mark one-shot timer as inactive (which means the timer has
+ been deleted and its allocated memory may be re-used) */
+ Timers[timer].active = TIMER_INACTIVE;
+ } else {
+ /* otherwise, re-spawn timer by adding one triggering interval
+ to its triggering time */
+ timer_inc(timer, &now);
+ }
+ }
+ }
+
+ int next_timer = -1; /* ID of the next upcoming timer */
+
+ /* loop through the timer slots and try to find the next upcoming
+ timer */
+ for (timer = 0; timer < nTimers; timer++) {
+ /* skip inactive (i.e. deleted) timers */
+ if (Timers[timer].active == TIMER_INACTIVE)
+ continue;
+
+ /* if this is the first timer that we check, mark it as the next
+ upcoming timer; otherwise, we'll have nothing to compare
+ against in this loop */
+ if (next_timer < 0)
+ next_timer = timer;
+ /* check whether current timer needs processing prior to the one
+ selected */
+ else if (timercmp(&Timers[timer].when, &Timers[next_timer].when, <)) {
+ /* if so, mark it as the next upcoming timer */
+ next_timer = timer;
+ }
+ }
+
+ /* sanity check; we should by now have found the next upcoming
+ timer */
+ if (next_timer < 0) {
+ /* otherwise, print an error and return a value of -1 to signal an
+ error */
+ error("Huh? Not even a single timer left? Dazed and confused...");
+ return -1;
+ }
+
+ /* processing all the timers might have taken a while, so update
+ the current time to compensate for processing delay */
+ gettimeofday(&now, NULL);
+
+ struct timeval diff; /* struct holding the time difference
+ between current time and the triggering time of the
+ next upcoming timer event */
+
+ /* calculate delay to the next upcoming timer event and store it
+ in "diff" */
+ timersub(&Timers[next_timer].when, &now, &diff);
+
+ /* a negative delay has occurred (positive clock skew or some
+ timers are faster than the time needed for processing their
+ callbacks) */
+ if (diff.tv_sec < 0) {
+ /* zero "diff" so the next update is triggered immediately */
+ timerclear(&diff);
+ } else {
+ /* convert "diff" to milliseconds */
+ int time_difference = diff.tv_sec * 1000 + diff.tv_usec / 1000;
+
+ /* if there is a notable difference between "time_difference" and
+ the next upcoming timer's interval, assume clock skew */
+ if (time_difference > (Timers[next_timer].interval + CLOCK_SKEW_DETECT_TIME_IN_MS)) {
+ /* extract clock skew from "time_difference" by eliminating
+ the timer's triggering interval */
+ int skew = time_difference - Timers[next_timer].interval;
+
+ /* display an info message to inform the user */
+ info("Oops, clock skewed by %d ms, updating timestamps...", skew);
+
+ /* convert clock skew from milliseconds to "timeval"
+ structure */
+ struct timeval clock_skew = {
+ .tv_sec = skew / 1000,
+ .tv_usec = (skew % 1000) * 1000
+ };
+
+ /* process all timers */
+ for (timer = 0; timer < nTimers; timer++) {
+ /* skip inactive (i.e. deleted) timers */
+ if (Timers[timer].active == TIMER_INACTIVE)
+ continue;
+
+ /* correct timer's time stamp by clock skew */
+ timersub(&Timers[timer].when, &clock_skew, &Timers[timer].when);
+ }
+
+ /* finally, zero "diff" so the next update is triggered
+ immediately */
+ timerclear(&diff);
+ }
+ }
+
+ /* set timespec "delay" passed by calling function to "diff" */
+ delay->tv_sec = diff.tv_sec;
+ /* timespec uses nanoseconds instead of microseconds!!! */
+ delay->tv_nsec = diff.tv_usec * 1000;
+
+ /* signal successful timer processing */
+ return 0;
+}
+
+
+void timer_exit(void)
+/* Release all timers and free the associated memory block.
+
+ return value: void
+*/
+{
+ /* reset number of allocated timer slots */
+ nTimers = 0;
+
+ /* free memory used for storing the timer slots */
+ if (Timers != NULL) {
+ free(Timers);
+ Timers = NULL;
+ }
+}
diff --git a/timer.h b/timer.h
new file mode 100644
index 0000000..3fd8227
--- /dev/null
+++ b/timer.h
@@ -0,0 +1,46 @@
+/* $Id: timer.h 1182 2012-03-23 19:54:21Z mzuther $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/timer.h $
+ *
+ * generic timer handling
+ *
+ * Copyright (C) 2003, 2004 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+
+#ifndef _TIMER_H_
+#define _TIMER_H_
+
+#define TIMER_ACTIVE 1
+#define TIMER_INACTIVE 0
+
+#include <time.h>
+
+int timer_add(void (*callback) (void *data), void *data, const int interval, const int one_shot);
+
+int timer_add_late(void (*callback) (void *data), void *data, const int interval, const int one_shot);
+
+int timer_process(struct timespec *delay);
+
+int timer_remove(void (*callback) (void *data), void *data);
+
+void timer_exit(void);
+
+#endif
diff --git a/timer_group.c b/timer_group.c
new file mode 100644
index 0000000..5333403
--- /dev/null
+++ b/timer_group.c
@@ -0,0 +1,538 @@
+/* $Id: timer_group.c 1199 2013-05-23 03:07:28Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/timer_group.c $
+ *
+ * Generic grouping of widgets that have been set to the same update
+ * interval, thus allowing synchronized updates.
+ *
+ * Copyright (C) 2010 Martin Zuther <code@mzuther.de>
+ * Copyright (C) 2010 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * Based on "timer.c" which is
+ * Copyright (C) 2003, 2004 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ * Exported functions:
+ *
+ * void timer_process_group(void *data)
+ *
+ * Process all widgets of a timer group; if the timer group only
+ * contains one-shot timers, it will be deleted after processing.
+ *
+ *
+ * void timer_exit_group(void)
+ *
+ * Release all timer groups and widgets and free the associated
+ * memory blocks.
+ *
+ *
+ * int timer_add_widget(void (*callback) (void *data), void *data,
+ * const int interval, const int one_shot)
+ *
+ * Add widget to timer group of the specified update interval
+ * (also creates a new timer group if necessary).
+ *
+ *
+ * int timer_remove_widget(void (*callback) (void *data), void *data)
+ *
+ * Remove widget from the timer group with the specified update
+ * interval (also removes corresponding timer group if empty).
+ *
+ */
+
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "debug.h"
+#include "cfg.h"
+#include "timer.h"
+#include "timer_group.h"
+
+#ifdef WITH_DMALLOC
+#include <dmalloc.h>
+#endif
+
+
+/* structure for storing all relevant data of a single timer group */
+typedef struct TIMER_GROUP {
+ /* pointer to the group's triggering interval in milliseconds;
+ this will be used to identify a specific timer group and also
+ as callback data for the underlying generic timer */
+ int *interval;
+
+ /* marks timer group as being active (so it will get processed) or
+ inactive (which means the timer group has been deleted and its
+ allocated memory may be re-used) */
+ int active;
+} TIMER_GROUP;
+
+/* number of allocated timer group slots */
+int nTimerGroups = 0;
+
+/* pointer to memory allocated for storing the timer group slots */
+TIMER_GROUP *TimerGroups = NULL;
+
+
+/* structure for storing all relevant timer data of a single widget */
+typedef struct TIMER_GROUP_WIDGET {
+ /* pointer to function of type void func(void *data) that will be
+ called when the timer is processed; it will also be used to
+ identify a specific widget */
+ void (*callback) (void *data);
+
+ /* pointer to data which will be passed to the callback function;
+ it will also be used to identify a specific widget */
+ void *data;
+
+ /* specifies the timer's triggering interval in milliseconds; it
+ will also be used to identify a specific widget */
+ int interval;
+
+ /* specifies whether the timer should trigger indefinitely until
+ it is deleted (value of 0) or only once (all other values) */
+ int one_shot;
+
+ /* marks timer as being active (so it will get processed) or
+ inactive (which means the timer has been deleted and its
+ allocated memory may be re-used) */
+ int active;
+} TIMER_GROUP_WIDGET;
+
+/* number of allocated widget slots */
+int nTimerGroupWidgets = 0;
+
+/* pointer to memory allocated for storing the widget slots */
+TIMER_GROUP_WIDGET *TimerGroupWidgets = NULL;
+
+
+int timer_group_exists(const int interval)
+/* Check whether a timer group for the specified interval exists.
+
+ interval (integer): the sought-after triggering interval in
+ milliseconds
+
+ return value (integer): returns a value of 1 if timer group
+ exists; otherwise returns a value of 0
+*/
+{
+ int group; /* current timer group's ID */
+
+ /* loop through the timer group slots to search for one that
+ matches the specified interval */
+ for (group = 0; group < nTimerGroups; group++) {
+ /* skip inactive (i.e. deleted) timer groups */
+ if (TimerGroups[group].active == TIMER_INACTIVE)
+ continue;
+
+ if (*TimerGroups[group].interval == interval) {
+ /* matching timer group found, so signal success by returning
+ a value of 1 */
+ return 1;
+ }
+ }
+
+ /* matching timer group not found, so signal failure by returning
+ a value of 0 */
+ return 0;
+}
+
+
+int timer_add_group(const int interval)
+/* Create a new timer group (unless it already exists) and link it to
+ the timer queue.
+
+ interval (integer): the new timer group's triggering interval in
+ milliseconds
+
+ return value (integer): returns a value of 0 on successful timer
+ group creation; otherwise returns a value of -1
+*/
+{
+ /* if timer group for update interval already exists, signal
+ success by returning a value of 0 */
+ if (timer_group_exists(interval))
+ return 0;
+
+ /* display an info message to inform the user that a new timer
+ group is being created */
+ info("Creating new timer group (%d ms)", interval);
+
+ int group; /* current timer group's ID */
+
+ /* try to minimize memory usage by looping through timer group
+ slots and looking for an inactive timer group */
+ for (group = 0; group < nTimerGroups; group++) {
+ if (TimerGroups[group].active == TIMER_INACTIVE) {
+ /* we've just found one, so let's reuse it ("group" holds its
+ ID) by breaking the loop */
+ debug("Reusing Timergroup %i", group);
+ break;
+ }
+ }
+
+ /* no inactive timer groups (or none at all) found, so we have to
+ add a new timer group slot */
+ if (group == nTimerGroups) {
+ TIMER_GROUP *tmp;
+
+ if ((tmp = realloc(TimerGroups, (nTimerGroups + 1) * sizeof(*TimerGroups))) == NULL) {
+ error("Error expanding TimerGroups");
+ /* signal unsuccessful timer group creation */
+ return -1;
+ }
+ TimerGroups = tmp;
+ nTimerGroups++;
+
+ if ((TimerGroups[group].interval = malloc(sizeof(int))) == NULL) {
+ /* signal unsuccessful timer group creation */
+ return -1;
+ }
+ }
+
+ /* initialize timer group's interval */
+ *TimerGroups[group].interval = interval;
+
+ /* set timer group to active so that it is processed and not
+ overwritten by the memory optimization routine above */
+ TimerGroups[group].active = TIMER_ACTIVE;
+
+ /* finally, request a generic timer that calls this group and
+ signal success or failure */
+ return timer_add(timer_process_group, TimerGroups[group].interval, interval, 0);
+}
+
+
+int timer_remove_group(const int interval)
+/* Remove a timer group and unlink it from the timer queue (also
+ removes all remaining widget slots in this timer group).
+
+ interval (integer): triggering interval in milliseconds; here, it
+ will be used to identify the timer group
+
+ return value (integer): returns a value of 0 on successful timer
+ group removal; otherwise returns a value of -1
+*/
+{
+ /* display an info message to inform the user that a timer group
+ is being removed */
+ info("Removing timer group (%d ms)", interval);
+
+ int group; /* current timer group's ID */
+ int widget; /* current widget's ID */
+
+ /* loop through the widget slots to look for remaining widgets
+ with the specified update interval */
+ for (widget = 0; widget < nTimerGroupWidgets; widget++) {
+ /* skip inactive (i.e. deleted) widget slots */
+ if (TimerGroupWidgets[widget].active == TIMER_INACTIVE)
+ continue;
+
+ if (TimerGroupWidgets[widget].interval == interval) {
+ /* we have found a matching widget slot, so mark it as being
+ inactive; we will not actually delete the slot, so its
+ allocated memory may be re-used */
+ TimerGroupWidgets[widget].active = TIMER_INACTIVE;
+ }
+ }
+
+ /* loop through timer group slots and try to find the specified
+ timer group slot by looking for its settings */
+ for (group = 0; group < nTimerGroups; group++) {
+ /* skip inactive (i.e. deleted) timer groups */
+ if (TimerGroups[group].active == TIMER_INACTIVE)
+ continue;
+
+ if (*TimerGroups[group].interval == interval) {
+ /* we have found the timer group slot, so mark it as being
+ inactive; we will not actually delete the slot, so its
+ allocated memory may be re-used */
+ TimerGroups[group].active = TIMER_INACTIVE;
+
+ /* remove the generic timer that calls this group */
+ if (timer_remove(timer_process_group, &TimerGroups[group].interval)) {
+ /* signal successful removal of timer group */
+ return 0;
+ } else {
+ /* an error occurred on generic timer removal, so signal
+ failure by returning a value of -1 */
+ return -1;
+ }
+ }
+ }
+
+ /* we have NOT found the timer group slot, so signal failure by
+ returning a value of -1 */
+ return -1;
+}
+
+
+int timer_remove_empty_group(const int interval)
+/* Remove timer group *only* if it contains no more widget slots.
+
+ interval (integer): triggering interval in milliseconds; here, it
+ will be used to identify the timer group
+
+ return value (integer): returns a value of 0 on successful
+ processing; otherwise returns a value of -1
+*/
+{
+ int widget; /* current widget's ID */
+
+ /* loop through the widget slots to look for widgets with the
+ specified update interval */
+ for (widget = 0; widget < nTimerGroupWidgets; widget++) {
+ /* skip inactive (i.e. deleted) widget slots */
+ if (TimerGroupWidgets[widget].active == TIMER_INACTIVE)
+ continue;
+
+ /* at least one other widget with specified update interval
+ exists, so signal success by returning a value of 0 */
+ if (TimerGroupWidgets[widget].interval == interval)
+ return 0;
+ }
+
+ /* no other widgets with specified update interval exist, so
+ remove corresponding timer group and signal success or
+ failure */
+ return timer_remove_group(interval);
+}
+
+
+void timer_process_group(void *data)
+/* Process all widgets of a timer group; if the timer group only
+ contains one-shot timers, it will be deleted after processing.
+
+ data (void pointer): points to an integer holding the triggering
+ interval in milliseconds; here, it will be used to identify the
+ timer group
+
+ return value: void
+*/
+{
+ int widget; /* current widget's ID */
+
+ /* convert callback data to integer (triggering interval in
+ milliseconds) */
+ int interval = *((int *) data);
+
+ /* sanity check; by now, at least one timer group should be
+ instantiated */
+ if (nTimerGroups <= 0) {
+ /* otherwise, print an error and return early */
+ error("Huh? Not even a single timer group to process? Dazed and confused...");
+ return;
+ }
+
+ /* sanity check; by now, at least one widget slot should be
+ instantiated */
+ if (nTimerGroupWidgets <= 0) {
+ /* otherwise, print an error and return early */
+ error("Huh? Not even a single widget slot to process? Dazed and confused...");
+ return;
+ }
+
+ /* loop through widgets and search for those matching the timer
+ group's update interval */
+ for (widget = 0; widget < nTimerGroupWidgets; widget++) {
+ /* skip inactive (i.e. deleted) widgets */
+ if (TimerGroupWidgets[widget].active == TIMER_INACTIVE)
+ continue;
+
+ /* the current widget belongs to the specified timer group */
+ if (TimerGroupWidgets[widget].interval == interval) {
+ /* if the widget's callback function has been set, call it and
+ pass the corresponding data */
+ if (TimerGroupWidgets[widget].callback != NULL)
+ TimerGroupWidgets[widget].callback(TimerGroupWidgets[widget].data);
+
+ /* mark one-shot widget as inactive (which means the it has
+ been deleted and its allocated memory may be re-used) */
+ if (TimerGroupWidgets[widget].one_shot) {
+ TimerGroupWidgets[widget].active = TIMER_INACTIVE;
+
+ /* also remove the corresponding timer group if it is empty */
+ timer_remove_empty_group(interval);
+ }
+ }
+ }
+}
+
+
+int timer_add_widget(void (*callback) (void *data), void *data, const int interval, const int one_shot)
+/* Add widget to timer group of the specified update interval
+ (also creates a new timer group if necessary).
+
+ callback (void pointer): function of type void func(void *data)
+ which will be called whenever the timer group triggers; this
+ pointer will also be used to identify a specific widget
+
+ data (void pointer): data which will be passed to the callback
+ function; this pointer will also be used to identify a specific
+ widget
+
+ interval (integer): specifies the timer's triggering interval in
+ milliseconds
+
+ one_shot (integer): specifies whether the timer should trigger
+ indefinitely until it is deleted (value of 0) or only once (all
+ other values)
+
+ return value (integer): returns a value of 0 on successful widget
+ addition; otherwise returns a value of -1
+*/
+{
+ int widget; /* current widget's ID */
+
+ /* if no timer group for update interval exists, create one */
+ if (!timer_group_exists(interval)) {
+ /* creation of new timer group failed, so signal failure by
+ returning a value of -1 */
+ if (timer_add_group(interval) != 0)
+ return -1;
+ }
+
+ /* try to minimize memory usage by looping through the widget
+ slots and looking for an inactive widget slot */
+ for (widget = 0; widget < nTimerGroupWidgets; widget++) {
+ if (TimerGroupWidgets[widget].active == TIMER_INACTIVE) {
+ /* we've just found one, so let's reuse it ("widget" holds its
+ ID) by breaking the loop */
+ break;
+ }
+ }
+
+ /* no inactive widget slots (or none at all) found, so we have to
+ add a new widget slot */
+ if (widget == nTimerGroupWidgets) {
+ TIMER_GROUP_WIDGET *tmp;
+
+ if ((tmp = realloc(TimerGroupWidgets, (nTimerGroupWidgets + 1) * sizeof(*TimerGroupWidgets))) == NULL) {
+ /* signal unsuccessful creation of widget slot */
+ return -1;
+ }
+ TimerGroupWidgets = tmp;
+ nTimerGroupWidgets++;
+ }
+
+ /* initialize widget slot */
+ TimerGroupWidgets[widget].callback = callback;
+ TimerGroupWidgets[widget].data = data;
+ TimerGroupWidgets[widget].interval = interval;
+ TimerGroupWidgets[widget].one_shot = one_shot;
+
+ /* set widget slot to active so that it is processed and not
+ overwritten by the memory optimization routine above */
+ TimerGroupWidgets[widget].active = TIMER_ACTIVE;
+
+ /* signal successful addition of widget slot */
+ return 0;
+}
+
+
+int timer_remove_widget(void (*callback) (void *data), void *data)
+/* Remove widget from the timer group with the specified update
+ interval (also removes corresponding timer group if empty).
+
+ callback (void pointer): function of type void func(void *data);
+ here, it will be used to identify a specific widget
+
+ data (void pointer): data which will be passed to the callback
+ function; here, it will be used to identify a specific widget
+
+ return value (integer): returns a value of 0 on successful widget
+ removal; otherwise returns a value of -1
+*/
+{
+ int widget; /* current widget's ID */
+ int interval = -1; /* specified widget's triggering interval in
+ milliseconds */
+
+ /* loop through the widget slots and try to find the specified
+ widget slot by looking for its settings */
+ for (widget = 0; widget < nTimerGroupWidgets; widget++) {
+ /* skip inactive (i.e. deleted) widget slots */
+ if (TimerGroupWidgets[widget].active == TIMER_INACTIVE)
+ continue;
+
+ if (TimerGroupWidgets[widget].callback == callback && TimerGroupWidgets[widget].data == data) {
+ /* we have found the widget slot, so mark it as being
+ inactive; we will not actually delete the slot, so its
+ allocated memory may be re-used */
+ TimerGroupWidgets[widget].active = TIMER_INACTIVE;
+
+ /* store the widget's triggering interval for later use and
+ break the loop */
+ interval = TimerGroupWidgets[widget].interval;
+ break;
+ }
+ }
+
+ /* if no matching widget was found, signal an error by returning
+ a value of -1 */
+ if (interval < 0)
+ return -1;
+
+ /* if no other widgets with specified update interval exist,
+ remove corresponding timer group and signal success or
+ failure */
+ return timer_remove_empty_group(interval);
+}
+
+
+void timer_exit_group(void)
+/* Release all timer groups and widgets and free the associated
+ memory blocks.
+
+ return value: void
+*/
+{
+ int group; /* current timer group's ID */
+
+ /* loop through all timer groups and remove them one by one */
+ for (group = 0; group < nTimerGroups; group++) {
+ /* remove generic timer */
+ timer_remove(timer_process_group, TimerGroups[group].interval);
+
+ /* free memory allocated for callback data (i.e. the group's
+ triggering interval in milliseconds) */
+ free(TimerGroups[group].interval);
+ }
+
+ /* reset number of allocated timer groups */
+ nTimerGroups = 0;
+
+ /* free allocated memory containing the timer group slots */
+ if (TimerGroups != NULL) {
+ free(TimerGroups);
+ TimerGroups = NULL;
+ }
+
+ /* reset number of allocated widget slots */
+ nTimerGroupWidgets = 0;
+
+ /* free allocated memory containing the widget slots */
+ if (TimerGroupWidgets != NULL) {
+ free(TimerGroupWidgets);
+ TimerGroupWidgets = NULL;
+ }
+}
diff --git a/timer_group.h b/timer_group.h
new file mode 100644
index 0000000..af50125
--- /dev/null
+++ b/timer_group.h
@@ -0,0 +1,41 @@
+/* $Id: timer_group.h 1136 2010-11-28 16:07:16Z mzuther $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/timer_group.h $
+ *
+ * generic grouping of widget timers that have been set to the same
+ * update interval, thus allowing synchronized updates
+ *
+ * Copyright (C) 2010 Martin Zuther <code@mzuther.de>
+ * Copyright (C) 2010 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+
+#ifndef _TIMER_GROUP_H_
+#define _TIMER_GROUP_H_
+
+
+void timer_process_group(void *data);
+
+void timer_exit_group(void);
+
+int timer_add_widget(void (*callback) (void *data), void *data, const int interval, const int one_shot);
+
+int timer_remove_widget(void (*callback) (void *data), void *data);
+
+#endif
diff --git a/tux.png b/tux.png
new file mode 100644
index 0000000..a4f8db3
--- /dev/null
+++ b/tux.png
Binary files differ
diff --git a/udelay.c b/udelay.c
new file mode 100644
index 0000000..33ffa95
--- /dev/null
+++ b/udelay.c
@@ -0,0 +1,114 @@
+/* $Id: udelay.c 844 2007-10-01 15:49:21Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/udelay.c $
+ *
+ * short delays
+ *
+ * Copyright (C) 1999, 2000 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ *
+ * exported fuctions:
+ *
+ * void udelay_init (void)
+ * selects delay method (gettimeofday() ord rdtsc() according
+ * to processor features
+ *
+ * unsigned long timing (const char *driver, const char *section, const char *name, const int defval, const char *unit);
+ * returns a timing value from config or the default value
+ *
+ * void udelay (unsigned long usec)
+ * delays program execution for usec microseconds
+ * uses global variable 'loops_per_usec', which has to be set before.
+ * This function does busy-waiting! so use only for delays smaller
+ * than 10 msec
+ *
+ */
+
+#include "config.h"
+#include <stdlib.h>
+#include <stdio.h>
+
+
+#include <math.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <string.h>
+#include <sys/time.h>
+
+
+#include "debug.h"
+#include "cfg.h"
+#include "qprintf.h"
+#include "udelay.h"
+
+
+
+void udelay_init(void)
+{
+ info("udelay: using gettimeofday() delay loop");
+}
+
+
+unsigned long timing(const char *driver, const char *section, const char *name, const int defval, const char *unit)
+{
+ char sec[256];
+ int fuzz, val;
+
+ qprintf(sec, sizeof(sec), "%s.Timing", section);
+
+ /* fuzz all timings by given factor */
+ cfg_number(sec, "fuzz", 100, 1, -1, &fuzz);
+
+ cfg_number(sec, name, defval, 0, -1, &val);
+ val = val * fuzz / 100;
+
+ if (val != defval) {
+ if (fuzz != 100) {
+ info("%s: timing: %6s = %5d %s (default %d %s, fuzz %d)", driver, name, val, unit, defval, unit, fuzz);
+ } else {
+ info("%s: timing: %6s = %5d %s (default %d %s)", driver, name, val, unit, defval, unit);
+ }
+ } else {
+ info("%s: timing: %6s = %5d %s (default)", driver, name, defval, unit);
+ }
+ return val;
+}
+
+
+void ndelay(const unsigned long nsec)
+{
+
+ struct timeval now, end;
+
+ gettimeofday(&end, NULL);
+ end.tv_usec += (nsec + 999) / 1000;
+ while (end.tv_usec > 1000000) {
+ end.tv_usec -= 1000000;
+ end.tv_sec++;
+ }
+
+ do {
+ rep_nop();
+ gettimeofday(&now, NULL);
+ } while (now.tv_sec == end.tv_sec ? now.tv_usec < end.tv_usec : now.tv_sec < end.tv_sec);
+}
diff --git a/udelay.h b/udelay.h
new file mode 100644
index 0000000..02c7835
--- /dev/null
+++ b/udelay.h
@@ -0,0 +1,50 @@
+/* $Id: udelay.h 1126 2010-07-13 03:25:44Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/udelay.h $
+ *
+ * short delays
+ *
+ * Copyright (C) 1999, 2000 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+#ifndef _UDELAY_H_
+#define _UDELAY_H_
+
+/* stolen from linux/asm-i386/processor.h */
+/* REP NOP (PAUSE) is a good thing to insert into busy-wait loops. */
+static inline void rep_nop(void)
+{
+#if defined(__i386) || defined(__i386__) || defined(__AMD64__) || defined(__x86_64__) || defined(__amd64__)
+ /* intel or amd64 arch, the "rep" and "nop" opcodes are available */
+ __asm__ __volatile__("rep; nop");
+#else
+ /* other Arch, maybe add core cooldown code here, too. */
+ do {
+ } while (0);
+#endif
+}
+
+void udelay_init(void);
+unsigned long timing(const char *driver, const char *section, const char *name, const int defval, const char *unit);
+void ndelay(const unsigned long nsec);
+
+#define udelay(usec) ndelay(usec*1000)
+
+#endif
diff --git a/usbhub.conf b/usbhub.conf
new file mode 100644
index 0000000..0886953
--- /dev/null
+++ b/usbhub.conf
@@ -0,0 +1,94 @@
+# $Id: usbhub.conf 730 2007-01-14 13:50:28Z michael $
+# $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/usbhub.conf $
+
+Variables {
+ tick 50
+ netstep 0.5
+ diskstep 1.5
+}
+
+Display SitecomHUB {
+ Driver 'USBHUB'
+ Vendor '0x04b4'
+ Product '0x6560'
+}
+
+Display TyphoonHUB {
+ Driver 'USBHUB'
+ Vendor '0x0409'
+ Product '0x0058'
+}
+
+
+Widget GPO_Test300 {
+ class 'GPO'
+ expression 2+(1+test::onoff(1))/2
+ update 300
+}
+Widget GPO_Test400 {
+ class 'GPO'
+ expression 2+(1+test::onoff(2))/2
+ update 400
+}
+Widget GPO_Test500 {
+ class 'GPO'
+ expression 2+(1+test::onoff(3))/2
+ update 500
+}
+Widget GPO_Test600 {
+ class 'GPO'
+ expression 2+(1+test::onoff(4))/2
+ update 600
+}
+
+
+# Display network activity as pulse duration on the hub leds.
+# currently configured to
+#
+# 0 % pulse width : traffic < exp(10) == 22kbyte/sec
+# 50 % pulse width : traffic about exp(13.5) == 730kbyte/sec
+# 100 % pulse width : traffic > exp(16) == 8886kbyte/sec
+#
+# Which is quite suitable for a 100mbit network.
+
+Widget Net_RX {
+ class 'GPO'
+ expression (exp(10+test::bar(1,6,0,0.5)) < netdev('eth0', 'Rx_bytes', (6/netstep)*2*tick))?2:3
+ update tick
+}
+Widget Net_TX {
+ class 'GPO'
+ expression (exp(10+test::bar(2,6,0,0.5)) < netdev('eth0', 'Tx_bytes', (6/netstep)*2*tick))?2:3
+ update tick
+}
+
+# As above, but for disk read/writes, pwm for 0bytes/sec .. 33MB/sec (e^9 * 4096)
+Widget SDA_read {
+ class 'GPO'
+ expression (exp(test::bar(3,9,0,diskstep)) < diskstats('sda', 'read_sectors', (9/diskstep)*2*tick))?2:3
+ update tick
+}
+Widget SDA_write{
+ class 'GPO'
+ expression (exp(test::bar(4,9,0,diskstep)) < diskstats('sda', 'write_sectors', (9/diskstep)*2*tick))?2:3
+ update tick
+}
+
+Layout TestHUB {
+ GPO1 'GPO_Test300'
+ GPO2 'GPO_Test400'
+ GPO3 'GPO_Test500'
+ GPO4 'GPO_Test600'
+}
+
+Layout NetAndHDD {
+ GPO1 'Net_RX'
+ GPO2 'Net_TX'
+ GPO3 'SDA_read'
+ GPO4 'SDA_write'
+}
+
+#Display 'SitecomHUB'
+Display 'TyphoonHUB'
+#Layout 'TestHUB'
+Layout 'NetAndHDD'
diff --git a/widget.c b/widget.c
new file mode 100644
index 0000000..18aa8a6
--- /dev/null
+++ b/widget.c
@@ -0,0 +1,308 @@
+/* $Id: widget.c 996 2009-03-23 17:22:24Z volker $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/widget.c $
+ *
+ * generic widget handling
+ *
+ * Copyright (C) 2003, 2004 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ * exported functions:
+ *
+ * int widget_junk(void)
+ * does something
+ *
+ */
+
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+
+#include "debug.h"
+#include "cfg.h"
+#include "widget.h"
+
+#ifdef WITH_DMALLOC
+#include <dmalloc.h>
+#endif
+
+
+/* we use a static array of widgets and not realloc() */
+#define MAX_WIDGETS 256
+
+static WIDGET_CLASS *Classes = NULL;
+static int nClasses = 0;
+
+static WIDGET *Widgets = NULL;
+static int nWidgets = 0;
+
+static int widget_added = 0;
+
+int widget_register(WIDGET_CLASS * widget)
+{
+ int i;
+
+ /* sanity check: disallow widget registering after at least one */
+ /* widget has been added, because we use realloc here, and there may */
+ /* be pointers to the old memory area */
+ if (widget_added) {
+ error("internal error: register_widget(%s) after add_widget()", widget->name);
+ return -1;
+ }
+
+ for (i = 0; i < nClasses; i++) {
+ if (strcasecmp(widget->name, Classes[i].name) == 0) {
+ error("internal error: widget '%s' already exists!", widget->name);
+ return -1;
+ }
+ }
+
+ nClasses++;
+ Classes = realloc(Classes, nClasses * sizeof(WIDGET_CLASS));
+ Classes[nClasses - 1] = *widget;
+
+ return 0;
+}
+
+void widget_unregister(void)
+{
+ int i;
+ for (i = 0; i < nWidgets; i++) {
+ Widgets[i].class->quit(&(Widgets[i]));
+ if (Widgets[i].name)
+ free(Widgets[i].name);
+ }
+ free(Widgets);
+
+ free(Classes);
+
+ nWidgets = 0;
+ nClasses = 0;
+}
+
+int widget_color(const char *section, const char *name, const char *key, RGBA * C)
+{
+ char *color;
+
+ C->R = 0;
+ C->G = 0;
+ C->B = 0;
+ C->A = 0;
+
+ color = cfg_get(section, key, NULL);
+
+ if (color == NULL)
+ return 0;
+
+ if (*color == '\0') {
+ free(color);
+ return 0;
+ }
+
+ if (color2RGBA(color, C) < 0) {
+ error("widget '%s': ignoring illegal %s color '%s'", name, key, color);
+ free(color);
+ return 0;
+ }
+ free(color);
+ return 1;
+}
+
+int intersect(WIDGET * w1, WIDGET * w2)
+{
+ int x1w1, y1w1, x2w1, y2w1; /* 1st rectangle */
+ int x1w2, y1w2, x2w2, y2w2; /* 2nd rectangle */
+
+ if (w1->x2 == NOCOORD || w1->y2 == NOCOORD || w2->x2 == NOCOORD || w2->y2 == NOCOORD) {
+ /* w1 or w2 is no display widget: no intersection */
+ return 0;
+ }
+ x1w1 = MIN(w1->col, w1->x2);
+ x2w1 = MAX(w1->col, w1->x2);
+ y1w1 = MIN(w1->row, w1->y2);
+ y2w1 = MAX(w1->row, w1->y2);
+ x1w2 = MIN(w2->col, w2->x2);
+ x2w2 = MAX(w2->col, w2->x2);
+ y1w2 = MIN(w2->row, w2->y2);
+ y2w2 = MAX(w2->row, w2->y2);
+
+ if (x1w2 < x2w1 && x2w2 > x1w1 && y1w2 < y2w1 && y2w2 > y1w1) {
+ /* true: Intersection */
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
+int widget_add(const char *name, const int type, const int layer, const int row, const int col)
+{
+ int i;
+ char *section;
+ char *class;
+ int fg_valid, bg_valid;
+ RGBA FG, BG;
+
+ WIDGET_CLASS *Class;
+ WIDGET *Widget;
+ WIDGET *Parent;
+
+ /* prepare config section */
+ /* strlen("Widget:")=7 */
+ section = malloc(strlen(name) + 8);
+ strcpy(section, "Widget:");
+ strcat(section, name);
+
+ /* get widget class */
+ class = cfg_get(section, "class", NULL);
+ if (class == NULL || *class == '\0') {
+ error("error: widget '%s' has no class!", name);
+ if (class)
+ free(class);
+ free(section);
+ return -1;
+ }
+
+ /* get widget foreground color */
+ fg_valid = widget_color(section, name, "foreground", &FG);
+ bg_valid = widget_color(section, name, "background", &BG);
+
+ free(section);
+
+ /* lookup widget class */
+ Class = NULL;
+ for (i = 0; i < nClasses; i++) {
+ if (strcasecmp(class, Classes[i].name) == 0) {
+ Class = &(Classes[i]);
+ break;
+ }
+ }
+ if (i == nClasses) {
+ error("widget '%s': class '%s' not supported", name, class);
+ if (class)
+ free(class);
+ return -1;
+ }
+
+ /* check if widget type matches */
+ if (Class->type != type) {
+ error("widget '%s': class '%s' not applicable", name, class);
+ switch (Class->type) {
+ case WIDGET_TYPE_RC:
+ error(" Widgetclass %s is placed by Row/Column", class);
+ break;
+ case WIDGET_TYPE_XY:
+ error(" Widgetclass %s is placed by X/Y", class);
+ break;
+ case WIDGET_TYPE_GPO:
+ case WIDGET_TYPE_TIMER:
+ case WIDGET_TYPE_KEYPAD:
+ default:
+ error(" Widgetclass %s has unknown type %d", class, Class->type);
+ }
+ free(class);
+ return -1;
+ }
+
+ if (class)
+ free(class);
+
+
+ /* do NOT use realloc here because there may be pointers to the old */
+ /* memory area, which would point to nowhere if realloc moves the area */
+ if (Widgets == NULL) {
+ Widgets = malloc(MAX_WIDGETS * sizeof(WIDGET));
+ if (Widgets == NULL) {
+ error("internal error: allocation of widget buffer failed: %s", strerror(errno));
+ return -1;
+ }
+ }
+
+ /* another sanity check */
+ if (nWidgets >= MAX_WIDGETS) {
+ error("internal error: widget buffer full! Tried to allocate %d widgets (max: %d)", nWidgets, MAX_WIDGETS);
+ return -1;
+ }
+
+ /* look up parent widget (widget with the same name) */
+ Parent = NULL;
+ for (i = 0; i < nWidgets; i++) {
+ if (strcmp(name, Widgets[i].name) == 0) {
+ Parent = &(Widgets[i]);
+ break;
+ }
+ }
+
+ Widget = &(Widgets[nWidgets]);
+ nWidgets++;
+
+ Widget->name = strdup(name);
+ Widget->class = Class;
+ Widget->parent = Parent;
+ Widget->fg_color = FG;
+ Widget->bg_color = BG;
+ Widget->fg_valid = fg_valid;
+ Widget->bg_valid = bg_valid;
+ Widget->layer = layer;
+ Widget->row = row;
+ Widget->col = col;
+
+ if (Class->init != NULL) {
+ Class->init(Widget);
+ }
+
+ info(" widget '%s': Class '%s', Parent '%s', Layer %d, %s %d, %s %d (to %d,%d)",
+ name, (NULL == Class) ? "<none>" : Class->name,
+ (NULL == Parent) ? "<root>" : Parent->name,
+ layer, (WIDGET_TYPE_XY == Class->type) ? "Y" : "Row", row, (WIDGET_TYPE_XY == Class->type) ? "X" : "Col", col,
+ Widget->y2, Widget->x2);
+
+ /* sanity check: look for overlapping widgets */
+ for (i = 0; i < nWidgets - 1; i++) {
+ if (Widgets[i].layer == layer) {
+ if (intersect(&(Widgets[i]), Widget)) {
+ info("WARNING widget %s(%i,%i) intersects with %s(%i,%i) on layer %d",
+ Widgets[i].name, Widgets[i].row, Widgets[i].col, name, row, col, layer);
+ }
+ }
+ }
+
+ return 0;
+}
+
+/* return the found widget, or else NULL */
+WIDGET *widget_find(int type, void *needle)
+{
+ WIDGET *widget = NULL;
+ int i;
+
+ for (i = 0; i < nWidgets; i++) {
+ widget = &(Widgets[i]);
+ if (widget->class->type == type) {
+ if (widget->class->find != NULL && widget->class->find(widget, needle) == 0)
+ break;
+ }
+ widget = NULL;
+ }
+
+ return widget;
+}
diff --git a/widget.h b/widget.h
new file mode 100644
index 0000000..55c1967
--- /dev/null
+++ b/widget.h
@@ -0,0 +1,84 @@
+/* $Id: widget.h 996 2009-03-23 17:22:24Z volker $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/widget.h $
+ *
+ * generic widget handling
+ *
+ * Copyright (C) 2003, 2004 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+
+#ifndef _WIDGET_H_
+#define _WIDGET_H_
+
+#include "rgb.h"
+
+
+struct WIDGET; /* forward declaration */
+
+
+typedef struct WIDGET_CLASS {
+ char *name;
+ int type;
+ int (*init) (struct WIDGET * Self);
+ int (*draw) (struct WIDGET * Self);
+ int (*find) (struct WIDGET * Self, void *needle);
+ int (*quit) (struct WIDGET * Self);
+} WIDGET_CLASS;
+
+
+typedef struct WIDGET {
+ char *name;
+ WIDGET_CLASS *class;
+ struct WIDGET *parent;
+ RGBA fg_color;
+ RGBA bg_color;
+ int fg_valid;
+ int bg_valid;
+ int layer;
+ int row;
+ int col;
+ void *data;
+ int x2; /* x of opposite corner, -1 for no display widget */
+ int y2; /* y of opposite corner, -1 for no display widget */
+} WIDGET;
+
+
+#define WIDGET_TYPE_RC 1
+#define WIDGET_TYPE_XY 2
+#define WIDGET_TYPE_GPO 3
+#define WIDGET_TYPE_TIMER 4
+#define WIDGET_TYPE_KEYPAD 5
+
+
+int widget_register(WIDGET_CLASS * widget);
+void widget_unregister(void);
+int intersect(WIDGET * w1, WIDGET * w2);
+int widget_add(const char *name, const int type, const int layer, const int row, const int col);
+WIDGET *widget_find(int type, void *needle);
+int widget_color(const char *section, const char *name, const char *key, RGBA * C);
+
+#undef MIN
+#define MIN(a,b) ((a) < (b) ? (a) : (b))
+#undef MAX
+#define MAX(a,b) ((a) > (b) ? (a) : (b))
+#define NOCOORD (-1)
+
+#endif
diff --git a/widget_bar.c b/widget_bar.c
new file mode 100644
index 0000000..3399a04
--- /dev/null
+++ b/widget_bar.c
@@ -0,0 +1,240 @@
+/* $Id: widget_bar.c 1106 2010-02-07 14:03:46Z mzuther $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/widget_bar.c $
+ *
+ * bar widget handling
+ *
+ * Copyright (C) 2003, 2004 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ * exported functions:
+ *
+ * WIDGET_CLASS Widget_Bar
+ * the bar widget
+ *
+ */
+
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+
+#include "debug.h"
+#include "cfg.h"
+#include "property.h"
+#include "timer_group.h"
+#include "widget.h"
+#include "widget_bar.h"
+
+#ifdef WITH_DMALLOC
+#include <dmalloc.h>
+#endif
+
+
+void widget_bar_update(void *Self)
+{
+ WIDGET *W = (WIDGET *) Self;
+ WIDGET_BAR *Bar = W->data;
+
+ double val1, val2;
+ double min, max;
+
+ /* evaluate properties */
+ property_eval(&Bar->expression1);
+ val1 = P2N(&Bar->expression1);
+
+ if (property_valid(&Bar->expression2)) {
+ property_eval(&Bar->expression2);
+ val2 = P2N(&Bar->expression2);
+ } else {
+ val2 = val1;
+ }
+
+ /* minimum: if expression is empty, do auto-scaling */
+ if (property_valid(&Bar->expr_min)) {
+ property_eval(&Bar->expr_min);
+ min = P2N(&Bar->expr_min);
+ } else {
+ min = Bar->min;
+ if (val1 < min) {
+ min = val1;
+ }
+ if (val2 < min) {
+ min = val2;
+ }
+ }
+
+ /* maximum: if expression is empty, do auto-scaling */
+ if (property_valid(&Bar->expr_max)) {
+ property_eval(&Bar->expr_max);
+ max = P2N(&Bar->expr_max);
+ } else {
+ max = Bar->max;
+ if (val1 > max) {
+ max = val1;
+ }
+ if (val2 > max) {
+ max = val2;
+ }
+ }
+
+ /* debugging */
+ if (Bar->min != min || Bar->max != max) {
+ debug("Bar '%s': new scale %G - %G", W->name, min, max);
+ }
+
+ /* calculate bar values */
+ Bar->min = min;
+ Bar->max = max;
+ if (max > min) {
+ Bar->val1 = (val1 - min) / (max - min);
+ Bar->val2 = (val2 - min) / (max - min);
+ } else {
+ Bar->val1 = 0.0;
+ Bar->val2 = 0.0;
+ }
+
+ /* finally, draw it! */
+ if (W->class->draw)
+ W->class->draw(W);
+
+}
+
+
+int widget_bar_init(WIDGET * Self)
+{
+ char *section;
+ char *c;
+ WIDGET_BAR *Bar;
+
+ /* prepare config section */
+ /* strlen("Widget:")=7 */
+ section = malloc(strlen(Self->name) + 8);
+ strcpy(section, "Widget:");
+ strcat(section, Self->name);
+
+ Bar = malloc(sizeof(WIDGET_BAR));
+ memset(Bar, 0, sizeof(WIDGET_BAR));
+
+ /* load properties */
+ property_load(section, "expression", NULL, &Bar->expression1);
+ property_load(section, "expression2", NULL, &Bar->expression2);
+ property_load(section, "min", NULL, &Bar->expr_min);
+ property_load(section, "max", NULL, &Bar->expr_max);
+
+ /* sanity checks */
+ if (!property_valid(&Bar->expression1)) {
+ error("Warning: widget %s has no expression", section);
+ }
+
+ /* bar length, default 1 */
+ cfg_number(section, "length", 1, 0, -1, &(Bar->length));
+
+ /* direction: East (default), West, North, South */
+ c = cfg_get(section, "direction", "E");
+ switch (toupper(*c)) {
+ case 'E':
+ Bar->direction = DIR_EAST;
+ Self->x2 = Self->col + Bar->length - 1;
+ Self->y2 = Self->row;
+ break;
+ case 'W':
+ Bar->direction = DIR_WEST;
+ Self->x2 = Self->col + Bar->length - 1;
+ Self->y2 = Self->row;
+ break;
+ case 'N':
+ Bar->direction = DIR_NORTH;
+ Self->x2 = Self->col;
+ Self->y2 = Self->row + Bar->length - 1;
+ break;
+ case 'S':
+ Bar->direction = DIR_SOUTH;
+ Self->x2 = Self->col;
+ Self->y2 = Self->row + Bar->length - 1;
+ break;
+ default:
+ error("widget %s has unknown direction '%s'; known directions: 'E', 'W', 'N', 'S'; using 'E(ast)'", Self->name,
+ c);
+ Bar->direction = DIR_EAST;
+ }
+ free(c);
+
+ /* style: none (default), hollow */
+ c = cfg_get(section, "style", "0");
+ switch (toupper(*c)) {
+ case 'H':
+ Bar->style = STYLE_HOLLOW;
+ break;
+ case '0':
+ Bar->style = 0;
+ break;
+ default:
+ error("widget %s has unknown style '%s'; known styles: '0' or 'H'; using '0'", Self->name, c);
+ Bar->style = 0;
+ }
+ free(c);
+
+ /* update interval (msec), default 1 sec */
+ cfg_number(section, "update", 1000, 10, -1, &(Bar->update));
+
+ /* get widget special colors */
+ Bar->color_valid[0] = widget_color(section, Self->name, "barcolor0", &Bar->color[0]);
+ Bar->color_valid[1] = widget_color(section, Self->name, "barcolor1", &Bar->color[1]);
+
+ free(section);
+ Self->data = Bar;
+
+ timer_add_widget(widget_bar_update, Self, Bar->update, 0);
+
+ return 0;
+}
+
+
+int widget_bar_quit(WIDGET * Self)
+{
+ if (Self) {
+ if (Self->data) {
+ WIDGET_BAR *Bar = Self->data;
+ property_free(&Bar->expression1);
+ property_free(&Bar->expression2);
+ property_free(&Bar->expr_min);
+ property_free(&Bar->expr_max);
+ free(Self->data);
+ }
+ Self->data = NULL;
+ }
+
+
+ return 0;
+
+}
+
+
+
+WIDGET_CLASS Widget_Bar = {
+ .name = "bar",
+ .type = WIDGET_TYPE_RC,
+ .init = widget_bar_init,
+ .draw = NULL,
+ .quit = widget_bar_quit,
+};
diff --git a/widget_bar.h b/widget_bar.h
new file mode 100644
index 0000000..ba8a55f
--- /dev/null
+++ b/widget_bar.h
@@ -0,0 +1,58 @@
+/* $Id: widget_bar.h 1164 2011-12-22 10:48:01Z mjona $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/widget_bar.h $
+ *
+ * bar widget handling
+ *
+ * Copyright (C) 2003, 2004 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+
+#ifndef _WIDGET_BAR_H_
+#define _WIDGET_BAR_H_
+
+#include "property.h"
+#include "widget.h"
+#include "rgb.h"
+
+typedef enum { DIR_EAST = 1, DIR_WEST = 2, DIR_NORTH = 4, DIR_SOUTH = 8 } DIRECTION;
+typedef enum { STYLE_HOLLOW = 1, STYLE_FIRST = 2, STYLE_LAST = 4 } STYLE;
+
+typedef struct WIDGET_BAR {
+ PROPERTY expression1; /* value (length) of upper half */
+ PROPERTY expression2; /* value (length) of lower half */
+ PROPERTY expr_min; /* explicit minimum value */
+ PROPERTY expr_max; /* explicit maximum value */
+ DIRECTION direction; /* bar direction */
+ STYLE style; /* bar style (hollow) */
+ int length; /* bar length */
+ int update; /* update interval (msec) */
+ double val1; /* bar value, 0.0 ... 1.0 */
+ double val2; /* bar value, 0.0 ... 1.0 */
+ double min; /* minimum value */
+ double max; /* maximum value */
+ RGBA color[2]; /* bar colors */
+ int color_valid[2]; /* bar color is valid */
+} WIDGET_BAR;
+
+
+extern WIDGET_CLASS Widget_Bar;
+
+#endif
diff --git a/widget_gpo.c b/widget_gpo.c
new file mode 100644
index 0000000..2b56f32
--- /dev/null
+++ b/widget_gpo.c
@@ -0,0 +1,130 @@
+/* $Id: widget_gpo.c 1106 2010-02-07 14:03:46Z mzuther $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/widget_gpo.c $
+ *
+ * GPO widget handling
+ *
+ * Copyright (C) 2005 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2005, 2006, 2007 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ * exported functions:
+ *
+ * WIDGET_CLASS Widget_GPO
+ * the GPO widget
+ *
+ */
+
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+
+#include "debug.h"
+#include "cfg.h"
+#include "property.h"
+#include "timer_group.h"
+#include "widget.h"
+#include "widget_gpo.h"
+
+#ifdef WITH_DMALLOC
+#include <dmalloc.h>
+#endif
+
+
+void widget_gpo_update(void *Self)
+{
+ WIDGET *W = (WIDGET *) Self;
+ WIDGET_GPO *GPO = W->data;
+
+ /* evaluate properties */
+ property_eval(&GPO->expression);
+ property_eval(&GPO->update);
+
+ /* finally, draw it! */
+ if (W->class->draw)
+ W->class->draw(W);
+
+ /* add a new one-shot timer */
+ if (P2N(&GPO->update) > 0) {
+ timer_add_widget(widget_gpo_update, Self, P2N(&GPO->update), 1);
+ }
+
+}
+
+
+int widget_gpo_init(WIDGET * Self)
+{
+ char *section;
+ WIDGET_GPO *GPO;
+
+ /* prepare config section */
+ /* strlen("Widget:")=7 */
+ section = malloc(strlen(Self->name) + 8);
+ strcpy(section, "Widget:");
+ strcat(section, Self->name);
+
+ GPO = malloc(sizeof(WIDGET_GPO));
+ memset(GPO, 0, sizeof(WIDGET_GPO));
+
+ /* load properties */
+ property_load(section, "expression", NULL, &GPO->expression);
+ property_load(section, "update", "1000", &GPO->update);
+
+ /* sanity checks */
+ if (!property_valid(&GPO->expression)) {
+ error("Warning: widget %s has no expression", section);
+ }
+
+ free(section);
+ Self->data = GPO;
+ /* no display dimension */
+ Self->x2 = NOCOORD;
+ Self->y2 = NOCOORD;
+
+ /* fire it the first time */
+ widget_gpo_update(Self);
+
+ return 0;
+}
+
+
+int widget_gpo_quit(WIDGET * Self)
+{
+ if (Self && Self->data) {
+ WIDGET_GPO *GPO = Self->data;
+ property_free(&GPO->expression);
+ property_free(&GPO->update);
+ free(Self->data);
+ Self->data = NULL;
+ }
+ return 0;
+}
+
+
+
+WIDGET_CLASS Widget_GPO = {
+ .name = "gpo",
+ .type = WIDGET_TYPE_GPO,
+ .init = widget_gpo_init,
+ .draw = NULL,
+ .quit = widget_gpo_quit,
+};
diff --git a/widget_gpo.h b/widget_gpo.h
new file mode 100644
index 0000000..df5eba3
--- /dev/null
+++ b/widget_gpo.h
@@ -0,0 +1,42 @@
+/* $Id: widget_gpo.h 1164 2011-12-22 10:48:01Z mjona $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/widget_gpo.h $
+ *
+ * GPO widget handling
+ *
+ * Copyright (C) 2005 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2005, 2006, 2007 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+
+#ifndef _WIDGET_GPO_H_
+#define _WIDGET_GPO_H_
+
+#include "property.h"
+#include "widget.h"
+
+typedef struct WIDGET_GPO {
+ PROPERTY expression; /* main GPO expression */
+ PROPERTY update; /* update interval (msec) */
+} WIDGET_GPO;
+
+
+extern WIDGET_CLASS Widget_GPO;
+
+#endif
diff --git a/widget_icon.c b/widget_icon.c
new file mode 100644
index 0000000..152343b
--- /dev/null
+++ b/widget_icon.c
@@ -0,0 +1,212 @@
+/* $Id: widget_icon.c 1106 2010-02-07 14:03:46Z mzuther $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/widget_icon.c $
+ *
+ * icon widget handling
+ *
+ * Copyright (C) 2003, 2004 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ * exported functions:
+ *
+ * WIDGET_CLASS Widget_Icon
+ * the icon widget
+ *
+ */
+
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+
+#include "debug.h"
+#include "cfg.h"
+#include "qprintf.h"
+#include "property.h"
+#include "timer_group.h"
+#include "widget.h"
+#include "widget_icon.h"
+
+#ifdef WITH_DMALLOC
+#include <dmalloc.h>
+#endif
+
+/* icons size is same as char size */
+extern int XRES, YRES;
+
+static void widget_icon_read_bitmap(const char *section, WIDGET_ICON * Icon)
+{
+ int row, n;
+ char key[15];
+ char *val, *v;
+ unsigned char *map;
+
+ for (row = 0; row < YRES; row++) {
+ qprintf(key, sizeof(key), "Bitmap.Row%d", row + 1);
+ val = cfg_get(section, key, "");
+ map = Icon->bitmap + row;
+ n = 0;
+ for (v = val; *v != '\0'; v++) {
+ if (n >= Icon->maxmap) {
+ Icon->maxmap++;
+ Icon->bitmap = realloc(Icon->bitmap, Icon->maxmap * YRES * sizeof(char));
+ memset(Icon->bitmap + n * YRES, 0, YRES * sizeof(char));
+ map = Icon->bitmap + n * YRES + row;
+ }
+ switch (*v) {
+ case '|':
+ n++;
+ map += YRES;
+ break;
+ case '*':
+ (*map) <<= 1;
+ (*map) |= 1;
+ break;
+ default:
+ (*map) <<= 1;
+ }
+ }
+ free(val);
+ }
+}
+
+
+void widget_icon_update(void *Self)
+{
+ WIDGET *W = (WIDGET *) Self;
+ WIDGET_ICON *Icon = W->data;
+
+ /* process the parent only */
+ if (W->parent == NULL) {
+
+ /* evaluate properties */
+ property_eval(&Icon->speed);
+ property_eval(&Icon->visible);
+ property_eval(&Icon->frame);
+
+ int frame = P2N(&Icon->frame);
+ if ((frame >= 0) && (frame <= Icon->maxmap)) {
+ /* select icon bitmap by evaluated frame number */
+ Icon->curmap = frame;
+ } else {
+ /* rotate icon bitmap */
+ Icon->curmap++;
+ if (Icon->curmap >= Icon->maxmap)
+ Icon->curmap = 0;
+ }
+ }
+
+ /* finally, draw it! */
+ if (W->class->draw)
+ W->class->draw(W);
+
+ /* add a new one-shot timer */
+ if (P2N(&Icon->speed) > 0) {
+ timer_add_widget(widget_icon_update, Self, P2N(&Icon->speed), 1);
+ }
+}
+
+
+
+int widget_icon_init(WIDGET * Self)
+{
+ char *section;
+ WIDGET_ICON *Icon;
+
+ /* re-use the parent if one exists */
+ if (Self->parent == NULL) {
+
+ /* prepare config section */
+ /* strlen("Widget:")=7 */
+ section = malloc(strlen(Self->name) + 8);
+ strcpy(section, "Widget:");
+ strcat(section, Self->name);
+
+ Icon = malloc(sizeof(WIDGET_ICON));
+ memset(Icon, 0, sizeof(WIDGET_ICON));
+
+ /* load properties */
+ property_load(section, "speed", "100", &Icon->speed);
+ property_load(section, "visible", "1", &Icon->visible);
+ property_load(section, "frame", "-1", &Icon->frame);
+
+ /* read bitmap */
+ widget_icon_read_bitmap(section, Icon);
+
+ free(section);
+ Self->data = Icon;
+ Self->x2 = Self->col + 1;
+ Self->y2 = Self->row + 1;
+
+ /* as the speed is evaluatod on every call, we use 'one-shot'-timers. */
+ /* The timer will be reactivated on every call to widget_icon_update(). */
+ /* We do the initial call here... */
+ Icon->prvmap = -1;
+
+ /* reset ascii */
+ Icon->ascii = -1;
+
+ } else {
+
+ /* re-use the parent */
+ Self->data = Self->parent->data;
+
+ }
+
+ /* just do it! */
+ widget_icon_update(Self);
+
+ return 0;
+}
+
+
+int widget_icon_quit(WIDGET * Self)
+{
+ if (Self) {
+ /* do not deallocate child widget! */
+ if (Self->parent == NULL) {
+ if (Self->data) {
+ WIDGET_ICON *Icon = Self->data;
+ property_free(&Icon->speed);
+ property_free(&Icon->visible);
+ property_free(&Icon->frame);
+ if (Icon->bitmap)
+ free(Icon->bitmap);
+ free(Self->data);
+ Self->data = NULL;
+ }
+ }
+ }
+
+ return 0;
+
+}
+
+
+
+WIDGET_CLASS Widget_Icon = {
+ .name = "icon",
+ .type = WIDGET_TYPE_RC,
+ .init = widget_icon_init,
+ .draw = NULL,
+ .quit = widget_icon_quit,
+};
diff --git a/widget_icon.h b/widget_icon.h
new file mode 100644
index 0000000..31c2378
--- /dev/null
+++ b/widget_icon.h
@@ -0,0 +1,48 @@
+/* $Id: widget_icon.h 1164 2011-12-22 10:48:01Z mjona $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/widget_icon.h $
+ *
+ * icon widget handling
+ *
+ * Copyright (C) 2003, 2004 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+
+#ifndef _WIDGET_ICON_H_
+#define _WIDGET_ICON_H_
+
+#include "property.h"
+#include "widget.h"
+
+typedef struct WIDGET_ICON {
+ PROPERTY speed; /* update interval (msec) */
+ PROPERTY visible; /* icon visible? */
+ PROPERTY frame; /* evaluated expression of frame number (optional) */
+ int ascii; /* ascii code of icon (depends on the driver) */
+ int curmap; /* current bitmap sequence */
+ int prvmap; /* previous bitmap sequence */
+ int maxmap; /* number of bitmap sequences */
+ unsigned char *bitmap; /* bitmaps of (animated) icon */
+} WIDGET_ICON;
+
+
+extern WIDGET_CLASS Widget_Icon;
+
+#endif
diff --git a/widget_image.c b/widget_image.c
new file mode 100644
index 0000000..ef095c6
--- /dev/null
+++ b/widget_image.c
@@ -0,0 +1,292 @@
+/* $Id: widget_image.c 1106 2010-02-07 14:03:46Z mzuther $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/widget_image.c $
+ *
+ * image widget handling
+ *
+ * Copyright (C) 2006 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2006 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ * exported functions:
+ *
+ * WIDGET_CLASS Widget_Image
+ * the image widget
+ *
+ */
+
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+#include <errno.h>
+
+#ifdef HAVE_GD_GD_H
+#include <gd/gd.h>
+#else
+#ifdef HAVE_GD_H
+#include <gd.h>
+#else
+#error "gd.h not found!"
+#error "cannot compile image widget"
+#endif
+#endif
+
+#if GD2_VERS != 2
+#error "lcd4linux requires libgd version 2"
+#error "cannot compile image widget"
+#endif
+
+#include "debug.h"
+#include "cfg.h"
+#include "qprintf.h"
+#include "property.h"
+#include "timer_group.h"
+#include "widget.h"
+#include "widget_image.h"
+#include "rgb.h"
+
+#ifdef WITH_DMALLOC
+#include <dmalloc.h>
+#endif
+
+
+static void widget_image_render(const char *Name, WIDGET_IMAGE * Image)
+{
+ int x, y;
+ int inverted;
+ gdImagePtr gdImage;
+
+ /* clear bitmap */
+ if (Image->bitmap) {
+ int i;
+ for (i = 0; i < Image->height * Image->width; i++) {
+ RGBA empty = {.R = 0x00,.G = 0x00,.B = 0x00,.A = 0x00 };
+ Image->bitmap[i] = empty;
+ }
+ }
+
+ /* reload image only on first call or on explicit reload request */
+ if (Image->gdImage == NULL || P2N(&Image->reload)) {
+
+ char *file;
+ FILE *fd;
+
+ /* free previous image */
+ if (Image->gdImage) {
+ gdImageDestroy(Image->gdImage);
+ Image->gdImage = NULL;
+ }
+
+ file = P2S(&Image->file);
+ if (file == NULL || file[0] == '\0') {
+ error("Warning: Image %s has no file", Name);
+ return;
+ }
+
+ fd = fopen(file, "rb");
+ if (fd == NULL) {
+ error("Warning: Image %s: fopen(%s) failed: %s", Name, file, strerror(errno));
+ return;
+ }
+
+ Image->gdImage = gdImageCreateFromPng(fd);
+ fclose(fd);
+
+ if (Image->gdImage == NULL) {
+ error("Warning: Image %s: CreateFromPng(%s) failed!", Name, file);
+ return;
+ }
+
+ }
+
+ /* maybe resize bitmap */
+ gdImage = Image->gdImage;
+ if (gdImage->sx > Image->width) {
+ Image->width = gdImage->sx;
+ free(Image->bitmap);
+ Image->bitmap = NULL;
+ }
+ if (gdImage->sy > Image->height) {
+ Image->height = gdImage->sy;
+ free(Image->bitmap);
+ Image->bitmap = NULL;
+ }
+ if (Image->bitmap == NULL && Image->width > 0 && Image->height > 0) {
+ int i = Image->width * Image->height * sizeof(Image->bitmap[0]);
+ Image->bitmap = malloc(i);
+ if (Image->bitmap == NULL) {
+ error("Warning: Image %s: malloc(%d) failed: %s", Name, i, strerror(errno));
+ return;
+ }
+ for (i = 0; i < Image->height * Image->width; i++) {
+ RGBA empty = {.R = 0x00,.G = 0x00,.B = 0x00,.A = 0x00 };
+ Image->bitmap[i] = empty;
+ }
+ }
+
+
+ /* finally really render it */
+ inverted = P2N(&Image->inverted);
+ if (P2N(&Image->visible)) {
+ for (x = 0; x < gdImage->sx; x++) {
+ for (y = 0; y < gdImage->sy; y++) {
+ int p = gdImageGetTrueColorPixel(gdImage, x, y);
+ int a = gdTrueColorGetAlpha(p);
+ int i = y * Image->width + x;
+ Image->bitmap[i].R = gdTrueColorGetRed(p);
+ Image->bitmap[i].G = gdTrueColorGetGreen(p);
+ Image->bitmap[i].B = gdTrueColorGetBlue(p);
+ /* GD's alpha is 0 (opaque) to 127 (tranparanet) */
+ /* our alpha is 0 (transparent) to 255 (opaque) */
+ Image->bitmap[i].A = (a == 127) ? 0 : 255 - 2 * a;
+ if (inverted) {
+ Image->bitmap[i].R = 255 - Image->bitmap[i].R;
+ Image->bitmap[i].G = 255 - Image->bitmap[i].G;
+ Image->bitmap[i].B = 255 - Image->bitmap[i].B;
+ }
+ }
+ }
+ }
+}
+
+
+static void widget_image_update(void *Self)
+{
+ WIDGET *W = (WIDGET *) Self;
+ WIDGET_IMAGE *Image = W->data;
+
+ /* process the parent only */
+ if (W->parent == NULL) {
+
+ /* evaluate properties */
+ property_eval(&Image->file);
+ property_eval(&Image->update);
+ property_eval(&Image->reload);
+ property_eval(&Image->visible);
+ property_eval(&Image->inverted);
+
+ /* render image into bitmap */
+ widget_image_render(W->name, Image);
+
+ }
+
+ /* finally, draw it! */
+ if (W->class->draw)
+ W->class->draw(W);
+
+ /* add a new one-shot timer */
+ if (P2N(&Image->update) > 0) {
+ timer_add_widget(widget_image_update, Self, P2N(&Image->update), 1);
+ }
+}
+
+
+
+int widget_image_init(WIDGET * Self)
+{
+ char *section;
+ WIDGET_IMAGE *Image;
+
+ /* re-use the parent if one exists */
+ if (Self->parent == NULL) {
+
+ /* prepare config section */
+ /* strlen("Widget:")=7 */
+ section = malloc(strlen(Self->name) + 8);
+ strcpy(section, "Widget:");
+ strcat(section, Self->name);
+
+ Image = malloc(sizeof(WIDGET_IMAGE));
+ memset(Image, 0, sizeof(WIDGET_IMAGE));
+
+ /* initial size */
+ Image->width = 0;
+ Image->height = 0;
+ Image->bitmap = NULL;
+
+ /* load properties */
+ property_load(section, "file", NULL, &Image->file);
+ property_load(section, "update", "100", &Image->update);
+ property_load(section, "reload", "0", &Image->reload);
+ property_load(section, "visible", "1", &Image->visible);
+ property_load(section, "inverted", "0", &Image->inverted);
+
+ /* sanity checks */
+ if (!property_valid(&Image->file)) {
+ error("Warning: widget %s has no file", section);
+ }
+
+ free(section);
+ Self->data = Image;
+ Self->x2 = Self->col + Image->width;
+ Self->y2 = Self->row + Image->height;
+
+ } else {
+
+ /* re-use the parent */
+ Self->data = Self->parent->data;
+
+ }
+
+ /* just do it! */
+ widget_image_update(Self);
+
+ return 0;
+}
+
+
+int widget_image_quit(WIDGET * Self)
+{
+ if (Self) {
+ /* do not deallocate child widget! */
+ if (Self->parent == NULL) {
+ if (Self->data) {
+ WIDGET_IMAGE *Image = Self->data;
+ if (Image->gdImage) {
+ gdImageDestroy(Image->gdImage);
+ Image->gdImage = NULL;
+ }
+ free(Image->bitmap);
+ property_free(&Image->file);
+ property_free(&Image->update);
+ property_free(&Image->reload);
+ property_free(&Image->visible);
+ property_free(&Image->inverted);
+ free(Self->data);
+ Self->data = NULL;
+ }
+ }
+ }
+
+ return 0;
+
+}
+
+
+
+WIDGET_CLASS Widget_Image = {
+ .name = "image",
+ .type = WIDGET_TYPE_XY,
+ .init = widget_image_init,
+ .draw = NULL,
+ .quit = widget_image_quit,
+};
diff --git a/widget_image.h b/widget_image.h
new file mode 100644
index 0000000..1e9d0b5
--- /dev/null
+++ b/widget_image.h
@@ -0,0 +1,48 @@
+/* $Id: widget_image.h 1164 2011-12-22 10:48:01Z mjona $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/widget_image.h $
+ *
+ * image widget handling
+ *
+ * Copyright (C) 2006 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2006 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+
+#ifndef _WIDGET_IMAGE_H_
+#define _WIDGET_IMAGE_H_
+
+#include "property.h"
+#include "widget.h"
+#include "rgb.h"
+
+typedef struct WIDGET_IMAGE {
+ void *gdImage; /* raw gd image */
+ RGBA *bitmap; /* image bitmap */
+ int width, height; /* size of the image */
+ PROPERTY file; /* image filename */
+ PROPERTY update; /* update interval */
+ PROPERTY reload; /* reload image on update? */
+ PROPERTY visible; /* image visible? */
+ PROPERTY inverted; /* image inverted? */
+} WIDGET_IMAGE;
+
+extern WIDGET_CLASS Widget_Image;
+
+#endif
diff --git a/widget_keypad.c b/widget_keypad.c
new file mode 100644
index 0000000..35df70a
--- /dev/null
+++ b/widget_keypad.c
@@ -0,0 +1,146 @@
+/* $Id: widget_keypad.c 996 2009-03-23 17:22:24Z volker $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/widget_keypad.c $
+ *
+ * keypad widget handling
+ *
+ * Copyright (C) 2006 Chris Maj <cmaj@freedomcorpse.com>
+ * Copyright (C) 2006 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ * exported functions:
+ *
+ * WIDGET_CLASS Widget_Keypad
+ * the keypad widget
+ *
+ */
+
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+
+#include "debug.h"
+#include "cfg.h"
+#include "property.h"
+#include "timer.h"
+#include "widget.h"
+#include "widget_keypad.h"
+
+#ifdef WITH_DMALLOC
+#include <dmalloc.h>
+#endif
+
+
+int widget_keypad_draw(WIDGET * Self)
+{
+ WIDGET_KEYPAD *keypad = Self->data;
+
+ /* evaluate properties */
+ property_eval(&keypad->expression);
+
+ return P2N(&keypad->expression);
+}
+
+
+int widget_keypad_init(WIDGET * Self)
+{
+ char *section;
+ char *c;
+ WIDGET_KEYPAD *keypad;
+
+ /* prepare config section */
+ /* strlen("Widget:")=7 */
+ section = malloc(strlen(Self->name) + 8);
+ strcpy(section, "Widget:");
+ strcat(section, Self->name);
+
+ keypad = malloc(sizeof(WIDGET_KEYPAD));
+ memset(keypad, 0, sizeof(WIDGET_KEYPAD));
+
+ /* load properties */
+ property_load(section, "expression", NULL, &keypad->expression);
+
+ /* state: pressed (default), released */
+ c = cfg_get(section, "state", "pressed");
+ if (!strcasecmp(c, "released"))
+ keypad->key = WIDGET_KEY_RELEASED;
+ else
+ keypad->key = WIDGET_KEY_PRESSED;
+
+ /* position: confirm (default), up, down, left, right, cancel */
+ c = cfg_get(section, "position", "confirm");
+ if (!strcasecmp(c, "up"))
+ keypad->key += WIDGET_KEY_UP;
+ else if (!strcasecmp(c, "down"))
+ keypad->key += WIDGET_KEY_DOWN;
+ else if (!strcasecmp(c, "left"))
+ keypad->key += WIDGET_KEY_LEFT;
+ else if (!strcasecmp(c, "right"))
+ keypad->key += WIDGET_KEY_RIGHT;
+ else if (!strcasecmp(c, "cancel"))
+ keypad->key += WIDGET_KEY_CANCEL;
+ else
+ keypad->key += WIDGET_KEY_CONFIRM;
+
+ free(section);
+ Self->data = keypad;
+ Self->x2 = NOCOORD;
+ Self->y2 = NOCOORD;
+
+ return 0;
+}
+
+int widget_keypad_find(WIDGET * Self, void *needle)
+{
+ WIDGET_KEYPAD *keypad;
+ KEYPADKEY key = *(KEYPADKEY *) needle;
+
+ if (Self && Self->data) {
+ keypad = Self->data;
+ if (keypad->key == key)
+ return 0;
+ }
+
+ return -1;
+}
+
+int widget_keypad_quit(WIDGET * Self)
+{
+ if (Self && Self->data) {
+ WIDGET_KEYPAD *keypad = Self->data;
+ property_free(&keypad->expression);
+ free(Self->data);
+ Self->data = NULL;
+ }
+ return 0;
+}
+
+
+
+WIDGET_CLASS Widget_Keypad = {
+ .name = "keypad",
+ .type = WIDGET_TYPE_KEYPAD,
+ .init = widget_keypad_init,
+ .draw = widget_keypad_draw,
+ .find = widget_keypad_find,
+ .quit = widget_keypad_quit,
+};
diff --git a/widget_keypad.h b/widget_keypad.h
new file mode 100644
index 0000000..d0ed1ca
--- /dev/null
+++ b/widget_keypad.h
@@ -0,0 +1,53 @@
+/* $Id: widget_keypad.h 1164 2011-12-22 10:48:01Z mjona $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/widget_keypad.h $
+ *
+ * keypad widget handling
+ *
+ * Copyright (C) 2006 Chris Maj <cmaj@freedomcorpse.com>
+ * Copyright (C) 2006 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+
+#ifndef _WIDGET_KEYPAD_H_
+#define _WIDGET_KEYPAD_H_
+
+#include "property.h"
+#include "widget.h"
+
+typedef enum {
+ WIDGET_KEY_UP = 1,
+ WIDGET_KEY_DOWN = 2,
+ WIDGET_KEY_LEFT = 4,
+ WIDGET_KEY_RIGHT = 8,
+ WIDGET_KEY_CONFIRM = 16,
+ WIDGET_KEY_CANCEL = 32,
+ WIDGET_KEY_PRESSED = 64,
+ WIDGET_KEY_RELEASED = 128
+} KEYPADKEY;
+
+typedef struct WIDGET_KEYPAD {
+ PROPERTY expression; /* expression that delivers the value */
+ KEYPADKEY key; /* which key */
+} WIDGET_KEYPAD;
+
+
+extern WIDGET_CLASS Widget_Keypad;
+
+#endif
diff --git a/widget_text.c b/widget_text.c
new file mode 100644
index 0000000..0f9a19b
--- /dev/null
+++ b/widget_text.c
@@ -0,0 +1,451 @@
+/* $Id: widget_text.c 1199 2013-05-23 03:07:28Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/widget_text.c $
+ *
+ * simple text widget handling
+ *
+ * Copyright (C) 2003, 2004 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ * Copyright (C) 2008 Michael Vogt <michu@neophob.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ * exported functions:
+ *
+ * WIDGET_CLASS Widget_Text
+ * a simple text widget which
+ * must be supported by all displays
+ *
+ */
+
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+
+#include "debug.h"
+#include "cfg.h"
+#include "evaluator.h"
+#include "property.h"
+#include "timer.h"
+#include "timer_group.h"
+#include "event.h"
+#include "widget.h"
+#include "widget_text.h"
+
+#ifdef WITH_DMALLOC
+#include <dmalloc.h>
+#endif
+
+
+void widget_text_scroll(void *Self)
+{
+ WIDGET *W = (WIDGET *) Self;
+ if (NULL == W || NULL == W->data) {
+ error("Warning: internal data error in Textwidget");
+ return;
+ }
+ WIDGET_TEXT *T = W->data;
+
+ char *prefix = P2S(&T->prefix);
+ char *postfix = P2S(&T->postfix);
+
+ char *string = T->string;
+
+ int num, len, width, pad;
+ char *src, *dst;
+
+ if (NULL == string) {
+ error("Warning: Widget %s has no string", W->name);
+ return;
+ }
+ num = 0;
+ len = strlen(string);
+ width = T->width - strlen(prefix) - strlen(postfix);
+ if (width < 0)
+ width = 0;
+
+ switch (T->align) {
+ case ALIGN_LEFT:
+ pad = 0;
+ break;
+ case ALIGN_CENTER:
+ pad = (width - len) / 2;
+ if (pad < 0)
+ pad = 0;
+ break;
+ case ALIGN_RIGHT:
+ pad = width - len;
+ if (pad < 0)
+ pad = 0;
+ break;
+ case ALIGN_AUTOMATIC:
+ if (len <= width) {
+ pad = 0;
+ break;
+ }
+ case ALIGN_MARQUEE:
+ pad = width - T->scroll;
+ T->scroll++;
+ if (T->scroll >= width + len)
+ T->scroll = 0;
+ break;
+ case ALIGN_PINGPONG_LEFT:
+ case ALIGN_PINGPONG_CENTER:
+ case ALIGN_PINGPONG_RIGHT:
+#define PINGPONGWAIT 2
+
+ /* scrolling is not necessary - align the string */
+ if (len <= width) {
+ switch (T->align) {
+ case ALIGN_PINGPONG_LEFT:
+ pad = 0;
+ break;
+ case ALIGN_PINGPONG_RIGHT:
+ pad = width - len;
+ if (pad < 0)
+ pad = 0;
+ break;
+ default:
+ pad = (width - len) / 2;
+ if (pad < 0)
+ pad = 0;
+ break;
+ }
+ } else {
+ if (T->direction == 1)
+ T->scroll++; /* scroll right */
+ else
+ T->scroll--; /* scroll left */
+
+ /*pad = if positive, add leading space characters, else offset of string begin */
+ pad = 0 - T->scroll;
+
+ if (pad < 0 - (len - width)) {
+ if (T->delay-- < 1) { /* wait before switch direction */
+ T->direction = 0; /* change scroll direction */
+ T->delay = PINGPONGWAIT;
+ T->scroll -= PINGPONGWAIT;
+ } /* else debug("wait1"); */
+ pad = 0 - (len - width);
+ } else if (pad > 0) {
+ if (T->delay-- < 1) {
+ T->direction = 1;
+ T->delay = PINGPONGWAIT;
+ T->scroll += PINGPONGWAIT;
+ } /* else debug("wait2"); */
+ pad = 0;
+ }
+
+ }
+ break;
+ default: /* not reached */
+ pad = 0;
+ }
+
+ dst = T->buffer;
+
+ /* process prefix */
+ src = prefix;
+ while (num < T->width) {
+ if (*src == '\0')
+ break;
+ *(dst++) = *(src++);
+ num++;
+ }
+
+ src = string;
+
+ /* pad blanks on the beginning */
+ while (pad > 0 && num < T->width) {
+ *(dst++) = ' ';
+ num++;
+ pad--;
+ }
+
+ /* skip src chars (marquee) */
+ while (pad < 0) {
+ src++;
+ pad++;
+ }
+
+ /* copy content */
+ while (num < T->width) {
+ if (*src == '\0')
+ break;
+ *(dst++) = *(src++);
+ num++;
+ }
+
+ /* pad blanks on the end */
+ src = postfix;
+ len = strlen(src);
+ while (num < T->width - len) {
+ *(dst++) = ' ';
+ num++;
+ }
+
+ /* process postfix */
+ while (num < T->width) {
+ if (*src == '\0')
+ break;
+ *(dst++) = *(src++);
+ num++;
+ }
+
+ *dst = '\0';
+
+ /* finally, draw it! */
+ if (W->class->draw)
+ W->class->draw(W);
+}
+
+
+
+void widget_text_update(void *Self)
+{
+ WIDGET *W = (WIDGET *) Self;
+ WIDGET_TEXT *T = W->data;
+ char *string;
+ int update = 0;
+
+ /* evaluate properties */
+ update += property_eval(&T->prefix);
+ update += property_eval(&T->postfix);
+ update += property_eval(&T->style);
+
+ /* evaluate value */
+ property_eval(&T->value);
+
+ /* string or number? */
+ if (T->precision == 0xDEAD) {
+ string = strdup(P2S(&T->value));
+ } else {
+ double number = P2N(&T->value);
+ int width = T->width - strlen(P2S(&T->prefix)) - strlen(P2S(&T->postfix));
+ int precision = T->precision;
+ /* print zero bytes so we can specify NULL as target */
+ /* and get the length of the resulting string */
+ int size = snprintf(NULL, 0, "%.*f", precision, number);
+ /* number does not fit into field width: try to reduce precision */
+ if (width < 0)
+ width = 0;
+ if (size > width && precision > 0) {
+ int delta = size - width;
+ if (delta > precision)
+ delta = precision;
+ precision -= delta;
+ size -= delta;
+ /* zero precision: omit decimal point, too */
+ if (precision == 0)
+ size--;
+ }
+ /* number still doesn't fit: display '*****' */
+ if (size > width) {
+ string = malloc(width + 1);
+ memset(string, '*', width);
+ *(string + width) = '\0';
+ } else {
+ string = malloc(size + 1);
+ snprintf(string, size + 1, "%.*f", precision, number);
+ }
+ }
+
+ /* did the formatted string change? */
+ if (T->string == NULL || strcmp(T->string, string) != 0) {
+ update++;
+ free(T->string);
+ T->string = string;
+ } else {
+ free(string);
+ }
+
+ /* something has changed and should be updated */
+ if (update) {
+ /* reset marquee counter if content has changed */
+ T->scroll = 0;
+
+ /* Init pingpong scroller. start scrolling left (wrong way) to get a delay */
+ if (T->align == ALIGN_PINGPONG_LEFT || T->align == ALIGN_PINGPONG_CENTER || T->align == ALIGN_PINGPONG_RIGHT) {
+ T->direction = 0;
+ T->delay = PINGPONGWAIT;
+ }
+ /* if there's a marquee scroller active, it has its own */
+ /* update callback timer, so we do nothing here; otherwise */
+ /* we simply call this scroll callback directly */
+ if (T->align != ALIGN_MARQUEE || T->align != ALIGN_AUTOMATIC || T->align != ALIGN_PINGPONG_LEFT
+ || T->align != ALIGN_PINGPONG_CENTER || T->align != ALIGN_PINGPONG_RIGHT) {
+ widget_text_scroll(Self);
+ }
+ }
+
+}
+
+
+int widget_text_init(WIDGET * Self)
+{
+ char *section;
+ char *c;
+ WIDGET_TEXT *Text;
+
+ /* prepare config section */
+ /* strlen("Widget:")=7 */
+ section = malloc(strlen(Self->name) + 8);
+ strcpy(section, "Widget:");
+ strcat(section, Self->name);
+
+ Text = malloc(sizeof(WIDGET_TEXT));
+ memset(Text, 0, sizeof(WIDGET_TEXT));
+
+ /* load properties */
+ property_load(section, "prefix", NULL, &Text->prefix);
+ property_load(section, "expression", "", &Text->value);
+ property_load(section, "postfix", NULL, &Text->postfix);
+ property_load(section, "style", NULL, &Text->style);
+
+ /* sanity checks */
+ if (!property_valid(&Text->value)) {
+ error("Warning: widget %s has no expression", section);
+ }
+
+ /* field width, default 10 */
+ cfg_number(section, "width", 10, 0, -1, &(Text->width));
+
+ /* precision: number of digits after the decimal point (default: none) */
+ /* Note: this is the *maximum* precision on small values, */
+ /* for larger values the precision may be reduced to fit into the field width. */
+ /* The default value 0xDEAD is used to distinguish between numbers and strings: */
+ /* if no precision is given, the result is always treated as a string. If a */
+ /* precision is specified, the result is treated as a number. */
+ cfg_number(section, "precision", 0xDEAD, 0, 80, &(Text->precision));
+
+ /* field alignment: Left (default), Center, Right or Marquee */
+ c = cfg_get(section, "align", "L");
+ switch (toupper(c[0])) {
+ case 'L':
+ Text->align = ALIGN_LEFT;
+ break;
+ case 'C':
+ Text->align = ALIGN_CENTER;
+ break;
+ case 'R':
+ Text->align = ALIGN_RIGHT;
+ break;
+ case 'M':
+ Text->align = ALIGN_MARQUEE;
+ break;
+ case 'A':
+ Text->align = ALIGN_AUTOMATIC;
+ break;
+ case 'P':
+ switch (toupper(c[1])) {
+ case 'C':
+ Text->align = ALIGN_PINGPONG_CENTER;
+ break;
+ case 'L':
+ Text->align = ALIGN_PINGPONG_LEFT;
+ break;
+ case 'R':
+ Text->align = ALIGN_PINGPONG_RIGHT;
+ break;
+ default:
+ Text->align = ALIGN_PINGPONG_CENTER;
+ error("widget %s has unknown alignment '%s', using 'Centered Pingpong'", section, c);
+ }
+ break;
+ default:
+ error("widget %s has unknown alignment '%s', using 'Left'", section, c);
+ Text->align = ALIGN_LEFT;
+ }
+ free(c);
+
+ /* update interval (msec), default 1 sec, 0 stands for never */
+ cfg_number(section, "update", 1000, 0, -1, &(Text->update));
+ /* limit update interval to min 10 msec */
+ if (Text->update > 0 && Text->update < 10)
+ Text->update = 10;
+
+ /* marquee scroller speed: interval (msec), default 500msec */
+ if (Text->align == ALIGN_MARQUEE || Text->align == ALIGN_AUTOMATIC || Text->align == ALIGN_PINGPONG_LEFT
+ || Text->align == ALIGN_PINGPONG_CENTER || Text->align == ALIGN_PINGPONG_RIGHT) {
+ cfg_number(section, "speed", 500, 10, -1, &(Text->speed));
+ }
+ //update on this event
+ char *event_name = cfg_get(section, "event", "");
+ if (*event_name != '\0') {
+ named_event_add(event_name, widget_text_update, Self);
+ if (Text->update == 1000) {
+ Text->update = 0;
+ }
+ }
+ free(event_name);
+
+
+ /* buffer */
+ Text->buffer = malloc(Text->width + 1);
+
+ free(section);
+ Self->data = Text;
+ Self->x2 = Self->col + Text->width;
+ Self->y2 = Self->row;
+
+ /* add update timer, use one-shot if 'update' is zero */
+ timer_add_widget(widget_text_update, Self, Text->update, Text->update == 0);
+
+ /* a marquee scroller has its own timer and callback */
+ if (Text->align == ALIGN_MARQUEE || Text->align == ALIGN_AUTOMATIC || Text->align == ALIGN_PINGPONG_LEFT
+ || Text->align == ALIGN_PINGPONG_CENTER || Text->align == ALIGN_PINGPONG_RIGHT) {
+ timer_add(widget_text_scroll, Self, Text->speed, 0);
+ }
+
+ return 0;
+}
+
+
+int widget_text_quit(WIDGET * Self)
+{
+ WIDGET_TEXT *Text;
+ if (Self) {
+ Text = Self->data;
+ if (Self->data) {
+ property_free(&Text->prefix);
+ property_free(&Text->value);
+ property_free(&Text->postfix);
+ property_free(&Text->style);
+ free(Text->string);
+ free(Text->buffer);
+ free(Self->data);
+ Self->data = NULL;
+ }
+
+ }
+ return 0;
+
+}
+
+
+
+WIDGET_CLASS Widget_Text = {
+ .name = "text",
+ .type = WIDGET_TYPE_RC,
+ .init = widget_text_init,
+ .draw = NULL,
+ .quit = widget_text_quit,
+};
diff --git a/widget_text.h b/widget_text.h
new file mode 100644
index 0000000..af8b6be
--- /dev/null
+++ b/widget_text.h
@@ -0,0 +1,58 @@
+/* $Id: widget_text.h 1164 2011-12-22 10:48:01Z mjona $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/widget_text.h $
+ *
+ * simple text widget handling
+ *
+ * Copyright (C) 2003, 2004 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+
+#ifndef _WIDGET_TEXT_H_
+#define _WIDGET_TEXT_H_
+
+#include "property.h"
+#include "widget.h"
+
+typedef enum { ALIGN_LEFT, ALIGN_CENTER, ALIGN_RIGHT, ALIGN_MARQUEE, ALIGN_AUTOMATIC, ALIGN_PINGPONG_LEFT,
+ ALIGN_PINGPONG_CENTER, ALIGN_PINGPONG_RIGHT
+} TEXT_ALIGN;
+
+typedef struct WIDGET_TEXT {
+ PROPERTY prefix; /* label on the left side */
+ PROPERTY postfix; /* label on the right side */
+ PROPERTY value; /* value of text widget */
+ PROPERTY style; /* text style (plain/bold/slant) */
+ char *string; /* formatted value */
+ char *buffer; /* string with 'width+1' bytes allocated */
+ int width; /* field width */
+ int precision; /* number of digits after the decimal point */
+ TEXT_ALIGN align; /* alignment: L(eft), C(enter), R(ight), M(arquee), A(utomatic) */
+ int update; /* update interval */
+ int scroll; /* marquee starting point */
+ int speed; /* marquee scrolling speed */
+ int direction; /* pingpong direction, 0=right, 1=left */
+ int delay; /* pingpong scrolling, wait before switch direction */
+} WIDGET_TEXT;
+
+
+extern WIDGET_CLASS Widget_Text;
+
+#endif
diff --git a/widget_timer.c b/widget_timer.c
new file mode 100644
index 0000000..e465c5d
--- /dev/null
+++ b/widget_timer.c
@@ -0,0 +1,147 @@
+/* $Id: widget_timer.c 1191 2012-06-23 21:52:34Z mzuther $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/widget_timer.c $
+ *
+ * timer widget handling
+ *
+ * Copyright (C) 2006 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2006 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ * exported functions:
+ *
+ * WIDGET_CLASS Widget_Timer
+ * the timer widget
+ *
+ */
+
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+
+#include "debug.h"
+#include "cfg.h"
+#include "qprintf.h"
+#include "property.h"
+#include "timer.h"
+#include "widget.h"
+#include "widget_timer.h"
+
+#ifdef WITH_DMALLOC
+#include <dmalloc.h>
+#endif
+
+void widget_timer_update(void *Self)
+{
+ WIDGET *W = (WIDGET *) Self;
+ WIDGET_TIMER *Timer = W->data;
+ int update, active;
+
+ /* evaluate expressions */
+ property_eval(&Timer->update);
+ property_eval(&Timer->active);
+
+ /* get new update interval */
+ update = P2N(&Timer->update);
+ if (update < 10)
+ update = 10;
+
+ /* finally, fire it! */
+ active = P2N(&Timer->active);
+ if (active > 0) {
+ property_eval(&Timer->expression);
+ }
+
+ /* add a new one-shot timer */
+ timer_add(widget_timer_update, Self, update, 1);
+}
+
+
+
+int widget_timer_init(WIDGET * Self)
+{
+ char *section;
+ WIDGET_TIMER *Timer;
+
+ /* prepare config section */
+ /* strlen("Widget:")=7 */
+ section = malloc(strlen(Self->name) + 8);
+ strcpy(section, "Widget:");
+ strcat(section, Self->name);
+
+ Timer = malloc(sizeof(WIDGET_TIMER));
+ memset(Timer, 0, sizeof(WIDGET_TIMER));
+
+ /* load properties */
+ property_load(section, "expression", NULL, &Timer->expression);
+ property_load(section, "update", "100", &Timer->update);
+ property_load(section, "active", "1", &Timer->active);
+
+ free(section);
+ Self->data = Timer;
+ Self->x2 = NOCOORD;
+ Self->y2 = NOCOORD;
+
+ /* just do it! */
+ widget_timer_update(Self);
+
+ return 0;
+}
+
+
+int widget_timer_quit(WIDGET * Self)
+{
+ if (Self) {
+ /* do not deallocate child widget! */
+ if (Self->parent == NULL) {
+ if (Self->data) {
+ WIDGET_TIMER *Timer = Self->data;
+ property_free(&Timer->expression);
+ property_free(&Timer->update);
+ property_free(&Timer->active);
+ free(Self->data);
+ Self->data = NULL;
+ }
+ }
+ }
+
+ return 0;
+
+}
+
+
+int widget_timer_register(void)
+{
+ WIDGET_CLASS wc;
+ wc = Widget_Timer;
+ widget_register(&wc);
+ return 0;
+}
+
+
+WIDGET_CLASS Widget_Timer = {
+ .name = "timer",
+ .type = WIDGET_TYPE_TIMER,
+ .init = widget_timer_init,
+ .draw = NULL,
+ .quit = widget_timer_quit,
+};
diff --git a/widget_timer.h b/widget_timer.h
new file mode 100644
index 0000000..586cf61
--- /dev/null
+++ b/widget_timer.h
@@ -0,0 +1,44 @@
+/* $Id: widget_timer.h 1164 2011-12-22 10:48:01Z mjona $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/widget_timer.h $
+ *
+ * timer widget handling
+ *
+ * Copyright (C) 2006 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2006 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+
+#ifndef _WIDGET_TIMER_H_
+#define _WIDGET_TIMER_H_
+
+#include "property.h"
+#include "widget.h"
+
+typedef struct WIDGET_TIMER {
+ PROPERTY expression; /* main timer expression */
+ PROPERTY update; /* update interval (msec) */
+ PROPERTY active; /* timer active? */
+} WIDGET_TIMER;
+
+extern WIDGET_CLASS Widget_Timer;
+
+int widget_timer_register(void);
+
+#endif