[Nut-upsdev] newhidups with APC Smart-UPS 1500
Peter Selinger
selinger at mathstat.dal.ca
Mon Oct 16 19:11:36 UTC 2006
Jacob and Felix,
I just fixed this bug in SVN. The code now uses an allocated list,
instead of a fixed-size array.
Could you please test this. There should be no more segmentation
fault.
Thanks, -- Peter
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
>
>
>
> -----Original Message-----
> From: nut-upsdev-bounces at lists.alioth.debian.org
> [mailto:nut-upsdev-bounces at lists.alioth.debian.org] On Behalf Of Peter
> Selinger
> Sent: Wednesday, October 04, 2006 7:14 PM
> To: Felix M=FChlbauer
> Cc: NUT developers
> Subject: Re: [Nut-upsdev] newhidups with APC Smart-UPS 1500
>
> Thanks. This is useful info, but not sufficient to isolate the bug.
> Could you run newhidups in the debugger, like this:
>
> gdb drivers/newhidups
> (gdb) run -DDDDD -u root auto
>
> [the driver will run and produce enormous amounts of debugging output,
> then crash. Then issue the following command to generate a backtrace,
> which, with some luck, will tell us exactly where the program crashed. ]
>
> (gdb) bt
>
> Please send both the debugging output before the crash, and the debugger
> output after it. Feel free to play around with additional debugger
> commands.
>
> If the resulting file is too large to post on the mailing list, you can
> (exceptionally) send it to my address directly. But in general, please
> keep the traffic on the mailing list. Thanks, -- Peter
>
> =?ISO-8859-1?Q?Felix_M=FChlbauer?= wrote:
> >
> >
> > Peter Selinger wrote:
> > > Yikes, that's a bug I have not seen before. Could you run the driver
>
> > > with debugging enabled, like this:
> > >
> > > drivers/newhidups -DD -u root auto
> > >
> >
> >
> > debug level is '2'
> > Checking device (046B/FF40) (002/003)
> > - VendorID: 046b
> > - ProductID: ff40
> > - Manufacturer: American Megatrends Inc.
> > - Product: Virtual Floppy Device
> > - Serial Number: unknown
> > - Bus: 002
> > Trying to match device
> > Device does not match - skipping
> > Checking device (046B/FF20) (002/002)
> > - VendorID: 046b
> > - ProductID: ff20
> > - Manufacturer: American Megatrends Inc.
> > - Product: Virtual Cdrom Device
> > - Serial Number: unknown
> > - Bus: 002
> > Trying to match device
> > Device does not match - skipping
> > Checking device (0000/0000) (002/001)
> > - VendorID: 0000
> > - ProductID: 0000
> > - Manufacturer: Linux 2.6.8-dol-03-11-amd64-k8-smp ohci_hcd
> > - Product: Advanced Micro Devices [AMD] AMD-8111 USB (#2)
> > - Serial Number: 0000:03:00.1
> > - Bus: 002
> > Trying to match device
> > Device does not match - skipping
> > Checking device (0A81/0205) (001/005)
> > - VendorID: 0a81
> > - ProductID: 0205
> > - Manufacturer: CHESEN
> > - Product: PS2 to USB Converter
> > - Serial Number: unknown
> > - Bus: 001
> > Trying to match device
> > Device does not match - skipping
> > Checking device (046B/FF10) (001/004)
> > - VendorID: 046b
> > - ProductID: ff10
> > - Manufacturer: American Megatrends Inc.
> > - Product: Virtual Keyboard and Mouse
> > - Serial Number: unknown
> > - Bus: 001
> > Trying to match device
> > Device does not match - skipping
> > Checking device (051D/0002) (001/003)
> > - VendorID: 051d
> > - ProductID: 0002
> > - Manufacturer: American Power Conversion
> > - Product: Smart-UPS 1500 RM FW:617.3.I USB FW:1.5
> > - Serial Number: AS0341111860
> > - Bus: 001
> > Trying to match device
> > Device matches
> > Warning: two different HID descriptors retrieved (Reportlen = 61939
> vs.
> > 1040)
> > HID descriptor retrieved (Reportlen = 1040) Report descriptor
> > retrieved (Reportlen = 1040) Found HID device 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: 900.000000
> > Path: UPS.PowerSummary.RunTimeToEmpty, Type: Feature, Value:
> > 900.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: 900.000000
> > Path: UPS.Battery.Temperature, Type: Feature, Value: 292.899994
> > 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: 230.400009
> > 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: 67.599998
> > 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
> > upsdrv_updateinfo...
> > Waiting for notifications...
> >
> > =>Got 1 HID Objects...
> > battery.runtime = 900
> > 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
> > Segmentation fault
> >
>
>
> _______________________________________________
> Nut-upsdev mailing list
> Nut-upsdev at lists.alioth.debian.org
> http://lists.alioth.debian.org/mailman/listinfo/nut-upsdev
>
More information about the Nut-upsdev
mailing list