On 07/07/2014 15:03, Charles Lepple wrote:
Giuseppe Corbelli <giuseppe.corbelli <at> copanitalia.com> writes:

Nevermind, please try the one attached, just created by

git diff -p 80d9534 configure.ac data/driver.list.in drivers/Makefile.am
drivers/asem.c > asem.patch

Just applied it on current master (80d9534a133da170cade150700407920450a9753)
and seems ok.

Sorry I did not test this sooner - this went to Gmane but not to my email.
If you have time, could you please write up a quick man page for this driver?

Also, there seem to be some missing symbols and include files:

http://buildbot.networkupstools.org/public/nut/waterfall?branch=asem_i2c

The problem is that linux/i2c-dev.h must come from libi2c-dev to define the required functions. Same header is part of the kernel, but without required functions. Changed the configure.ac check to look for the functions, not just the header.
To build the driver you'll need libi2c-dev package (part of i2c-tools) on 
debian.
Also removed the #include <config.h> as you suggested.

--
            Giuseppe Corbelli
WASP Software Engineer, Copan Italia S.p.A
Phone: +390303666318  Fax: +390302659932
E-mail: [email protected]
diff --git a/configure.ac b/configure.ac
index e2cd10c..39f1ad4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -472,10 +472,11 @@ NUT_ARG_WITH([linux_i2c], [build and install i2c drivers], [auto])
 if test "${nut_with_linux_i2c}" != no; then
     case ${target_os} in
         linux* )
-            AC_CHECK_HEADERS(
-                [linux/i2c-dev.h unistd.h errno.h],
+            AC_CHECK_DECLS(
+                [i2c_smbus_read_word_data, i2c_smbus_write_word_data, i2c_smbus_read_block_data],
                 [nut_with_linux_i2c="yes"],
-                [nut_with_linux_i2c="no"]
+                [nut_with_linux_i2c="no"],
+                [#include <linux/i2c-dev.h>]
             )
             ;;
         * )
diff --git a/drivers/asem.c b/drivers/asem.c
index 8e162ce..2c0bc1e 100644
--- a/drivers/asem.c
+++ b/drivers/asem.c
@@ -30,9 +30,6 @@
 	so you need to boot with acpi_enforce_resources=lax option.
 */
 
-/* Assume ../include path added */
-#include <config.h>
-
 /* Depends on i2c-dev.h, Linux only */
 #if HAVE_LINUX_I2C_DEV_H
 #include <stdio.h>
_______________________________________________
Nut-upsdev mailing list
[email protected]
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/nut-upsdev

Reply via email to