Imported Upstream version 2.7.1
This commit is contained in:
parent
a1fa151fc7
commit
0121794af9
451 changed files with 41339 additions and 10887 deletions
|
|
@ -16,7 +16,7 @@
|
|||
# sub-directory
|
||||
SUBDIRS = . nut-scanner
|
||||
|
||||
EXTRA_DIST = nut-usbinfo.pl nut-hclinfo.py nut-recorder.sh svn2cl.authors nut-snmpinfo.py
|
||||
EXTRA_DIST = nut-usbinfo.pl nut-hclinfo.py nut-recorder.sh gitlog2changelog.py nut-snmpinfo.py
|
||||
|
||||
all: nut-scanner-deps
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
# Makefile.in generated by automake 1.11.1 from Makefile.am.
|
||||
# Makefile.in generated by automake 1.11.6 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
|
||||
# Inc.
|
||||
# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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.
|
||||
|
|
@ -17,6 +17,23 @@
|
|||
|
||||
# TODO: remove redundancies!
|
||||
VPATH = @srcdir@
|
||||
am__make_dryrun = \
|
||||
{ \
|
||||
am__dry=no; \
|
||||
case $$MAKEFLAGS in \
|
||||
*\\[\ \ ]*) \
|
||||
echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
|
||||
| grep '^AM OK$$' >/dev/null || am__dry=yes;; \
|
||||
*) \
|
||||
for am__flg in $$MAKEFLAGS; do \
|
||||
case $$am__flg in \
|
||||
*=*|--*) ;; \
|
||||
*n*) am__dry=yes; break;; \
|
||||
esac; \
|
||||
done;; \
|
||||
esac; \
|
||||
test $$am__dry = yes; \
|
||||
}
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
|
|
@ -52,8 +69,9 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \
|
|||
$(top_srcdir)/m4/nut_check_libltdl.m4 \
|
||||
$(top_srcdir)/m4/nut_check_libneon.m4 \
|
||||
$(top_srcdir)/m4/nut_check_libnetsnmp.m4 \
|
||||
$(top_srcdir)/m4/nut_check_libnss.m4 \
|
||||
$(top_srcdir)/m4/nut_check_libopenssl.m4 \
|
||||
$(top_srcdir)/m4/nut_check_libpowerman.m4 \
|
||||
$(top_srcdir)/m4/nut_check_libssl.m4 \
|
||||
$(top_srcdir)/m4/nut_check_libusb.m4 \
|
||||
$(top_srcdir)/m4/nut_check_libwrap.m4 \
|
||||
$(top_srcdir)/m4/nut_check_os.m4 \
|
||||
|
|
@ -76,6 +94,11 @@ RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
|
|||
install-pdf-recursive install-ps-recursive install-recursive \
|
||||
installcheck-recursive installdirs-recursive pdf-recursive \
|
||||
ps-recursive uninstall-recursive
|
||||
am__can_run_installinfo = \
|
||||
case $$AM_UPDATE_INFO_DIR in \
|
||||
n|no|NO) false;; \
|
||||
*) (install-info --version) >/dev/null 2>&1;; \
|
||||
esac
|
||||
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
|
||||
distclean-recursive maintainer-clean-recursive
|
||||
AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
|
||||
|
|
@ -115,6 +138,7 @@ ACLOCAL = @ACLOCAL@
|
|||
AMTAR = @AMTAR@
|
||||
AR = @AR@
|
||||
ASCIIDOC = @ASCIIDOC@
|
||||
ASPELL = @ASPELL@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
|
|
@ -141,6 +165,7 @@ DOC_BUILD_LIST = @DOC_BUILD_LIST@
|
|||
DRIVER_BUILD_LIST = @DRIVER_BUILD_LIST@
|
||||
DRIVER_INSTALL_TARGET = @DRIVER_INSTALL_TARGET@
|
||||
DRIVER_MAN_LIST = @DRIVER_MAN_LIST@
|
||||
DRVPATH = @DRVPATH@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO_C = @ECHO_C@
|
||||
|
|
@ -309,7 +334,7 @@ udevdir = @udevdir@
|
|||
# to have nutscan-{usb,snmp}.h built before going into the nut-scanner
|
||||
# sub-directory
|
||||
SUBDIRS = . nut-scanner
|
||||
EXTRA_DIST = nut-usbinfo.pl nut-hclinfo.py nut-recorder.sh svn2cl.authors nut-snmpinfo.py
|
||||
EXTRA_DIST = nut-usbinfo.pl nut-hclinfo.py nut-recorder.sh gitlog2changelog.py nut-snmpinfo.py
|
||||
all: all-recursive
|
||||
|
||||
.SUFFIXES:
|
||||
|
|
@ -517,13 +542,10 @@ distdir: $(DISTFILES)
|
|||
done
|
||||
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
test -d "$(distdir)/$$subdir" \
|
||||
|| $(MKDIR_P) "$(distdir)/$$subdir" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
$(am__make_dryrun) \
|
||||
|| test -d "$(distdir)/$$subdir" \
|
||||
|| $(MKDIR_P) "$(distdir)/$$subdir" \
|
||||
|| exit 1; \
|
||||
dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
|
||||
$(am__relativize); \
|
||||
new_distdir=$$reldir; \
|
||||
|
|
@ -561,10 +583,15 @@ install-am: all-am
|
|||
|
||||
installcheck: installcheck-recursive
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
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:
|
||||
|
|
|
|||
125
tools/gitlog2changelog.py
Executable file
125
tools/gitlog2changelog.py
Executable file
|
|
@ -0,0 +1,125 @@
|
|||
#!/usr/bin/env python
|
||||
# Copyright 2008 Marcus D. Hanwell <marcus@cryos.org>
|
||||
# Minor changes for NUT by Charles Lepple
|
||||
# Distributed under the terms of the GNU General Public License v2 or later
|
||||
|
||||
import string, re, os
|
||||
from textwrap import TextWrapper
|
||||
import sys
|
||||
|
||||
rev_range = ''
|
||||
|
||||
if len(sys.argv) > 1:
|
||||
base = sys.argv[1]
|
||||
rev_range = '%s..HEAD' % base
|
||||
|
||||
# Execute git log with the desired command line options.
|
||||
fin = os.popen('git log --summary --stat --no-merges --date=short %s' % rev_range, 'r')
|
||||
# Create a ChangeLog file in the current directory.
|
||||
fout = open('ChangeLog', 'w')
|
||||
|
||||
# Set up the loop variables in order to locate the blocks we want
|
||||
authorFound = False
|
||||
dateFound = False
|
||||
messageFound = False
|
||||
filesFound = False
|
||||
message = ""
|
||||
messageNL = False
|
||||
files = ""
|
||||
prevAuthorLine = ""
|
||||
|
||||
wrapper = TextWrapper(initial_indent="\t", subsequent_indent="\t ")
|
||||
|
||||
# The main part of the loop
|
||||
for line in fin:
|
||||
# The commit line marks the start of a new commit object.
|
||||
if line.startswith('commit'):
|
||||
# Start all over again...
|
||||
authorFound = False
|
||||
dateFound = False
|
||||
messageFound = False
|
||||
messageNL = False
|
||||
message = ""
|
||||
filesFound = False
|
||||
files = ""
|
||||
continue
|
||||
# Match the author line and extract the part we want
|
||||
elif 'Author:' in line:
|
||||
authorList = re.split(': ', line, 1)
|
||||
author = authorList[1]
|
||||
author = author[0:len(author)-1]
|
||||
authorFound = True
|
||||
# Match the date line
|
||||
elif 'Date:' in line:
|
||||
dateList = re.split(': ', line, 1)
|
||||
date = dateList[1]
|
||||
date = date[0:len(date)-1]
|
||||
dateFound = True
|
||||
# The Fossil-IDs are ignored:
|
||||
elif line.startswith(' Fossil-ID:') or line.startswith(' [[SVN:'):
|
||||
continue
|
||||
# The svn-id lines are ignored
|
||||
elif ' git-svn-id:' in line:
|
||||
continue
|
||||
# The sign off line is ignored too
|
||||
elif 'Signed-off-by' in line:
|
||||
continue
|
||||
# Extract the actual commit message for this commit
|
||||
elif authorFound & dateFound & messageFound == False:
|
||||
# Find the commit message if we can
|
||||
if len(line) == 1:
|
||||
if messageNL:
|
||||
messageFound = True
|
||||
else:
|
||||
messageNL = True
|
||||
elif len(line) == 4:
|
||||
messageFound = True
|
||||
else:
|
||||
if len(message) == 0:
|
||||
message = message + line.strip()
|
||||
else:
|
||||
message = message + " " + line.strip()
|
||||
# If this line is hit all of the files have been stored for this commit
|
||||
elif re.search('files? changed', line) >= 0:
|
||||
filesFound = True
|
||||
continue
|
||||
# Collect the files for this commit. FIXME: Still need to add +/- to files
|
||||
elif authorFound & dateFound & messageFound:
|
||||
fileList = re.split(' \| ', line, 2)
|
||||
if len(fileList) > 1:
|
||||
if len(files) > 0:
|
||||
files = files + ", " + fileList[0].strip()
|
||||
else:
|
||||
files = fileList[0].strip()
|
||||
# All of the parts of the commit have been found - write out the entry
|
||||
if authorFound & dateFound & messageFound & filesFound:
|
||||
# First the author line, only outputted if it is the first for that
|
||||
# author on this day
|
||||
authorLine = date + " " + author
|
||||
if len(prevAuthorLine) == 0:
|
||||
fout.write(authorLine + "\n\n")
|
||||
elif authorLine == prevAuthorLine:
|
||||
pass
|
||||
else:
|
||||
fout.write("\n" + authorLine + "\n\n")
|
||||
|
||||
# Assemble the actual commit message line(s) and limit the line length
|
||||
# to 80 characters.
|
||||
commitLine = "* " + files + ": " + message
|
||||
|
||||
# Write out the commit line
|
||||
fout.write(wrapper.fill(commitLine) + "\n")
|
||||
|
||||
#Now reset all the variables ready for a new commit block.
|
||||
authorFound = False
|
||||
dateFound = False
|
||||
messageFound = False
|
||||
messageNL = False
|
||||
message = ""
|
||||
filesFound = False
|
||||
files = ""
|
||||
prevAuthorLine = authorLine
|
||||
|
||||
# Close the input and output lines now that we are finished.
|
||||
fin.close()
|
||||
fout.close()
|
||||
|
|
@ -200,7 +200,7 @@ def buildHTMLTable(deviceData):
|
|||
except:
|
||||
cH = False
|
||||
|
||||
if cH and cH.get("text") == cellContent:
|
||||
if not column["name"] == "driver" and cH and cH.get("text") == cellContent:
|
||||
cH["rowspan"] = cH.get("rowspan", 1) + 1
|
||||
else:
|
||||
cell = { "text": cellContent, "rowspan": 1 }
|
||||
|
|
|
|||
|
|
@ -9,15 +9,19 @@ if WITH_LIBLTDL
|
|||
lib_LTLIBRARIES = libnutscan.la
|
||||
endif
|
||||
libnutscan_la_SOURCES = scan_nut.c scan_ipmi.c \
|
||||
nutscan-device.c nutscan-ip.c nutscan-display.c nutscan-init.c \
|
||||
scan_usb.c scan_snmp.c scan_xml_http.c scan_avahi.c
|
||||
nutscan-device.c nutscan-ip.c nutscan-display.c \
|
||||
nutscan-init.c scan_usb.c scan_snmp.c scan_xml_http.c \
|
||||
scan_avahi.c scan_eaton_serial.c nutscan-serial.c \
|
||||
$(top_srcdir)/drivers/serial.c \
|
||||
$(top_srcdir)/drivers/bcmxcp_ser.c \
|
||||
$(top_srcdir)/common/common.c
|
||||
libnutscan_la_LIBADD = $(NETLIBS) $(LIBLTDL_LIBS)
|
||||
libnutscan_la_LDFLAGS = -version-info 1:0:0
|
||||
libnutscan_la_CFLAGS = -I$(top_srcdir)/clients -I$(top_srcdir)/include $(LIBLTDL_CFLAGS)
|
||||
libnutscan_la_LDFLAGS = $(SERLIBS) -version-info 1:0:0
|
||||
libnutscan_la_CFLAGS = -I$(top_srcdir)/clients -I$(top_srcdir)/include $(LIBLTDL_CFLAGS) -I$(top_srcdir)/drivers
|
||||
|
||||
nut_scanner_SOURCES = nut-scanner.c
|
||||
nut_scanner_CFLAGS = -I$(top_srcdir)/clients -I$(top_srcdir)/include
|
||||
nut_scanner_LDADD = libnutscan.la
|
||||
nut_scanner_LDADD = libnutscan.la ../../common/libcommon.la
|
||||
|
||||
if WITH_SSL
|
||||
libnutscan_la_CFLAGS += $(LIBSSL_CFLAGS)
|
||||
|
|
@ -44,7 +48,7 @@ dist_noinst_HEADERS = nutscan-usb.h nutscan-snmp.h
|
|||
if WITH_DEV
|
||||
include_HEADERS = nut-scan.h nutscan-device.h nutscan-ip.h nutscan-init.h
|
||||
else
|
||||
dist_noinst_HEADERS += nut-scan.h nutscan-device.h nutscan-ip.h nutscan-init.h
|
||||
dist_noinst_HEADERS += nut-scan.h nutscan-device.h nutscan-ip.h nutscan-init.h nutscan-serial.h
|
||||
endif
|
||||
|
||||
CLEANFILES = nutscan-usb.h nutscan-snmp.h
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
# Makefile.in generated by automake 1.11.1 from Makefile.am.
|
||||
# Makefile.in generated by automake 1.11.6 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
|
||||
# Inc.
|
||||
# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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.
|
||||
|
|
@ -18,6 +18,23 @@
|
|||
|
||||
|
||||
VPATH = @srcdir@
|
||||
am__make_dryrun = \
|
||||
{ \
|
||||
am__dry=no; \
|
||||
case $$MAKEFLAGS in \
|
||||
*\\[\ \ ]*) \
|
||||
echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
|
||||
| grep '^AM OK$$' >/dev/null || am__dry=yes;; \
|
||||
*) \
|
||||
for am__flg in $$MAKEFLAGS; do \
|
||||
case $$am__flg in \
|
||||
*=*|--*) ;; \
|
||||
*n*) am__dry=yes; break;; \
|
||||
esac; \
|
||||
done;; \
|
||||
esac; \
|
||||
test $$am__dry = yes; \
|
||||
}
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
|
|
@ -45,7 +62,7 @@ target_triplet = @target@
|
|||
@WITH_NEON_TRUE@am__append_5 = $(LIBNEON_CFLAGS)
|
||||
@WITH_AVAHI_TRUE@am__append_6 = $(LIBAVAHI_CFLAGS)
|
||||
@WITH_IPMI_TRUE@am__append_7 = $(LIBIPMI_CFLAGS)
|
||||
@WITH_DEV_FALSE@am__append_8 = nut-scan.h nutscan-device.h nutscan-ip.h nutscan-init.h
|
||||
@WITH_DEV_FALSE@am__append_8 = nut-scan.h nutscan-device.h nutscan-ip.h nutscan-init.h nutscan-serial.h
|
||||
subdir = tools/nut-scanner
|
||||
DIST_COMMON = README $(am__dist_noinst_HEADERS_DIST) \
|
||||
$(am__include_HEADERS_DIST) $(srcdir)/Makefile.am \
|
||||
|
|
@ -64,8 +81,9 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \
|
|||
$(top_srcdir)/m4/nut_check_libltdl.m4 \
|
||||
$(top_srcdir)/m4/nut_check_libneon.m4 \
|
||||
$(top_srcdir)/m4/nut_check_libnetsnmp.m4 \
|
||||
$(top_srcdir)/m4/nut_check_libnss.m4 \
|
||||
$(top_srcdir)/m4/nut_check_libopenssl.m4 \
|
||||
$(top_srcdir)/m4/nut_check_libpowerman.m4 \
|
||||
$(top_srcdir)/m4/nut_check_libssl.m4 \
|
||||
$(top_srcdir)/m4/nut_check_libusb.m4 \
|
||||
$(top_srcdir)/m4/nut_check_libwrap.m4 \
|
||||
$(top_srcdir)/m4/nut_check_os.m4 \
|
||||
|
|
@ -100,6 +118,12 @@ am__nobase_list = $(am__nobase_strip_setup); \
|
|||
am__base_list = \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
|
||||
am__uninstall_files_from_dir = { \
|
||||
test -z "$$files" \
|
||||
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|
||||
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
|
||||
$(am__cd) "$$dir" && rm -f $$files; }; \
|
||||
}
|
||||
am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" \
|
||||
"$(DESTDIR)$(includedir)"
|
||||
LTLIBRARIES = $(lib_LTLIBRARIES)
|
||||
|
|
@ -112,7 +136,9 @@ am_libnutscan_la_OBJECTS = libnutscan_la-scan_nut.lo \
|
|||
libnutscan_la-nutscan-ip.lo libnutscan_la-nutscan-display.lo \
|
||||
libnutscan_la-nutscan-init.lo libnutscan_la-scan_usb.lo \
|
||||
libnutscan_la-scan_snmp.lo libnutscan_la-scan_xml_http.lo \
|
||||
libnutscan_la-scan_avahi.lo
|
||||
libnutscan_la-scan_avahi.lo libnutscan_la-scan_eaton_serial.lo \
|
||||
libnutscan_la-nutscan-serial.lo libnutscan_la-serial.lo \
|
||||
libnutscan_la-bcmxcp_ser.lo libnutscan_la-common.lo
|
||||
libnutscan_la_OBJECTS = $(am_libnutscan_la_OBJECTS)
|
||||
libnutscan_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(libnutscan_la_CFLAGS) \
|
||||
|
|
@ -121,7 +147,7 @@ libnutscan_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
|
|||
PROGRAMS = $(bin_PROGRAMS)
|
||||
am_nut_scanner_OBJECTS = nut_scanner-nut-scanner.$(OBJEXT)
|
||||
nut_scanner_OBJECTS = $(am_nut_scanner_OBJECTS)
|
||||
nut_scanner_DEPENDENCIES = libnutscan.la
|
||||
nut_scanner_DEPENDENCIES = libnutscan.la ../../common/libcommon.la
|
||||
nut_scanner_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(nut_scanner_CFLAGS) \
|
||||
$(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||
|
|
@ -140,8 +166,13 @@ LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
|
|||
$(LDFLAGS) -o $@
|
||||
SOURCES = $(libnutscan_la_SOURCES) $(nut_scanner_SOURCES)
|
||||
DIST_SOURCES = $(libnutscan_la_SOURCES) $(nut_scanner_SOURCES)
|
||||
am__can_run_installinfo = \
|
||||
case $$AM_UPDATE_INFO_DIR in \
|
||||
n|no|NO) false;; \
|
||||
*) (install-info --version) >/dev/null 2>&1;; \
|
||||
esac
|
||||
am__dist_noinst_HEADERS_DIST = nutscan-usb.h nutscan-snmp.h nut-scan.h \
|
||||
nutscan-device.h nutscan-ip.h nutscan-init.h
|
||||
nutscan-device.h nutscan-ip.h nutscan-init.h nutscan-serial.h
|
||||
am__include_HEADERS_DIST = nut-scan.h nutscan-device.h nutscan-ip.h \
|
||||
nutscan-init.h
|
||||
HEADERS = $(dist_noinst_HEADERS) $(include_HEADERS)
|
||||
|
|
@ -153,6 +184,7 @@ ACLOCAL = @ACLOCAL@
|
|||
AMTAR = @AMTAR@
|
||||
AR = @AR@
|
||||
ASCIIDOC = @ASCIIDOC@
|
||||
ASPELL = @ASPELL@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
|
|
@ -179,6 +211,7 @@ DOC_BUILD_LIST = @DOC_BUILD_LIST@
|
|||
DRIVER_BUILD_LIST = @DRIVER_BUILD_LIST@
|
||||
DRIVER_INSTALL_TARGET = @DRIVER_INSTALL_TARGET@
|
||||
DRIVER_MAN_LIST = @DRIVER_MAN_LIST@
|
||||
DRVPATH = @DRVPATH@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO_C = @ECHO_C@
|
||||
|
|
@ -334,18 +367,22 @@ udevdir = @udevdir@
|
|||
BUILT_SOURCES = nutscan-usb.h nutscan-snmp.h
|
||||
@WITH_LIBLTDL_TRUE@lib_LTLIBRARIES = libnutscan.la
|
||||
libnutscan_la_SOURCES = scan_nut.c scan_ipmi.c \
|
||||
nutscan-device.c nutscan-ip.c nutscan-display.c nutscan-init.c \
|
||||
scan_usb.c scan_snmp.c scan_xml_http.c scan_avahi.c
|
||||
nutscan-device.c nutscan-ip.c nutscan-display.c \
|
||||
nutscan-init.c scan_usb.c scan_snmp.c scan_xml_http.c \
|
||||
scan_avahi.c scan_eaton_serial.c nutscan-serial.c \
|
||||
$(top_srcdir)/drivers/serial.c \
|
||||
$(top_srcdir)/drivers/bcmxcp_ser.c \
|
||||
$(top_srcdir)/common/common.c
|
||||
|
||||
libnutscan_la_LIBADD = $(NETLIBS) $(LIBLTDL_LIBS) $(am__append_2)
|
||||
libnutscan_la_LDFLAGS = -version-info 1:0:0
|
||||
libnutscan_la_LDFLAGS = $(SERLIBS) -version-info 1:0:0
|
||||
libnutscan_la_CFLAGS = -I$(top_srcdir)/clients -I$(top_srcdir)/include \
|
||||
$(LIBLTDL_CFLAGS) $(am__append_1) $(am__append_3) \
|
||||
$(am__append_4) $(am__append_5) $(am__append_6) \
|
||||
$(am__append_7)
|
||||
$(LIBLTDL_CFLAGS) -I$(top_srcdir)/drivers $(am__append_1) \
|
||||
$(am__append_3) $(am__append_4) $(am__append_5) \
|
||||
$(am__append_6) $(am__append_7)
|
||||
nut_scanner_SOURCES = nut-scanner.c
|
||||
nut_scanner_CFLAGS = -I$(top_srcdir)/clients -I$(top_srcdir)/include
|
||||
nut_scanner_LDADD = libnutscan.la
|
||||
nut_scanner_LDADD = libnutscan.la ../../common/libcommon.la
|
||||
dist_noinst_HEADERS = nutscan-usb.h nutscan-snmp.h $(am__append_8)
|
||||
@WITH_DEV_TRUE@include_HEADERS = nut-scan.h nutscan-device.h nutscan-ip.h nutscan-init.h
|
||||
CLEANFILES = nutscan-usb.h nutscan-snmp.h
|
||||
|
|
@ -386,7 +423,6 @@ $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
|
|||
$(am__aclocal_m4_deps):
|
||||
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
|
||||
@$(NORMAL_INSTALL)
|
||||
test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
|
||||
@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
|
||||
list2=; for p in $$list; do \
|
||||
if test -f $$p; then \
|
||||
|
|
@ -394,6 +430,8 @@ install-libLTLIBRARIES: $(lib_LTLIBRARIES)
|
|||
else :; fi; \
|
||||
done; \
|
||||
test -z "$$list2" || { \
|
||||
echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \
|
||||
$(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \
|
||||
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
|
||||
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
|
||||
}
|
||||
|
|
@ -415,12 +453,15 @@ clean-libLTLIBRARIES:
|
|||
echo "rm -f \"$${dir}/so_locations\""; \
|
||||
rm -f "$${dir}/so_locations"; \
|
||||
done
|
||||
libnutscan.la: $(libnutscan_la_OBJECTS) $(libnutscan_la_DEPENDENCIES)
|
||||
libnutscan.la: $(libnutscan_la_OBJECTS) $(libnutscan_la_DEPENDENCIES) $(EXTRA_libnutscan_la_DEPENDENCIES)
|
||||
$(libnutscan_la_LINK) $(am_libnutscan_la_rpath) $(libnutscan_la_OBJECTS) $(libnutscan_la_LIBADD) $(LIBS)
|
||||
install-binPROGRAMS: $(bin_PROGRAMS)
|
||||
@$(NORMAL_INSTALL)
|
||||
test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
|
||||
@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; \
|
||||
|
|
@ -460,7 +501,7 @@ clean-binPROGRAMS:
|
|||
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
|
||||
echo " rm -f" $$list; \
|
||||
rm -f $$list
|
||||
nut-scanner$(EXEEXT): $(nut_scanner_OBJECTS) $(nut_scanner_DEPENDENCIES)
|
||||
nut-scanner$(EXEEXT): $(nut_scanner_OBJECTS) $(nut_scanner_DEPENDENCIES) $(EXTRA_nut_scanner_DEPENDENCIES)
|
||||
@rm -f nut-scanner$(EXEEXT)
|
||||
$(nut_scanner_LINK) $(nut_scanner_OBJECTS) $(nut_scanner_LDADD) $(LIBS)
|
||||
|
||||
|
|
@ -470,16 +511,21 @@ mostlyclean-compile:
|
|||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnutscan_la-bcmxcp_ser.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnutscan_la-common.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnutscan_la-nutscan-device.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnutscan_la-nutscan-display.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnutscan_la-nutscan-init.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnutscan_la-nutscan-ip.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnutscan_la-nutscan-serial.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnutscan_la-scan_avahi.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnutscan_la-scan_eaton_serial.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnutscan_la-scan_ipmi.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnutscan_la-scan_nut.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnutscan_la-scan_snmp.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnutscan_la-scan_usb.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnutscan_la-scan_xml_http.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnutscan_la-serial.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nut_scanner-nut-scanner.Po@am__quote@
|
||||
|
||||
.c.o:
|
||||
|
|
@ -573,6 +619,41 @@ libnutscan_la-scan_avahi.lo: scan_avahi.c
|
|||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnutscan_la_CFLAGS) $(CFLAGS) -c -o libnutscan_la-scan_avahi.lo `test -f 'scan_avahi.c' || echo '$(srcdir)/'`scan_avahi.c
|
||||
|
||||
libnutscan_la-scan_eaton_serial.lo: scan_eaton_serial.c
|
||||
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnutscan_la_CFLAGS) $(CFLAGS) -MT libnutscan_la-scan_eaton_serial.lo -MD -MP -MF $(DEPDIR)/libnutscan_la-scan_eaton_serial.Tpo -c -o libnutscan_la-scan_eaton_serial.lo `test -f 'scan_eaton_serial.c' || echo '$(srcdir)/'`scan_eaton_serial.c
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libnutscan_la-scan_eaton_serial.Tpo $(DEPDIR)/libnutscan_la-scan_eaton_serial.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='scan_eaton_serial.c' object='libnutscan_la-scan_eaton_serial.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnutscan_la_CFLAGS) $(CFLAGS) -c -o libnutscan_la-scan_eaton_serial.lo `test -f 'scan_eaton_serial.c' || echo '$(srcdir)/'`scan_eaton_serial.c
|
||||
|
||||
libnutscan_la-nutscan-serial.lo: nutscan-serial.c
|
||||
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnutscan_la_CFLAGS) $(CFLAGS) -MT libnutscan_la-nutscan-serial.lo -MD -MP -MF $(DEPDIR)/libnutscan_la-nutscan-serial.Tpo -c -o libnutscan_la-nutscan-serial.lo `test -f 'nutscan-serial.c' || echo '$(srcdir)/'`nutscan-serial.c
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libnutscan_la-nutscan-serial.Tpo $(DEPDIR)/libnutscan_la-nutscan-serial.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nutscan-serial.c' object='libnutscan_la-nutscan-serial.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnutscan_la_CFLAGS) $(CFLAGS) -c -o libnutscan_la-nutscan-serial.lo `test -f 'nutscan-serial.c' || echo '$(srcdir)/'`nutscan-serial.c
|
||||
|
||||
libnutscan_la-serial.lo: $(top_srcdir)/drivers/serial.c
|
||||
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnutscan_la_CFLAGS) $(CFLAGS) -MT libnutscan_la-serial.lo -MD -MP -MF $(DEPDIR)/libnutscan_la-serial.Tpo -c -o libnutscan_la-serial.lo `test -f '$(top_srcdir)/drivers/serial.c' || echo '$(srcdir)/'`$(top_srcdir)/drivers/serial.c
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libnutscan_la-serial.Tpo $(DEPDIR)/libnutscan_la-serial.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/drivers/serial.c' object='libnutscan_la-serial.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnutscan_la_CFLAGS) $(CFLAGS) -c -o libnutscan_la-serial.lo `test -f '$(top_srcdir)/drivers/serial.c' || echo '$(srcdir)/'`$(top_srcdir)/drivers/serial.c
|
||||
|
||||
libnutscan_la-bcmxcp_ser.lo: $(top_srcdir)/drivers/bcmxcp_ser.c
|
||||
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnutscan_la_CFLAGS) $(CFLAGS) -MT libnutscan_la-bcmxcp_ser.lo -MD -MP -MF $(DEPDIR)/libnutscan_la-bcmxcp_ser.Tpo -c -o libnutscan_la-bcmxcp_ser.lo `test -f '$(top_srcdir)/drivers/bcmxcp_ser.c' || echo '$(srcdir)/'`$(top_srcdir)/drivers/bcmxcp_ser.c
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libnutscan_la-bcmxcp_ser.Tpo $(DEPDIR)/libnutscan_la-bcmxcp_ser.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/drivers/bcmxcp_ser.c' object='libnutscan_la-bcmxcp_ser.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnutscan_la_CFLAGS) $(CFLAGS) -c -o libnutscan_la-bcmxcp_ser.lo `test -f '$(top_srcdir)/drivers/bcmxcp_ser.c' || echo '$(srcdir)/'`$(top_srcdir)/drivers/bcmxcp_ser.c
|
||||
|
||||
libnutscan_la-common.lo: $(top_srcdir)/common/common.c
|
||||
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnutscan_la_CFLAGS) $(CFLAGS) -MT libnutscan_la-common.lo -MD -MP -MF $(DEPDIR)/libnutscan_la-common.Tpo -c -o libnutscan_la-common.lo `test -f '$(top_srcdir)/common/common.c' || echo '$(srcdir)/'`$(top_srcdir)/common/common.c
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libnutscan_la-common.Tpo $(DEPDIR)/libnutscan_la-common.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/common/common.c' object='libnutscan_la-common.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnutscan_la_CFLAGS) $(CFLAGS) -c -o libnutscan_la-common.lo `test -f '$(top_srcdir)/common/common.c' || echo '$(srcdir)/'`$(top_srcdir)/common/common.c
|
||||
|
||||
nut_scanner-nut-scanner.o: nut-scanner.c
|
||||
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nut_scanner_CFLAGS) $(CFLAGS) -MT nut_scanner-nut-scanner.o -MD -MP -MF $(DEPDIR)/nut_scanner-nut-scanner.Tpo -c -o nut_scanner-nut-scanner.o `test -f 'nut-scanner.c' || echo '$(srcdir)/'`nut-scanner.c
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/nut_scanner-nut-scanner.Tpo $(DEPDIR)/nut_scanner-nut-scanner.Po
|
||||
|
|
@ -594,8 +675,11 @@ clean-libtool:
|
|||
-rm -rf .libs _libs
|
||||
install-includeHEADERS: $(include_HEADERS)
|
||||
@$(NORMAL_INSTALL)
|
||||
test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)"
|
||||
@list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
|
||||
if test -n "$$list"; then \
|
||||
echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \
|
||||
$(MKDIR_P) "$(DESTDIR)$(includedir)" || exit 1; \
|
||||
fi; \
|
||||
for p in $$list; do \
|
||||
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
|
||||
echo "$$d$$p"; \
|
||||
|
|
@ -609,9 +693,7 @@ uninstall-includeHEADERS:
|
|||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
|
||||
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
|
||||
test -n "$$files" || exit 0; \
|
||||
echo " ( cd '$(DESTDIR)$(includedir)' && rm -f" $$files ")"; \
|
||||
cd "$(DESTDIR)$(includedir)" && rm -f $$files
|
||||
dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir)
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
|
|
@ -716,10 +798,15 @@ install-am: all-am
|
|||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
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:
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
/* nut-scan.h: detect NUT services
|
||||
*
|
||||
* Copyright (C) 2011 - Frederic Bohe <fredericbohe@eaton.com>
|
||||
* Copyright (C)
|
||||
* 2011 - Frederic Bohe <fredericbohe@eaton.com>
|
||||
* 2012 - Arnaud Quette <arnaud.quette@free.fr>
|
||||
*
|
||||
* 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
|
||||
|
|
@ -16,6 +18,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef NUT_SCAN_H
|
||||
#define NUT_SCAN_H
|
||||
|
||||
|
|
@ -23,6 +26,16 @@
|
|||
#include <nutscan-device.h>
|
||||
#include <nutscan-ip.h>
|
||||
|
||||
#ifdef WITH_IPMI
|
||||
#include <freeipmi/freeipmi.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
extern "C" {
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
|
||||
/* SNMP structure */
|
||||
typedef struct nutscan_snmp {
|
||||
char * community;
|
||||
|
|
@ -36,8 +49,37 @@ typedef struct nutscan_snmp {
|
|||
void * handle;
|
||||
} nutscan_snmp_t;
|
||||
|
||||
/* IPMI structure */
|
||||
/* Settings for OutofBand (remote) connection */
|
||||
typedef struct nutscan_ipmi {
|
||||
char* username; /* IPMI 1.5 and 2.0 */
|
||||
char* password; /* IPMI 1.5 and 2.0 */
|
||||
int authentication_type; /* IPMI 1.5 */
|
||||
int cipher_suite_id; /* IPMI 2.0 */
|
||||
char* K_g_BMC_key; /* IPMI 2.0, optional key for 2 key auth. */
|
||||
int privilege_level; /* for both */
|
||||
unsigned int workaround_flags; /* for both */
|
||||
int ipmi_version; /* IPMI 1.5 or 2.0? */
|
||||
} nutscan_ipmi_t;
|
||||
|
||||
/* IPMI auth defines, simply using FreeIPMI defines */
|
||||
#ifndef IPMI_AUTHENTICATION_TYPE_NONE
|
||||
#define IPMI_AUTHENTICATION_TYPE_NONE 0x00
|
||||
#define IPMI_AUTHENTICATION_TYPE_MD2 0x01
|
||||
#define IPMI_AUTHENTICATION_TYPE_MD5 0x02
|
||||
#define IPMI_AUTHENTICATION_TYPE_STRAIGHT_PASSWORD_KEY 0x04
|
||||
#define IPMI_AUTHENTICATION_TYPE_OEM_PROP 0x05
|
||||
#define IPMI_AUTHENTICATION_TYPE_RMCPPLUS 0x06
|
||||
#endif
|
||||
#ifndef IPMI_PRIVILEGE_LEVEL_ADMIN
|
||||
#define IPMI_PRIVILEGE_LEVEL_ADMIN 0x04
|
||||
#endif
|
||||
|
||||
#define IPMI_1_5 1
|
||||
#define IPMI_2_0 0
|
||||
|
||||
/* Scanning */
|
||||
nutscan_device_t * nutscan_scan_snmp(const char * start_ip,const char * stop_ip,long usec_timeout, nutscan_snmp_t * sec);
|
||||
nutscan_device_t * nutscan_scan_snmp(const char * start_ip, const char * stop_ip, long usec_timeout, nutscan_snmp_t * sec);
|
||||
|
||||
nutscan_device_t * nutscan_scan_usb();
|
||||
|
||||
|
|
@ -47,10 +89,18 @@ nutscan_device_t * nutscan_scan_nut(const char * startIP, const char * stopIP, c
|
|||
|
||||
nutscan_device_t * nutscan_scan_avahi(long usec_timeout);
|
||||
|
||||
nutscan_device_t * nutscan_scan_ipmi(void);
|
||||
nutscan_device_t * nutscan_scan_ipmi(const char * startIP, const char * stopIP, nutscan_ipmi_t * sec);
|
||||
|
||||
nutscan_device_t * nutscan_scan_eaton_serial(const char* ports_list);
|
||||
|
||||
/* Display functions */
|
||||
void nutscan_display_ups_conf(nutscan_device_t * device);
|
||||
void nutscan_display_parsable(nutscan_device_t * device);
|
||||
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -35,13 +35,14 @@
|
|||
|
||||
#define ERR_BAD_OPTION (-1)
|
||||
|
||||
const char optstring[] = "?ht:s:e:c:l:u:W:X:w:x:p:CUSMOAm:NPqIVa";
|
||||
const char optstring[] = "?ht:s:e:E:c:l:u:W:X:w:x:p:b:B:d:D:CUSMOAm:NPqIVa";
|
||||
|
||||
#ifdef HAVE_GETOPT_LONG
|
||||
const struct option longopts[] =
|
||||
{{ "timeout",required_argument,NULL,'t' },
|
||||
{ "start_ip",required_argument,NULL,'s' },
|
||||
{ "end_ip",required_argument,NULL,'e' },
|
||||
{ "eaton_serial",required_argument,NULL,'E' },
|
||||
{ "mask_cidr",required_argument,NULL,'m' },
|
||||
{ "community",required_argument,NULL,'c' },
|
||||
{ "secLevel",required_argument,NULL,'l' },
|
||||
|
|
@ -50,6 +51,10 @@ const struct option longopts[] =
|
|||
{ "privPassword",required_argument,NULL,'X' },
|
||||
{ "authProtocol",required_argument,NULL,'w' },
|
||||
{ "privProtocol",required_argument,NULL,'x' },
|
||||
{ "username",required_argument,NULL,'b' },
|
||||
{ "password",required_argument,NULL,'B' },
|
||||
{ "authType",required_argument,NULL,'d' },
|
||||
{ "cipher_suite_id",required_argument,NULL,'D' },
|
||||
{ "port",required_argument,NULL,'p' },
|
||||
{ "complete_scan",no_argument,NULL,'C' },
|
||||
{ "usb_scan",no_argument,NULL,'U' },
|
||||
|
|
@ -75,6 +80,7 @@ static long timeout = DEFAULT_TIMEOUT*1000*1000; /* in usec */
|
|||
static char * start_ip = NULL;
|
||||
static char * end_ip = NULL;
|
||||
static char * port = NULL;
|
||||
static char * serial_ports = NULL;
|
||||
|
||||
#ifdef HAVE_PTHREAD
|
||||
static pthread_t thread[TYPE_END];
|
||||
|
|
@ -110,11 +116,20 @@ static void * run_avahi(void * arg)
|
|||
}
|
||||
static void * run_ipmi(void * arg)
|
||||
{
|
||||
dev[TYPE_IPMI] = nutscan_scan_ipmi();
|
||||
nutscan_ipmi_t * sec = (nutscan_ipmi_t *)arg;
|
||||
|
||||
dev[TYPE_IPMI] = nutscan_scan_ipmi(start_ip,end_ip,sec);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void * run_eaton_serial(void * arg)
|
||||
{
|
||||
dev[TYPE_EATON_SERIAL] = nutscan_scan_eaton_serial (serial_ports);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#endif /* HAVE_PTHREAD */
|
||||
static int printq(int quiet,const char *fmt, ...)
|
||||
int printq(int quiet,const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
int ret;
|
||||
|
|
@ -133,6 +148,7 @@ static int printq(int quiet,const char *fmt, ...)
|
|||
int main(int argc, char *argv[])
|
||||
{
|
||||
nutscan_snmp_t snmp_sec;
|
||||
nutscan_ipmi_t ipmi_sec;
|
||||
int opt_ret;
|
||||
char * cidr = NULL;
|
||||
int allow_all = 0;
|
||||
|
|
@ -142,11 +158,18 @@ int main(int argc, char *argv[])
|
|||
int allow_oldnut = 0;
|
||||
int allow_avahi = 0;
|
||||
int allow_ipmi = 0;
|
||||
int allow_eaton_serial = 0; /* MUST be requested explicitely! */
|
||||
int quiet = 0;
|
||||
void (*display_func)(nutscan_device_t * device);
|
||||
int ret_code = EXIT_SUCCESS;
|
||||
|
||||
memset(&snmp_sec, 0, sizeof(snmp_sec));
|
||||
memset(&ipmi_sec, 0, sizeof(ipmi_sec));
|
||||
/* Set the default values for IPMI */
|
||||
ipmi_sec.authentication_type = IPMI_AUTHENTICATION_TYPE_MD5;
|
||||
ipmi_sec.ipmi_version = IPMI_1_5; /* default to IPMI 1.5, if not otherwise specified */
|
||||
ipmi_sec.cipher_suite_id = 3; /* default to HMAC-SHA1; HMAC-SHA1-96; AES-CBC-128 */
|
||||
ipmi_sec.privilege_level = IPMI_PRIVILEGE_LEVEL_ADMIN; /* should be sufficient */
|
||||
|
||||
nutscan_init();
|
||||
|
||||
|
|
@ -169,6 +192,10 @@ int main(int argc, char *argv[])
|
|||
case 'e':
|
||||
end_ip = strdup(optarg);
|
||||
break;
|
||||
case 'E':
|
||||
serial_ports = strdup(optarg);
|
||||
allow_eaton_serial = 1;
|
||||
break;
|
||||
case 'm':
|
||||
cidr = strdup(optarg);
|
||||
break;
|
||||
|
|
@ -220,6 +247,46 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
allow_snmp = 1;
|
||||
break;
|
||||
case 'b':
|
||||
if(!nutscan_avail_ipmi) {
|
||||
goto display_help;
|
||||
}
|
||||
ipmi_sec.username = strdup(optarg);
|
||||
break;
|
||||
case 'B':
|
||||
if(!nutscan_avail_ipmi) {
|
||||
goto display_help;
|
||||
}
|
||||
ipmi_sec.password = strdup(optarg);
|
||||
break;
|
||||
case 'd':
|
||||
if(!nutscan_avail_ipmi) {
|
||||
goto display_help;
|
||||
}
|
||||
if (!strcmp(optarg, "NONE")) {
|
||||
ipmi_sec.authentication_type = IPMI_AUTHENTICATION_TYPE_NONE;
|
||||
}
|
||||
else if (!strcmp(optarg, "STRAIGHT_PASSWORD_KEY")) {
|
||||
ipmi_sec.authentication_type = IPMI_AUTHENTICATION_TYPE_STRAIGHT_PASSWORD_KEY;
|
||||
}
|
||||
else if (!strcmp(optarg, "MD2")) {
|
||||
ipmi_sec.authentication_type = IPMI_AUTHENTICATION_TYPE_MD2;
|
||||
}
|
||||
else if (!strcmp(optarg, "MD5")) {
|
||||
ipmi_sec.authentication_type = IPMI_AUTHENTICATION_TYPE_MD5;
|
||||
}
|
||||
else {
|
||||
fprintf(stderr,"Unknown authentication type (%s). Defaulting to MD5\n", optarg);
|
||||
}
|
||||
break;
|
||||
case 'D':
|
||||
if(!nutscan_avail_ipmi) {
|
||||
goto display_help;
|
||||
}
|
||||
ipmi_sec.cipher_suite_id = atoi(optarg);
|
||||
/* Force IPMI 2.0! */
|
||||
ipmi_sec.ipmi_version = IPMI_2_0;
|
||||
break;
|
||||
case 'p':
|
||||
port = strdup(optarg);
|
||||
break;
|
||||
|
|
@ -280,8 +347,9 @@ int main(int argc, char *argv[])
|
|||
printf("AVAHI\n");
|
||||
}
|
||||
if(nutscan_avail_ipmi) {
|
||||
printf("IPMI\n");
|
||||
printf("IPMI\n");
|
||||
}
|
||||
printf("EATON_SERIAL\n");
|
||||
exit(EXIT_SUCCESS);
|
||||
case '?':
|
||||
ret_code = ERR_BAD_OPTION;
|
||||
|
|
@ -307,6 +375,10 @@ display_help:
|
|||
if( nutscan_avail_ipmi ) {
|
||||
printf(" -I, --ipmi_scan: Scan IPMI devices.\n");
|
||||
}
|
||||
|
||||
printf(" -E, --eaton_serial <serial ports list>: Scan serial Eaton devices (XCP, SHUT and Q1).\n");
|
||||
|
||||
printf("\nNetwork specific options:\n");
|
||||
printf(" -t, --timeout <timeout in seconds>: network operation timeout (default %d).\n",DEFAULT_TIMEOUT);
|
||||
printf(" -s, --start_ip <IP address>: First IP address to scan.\n");
|
||||
printf(" -e, --end_ip <IP address>: Last IP address to scan.\n");
|
||||
|
|
@ -325,6 +397,18 @@ display_help:
|
|||
printf(" -X, --privPassword <privacy pass phrase>: Set the privacy pass phrase used for encrypted SNMPv3 messages (mandatory if you set secLevel to authPriv)\n");
|
||||
}
|
||||
|
||||
if( nutscan_avail_ipmi ) {
|
||||
printf("\nIPMI over LAN specific options:\n");
|
||||
printf(" -b, --username <username>: Set the username used for authenticating IPMI over LAN connections (mandatory for IPMI over LAN. No default)\n");
|
||||
/* Specify the username to use when authenticating with the remote host. If not specified, a null (i.e. anonymous) username is assumed. The user must have
|
||||
* at least ADMIN privileges in order for this tool to operate fully. */
|
||||
printf(" -B, --password <password>: Specify the password to use when authenticationg with the remote host (mandatory for IPMI over LAN. No default)\n");
|
||||
/* Specify the password to use when authenticationg with the remote host. If not specified, a null password is assumed. Maximum password length is 16 for IPMI
|
||||
* 1.5 and 20 for IPMI 2.0. */
|
||||
printf(" -d, --authType <authentication type>: Specify the IPMI 1.5 authentication type to use (NONE, STRAIGHT_PASSWORD_KEY, MD2, and MD5) with the remote host (default=MD5)\n");
|
||||
printf(" -D, --cipher_suite_id <cipher suite id>: Specify the IPMI 2.0 cipher suite ID to use, for authentication, integrity, and confidentiality (default=3)\n");
|
||||
}
|
||||
|
||||
printf("\nNUT specific options:\n");
|
||||
printf(" -p, --port <port number>: Port number of remote NUT upsd\n");
|
||||
printf("\ndisplay specific options:\n");
|
||||
|
|
@ -344,7 +428,7 @@ display_help:
|
|||
}
|
||||
|
||||
if( !allow_usb && !allow_snmp && !allow_xml && !allow_oldnut &&
|
||||
!allow_avahi && !allow_ipmi ) {
|
||||
!allow_avahi && !allow_ipmi && !allow_eaton_serial) {
|
||||
allow_all = 1;
|
||||
}
|
||||
|
||||
|
|
@ -355,6 +439,7 @@ display_help:
|
|||
allow_oldnut = 1;
|
||||
allow_avahi = 1;
|
||||
allow_ipmi = 1;
|
||||
/* BEWARE: allow_all does not include allow_eaton_serial! */
|
||||
}
|
||||
|
||||
if( allow_usb && nutscan_avail_usb ) {
|
||||
|
|
@ -371,6 +456,7 @@ display_help:
|
|||
if( allow_snmp && nutscan_avail_snmp ) {
|
||||
if( start_ip == NULL ) {
|
||||
printq(quiet,"No start IP, skipping SNMP\n");
|
||||
nutscan_avail_snmp = 0;
|
||||
}
|
||||
else {
|
||||
printq(quiet,"Scanning SNMP bus.\n");
|
||||
|
|
@ -398,6 +484,7 @@ display_help:
|
|||
if( allow_oldnut && nutscan_avail_nut) {
|
||||
if( start_ip == NULL ) {
|
||||
printq(quiet,"No start IP, skipping NUT bus (old connect method)\n");
|
||||
nutscan_avail_nut = 0;
|
||||
}
|
||||
else {
|
||||
printq(quiet,"Scanning NUT bus (old connect method).\n");
|
||||
|
|
@ -425,11 +512,22 @@ display_help:
|
|||
if( allow_ipmi && nutscan_avail_ipmi) {
|
||||
printq(quiet,"Scanning IPMI bus.\n");
|
||||
#ifdef HAVE_PTHREAD
|
||||
if(pthread_create(&thread[TYPE_IPMI],NULL,run_ipmi,NULL)) {
|
||||
if(pthread_create(&thread[TYPE_IPMI],NULL,run_ipmi,&ipmi_sec)) {
|
||||
nutscan_avail_ipmi = 0;
|
||||
}
|
||||
#else
|
||||
dev[TYPE_IPMI] = nutscan_scan_ipmi();
|
||||
dev[TYPE_IPMI] = nutscan_scan_ipmi(start_ip,end_ip,&ipmi_sec);
|
||||
#endif /* HAVE_PTHREAD */
|
||||
}
|
||||
|
||||
/* Eaton serial scan */
|
||||
if (allow_eaton_serial) {
|
||||
printq(quiet,"Scanning serial bus for Eaton devices.\n");
|
||||
#ifdef HAVE_PTHREAD
|
||||
pthread_create(&thread[TYPE_EATON_SERIAL], NULL, run_eaton_serial, serial_ports);
|
||||
/* FIXME: check return code */
|
||||
#else
|
||||
dev[TYPE_EATON_SERIAL] = nutscan_scan_eaton_serial (serial_ports);
|
||||
#endif /* HAVE_PTHREAD */
|
||||
}
|
||||
|
||||
|
|
@ -452,6 +550,9 @@ display_help:
|
|||
if( allow_ipmi && nutscan_avail_ipmi ) {
|
||||
pthread_join(thread[TYPE_IPMI],NULL);
|
||||
}
|
||||
if (allow_eaton_serial) {
|
||||
pthread_join(thread[TYPE_EATON_SERIAL],NULL);
|
||||
}
|
||||
#endif /* HAVE_PTHREAD */
|
||||
|
||||
display_func(dev[TYPE_USB]);
|
||||
|
|
@ -472,6 +573,9 @@ display_help:
|
|||
display_func(dev[TYPE_IPMI]);
|
||||
nutscan_free_device(dev[TYPE_IPMI]);
|
||||
|
||||
display_func(dev[TYPE_EATON_SERIAL]);
|
||||
nutscan_free_device(dev[TYPE_EATON_SERIAL]);
|
||||
|
||||
nutscan_free();
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
|
|
|
|||
|
|
@ -19,6 +19,17 @@
|
|||
#include "nutscan-device.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
const char * nutscan_device_type_strings[TYPE_END - 1] = {
|
||||
"USB",
|
||||
"SNMP",
|
||||
"XML",
|
||||
"NUT",
|
||||
"IPMI",
|
||||
"Avahi",
|
||||
"serial",
|
||||
};
|
||||
|
||||
nutscan_device_t * nutscan_new_device()
|
||||
{
|
||||
|
|
@ -37,7 +48,6 @@ nutscan_device_t * nutscan_new_device()
|
|||
static void deep_free_device(nutscan_device_t * device)
|
||||
{
|
||||
nutscan_options_t * current;
|
||||
nutscan_options_t * old;
|
||||
|
||||
if(device==NULL) {
|
||||
return;
|
||||
|
|
@ -49,18 +59,10 @@ static void deep_free_device(nutscan_device_t * device)
|
|||
free(device->port);
|
||||
}
|
||||
|
||||
current = &device->opt;
|
||||
while (device->opt != NULL) {
|
||||
current = device->opt;
|
||||
device->opt = current->next;
|
||||
|
||||
if(current->option != NULL) {
|
||||
free(current->option);
|
||||
}
|
||||
|
||||
if(current->value != NULL) {
|
||||
free(current->value);
|
||||
}
|
||||
|
||||
current = current->next;
|
||||
while (current != NULL) {
|
||||
if(current->option != NULL) {
|
||||
free(current->option);
|
||||
}
|
||||
|
|
@ -68,9 +70,8 @@ static void deep_free_device(nutscan_device_t * device)
|
|||
if(current->value != NULL) {
|
||||
free(current->value);
|
||||
}
|
||||
old = current;
|
||||
current = current->next;
|
||||
free(old);
|
||||
|
||||
free(current);
|
||||
};
|
||||
|
||||
if(device->prev) {
|
||||
|
|
@ -95,37 +96,38 @@ void nutscan_free_device(nutscan_device_t * device)
|
|||
deep_free_device(device->next);
|
||||
}
|
||||
|
||||
free(device);
|
||||
deep_free_device(device);
|
||||
}
|
||||
|
||||
void nutscan_add_option_to_device(nutscan_device_t * device,char * option, char * value)
|
||||
void nutscan_add_option_to_device(nutscan_device_t * device, char * option, char * value)
|
||||
{
|
||||
nutscan_options_t * opt;
|
||||
nutscan_options_t **opt;
|
||||
|
||||
opt = &(device->opt);
|
||||
/* search for last entry */
|
||||
if( opt->option != NULL ) {
|
||||
while( opt->next != NULL ) {
|
||||
opt = opt->next;
|
||||
}
|
||||
opt = &device->opt;
|
||||
|
||||
opt->next = malloc(sizeof(nutscan_options_t));
|
||||
opt = opt->next;
|
||||
memset(opt,0,sizeof(nutscan_options_t));
|
||||
}
|
||||
while (NULL != *opt)
|
||||
opt = &(*opt)->next;
|
||||
|
||||
*opt = (nutscan_options_t *)malloc(sizeof(nutscan_options_t));
|
||||
|
||||
// TBD: A gracefull way to propagate memory failure would be nice
|
||||
assert(NULL != *opt);
|
||||
|
||||
memset(*opt, 0, sizeof(nutscan_options_t));
|
||||
|
||||
if( option != NULL ) {
|
||||
opt->option = strdup(option);
|
||||
(*opt)->option = strdup(option);
|
||||
}
|
||||
else {
|
||||
opt->option = NULL;
|
||||
(*opt)->option = NULL;
|
||||
}
|
||||
|
||||
if( value != NULL ) {
|
||||
opt->value = strdup(value);
|
||||
(*opt)->value = strdup(value);
|
||||
}
|
||||
else {
|
||||
opt->value = NULL;
|
||||
(*opt)->value = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -181,3 +183,14 @@ nutscan_device_t * nutscan_add_device_to_device(nutscan_device_t * first, nutsca
|
|||
|
||||
return dev2;
|
||||
}
|
||||
|
||||
nutscan_device_t * nutscan_rewind_device(nutscan_device_t * device)
|
||||
{
|
||||
if (NULL == device)
|
||||
return NULL;
|
||||
|
||||
while (NULL != device->prev)
|
||||
device = device->prev;
|
||||
|
||||
return device;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,22 @@
|
|||
#ifndef SCAN_DEVICE
|
||||
#define SCAN_DEVICE
|
||||
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
extern "C" {
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief Device type string getter
|
||||
*
|
||||
* \param type Device type
|
||||
*
|
||||
* \return Type string
|
||||
*/
|
||||
#define nutscan_device_type_string(type) \
|
||||
(assert(0 < (type) && (type) < TYPE_END), nutscan_device_type_strings[type - 1])
|
||||
|
||||
typedef enum nutscan_device_type {
|
||||
TYPE_NONE=0,
|
||||
TYPE_USB,
|
||||
|
|
@ -27,9 +43,13 @@ typedef enum nutscan_device_type {
|
|||
TYPE_NUT,
|
||||
TYPE_IPMI,
|
||||
TYPE_AVAHI,
|
||||
TYPE_EATON_SERIAL,
|
||||
TYPE_END
|
||||
} nutscan_device_type_t;
|
||||
|
||||
/** Device type -> string mapping */
|
||||
extern const char * nutscan_device_type_strings[TYPE_END - 1];
|
||||
|
||||
typedef struct nutscan_options {
|
||||
char * option;
|
||||
char * value;
|
||||
|
|
@ -40,7 +60,7 @@ typedef struct nutscan_device {
|
|||
nutscan_device_type_t type;
|
||||
char * driver;
|
||||
char * port;
|
||||
nutscan_options_t opt;
|
||||
nutscan_options_t * opt;
|
||||
struct nutscan_device * prev;
|
||||
struct nutscan_device * next;
|
||||
} nutscan_device_t;
|
||||
|
|
@ -49,4 +69,20 @@ nutscan_device_t * nutscan_new_device();
|
|||
void nutscan_free_device(nutscan_device_t * device);
|
||||
void nutscan_add_option_to_device(nutscan_device_t * device,char * option, char * value);
|
||||
nutscan_device_t * nutscan_add_device_to_device(nutscan_device_t * first, nutscan_device_t * second);
|
||||
|
||||
/**
|
||||
* \brief Rewind device list
|
||||
*
|
||||
* \param device Device list item
|
||||
*
|
||||
* \return Device list head
|
||||
*/
|
||||
nutscan_device_t * nutscan_rewind_device(nutscan_device_t * device);
|
||||
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -21,14 +21,15 @@
|
|||
#include <stdio.h>
|
||||
#include "nutscan-device.h"
|
||||
|
||||
char nutscan_device_type_string[TYPE_END][6] = {
|
||||
char * nutscan_device_type_string[TYPE_END]= {
|
||||
"NONE",
|
||||
"USB",
|
||||
"SNMP",
|
||||
"XML",
|
||||
"NUT",
|
||||
"IPMI",
|
||||
"AVAHI" };
|
||||
"AVAHI",
|
||||
"EATON_SERIAL" };
|
||||
|
||||
void nutscan_display_ups_conf(nutscan_device_t * device)
|
||||
{
|
||||
|
|
@ -51,9 +52,9 @@ void nutscan_display_ups_conf(nutscan_device_t * device)
|
|||
nutdev_num, current_dev->driver,
|
||||
current_dev->port);
|
||||
|
||||
opt = &(current_dev->opt);
|
||||
opt = current_dev->opt;
|
||||
|
||||
do {
|
||||
while (NULL != opt) {
|
||||
if( opt->option != NULL ) {
|
||||
printf("\t%s",opt->option);
|
||||
if( opt->value != NULL ) {
|
||||
|
|
@ -62,7 +63,7 @@ void nutscan_display_ups_conf(nutscan_device_t * device)
|
|||
printf("\n");
|
||||
}
|
||||
opt = opt->next;
|
||||
} while( opt != NULL );
|
||||
}
|
||||
|
||||
nutdev_num++;
|
||||
|
||||
|
|
@ -92,9 +93,9 @@ void nutscan_display_parsable(nutscan_device_t * device)
|
|||
current_dev->driver,
|
||||
current_dev->port);
|
||||
|
||||
opt = &(current_dev->opt);
|
||||
opt = current_dev->opt;
|
||||
|
||||
do {
|
||||
while (NULL != opt) {
|
||||
if( opt->option != NULL ) {
|
||||
printf(",%s",opt->option);
|
||||
if( opt->value != NULL ) {
|
||||
|
|
@ -102,7 +103,8 @@ void nutscan_display_parsable(nutscan_device_t * device)
|
|||
}
|
||||
}
|
||||
opt = opt->next;
|
||||
} while( opt != NULL );
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
|
||||
current_dev = current_dev->next;
|
||||
|
|
|
|||
|
|
@ -19,6 +19,12 @@
|
|||
#ifndef SCAN_INIT
|
||||
#define SCAN_INIT
|
||||
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
extern "C" {
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
|
||||
extern int nutscan_avail_avahi;
|
||||
extern int nutscan_avail_ipmi;
|
||||
extern int nutscan_avail_nut;
|
||||
|
|
@ -28,4 +34,11 @@ extern int nutscan_avail_xml_http;
|
|||
|
||||
void nutscan_init(void);
|
||||
void nutscan_free(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -22,6 +22,12 @@
|
|||
#include <arpa/inet.h>
|
||||
#include <netinet/in.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
extern "C" {
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
|
||||
enum network_type {
|
||||
IPv4,
|
||||
IPv6
|
||||
|
|
@ -38,4 +44,11 @@ typedef struct nutscan_ip_iter {
|
|||
char * nutscan_ip_iter_init(nutscan_ip_iter_t *, const char * startIP, const char * stopIP);
|
||||
char * nutscan_ip_iter_inc(nutscan_ip_iter_t *);
|
||||
int nutscan_cidr_to_ip(const char * cidr, char ** start_ip, char ** stop_ip);
|
||||
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
|||
196
tools/nut-scanner/nutscan-serial.c
Normal file
196
tools/nut-scanner/nutscan-serial.c
Normal file
|
|
@ -0,0 +1,196 @@
|
|||
/* nutscan-serial.c: helper functions to get serial devices name
|
||||
*
|
||||
* Copyright (C) 2011 - Frederic Bohe <fredericbohe@eaton.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
|
||||
*/
|
||||
|
||||
#include "nutscan-serial.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include "nut_platform.h"
|
||||
|
||||
#ifdef WIN32
|
||||
/* Windows: all serial port names start with "COM" */
|
||||
#define SERIAL_PORT_PREFIX "COM"
|
||||
#else
|
||||
/* Unix: all serial port names start with "/dev/tty" */
|
||||
#define SERIAL_PORT_PREFIX "/dev/tty"
|
||||
#endif
|
||||
|
||||
#define ERR_OUT_OF_BOUND "Serial port range out of bound (must be 0 to 9 or a to z depending on your system)\n"
|
||||
|
||||
typedef struct {
|
||||
char * name;
|
||||
char auto_start_port;
|
||||
char auto_stop_port;
|
||||
} device_portname_t;
|
||||
|
||||
device_portname_t device_portname[] = {
|
||||
#ifdef NUT_PLATFORM_HPUX
|
||||
/* the first number seems to be a card instance, the second number seems
|
||||
to be a port number */
|
||||
{ "/dev/tty0p%c", '0', '9' },
|
||||
{ "/dev/tty1p%c", '0', '9' },
|
||||
/* osf/1 and Digital UNIX style */
|
||||
{ "/dev/tty0%c", '0', '9' },
|
||||
#endif
|
||||
#ifdef NUT_PLATFORM_SOLARIS
|
||||
{ "/dev/tty%c", 'a', 'z' },
|
||||
#endif
|
||||
#ifdef NUT_PLATFORM_AIX
|
||||
{ "/dev/tty%c", '0', '9' },
|
||||
#endif
|
||||
#ifdef NUT_PLATFORM_LINUX
|
||||
{ "/dev/ttyS%c", '0', '9' },
|
||||
{ "/dev/ttyUSB%c", '0', '9' },
|
||||
#endif
|
||||
#ifdef NUT_PLATFORM_MS_WINDOWS
|
||||
{ "COM%c", '1', '9'},
|
||||
#endif
|
||||
/* SGI IRIX */
|
||||
/* { "/dev/ttyd%i", "=" }, */
|
||||
/* { "/dev/ttyf%i", "=" }, */
|
||||
/* FIXME: Mac OS X has no serial port, but maybe ttyUSB? */
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
/* Return 1 if port_name is a full path name to a serial port,
|
||||
* as per SERIAL_PORT_PREFIX */
|
||||
static int is_serial_port_path(const char * port_name)
|
||||
{
|
||||
if (!strncmp(port_name, SERIAL_PORT_PREFIX, strlen(SERIAL_PORT_PREFIX))) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Add "port" to "list" */
|
||||
static char ** add_port(char ** list, char * port)
|
||||
{
|
||||
char ** res;
|
||||
int count = 0;
|
||||
|
||||
if(list == NULL) {
|
||||
count = 0;
|
||||
}
|
||||
else {
|
||||
while(list[count] != NULL) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
/*+1 to get the number of port from the index nb_ports*/
|
||||
/*+1 for the terminal NULL */
|
||||
res = realloc(list,(count+1+1)*sizeof(char*));
|
||||
if( res == NULL ) {
|
||||
return NULL;
|
||||
}
|
||||
res[count] = strdup(port);
|
||||
res[count+1] = NULL;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
/* Return a list of serial ports name, in 'ports_list', according to the OS,
|
||||
* the provided 'ports_range', and the number of available ports */
|
||||
char ** nutscan_get_serial_ports_list(const char *ports_range)
|
||||
{
|
||||
char start_port = 0;
|
||||
char stop_port = 0;
|
||||
char current_port = 0;
|
||||
char * list_sep_ptr = NULL;
|
||||
char ** ports_list = NULL;
|
||||
char str_tmp[128];
|
||||
char * tok;
|
||||
device_portname_t *cur_device = NULL;
|
||||
char * saveptr = NULL;
|
||||
char * range;
|
||||
int flag_auto = 0;
|
||||
|
||||
/* 1) check ports_list */
|
||||
if ((ports_range == NULL) || (!strncmp(ports_range, "auto", 4))) {
|
||||
flag_auto = 1;
|
||||
}
|
||||
else {
|
||||
range = strdup(ports_range);
|
||||
/* we have a list:
|
||||
* - single element: X (digit) or port name (COM1, /dev/ttyS0, ...)
|
||||
* - range list: X-Y
|
||||
* - multiple elements (coma separated): /dev/ttyS0,/dev/ttyUSB0 */
|
||||
if ( (list_sep_ptr = strchr(range, '-')) != NULL ) {
|
||||
tok = strtok_r(range,"-",&saveptr);
|
||||
if( tok[1] != 0 ) {
|
||||
fprintf(stderr,ERR_OUT_OF_BOUND);
|
||||
free(range);
|
||||
return NULL;
|
||||
}
|
||||
start_port = tok[0];
|
||||
tok = strtok_r(NULL,"-",&saveptr);
|
||||
if( tok != NULL ) {
|
||||
if( tok[1] != 0 ) {
|
||||
fprintf(stderr,ERR_OUT_OF_BOUND);
|
||||
free(range);
|
||||
return NULL;
|
||||
}
|
||||
stop_port = tok[0];
|
||||
}
|
||||
else {
|
||||
stop_port = start_port;
|
||||
}
|
||||
}
|
||||
else if ( ((list_sep_ptr = strchr(ports_range, ',')) != NULL )
|
||||
&& (is_serial_port_path(ports_range)) ) {
|
||||
tok = strtok_r(range,",",&saveptr);
|
||||
while( tok != NULL ) {
|
||||
ports_list = add_port(ports_list,tok);
|
||||
tok = strtok_r(NULL,",",&saveptr);
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* we have been provided a single port name */
|
||||
/* it's a full device name */
|
||||
if( ports_range[1] != 0 ) {
|
||||
ports_list = add_port(ports_list,range);
|
||||
}
|
||||
/* it's device number */
|
||||
else {
|
||||
start_port = stop_port = ports_range[0];
|
||||
}
|
||||
}
|
||||
free(range);
|
||||
}
|
||||
|
||||
|
||||
if( start_port == 0 && !flag_auto) {
|
||||
return ports_list;
|
||||
}
|
||||
|
||||
for (cur_device=device_portname;cur_device->name!= NULL;cur_device++) {
|
||||
if( flag_auto ) {
|
||||
start_port = cur_device->auto_start_port;
|
||||
stop_port = cur_device->auto_stop_port;
|
||||
}
|
||||
for( current_port=start_port; current_port <= stop_port;
|
||||
current_port++){
|
||||
snprintf(str_tmp, sizeof(str_tmp),cur_device->name,
|
||||
current_port);
|
||||
ports_list = add_port(ports_list,str_tmp);
|
||||
}
|
||||
}
|
||||
return ports_list;
|
||||
}
|
||||
|
||||
24
tools/nut-scanner/nutscan-serial.h
Normal file
24
tools/nut-scanner/nutscan-serial.h
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
/* nutscan-serial.h: helper functions to get serial devices name
|
||||
*
|
||||
* Copyright (C) 2011 - Frederic Bohe <fredericbohe@eaton.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
|
||||
*/
|
||||
#ifndef SCAN_SERIAL
|
||||
#define SCAN_SERIAL
|
||||
|
||||
char ** nutscan_get_serial_ports_list(const char *ports_range);
|
||||
|
||||
#endif
|
||||
|
|
@ -27,22 +27,23 @@ typedef struct {
|
|||
|
||||
/* SNMP IDs device table */
|
||||
static snmp_device_id_t snmp_device_table[] = {
|
||||
{ ".1.3.6.1.4.1.2947.1.1.2.0" , "bestpower", NULL},
|
||||
{ ".1.3.6.1.4.1.13742.1.1.12.0" , "raritan", ".1.3.6.1.4.1.13742"},
|
||||
{ "1.3.6.1.2.1.33.1.1.1.0" , "ietf", ".1.3.6.1.2.1.33"},
|
||||
{ ".1.3.6.1.4.1.4555.1.1.1.1.1.1.0" , "netvision", ".1.3.6.1.4.1.4555.1.1.1"},
|
||||
{ ".1.3.6.1.4.1.4779.1.3.5.2.1.24.1" , "baytech", NULL},
|
||||
{ ".1.3.6.1.4.1.318.1.1.1.1.1.1.0" , "apcc", NULL},
|
||||
{ "1.3.6.1.4.1.534.1.1.2.0" , "pw", ".1.3.6.1.4.1.534.1"},
|
||||
{ ".1.3.6.1.4.1.17373.3.1.1.0" , "aphel_genesisII", ".1.3.6.1.4.1.17373"},
|
||||
{ ".1.3.6.1.4.1.534.6.6.6.1.1.12.0" , "aphel_revelation", ".1.3.6.1.4.1.534.6.6.6"},
|
||||
{ ".1.3.6.1.4.1.534.6.6.7.1.2.1.2.0" , "eaton_epdu", ".1.3.6.1.4.1.534.6.6.7"},
|
||||
{ "" , "pulizzi_monitored", NULL},
|
||||
{ ".1.3.6.1.4.1.20677.1" , "pulizzi_switched1", ".1.3.6.1.4.1.20677.1"},
|
||||
{ ".1.3.6.1.4.1.20677.1" , "pulizzi_switched2", ".1.3.6.1.4.1.20677.2"},
|
||||
{ "1.3.6.1.4.1.534.1.1.2.0" , "pw", ".1.3.6.1.4.1.534.1"},
|
||||
{ ".1.3.6.1.4.1.705.1.1.1.0" , "mge", ".1.3.6.1.4.1.705.1"},
|
||||
{ ".1.3.6.1.4.1.318.1.1.1.1.1.1.0" , "apcc", NULL},
|
||||
{ ".1.3.6.1.4.1.4779.1.3.5.2.1.24.1" , "baytech", NULL},
|
||||
{ ".1.3.6.1.4.1.2947.1.1.2.0" , "bestpower", NULL},
|
||||
{ ".1.3.6.1.4.1.3808.1.1.1.1.1.1.0" , "cyberpower", ".1.3.6.1.4.1.3808"},
|
||||
{ "" , "delta_ups", ".1.3.6.1.4.1.2254.2.4"},
|
||||
{ ".1.3.6.1.4.1.705.1.1.1.0" , "mge", ".1.3.6.1.4.1.705.1"},
|
||||
{ ".1.3.6.1.4.1.232.165.3.1.1.0" , "cpqpower", ".1.3.6.1.4.1.232.165.3"},
|
||||
{ ".1.3.6.1.4.1.4555.1.1.1.1.1.1.0" , "netvision", ".1.3.6.1.4.1.4555.1.1.1"},
|
||||
{ ".1.3.6.1.4.1.13742.1.1.12.0" , "raritan", ".1.3.6.1.4.1.13742"},
|
||||
{ "1.3.6.1.2.1.33.1.1.1.0" , "ietf", ".1.3.6.1.2.1.33"},
|
||||
/* Terminating entry */
|
||||
{ NULL, NULL, NULL}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -50,6 +50,8 @@ static usb_device_id_t usb_device_table[] = {
|
|||
{ 0x0463, 0x0001, "usbhid-ups" },
|
||||
{ 0x0463, 0xffff, "usbhid-ups" },
|
||||
{ 0x047c, 0xffff, "usbhid-ups" },
|
||||
{ 0x04b4, 0x5500, "riello_usb" },
|
||||
{ 0x04d8, 0xd004, "usbhid-ups" },
|
||||
{ 0x050d, 0x0375, "usbhid-ups" },
|
||||
{ 0x050d, 0x0551, "usbhid-ups" },
|
||||
{ 0x050d, 0x0750, "usbhid-ups" },
|
||||
|
|
@ -100,6 +102,7 @@ static usb_device_id_t usb_device_table[] = {
|
|||
{ 0x09ae, 0x3013, "usbhid-ups" },
|
||||
{ 0x09ae, 0x3014, "usbhid-ups" },
|
||||
{ 0x09ae, 0x3015, "usbhid-ups" },
|
||||
{ 0x09ae, 0x3016, "usbhid-ups" },
|
||||
{ 0x09ae, 0x4001, "usbhid-ups" },
|
||||
{ 0x09ae, 0x4002, "usbhid-ups" },
|
||||
{ 0x09ae, 0x4003, "usbhid-ups" },
|
||||
|
|
|
|||
|
|
@ -506,7 +506,7 @@ fail:
|
|||
if (simple_poll)
|
||||
(*nut_avahi_simple_poll_free)(simple_poll);
|
||||
|
||||
return dev_ret;
|
||||
return nutscan_rewind_device(dev_ret);
|
||||
}
|
||||
#else /* WITH_AVAHI */
|
||||
/* stub function */
|
||||
|
|
|
|||
439
tools/nut-scanner/scan_eaton_serial.c
Normal file
439
tools/nut-scanner/scan_eaton_serial.c
Normal file
|
|
@ -0,0 +1,439 @@
|
|||
/* scan_eaton_serial.c: detect Eaton serial XCP, SHUT and Q1 devices
|
||||
*
|
||||
* Copyright (C) 2012 Arnaud Quette <ArnaudQuette@eaton.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
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
/* Need this on AIX when using xlc to get alloca */
|
||||
#ifdef _AIX
|
||||
#pragma alloca
|
||||
#endif /* _AIX */
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <signal.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include "nut-scan.h"
|
||||
#include "serial.h"
|
||||
#include "bcmxcp_io.h"
|
||||
#include "bcmxcp.h"
|
||||
#include "nutscan-serial.h"
|
||||
|
||||
#ifdef HAVE_PTHREAD
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
|
||||
/* SHUT header */
|
||||
#define SHUT_SYNC 0x16
|
||||
#define MAX_TRY 4
|
||||
|
||||
/* BCMXCP header */
|
||||
extern unsigned char AUT[4];
|
||||
extern struct pw_baud_rate {
|
||||
int rate;
|
||||
int name;
|
||||
} pw_baud_rates[];
|
||||
|
||||
/* Local list of found devices */
|
||||
static nutscan_device_t * dev_ret = NULL;
|
||||
|
||||
/* Remap some functions to avoid undesired behavior (drivers/main.c) */
|
||||
char *getval(const char *var) { return NULL; }
|
||||
|
||||
#ifdef HAVE_PTHREAD
|
||||
static pthread_mutex_t dev_mutex;
|
||||
#endif
|
||||
|
||||
/* Drivers name */
|
||||
#define SHUT_DRIVER_NAME "mge-shut"
|
||||
#define XCP_DRIVER_NAME "bcmxcp"
|
||||
#define Q1_DRIVER_NAME "blazer_ser"
|
||||
|
||||
/* Fake driver main, for using serial functions, needed for bcmxcp_ser.c */
|
||||
char *device_path;
|
||||
int upsfd;
|
||||
int exit_flag = 0;
|
||||
int do_lock_port;
|
||||
|
||||
/* Functions extracted from drivers/bcmxcp.c, to avoid pulling too many things
|
||||
* lightweight function to calculate the 8-bit
|
||||
* two's complement checksum of buf, using XCP data length (including header)
|
||||
* the result must be 0 for the sequence data to be valid */
|
||||
int checksum_test(const unsigned char *buf)
|
||||
{
|
||||
unsigned char checksum = 0;
|
||||
int i, length;
|
||||
/* buf[2] is the length of the XCP frame ; add 5 for the header */
|
||||
length = (int)(buf[2]) + 5;
|
||||
|
||||
for (i = 0; i < length; i++) {
|
||||
checksum += buf[i];
|
||||
}
|
||||
/* Compute the 8-bit, Two's Complement checksum now and return it */
|
||||
checksum = ((0x100 - checksum) & 0xFF);
|
||||
return (checksum == 0);
|
||||
}
|
||||
|
||||
|
||||
unsigned char calc_checksum(const unsigned char *buf)
|
||||
{
|
||||
unsigned char c;
|
||||
int i;
|
||||
|
||||
c = 0;
|
||||
for(i = 0; i < 2 + buf[1]; i++)
|
||||
c -= buf[i];
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* SHUT functions (MGE legacy, but Eaton path forward)
|
||||
******************************************************************************/
|
||||
|
||||
/* Light version of of drivers/libshut.c->shut_synchronise()
|
||||
* return 1 if OK, 0 otherwise */
|
||||
int shut_synchronise(int upsfd)
|
||||
{
|
||||
int try;
|
||||
u_char reply = '\0';
|
||||
|
||||
/* Sync with the UPS according to notification */
|
||||
for (try = 0; try < MAX_TRY; try++) {
|
||||
if ((ser_send_char(upsfd, SHUT_SYNC)) == -1) {
|
||||
continue;
|
||||
}
|
||||
|
||||
ser_get_char(upsfd, &reply, 1, 0);
|
||||
if (reply == SHUT_SYNC) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* SHUT scan:
|
||||
* send SYNC token (0x16) and receive the SYNC token back
|
||||
* FIXME: maybe try to get device descriptor?!
|
||||
*/
|
||||
nutscan_device_t * nutscan_scan_eaton_serial_shut(const char* port_name)
|
||||
{
|
||||
nutscan_device_t * dev = NULL;
|
||||
int devfd = -1;
|
||||
|
||||
if ( (devfd = ser_open_nf(port_name)) != -1 ) {
|
||||
/* set RTS to off and DTR to on to allow correct behavior
|
||||
* with UPS using PnP feature */
|
||||
if (ser_set_dtr(devfd, 1) != -1) {
|
||||
|
||||
ser_set_rts(devfd, 0);
|
||||
ser_set_speed_nf(devfd, port_name, B2400);
|
||||
|
||||
if (shut_synchronise(devfd)) {
|
||||
|
||||
/* Communication established successfully! */
|
||||
dev = nutscan_new_device();
|
||||
dev->type = TYPE_EATON_SERIAL;
|
||||
dev->driver = strdup(SHUT_DRIVER_NAME);
|
||||
dev->port = strdup(port_name);
|
||||
#ifdef HAVE_PTHREAD
|
||||
pthread_mutex_lock(&dev_mutex);
|
||||
#endif
|
||||
dev_ret = nutscan_add_device_to_device(dev_ret, dev);
|
||||
#ifdef HAVE_PTHREAD
|
||||
pthread_mutex_unlock(&dev_mutex);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
/* Close the device */
|
||||
ser_close(devfd, NULL);
|
||||
}
|
||||
|
||||
return dev;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* XCP functions (Eaton Powerware legacy)
|
||||
******************************************************************************/
|
||||
|
||||
/* XCP scan:
|
||||
* baudrate nego (...)
|
||||
* Send ESC to take it out of menu
|
||||
* Wait 90ms
|
||||
* Send auth command (AUTHOR[4] = {0xCF, 0x69, 0xE8, 0xD5};)
|
||||
* Wait 500ms (or less?)
|
||||
* Send PW_SET_REQ_ONLY_MODE command (0xA0) and wait for response
|
||||
* [Get ID Block (PW_ID_BLOCK_REQ) (0x31)]
|
||||
*/
|
||||
nutscan_device_t * nutscan_scan_eaton_serial_xcp(const char* port_name)
|
||||
{
|
||||
nutscan_device_t * dev = NULL;
|
||||
int i, ret, devfd = -1;
|
||||
unsigned char answer[256];
|
||||
unsigned char sbuf[128];
|
||||
|
||||
memset(sbuf, 0, 128);
|
||||
|
||||
if ( (devfd = ser_open_nf(port_name)) != -1 ) {
|
||||
#ifdef HAVE_PTHREAD
|
||||
pthread_mutex_lock(&dev_mutex);
|
||||
#endif
|
||||
upsfd = devfd;
|
||||
#ifdef HAVE_PTHREAD
|
||||
pthread_mutex_unlock(&dev_mutex);
|
||||
#endif
|
||||
|
||||
for (i=0; (pw_baud_rates[i].rate != 0) && (dev == NULL); i++)
|
||||
{
|
||||
memset(answer, 0, 256);
|
||||
|
||||
if (ser_set_speed_nf(devfd, port_name, pw_baud_rates[i].rate) == -1)
|
||||
break;
|
||||
|
||||
ret = ser_send_char(devfd, 0x1d); /* send ESC to take it out of menu */
|
||||
if (ret <= 0)
|
||||
break;
|
||||
|
||||
usleep(90000);
|
||||
send_write_command(AUT, 4);
|
||||
usleep(500000);
|
||||
|
||||
/* Discovery with Baud Hunting (XCP protocol spec. §4.1.2)
|
||||
* sending PW_SET_REQ_ONLY_MODE should be enough, since
|
||||
* the unit should send back Identification block */
|
||||
sbuf[0] = PW_COMMAND_START_BYTE;
|
||||
sbuf[1] = (unsigned char)1;
|
||||
sbuf[2] = PW_SET_REQ_ONLY_MODE;
|
||||
sbuf[3] = calc_checksum(sbuf);
|
||||
ret = ser_send_buf_pace(devfd, 1000, sbuf, 4);
|
||||
|
||||
/* Read PW_COMMAND_START_BYTE byte */
|
||||
ret = ser_get_char(devfd, answer, 1, 0);
|
||||
|
||||
#if 0
|
||||
/* FIXME: seems not needed, but requires testing with more devices! */
|
||||
if (ret <= 0) {
|
||||
usleep(250000); /* 500000? */
|
||||
memset(answer, 0, 256);
|
||||
ret = command_sequence(&id_command, 1, answer);
|
||||
}
|
||||
#endif
|
||||
|
||||
if ( (ret > 0) && (answer[0] == PW_COMMAND_START_BYTE) ) {
|
||||
dev = nutscan_new_device();
|
||||
dev->type = TYPE_EATON_SERIAL;
|
||||
dev->driver = strdup(XCP_DRIVER_NAME);
|
||||
dev->port = strdup(port_name);
|
||||
#ifdef HAVE_PTHREAD
|
||||
pthread_mutex_lock(&dev_mutex);
|
||||
#endif
|
||||
dev_ret = nutscan_add_device_to_device(dev_ret, dev);
|
||||
#ifdef HAVE_PTHREAD
|
||||
pthread_mutex_unlock(&dev_mutex);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
usleep(100000);
|
||||
}
|
||||
/* Close the device */
|
||||
ser_close(devfd, NULL);
|
||||
}
|
||||
|
||||
return dev;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Q1 functions (Phoenixtec/Centralion/Santak, still Eaton path forward)
|
||||
******************************************************************************/
|
||||
|
||||
#define SER_WAIT_SEC 1 /* 3 seconds for Best UPS */
|
||||
#define MAXTRIES 3
|
||||
|
||||
/* Q1 scan:
|
||||
* - open the serial port and set the speed to 2400 baud
|
||||
* - simply try to get Q1 (status) string
|
||||
* - check its size and first char. which should be '('
|
||||
*/
|
||||
nutscan_device_t * nutscan_scan_eaton_serial_q1(const char* port_name)
|
||||
{
|
||||
nutscan_device_t * dev = NULL;
|
||||
struct termios tio;
|
||||
int ret = 0, retry;
|
||||
int devfd = -1;
|
||||
char buf[128];
|
||||
|
||||
if ( (devfd = ser_open_nf(port_name)) != -1 ) {
|
||||
if (ser_set_speed_nf(devfd, port_name, B2400) != -1) {
|
||||
|
||||
if (!tcgetattr(devfd, &tio)) {
|
||||
|
||||
/* Use canonical mode input processing (to read reply line) */
|
||||
tio.c_lflag |= ICANON; /* Canonical input (erase and kill processing) */
|
||||
|
||||
tio.c_cc[VEOF] = _POSIX_VDISABLE;
|
||||
tio.c_cc[VEOL] = '\r';
|
||||
tio.c_cc[VERASE] = _POSIX_VDISABLE;
|
||||
tio.c_cc[VINTR] = _POSIX_VDISABLE;
|
||||
tio.c_cc[VKILL] = _POSIX_VDISABLE;
|
||||
tio.c_cc[VQUIT] = _POSIX_VDISABLE;
|
||||
tio.c_cc[VSUSP] = _POSIX_VDISABLE;
|
||||
tio.c_cc[VSTART] = _POSIX_VDISABLE;
|
||||
tio.c_cc[VSTOP] = _POSIX_VDISABLE;
|
||||
|
||||
if (!tcsetattr(devfd, TCSANOW, &tio)) {
|
||||
|
||||
/* Set the default (normal) cablepower */
|
||||
ser_set_dtr(devfd, 1);
|
||||
ser_set_rts(devfd, 0);
|
||||
|
||||
/* Allow some time to settle for the cablepower */
|
||||
usleep(100000);
|
||||
|
||||
/* Only try pure 'Q1', not older ones like 'D' or 'QS'
|
||||
* > [Q1\r]
|
||||
* < [(226.0 195.0 226.0 014 49.0 27.5 30.0 00001000\r]
|
||||
*/
|
||||
for (retry = 1; retry <= MAXTRIES; retry++) {
|
||||
|
||||
/* simplified code */
|
||||
ser_flush_io(devfd);
|
||||
if ( (ret = ser_send(devfd, "Q1\r")) > 0) {
|
||||
|
||||
/* Get Q1 reply */
|
||||
if ( (ret = ser_get_buf(devfd, buf, sizeof(buf), SER_WAIT_SEC, 0)) > 0) {
|
||||
|
||||
/* Check answer */
|
||||
/* should at least (and most) be 46 chars */
|
||||
if (ret >= 46) {
|
||||
if (buf[0] == '(') {
|
||||
|
||||
dev = nutscan_new_device();
|
||||
dev->type = TYPE_EATON_SERIAL;
|
||||
dev->driver = strdup(Q1_DRIVER_NAME);
|
||||
dev->port = strdup(port_name);
|
||||
#ifdef HAVE_PTHREAD
|
||||
pthread_mutex_lock(&dev_mutex);
|
||||
#endif
|
||||
dev_ret = nutscan_add_device_to_device(dev_ret, dev);
|
||||
#ifdef HAVE_PTHREAD
|
||||
pthread_mutex_unlock(&dev_mutex);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Close the device */
|
||||
ser_close(devfd, NULL);
|
||||
}
|
||||
return dev;
|
||||
}
|
||||
|
||||
static void * nutscan_scan_eaton_serial_device(void * port_arg)
|
||||
{
|
||||
nutscan_device_t * dev = NULL;
|
||||
char* port_name = (char*) port_arg;
|
||||
|
||||
/* Try SHUT first */
|
||||
if ( (dev = nutscan_scan_eaton_serial_shut(port_name)) == NULL) {
|
||||
usleep(100000);
|
||||
/* Else, try XCP */
|
||||
if ( (dev = nutscan_scan_eaton_serial_xcp(port_name)) == NULL) {
|
||||
/* Else, try Q1 */
|
||||
usleep(100000);
|
||||
dev = nutscan_scan_eaton_serial_q1(port_name);
|
||||
}
|
||||
/* Else try UTalk? */
|
||||
}
|
||||
return dev;
|
||||
}
|
||||
|
||||
nutscan_device_t * nutscan_scan_eaton_serial(const char* ports_range)
|
||||
{
|
||||
struct sigaction oldact;
|
||||
int change_action_handler = 0;
|
||||
char *current_port_name = NULL;
|
||||
char **serial_ports_list;
|
||||
int current_port_nb;
|
||||
int i;
|
||||
#ifdef HAVE_PTHREAD
|
||||
pthread_t thread;
|
||||
pthread_t * thread_array = NULL;
|
||||
int thread_count = 0;
|
||||
|
||||
pthread_mutex_init(&dev_mutex,NULL);
|
||||
#endif
|
||||
|
||||
/* 1) Get ports_list */
|
||||
serial_ports_list = nutscan_get_serial_ports_list(ports_range);
|
||||
if( serial_ports_list == NULL ) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Ignore SIGPIPE if the caller hasn't set a handler for it yet */
|
||||
if( sigaction(SIGPIPE, NULL, &oldact) == 0 ) {
|
||||
if( oldact.sa_handler == SIG_DFL ) {
|
||||
change_action_handler = 1;
|
||||
signal(SIGPIPE,SIG_IGN);
|
||||
}
|
||||
}
|
||||
|
||||
/* port(s) iterator */
|
||||
current_port_nb = 0;
|
||||
while(serial_ports_list[current_port_nb] != NULL) {
|
||||
current_port_name = serial_ports_list[current_port_nb];
|
||||
#ifdef HAVE_PTHREAD
|
||||
if (pthread_create(&thread, NULL, nutscan_scan_eaton_serial_device, (void*)current_port_name) == 0){
|
||||
thread_count++;
|
||||
thread_array = realloc(thread_array,
|
||||
thread_count*sizeof(pthread_t));
|
||||
thread_array[thread_count-1] = thread;
|
||||
}
|
||||
#else
|
||||
nutscan_scan_eaton_serial_device(current_port_name);
|
||||
#endif
|
||||
current_port_nb++;
|
||||
}
|
||||
|
||||
#ifdef HAVE_PTHREAD
|
||||
for ( i = 0; i < thread_count ; i++) {
|
||||
pthread_join(thread_array[i],NULL);
|
||||
}
|
||||
pthread_mutex_destroy(&dev_mutex);
|
||||
free(thread_array);
|
||||
#endif
|
||||
|
||||
if(change_action_handler) {
|
||||
signal(SIGPIPE,SIG_DFL);
|
||||
}
|
||||
|
||||
/* free everything... */
|
||||
i=0;
|
||||
while(serial_ports_list[i] != NULL) {
|
||||
free(serial_ports_list[i]);
|
||||
i++;
|
||||
}
|
||||
free( serial_ports_list);
|
||||
return nutscan_rewind_device(dev_ret);
|
||||
}
|
||||
|
|
@ -29,29 +29,61 @@
|
|||
|
||||
#define NUT_IPMI_DRV_NAME "nut-ipmipsu"
|
||||
|
||||
/* IPMI defines */
|
||||
/* 5 seconds for establishing an IPMI connection */
|
||||
#define IPMI_SESSION_TIMEOUT_LENGTH_DEFAULT 5000
|
||||
#define IPMI_RETRANSMISSION_TIMEOUT_LENGTH_DEFAULT 250
|
||||
|
||||
/* dynamic link library stuff */
|
||||
static char * libname = "libfreeipmi";
|
||||
static lt_dlhandle dl_handle = NULL;
|
||||
static const char *dl_error = NULL;
|
||||
|
||||
static int (*nut_ipmi_fru_parse_close_device_id) (ipmi_fru_parse_ctx_t ctx);
|
||||
static void (*nut_ipmi_fru_parse_ctx_destroy) (ipmi_fru_parse_ctx_t ctx);
|
||||
#ifdef HAVE_FREEIPMI_11X_12X
|
||||
static void (*nut_ipmi_sdr_ctx_destroy) (ipmi_sdr_ctx_t ctx);
|
||||
/* Functions symbols remapping */
|
||||
#define IPMI_FRU_CLOSE_DEVICE_ID "ipmi_fru_close_device_id"
|
||||
#define IPMI_FRU_CTX_DESTROY "ipmi_fru_ctx_destroy"
|
||||
#define IPMI_FRU_CTX_CREATE "ipmi_fru_ctx_create"
|
||||
#define IPMI_FRU_CTX_SET_FLAGS "ipmi_fru_ctx_set_flags"
|
||||
#define IPMI_FRU_OPEN_DEVICE_ID "ipmi_fru_open_device_id"
|
||||
#define IPMI_FRU_CTX_ERRORMSG "ipmi_fru_ctx_errormsg"
|
||||
#define IPMI_FRU_READ_DATA_AREA "ipmi_fru_read_data_area"
|
||||
#define IPMI_FRU_PARSE_NEXT "ipmi_fru_next"
|
||||
typedef ipmi_fru_ctx_t ipmi_fru_parse_ctx_t;
|
||||
typedef ipmi_sdr_ctx_t ipmi_sdr_cache_ctx_t;
|
||||
/* Functions remapping */
|
||||
static void (*nut_ipmi_sdr_ctx_destroy) (ipmi_sdr_ctx_t ctx);
|
||||
#else /* HAVE_FREEIPMI_11X_12X */
|
||||
static void (*nut_ipmi_sdr_cache_ctx_destroy) (ipmi_sdr_cache_ctx_t ctx);
|
||||
static void (*nut_ipmi_sdr_parse_ctx_destroy) (ipmi_sdr_parse_ctx_t ctx);
|
||||
#define IPMI_FRU_AREA_SIZE_MAX IPMI_FRU_PARSE_AREA_SIZE_MAX
|
||||
#define IPMI_FRU_FLAGS_SKIP_CHECKSUM_CHECKS IPMI_FRU_PARSE_FLAGS_SKIP_CHECKSUM_CHECKS
|
||||
#define IPMI_FRU_AREA_TYPE_MULTIRECORD_POWER_SUPPLY_INFORMATION IPMI_FRU_PARSE_AREA_TYPE_MULTIRECORD_POWER_SUPPLY_INFORMATION
|
||||
/* Functions symbols remapping */
|
||||
#define IPMI_FRU_CLOSE_DEVICE_ID "ipmi_fru_parse_close_device_id"
|
||||
#define IPMI_FRU_CTX_DESTROY "ipmi_fru_parse_ctx_destroy"
|
||||
#define IPMI_FRU_CTX_CREATE "ipmi_fru_parse_ctx_create"
|
||||
#define IPMI_FRU_CTX_SET_FLAGS "ipmi_fru_parse_ctx_set_flags"
|
||||
#define IPMI_FRU_OPEN_DEVICE_ID "ipmi_fru_parse_open_device_id"
|
||||
#define IPMI_FRU_CTX_ERRORMSG "ipmi_fru_parse_ctx_errormsg"
|
||||
#define IPMI_FRU_READ_DATA_AREA "ipmi_fru_parse_read_data_area"
|
||||
#define IPMI_FRU_PARSE_NEXT "ipmi_fru_parse_next"
|
||||
/* Functions remapping */
|
||||
static void (*nut_ipmi_sdr_cache_ctx_destroy) (ipmi_sdr_cache_ctx_t ctx);
|
||||
static void (*nut_ipmi_sdr_parse_ctx_destroy) (ipmi_sdr_parse_ctx_t ctx);
|
||||
#endif /* HAVE_FREEIPMI_11X_12X */
|
||||
static ipmi_fru_parse_ctx_t (*nut_ipmi_fru_parse_ctx_create) (ipmi_ctx_t ipmi_ctx);
|
||||
static int (*nut_ipmi_fru_parse_ctx_set_flags) (ipmi_fru_parse_ctx_t ctx, unsigned int flags);
|
||||
static int (*nut_ipmi_fru_parse_open_device_id) (ipmi_fru_parse_ctx_t ctx, uint8_t fru_device_id);
|
||||
static char * (*nut_ipmi_fru_parse_ctx_errormsg) (ipmi_fru_parse_ctx_t ctx);
|
||||
static int (*nut_ipmi_fru_parse_read_data_area) (ipmi_fru_parse_ctx_t ctx,
|
||||
|
||||
|
||||
static int (*nut_ipmi_fru_close_device_id) (ipmi_fru_parse_ctx_t ctx);
|
||||
static void (*nut_ipmi_fru_ctx_destroy) (ipmi_fru_parse_ctx_t ctx);
|
||||
static ipmi_fru_parse_ctx_t (*nut_ipmi_fru_ctx_create) (ipmi_ctx_t ipmi_ctx);
|
||||
static int (*nut_ipmi_fru_ctx_set_flags) (ipmi_fru_parse_ctx_t ctx, unsigned int flags);
|
||||
static int (*nut_ipmi_fru_open_device_id) (ipmi_fru_parse_ctx_t ctx, uint8_t fru_device_id);
|
||||
static char * (*nut_ipmi_fru_ctx_errormsg) (ipmi_fru_parse_ctx_t ctx);
|
||||
static int (*nut_ipmi_fru_read_data_area) (ipmi_fru_parse_ctx_t ctx,
|
||||
unsigned int *area_type,
|
||||
unsigned int *area_length,
|
||||
void *areabuf,
|
||||
unsigned int areabuflen);
|
||||
static int (*nut_ipmi_fru_parse_next) (ipmi_fru_parse_ctx_t ctx);
|
||||
static int (*nut_ipmi_fru_next) (ipmi_fru_parse_ctx_t ctx);
|
||||
static ipmi_ctx_t (*nut_ipmi_ctx_create) (void);
|
||||
static int (*nut_ipmi_ctx_find_inband) (ipmi_ctx_t ctx,
|
||||
ipmi_driver_type_t *driver_type,
|
||||
|
|
@ -61,10 +93,23 @@ static int (*nut_ipmi_ctx_find_inband) (ipmi_ctx_t ctx,
|
|||
const char *driver_device,
|
||||
unsigned int workaround_flags,
|
||||
unsigned int flags);
|
||||
static int (*nut_ipmi_ctx_open_outofband) (ipmi_ctx_t ctx,
|
||||
const char *hostname,
|
||||
const char *username,
|
||||
const char *password,
|
||||
uint8_t authentication_type,
|
||||
uint8_t privilege_level,
|
||||
unsigned int session_timeout,
|
||||
unsigned int retransmission_timeout,
|
||||
unsigned int workaround_flags,
|
||||
unsigned int flags);
|
||||
static int (*nut_ipmi_ctx_errnum) (ipmi_ctx_t ctx);
|
||||
static char * (*nut_ipmi_ctx_errormsg) (ipmi_ctx_t ctx);
|
||||
static int (*nut_ipmi_ctx_close) (ipmi_ctx_t ctx);
|
||||
static void (*nut_ipmi_ctx_destroy) (ipmi_ctx_t ctx);
|
||||
|
||||
/* Internal functions */
|
||||
static nutscan_device_t * nutscan_scan_ipmi_device(const char * IPaddr, nutscan_ipmi_t * sec);
|
||||
|
||||
/* Return 0 on error */
|
||||
int nutscan_load_ipmi_library()
|
||||
|
|
@ -92,12 +137,12 @@ int nutscan_load_ipmi_library()
|
|||
/* Clear any existing error */
|
||||
lt_dlerror();
|
||||
|
||||
*(void **) (&nut_ipmi_fru_parse_close_device_id) = lt_dlsym(dl_handle, "ipmi_fru_parse_close_device_id");
|
||||
*(void **) (&nut_ipmi_fru_close_device_id) = lt_dlsym(dl_handle, IPMI_FRU_CLOSE_DEVICE_ID);
|
||||
if ((dl_error = lt_dlerror()) != NULL) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
*(void **) (&nut_ipmi_fru_parse_ctx_destroy) = lt_dlsym(dl_handle, "ipmi_fru_parse_ctx_destroy");
|
||||
*(void **) (&nut_ipmi_fru_ctx_destroy) = lt_dlsym(dl_handle, IPMI_FRU_CTX_DESTROY);
|
||||
if ((dl_error = lt_dlerror()) != NULL) {
|
||||
goto err;
|
||||
}
|
||||
|
|
@ -122,32 +167,32 @@ int nutscan_load_ipmi_library()
|
|||
}
|
||||
#endif /* HAVE_FREEIPMI_11X_12X */
|
||||
|
||||
*(void **) (&nut_ipmi_fru_parse_ctx_create) = lt_dlsym(dl_handle, "ipmi_fru_parse_ctx_create");
|
||||
*(void **) (&nut_ipmi_fru_ctx_create) = lt_dlsym(dl_handle, IPMI_FRU_CTX_CREATE);
|
||||
if ((dl_error = lt_dlerror()) != NULL) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
*(void **) (&nut_ipmi_fru_parse_ctx_set_flags) = lt_dlsym(dl_handle, "ipmi_fru_parse_ctx_set_flags");
|
||||
*(void **) (&nut_ipmi_fru_ctx_set_flags) = lt_dlsym(dl_handle, IPMI_FRU_CTX_SET_FLAGS);
|
||||
if ((dl_error = lt_dlerror()) != NULL) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
*(void **) (&nut_ipmi_fru_parse_open_device_id) = lt_dlsym(dl_handle, "ipmi_fru_parse_open_device_id");
|
||||
*(void **) (&nut_ipmi_fru_open_device_id) = lt_dlsym(dl_handle, IPMI_FRU_OPEN_DEVICE_ID);
|
||||
if ((dl_error = lt_dlerror()) != NULL) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
*(void **) (&nut_ipmi_fru_parse_ctx_errormsg) = lt_dlsym(dl_handle, "ipmi_fru_parse_ctx_errormsg");
|
||||
*(void **) (&nut_ipmi_fru_ctx_errormsg) = lt_dlsym(dl_handle, IPMI_FRU_CTX_ERRORMSG);
|
||||
if ((dl_error = lt_dlerror()) != NULL) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
*(void **) (&nut_ipmi_fru_parse_read_data_area) = lt_dlsym(dl_handle, "ipmi_fru_parse_read_data_area");
|
||||
*(void **) (&nut_ipmi_fru_read_data_area) = lt_dlsym(dl_handle, IPMI_FRU_READ_DATA_AREA);
|
||||
if ((dl_error = lt_dlerror()) != NULL) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
*(void **) (&nut_ipmi_fru_parse_next) = lt_dlsym(dl_handle, "ipmi_fru_parse_next");
|
||||
*(void **) (&nut_ipmi_fru_next) = lt_dlsym(dl_handle, IPMI_FRU_PARSE_NEXT);
|
||||
if ((dl_error = lt_dlerror()) != NULL) {
|
||||
goto err;
|
||||
}
|
||||
|
|
@ -162,6 +207,16 @@ int nutscan_load_ipmi_library()
|
|||
goto err;
|
||||
}
|
||||
|
||||
*(void **) (&nut_ipmi_ctx_open_outofband) = lt_dlsym(dl_handle, "ipmi_ctx_open_outofband");
|
||||
if ((dl_error = lt_dlerror()) != NULL) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
*(void **) (&nut_ipmi_ctx_errnum) = lt_dlsym(dl_handle, "ipmi_ctx_errnum");
|
||||
if ((dl_error = lt_dlerror()) != NULL) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
*(void **) (&nut_ipmi_ctx_errormsg) = lt_dlsym(dl_handle, "ipmi_ctx_errormsg");
|
||||
if ((dl_error = lt_dlerror()) != NULL) {
|
||||
goto err;
|
||||
|
|
@ -179,7 +234,7 @@ int nutscan_load_ipmi_library()
|
|||
|
||||
return 1;
|
||||
err:
|
||||
fprintf(stderr, "Cannot load IPMI library (%s) : %s. IPMI search disabled.\n", libname, dl_error);
|
||||
fprintf(stderr, "Cannot load IPMI library (%s) : %s. IPMI search disabled.\n", libname, dl_error);
|
||||
dl_handle = (void *)1;
|
||||
lt_dlexit();
|
||||
return 0;
|
||||
|
|
@ -197,8 +252,8 @@ static void nut_freeipmi_cleanup(ipmi_fru_parse_ctx_t fru_parse_ctx,
|
|||
#endif /* HAVE_FREEIPMI_11X_12X */
|
||||
{
|
||||
if (fru_parse_ctx) {
|
||||
(*nut_ipmi_fru_parse_close_device_id) (fru_parse_ctx);
|
||||
(*nut_ipmi_fru_parse_ctx_destroy) (fru_parse_ctx);
|
||||
(*nut_ipmi_fru_close_device_id) (fru_parse_ctx);
|
||||
(*nut_ipmi_fru_ctx_destroy) (fru_parse_ctx);
|
||||
}
|
||||
|
||||
#ifdef HAVE_FREEIPMI_11X_12X
|
||||
|
|
@ -226,7 +281,7 @@ int is_ipmi_device_supported(ipmi_ctx_t ipmi_ctx, int ipmi_id)
|
|||
int ret = -1;
|
||||
unsigned int area_type = 0;
|
||||
unsigned int area_length = 0;
|
||||
uint8_t areabuf[IPMI_FRU_PARSE_AREA_SIZE_MAX+1];
|
||||
uint8_t areabuf[IPMI_FRU_AREA_SIZE_MAX+1];
|
||||
ipmi_fru_parse_ctx_t fru_parse_ctx = NULL;
|
||||
#ifdef HAVE_FREEIPMI_11X_12X
|
||||
ipmi_sdr_ctx_t sdr_ctx = NULL;
|
||||
|
|
@ -236,14 +291,14 @@ int is_ipmi_device_supported(ipmi_ctx_t ipmi_ctx, int ipmi_id)
|
|||
#endif /* HAVE_FREEIPMI_11X_12X */
|
||||
|
||||
/* Parse FRU information */
|
||||
if (!(fru_parse_ctx = (*nut_ipmi_fru_parse_ctx_create) (ipmi_ctx)))
|
||||
if (!(fru_parse_ctx = (*nut_ipmi_fru_ctx_create) (ipmi_ctx)))
|
||||
{
|
||||
fprintf(stderr, "ipmi_fru_parse_ctx_create()\n");
|
||||
fprintf(stderr, "Error with %s(): %s\n", IPMI_FRU_CTX_CREATE, (*nut_ipmi_ctx_errormsg)(ipmi_ctx));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* lots of motherboards calculate checksums incorrectly */
|
||||
if ((*nut_ipmi_fru_parse_ctx_set_flags) (fru_parse_ctx, IPMI_FRU_PARSE_FLAGS_SKIP_CHECKSUM_CHECKS) < 0)
|
||||
if ((*nut_ipmi_fru_ctx_set_flags) (fru_parse_ctx, IPMI_FRU_FLAGS_SKIP_CHECKSUM_CHECKS) < 0)
|
||||
{
|
||||
#ifdef HAVE_FREEIPMI_11X_12X
|
||||
nut_freeipmi_cleanup(fru_parse_ctx, sdr_ctx);
|
||||
|
|
@ -253,7 +308,7 @@ int is_ipmi_device_supported(ipmi_ctx_t ipmi_ctx, int ipmi_id)
|
|||
return 0;
|
||||
}
|
||||
|
||||
if ((*nut_ipmi_fru_parse_open_device_id) (fru_parse_ctx, ipmi_id) < 0)
|
||||
if ((*nut_ipmi_fru_open_device_id) (fru_parse_ctx, ipmi_id) < 0)
|
||||
{
|
||||
#ifdef HAVE_FREEIPMI_11X_12X
|
||||
nut_freeipmi_cleanup(fru_parse_ctx, sdr_ctx);
|
||||
|
|
@ -268,14 +323,14 @@ int is_ipmi_device_supported(ipmi_ctx_t ipmi_ctx, int ipmi_id)
|
|||
/* clear fields */
|
||||
area_type = 0;
|
||||
area_length = 0;
|
||||
memset (areabuf, '\0', IPMI_FRU_PARSE_AREA_SIZE_MAX + 1);
|
||||
memset (areabuf, '\0', IPMI_FRU_AREA_SIZE_MAX + 1);
|
||||
|
||||
/* parse FRU buffer */
|
||||
if ((*nut_ipmi_fru_parse_read_data_area) (fru_parse_ctx,
|
||||
if ((*nut_ipmi_fru_read_data_area) (fru_parse_ctx,
|
||||
&area_type,
|
||||
&area_length,
|
||||
areabuf,
|
||||
IPMI_FRU_PARSE_AREA_SIZE_MAX) < 0)
|
||||
IPMI_FRU_AREA_SIZE_MAX) < 0)
|
||||
{
|
||||
#ifdef HAVE_FREEIPMI_11X_12X
|
||||
nut_freeipmi_cleanup(fru_parse_ctx, sdr_ctx);
|
||||
|
|
@ -287,7 +342,7 @@ int is_ipmi_device_supported(ipmi_ctx_t ipmi_ctx, int ipmi_id)
|
|||
|
||||
if (area_length)
|
||||
{
|
||||
if (area_type == IPMI_FRU_PARSE_AREA_TYPE_MULTIRECORD_POWER_SUPPLY_INFORMATION)
|
||||
if (area_type == IPMI_FRU_AREA_TYPE_MULTIRECORD_POWER_SUPPLY_INFORMATION)
|
||||
{
|
||||
/* Found a POWER_SUPPLY record */
|
||||
#ifdef HAVE_FREEIPMI_11X_12X
|
||||
|
|
@ -298,7 +353,7 @@ int is_ipmi_device_supported(ipmi_ctx_t ipmi_ctx, int ipmi_id)
|
|||
return 1;
|
||||
}
|
||||
}
|
||||
} while ((ret = (*nut_ipmi_fru_parse_next) (fru_parse_ctx)) == 1);
|
||||
} while ((ret = (*nut_ipmi_fru_next) (fru_parse_ctx)) == 1);
|
||||
|
||||
/* No need for further errors checking */
|
||||
#ifdef HAVE_FREEIPMI_11X_12X
|
||||
|
|
@ -309,15 +364,16 @@ int is_ipmi_device_supported(ipmi_ctx_t ipmi_ctx, int ipmi_id)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* return NULL on error */
|
||||
nutscan_device_t * nutscan_scan_ipmi()
|
||||
/* Check for IPMI support on a specific (local or remote) system
|
||||
* Return NULL on error, or a valid nutscan_device_t otherwise */
|
||||
nutscan_device_t * nutscan_scan_ipmi_device(const char * IPaddr, nutscan_ipmi_t * ipmi_sec)
|
||||
{
|
||||
ipmi_ctx_t ipmi_ctx = NULL;
|
||||
nutscan_device_t * nut_dev = NULL;
|
||||
nutscan_device_t * current_nut_dev = NULL;
|
||||
int ret = -1;
|
||||
int ipmi_id = 0;
|
||||
char port_id[10];
|
||||
char port_id[64];
|
||||
|
||||
if( !nutscan_avail_ipmi ) {
|
||||
return NULL;
|
||||
|
|
@ -331,24 +387,131 @@ nutscan_device_t * nutscan_scan_ipmi()
|
|||
return NULL;
|
||||
}
|
||||
|
||||
if ((ret = (*nut_ipmi_ctx_find_inband) (ipmi_ctx,
|
||||
NULL,
|
||||
0, /* don't disable auto-probe */
|
||||
0,
|
||||
0,
|
||||
NULL,
|
||||
0, /* workaround flags, none by default */
|
||||
0 /* flags */
|
||||
)) < 0)
|
||||
/* Are we scanning locally, or over the network? */
|
||||
if (IPaddr == NULL)
|
||||
{
|
||||
fprintf(stderr, "ipmi_ctx_find_inband: %s\n",
|
||||
(*nut_ipmi_ctx_errormsg) (ipmi_ctx));
|
||||
return NULL;
|
||||
/* FIXME: we need root right to access local IPMI!
|
||||
if (!ipmi_is_root ()) {
|
||||
fprintf(stderr, "IPMI scan: %s\n", ipmi_ctx_strerror (IPMI_ERR_PERMISSION));
|
||||
} */
|
||||
|
||||
if ((ret = (*nut_ipmi_ctx_find_inband) (ipmi_ctx,
|
||||
NULL,
|
||||
0, /* don't disable auto-probe */
|
||||
0,
|
||||
0,
|
||||
NULL,
|
||||
0, /* workaround flags, none by default */
|
||||
0 /* flags */
|
||||
)) < 0)
|
||||
{
|
||||
fprintf(stderr, "ipmi_ctx_find_inband: %s\n",
|
||||
(*nut_ipmi_ctx_errormsg) (ipmi_ctx));
|
||||
return NULL;
|
||||
}
|
||||
if (!ret)
|
||||
{
|
||||
/* No local IPMI device detected */
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
if (!ret)
|
||||
{
|
||||
/* No local IPMI device detected */
|
||||
return NULL;
|
||||
else {
|
||||
|
||||
#if 0
|
||||
if (ipmi_sec->ipmi_version == IPMI_2_0) {
|
||||
|
||||
/* FIXME: need processing?!
|
||||
* int parse_kg (void *out, unsigned int outlen, const char *in)
|
||||
* if ((rv = parse_kg (common_cmd_args_config->k_g, IPMI_MAX_K_G_LENGTH + 1, data->string)) < 0)
|
||||
* {
|
||||
* fprintf (stderr, "Config File Error: k_g input formatted incorrectly\n");
|
||||
* exit (EXIT_FAILURE);
|
||||
* }*/
|
||||
if ((ret = (*nut_ipmi_ctx_open_outofband_2_0) (ipmi_ctx,
|
||||
IPaddr,
|
||||
ipmi_sec->username,
|
||||
ipmi_sec->password,
|
||||
ipmi_sec->K_g_BMC_key,
|
||||
??? (ipmi_sec->K_g_BMC_key) ? config->k_g_len : 0,
|
||||
ipmi_sec->privilege_level,
|
||||
ipmi_sec->cipher_suite_id,
|
||||
IPMI_SESSION_TIMEOUT_LENGTH_DEFAULT,
|
||||
IPMI_RETRANSMISSION_TIMEOUT_LENGTH_DEFAULT,
|
||||
ipmi_dev->workaround_flags,
|
||||
flags) < 0)
|
||||
{
|
||||
IPMI_MONITORING_DEBUG (("ipmi_ctx_open_outofband_2_0: %s", ipmi_ctx_errormsg (c->ipmi_ctx)));
|
||||
if (ipmi_ctx_errnum (c->ipmi_ctx) == IPMI_ERR_USERNAME_INVALID)
|
||||
c->errnum = IPMI_MONITORING_ERR_USERNAME_INVALID;
|
||||
else if (ipmi_ctx_errnum (c->ipmi_ctx) == IPMI_ERR_PASSWORD_INVALID)
|
||||
c->errnum = IPMI_MONITORING_ERR_PASSWORD_INVALID;
|
||||
else if (ipmi_ctx_errnum (c->ipmi_ctx) == IPMI_ERR_PRIVILEGE_LEVEL_INSUFFICIENT)
|
||||
c->errnum = IPMI_MONITORING_ERR_PRIVILEGE_LEVEL_INSUFFICIENT;
|
||||
else if (ipmi_ctx_errnum (c->ipmi_ctx) == IPMI_ERR_PRIVILEGE_LEVEL_CANNOT_BE_OBTAINED)
|
||||
c->errnum = IPMI_MONITORING_ERR_PRIVILEGEL_LEVEL_CANNOT_BE_OBTAINED;
|
||||
else if (ipmi_ctx_errnum (c->ipmi_ctx) == IPMI_ERR_K_G_INVALID)
|
||||
c->errnum = IPMI_MONITORING_ERR_K_G_INVALID;
|
||||
else if (ipmi_ctx_errnum (c->ipmi_ctx) == IPMI_ERR_CIPHER_SUITE_ID_UNAVAILABLE)
|
||||
c->errnum = IPMI_MONITORING_ERR_CIPHER_SUITE_ID_UNAVAILABLE;
|
||||
else if (ipmi_ctx_errnum (c->ipmi_ctx) == IPMI_ERR_PASSWORD_VERIFICATION_TIMEOUT)
|
||||
c->errnum = IPMI_MONITORING_ERR_PASSWORD_VERIFICATION_TIMEOUT;
|
||||
else if (ipmi_ctx_errnum (c->ipmi_ctx) == IPMI_ERR_IPMI_2_0_UNAVAILABLE)
|
||||
c->errnum = IPMI_MONITORING_ERR_IPMI_2_0_UNAVAILABLE;
|
||||
else if (ipmi_ctx_errnum (c->ipmi_ctx) == IPMI_ERR_CONNECTION_TIMEOUT)
|
||||
c->errnum = IPMI_MONITORING_ERR_CONNECTION_TIMEOUT;
|
||||
else if (ipmi_ctx_errnum (c->ipmi_ctx) == IPMI_ERR_SESSION_TIMEOUT)
|
||||
c->errnum = IPMI_MONITORING_ERR_SESSION_TIMEOUT;
|
||||
else if (ipmi_ctx_errnum (c->ipmi_ctx) == IPMI_ERR_BAD_COMPLETION_CODE
|
||||
|| ipmi_ctx_errnum (c->ipmi_ctx) == IPMI_ERR_IPMI_ERROR)
|
||||
c->errnum = IPMI_MONITORING_ERR_IPMI_ERROR;
|
||||
else if (ipmi_ctx_errnum (c->ipmi_ctx) == IPMI_ERR_BMC_BUSY)
|
||||
c->errnum = IPMI_MONITORING_ERR_BMC_BUSY;
|
||||
else if (ipmi_ctx_errnum (c->ipmi_ctx) == IPMI_ERR_OUT_OF_MEMORY)
|
||||
c->errnum = IPMI_MONITORING_ERR_OUT_OF_MEMORY;
|
||||
else if (ipmi_ctx_errnum (c->ipmi_ctx) == IPMI_ERR_HOSTNAME_INVALID)
|
||||
c->errnum = IPMI_MONITORING_ERR_HOSTNAME_INVALID;
|
||||
else if (ipmi_ctx_errnum (c->ipmi_ctx) == IPMI_ERR_PARAMETERS)
|
||||
c->errnum = IPMI_MONITORING_ERR_PARAMETERS;
|
||||
else if (ipmi_ctx_errnum (c->ipmi_ctx) == IPMI_ERR_SYSTEM_ERROR)
|
||||
c->errnum = IPMI_MONITORING_ERR_SYSTEM_ERROR;
|
||||
else
|
||||
c->errnum = IPMI_MONITORING_ERR_INTERNAL_ERROR;
|
||||
return (-1);
|
||||
}
|
||||
}
|
||||
else { /* Not IPMI 2.0 */
|
||||
|
||||
#endif /* 0 */
|
||||
|
||||
/* Fall back to IPMI 1.5 */
|
||||
if ((ret = (*nut_ipmi_ctx_open_outofband) (ipmi_ctx,
|
||||
IPaddr,
|
||||
ipmi_sec->username,
|
||||
ipmi_sec->password,
|
||||
ipmi_sec->authentication_type,
|
||||
ipmi_sec->privilege_level,
|
||||
IPMI_SESSION_TIMEOUT_LENGTH_DEFAULT,
|
||||
IPMI_RETRANSMISSION_TIMEOUT_LENGTH_DEFAULT,
|
||||
ipmi_sec->workaround_flags,
|
||||
IPMI_FLAGS_DEFAULT
|
||||
)) < 0)
|
||||
{
|
||||
/* No IPMI device detected on this host!
|
||||
if ((*nut_ipmi_ctx_errnum) (ipmi_ctx) == IPMI_ERR_USERNAME_INVALID
|
||||
|| (*nut_ipmi_ctx_errnum) (ipmi_ctx) == IPMI_ERR_PASSWORD_INVALID
|
||||
|| (*nut_ipmi_ctx_errnum) (ipmi_ctx) == IPMI_ERR_PRIVILEGE_LEVEL_INSUFFICIENT
|
||||
|| (*nut_ipmi_ctx_errnum) (ipmi_ctx) == IPMI_ERR_PRIVILEGE_LEVEL_CANNOT_BE_OBTAINED
|
||||
|| (*nut_ipmi_ctx_errnum) (ipmi_ctx) == IPMI_ERR_AUTHENTICATION_TYPE_UNAVAILABLE
|
||||
|| (*nut_ipmi_ctx_errnum) (ipmi_ctx) == IPMI_ERR_PASSWORD_VERIFICATION_TIMEOUT
|
||||
|| (*nut_ipmi_ctx_errnum) (ipmi_ctx) == IPMI_ERR_HOSTNAME_INVALID
|
||||
|| (*nut_ipmi_ctx_errnum) (ipmi_ctx) == IPMI_ERR_CONNECTION_TIMEOUT) { */
|
||||
|
||||
/* FIXME: don't log timeout errors */
|
||||
fprintf(stderr, "nut_ipmi_ctx_open_outofband: %s\n",
|
||||
(*nut_ipmi_ctx_errormsg) (ipmi_ctx));
|
||||
return NULL;
|
||||
/*}*/
|
||||
}
|
||||
}
|
||||
|
||||
/* Loop through all possible components */
|
||||
|
|
@ -365,9 +528,17 @@ nutscan_device_t * nutscan_scan_ipmi()
|
|||
/* Fill the device structure (sufficient with driver and port) */
|
||||
nut_dev->type = TYPE_IPMI;
|
||||
nut_dev->driver = strdup(NUT_IPMI_DRV_NAME);
|
||||
sprintf(port_id, "id%x", ipmi_id);
|
||||
if (IPaddr == NULL) {
|
||||
sprintf(port_id, "id%x", ipmi_id);
|
||||
}
|
||||
else {
|
||||
/* FIXME: also check against "localhost" and its IPv{4,6} */
|
||||
sprintf(port_id, "id%x@%s", ipmi_id, IPaddr);
|
||||
}
|
||||
nut_dev->port = strdup(port_id);
|
||||
|
||||
/* FIXME: also dump device.serial?
|
||||
* using drivers/libfreeipmi_get_board_info() */
|
||||
|
||||
current_nut_dev = nutscan_add_device_to_device(
|
||||
current_nut_dev,
|
||||
nut_dev);
|
||||
|
|
@ -384,9 +555,50 @@ nutscan_device_t * nutscan_scan_ipmi()
|
|||
|
||||
return current_nut_dev;
|
||||
}
|
||||
|
||||
/* General IPMI scan entry point: scan 1 to n devices, local or remote,
|
||||
* for IPMI support
|
||||
* Return NULL on error, or a valid nutscan_device_t otherwise */
|
||||
nutscan_device_t * nutscan_scan_ipmi(const char * start_ip, const char * stop_ip, nutscan_ipmi_t * sec)
|
||||
{
|
||||
nutscan_ip_iter_t ip;
|
||||
char * ip_str = NULL;
|
||||
nutscan_ipmi_t * tmp_sec;
|
||||
nutscan_device_t * nut_dev = NULL;
|
||||
nutscan_device_t * current_nut_dev = NULL;
|
||||
|
||||
if( !nutscan_avail_ipmi ) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/* Are we scanning locally, or through the network? */
|
||||
if (start_ip == NULL)
|
||||
{
|
||||
/* Local PSU scan */
|
||||
current_nut_dev = nutscan_scan_ipmi_device(NULL, NULL);
|
||||
}
|
||||
else {
|
||||
ip_str = nutscan_ip_iter_init(&ip, start_ip, stop_ip);
|
||||
|
||||
while(ip_str != NULL) {
|
||||
tmp_sec = malloc(sizeof(nutscan_ipmi_t));
|
||||
memcpy(tmp_sec, sec, sizeof(nutscan_ipmi_t));
|
||||
|
||||
if ((current_nut_dev = nutscan_scan_ipmi_device(ip_str, tmp_sec)) != NULL) {
|
||||
/* Store the positive result */
|
||||
current_nut_dev = nutscan_add_device_to_device(current_nut_dev, nut_dev);
|
||||
}
|
||||
/* Prepare the next iteration */
|
||||
ip_str = nutscan_ip_iter_inc(&ip);
|
||||
};
|
||||
}
|
||||
|
||||
return nutscan_rewind_device(current_nut_dev);
|
||||
}
|
||||
#else /* WITH_IPMI */
|
||||
/* stub function */
|
||||
nutscan_device_t * nutscan_scan_ipmi()
|
||||
nutscan_device_t * nutscan_scan_ipmi(const char * startIP, const char * stopIP, nutscan_ipmi_t * sec)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ static int (*nut_upscli_list_start)(UPSCONN_t *ups, unsigned int numq,
|
|||
const char **query);
|
||||
static int (*nut_upscli_list_next)(UPSCONN_t *ups, unsigned int numq,
|
||||
const char **query,unsigned int *numa, char ***answer);
|
||||
static int (*nut_upscli_disconnect)(UPSCONN_t *ups);
|
||||
|
||||
static nutscan_device_t * dev_ret = NULL;
|
||||
#ifdef HAVE_PTHREAD
|
||||
|
|
@ -98,6 +99,12 @@ int nutscan_load_upsclient_library()
|
|||
goto err;
|
||||
}
|
||||
|
||||
*(void **) (&nut_upscli_disconnect) = lt_dlsym(dl_handle,
|
||||
"upscli_disconnect");
|
||||
if ((dl_error = lt_dlerror()) != NULL) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
return 1;
|
||||
err:
|
||||
fprintf(stderr, "Cannot load NUT library (%s) : %s. NUT search disabled.\n", libname, dl_error);
|
||||
|
|
@ -133,6 +140,7 @@ static void * list_nut_devices(void * arg)
|
|||
free(ups);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((*nut_upscli_tryconnect)(ups, hostname, port,UPSCLI_CONN_TRYSSL,&tv) < 0) {
|
||||
free(target_hostname);
|
||||
free(nut_arg);
|
||||
|
|
@ -141,6 +149,7 @@ static void * list_nut_devices(void * arg)
|
|||
}
|
||||
|
||||
if((*nut_upscli_list_start)(ups, numq, query) < 0) {
|
||||
(*nut_upscli_disconnect)(ups);
|
||||
free(target_hostname);
|
||||
free(nut_arg);
|
||||
free(ups);
|
||||
|
|
@ -150,6 +159,7 @@ static void * list_nut_devices(void * arg)
|
|||
while ((*nut_upscli_list_next)(ups,numq, query, &numa, &answer) == 1) {
|
||||
/* UPS <upsname> <description> */
|
||||
if (numa < 3) {
|
||||
(*nut_upscli_disconnect)(ups);
|
||||
free(target_hostname);
|
||||
free(nut_arg);
|
||||
free(ups);
|
||||
|
|
@ -164,7 +174,7 @@ static void * list_nut_devices(void * arg)
|
|||
dev = nutscan_new_device();
|
||||
dev->type = TYPE_NUT;
|
||||
dev->driver = strdup("nutclient");
|
||||
/* +1+1 is for '@' character and terminnating 0 */
|
||||
/* +1+1 is for '@' character and terminating 0 */
|
||||
buf_size = strlen(answer[1])+strlen(hostname)+1+1;
|
||||
dev->port = malloc(buf_size);
|
||||
if( dev->port ) {
|
||||
|
|
@ -182,6 +192,7 @@ static void * list_nut_devices(void * arg)
|
|||
}
|
||||
}
|
||||
|
||||
(*nut_upscli_disconnect)(ups);
|
||||
free(target_hostname);
|
||||
free(nut_arg);
|
||||
free(ups);
|
||||
|
|
@ -269,5 +280,5 @@ nutscan_device_t * nutscan_scan_nut(const char* startIP, const char* stopIP, con
|
|||
signal(SIGPIPE,SIG_DFL);
|
||||
}
|
||||
|
||||
return dev_ret;
|
||||
return nutscan_rewind_device(dev_ret);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -697,7 +697,7 @@ nutscan_device_t * nutscan_scan_snmp(const char * start_ip, const char * stop_ip
|
|||
free(thread_array);
|
||||
#endif
|
||||
|
||||
return dev_ret;
|
||||
return nutscan_rewind_device(dev_ret);
|
||||
}
|
||||
#else /* WITH_SNMP */
|
||||
nutscan_device_t * nutscan_scan_snmp(const char * start_ip, const char * stop_ip,long usec_timeout, nutscan_snmp_t * sec)
|
||||
|
|
|
|||
|
|
@ -177,7 +177,7 @@ nutscan_device_t * nutscan_scan_usb()
|
|||
dev->descriptor.iSerialNumber,
|
||||
string, sizeof(string));
|
||||
if (ret > 0) {
|
||||
serialnumber = strdup(string);
|
||||
serialnumber = strdup(rtrim(string, ' '));
|
||||
}
|
||||
}
|
||||
/* get product name */
|
||||
|
|
@ -186,7 +186,7 @@ nutscan_device_t * nutscan_scan_usb()
|
|||
dev->descriptor.iProduct,
|
||||
string, sizeof(string));
|
||||
if (ret > 0) {
|
||||
device_name = strdup(string);
|
||||
device_name = strdup(rtrim(string, ' '));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -196,7 +196,7 @@ nutscan_device_t * nutscan_scan_usb()
|
|||
dev->descriptor.iManufacturer,
|
||||
string, sizeof(string));
|
||||
if (ret > 0) {
|
||||
vendor_name = strdup(string);
|
||||
vendor_name = strdup(rtrim(string, ' '));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -255,7 +255,7 @@ nutscan_device_t * nutscan_scan_usb()
|
|||
}
|
||||
}
|
||||
|
||||
return current_nut_dev;
|
||||
return nutscan_rewind_device(current_nut_dev);
|
||||
}
|
||||
#else /* WITH_USB */
|
||||
nutscan_device_t * nutscan_scan_usb()
|
||||
|
|
|
|||
|
|
@ -231,7 +231,7 @@ nutscan_device_t * nutscan_scan_xml_http(long usec_timeout)
|
|||
}
|
||||
|
||||
|
||||
return current_nut_dev;
|
||||
return nutscan_rewind_device(current_nut_dev);
|
||||
}
|
||||
#else /* WITH_NEON */
|
||||
nutscan_device_t * nutscan_scan_xml_http(long usec_timeout)
|
||||
|
|
|
|||
|
|
@ -297,6 +297,12 @@ sub find_usbdevs
|
|||
elsif ($nameFile eq "richcomm_usb.c") {
|
||||
$driver="richcomm_usb";
|
||||
}
|
||||
elsif ($nameFile eq "riello_usb.c") {
|
||||
$driver="riello_usb";
|
||||
}
|
||||
elsif ($nameFile eq "nutdrv_qx.c") {
|
||||
$driver="nutdrv_qx";
|
||||
}
|
||||
else {
|
||||
die "Unknown driver type: $nameFile";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,21 +0,0 @@
|
|||
esr-guest:Eric S. Raymond <esr-guest@alioth.debian.org>
|
||||
lestat-guest:David Goncalves <david@lestat.st>
|
||||
agordeev-guest:Alexander Gordeev <agordeev-guest@alioth.debian.org>
|
||||
emilienkia-guest:Emilien Kia <emilienkia-guest@alioth.debian.org>
|
||||
prachi-guest:Prachi Gandhi <prachi-guest@alioth.debian.org>
|
||||
praveenkumar-guest:Praveen Kumar <praveenkumar-guest@alioth.debian.org>
|
||||
msoltyspl-guest:Michal Soltys <msoltyspl-guest@alioth.debian.org>
|
||||
keyson-guest:Kjell Claesson <keyson-guest@alioth.debian.org>
|
||||
chetanagarwal-guest:Chetan Agarwal <chetanagarwal-guest@alioth.debian.org>
|
||||
fbohe-guest:Frederic Bohe <fbohe-guest@alioth.debian.org>
|
||||
aquette:Arnaud Quette <arnaud.quette@free.fr>
|
||||
clepple-guest:Charles Lepple <clepple+nut@gmail.com>
|
||||
adkorte-guest:Arjen de Korte <adkorte-guest@alioth.debian.org>
|
||||
selinger-guest:Peter Selinger <selinger@users.sourceforge.net>
|
||||
carlosefr-guest:Carlos Rodrigues <cefrodrigues@gmail.com>
|
||||
nba-guest:Niels Baggesen <nba@users.sourceforge.net>
|
||||
lyrgard-guest:Jonathan Dion <lyrgard-guest@alioth.debian.org>
|
||||
jongough-guest:Jon Gough <jon.gough@eclipsesystems.com.au>
|
||||
mihl-guest:Michal Hlavinka <mhlavink@redhat.com>
|
||||
acolombier-guest:Antoine Colombier <acolombier-guest@alioth.debian.org>
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue