[Nut-upsdev] newhidups for APC Back-UPS ES 650

Alfred Ganz alfred-ganz at agci.com
Tue Aug 2 19:30:11 UTC 2005


Gentlemen,

Please note that what follows pre-dates the latest changes from Arnaud
(just thought someone might want to look at these before I can test the 
latest!).

When running newhidups with -D -D -D I saw messages that looked like
errors, and it took me a while to understand that they were not really
errors. I therefore added two new entries in apc-hid.h, and I modified
a couple of diagnistic messages in newhidups.c, in the hope that someone
else might have it easier. I append a patch file against vanilla 2.0.2.

Also, I thought it might help if I append some extracts from a short
run with the changes. I append those as well.

I will play with the latest changes as soon as I can, unfortunately I
will have to shut this system and move the UPS behind a switch again to
do the testing properly. BTW, the "shutdown.return" entry in apc-hid.h
seems to work fine with my device.

Hope this helps, AG

------------- a patch list -------------------------------------------------
diff -u nut-2.0.2.orig/drivers/apc-hid.h nut-2.0.2/drivers/apc-hid.h
--- nut-2.0.2.orig/drivers/apc-hid.h	2005-06-22 03:39:36.000000000 -0400
+++ nut-2.0.2/drivers/apc-hid.h	2005-07-25 16:40:46.000000000 -0400
@@ -87,6 +87,11 @@
     "%.0f", HU_FLAG_OK, &replacebatt_info[0] },
   { "ups.status", 0, 1, "UPS.PowerSummary.PresentStatus.ShutdownImminent", NULL,
     "%.0f", HU_FLAG_OK, &shutdownimm_info[0] },
+  /* The following two are returned with long notification from Back-UPS ES 650 */
+  { "ups.status", 0, 1, "UPS.PowerSummary.PresentStatus.RemainingTimeLimitExpired", NULL,
+    "%.0f", HU_FLAG_OK, NULL },
+  { "ups.status", 0, 1, "UPS.PowerSummary.PresentStatus.BatteryPresent", NULL,
+    "%.0f", HU_FLAG_OK, NULL },
 
   /* Input page */
   { "input.voltage", 0, 0, "UPS.Input.Voltage", NULL, "%.1f", HU_FLAG_OK, NULL },
diff -u nut-2.0.2.orig/drivers/newhidups.c nut-2.0.2/drivers/newhidups.c
--- nut-2.0.2.orig/drivers/newhidups.c	2005-06-22 08:10:33.000000000 -0400
+++ nut-2.0.2/drivers/newhidups.c	2005-07-27 10:20:27.000000000 -0400
@@ -294,10 +294,17 @@
 							else
 							  dstate_setinfo(item->info_type, item->dfl, nutvalue);
 						  }
+						else
+						  upsdebugx(3, "%s not affected", item->info_type);
 						/* FIXME: else => revert the status, ie -LB == reset LB... */
 					  }
 					else
-					  upsdebugx(2, "%s = %ld", item->info_type, eventsList[evtCount-1]->Value);
+					  {
+					    if (strncmp(item->info_type, "ups.status", 10))
+						upsdebugx(2, "%s = %ld", item->info_type, eventsList[evtCount-1]->Value);
+					    else
+						upsdebugx(3, "%s not affected", item->info_type);
+					  }
 				  }
 				free(eventsList[evtCount-1]);
 				evtCount--;
----------------------------------------------------------------------------

------------- Running: newhidups -D -D -D -a ups.agci ----------------------
debug level is '3'
Opening new device (0000/0000)
Opening new device (0000/0000)
Opening new device (0000/0000)
Opening new device (051D/0002)
Found 0x51d
- Manufacturer : APC
- Product      : Back-UPS ES 650 FW:818.w1.D USB FW:w1
- Serial Number: QB0518132135  
HID descriptor retrieved (Reportlen =   872)
Report descriptor retrieved (Reportlen = 872)
found 1 (872)
Network UPS Tools: New USB/HID UPS driver 0.23 (2.0.2)

Report Descriptor size = 872
Report Descriptor: (200 bytes) => 05 84 09 04 A1 01 09 24 A1 00 85 01 09 FE 79 01 
Detected an UPS: APC/Back-UPS ES 650 FW:818.w1.D USB FW:w1

.............  output heavily reduced!

Path: UPS.PowerSummary.iSerialNumber
Path: UPS.PowerSummary.iDeviceChemistry
Path: UPS.PowerSummary.iOEMInformation
Path: UPS.PowerSummary.Rechargeable
Path: UPS.PowerSummary.APCStatusFlag
Path: UPS.PowerSummary.APCStatusFlag
Path: UPS.PowerSummary.ManufacturerDate
Path: UPS.PowerSummary.ConfigVoltage
Path: UPS.PowerSummary.Voltage
Path: UPS.PowerSummary.iManufacturer
Path: UPS.PowerSummary.CapacityMode
Path: UPS.PowerSummary.RemainingCapacity
Path: UPS.PowerSummary.RemainingCapacity
Path: UPS.PowerSummary.RunTimeToEmpty
Path: UPS.PowerSummary.RunTimeToEmpty
Path: UPS.PowerSummary.DesignCapacity
Path: UPS.PowerSummary.FullChargeCapacity
Path: UPS.PowerSummary.WarningCapacityLimit
Path: UPS.PowerSummary.CapacityGranularity2
Path: UPS.PowerSummary.RemainingCapacityLimit
Path: UPS.PowerSummary.CapacityGranularity1
Path: UPS.PowerSummary.PresentStatus.Charging
Path: UPS.PowerSummary.PresentStatus.Charging
Path: UPS.PowerSummary.PresentStatus.Discharging
Path: UPS.PowerSummary.PresentStatus.Discharging
Path: UPS.PowerSummary.PresentStatus.ACPresent
Path: UPS.PowerSummary.PresentStatus.ACPresent
Path: UPS.PowerSummary.PresentStatus.BatteryPresent
Path: UPS.PowerSummary.PresentStatus.BatteryPresent
Path: UPS.PowerSummary.PresentStatus.BelowRemainingCapacityLimit
Path: UPS.PowerSummary.PresentStatus.BelowRemainingCapacityLimit
Path: UPS.PowerSummary.PresentStatus.ShutdownImminent
Path: UPS.PowerSummary.PresentStatus.ShutdownImminent
Path: UPS.PowerSummary.PresentStatus.RemainingTimeLimitExpired
Path: UPS.PowerSummary.PresentStatus.RemainingTimeLimitExpired
Path: UPS.PowerSummary.PresentStatus.NeedReplacement
Path: UPS.PowerSummary.PresentStatus.NeedReplacement
Path: UPS.PowerSummary.PresentStatus.OverLoad
Path: UPS.PowerSummary.PresentStatus.OverLoad
Path: UPS.PowerSummary.RemainingTimeLimit
Path: UPS.PowerSummary.AudibleAlarmControl
Path: UPS.Battery.APCBattReplaceDate
Path: UPS.Battery.ManufacturerDate
Path: UPS.Battery.RemainingCapacity
Path: UPS.Battery.RunTimeToEmpty
Path: UPS.Battery.RunTimeToEmpty
Path: UPS.Battery.RemainingTimeLimit
Path: UPS.Battery.ConfigVoltage
Path: UPS.Battery.Voltage
Path: UPS.Battery.ff860024
Path: UPS.ff860018.Input
Path: UPS.ff860018.ConfigVoltage
Path: UPS.ff860018.Voltage
Path: UPS.ff860018.LowVoltageTransfer
Path: UPS.ff860018.HighVoltageTransfer
Path: UPS.ff860018.ff860024
Path: UPS.ff860018.ff860061
Path: UPS.APC860052.APCGeneralCollection
Path: UPS.APC860052.APCForceShutdown
Path: UPS.APCDelayBeforeShutdown.PowerConverter
Path: UPS.APCDelayBeforeShutdown.PercentLoad
Path: UPS.ff860024.ff860001
Path: UPS.ff860024.ff860023
Path: UPS.ff860024.ff860026
Path: UPS.ff860025
Path: UPS.iProduct
Path: UPS.APC_UPS_FirmwareRevision
Path: UPS.iSerialNumber
Path: UPS.iManufacturer
Path: UPS.ManufacturerDate.PresentStatus
Path: UPS.ManufacturerDate.Charging
Path: UPS.ManufacturerDate.Discharging
Path: UPS.ManufacturerDate.ACPresent
Path: UPS.ManufacturerDate.BatteryPresent
Path: UPS.ManufacturerDate.BelowRemainingCapacityLimit
Path: UPS.ManufacturerDate.ShutdownImminent
Path: UPS.ManufacturerDate.RemainingTimeLimitExpired
Path: UPS.ManufacturerDate.NeedReplacement
Path: UPS.ManufacturerDate.OverLoad
Path: UPS.APCPanelTest
Path: UPS.AudibleAlarmControl
Path: UPS.ff860029
Path: UPS.ff86002a
entering identify_ups(0x051d, 0x0001)

entering lookup_path()
Looking up UPS
..................... someone tell me if you want more!
..................... removing the Looking up lines

upsdrv_updateinfo...
Waiting for notifications...
 ok

Notification: (2 bytes) => 06 08                                           
entering lookup_path()
Object: UPS.PowerSummary.APCStatusFlag = 8
upsdrv_updateinfo...
Waiting for notifications...
 ok

Notification: (4 bytes) => 0C 64 B3 08                                     
entering lookup_path()
Object: UPS.PowerSummary.RemainingCapacity = 100
entering lookup_path()
Object: UPS.PowerSummary.RunTimeToEmpty = 2227

=>Got 2 HID Objects...
Object: UPS.PowerSummary.RunTimeToEmpty = 2227
battery.runtime = 2227
Object: UPS.PowerSummary.RemainingCapacity = 100
battery.charge = 100
upsdrv_updateinfo...
Waiting for notifications...
 ok

.......... several of the above

Notification: (5 bytes) => 16 0C 00 00 00                                  
entering lookup_path()
Object: UPS.PowerSummary.PresentStatus.Charging = 0
entering lookup_path()
Object: UPS.PowerSummary.PresentStatus.Discharging = 0
entering lookup_path()
Object: UPS.PowerSummary.PresentStatus.ACPresent = 1
entering lookup_path()
Object: UPS.PowerSummary.PresentStatus.BatteryPresent = 1
entering lookup_path()
Object: UPS.PowerSummary.PresentStatus.BelowRemainingCapacityLimit = 0
entering lookup_path()
Object: UPS.PowerSummary.PresentStatus.ShutdownImminent = 0
entering lookup_path()
Object: UPS.PowerSummary.PresentStatus.RemainingTimeLimitExpired = 0
entering lookup_path()
Object: UPS.PowerSummary.PresentStatus.NeedReplacement = 0
entering lookup_path()
Object: UPS.PowerSummary.PresentStatus.OverLoad = 0

.............  removing empty Status entries!

=>Got 9 HID Objects...
Object: UPS.PowerSummary.PresentStatus.OverLoad = 0
hu_find_infoval: searching for value = 0

hu_find_infoval: no matching INFO_* value for this HID value (0)

ups.status not affected
Object: UPS.PowerSummary.PresentStatus.NeedReplacement = 0
hu_find_infoval: searching for value = 0

hu_find_infoval: no matching INFO_* value for this HID value (0)

ups.status not affected
Object: UPS.PowerSummary.PresentStatus.RemainingTimeLimitExpired = 0
ups.status not affected
Object: UPS.PowerSummary.PresentStatus.ShutdownImminent = 0
hu_find_infoval: searching for value = 0

hu_find_infoval: no matching INFO_* value for this HID value (0)

ups.status not affected
Object: UPS.PowerSummary.PresentStatus.BelowRemainingCapacityLimit = 0
hu_find_infoval: searching for value = 0

hu_find_infoval: no matching INFO_* value for this HID value (0)

ups.status not affected
Object: UPS.PowerSummary.PresentStatus.BatteryPresent = 1
ups.status not affected
Object: UPS.PowerSummary.PresentStatus.ACPresent = 1
hu_find_infoval: searching for value = 1

hu_find_infoval: found OL (value: 1)

ups.status = OL
process_status_info: OL

Object: UPS.PowerSummary.PresentStatus.Discharging = 0
hu_find_infoval: searching for value = 0

hu_find_infoval: no matching INFO_* value for this HID value (0)

ups.status not affected
Object: UPS.PowerSummary.PresentStatus.Charging = 0
hu_find_infoval: searching for value = 0

hu_find_infoval: no matching INFO_* value for this HID value (0)

ups.status not affected
upsdrv_updateinfo...
Waiting for notifications...
 ok
----------------------------------------------------------------------------

-- 
 ----------------------------------------------------------------------
   Alfred Ganz					alfred-ganz at agci.com
   AG Consulting, Inc.				(203) 624-9667
   440 Prospect Street # 11
   New Haven, CT 06511
 ----------------------------------------------------------------------



More information about the Nut-upsdev mailing list