]> git.webhop.me Git - lcd4linux.git/commitdiff
[lcd4linux @ 2005-03-28 19:39:14 by reinelt]
authorreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>
Mon, 28 Mar 2005 19:39:23 +0000 (19:39 +0000)
committerreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>
Mon, 28 Mar 2005 19:39:23 +0000 (19:39 +0000)
HD44780/I2C patch from Luis merged (still does not work for me)

git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@519 3ae390bd-cb1e-0410-b409-cd5a39f66f1f

Makefile.am
Makefile.in
config.h.in
configure
configure.in
drivers.m4
drv_HD44780.c
drv_generic_i2c.c [new file with mode: 0644]
drv_generic_i2c.h [new file with mode: 0644]

index 7451fd0fa3dcbacb43e7c2e9899599a15f3bea86..f4c1497ed81944807bc62e43778778ab317064b8 100644 (file)
@@ -57,6 +57,8 @@ 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_BeckmannEgle.c          \
 drv_BWCT.c                  \
 drv_Crystalfontz.c          \
index afa50c11b297544ff40fba234308682e6309cfc1..ad3e2ad7b97194b05899d631b0d785dc46125d5b 100644 (file)
@@ -62,6 +62,7 @@ POST_UNINSTALL = :
 host_alias = @host_alias@
 host_triplet = @host@
 CC = @CC@
+CPP = @CPP@
 CURSES_INCLUDEDIR = @CURSES_INCLUDEDIR@
 CURSES_LIBS = @CURSES_LIBS@
 DRVLIBS = @DRVLIBS@
@@ -99,7 +100,7 @@ lcd4linux_SOURCES =  lcd4linux.c                 cfg.c         cfg.h         deb
 
 #liblcd4linux_la_SOURCES =
 
-EXTRA_lcd4linux_SOURCES =  drv_generic_text.c          drv_generic_text.h          drv_generic_graphic.c       drv_generic_graphic.h       drv_generic_serial.c        drv_generic_serial.h        drv_generic_parport.c       drv_generic_parport.h       drv_BeckmannEgle.c          drv_BWCT.c                  drv_Crystalfontz.c          drv_Curses.c                drv_Cwlinux.c               drv_HD44780.c               drv_Image.c                 drv_LCDLinux.c              drv_LCDTerm.c               drv_M50530.c                drv_MatrixOrbital.c         drv_MilfordInstruments.c    drv_NULL.c                  drv_RouterBoard.c           drv_SimpleLCD.c             drv_T6963.c                 drv_USBLCD.c                drv_X11.c                                               font_6x8.h                                              plugin_apm.c                plugin_cpuinfo.c            plugin_diskstats.c          plugin_dvb.c                plugin_exec.c               plugin_i2c_sensors.c        plugin_imon.c               plugin_isdn.c               plugin_loadavg.c            plugin_meminfo.c            plugin_mysql.c              plugin_netdev.c             plugin_pop3.c               plugin_ppp.c                plugin_proc_stat.c          plugin_seti.c               plugin_uname.c              plugin_uptime.c             plugin_wireless.c           plugin_xmms.c
+EXTRA_lcd4linux_SOURCES =  drv_generic_text.c          drv_generic_text.h          drv_generic_graphic.c       drv_generic_graphic.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_BeckmannEgle.c          drv_BWCT.c                  drv_Crystalfontz.c          drv_Curses.c                drv_Cwlinux.c               drv_HD44780.c               drv_Image.c                 drv_LCDLinux.c              drv_LCDTerm.c               drv_M50530.c                drv_MatrixOrbital.c         drv_MilfordInstruments.c    drv_NULL.c                  drv_RouterBoard.c           drv_SimpleLCD.c             drv_T6963.c                 drv_USBLCD.c                drv_X11.c                                               font_6x8.h                                              plugin_apm.c                plugin_cpuinfo.c            plugin_diskstats.c          plugin_dvb.c                plugin_exec.c               plugin_i2c_sensors.c        plugin_imon.c               plugin_isdn.c               plugin_loadavg.c            plugin_meminfo.c            plugin_mysql.c              plugin_netdev.c             plugin_pop3.c               plugin_ppp.c                plugin_proc_stat.c          plugin_seti.c               plugin_uname.c              plugin_uptime.c             plugin_wireless.c           plugin_xmms.c
 
 
 EXTRA_DIST =  lcd4linux.conf.sample       lcd4kde.conf                lcd4linux.kdelnk            lcd4linux.xpm               lcd4linux.lsm               curses.m4                   AUTHORS                     CREDITS                     FAQ                         NEWS                        TODO                        README                      README.Drivers              README.Plugins              README.KDE                  plugin_sample.c
@@ -144,20 +145,21 @@ DEP_FILES =  .deps/cfg.P .deps/debug.P .deps/drv.P .deps/drv_BWCT.P \
 .deps/drv_MatrixOrbital.P .deps/drv_MilfordInstruments.P \
 .deps/drv_NULL.P .deps/drv_RouterBoard.P .deps/drv_SimpleLCD.P \
 .deps/drv_T6963.P .deps/drv_USBLCD.P .deps/drv_X11.P \
-.deps/drv_generic_graphic.P .deps/drv_generic_parport.P \
-.deps/drv_generic_serial.P .deps/drv_generic_text.P .deps/evaluator.P \
-.deps/hash.P .deps/layout.P .deps/lcd4linux.P .deps/pid.P \
-.deps/plugin.P .deps/plugin_apm.P .deps/plugin_cfg.P \
-.deps/plugin_cpuinfo.P .deps/plugin_diskstats.P .deps/plugin_dvb.P \
-.deps/plugin_exec.P .deps/plugin_i2c_sensors.P .deps/plugin_imon.P \
-.deps/plugin_isdn.P .deps/plugin_loadavg.P .deps/plugin_math.P \
-.deps/plugin_meminfo.P .deps/plugin_mysql.P .deps/plugin_netdev.P \
-.deps/plugin_pop3.P .deps/plugin_ppp.P .deps/plugin_proc_stat.P \
-.deps/plugin_seti.P .deps/plugin_string.P .deps/plugin_test.P \
-.deps/plugin_time.P .deps/plugin_uname.P .deps/plugin_uptime.P \
-.deps/plugin_wireless.P .deps/plugin_xmms.P .deps/qprintf.P \
-.deps/thread.P .deps/timer.P .deps/udelay.P .deps/widget.P \
-.deps/widget_bar.P .deps/widget_icon.P .deps/widget_text.P
+.deps/drv_generic_graphic.P .deps/drv_generic_i2c.P \
+.deps/drv_generic_parport.P .deps/drv_generic_serial.P \
+.deps/drv_generic_text.P .deps/evaluator.P .deps/hash.P .deps/layout.P \
+.deps/lcd4linux.P .deps/pid.P .deps/plugin.P .deps/plugin_apm.P \
+.deps/plugin_cfg.P .deps/plugin_cpuinfo.P .deps/plugin_diskstats.P \
+.deps/plugin_dvb.P .deps/plugin_exec.P .deps/plugin_i2c_sensors.P \
+.deps/plugin_imon.P .deps/plugin_isdn.P .deps/plugin_loadavg.P \
+.deps/plugin_math.P .deps/plugin_meminfo.P .deps/plugin_mysql.P \
+.deps/plugin_netdev.P .deps/plugin_pop3.P .deps/plugin_ppp.P \
+.deps/plugin_proc_stat.P .deps/plugin_seti.P .deps/plugin_string.P \
+.deps/plugin_test.P .deps/plugin_time.P .deps/plugin_uname.P \
+.deps/plugin_uptime.P .deps/plugin_wireless.P .deps/plugin_xmms.P \
+.deps/qprintf.P .deps/thread.P .deps/timer.P .deps/udelay.P \
+.deps/widget.P .deps/widget_bar.P .deps/widget_icon.P \
+.deps/widget_text.P
 SOURCES = $(lcd4linux_SOURCES) $(EXTRA_lcd4linux_SOURCES)
 OBJECTS = $(lcd4linux_OBJECTS)
 
index b122ecb644131a3492fc00fcb31157d961dbdb03..7a01663c6605d15e5709566dfda3c3294bc1cd1e 100644 (file)
 /* Define to 1 if you have the `m' library (-lm). */
 #undef HAVE_LIBM
 
+/* Define to 1 if you have the <linux/compiler.h> header file. */
+#undef HAVE_LINUX_COMPILER_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/i2c-dev.h> header file. */
+#undef HAVE_LINUX_I2C_DEV_H
+
+/* Define to 1 if you have the <linux/i2c.h> header file. */
+#undef HAVE_LINUX_I2C_H
+
 /* Define to 1 if you have the <linux/isdn.h> header file. */
 #undef HAVE_LINUX_ISDN_H
 
 /* HD44780 driver */
 #undef WITH_HD44780
 
+/* I2C bus driver */
+#undef WITH_I2C
+
 /* LCD-Linux driver */
 #undef WITH_LCDLINUX
 
 #undef inline
 #endif
 
+/* Define to `long' if <sys/types.h> does not define. */
+#undef off_t
+
 /* Define to `int' if <sys/types.h> does not define. */
 #undef pid_t
 
index f6a31d176a6826d63abf3756eadc56a885311f64..c4c8b9033d03624cd44fced8ca67a03db441149b 100755 (executable)
--- a/configure
+++ b/configure
@@ -311,7 +311,7 @@ ac_includes_default="\
 # include <unistd.h>
 #endif"
 
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO SET_MAKE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT LN_S CURSES_LIBS CURSES_INCLUDEDIR CPP EGREP X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS DRIVERS DRVLIBS PLUGINS PLUGINLIBS LIBOBJS POW_LIB LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO SET_MAKE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP LN_S CURSES_LIBS CURSES_INCLUDEDIR EGREP X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS DRIVERS DRVLIBS PLUGINS PLUGINLIBS LIBOBJS POW_LIB LTLIBOBJS'
 ac_subst_files=''
 
 # Initialize some variables set by options.
@@ -2555,173 +2555,6 @@ 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
-
-echo "$as_me:$LINENO: checking whether ln -s works" >&5
-echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6
-LN_S=$as_ln_s
-if test "$LN_S" = "ln -s"; then
-  echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6
-else
-  echo "$as_me:$LINENO: result: no, using $LN_S" >&5
-echo "${ECHO_T}no, using $LN_S" >&6
-fi
-
-echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5
-echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6
-set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'`
-if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.make <<\_ACEOF
-all:
-       @echo 'ac_maketemp="$(MAKE)"'
-_ACEOF
-# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
-eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=`
-if test -n "$ac_maketemp"; then
-  eval ac_cv_prog_make_${ac_make}_set=yes
-else
-  eval ac_cv_prog_make_${ac_make}_set=no
-fi
-rm -f conftest.make
-fi
-if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
-  echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6
-  SET_MAKE=
-else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-  SET_MAKE="MAKE=${MAKE-make}"
-fi
-
-
-# dmalloc
-echo "$as_me:$LINENO: checking if malloc debugging is wanted" >&5
-echo $ECHO_N "checking if malloc debugging is wanted... $ECHO_C" >&6
-
-# Check whether --with-dmalloc or --without-dmalloc was given.
-if test "${with_dmalloc+set}" = set; then
-  withval="$with_dmalloc"
-  if test "$withval" = yes; then
-  echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6
-
-cat >>confdefs.h <<\_ACEOF
-#define WITH_DMALLOC 1
-_ACEOF
-
-  LIBS="$LIBS -ldmalloc"
-  LDFLAGS="$LDFLAGS -g"
-else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi;
-
-
-# Checks for libraries.
-
-
-echo "$as_me:$LINENO: checking for log in -lm" >&5
-echo $ECHO_N "checking for log in -lm... $ECHO_C" >&6
-if test "${ac_cv_lib_m_log+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lm  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-/* Override any gcc2 internal prototype to avoid an error.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
-char log ();
-int
-main ()
-{
-log ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_c_werror_flag"                   || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_lib_m_log=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_lib_m_log=no
-fi
-rm -f conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_m_log" >&5
-echo "${ECHO_T}$ac_cv_lib_m_log" >&6
-if test $ac_cv_lib_m_log = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBM 1
-_ACEOF
-
-  LIBS="-lm $LIBS"
-
-fi
-
-
-# curses
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
 
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
@@ -2957,28 +2790,274 @@ 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
 
-
-echo "$as_me:$LINENO: checking for egrep" >&5
-echo $ECHO_N "checking for egrep... $ECHO_C" >&6
-if test "${ac_cv_prog_egrep+set}" = set; then
+# 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.
+echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
+echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6
+if test -z "$INSTALL"; then
+if test "${ac_cv_path_install+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  if echo a | (grep -E '(a|b)') >/dev/null 2>&1
-    then ac_cv_prog_egrep='grep -E'
-    else ac_cv_prog_egrep='egrep'
-    fi
-fi
-echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5
-echo "${ECHO_T}$ac_cv_prog_egrep" >&6
- EGREP=$ac_cv_prog_egrep
-
-
+  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_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
+           ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+           break 3
+         fi
+       fi
+      done
+    done
+    ;;
+esac
+done
 
-       search_ncurses=true
-       screen_manager=""
-       has_curses=false
 
-       CFLAGS=${CFLAGS--O}
+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.  We don't cache a
+    # path for INSTALL within a source directory, because that will
+    # break other packages using the cache if that directory is
+    # removed, or if the path is relative.
+    INSTALL=$ac_install_sh
+  fi
+fi
+echo "$as_me:$LINENO: result: $INSTALL" >&5
+echo "${ECHO_T}$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'
+
+echo "$as_me:$LINENO: checking whether ln -s works" >&5
+echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6
+LN_S=$as_ln_s
+if test "$LN_S" = "ln -s"; then
+  echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+else
+  echo "$as_me:$LINENO: result: no, using $LN_S" >&5
+echo "${ECHO_T}no, using $LN_S" >&6
+fi
+
+echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6
+set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'`
+if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.make <<\_ACEOF
+all:
+       @echo 'ac_maketemp="$(MAKE)"'
+_ACEOF
+# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=`
+if test -n "$ac_maketemp"; then
+  eval ac_cv_prog_make_${ac_make}_set=yes
+else
+  eval ac_cv_prog_make_${ac_make}_set=no
+fi
+rm -f conftest.make
+fi
+if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
+  echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+  SET_MAKE=
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+  SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+
+# dmalloc
+echo "$as_me:$LINENO: checking if malloc debugging is wanted" >&5
+echo $ECHO_N "checking if malloc debugging is wanted... $ECHO_C" >&6
+
+# Check whether --with-dmalloc or --without-dmalloc was given.
+if test "${with_dmalloc+set}" = set; then
+  withval="$with_dmalloc"
+  if test "$withval" = yes; then
+  echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+
+cat >>confdefs.h <<\_ACEOF
+#define WITH_DMALLOC 1
+_ACEOF
+
+  LIBS="$LIBS -ldmalloc"
+  LDFLAGS="$LDFLAGS -g"
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi;
+
+
+# Checks for libraries.
+
+
+echo "$as_me:$LINENO: checking for log in -lm" >&5
+echo $ECHO_N "checking for log in -lm... $ECHO_C" >&6
+if test "${ac_cv_lib_m_log+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lm  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char log ();
+int
+main ()
+{
+log ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"                   || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_m_log=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_m_log=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_m_log" >&5
+echo "${ECHO_T}$ac_cv_lib_m_log" >&6
+if test $ac_cv_lib_m_log = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBM 1
+_ACEOF
+
+  LIBS="-lm $LIBS"
+
+fi
+
+
+# curses
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+echo "$as_me:$LINENO: checking for egrep" >&5
+echo $ECHO_N "checking for egrep... $ECHO_C" >&6
+if test "${ac_cv_prog_egrep+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if echo a | (grep -E '(a|b)') >/dev/null 2>&1
+    then ac_cv_prog_egrep='grep -E'
+    else ac_cv_prog_egrep='egrep'
+    fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5
+echo "${ECHO_T}$ac_cv_prog_egrep" >&6
+ EGREP=$ac_cv_prog_egrep
+
+
+
+       search_ncurses=true
+       screen_manager=""
+       has_curses=false
+
+       CFLAGS=${CFLAGS--O}
 
 
 
@@ -3399,7 +3478,7 @@ echo "${ECHO_T}Please note that some screen refreshs may fail" >&6
 echo $ECHO_N "checking for ncurses version... $ECHO_C" >&6
        ncurses_version=unknown
 cat > conftest.$ac_ext <<EOF
-#line 3402 "configure"
+#line 3481 "configure"
 #include "confdefs.h"
 #ifdef RENAMED_NCURSES
 #include <curses.h>
@@ -4973,54 +5052,428 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   (exit $ac_status); }; }; then
   :
 else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-ac_cv_header_stdc=no
-fi
-rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-fi
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_header_stdc=no
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
+echo "${ECHO_T}$ac_cv_header_stdc" >&6
+if test $ac_cv_header_stdc = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define STDC_HEADERS 1
+_ACEOF
+
+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=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"                   || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  eval "$as_ac_Header=yes"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_Header=no"
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+
+
+for ac_header in gd/gd.h gd.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"                   || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+    (
+      cat <<\_ASBOX
+## ---------------------------------------------------- ##
+## Report this to lcd4linux-users@lists.sourceforge.net ##
+## ---------------------------------------------------- ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+ has_gd=true
+else
+  has_gd=false
+fi
+
+done
+
+
+# check for usb.h
+
+for ac_header in usb.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"                   || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+    (
+      cat <<\_ASBOX
+## ---------------------------------------------------- ##
+## Report this to lcd4linux-users@lists.sourceforge.net ##
+## ---------------------------------------------------- ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
 fi
-echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
-echo "${ECHO_T}$ac_cv_header_stdc" >&6
-if test $ac_cv_header_stdc = yes; then
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
 
-cat >>confdefs.h <<\_ACEOF
-#define STDC_HEADERS 1
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
 _ACEOF
-
+ has_usb=true
+else
+  has_usb=false
 fi
 
-# On IRIX 5.3, sys/types and inttypes.h are conflicting.
-
-
-
-
-
-
+done
 
 
+# check for i2c
 
-for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
-                 inttypes.h stdint.h unistd.h
+for ac_header in linux/compiler.h
 do
 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-echo "$as_me:$LINENO: checking for $ac_header" >&5
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo "$as_me:$LINENO: checking for $ac_header" >&5
 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
 if eval "test \"\${$as_ac_Header+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-
 #include <$ac_header>
 _ACEOF
 rm -f conftest.$ac_objext
@@ -5044,30 +5497,106 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  eval "$as_ac_Header=yes"
+  ac_header_compiler=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-eval "$as_ac_Header=no"
+ac_header_compiler=no
 fi
 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+    (
+      cat <<\_ASBOX
+## ---------------------------------------------------- ##
+## Report this to lcd4linux-users@lists.sourceforge.net ##
+## ---------------------------------------------------- ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
 fi
 echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
 if test `eval echo '${'$as_ac_Header'}'` = yes; then
   cat >>confdefs.h <<_ACEOF
 #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
 _ACEOF
 
-fi
-
-done
-
-
-
-
-for ac_header in gd/gd.h gd.h
+for ac_header in linux/i2c.h
 do
 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
 if eval "test \"\${$as_ac_Header+set}\" = set"; then
@@ -5210,17 +5739,8 @@ if test `eval echo '${'$as_ac_Header'}'` = yes; then
   cat >>confdefs.h <<_ACEOF
 #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
 _ACEOF
- has_gd=true
-else
-  has_gd=false
-fi
-
-done
-
-
-# check for usb.h
 
-for ac_header in usb.h
+for ac_header in linux/i2c-dev.h
 do
 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
 if eval "test \"\${$as_ac_Header+set}\" = set"; then
@@ -5363,9 +5883,21 @@ if test `eval echo '${'$as_ac_Header'}'` = yes; then
   cat >>confdefs.h <<_ACEOF
 #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
 _ACEOF
- has_usb=true
+ has_i2c=true
 else
-  has_usb=false
+  has_i2c=false
+fi
+
+done
+
+else
+  has_i2c=false
+fi
+
+done
+
+       has_i2c=false
+
 fi
 
 done
@@ -5489,12 +6021,18 @@ done
 echo "$as_me:$LINENO: result: done" >&5
 echo "${ECHO_T}done" >&6
 
-PARPORT="no"
-SERIAL="no"
+
+# generic display drivers
 TEXT="no"
 GRAPHIC="no"
 IMAGE="no"
 
+# generiv I/O drivers
+PARPORT="no"
+SERIAL="no"
+I2C="no"
+
+
 if test "$BECKMANNEGLE" = "yes"; then
    TEXT="yes"
    SERIAL="yes"
@@ -5563,6 +6101,7 @@ fi
 if test "$HD44780" = "yes"; then
    TEXT="yes"
    PARPORT="yes"
+   I2C="yes"
    DRIVERS="$DRIVERS drv_HD44780.o"
 
 cat >>confdefs.h <<\_ACEOF
@@ -5723,12 +6262,14 @@ _ACEOF
    fi
 fi
 
+
 if test "$DRIVERS" = ""; then
-   { { echo "$as_me:$LINENO: error: You should include at least one driver..." >&5
-echo "$as_me: error: You should include at least one driver..." >&2;}
+   { { echo "$as_me:$LINENO: error: You should activate at least one driver..." >&5
+echo "$as_me: error: You should activate at least one driver..." >&2;}
    { (exit 1); exit 1; }; }
 fi
 
+
 # generic text driver
 if test "$TEXT" = "yes"; then
    DRIVERS="$DRIVERS drv_generic_text.o"
@@ -5740,6 +6281,7 @@ if test "$GRAPHIC" = "yes"; then
    DRIVERS="$DRIVERS drv_generic_graphic.o"
 fi
 
+
 # generic parport driver
 if test "$PARPORT" = "yes"; then
    DRIVERS="$DRIVERS drv_generic_parport.o"
@@ -5750,6 +6292,23 @@ if test "$SERIAL" = "yes"; then
    DRIVERS="$DRIVERS drv_generic_serial.o"
 fi
 
+# generic i2c driver
+if test "$I2C" = "yes"; then
+   if test "$has_i2c" = true; then
+
+cat >>confdefs.h <<\_ACEOF
+#define WITH_I2C 1
+_ACEOF
+
+      DRIVERS="$DRIVERS drv_generic_i2c.o"
+   else
+      I2C="no"
+      { echo "$as_me:$LINENO: WARNING: I2C include files not found: I2C bus driver disabled" >&5
+echo "$as_me: WARNING: I2C include files not found: I2C bus driver disabled" >&2;}
+   fi
+fi
+
+
 
 
 
@@ -8036,6 +8595,71 @@ _ACEOF
     ;;
 esac
 
+echo "$as_me:$LINENO: checking for off_t" >&5
+echo $ECHO_N "checking for off_t... $ECHO_C" >&6
+if test "${ac_cv_type_off_t+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+if ((off_t *) 0)
+  return 0;
+if (sizeof (off_t))
+  return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"                   || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_type_off_t=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type_off_t=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_off_t" >&5
+echo "${ECHO_T}$ac_cv_type_off_t" >&6
+if test $ac_cv_type_off_t = yes; then
+  :
+else
+
+cat >>confdefs.h <<_ACEOF
+#define off_t long
+_ACEOF
+
+fi
+
 echo "$as_me:$LINENO: checking for pid_t" >&5
 echo $ECHO_N "checking for pid_t... $ECHO_C" >&6
 if test "${ac_cv_type_pid_t+set}" = set; then
@@ -10331,10 +10955,10 @@ s,@CPPFLAGS@,$CPPFLAGS,;t t
 s,@ac_ct_CC@,$ac_ct_CC,;t t
 s,@EXEEXT@,$EXEEXT,;t t
 s,@OBJEXT@,$OBJEXT,;t t
+s,@CPP@,$CPP,;t t
 s,@LN_S@,$LN_S,;t t
 s,@CURSES_LIBS@,$CURSES_LIBS,;t t
 s,@CURSES_INCLUDEDIR@,$CURSES_INCLUDEDIR,;t t
-s,@CPP@,$CPP,;t t
 s,@EGREP@,$EGREP,;t t
 s,@X_CFLAGS@,$X_CFLAGS,;t t
 s,@X_PRE_LIBS@,$X_PRE_LIBS,;t t
index 620a4a6c07d8d9f7de1176d6d3ee42022feb21a3..3240e65304ac186f8b75de8c83ddb53e6a608b2b 100644 (file)
@@ -30,6 +30,8 @@ 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
 
@@ -52,6 +54,16 @@ AC_CHECK_HEADERS(gd/gd.h gd.h, [has_gd=true], [has_gd=false])
 # check for usb.h
 AC_CHECK_HEADERS(usb.h, [has_usb=true], [has_usb=false])
 
+# check for i2c
+AC_CHECK_HEADERS(linux/compiler.h,
+       [AC_CHECK_HEADERS(linux/i2c.h,
+               [AC_CHECK_HEADERS(linux/i2c-dev.h,
+                       [has_i2c=true],
+                       [has_i2c=false])],
+               [has_i2c=false])]
+       [has_i2c=false]
+)
+
 # drivers
 sinclude(drivers.m4)
 
@@ -69,6 +81,7 @@ AC_CHECK_HEADERS(asm/msr.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_HEADER_TIME
index f012f3c49f2037b2718552f5738b4b46fc594c77..708cb4f300737ef05edfc51ff5a1dfbb7ab209c2 100644 (file)
@@ -137,12 +137,18 @@ done
 
 AC_MSG_RESULT([done])
 
-PARPORT="no"
-SERIAL="no"
+
+# generic display drivers
 TEXT="no"
 GRAPHIC="no"
 IMAGE="no"
 
+# generiv I/O drivers
+PARPORT="no"
+SERIAL="no"
+I2C="no"
+
+
 if test "$BECKMANNEGLE" = "yes"; then
    TEXT="yes"
    SERIAL="yes"
@@ -189,6 +195,7 @@ fi
 if test "$HD44780" = "yes"; then
    TEXT="yes"
    PARPORT="yes"
+   I2C="yes"
    DRIVERS="$DRIVERS drv_HD44780.o"
    AC_DEFINE(WITH_HD44780,1,[HD44780 driver])
 fi
@@ -287,14 +294,16 @@ if test "$X11" = "yes"; then
       GRAPHIC="yes"
       DRIVERS="$DRIVERS drv_X11.o"
       DRVLIBS="$DRVLIBS -L$ac_x_libraries -lX11"
-      AC_DEFINE(WITH_X11,1,[X11 driver])
+      AC_DEFINE(WITH_X11, 1, [X11 driver])
    fi
 fi
 
+
 if test "$DRIVERS" = ""; then
-   AC_MSG_ERROR([You should include at least one driver...])
+   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"
@@ -306,6 +315,7 @@ if test "$GRAPHIC" = "yes"; then
    DRIVERS="$DRIVERS drv_generic_graphic.o"
 fi
 
+
 # generic parport driver
 if test "$PARPORT" = "yes"; then
    DRIVERS="$DRIVERS drv_generic_parport.o"
@@ -316,5 +326,17 @@ if test "$SERIAL" = "yes"; then
    DRIVERS="$DRIVERS drv_generic_serial.o"
 fi
 
+# generic i2c driver
+if test "$I2C" = "yes"; then
+   if test "$has_i2c" = true; then
+      AC_DEFINE(WITH_I2C, 1, [I2C bus driver])
+      DRIVERS="$DRIVERS drv_generic_i2c.o"
+   else
+      I2C="no"
+      AC_MSG_WARN(I2C include files not found: I2C bus driver disabled)
+   fi   
+fi
+
+
 AC_SUBST(DRIVERS)
 AC_SUBST(DRVLIBS)
index a7787319639a1324c3271a711aed9d2ee597bd2a..0771aa2e780bf2690ee355f9ef0b9e6db1100a4f 100644 (file)
@@ -1,10 +1,13 @@
-/* $Id: drv_HD44780.c,v 1.45 2005/03/25 15:44:43 reinelt Exp $
+/* $Id: drv_HD44780.c,v 1.46 2005/03/28 19:39:23 reinelt Exp $
  *
  * new style driver for HD44780-based displays
  *
  * Copyright (C) 2003 Michael Reinelt <reinelt@eunet.at>
  * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
  *
+ * Support for I2C bus
+ * Copyright (C) 2005 Luis F. Correia <luis.f.correia@seg-social.pt>
+ *
  * Modification for 4-Bit mode
  * Copyright (C) 2003 Martin Hejl (martin@hejl.de)
  *
@@ -29,6 +32,9 @@
  *
  *
  * $Log: drv_HD44780.c,v $
+ * Revision 1.46  2005/03/28 19:39:23  reinelt
+ * HD44780/I2C patch from Luis merged (still does not work for me)
+ *
  * Revision 1.45  2005/03/25 15:44:43  reinelt
  * HD44780 Backlight fixed (thanks to geronet)
  *
 #include <sys/time.h>
 #include <sys/ioctl.h>
 
-/* Fixme: I2C support does not compile */
-#if 0
-#include <linux/i2c.h>
-#include <linux/i2c-dev.h>
-#endif
-
 #include "debug.h"
 #include "cfg.h"
 #include "udelay.h"
 #include "drv_generic_text.h"
 #include "drv_generic_parport.h"
 
+#ifdef WITH_I2C
+#include "drv_generic_i2c.h"
+#endif
+
 static char Name[]="HD44780";
 
 static int Bus;
@@ -342,11 +346,6 @@ static MODEL Models[] = {
 };
 
 
-/* handle for I2C device */
-static int i2c_device;
-
-
-
 /****************************************/
 /***  generic functions               ***/
 /****************************************/
@@ -746,32 +745,40 @@ static void drv_HD_PP_stop (void)
 /***  i2c dependant functions         ***/
 /****************************************/
 
-/* Fixme: remove the __attribute__((unused)) as soon as the i2c driver works */
-static void drv_HD_I2C_nibble (const __attribute__((unused)) unsigned char controller, 
-                              const __attribute__((unused)) unsigned char nibble)
+#ifdef WITH_I2C
+
+static void drv_HD_I2C_nibble (unsigned char controller, unsigned char nibble)
 {
-/* Fixme: I2C support does not compile */
-#if 0
+  unsigned char enable;
+
+  /* enable signal: 'controller' is a bitmask */
+  /* bit 0 .. send to controller #0 */
+  /* bit 1 .. send to controller #1 */
+  /* so we can send a byte to both controllers at the same time! */
+  enable = 0;
+  if (controller & 0x01) enable |= SIGNAL_ENABLE;
+  if (controller & 0x02) enable |= SIGNAL_ENABLE2;
+  
+
   /* clear ENABLE */
   /* put data on DB1..DB4 */
   /* nibble already contains RS bit! */
-  i2c_smbus_write_byte_data(i2c_device, 0, nibble);
+  drv_generic_i2c_data(nibble);
   
   /* Address set-up time */
   ndelay(T_AS);
   
   /* rise ENABLE */
-  i2c_smbus_write_byte_data(i2c_device, 0, nibble | SIGNAL_ENABLE);
+   drv_generic_i2c_data(nibble | enable);
   
   /* Enable pulse width */
   ndelay(T_PW);
   
   /* lower ENABLE */
-  i2c_smbus_write_byte_data(i2c_device, 0, nibble);
+   drv_generic_i2c_data(nibble);
   
   /* Address hold time */
   ndelay(T_H);
-#endif
 }
 
 
@@ -792,7 +799,11 @@ static void drv_HD_I2C_byte (const unsigned char controller, const unsigned char
 static void drv_HD_I2C_command (const unsigned char controller, const unsigned char cmd, const int delay)
 {
   /* send data with RS disabled */
-  drv_HD_I2C_byte (controller, cmd);
+  drv_HD_I2C_nibble (controller, ((cmd>>4)&0x0f));
+
+  ndelay(T_CYCLE-T_AS-T_PW);
+
+  drv_HD_I2C_nibble (controller, ((cmd)&0x0f));
  
   /* wait for command completion */
   udelay(delay);
@@ -817,51 +828,29 @@ static void drv_HD_I2C_data (const unsigned char controller, const char *string,
 
 static int drv_HD_I2C_load (const char *section)
 {
-  int dev;
-  char *bus,*device;
-
-  bus    = cfg_get(section, "Port", NULL);   
-  device = cfg_get(section, "Device", NULL);   
-  dev    = 0x70;
-
-  info("%s: initializing I2C bus %s",Name,bus);
-  if ((i2c_device = open(bus,O_RDWR)) < 0) {
-    error("%s: I2C bus %s open failed !\n",Name,bus);
-    return -1;
-  }
-  
-  info("%s: initializing I2C slave device 0x%x",Name,dev);
-/* Fixme: I2C support does not compile */
-#if 0
-  if (ioctl(i2c_device,I2C_SLAVE, (dev>>1) ) < 0) {
-    error("%s: error initializing device 0x%x\n",Name,dev);
-    close(i2c_device);
-    return -1;
-  }
-#endif
-
-  info("%s: detecting I2C device 0x%x on bus %s ",Name,dev,bus);
-/* Fixme: I2C support does not compile */
-#if 0
-  if (i2c_smbus_write_quick(i2c_device,I2C_SMBUS_WRITE) < 0) {
-    error("%s: i2c slave-device 0x%x not found!\n",Name,dev);
-    close(i2c_device);
-    return -1;
-  }
-#endif
-  
   if (cfg_number(section, "Bits", 8, 4, 8, &Bits)<0) return -1;
   if (Bits!=4) {
-    error ("%s: bad %s.Bits '%d' from %s, should be '4' ", Name, section, Bits, cfg_source());
+    error ("%s: bad %s.Bits '%d' from %s, should be '4'", Name, section, Bits, cfg_source());
     return -1;
-  }   
+  }    
   
   info ("%s: using %d bit mode", Name, Bits);
   
-  /* initialize *both* displays */
+  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;
+  
+  /* initialize display */
   drv_HD_I2C_nibble  (allControllers, 0x03); udelay(T_INIT1); /* 4 Bit mode, wait 4.1 ms */
   drv_HD_I2C_nibble  (allControllers, 0x03); udelay(T_INIT2); /* 4 Bit mode, wait 100 us */
-  drv_HD_I2C_nibble  (allControllers, 0x03); udelay(T_INIT1); /* 4 Bit mode, wait 4.1 ms */
+  drv_HD_I2C_nibble  (allControllers, 0x03); udelay(T_INIT2); /* 4 Bit mode, wait 4.1 ms */
   drv_HD_I2C_nibble  (allControllers, 0x02); 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 */
 
@@ -874,13 +863,14 @@ static int drv_HD_I2C_load (const char *section)
 static void drv_HD_I2C_stop (void)
 {
   /* clear all signals */
-  // drv_generic_i2c_data (0);
-  /* close port */
-  // drv_generic_i2c_close();
+  drv_generic_i2c_data (0);
 
-  close(i2c_device);
+  /* close port */
+  drv_generic_i2c_close();
 }
 
+#endif /* WITH_I2C */
+
 
 /****************************************/
 /***  display dependant functions     ***/
@@ -1068,12 +1058,19 @@ static int drv_HD_start (const char *section, const int quiet)
     drv_HD_stop    = drv_HD_PP_stop;
     
   } 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());
diff --git a/drv_generic_i2c.c b/drv_generic_i2c.c
new file mode 100644 (file)
index 0000000..5a01cdd
--- /dev/null
@@ -0,0 +1,155 @@
+/* $Id: drv_generic_i2c.c,v 1.1 2005/03/28 19:39:23 reinelt Exp $
+ *
+ * generic driver helper for i2c displays
+ *
+ * Copyright (C) 2005 Luis F. Correia <luis.f.correia@seg-social.pt>
+ * 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.
+ *
+ *
+ * $Log: drv_generic_i2c.c,v $
+ * Revision 1.1  2005/03/28 19:39:23  reinelt
+ * HD44780/I2C patch from Luis merged (still does not work for me)
+ *
+ *
+ */
+
+#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 <linux/compiler.h>
+#include <linux/i2c.h>
+#include <linux/i2c-dev.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 void my_i2c_smbus_write_byte_data(const int device, const unsigned char data)
+{
+  struct i2c_smbus_ioctl_data args;
+  args.read_write = I2C_SMBUS_WRITE;
+  args.command = data;
+  args.size = I2C_SMBUS_BYTE;
+  args.data = 0;
+  ioctl(device,I2C_SMBUS,&args);
+}
+
+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);
+}
+
+int drv_generic_i2c_open (const char *section, const char *driver)
+{
+  int dev;
+  char *bus,*device;
+
+  //SIGNAL_ENABLE = 0x40;
+  //SIGNAL_RW = 0x10;
+  //SIGNAL_RS = 0x20;
+
+  udelay_init();
+
+  bus    = cfg_get(section, "Port", NULL);   
+  device = cfg_get(section, "Device", NULL);
+  dev    = atoi(device);
+  info   ("%s: initializing I2C bus %s",driver,bus);
+  info   ("device %d",dev);
+  if ((i2c_device = open(bus,O_WRONLY)) < 0) {
+    error("%s: I2C bus %s open failed !\n",driver,bus);
+    return -1;
+  }
+  
+  info   ("%s: initializing I2C slave device 0x%x",driver,dev);
+  if (ioctl(i2c_device,I2C_SLAVE, dev ) < 0) {
+    error("%s: error initializing device 0x%x\n",driver,dev);
+    close(i2c_device);
+    return -1;
+  }
+
+  return 0;
+}
+
+
+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_data (const unsigned char data)
+{
+
+  my_i2c_smbus_write_byte_data(i2c_device, data);
+  
+}
diff --git a/drv_generic_i2c.h b/drv_generic_i2c.h
new file mode 100644 (file)
index 0000000..731bacc
--- /dev/null
@@ -0,0 +1,61 @@
+/* $Id: drv_generic_i2c.h,v 1.1 2005/03/28 19:39:23 reinelt Exp $
+ *
+ * generic driver helper for i2c displays
+ *
+ * Copyright (C) 2005 Luis F. Correia <luis.f.correia@seg-social.pt>
+ * 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.
+ *
+ *
+ * $Log: drv_generic_i2c.h,v $
+ * Revision 1.1  2005/03/28 19:39:23  reinelt
+ * HD44780/I2C patch from Luis merged (still does not work for me)
+ *
+ *
+ */
+
+/* 
+ *
+ * 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
+ */
+
+#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_data  (const unsigned char data);
+
+#endif