[Nut-upsdev] newhidups with APC Smart-UPS 1500
Peter Selinger
selinger at mathstat.dal.ca
Wed Oct 18 17:17:45 UTC 2006
Great, thanks for the feedback! -- Peter
Schmier, Jacob wrote:
>
>
> I tested your fix (newhidups -DDD /dev/null) using both and APC Back-UPS
> 350 an APC Smart-UPS RT 2000 XL. =20
>
> No more segmentation fault due to the fixed-size array.
>
> ~Jacob
>
> -----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: Monday, October 16, 2006 12:12 PM
> To: Schmier, Jacob
> Cc: NUT developers
> Subject: Re: [Nut-upsdev] newhidups with APC Smart-UPS 1500
>
> Jacob and Felix,
>
> I just fixed this bug in SVN. The code now uses an allocated list,
> instead of a fixed-size array.=20
>
> Could you please test this. There should be no more segmentation fault.=20
>
> Thanks, -- Peter
>
> Schmier, Jacob wrote:
> >=20
> >=20
> > The source of the segmentation fault is in newhidups.c at line 534.
> >=20
> > 528
> > 529 void upsdrv_updateinfo(void)
> > 530 {
> > 531 hid_info_t *item;
> > 532 char *nutvalue;
> > 533 int retcode, evtCount =3D 0;
> > 534 HIDItem *eventsList[10];
> > 535=20
> > 536 upsdebugx(1, "upsdrv_updateinfo...");
> > 537
> > 538
> >=20
> > The array only holds pointers to 10 HID items.
> >=20
> > > =3D>Got 16 HID Objects...
> >=20
> > Produces a segmentation fault.
> >=20
> > I got around this by temporarily increasing the size of the array.
> > HIDItem *eventsList[32];
> >=20
> > A better fix is needed. The code loops until the total number HID=20
> > objects are retrieved. The array needs to hold this total number of=20
> > HID objects in all cases to avoid problems.
> >=20
> > ~Jacob Schmier
> >=20
> >=20
> >=20
> > -----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=3DFChlbauer
> > Cc: NUT developers
> > Subject: Re: [Nut-upsdev] newhidups with APC Smart-UPS 1500
> >=20
> > Thanks. This is useful info, but not sufficient to isolate the bug.
> > Could you run newhidups in the debugger, like this:
> >=20
> > gdb drivers/newhidups
> > (gdb) run -DDDDD -u root auto
> >=20
> > [the driver will run and produce enormous amounts of debugging output,
>
> > then crash. Then issue the following command to generate a backtrace,=20
> > which, with some luck, will tell us exactly where the program crashed.
>
> > ]
> >=20
> > (gdb) bt
> >=20
> > Please send both the debugging output before the crash, and the=20
> > debugger output after it. Feel free to play around with additional=20
> > debugger commands.
> >=20
> > If the resulting file is too large to post on the mailing list, you=20
> > can
> > (exceptionally) send it to my address directly. But in general, please
>
> > keep the traffic on the mailing list. Thanks, -- Peter
> >=20
> > =3D?ISO-8859-1?Q?Felix_M=3DFChlbauer?=3D wrote:
> > >
> > >
> > > Peter Selinger wrote:
> > > > Yikes, that's a bug I have not seen before. Could you run the=20
> > > > driver
> >=20
> > > > 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 =3D =
> 61939
> > vs.
> > > 1040)
> > > HID descriptor retrieved (Reportlen =3D 1040) Report descriptor=20
> > > retrieved (Reportlen =3D 1040) Found HID device Network UPS Tools:
> > 0.28
> > > USB communication driver 0.28 - core 0.30 (2.1.0)
> > >
> > > Report Descriptor size =3D 1040
> > > Detected a UPS: American Power Conversion/Smart-UPS 1500 RM=20
> > > FW:617.3.I
> >=20
> > > 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:=20
> > > 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:=20
> > > 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:=20
> > > 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:=20
> > > Feature,
> > > Value: 0.000000
> > > Path: UPS.PowerSummary.PresentStatus.ShutdownImminent, Type: Input,
> > > Value: 0.000000
> > > Path: UPS.PowerSummary.PresentStatus.ShutdownImminent, Type:=20
> > > 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:=20
> > > 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:=20
> > > 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:=20
> > > 12106.000000
> > > Path: UPS.Battery.RemainingCapacity, Type: Feature, Value:=20
> > > 100.000000
> > > Path: UPS.Battery.RemainingTimeLimit, Type: Input, Value: 120.000000
> > > Path: UPS.Battery.RemainingTimeLimit, Type: Feature, Value:=20
> > > 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:=20
> > > 253.000000
> > > Path: UPS.Output.LowVoltageTransfer, Type: Input, Value: 208.000000
> > > Path: UPS.Output.LowVoltageTransfer, Type: Feature, Value:=20
> > > 208.000000
> > > Path: UPS.Output.APCDelayBeforeStartup, Type: Input, Value: 0.000000
> > > Path: UPS.Output.APCDelayBeforeStartup, Type: Feature, Value:=20
> > > 0.000000
> > > Path: UPS.Output.APCShutdownAfterDelay, Type: Input, Value:=20
> > > 90.000000
> > > Path: UPS.Output.APCShutdownAfterDelay, Type: Feature, Value:
> > > 90.000000
> > > Path: UPS.Output.DelayBeforeShutdown, Type: Feature, Value:=20
> > > -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:=20
> > > 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:=20
> > > 0.000000
> > > Path: UPS.PresentStatus.ShutdownImminent, Type: Feature, Value:
> > > 0.000000
> > > Path: UPS.PresentStatus.RemainingTimeLimitExpired, Type: Input,
> Value:=20
> >=20
> > > 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:=20
> > > 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=20
> > > UPS.Battery.APCBattReplaceDate Can't find object=20
> > > UPS.Output.ConfigActivePower Can't find object=20
> > > UPS.PowerSummary.Charging Can't find object=20
> > > UPS.PowerSummary.Discharging Can't find object=20
> > > UPS.PowerSummary.ACPresent Can't find object=20
> > > UPS.PowerSummary.BelowRemainingCapacityLimit
> > > Can't find object UPS.PowerSummary.ShutdownImminent Can't find=20
> > > object UPS.PowerSummary.PresentStatus.FullyCharged
> > > Can't find object UPS.Output.Overload Can't find object=20
> > > UPS.Output.Boost Can't find object UPS.Input.ConfigVoltage Can't=20
> > > find object UPS.Input.LowVoltageTransfer Can't find object=20
> > > UPS.Input.HighVoltageTransfer Can't find object=20
> > > UPS.BatterySystem.Battery.Test Can't find object=20
> > > UPS.BatterySystem.Battery.Test Can't find object=20
> > > UPS.BatterySystem.Battery.Test Can't find object=20
> > > UPS.PowerSummary.APCPanelTest Can't find object=20
> > > UPS.PowerSummary.APCPanelTest Can't find object=20
> > > 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=20
> > > upsdrv_updateinfo...
> > > Waiting for notifications...
> > >
> > > =3D>Got 1 HID Objects...
> > > battery.runtime =3D 900
> > > upsdrv_updateinfo...
> > > Waiting for notifications...
> > >
> > > =3D>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 =3D !overload
> > > ups.status =3D !replacebatt
> > > find_hid_info: unknown variable:
> > > UPS.PowerSummary.PresentStatus.CommunicationLost
> > >
> > > ups.status =3D !timelimitexp
> > > ups.status =3D !shutdownimm
> > > find_hid_info: unknown variable:
> > > UPS.PowerSummary.PresentStatus.ShutdownRequested
> > >
> > > ups.status =3D !lowbatt
> > > ups.status =3D batterypres
> > > ups.status =3D online
> > > ups.status =3D !dischrg
> > > ups.status =3D !chrg
> > > Segmentation fault
> > >
> >=20
> >=20
> > _______________________________________________
> > Nut-upsdev mailing list
> > Nut-upsdev at lists.alioth.debian.org
> > http://lists.alioth.debian.org/mailman/listinfo/nut-upsdev
> >=20
>
>
> _______________________________________________
> 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