Giter Site home page Giter Site logo

Comments (3)

lewisxy avatar lewisxy commented on May 27, 2024 1

Thanks for the help. I managed to build it. Here is some note.
My server is running Ubuntu 20.04 LTS. So I created an VM with the same OS to build things.

My configuration command is

./configure --prefix= \
                             --with-user=nut --with-group=nut \
                             --with-modbus \
                             --sysconfdir=/etc/nut \
                             --includedir=/usr/include \
                             --with-dev \
                             --enable-static \
                             --with-statepath=/run/nut \
                             --with-altpidpath=/run/nut \
                             --with-drvpath=/lib/nut \
                             --with-pidpath=/run/nut \
                             --datadir=/usr/share/nut \
                             --with-pkgconfig-dir=/usr/lib/pkgconfig

This is partially adapted from @biergaizi 's and partially from rules defined in the package source. Note that libmodbus-dev need to be installed for configuration to succeed. After configuration, I just followed the build instructions from @biergaizi , and copy the binary to my server. I also installed libmodbus5 on the server.

The modbus driver provides way more information and controls than the usbhid-ups I was using before. For example, I can now read the ups.load and shutdown/power cycle each outlet groups independently, which are previously unavailable.

from nut.

biergaizi avatar biergaizi commented on May 27, 2024

Yes, it's possible. As a driver developer, I've used this method extensively for testing purpose.

In order to do that, the driver must be built using the same search paths as the system-wide NUT installation when running ./configure, otherwise they would be unable to find each other's files. For example, on Debian, it would be:

./configure --with-modbus \
    --with-user=nut --with-group=dialout \
    --datadir=/usr/share/nut \
    --sysconfdir=/etc/ups \
    --with-statepath=/var/run/nut \
    --with-pidpath=/var/run/nut \
    --with-altpidpath=/var/run/nut \
    --with-drvpath=/usr/sbin \
    --with-systemdsystemunitdir=/usr/lib/systemd/system \
    --with-pkgconfig-dir=/usr/lib/pkgconfig \
    --with-udev-dir=/usr/lib/udev \
    --libdir=/usr/lib/

All of these parameters must be set identical to the system-wide NUT package. Thus, it's often necessary to examine the source code of your distro package's build files to find the correct values. Don't use random values, it won't work and may mess your system up.

But if you're able to do that, all you need is to:

# compile include/ separately
cd include
make
cd ..

# compile common/ separately
cd common/
make
cd ..

# compile driver-name separately
cd drivers
make driver-name

Then, simply copy the driver to your system's path.

from nut.

jimklimov avatar jimklimov commented on May 27, 2024

For apc_modbus in particular, if you plan to use USB connection, you would need a custom-built libmodbus and then configure NUT against that (see wiki).

For Serial and TCP links the stock version should do.

from nut.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.