[Nut-upsdev] Re: Belkin and newhidups (was: Belkin F6C550-AVR UPS)
zaid_aj at telus.net
zaid_aj at telus.net
Thu Aug 4 03:38:36 UTC 2005
Hi,
More updates, after looking at apc-hid.h and mge-hid.h I started writing
belkin-hid.h but I'm not sure of the part where I add the model entry
for my UPS.
For example, here's the relevant part from lsusb -v :
Bus 003 Device 002: ID 050d:0551 Belkin Components
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 1.10
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 8
idVendor 0x050d Belkin Components
idProduct 0x0551
bcdDevice 0.01
iManufacturer 4 Belkin
iProduct 18 UPS
iSerial 0
And this is the structure of HIDDevice (taken from libhid.h):
typedef struct
{
char* Name; /*!< HID Device name */
char* Vendor; /*!< Device's Vendor Name */
u_int16_t VendorID; /*!< Device's Vendor ID */
char* Product; /*!< Device's Product Name */
...
} HIDDevice;
>From what I understood from looking at the examples in mge-hid.h and
apc-hid.h, the entry that I should have will look similar to:
{ "Belkin Components", "Belkin Components", -1, "UPS"}
But the output indicates that this is not correct, since I get:
Network UPS Tools: New USB/HID UPS driver 0.26 (2.1.0)
debug level is '5'
Opening new device (0000/0000)
Opening new device (0000/0000)
Opening new device (050D/0551)
Found 0x50d
- Manufacturer : Belkin
- Product : UPS
- No serial number string
HID descriptor retrieved (Reportlen = 424)
Report descriptor retrieved (Reportlen = 424)
found 1 (424)
Report Descriptor size = 424
Report Descriptor: (200 bytes) => 05 84 09 04 A1 01 05 86 09 26 A1 02 85
01 75 08
Detected an UPS: Belkin/UPS
Manufacturer not supported!
Contact the driver author <arnaud.quette at free.fr / @mgeups.com> with the
below information
I have added #include "belkin-hid.h" to newhidups.c and recompiled.
I think I got most of the "Data lookup table", there are some entries
that I didn't know what to do with them so I didn't include them for
now.
Any input is appreciated.
Zaid
-------------- next part --------------
#define BELKIN_HID_VERSION "BELKIN HID 0.01"
/* --------------------------------------------------------------- */
/* Model Name formating entries */
/* --------------------------------------------------------------- */
models_name_t belkin_models_names [] =
{
/* Belkin Home and Office models */
{ "Belkin", "UPS", -1, "Belkin UPS" },
/* FIXME: To be completed (more Belkin UPS models...) */
/* end of structure. */
{ NULL, NULL, -1, "Generic Belkin HID model}
};
/* --------------------------------------------------------------- */
/* Data lookup table (HID <-> NUT) */
/* --------------------------------------------------------------- */
hid_info_t hid_belkin[] =
{
/* Server side variables */
{ "driver.version.internal", ST_FLAG_STRING, 5, NULL, NULL,
DRIVER_VERSION, HU_FLAG_ABSENT | HU_FLAG_OK, NULL },
{ "driver.version.data", ST_FLAG_STRING, 11, NULL, NULL,
BELKIN_HID_VERSION, HU_FLAG_ABSENT | HU_FLAG_OK, NULL },
/* Battery page */
{ "battery.charge", 0, 1, "UPS.PowerSummary.RemainingCapacity", NULL, "%.0f", HU_FLAG_OK, NULL },
{ "batter.charge.low", ST_FLAG_RW | ST_FLAG_STRING, 5,
"UPS.PowerSummary.RemainingCapacityLimitSetting", NULL, "%.0f", HU_FLAG_OK | HU_FLAG_SEMI_STATIC, NULL },
{ "battery.runtime", 0, 0, "UPS.PowerSummary.RunTimeToEmpty", NULL, "%.0f", HU_FLAG_OK, NULL },
{ "battery.voltage", 0, 0, "UPS.PowerSummary.Voltage", NULL, "%.1f", HU_FLAG_OK, NULL },
{ "battery.voltage.nominal", 0, 0, "UPS.BatterySystem.ConfigVoltage", NULL,
"%.1f", HU_FLAG_OK, NULL },
/* UPS page */
/* FIXME: no load information available? */
/* Special case: ups.status */
{ "ups.status", 0, 1, "UPS.PowerSummary.ACPresent", NULL,
"%.0f", HU_FLAG_OK | HU_FLAG_QUICK_POLL, &onbatt_info[0] },
{ "ups.status", 0, 1, "UPS.PowerSummary.Discharging", NULL,
"%.0f", HU_FLAG_OK | HU_FLAG_QUICK_POLL, &discharging_info[0] },
{ "ups.status", 0, 1, "UPS.PowerSummary.Charging", NULL,
"%.0f", HU_FLAG_OK | HU_FLAG_QUICK_POLL, &charging_info[0] },
{ "ups.status", 0, 1, "UPS.PowerSummary.ShutdownImminent", NULL,
"%.0f", HU_FLAG_OK | HU_FLAG_QUICK_POLL, &shutdownimm_info[0] },
{ "ups.status", 0, 1, "UPS.PowerSummary.BelowRemainingCapacityLimit", NULL,
"%.0f", HU_FLAG_OK | HU_FLAG_QUICK_POLL, &lowbatt_info[0] },
/* Output page */
{ "output.voltage", 0, 0, "UPS.PowerSummary.Voltage", NULL, "%.1f", HU_FLAG_OK, NULL },
{ "output.current", 0, 0, "UPS.PowerSummary.Current", NULL, "%.2f", HU_FLAG_OK, NULL },
{ "output.voltage.target.line", 0, 0,
"UPS.PowerSummary.ConfigVoltage", NULL, "%.1f", HU_FLAG_OK, NULL },
/* End of structure */
{ NULL, 0, 0, NULL, NULL, NULL, 0, NULL }
};
More information about the Nut-upsdev
mailing list