[Nut-upsuser] Need nutdrv_atcl_usb for Windows port

hamberthm at gmail.com hamberthm at gmail.com
Sun Mar 12 19:40:29 UTC 2017


SUCCESS! Setting the flag  --disable-shared when using the ./configure command solved the problem. THANKS CHARLES, I couldn’t have done it if you haven’t told me the problem was Libtool and its dynamic libraries. 

As you can see, I’m a noob in the slow process of learning. Sorry if I spammed the forum too much with trivial things (for you).

Now, how can contribute my part to the project? The biggest challenge for the windows port (compiling) is already done by Denis and his guide. I can add the modified source for nutdrv_atcl_usb to the repositories but I haven’t any experience on doing that as well. Also I don’t know how to make it work with dynamic libraries. Maybe the whole Windows port is statically built since my nutdrv_atcl_usb.exe is pretty much equal to the other ones at 240 KB.

Anyway, you have my email.

Cheers to the NUT project!

Humberto

Gesendet von Mail für Windows 10

Von: Humberto Möckel
Gesendet: Samstag, 11. März 2017 18:29
An: nut-upsuser at lists.alioth.debian.org
Betreff: Re: [Nut-upsuser] Need nutdrv_atcl_usb for Windows port

Hello Charles and first of all, thank you so mucho for replying. I really appreciate your help.

This is the guide I was talking about: http://lists.alioth.debian.org/pipermail/nut-upsdev/2016-April/007171.html

All the versions of MinGW and msys plugins I'm using are exactly the ones listed on that guide written by Denis Serov. 

The procedure I used to compile is also the same as Denis suggested, but I made some changes on my own in the "build NUT" step since I added the "nutdrv_atcl_usb.c" source file from the last version of NUT, not present in the latest Windows build. Those are:

- Patched file "nut-usbinfo.pl" as otherwise it will abort the make process with an error. In the section "process the driver name" with the following code (same as latest NUT linux version):

elsif ($nameFile eq "nutdrv_atcl_usb.c") {
    $driver="nutdrv_atcl_usb";

- Patched the "makefile.am" in the drivers folder so it will include the source in the build. I added nutdrv_atcl_usb to the USB_LIBUSB_DRIVERLIST and added the LDADD/CFLAGS.

NOTE: I have no idea what those edits do. The only thing I wanted is the compiler to see the new source and compile it. So I just blindly searched mentions of the driver inside all the latest linux build sources and tried to patch them the same way on the outdated windows port. The two files above were all I could find where the driver was mentioned.

Also made two minor changes to the source file itself, fixed one variable that was giving error at building (I think it was something like USB sleep that I fixed to 5000), and the SleepEx() function instead of the sleep() one since the windows port was redefining sleep() to Sleep() and this one doesn't return 0 once the time has elapsed. 

For the build commands, I use as follows. I added the flag "--enable-maintainer-mode"  as I read in the developer guide to allow regeneration of the makefile.in:


[shell]
    cd /home/Administrator/nut-2.6.5-7
    autogen.sh --enable-maintainer-mode
   ./configure --with-doc=html-single CPPFLAGS="-DWINVER=0x0501 -D_WIN32_WINNT=0x0501" --enable-maintainer-mode
    export XML_CATALOG_FILES=/mingw/etc/xml/catalog
    make
    cd /docs/man
    make html-man

Now in response to you suggestion; I have no idea what NUT Scanner does and if I need it or not. The only thing I want is to use this driver so I can manage my UPS with NUT, and if possible to publish the changes I made so other people can use it.

I will wait for your answer anxiously. It has been a week of hours of trial and error and making this to work would be so nice!

THANKS!


On Sat, Mar 11, 2017 at 11:20 AM, Charles Lepple <clepple at gmail.com> wrote:
On Mar 10, 2017, at 5:25 PM, hamberthm at gmail.com wrote:
>
> UPDATE: I managed to build the windows port using a guide a user posted a while ago.

Which guide?

> I’ve also corrected a couple of variables like the SleepEx() function instead of the sleep() used in Linux. I’ve successfully compiled the EXE for nutdrv_atcl_usb but when I execute it via upsdrvctl it gives the following output:
>
> C:\MinGW\msys\1.0\home\Administrator\nut-2.6.5-7\drivers>nutdrv_atcl_usb
> nutdrv_atcl_usb:./.libs/lt-nutdrv_atcl_usb.c:233: FATAL: couldn't find nutdrv_atcl_usb.
>
> Now I have no idea how to continue…
>

The lt-*.c part indicates that the problem is likely related to libtool. Do you need any of the functionality like nut-scanner which requires libtool? If not, it might be possible to reconfigure for a static build.

It might help to see the ./configure parameters you used, plus any patches. Also, versions of the various MinGW/msys components would probably be useful for anyone else trying to build for Windows.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/nut-upsuser/attachments/20170312/7060049d/attachment.html>


More information about the Nut-upsuser mailing list