[Nut-upsdev] newhidups with APC Smart-UPS 1500

Felix Mühlbauer muehlbauer at informatik.uni-kl.de
Fri Oct 6 18:44:03 UTC 2006


Hello,

I tried your suggestion and the segfault is gone :)

but now the driver code loops examining the USP once and once again and 
never stops...
see debug log.

ciao Felix


Schmier, Jacob wrote:
> The source of the segmentation fault is in newhidups.c at line 534.
> 
> 528  
> 529 void upsdrv_updateinfo(void)  
> 530 { 
> 531         hid_info_t *item; 
> 532         char *nutvalue; 
> 533         int retcode, evtCount = 0; 
> 534         HIDItem *eventsList[10]; 
> 535  
> 536         upsdebugx(1, "upsdrv_updateinfo..."); 
> 537  
> 538 
> 
> The array only holds pointers to 10 HID items.
> 
>> =>Got 16 HID Objects...
> 
> Produces a segmentation fault.
> 
> I got around this by temporarily increasing the size of the array.
> HIDItem *eventsList[32];
> 
> A better fix is needed.  The code loops until the total number HID objects are retrieved.  The array needs to hold this total number of HID objects in all cases to avoid problems.
> 
> ~Jacob Schmier


Network UPS Tools: 0.28 USB communication driver 0.28 - core 0.30 (2.1.0)

Report Descriptor size = 1040
Detected a UPS: American Power Conversion/Smart-UPS 1500 RM FW:617.3.I 
USB FW:1.5
Using subdriver: APC/CyberPower HID 0.9
Path: UPS.PowerSummary.iProduct, Type: Feature, Value: 1.000000
Path: UPS.PowerSummary.iSerialNumber, Type: Feature, Value: 2.000000
Path: UPS.PowerSummary.iManufacturer, Type: Feature, Value: 3.000000
Path: UPS.PowerSummary.iOEMInformation, Type: Feature, Value: 3.000000
Path: UPS.PowerSummary.iDeviceChemistry, Type: Feature, Value: 4.000000
Path: UPS.PowerSummary.Rechargeable, Type: Feature, Value: 1.000000
Path: UPS.PowerSummary.CapacityMode, Type: Feature, Value: 2.000000
Path: UPS.PowerSummary.DesignCapacity, Type: Feature, Value: 100.000000
Path: UPS.PowerSummary.FullChargeCapacity, Type: Feature, Value: 100.000000
Path: UPS.PowerSummary.RemainingCapacity, Type: Input, Value: 100.000000
Path: UPS.PowerSummary.RemainingCapacity, Type: Feature, Value: 100.000000
Path: UPS.PowerSummary.CapacityGranularity1, Type: Feature, Value: 1.000000
Path: UPS.PowerSummary.CapacityGranularity2, Type: Feature, Value: 1.000000
Path: UPS.PowerSummary.WarningCapacityLimit, Type: Feature, Value: 50.000000
Path: UPS.PowerSummary.RemainingCapacityLimit, Type: Feature, Value: 
10.000000
Path: UPS.PowerSummary.ManufacturerDate, Type: Feature, Value: 12106.000000
Path: UPS.PowerSummary.RunTimeToEmpty, Type: Input, Value: 1020.000000
Path: UPS.PowerSummary.RunTimeToEmpty, Type: Feature, Value: 1020.000000
Path: UPS.PowerSummary.DelayBeforeShutdown, Type: Feature, Value: -1.000000
Path: UPS.PowerSummary.DelayBeforeReboot, Type: Feature, Value: 
16777215.000000
Path: UPS.PowerSummary.RemainingTimeLimit, Type: Input, Value: 120.000000
Path: UPS.PowerSummary.RemainingTimeLimit, Type: Feature, Value: 120.000000
Path: UPS.PowerSummary.ConfigVoltage, Type: Feature, Value: 24.000002
Path: UPS.PowerSummary.Voltage, Type: Feature, Value: 27.670002
Path: UPS.PowerSummary.AudibleAlarmControl, Type: Input, Value: 2.000000
Path: UPS.PowerSummary.AudibleAlarmControl, Type: Feature, Value: 2.000000
Path: UPS.PowerSummary.PresentStatus.Charging, Type: Input, Value: 0.000000
Path: UPS.PowerSummary.PresentStatus.Charging, Type: Feature, Value: 
0.000000
Path: UPS.PowerSummary.PresentStatus.Discharging, Type: Input, Value: 
0.000000
Path: UPS.PowerSummary.PresentStatus.Discharging, Type: Feature, Value: 
0.000000
Path: UPS.PowerSummary.PresentStatus.ACPresent, Type: Input, Value: 1.000000
Path: UPS.PowerSummary.PresentStatus.ACPresent, Type: Feature, Value: 
1.000000
Path: UPS.PowerSummary.PresentStatus.BatteryPresent, Type: Input, Value: 
1.000000
Path: UPS.PowerSummary.PresentStatus.BatteryPresent, Type: Feature, 
Value: 1.000000
Path: UPS.PowerSummary.PresentStatus.BelowRemainingCapacityLimit, Type: 
Input, Value: 0.000000
Path: UPS.PowerSummary.PresentStatus.BelowRemainingCapacityLimit, Type: 
Feature, Value: 0.000000
Path: UPS.PowerSummary.PresentStatus.ShutdownRequested, Type: Input, 
Value: 0.000000
Path: UPS.PowerSummary.PresentStatus.ShutdownRequested, Type: Feature, 
Value: 0.000000
Path: UPS.PowerSummary.PresentStatus.ShutdownImminent, Type: Input, 
Value: 0.000000
Path: UPS.PowerSummary.PresentStatus.ShutdownImminent, Type: Feature, 
Value: 0.000000
Path: UPS.PowerSummary.PresentStatus.RemainingTimeLimitExpired, Type: 
Input, Value: 0.000000
Path: UPS.PowerSummary.PresentStatus.RemainingTimeLimitExpired, Type: 
Feature, Value: 0.000000
Path: UPS.PowerSummary.PresentStatus.CommunicationLost, Type: Input, 
Value: 0.000000
Path: UPS.PowerSummary.PresentStatus.CommunicationLost, Type: Feature, 
Value: 0.000000
Path: UPS.PowerSummary.PresentStatus.NeedReplacement, Type: Input, 
Value: 0.000000
Path: UPS.PowerSummary.PresentStatus.NeedReplacement, Type: Feature, 
Value: 0.000000
Path: UPS.PowerSummary.PresentStatus.Overload, Type: Input, Value: 0.000000
Path: UPS.PowerSummary.PresentStatus.Overload, Type: Feature, Value: 
0.000000
Path: UPS.PowerSummary.PresentStatus.VoltageNotRegulated, Type: Input, 
Value: 0.000000
Path: UPS.PowerSummary.PresentStatus.VoltageNotRegulated, Type: Feature, 
Value: 0.000000
Path: UPS.PowerSummary.PresentStatus.ff860080, Type: Input, Value: 0.000000
Path: UPS.PowerSummary.PresentStatus.ff860080, Type: Feature, Value: 
0.000000
Path: UPS.PowerSummary.PresentStatus., Type: Input
Path: UPS.PowerSummary.PresentStatus., Type: Input
Path: UPS.PowerSummary.PresentStatus., Type: Input
Path: UPS.PowerSummary.PresentStatus., Type: Feature
Path: UPS.PowerSummary.PresentStatus., Type: Feature
Path: UPS.PowerSummary.PresentStatus., Type: Feature
Path: UPS.Battery.Test, Type: Input, Value: 6.000000
Path: UPS.Battery.Test, Type: Feature, Value: 6.000000
Path: UPS.Battery.APCBattCapBeforeStartup, Type: Input, Value: 0.000000
Path: UPS.Battery.APCBattCapBeforeStartup, Type: Feature, Value: 0.000000
Path: UPS.Battery.ff86001a, Type: Input, Value: 3.000000
Path: UPS.Battery.ff86001a, Type: Feature, Value: 3.000000
Path: UPS.Battery.ff86001b, Type: Input, Value: 0.000000
Path: UPS.Battery.ff86001b, Type: Feature, Value: 0.000000
Path: UPS.Battery.ManufacturerDate, Type: Input, Value: 12106.000000
Path: UPS.Battery.ManufacturerDate, Type: Feature, Value: 12106.000000
Path: UPS.Battery.RemainingCapacity, Type: Feature, Value: 100.000000
Path: UPS.Battery.RemainingTimeLimit, Type: Input, Value: 120.000000
Path: UPS.Battery.RemainingTimeLimit, Type: Feature, Value: 120.000000
Path: UPS.Battery.RunTimeToEmpty, Type: Feature, Value: 1020.000000
Path: UPS.Battery.Temperature, Type: Feature, Value: 294.200012
Path: UPS.Battery.ConfigVoltage, Type: Feature, Value: 24.000002
Path: UPS.Battery.Voltage, Type: Feature, Value: 27.670002
Path: UPS.Input.Voltage, Type: Feature, Value: 231.800003
Path: UPS.Input.ff860052, Type: Input, Value: 4.000000
Path: UPS.Input.ff860052, Type: Feature, Value: 4.000000
Path: UPS.Input.ff860061, Type: Input, Value: 2.000000
Path: UPS.Input.ff860061, Type: Feature, Value: 2.000000
Path: UPS.Output.PercentLoad, Type: Feature, Value: 63.700001
Path: UPS.Output.Frequency, Type: Feature, Value: 50.000004
Path: UPS.Output.Voltage, Type: Feature, Value: 231.800003
Path: UPS.Output.ConfigVoltage, Type: Input, Value: 230.000000
Path: UPS.Output.ConfigVoltage, Type: Feature, Value: 230.000000
Path: UPS.Output.HighVoltageTransfer, Type: Input, Value: 253.000000
Path: UPS.Output.HighVoltageTransfer, Type: Feature, Value: 253.000000
Path: UPS.Output.LowVoltageTransfer, Type: Input, Value: 208.000000
Path: UPS.Output.LowVoltageTransfer, Type: Feature, Value: 208.000000
Path: UPS.Output.APCDelayBeforeStartup, Type: Input, Value: 0.000000
Path: UPS.Output.APCDelayBeforeStartup, Type: Feature, Value: 0.000000
Path: UPS.Output.APCShutdownAfterDelay, Type: Input, Value: 90.000000
Path: UPS.Output.APCShutdownAfterDelay, Type: Feature, Value: 90.000000
Path: UPS.Output.DelayBeforeShutdown, Type: Feature, Value: -1.000000
Path: UPS.Output.DelayBeforeStartup, Type: Feature, Value: -1.000000
Path: UPS.Output.DelayBeforeReboot, Type: Feature, Value: 16777215.000000
Path: UPS.iProduct, Type: Feature, Value: 5.000000
Path: UPS.iSerialNumber, Type: Feature, Value: 2.000000
Path: UPS.iManufacturer, Type: Feature, Value: 3.000000
Path: UPS.iName, Type: Feature, Value: 6.000000
Path: UPS.APC_UPS_FirmwareRevision, Type: Feature, Value: 7.000000
Path: UPS.APC_USB_FirmwareRevision, Type: Feature, Value: 8.000000
Path: UPS.APCPanelTest, Type: Feature, Value: 1.000000
Path: UPS.ManufacturerDate, Type: Feature, Value: 12106.000000
Path: UPS.ff860027, Type: Feature, Value: 0.000000
Path: UPS.ff860028, Type: Feature, Value: 0.000000
Path: UPS.AudibleAlarmControl, Type: Input, Value: 2.000000
Path: UPS.AudibleAlarmControl, Type: Feature, Value: 2.000000
Path: UPS.PresentStatus.Charging, Type: Input, Value: 0.000000
Path: UPS.PresentStatus.Charging, Type: Feature, Value: 0.000000
Path: UPS.PresentStatus.Discharging, Type: Input, Value: 0.000000
Path: UPS.PresentStatus.Discharging, Type: Feature, Value: 0.000000
Path: UPS.PresentStatus.ACPresent, Type: Input, Value: 1.000000
Path: UPS.PresentStatus.ACPresent, Type: Feature, Value: 1.000000
Path: UPS.PresentStatus.BatteryPresent, Type: Input, Value: 1.000000
Path: UPS.PresentStatus.BatteryPresent, Type: Feature, Value: 1.000000
Path: UPS.PresentStatus.BelowRemainingCapacityLimit, Type: Input, Value: 
0.000000
Path: UPS.PresentStatus.BelowRemainingCapacityLimit, Type: Feature, 
Value: 0.000000
Path: UPS.PresentStatus.ShutdownRequested, Type: Input, Value: 0.000000
Path: UPS.PresentStatus.ShutdownRequested, Type: Feature, Value: 0.000000
Path: UPS.PresentStatus.ShutdownImminent, Type: Input, Value: 0.000000
Path: UPS.PresentStatus.ShutdownImminent, Type: Feature, Value: 0.000000
Path: UPS.PresentStatus.RemainingTimeLimitExpired, Type: Input, Value: 
0.000000
Path: UPS.PresentStatus.RemainingTimeLimitExpired, Type: Feature, Value: 
0.000000
Path: UPS.PresentStatus.CommunicationLost, Type: Input, Value: 0.000000
Path: UPS.PresentStatus.CommunicationLost, Type: Feature, Value: 0.000000
Path: UPS.PresentStatus.NeedReplacement, Type: Input, Value: 0.000000
Path: UPS.PresentStatus.NeedReplacement, Type: Feature, Value: 0.000000
Path: UPS.PresentStatus.Overload, Type: Input, Value: 0.000000
Path: UPS.PresentStatus.Overload, Type: Feature, Value: 0.000000
Path: UPS.PresentStatus.VoltageNotRegulated, Type: Input, Value: 0.000000
Path: UPS.PresentStatus.VoltageNotRegulated, Type: Feature, Value: 0.000000
Path: UPS.PresentStatus.ff860080, Type: Input, Value: 0.000000
Path: UPS.PresentStatus.ff860080, Type: Feature, Value: 0.000000
Path: UPS.PresentStatus., Type: Input
Path: UPS.PresentStatus., Type: Input
Path: UPS.PresentStatus., Type: Input
Path: UPS.PresentStatus., Type: Feature
Path: UPS.PresentStatus., Type: Feature
Path: UPS.PresentStatus., Type: Feature
Can't find object UPS.Battery.APCBattReplaceDate
Can't find object UPS.Output.ConfigActivePower
Can't find object UPS.PowerSummary.Charging
Can't find object UPS.PowerSummary.Discharging
Can't find object UPS.PowerSummary.ACPresent
Can't find object UPS.PowerSummary.BelowRemainingCapacityLimit
Can't find object UPS.PowerSummary.ShutdownImminent
Can't find object UPS.PowerSummary.PresentStatus.FullyCharged
Can't find object UPS.Output.Overload
Can't find object UPS.Output.Boost
Can't find object UPS.Input.ConfigVoltage
Can't find object UPS.Input.LowVoltageTransfer
Can't find object UPS.Input.HighVoltageTransfer
Can't find object UPS.BatterySystem.Battery.Test
Can't find object UPS.BatterySystem.Battery.Test
Can't find object UPS.BatterySystem.Battery.Test
Can't find object UPS.PowerSummary.APCPanelTest
Can't find object UPS.PowerSummary.APCPanelTest
Can't find object UPS.APCGeneralCollection.APCDelayBeforeShutdown
Can't find object UPS.PowerSummary.DelayBeforeStartup
Can't find object UPS.APCGeneralCollection.APCForceShutdown
Can't find object UPS.APCGeneralCollection.APCDelayBeforeShutdown
upsdrv_updateinfo...
dstate_init: sock /var/run/nut/newhidups-auto open on fd 5


----- first run starts here ...


upsdrv_updateinfo...
Waiting for notifications...

=>Got 1 HID Objects...
output.voltage.nominal = 230
upsdrv_updateinfo...
Waiting for notifications...

=>Got 1 HID Objects...
find_hid_info: unknown variable: UPS.Battery.APCBattCapBeforeStartup

upsdrv_updateinfo...
Waiting for notifications...

=>Got 1 HID Objects...
find_hid_info: unknown variable: UPS.Battery.RemainingTimeLimit

upsdrv_updateinfo...
Waiting for notifications...

=>Got 1 HID Objects...
battery.runtime.low = 120
upsdrv_updateinfo...
Waiting for notifications...

=>Got 1 HID Objects...
battery.runtime = 1020
upsdrv_updateinfo...
Waiting for notifications...

=>Got 16 HID Objects...
find_hid_info: unknown variable: UPS.PowerSummary.PresentStatus.

find_hid_info: unknown variable: UPS.PowerSummary.PresentStatus.

find_hid_info: unknown variable: UPS.PowerSummary.PresentStatus.

find_hid_info: unknown variable: UPS.PowerSummary.PresentStatus.ff860080

find_hid_info: unknown variable: 
UPS.PowerSummary.PresentStatus.VoltageNotRegulated

ups.status = !overload
ups.status = !replacebatt
find_hid_info: unknown variable: 
UPS.PowerSummary.PresentStatus.CommunicationLost

ups.status = !timelimitexp
ups.status = !shutdownimm
find_hid_info: unknown variable: 
UPS.PowerSummary.PresentStatus.ShutdownRequested

ups.status = !lowbatt
ups.status = batterypres
ups.status = online
ups.status = !dischrg
ups.status = !chrg
upsdrv_updateinfo...
Waiting for notifications...

=>Got 1 HID Objects...
battery.charge = 100
upsdrv_updateinfo...
Waiting for notifications...

=>Got 1 HID Objects...
ups.test.result = No test initiated
upsdrv_updateinfo...
Waiting for notifications...

=>Got 1 HID Objects...
find_hid_info: unknown variable: UPS.AudibleAlarmControl

upsdrv_updateinfo...
Waiting for notifications...

=>Got 1 HID Objects...
ups.beeper.status = enabled
upsdrv_updateinfo...
Waiting for notifications...

=>Got 1 HID Objects...
find_hid_info: unknown variable: UPS.Battery.ff86001b

upsdrv_updateinfo...
Waiting for notifications...

=>Got 1 HID Objects...
find_hid_info: unknown variable: UPS.Battery.ff86001a

upsdrv_updateinfo...
Waiting for notifications...

=>Got 1 HID Objects...
battery.mfr.date = 2003/10/10
upsdrv_updateinfo...
Waiting for notifications...

=>Got 1 HID Objects...
find_hid_info: unknown variable: UPS.Input.ff860061

upsdrv_updateinfo...
upsdrv_updateinfo...
Waiting for notifications...

=>Got 1 HID Objects...
find_hid_info: unknown variable: UPS.Output.APCShutdownAfterDelay

upsdrv_updateinfo...
Waiting for notifications...

=>Got 1 HID Objects...
find_hid_info: unknown variable: UPS.Output.HighVoltageTransfer

upsdrv_updateinfo...
Waiting for notifications...

=>Got 1 HID Objects...
find_hid_info: unknown variable: UPS.Output.APCDelayBeforeStartup

upsdrv_updateinfo...
Waiting for notifications...

=>Got 1 HID Objects...
find_hid_info: unknown variable: UPS.Output.LowVoltageTransfer


----- here the code begins to loop until infinity ...


upsdrv_updateinfo...
Waiting for notifications...

=>Got 1 HID Objects...
output.voltage.nominal = 230
upsdrv_updateinfo...
Waiting for notifications...

...



More information about the Nut-upsdev mailing list