You are not logged in.

#1 2009-11-12 17:30:34

Garret
Member
From: Palermo, Italy
Registered: 2006-07-09
Posts: 172

How to get my UPS working with NUT?

I recently bought an UPS (an Atlantis-Land A03-S1501 - OnePower 1501 of 1500VA and 900Watt).
I installed NUT (network-ups-tools) from the community repository. It's linked to my PC through an USB cable (like printers).

I configured NUT as follows:

# /etc/ups/ups.conf
[atlantis]
driver = megatec_usb
desc = "Main ups"
port = auto
# /etc/ups/upsd.conf
LISTEN 127.0.0.1
# /etc/ups/upsd.users
[garret]
password = mypassword
upsmon master
# /etc/ups/upsmon.conf
MONITOR atlantis@desktop 1 garret mypassowrd master
MINSUPPLIES 1
SHUTDOWNCMD "/sbin/shutdown -h +0"
POLLFREQ 5
POLLFREQALERT 5
HOSTSYNC 15
DEADTIME 15
POWERDOWNFLAG /etc/killpower
RBWARNTIME 43200
NOCOMMWARNTIME 300
FINALDELAY 5

When I start the daemon all seems working (I hear two beep from the UPS) but checking the daemon.log it says:

Nov 12 18:13:59 desktop megatec_usb[3287]: Startup successful
Nov 12 18:13:59 desktop upsd[3288]: listening on 127.0.0.1 port 3493
Nov 12 18:13:59 desktop upsd[3288]: Connected to UPS [atlantis]: megatec_usb-atlantis
Nov 12 18:13:59 desktop upsd[3289]: Startup successful
Nov 12 18:13:59 desktop upsmon[3291]: Startup successful
Nov 12 18:13:59 desktop upsmon[3292]: Login on UPS [atlantis@desktop] failed - got [ERR ACCESS-DENIED]
Nov 12 18:14:14 desktop megatec_usb[2544]: ser_send_pace: Device detached? (error -5: could not claim interface 0: Device or resource busy)
Nov 12 18:14:15 desktop megatec_usb[2544]: Successfully reconnected
Nov 12 18:14:38 desktop megatec_usb[2022]: ser_send_pace: Device detached? (error -5: error sending control message: Operation not permitted)
Nov 12 18:14:39 desktop megatec_usb[2022]: Successfully reconnected
Nov 12 18:15:22 desktop upsd[3308]: not listening on 127.0.0.1 port 3493
Nov 12 18:18:44 desktop megatec_usb[2482]: ser_send_pace: Device detached? (error -5: could not claim interface 0: Device or resource busy)
Nov 12 18:18:45 desktop megatec_usb[2482]: Successfully reconnected
Nov 12 18:21:23 desktop megatec_usb[2482]: ser_send_pace: Device detached? (error -5: could not claim interface 0: Device or resource busy)
Nov 12 18:21:23 desktop megatec_usb[2482]: Successfully reconnected

and

[garret@desktop ~]$ sudo upsd
Network UPS Tools upsd 2.4.1
not listening on 127.0.0.1 port 3493
[garret@desktop ~]$ sudo upsdrvctl start
Network UPS Tools - UPS driver controller 2.4.1
Network UPS Tools - Megatec protocol driver 1.6 (2.4.1)
Serial-over-USB transport layer 0.10
Megatec protocol UPS detected [  VT1208AG].
[garret@desktop ~]$

Last edited by Garret (2009-11-12 17:32:27)

Offline

#2 2009-11-23 09:11:27

kaivalagi
Member
From: Norwich, UK
Registered: 2009-11-05
Posts: 145

Re: How to get my UPS working with NUT?

I recently bought a Trust 1300VA Management UPS PW-4130M and have problems communicating with it via the megatec_usb driver. NUT fails to communicate with the device via USB, even though the device is known to work according to the NUT site.

All conf files are configured correctly AFAIK and daemon log looks like:

upsd[2137]: Can't connect to UPS [ups1] (megatec_usb-ups1): No such file or directory
upsmon[2141]: Poll UPS [ups1@localhost] failed - Driver not connected

Looking at the usb devices on my system via lsusb -v I find the following for the UPS:

Bus 002 Device 004: ID 06da:0003 Phoenixtec Power Co., Ltd 
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0         8
  idVendor           0x06da Phoenixtec Power Co., Ltd
  idProduct          0x0003 
  bcdDevice            5.01
  iManufacturer           3 
  iProduct                1 
  iSerial                 0 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           34
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0xa0
      (Bus Powered)
      Remote Wakeup
    MaxPower              100mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      0 No Subclass
      bInterfaceProtocol      0 None
      iInterface              0 
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.11
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      27
         Report Descriptors: 
           ** UNAVAILABLE **
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0008  1x 8 bytes
        bInterval              12
cannot read device status, Operation not permitted (1)

If I attempt to connect to the device directly using the megatec_usb driver as so:

sudo megatec_usb -u root -DDDDD -a ups1

I get the following returned:

Network UPS Tools - Megatec protocol driver 1.6 (2.4.1)
Serial-over-USB transport layer 0.10
send_to_all: SETINFO driver.parameter.port "auto"
debug level is '5'
...
...
Checking device (06DA/0003) (002/004)
- VendorID: 06da
- ProductID: 0003
- Manufacturer: CTN
- Product: USB UPS
- Serial Number: unknown
- Bus: 002
Trying to match device
Device matches
DTR=1, RTS=0
Starting UPS detection process...
Asking for UPS information [i]...
I => FAILED [short read]
I detail: (1 bytes) => 49
Asking for UPS status [Q1]...
get_data_phoenix: got so far [(245.2 2]
get_data_phoenix: (8 bytes) => 28 32 34 35 2e 32 20 32
5]t_data_phoenix: got so far [(245.2 2001001
get_data_phoenix: (16 bytes) => 28 32 34 35 2e 32 20 32 30 30 31 30 30 31
 0d 35
5.2 032 5]hoenix: got so far [(245.2 2001001
get_data_phoenix: (24 bytes) => 28 32 34 35 2e 32 20 32 30 30 31 30 30 31
 0d 35 2e 32 20 30 33 32 20 35
5.2 032 50.1 13.6]got so far [(245.2 2001001
get_data_phoenix: (32 bytes) => 28 32 34 35 2e 32 20 32 30 30 31 30 30 31
 0d 35 2e 32 20 30 33 32 20 35 30 2e 31 20 31 33 2e 36
5.2 032 50.1 13.6 25.0 00]ar [(245.2 2001001
get_data_phoenix: (40 bytes) => 28 32 34 35 2e 32 20 32 30 30 31 30 30 31
 0d 35 2e 32 20 30 33 32 20 35 30 2e 31 20 31 33 2e 36 20 32 35 2e 30 20 30
 30
5]2 032 50.1 13.6 25.0 00001001245.2 2001001
get_data_phoenix: (48 bytes) => 28 32 34 35 2e 32 20 32 30 30 31 30 30 31
 0d 35 2e 32 20 30 33 32 20 35 30 2e 31 20 31 33 2e 36 20 32 35 2e 30 20 30
 30 30 30 31 30 30 31 0d 35
5.2 032 5].1 13.6 25.0 00001001245.2 2001001
get_data_phoenix: (56 bytes) => 28 32 34 35 2e 32 20 32 30 30 31 30 30 31
 0d 35 2e 32 20 30 33 32 20 35 30 2e 31 20 31 33 2e 36 20 32 35 2e 30 20 30
 30 30 30 31 30 30 31 0d 35 2e 32 20 30 33 32 20 35
5.2 032 50.1 13.6]25.0 00001001245.2 2001001
get_data_phoenix: (64 bytes) => 28 32 34 35 2e 32 20 32 30 30 31 30 30 31
 0d 35 2e 32 20 30 33 32 20 35 30 2e 31 20 31 33 2e 36 20 32 35 2e 30 20 30
 30 30 30 31 30 30 31 0d 35 2e 32 20 30 33 32 20 35 30 2e 31 20 31 33 2e 36
Q1 => FAILED [short read]
Q1 detail: (14 bytes) => 28 32 34 35 2e 32 20 32 30 30 31 30 30 31
Asking for UPS status [Q1]...
get_data_phoenix: got so far [(245.7 2]
get_data_phoenix: (8 bytes) => 28 32 34 35 2e 37 20 32
5]t_data_phoenix: got so far [(245.7 2001001
get_data_phoenix: (16 bytes) => 28 32 34 35 2e 37 20 32 30 30 31 30 30 31
 0d 35
5.7 032 5]hoenix: got so far [(245.7 2001001
get_data_phoenix: (24 bytes) => 28 32 34 35 2e 37 20 32 30 30 31 30 30 31
 0d 35 2e 37 20 30 33 32 20 35
5.7 032 50.1 13.6]got so far [(245.7 2001001
get_data_phoenix: (32 bytes) => 28 32 34 35 2e 37 20 32 30 30 31 30 30 31
 0d 35 2e 37 20 30 33 32 20 35 30 2e 31 20 31 33 2e 36
5.7 032 50.1 13.6 25.0 00]ar [(245.7 2001001
get_data_phoenix: (40 bytes) => 28 32 34 35 2e 37 20 32 30 30 31 30 30 31
 0d 35 2e 37 20 30 33 32 20 35 30 2e 31 20 31 33 2e 36 20 32 35 2e 30 20 30
 30
5]7 032 50.1 13.6 25.0 00001001245.7 2001001
get_data_phoenix: (48 bytes) => 28 32 34 35 2e 37 20 32 30 30 31 30 30 31
 0d 35 2e 37 20 30 33 32 20 35 30 2e 31 20 31 33 2e 36 20 32 35 2e 30 20 30
 30 30 30 31 30 30 31 0d 35
5.7 032 5].1 13.6 25.0 00001001245.7 2001001
get_data_phoenix: (56 bytes) => 28 32 34 35 2e 37 20 32 30 30 31 30 30 31
 0d 35 2e 37 20 30 33 32 20 35 30 2e 31 20 31 33 2e 36 20 32 35 2e 30 20 30
 30 30 30 31 30 30 31 0d 35 2e 37 20 30 33 32 20 35
5.7 032 50.1 13.6]25.0 00001001245.7 2001001
get_data_phoenix: (64 bytes) => 28 32 34 35 2e 37 20 32 30 30 31 30 30 31
 0d 35 2e 37 20 30 33 32 20 35 30 2e 31 20 31 33 2e 36 20 32 35 2e 30 20 30
 30 30 30 31 30 30 31 0d 35 2e 37 20 30 33 32 20 35 30 2e 31 20 31 33 2e 36
Q1 => FAILED [short read]
Q1 detail: (14 bytes) => 28 32 34 35 2e 37 20 32 30 30 31 30 30 31
Asking for UPS status [Q1]...
get_data_phoenix: got so far [(246.1 2]
get_data_phoenix: (8 bytes) => 28 32 34 36 2e 31 20 32
6]t_data_phoenix: got so far [(246.1 2001001
get_data_phoenix: (16 bytes) => 28 32 34 36 2e 31 20 32 30 30 31 30 30 31
 0d 36
6.1 032 5]hoenix: got so far [(246.1 2001001
get_data_phoenix: (24 bytes) => 28 32 34 36 2e 31 20 32 30 30 31 30 30 31
 0d 36 2e 31 20 30 33 32 20 35
6.1 032 50.1 13.6]got so far [(246.1 2001001
get_data_phoenix: (32 bytes) => 28 32 34 36 2e 31 20 32 30 30 31 30 30 31
 0d 36 2e 31 20 30 33 32 20 35 30 2e 31 20 31 33 2e 36
6.1 032 50.1 13.6 25.0 00]ar [(246.1 2001001
get_data_phoenix: (40 bytes) => 28 32 34 36 2e 31 20 32 30 30 31 30 30 31
 0d 36 2e 31 20 30 33 32 20 35 30 2e 31 20 31 33 2e 36 20 32 35 2e 30 20 30
 30
6]1 032 50.1 13.6 25.0 00001001246.1 2001001
get_data_phoenix: (48 bytes) => 28 32 34 36 2e 31 20 32 30 30 31 30 30 31
 0d 36 2e 31 20 30 33 32 20 35 30 2e 31 20 31 33 2e 36 20 32 35 2e 30 20 30
 30 30 30 31 30 30 31 0d 36
6.1 032 5].1 13.6 25.0 00001001246.1 2001001
get_data_phoenix: (56 bytes) => 28 32 34 36 2e 31 20 32 30 30 31 30 30 31
 0d 36 2e 31 20 30 33 32 20 35 30 2e 31 20 31 33 2e 36 20 32 35 2e 30 20 30
 30 30 30 31 30 30 31 0d 36 2e 31 20 30 33 32 20 35
6.1 032 50.1 13.6]25.0 00001001246.1 2001001
get_data_phoenix: (64 bytes) => 28 32 34 36 2e 31 20 32 30 30 31 30 30 31
 0d 36 2e 31 20 30 33 32 20 35 30 2e 31 20 31 33 2e 36 20 32 35 2e 30 20 30
 30 30 30 31 30 30 31 0d 36 2e 31 20 30 33 32 20 35 30 2e 31 20 31 33 2e 36
Q1 => FAILED [short read]
Q1 detail: (14 bytes) => 28 32 34 36 2e 31 20 32 30 30 31 30 30 31
Asking for UPS status [Q1]...
get_data_phoenix: got so far [(245.2 2]
get_data_phoenix: (8 bytes) => 28 32 34 35 2e 32 20 32
5]t_data_phoenix: got so far [(245.2 2001001
get_data_phoenix: (16 bytes) => 28 32 34 35 2e 32 20 32 30 30 31 30 30 31
 0d 35
5.2 031 5]hoenix: got so far [(245.2 2001001
get_data_phoenix: (24 bytes) => 28 32 34 35 2e 32 20 32 30 30 31 30 30 31
 0d 35 2e 32 20 30 33 31 20 35
5.2 031 50.1 13.6]got so far [(245.2 2001001
get_data_phoenix: (32 bytes) => 28 32 34 35 2e 32 20 32 30 30 31 30 30 31
 0d 35 2e 32 20 30 33 31 20 35 30 2e 31 20 31 33 2e 36
5.2 031 50.1 13.6 25.0 00]ar [(245.2 2001001
get_data_phoenix: (40 bytes) => 28 32 34 35 2e 32 20 32 30 30 31 30 30 31
 0d 35 2e 32 20 30 33 31 20 35 30 2e 31 20 31 33 2e 36 20 32 35 2e 30 20 30
 30
5]2 031 50.1 13.6 25.0 00001001245.2 2001001
get_data_phoenix: (48 bytes) => 28 32 34 35 2e 32 20 32 30 30 31 30 30 31
 0d 35 2e 32 20 30 33 31 20 35 30 2e 31 20 31 33 2e 36 20 32 35 2e 30 20 30
 30 30 30 31 30 30 31 0d 35
5.2 031 5].1 13.6 25.0 00001001245.2 2001001
get_data_phoenix: (56 bytes) => 28 32 34 35 2e 32 20 32 30 30 31 30 30 31
 0d 35 2e 32 20 30 33 31 20 35 30 2e 31 20 31 33 2e 36 20 32 35 2e 30 20 30
 30 30 30 31 30 30 31 0d 35 2e 32 20 30 33 31 20 35
5.2 031 50.1 13.6]25.0 00001001245.2 2001001
get_data_phoenix: (64 bytes) => 28 32 34 35 2e 32 20 32 30 30 31 30 30 31
 0d 35 2e 32 20 30 33 31 20 35 30 2e 31 20 31 33 2e 36 20 32 35 2e 30 20 30
 30 30 30 31 30 30 31 0d 35 2e 32 20 30 33 31 20 35 30 2e 31 20 31 33 2e 36
Q1 => FAILED [short read]
Q1 detail: (14 bytes) => 28 32 34 35 2e 32 20 32 30 30 31 30 30 31
Asking for UPS status [Q1]...
get_data_phoenix: got so far [(245.2 2]
get_data_phoenix: (8 bytes) => 28 32 34 35 2e 32 20 32
5]t_data_phoenix: got so far [(245.2 2001001
get_data_phoenix: (16 bytes) => 28 32 34 35 2e 32 20 32 30 30 31 30 30 31
 0d 35
5.2 031 5]hoenix: got so far [(245.2 2001001
get_data_phoenix: (24 bytes) => 28 32 34 35 2e 32 20 32 30 30 31 30 30 31
 0d 35 2e 32 20 30 33 31 20 35
5.2 031 50.1 13.6]got so far [(245.2 2001001
get_data_phoenix: (32 bytes) => 28 32 34 35 2e 32 20 32 30 30 31 30 30 31
 0d 35 2e 32 20 30 33 31 20 35 30 2e 31 20 31 33 2e 36
5.2 031 50.1 13.6 25.0 00]ar [(245.2 2001001
get_data_phoenix: (40 bytes) => 28 32 34 35 2e 32 20 32 30 30 31 30 30 31
 0d 35 2e 32 20 30 33 31 20 35 30 2e 31 20 31 33 2e 36 20 32 35 2e 30 20 30
 30
5]2 031 50.1 13.6 25.0 00001001245.2 2001001
get_data_phoenix: (48 bytes) => 28 32 34 35 2e 32 20 32 30 30 31 30 30 31
 0d 35 2e 32 20 30 33 31 20 35 30 2e 31 20 31 33 2e 36 20 32 35 2e 30 20 30
 30 30 30 31 30 30 31 0d 35
5.2 031 5].1 13.6 25.0 00001001245.2 2001001
get_data_phoenix: (56 bytes) => 28 32 34 35 2e 32 20 32 30 30 31 30 30 31
 0d 35 2e 32 20 30 33 31 20 35 30 2e 31 20 31 33 2e 36 20 32 35 2e 30 20 30
 30 30 30 31 30 30 31 0d 35 2e 32 20 30 33 31 20 35
5.2 031 50.1 13.6]25.0 00001001245.2 2001001
get_data_phoenix: (64 bytes) => 28 32 34 35 2e 32 20 32 30 30 31 30 30 31
 0d 35 2e 32 20 30 33 31 20 35 30 2e 31 20 31 33 2e 36 20 32 35 2e 30 20 30
 30 30 30 31 30 30 31 0d 35 2e 32 20 30 33 31 20 35 30 2e 31 20 31 33 2e 36
Q1 => FAILED [short read]
Q1 detail: (14 bytes) => 28 32 34 35 2e 32 20 32 30 30 31 30 30 31
5 out of 5 detection attempts failed (minimum failures: 2).
Megatec protocol UPS not detected.

There are a number of users having issues with the megatec drivers on various distros, these users report that their UPS devices (incl the one I bought) used to work and now don't.

I'll post any new info I find on the issue, hopefully a future release of NUT will remedy the problem.

Also, if anyone has any suggestions for workarounds please post them

Last edited by kaivalagi (2009-11-23 09:18:59)


Running Arch 64 (Made the switch to Arch 10/2009)
AUR | BZR

Offline

#3 2010-01-14 14:45:54

kaivalagi
Member
From: Norwich, UK
Registered: 2009-11-05
Posts: 145

Re: How to get my UPS working with NUT?

Can anyone share some knowledge on this that may help move things along?

Any help anyone?

Last edited by kaivalagi (2010-01-14 14:46:05)


Running Arch 64 (Made the switch to Arch 10/2009)
AUR | BZR

Offline

#4 2010-06-02 21:12:19

android
Member
From: San Diego
Registered: 2003-04-18
Posts: 160

Re: How to get my UPS working with NUT?

Hey There,

Don't know if this is your issue, but I had to rebuild nut with the following patch:

Index: /trunk/drivers/libhid.c
===================================================================
--- /trunk/drivers/libhid.c (revision 2336)
+++ /trunk/drivers/libhid.c (revision 2407)
@@ -142,5 +142,5 @@
     int    id = pData->ReportID;
     int    r;
-    unsigned char    buf[SMALLBUF];
+    unsigned char    buf[8];    /* Maximum size for low-speed USB devices */
 
     if (rbuf->ts[id] + age > time(NULL)) {
@@ -470,5 +470,5 @@
 int HIDGetEvents(hid_dev_handle_t udev, HIDData_t **event, int eventsize)
 {
-    unsigned char    buf[SMALLBUF];
+    unsigned char    buf[8];    /* Maximum size for low-speed USB devices */
     int        itemCount = 0;
     int        buflen, r, i;

From: http://www.mail-archive.com/nut-upsuser … 05550.html
I was getting:

[root@nexus johnea]# upsdrvctl start nexups -DD
Network UPS Tools - UPS driver controller 2.4.3
Network UPS Tools - Generic HID driver 0.34 (2.4.3)
USB communication driver 0.31
Using subdriver: CyberPower HID 0.3
libusb_get_report: could not claim interface 0: Device or resource busy
Got disconnected by another driver: Device or resource busy
Can't initialize data from HID UPS
Driver failed to start (exit status=1)

Now upsc upscmd are providing output...

I was running: network-ups-tools 2.4.3-1 from community.





android

Offline

Board footer

Powered by FluxBB