]> git.pld-linux.org Git - packages/nut.git/commitdiff
- added i2c patch, enable linux-i2c driver using libi2c library
authorJakub Bogusz <qboosh@pld-linux.org>
Sun, 3 Dec 2017 20:22:19 +0000 (21:22 +0100)
committerJakub Bogusz <qboosh@pld-linux.org>
Sun, 3 Dec 2017 20:22:19 +0000 (21:22 +0100)
nut-i2c.patch [new file with mode: 0644]
nut.spec

diff --git a/nut-i2c.patch b/nut-i2c.patch
new file mode 100644 (file)
index 0000000..d7bb025
--- /dev/null
@@ -0,0 +1,39 @@
+--- nut-2.7.4/configure.ac.orig        2017-12-03 20:59:45.766861382 +0100
++++ nut-2.7.4/configure.ac     2017-12-03 21:04:32.550191441 +0100
+@@ -475,14 +475,7 @@
+ if test "${nut_with_linux_i2c}" != no; then
+     case ${target_os} in
+         linux* )
+-            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"],
+-                [#include <stdio.h>
+-                 #include <linux/i2c-dev.h>
+-                ]
+-            )
++            AC_CHECK_LIB([i2c], [i2c_smbus_read_word_data], [nut_with_linux_i2c="yes"], [nut_with_linux_i2c="no"])
+             ;;
+         * )
+             nut_with_linux_i2c="no"
+--- nut-2.7.4/drivers/asem.c.orig      2015-12-29 13:08:34.000000000 +0100
++++ nut-2.7.4/drivers/asem.c   2017-12-03 21:08:50.156855165 +0100
+@@ -35,6 +35,7 @@
+ #include <errno.h>
+ #include <unistd.h>
+ #include <linux/i2c-dev.h>
++#include <i2c/smbus.h>
+ #include "main.h"
+--- nut-2.7.4/drivers/Makefile.am.orig 2016-03-08 13:01:11.000000000 +0100
++++ nut-2.7.4/drivers/Makefile.am      2017-12-03 21:16:08.973516822 +0100
+@@ -225,7 +225,7 @@
+ macosx_ups_SOURCES = macosx-ups.c
+ # Asem
+-asem_LDADD = $(LDADD_DRIVERS)
++asem_LDADD = $(LDADD_DRIVERS) -li2c
+ asem_SOURCES = asem.c
+ # nutdrv_qx USB/Serial
index 2446418e8163a84ec5b170059f1ed2079fa844ea..dced6f30f15960688f65274e55ecce152fca8b1e 100644 (file)
--- a/nut.spec
+++ b/nut.spec
@@ -1,10 +1,10 @@
 # TODO:
-#      - --with-linux-i2c (requires i2c-dev.h header with i2c_smbus_* inline functions)
 #      - upsdrvctl (used by ups.init) doesn't recognize status and reload commands
 #
 # Conditional build:
 %bcond_without cgi             # CGI support
 %bcond_without freeipmi        # IPMI support
+%bcond_without i2c             # I2C support
 %bcond_without neon            # neon based XML/HTTP driver
 %bcond_without powerman        # PowerMan support
 %bcond_without snmp            # SNMP driver
@@ -31,6 +31,7 @@ Patch4:               %{name}-matrix.patch
 Patch5:                systemd-sysconfig.patch
 Patch6:                bcmxcp-off-by-one.patch
 Patch7:                %{name}-build.patch
+Patch8:                %{name}-i2c.patch
 URL:           http://www.networkupstools.org/
 BuildRequires: asciidoc >= 8.6.3
 BuildRequires: autoconf >= 2.60
@@ -38,6 +39,7 @@ BuildRequires:        automake
 BuildRequires: avahi-devel >= 0.6.30
 %{?with_freeipmi:BuildRequires:        freeipmi-devel}
 %{?with_cgi:BuildRequires:     gd-devel >= 2.0.15}
+%{?with_i2c:BuildRequires:     libi2c-devel}
 BuildRequires: libltdl-devel
 BuildRequires: libstdc++-devel
 BuildRequires: libtool
@@ -206,6 +208,7 @@ Statyczne biblioteki NUT-a.
 %patch5 -p1
 %patch6 -p1
 %patch7 -p1
+%patch8 -p1
 
 %build
 %{__libtoolize}
@@ -227,6 +230,7 @@ Statyczne biblioteki NUT-a.
        --with-cgi%{!?with_cgi:=no} \
        --with-dev \
        --with-ipmi%{!?with_freeipmi:=no} \
+       --with-linux-i2c%{!?with_i2c:=no} \
        --with-neon%{!?with_neon:=no} \
        --with-openssl \
        --with-powerman%{!?with_powerman:=no} \
@@ -371,6 +375,7 @@ fi
 %attr(755,root,root) /lib/nut/apcsmart
 %attr(755,root,root) /lib/nut/apcsmart-old
 %attr(755,root,root) /lib/nut/apcupsd-ups
+%{?with_i2c:%attr(755,root,root) /lib/nut/asem}
 %attr(755,root,root) /lib/nut/bcmxcp
 %{?with_usb:%attr(755,root,root) /lib/nut/bcmxcp_usb}
 %attr(755,root,root) /lib/nut/belkin
This page took 0.116645 seconds and 4 git commands to generate.