[Nut-upsuser] Old thread on belkin

Gene Heskett gene.heskett at gmail.com
Mon Dec 28 18:31:30 UTC 2009


On Monday 28 December 2009, Gene Heskett wrote:
>On Monday 28 December 2009, Arjen de Korte wrote:
>>Citeren Gene Heskett <gene.heskett at gmail.com>:
>>> Just starting it with the fedora service command gets this:
>>> [root at coyote rules.d]# service ups start
>>> /etc/sysconfig/ups: line 4: UPSD_OPTIONS: command not found
>>> Starting UPS driver controller:                            [FAILED]
>>> Starting upsd:                                             [FAILED]
>>> Starting UPS monitor (master):                             [FAILED]
>>>
>>> UPSD_OPTIONS is empty in /etc/sysconfig/ups
>>
>>We've have issues with the Fedora (and RedHat) scripts before. NUT
>>doesn't use /etc/sysconfig/ups, this is something that your distro
>>added. Chances are that this was written for an earlier version of NUT
>>and since never changed. It's not needed either, since all information
>>needed to startup the drivers, server and clients is in the NUT
>>configuration files already. Could you try if running
>>
>>     /path/to/upsdrvctl start
>>     /path/to/upsd
>>     /path/to/upsmon
>>
>>improves the situation?
>>
>>For debugging purposes you shouldn't use the startup scripts from
>>*any* distribution, because they will invariably direct the startup
>>messages to /dev/null (it might already tell you what's wrong now).
>>
>>> And the log shows:
>>> Dec 27 18:16:56 coyote upsd[21863]: listening on 127.0.0.1 port 3493
>>> Dec 27 18:16:56 coyote upsd[21863]: Can't chdir to /var/run/nut:
>>> Permission denied
>>
>>This is the STATEPATH directory (which is compiled in) and should be
>>writeable by the user 'upsd' is running as. It almost certainly isn't.
>>
>>Best regards, Arjen
>
>Ok, the strace output: wordwrap off
>
>[root at coyote ups]# strace  upsdrvctl start
>execve("/sbin/upsdrvctl", ["upsdrvctl", "start"], [/* 56 vars */]) = 0
>brk(0)                                  = 0x8073000
>access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or
> directory) open("/etc/ld.so.cache", O_RDONLY)      = 3
>fstat64(3, {st_mode=S_IFREG|0644, st_size=177483, ...}) = 0
>mmap2(NULL, 177483, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb78cf000
>close(3)                                = 0
>open("/lib/libc.so.6", O_RDONLY)        = 3
>read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0@\310#E4\0\0\0"...,
> 512) = 512 fstat64(3, {st_mode=S_IFREG|0755, st_size=1809672, ...}) = 0
>mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
> 0xb78ce000 mmap2(0x45226000, 1521232, PROT_READ|PROT_EXEC,
> MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x45226000 mmap2(0x45394000, 12288,
> PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x16e) =
> 0x45394000 mmap2(0x45397000, 9808, PROT_READ|PROT_WRITE,
> MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x45397000 close(3)         
>                       = 0
>mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
> 0xb78cd000 set_thread_area({entry_number:-1 -> 6, base_addr:0xb78cd6c0,
> limit:1048575, seg_32bit:1, contents:0, read_exec_only:0,
> limit_in_pages:1, seg_not_present:0, useable:1}) = 0
>mprotect(0x45394000, 8192, PROT_READ)   = 0
>mprotect(0x45222000, 4096, PROT_READ)   = 0
>munmap(0xb78cf000, 177483)              = 0
>fstat64(1, {st_mode=S_IFCHR|0600, st_rdev=makedev(136, 0), ...}) = 0
>mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
> 0xb78fa000 write(1, "Network UPS Tools - UPS driver c"..., 48Network UPS
> Tools - UPS driver controller 2.2.2 ) = 48
>brk(0)                                  = 0x8073000
>brk(0x8094000)                          = 0x8094000
>open("/etc/ups/ups.conf", O_RDONLY)     = 3
>fstat64(3, {st_mode=S_IFREG|0640, st_size=3659, ...}) = 0
>mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
> 0xb78f9000 read(3, "# Network UPS Tools: example ups"..., 4096) = 3659
>read(3, "", 4096)                       = 0
>close(3)                                = 0
>munmap(0xb78f9000, 4096)                = 0
>stat64("/sbin/usbhid-ups", {st_mode=S_IFREG|0755, st_size=114220, ...}) = 0
>clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD,
> child_tidptr=0xb78cd708) = 25669 rt_sigaction(SIGALRM, {0x8049100, [], 0},
> NULL, 8) = 0
>alarm(45)                               = 0
>waitpid(25669, Network UPS Tools: 0.29 USB communication driver - core 0.33
> (2.2.2)
>
>Using subdriver: Belkin HID 0.11
>Can't initialize data from HID UPS
>[{WIFEXITED(s) && WEXITSTATUS(s) == 1}], 0) = 25669
>--- SIGCHLD (Child exited) @ 0 (0) ---
>rt_sigaction(SIGALRM, {SIG_IGN, [ALRM], SA_RESTART}, {0x8049100, [], 0}, 8)
> = 0 alarm(0)                                = 44
>write(2, "Driver failed to start (exit sta"..., 39Driver failed to start
> (exit status=1) ) = 39
>exit_group(1)                           = ?
>[root at coyote ups]#
>
>Looks like we lose the strace function for the subdriver, Belkin. The data
>is flowing though, or is it, ttyUSB0 and ttyUSB1 are in use here, and the
>hiddev0 and hidraw0 devices have been nuked till the next time I unplug
>and replug the cable.
>
>Is this a situation where I'll have to crawl under the desk and do a
>momentary disconnect for every time I try to run this?  Where its at, and
>my 75 year old bones don't really want to do that too many times. I get
>enough exercise just pushing my luck & some woodworking these days.
>
>If this is a redhat-ism, then I can build the tarball if that would help,
> but the lack of specifics in the error messages sucks.  Just who the hell
> needs to own this /var/run/nut directory anyway?

Update, I put it back to root:root, replugged the ups's usb cable to make 
new hiddev0 and hidraw0's, no difference, the daemon still won't run.  

Msg from Belkin is:
Using subdriver: Belkin HID 0.11
Can't initialize data from HID UPS
Driver failed to start (exit status=1)

half hour later, after digging thru the docs and quasi-intelligent error msgs 
from the individual drivers, I can get this: (wordwrap off now)

-----------------------------------paste from screen----------------------
[root at coyote ups]# /sbin/usbhid-ups -D -a myups                                                                               
Network UPS Tools: 0.29 USB communication driver - core 0.33 (2.2.2)                                                          

debug level is '1'
upsdrv_initups... 
Using subdriver: Belkin HID 0.11
Path: UPS.BELKINConfig.BELKINConfigVoltage, Type: Feature, ReportID: 0x01, Offset: 0, Size: 8, Value: 120.000000
Path: UPS.BELKINConfig.BELKINConfigFrequency, Type: Feature, ReportID: 0x02, Offset: 0, Size: 8, Value: 60.000000
Path: UPS.BELKINConfig.BELKINConfigApparentPower, Type: Feature, ReportID: 0x03, Offset: 0, Size: 16, Value: 1500.000000
Path: UPS.BELKINConfig.BELKINConfigBatteryVoltage, Type: Feature, ReportID: 0x04, Offset: 0, Size: 16, Value: 24.000000 
Path: UPS.BELKINConfig.BELKINLowVoltageTransfer, Type: Feature, ReportID: 0x06, Offset: 0, Size: 16, Value: 88.000000   
Path: UPS.BELKINConfig.BELKINLowVoltageTransferMax, Type: Feature, ReportID: 0x07, Offset: 0, Size: 16, Value: 88.000000
Path: UPS.BELKINConfig.BELKINLowVoltageTransferMin, Type: Feature, ReportID: 0x08, Offset: 0, Size: 16, Value: 84.000000
Path: UPS.BELKINConfig.BELKINHighVoltageTransfer, Type: Feature, ReportID: 0x09, Offset: 0, Size: 16, Value: 140.000000 
Path: UPS.BELKINConfig.BELKINHighVoltageTransferMax, Type: Feature, ReportID: 0x0a, Offset: 0, Size: 16, Value: 144.000000
Path: UPS.BELKINConfig.BELKINHighVoltageTransferMin, Type: Feature, ReportID: 0x0b, Offset: 0, Size: 16, Value: 140.000000
Path: UPS.BELKINDevice.BELKINModelString, Type: Feature, ReportID: 0x0d, Offset: 0, Size: 16, Value: 68.000000            
Path: UPS.BELKINDevice.BELKINModelStringOffset, Type: Feature, ReportID: 0x0e, Offset: 0, Size: 16, Value: 0.000000       
Path: UPS.BELKINDevice.BELKINUPSType, Type: Feature, ReportID: 0x0f, Offset: 0, Size: 16, Value: 17.000000                
Path: UPS.BELKINControls.BELKINTest, Type: Feature, ReportID: 0x10, Offset: 0, Size: 8, Value: 1.000000                   
Path: UPS.BELKINControls.BELKINAudibleAlarmControl, Type: Feature, ReportID: 0x11, Offset: 0, Size: 8, Value: 2.000000    
Path: UPS.BELKINControls.BELKINDelayBeforeShutdown, Type: Feature, ReportID: 0x15, Offset: 0, Size: 16, Value: 0.000000   
Path: UPS.BELKINControls.BELKINDelayBeforeStartup, Type: Feature, ReportID: 0x16, Offset: 0, Size: 16, Value: 0.000000    
Path: UPS.BELKINPowerState.BELKINInput.BELKINVoltage, Type: Feature, ReportID: 0x18, Offset: 0, Size: 16, Value: 1252.000000
Path: UPS.BELKINPowerState.BELKINInput.BELKINFrequency, Type: Feature, ReportID: 0x19, Offset: 0, Size: 16, Value: 599.000000
Path: UPS.BELKINPowerState.BELKINOutput.BELKINVoltage, Type: Feature, ReportID: 0x1b, Offset: 0, Size: 16, Value: 1249.000000
Path: UPS.BELKINPowerState.BELKINOutput.BELKINFrequency, Type: Feature, ReportID: 0x1c, Offset: 0, Size: 16, Value: 599.000000
Path: UPS.BELKINPowerState.BELKINOutput.BELKINPercentLoad, Type: Feature, ReportID: 0x1e, Offset: 0, Size: 8, Value: 35.000000
Path: UPS.BELKINBatterySystem.BELKINVoltage, Type: Feature, ReportID: 0x20, Offset: 0, Size: 16, Value: 277.000000            
Path: UPS.BELKINBatterySystem.BELKINCharge, Type: Feature, ReportID: 0x21, Offset: 0, Size: 8, Value: 100.000000              
Path: UPS.BELKINStatus.BELKINPowerStatus, Type: Feature, ReportID: 0x22, Offset: 0, Size: 16, Value: 32768.000000             
Path: UPS.BELKINStatus.BELKINBatteryStatus, Type: Feature, ReportID: 0x23, Offset: 0, Size: 8, Value: 16.000000               
Path: UPS.PowerSummary.iProduct, Type: Feature, ReportID: 0x28, Offset: 0, Size: 8, Value: 20.000000                          
Can't retrieve Report 41: Broken pipe                                                                                         
Path: UPS.PowerSummary.iSerialNumber, Type: Feature, ReportID: 0x29, Offset: 0, Size: 8                                       
Path: UPS.PowerSummary.iDeviceChemistry, Type: Feature, ReportID: 0x2a, Offset: 0, Size: 8, Value: 70.000000                  
Path: UPS.PowerSummary.iOEMInformation, Type: Feature, ReportID: 0x2b, Offset: 0, Size: 8, Value: 4.000000                    
Path: UPS.PowerSummary.Rechargeable, Type: Feature, ReportID: 0x2c, Offset: 0, Size: 8, Value: 1.000000                       
Path: UPS.PowerSummary.Charging, Type: Input, ReportID: 0x2d, Offset: 0, Size: 8, Value: 1.000000                             
Path: UPS.PowerSummary.Charging, Type: Feature, ReportID: 0x2d, Offset: 0, Size: 8, Value: 1.000000                           
Path: UPS.PowerSummary.Discharging, Type: Input, ReportID: 0x2e, Offset: 0, Size: 8, Value: 0.000000                          
Path: UPS.PowerSummary.Discharging, Type: Feature, ReportID: 0x2e, Offset: 0, Size: 8, Value: 0.000000                        
Path: UPS.PowerSummary.ConfigVoltage, Type: Feature, ReportID: 0x30, Offset: 0, Size: 16, Value: 120.000000                   
Path: UPS.PowerSummary.Voltage, Type: Feature, ReportID: 0x31, Offset: 0, Size: 16, Value: 1251.000000                        
Path: UPS.PowerSummary.Current, Type: Feature, ReportID: 0x32, Offset: 0, Size: 8, Value: 0.000000                            
Path: UPS.PowerSummary.CapacityMode, Type: Feature, ReportID: 0x33, Offset: 0, Size: 8, Value: 2.000000                       
Path: UPS.PowerSummary.RemainingCapacity, Type: Input, ReportID: 0x34, Offset: 0, Size: 8, Value: 100.000000                  
Path: UPS.PowerSummary.RemainingCapacity, Type: Feature, ReportID: 0x34, Offset: 0, Size: 8, Value: 100.000000                
Path: UPS.PowerSummary.RunTimeToEmpty, Type: Input, ReportID: 0x35, Offset: 0, Size: 16, Value: 120.000000                    
Path: UPS.PowerSummary.RunTimeToEmpty, Type: Feature, ReportID: 0x35, Offset: 0, Size: 16, Value: 120.000000                  
Path: UPS.PowerSummary.DesignCapacity, Type: Feature, ReportID: 0x36, Offset: 0, Size: 8, Value: 100.000000                   
Path: UPS.PowerSummary.FullChargeCapacity, Type: Feature, ReportID: 0x37, Offset: 0, Size: 8, Value: 100.000000               
Path: UPS.PowerSummary.WarningCapacityLimit, Type: Feature, ReportID: 0x38, Offset: 0, Size: 8, Value: 30.000000              
Path: UPS.PowerSummary.CapacityGranularity2, Type: Feature, ReportID: 0x39, Offset: 0, Size: 8, Value: 1.000000
Path: UPS.PowerSummary.RemainingCapacityLimit, Type: Feature, ReportID: 0x3a, Offset: 0, Size: 8, Value: 30.000000
Path: UPS.PowerSummary.CapacityGranularity1, Type: Feature, ReportID: 0x3b, Offset: 0, Size: 8, Value: 1.000000
Path: UPS.PowerSummary.ACPresent, Type: Feature, ReportID: 0x3c, Offset: 0, Size: 8, Value: 1.000000
Path: UPS.PowerSummary.ACPresent, Type: Input, ReportID: 0x3c, Offset: 0, Size: 8, Value: 1.000000
Path: UPS.PowerSummary.BelowRemainingCapacityLimit, Type: Input, ReportID: 0x3d, Offset: 0, Size: 8, Value: 0.000000
Path: UPS.PowerSummary.BelowRemainingCapacityLimit, Type: Feature, ReportID: 0x3d, Offset: 0, Size: 8, Value: 0.000000
Path: UPS.PowerSummary.ShutdownImminent, Type: Input, ReportID: 0x3e, Offset: 0, Size: 8, Value: 0.000000
Path: UPS.PowerSummary.ShutdownImminent, Type: Feature, ReportID: 0x3e, Offset: 0, Size: 8, Value: 0.000000
Can't retrieve Report 41: Broken pipe
Detected a UPS: Belkin /unknown
upsdrv_initinfo...
upsdrv_updateinfo...
Got 1 HID objects...
Quick update...
upsdrv_updateinfo...
Got -110 HID objects...
Quick update...
upsdrv_updateinfo...
Got 1 HID objects...
Quick update...
upsdrv_updateinfo...
Got 1 HID objects...
Quick update...
Can't retrieve Report 60: Broken pipe
upsdrv_updateinfo...
Got to reconnect!

upsdrv_updateinfo...
Got to reconnect!

upsdrv_updateinfo...
Got to reconnect!

upsdrv_updateinfo...
Got to reconnect!

upsdrv_updateinfo...
Got to reconnect!

upsdrv_updateinfo...
Got to reconnect!

^CSignal 2: exiting
upsdrv_cleanup...
[root at coyote ups]#

----------------------
Which doesn't appear to say the protocols are 100% compatible. Without the
lone -D, it appears not to work, and with 2 or 3 of them, it gets grossly 
verbose.

And from the above, it looks like the report 41 failure is poisoning the 
driver somehow?
Its repeatable for everytime I exec that line that started this. 

However, with 2 -D's it does restart itself when it fails, and has been
working long enough to actually get and decode the output that I can
cat to the screen slowly if I can find the hid device. Scraped from that
screen as it marches by after using:

[root at coyote]# /sbin/usbhid-ups -D -D -a myups
[huge snip]
upsdrv_updateinfo...
Got 1 HID objects...
Path: UPS.PowerSummary.ACPresent, Type: Input, ReportID: 0x3c, Offset: 0, Size: 8, Value: 1.000000
Quick update...
Path: UPS.PowerSummary.Discharging, Type: Feature, ReportID: 0x2e, Offset: 0, Size: 8, Value: 0.000000
Path: UPS.PowerSummary.Charging, Type: Feature, ReportID: 0x2d, Offset: 0, Size: 8, Value: 1.000000
Path: UPS.PowerSummary.ACPresent, Type: Feature, ReportID: 0x3c, Offset: 0, Size: 8, Value: 1.000000
Path: UPS.BELKINStatus.BELKINPowerStatus, Type: Feature, ReportID: 0x22, Offset: 0, Size: 16, Value: 32768.000000
Path: UPS.BELKINStatus.BELKINBatteryStatus, Type: Feature, ReportID: 0x23, Offset: 0, Size: 8, Value: 16.000000
Path: UPS.BELKINStatus.BELKINBatteryStatus, Type: Feature, ReportID: 0x23, Offset: 0, Size: 8, Value: 16.000000
upsdrv_updateinfo...
Got 1 HID objects...
Path: UPS.PowerSummary.Charging, Type: Input, ReportID: 0x2d, Offset: 0, Size: 8, Value: 1.000000
Quick update...
Path: UPS.PowerSummary.Discharging, Type: Feature, ReportID: 0x2e, Offset: 0, Size: 8, Value: 0.000000
Path: UPS.PowerSummary.Charging, Type: Feature, ReportID: 0x2d, Offset: 0, Size: 8, Value: 1.000000
Path: UPS.PowerSummary.ACPresent, Type: Feature, ReportID: 0x3c, Offset: 0, Size: 8, Value: 1.000000
Path: UPS.BELKINStatus.BELKINPowerStatus, Type: Feature, ReportID: 0x22, Offset: 0, Size: 16, Value: 32768.000000
Path: UPS.BELKINStatus.BELKINBatteryStatus, Type: Feature, ReportID: 0x23, Offset: 0, Size: 8, Value: 16.000000
Path: UPS.BELKINStatus.BELKINBatteryStatus, Type: Feature, ReportID: 0x23, Offset: 0, Size: 8, Value: 16.000000

So, progress of sorts, but how do we make it work from the /etc/init.d/ups
script?

-- 
Cheers, Gene
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)

Should I do my BOBBIE VINTON medley?



More information about the Nut-upsuser mailing list