Hi, I'm trying to generate a skeleton driver with usbhid-ups and gen-usbhid-subdriver but the output seems to be incorrect. Same behavior with stable 2.6.5, so I guess there is something wrong with data coming out of device. I attached the output of usbhid-ups and gen-usbhid-subdriver from the commands:
drivers/usbhid-ups -DD -u root -x explore -x vendorid=04d8 -a openups >& openups-dump.txt ./gen-usbhid-subdriver.sh -n openUPS -v 04d8 -p d004 -k < ../../openups-dump.txt Thanks, Nicu
0.000000 debug level is '2' 0.000504 upsdrv_initups... 0.306826 Checking device (04D8/D004) (008/003) 0.319507 - VendorID: 04d8 0.319538 - ProductID: d004 0.319546 - Manufacturer: Mini-Box.Com 0.319553 - Product: OPEN-UPS 0.319560 - Serial Number: PBSO4-LiFePO 0.319567 - Bus: 008 0.319574 Trying to match device 0.319622 Device matches 0.321508 HID descriptor length 519 0.325501 Report Descriptor size = 519 0.325668 Using subdriver: EXPLORE HID 0.1 0.326510 Path: UPS.PowerSummary.PowerSummaryID, Type: Feature, ReportID: 0x01, Offset: 0, Size: 8, Value: 1 0.327502 refresh_report_buffer: expected 4 bytes, but got 2 instead 0.327516 Path: UPS.PowerSummary.iName, Type: Feature, ReportID: 0x10, Offset: 0, Size: 8, Value: 1 0.328503 refresh_report_buffer: expected 4 bytes, but got 2 instead 0.328518 Path: UPS.PowerSummary.iProduct, Type: Feature, ReportID: 0x11, Offset: 0, Size: 8, Value: 2 0.329501 refresh_report_buffer: expected 4 bytes, but got 2 instead 0.329515 Path: UPS.PowerSummary.iSerialNumber, Type: Feature, ReportID: 0x12, Offset: 0, Size: 8, Value: 3 0.330500 refresh_report_buffer: expected 4 bytes, but got 2 instead 0.330513 Path: UPS.PowerSummary.iDeviceChemistry, Type: Feature, ReportID: 0x13, Offset: 0, Size: 8, Value: 4 0.331502 refresh_report_buffer: expected 4 bytes, but got 2 instead 0.331516 Path: UPS.PowerSummary.iOEMInformation, Type: Feature, ReportID: 0x14, Offset: 0, Size: 8, Value: 1 0.332500 refresh_report_buffer: expected 4 bytes, but got 2 instead 0.332514 Path: UPS.PowerSummary.iManufacturer, Type: Feature, ReportID: 0x15, Offset: 0, Size: 8, Value: 1 0.333500 refresh_report_buffer: expected 4 bytes, but got 2 instead 0.333514 Path: UPS.PowerSummary.00840087, Type: Feature, ReportID: 0x16, Offset: 0, Size: 8, Value: 1 0.334499 refresh_report_buffer: expected 13 bytes, but got 5 instead 0.334514 Path: UPS.PowerSummary.ConfigVoltage, Type: Feature, ReportID: 0x20, Offset: 0, Size: 16, Value: 0 0.334528 Path: UPS.PowerSummary.Voltage, Type: Feature, ReportID: 0x20, Offset: 48, Size: 16, Value: 0 0.335501 refresh_report_buffer: expected 13 bytes, but got 5 instead 0.335515 Path: UPS.PowerSummary.ConfigCurrent, Type: Feature, ReportID: 0x30, Offset: 0, Size: 16, Value: 0 0.335529 Path: UPS.PowerSummary.Current, Type: Feature, ReportID: 0x30, Offset: 48, Size: 16, Value: 0 0.336508 Path: UPS.PowerSummary.PresentStatus.Present, Type: Feature, ReportID: 0x40, Offset: 0, Size: 1, Value: 0 0.336522 Path: UPS.PowerSummary.PresentStatus.Good, Type: Feature, ReportID: 0x40, Offset: 1, Size: 1, Value: 0.01 0.336535 Path: UPS.PowerSummary.PresentStatus.InternalFailure, Type: Feature, ReportID: 0x40, Offset: 2, Size: 1, Value: 0 0.336547 Path: UPS.PowerSummary.PresentStatus.Overload, Type: Feature, ReportID: 0x40, Offset: 3, Size: 1, Value: 0 0.336559 Path: UPS.PowerSummary.PresentStatus.OverCharged, Type: Feature, ReportID: 0x40, Offset: 4, Size: 1, Value: 0 0.336571 Path: UPS.PowerSummary.PresentStatus.OverTemperature, Type: Feature, ReportID: 0x40, Offset: 5, Size: 1, Value: 0 0.336583 Path: UPS.PowerSummary.PresentStatus.ShutdownRequested, Type: Feature, ReportID: 0x40, Offset: 6, Size: 1, Value: 0 0.336595 Path: UPS.PowerSummary.PresentStatus.ShutdownImminent, Type: Feature, ReportID: 0x40, Offset: 7, Size: 1, Value: 0 0.336608 Path: UPS.PowerSummary.PresentStatus.BelowRemainingCapacityLimit, Type: Feature, ReportID: 0x40, Offset: 8, Size: 1, Value: 0 0.336620 Path: UPS.PowerSummary.PresentStatus.RemainingTimeLimitExpired, Type: Feature, ReportID: 0x40, Offset: 9, Size: 1, Value: 0 0.336632 Path: UPS.PowerSummary.PresentStatus.Charging, Type: Feature, ReportID: 0x40, Offset: 10, Size: 1, Value: 0 0.336644 Path: UPS.PowerSummary.PresentStatus.Discharging, Type: Feature, ReportID: 0x40, Offset: 11, Size: 1, Value: 0 0.336656 Path: UPS.PowerSummary.PresentStatus.ConditioningFlag, Type: Feature, ReportID: 0x40, Offset: 12, Size: 1, Value: 0 0.336668 Path: UPS.PowerSummary.PresentStatus.NeedReplacement, Type: Feature, ReportID: 0x40, Offset: 13, Size: 1, Value: 0 0.336691 Path: UPS.PowerSummary.PresentStatus.ACPresent, Type: Feature, ReportID: 0x40, Offset: 14, Size: 1, Value: 0 0.336704 Path: UPS.PowerSummary.PresentStatus.BatteryPresent, Type: Feature, ReportID: 0x40, Offset: 15, Size: 1, Value: 0 0.336716 Path: UPS.PowerSummary.00000000.Present, Type: Input, ReportID: 0x40, Offset: 0, Size: 1, Value: 0 0.336729 Path: UPS.PowerSummary.00000000.Good, Type: Input, ReportID: 0x40, Offset: 1, Size: 1, Value: 0.01 0.336741 Path: UPS.PowerSummary.00000000.InternalFailure, Type: Input, ReportID: 0x40, Offset: 2, Size: 1, Value: 0 0.336754 Path: UPS.PowerSummary.00000000.Overload, Type: Input, ReportID: 0x40, Offset: 3, Size: 1, Value: 0 0.336768 Path: UPS.PowerSummary.00000000.OverCharged, Type: Input, ReportID: 0x40, Offset: 4, Size: 1, Value: 0 0.336780 Path: UPS.PowerSummary.00000000.OverTemperature, Type: Input, ReportID: 0x40, Offset: 5, Size: 1, Value: 0 0.336792 Path: UPS.PowerSummary.00000000.ShutdownRequested, Type: Input, ReportID: 0x40, Offset: 6, Size: 1, Value: 0 0.336804 Path: UPS.PowerSummary.00000000.ShutdownImminent, Type: Input, ReportID: 0x40, Offset: 7, Size: 1, Value: 0 0.336816 Path: UPS.PowerSummary.00000000.BelowRemainingCapacityLimit, Type: Input, ReportID: 0x40, Offset: 8, Size: 1, Value: 0 0.336828 Path: UPS.PowerSummary.00000000.RemainingTimeLimitExpired, Type: Input, ReportID: 0x40, Offset: 9, Size: 1, Value: 0 0.336841 Path: UPS.PowerSummary.00000000.Charging, Type: Input, ReportID: 0x40, Offset: 10, Size: 1, Value: 0 0.336853 Path: UPS.PowerSummary.00000000.Discharging, Type: Input, ReportID: 0x40, Offset: 11, Size: 1, Value: 0 0.336865 Path: UPS.PowerSummary.00000000.ConditioningFlag, Type: Input, ReportID: 0x40, Offset: 12, Size: 1, Value: 0 0.336877 Path: UPS.PowerSummary.00000000.NeedReplacement, Type: Input, ReportID: 0x40, Offset: 13, Size: 1, Value: 0 0.336889 Path: UPS.PowerSummary.00000000.ACPresent, Type: Input, ReportID: 0x40, Offset: 14, Size: 1, Value: 0 0.336901 Path: UPS.PowerSummary.00000000.BatteryPresent, Type: Input, ReportID: 0x40, Offset: 15, Size: 1, Value: 0 0.337503 Path: UPS.PowerSummary.CapacityMode, Type: Feature, ReportID: 0x50, Offset: 0, Size: 8, Value: 0.02 0.338506 Path: UPS.PowerSummary.DesignCapacity, Type: Feature, ReportID: 0x51, Offset: 0, Size: 8, Value: 100 0.339508 Path: UPS.PowerSummary.RemainingCapacity, Type: Input, ReportID: 0x52, Offset: 0, Size: 8, Value: 50 0.339523 Path: UPS.PowerSummary.RemainingCapacity, Type: Feature, ReportID: 0x52, Offset: 0, Size: 8, Value: 50 0.340505 Path: UPS.PowerSummary.FullChargeCapacity, Type: Feature, ReportID: 0x53, Offset: 0, Size: 8, Value: 100 0.341504 Path: UPS.PowerSummary.RemainingCapacityLimit, Type: Feature, ReportID: 0x54, Offset: 0, Size: 8, Value: 5 0.342505 Path: UPS.PowerSummary.WarningCapacityLimit, Type: Feature, ReportID: 0x55, Offset: 0, Size: 8, Value: 20 0.343504 Path: UPS.PowerSummary.CapacityGranularity1, Type: Feature, ReportID: 0x56, Offset: 0, Size: 8, Value: 5 0.344505 Path: UPS.PowerSummary.CapacityGranularity2, Type: Feature, ReportID: 0x57, Offset: 0, Size: 8, Value: 5 0.345508 Path: UPS.PowerSummary.RunTimeToEmpty, Type: Feature, ReportID: 0x60, Offset: 0, Size: 24, Value: 3.9321e+06 0.345522 Path: UPS.PowerSummary.RunTimeToEmpty, Type: Input, ReportID: 0x60, Offset: 0, Size: 24, Value: 3.9321e+06 0.346515 Can't retrieve Report b1: Broken pipe 0.346528 Path: ff000001.ff000001, Type: Output, ReportID: 0xb1, Offset: 0, Size: 248 0.347502 Can't retrieve Report b2: Broken pipe 0.347514 Path: ff000001.ff000001, Type: Input, ReportID: 0xb2, Offset: 0, Size: 248 0.348506 Can't retrieve Report 81: Broken pipe 0.348520 Path: ff000001.ff000001, Type: Output, ReportID: 0x81, Offset: 0, Size: 248 0.349501 Can't retrieve Report 82: Broken pipe 0.349513 Path: ff000001.ff000001, Type: Input, ReportID: 0x82, Offset: 0, Size: 248 0.350503 Can't retrieve Report 83: Broken pipe 0.350523 Path: ff000001.ff000001, Type: Output, ReportID: 0x83, Offset: 0, Size: 248 0.351503 Can't retrieve Report 84: Broken pipe 0.351514 Path: ff000001.ff000001, Type: Input, ReportID: 0x84, Offset: 0, Size: 248 0.352500 Can't retrieve Report 85: Broken pipe 0.352511 Path: ff000001.ff000001, Type: Output, ReportID: 0x85, Offset: 0, Size: 248 0.353505 Can't retrieve Report 86: Broken pipe 0.353517 Path: ff000001.ff000001, Type: Input, ReportID: 0x86, Offset: 0, Size: 248 0.354505 Can't retrieve Report a2: Broken pipe 0.354518 Path: ff000001.ff000001, Type: Input, ReportID: 0xa2, Offset: 0, Size: 248 0.355502 Can't retrieve Report a1: Broken pipe 0.355514 Path: ff000001.ff000001, Type: Output, ReportID: 0xa1, Offset: 0, Size: 248 0.356506 Can't retrieve Report a4: Broken pipe 0.356520 Path: ff000001.ff000001, Type: Input, ReportID: 0xa4, Offset: 0, Size: 248 0.357502 Can't retrieve Report a3: Broken pipe 0.357513 Path: ff000001.ff000001, Type: Output, ReportID: 0xa3, Offset: 0, Size: 248 0.358504 Can't retrieve Report a5: Broken pipe 0.358515 Path: ff000001.ff000001, Type: Output, ReportID: 0xa5, Offset: 0, Size: 248 0.359503 Can't retrieve Report a9: Broken pipe 0.359515 Path: ff000001.ff000001, Type: Output, ReportID: 0xa9, Offset: 0, Size: 248 0.360504 Can't retrieve Report aa: Broken pipe 0.360515 Path: ff000001.ff000001, Type: Input, ReportID: 0xaa, Offset: 0, Size: 248 0.361504 Can't retrieve Report cc: Broken pipe 0.361516 Path: ff000001.ff000001, Type: Input, ReportID: 0xcc, Offset: 0, Size: 248 Network UPS Tools - Generic HID driver 0.37 (2.6.5-3766M) USB communication driver 0.31 0.361537 Report descriptor retrieved (Reportlen = 519) 0.361544 Found HID device 0.361552 Detected a UPS: Mini-Box.Com/OPEN-UPS 0.361561 find_nut_info: unknown info type: load.off.delay 0.361569 find_nut_info: unknown info type: load.on.delay 0.361576 find_nut_info: unknown info type: load.off.delay 0.361589 upsdrv_initinfo... 0.361601 upsdrv_updateinfo... 0.613528 libusb_get_interrupt: Connection timed out 0.613565 Got 0 HID objects... 0.613574 Quick update... 0.613681 dstate_init: sock /var/state/ups/usbhid-ups-openups open on fd 5 0.613697 upsdrv_updateinfo... 0.865536 libusb_get_interrupt: Connection timed out 0.865568 Got 0 HID objects... 0.865577 Quick update... 2.615467 upsdrv_updateinfo... 2.867631 libusb_get_interrupt: Connection timed out 2.867666 Got 0 HID objects... 2.867675 Quick update... 4.617224 upsdrv_updateinfo... 4.868724 libusb_get_interrupt: Connection timed out 4.868758 Got 0 HID objects... 4.868767 Quick update...
/* openups-hid.c - subdriver to monitor openUPS USB/HID devices with NUT * * Copyright (C) * 2003 - 2012 Arnaud Quette <[email protected]> * 2005 - 2006 Peter Selinger <[email protected]> * 2008 - 2009 Arjen de Korte <[email protected]> * * Note: this subdriver was initially generated as a "stub" by the * gen-usbhid-subdriver script. It must be customized. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "usbhid-ups.h" #include "openups-hid.h" #include "main.h" /* for getval() */ #include "usb-common.h" #define OPENUPS_HID_VERSION "openUPS HID 0.1" /* FIXME: experimental flag to be put in upsdrv_info */ /* openUPS */ #define OPENUPS_VENDORID 0x 0.319507 04d8 /* USB IDs device table */ static usb_device_id_t openups_usb_device_table[] = { /* openUPS */ { USB_DEVICE(OPENUPS_VENDORID, 0x 0.319538 d004), NULL }, /* Terminating entry */ { -1, -1, NULL } }; /* --------------------------------------------------------------- */ /* Vendor-specific usage table */ /* --------------------------------------------------------------- */ /* OPENUPS usage table */ static usage_lkp_t openups_usage_lkp[] = { { "OPENUPS1", 0x00000000 }, { "OPENUPS2", 0x00840087 }, { "OPENUPS3", 0x346528 ff000001 }, { "OPENUPS4", 0x347514 ff000001 }, { "OPENUPS5", 0x348520 ff000001 }, { "OPENUPS6", 0x349513 ff000001 }, { "OPENUPS7", 0x350523 ff000001 }, { "OPENUPS8", 0x351514 ff000001 }, { "OPENUPS9", 0x352511 ff000001 }, { "OPENUPS10", 0x353517 ff000001 }, { "OPENUPS11", 0x354518 ff000001 }, { "OPENUPS12", 0x355514 ff000001 }, { "OPENUPS13", 0x356520 ff000001 }, { "OPENUPS14", 0x357513 ff000001 }, { "OPENUPS15", 0x358515 ff000001 }, { "OPENUPS16", 0x359515 ff000001 }, { "OPENUPS17", 0x360515 ff000001 }, { "OPENUPS18", 0x361516 ff000001 }, { "OPENUPS19", 0xff000001 }, { NULL, 0 } }; static usage_tables_t openups_utab[] = { openups_usage_lkp, hid_usage_lkp, NULL, }; /* --------------------------------------------------------------- */ /* HID2NUT lookup table */ /* --------------------------------------------------------------- */ static hid_info_t openups_hid2nut[] = { { "unmapped.0.326510 ups.powersummary.powersummaryid", 0, 0, "0.326510 UPS.PowerSummary.PowerSummaryID", NULL, "%.0f", 0, NULL }, { "unmapped.0.327516 ups.powersummary.iname", 0, 0, "0.327516 UPS.PowerSummary.iName", NULL, "%.0f", 0, NULL }, { "unmapped.0.328518 ups.powersummary.iproduct", 0, 0, "0.328518 UPS.PowerSummary.iProduct", NULL, "%.0f", 0, NULL }, { "unmapped.0.329515 ups.powersummary.iserialnumber", 0, 0, "0.329515 UPS.PowerSummary.iSerialNumber", NULL, "%.0f", 0, NULL }, { "unmapped.0.330513 ups.powersummary.idevicechemistry", 0, 0, "0.330513 UPS.PowerSummary.iDeviceChemistry", NULL, "%.0f", 0, NULL }, { "unmapped.0.331516 ups.powersummary.ioeminformation", 0, 0, "0.331516 UPS.PowerSummary.iOEMInformation", NULL, "%.0f", 0, NULL }, { "unmapped.0.332514 ups.powersummary.imanufacturer", 0, 0, "0.332514 UPS.PowerSummary.iManufacturer", NULL, "%.0f", 0, NULL }, { "unmapped.0.333514 ups.powersummary.openups2", 0, 0, "0.333514 UPS.PowerSummary.OPENUPS2", NULL, "%.0f", 0, NULL }, { "unmapped.0.334514 ups.powersummary.configvoltage", 0, 0, "0.334514 UPS.PowerSummary.ConfigVoltage", NULL, "%.0f", 0, NULL }, { "unmapped.0.334528 ups.powersummary.voltage", 0, 0, "0.334528 UPS.PowerSummary.Voltage", NULL, "%.0f", 0, NULL }, { "unmapped.0.335515 ups.powersummary.configcurrent", 0, 0, "0.335515 UPS.PowerSummary.ConfigCurrent", NULL, "%.0f", 0, NULL }, { "unmapped.0.335529 ups.powersummary.current", 0, 0, "0.335529 UPS.PowerSummary.Current", NULL, "%.0f", 0, NULL }, { "unmapped.0.336508 ups.powersummary.presentstatus.present", 0, 0, "0.336508 UPS.PowerSummary.PresentStatus.Present", NULL, "%.0f", 0, NULL }, { "unmapped.0.336522 ups.powersummary.presentstatus.good", 0, 0, "0.336522 UPS.PowerSummary.PresentStatus.Good", NULL, "%.0f", 0, NULL }, { "unmapped.0.336535 ups.powersummary.presentstatus.internalfailure", 0, 0, "0.336535 UPS.PowerSummary.PresentStatus.InternalFailure", NULL, "%.0f", 0, NULL }, { "unmapped.0.336547 ups.powersummary.presentstatus.overload", 0, 0, "0.336547 UPS.PowerSummary.PresentStatus.Overload", NULL, "%.0f", 0, NULL }, { "unmapped.0.336559 ups.powersummary.presentstatus.overcharged", 0, 0, "0.336559 UPS.PowerSummary.PresentStatus.OverCharged", NULL, "%.0f", 0, NULL }, { "unmapped.0.336571 ups.powersummary.presentstatus.overtemperature", 0, 0, "0.336571 UPS.PowerSummary.PresentStatus.OverTemperature", NULL, "%.0f", 0, NULL }, { "unmapped.0.336583 ups.powersummary.presentstatus.shutdownrequested", 0, 0, "0.336583 UPS.PowerSummary.PresentStatus.ShutdownRequested", NULL, "%.0f", 0, NULL }, { "unmapped.0.336595 ups.powersummary.presentstatus.shutdownimminent", 0, 0, "0.336595 UPS.PowerSummary.PresentStatus.ShutdownImminent", NULL, "%.0f", 0, NULL }, { "unmapped.0.336608 ups.powersummary.presentstatus.belowremainingcapacitylimit", 0, 0, "0.336608 UPS.PowerSummary.PresentStatus.BelowRemainingCapacityLimit", NULL, "%.0f", 0, NULL }, { "unmapped.0.336620 ups.powersummary.presentstatus.remainingtimelimitexpired", 0, 0, "0.336620 UPS.PowerSummary.PresentStatus.RemainingTimeLimitExpired", NULL, "%.0f", 0, NULL }, { "unmapped.0.336632 ups.powersummary.presentstatus.charging", 0, 0, "0.336632 UPS.PowerSummary.PresentStatus.Charging", NULL, "%.0f", 0, NULL }, { "unmapped.0.336644 ups.powersummary.presentstatus.discharging", 0, 0, "0.336644 UPS.PowerSummary.PresentStatus.Discharging", NULL, "%.0f", 0, NULL }, { "unmapped.0.336656 ups.powersummary.presentstatus.conditioningflag", 0, 0, "0.336656 UPS.PowerSummary.PresentStatus.ConditioningFlag", NULL, "%.0f", 0, NULL }, { "unmapped.0.336668 ups.powersummary.presentstatus.needreplacement", 0, 0, "0.336668 UPS.PowerSummary.PresentStatus.NeedReplacement", NULL, "%.0f", 0, NULL }, { "unmapped.0.336691 ups.powersummary.presentstatus.acpresent", 0, 0, "0.336691 UPS.PowerSummary.PresentStatus.ACPresent", NULL, "%.0f", 0, NULL }, { "unmapped.0.336704 ups.powersummary.presentstatus.batterypresent", 0, 0, "0.336704 UPS.PowerSummary.PresentStatus.BatteryPresent", NULL, "%.0f", 0, NULL }, { "unmapped.0.336716 ups.powersummary.openups1.present", 0, 0, "0.336716 UPS.PowerSummary.OPENUPS1.Present", NULL, "%.0f", 0, NULL }, { "unmapped.0.336729 ups.powersummary.openups1.good", 0, 0, "0.336729 UPS.PowerSummary.OPENUPS1.Good", NULL, "%.0f", 0, NULL }, { "unmapped.0.336741 ups.powersummary.openups1.internalfailure", 0, 0, "0.336741 UPS.PowerSummary.OPENUPS1.InternalFailure", NULL, "%.0f", 0, NULL }, { "unmapped.0.336754 ups.powersummary.openups1.overload", 0, 0, "0.336754 UPS.PowerSummary.OPENUPS1.Overload", NULL, "%.0f", 0, NULL }, { "unmapped.0.336768 ups.powersummary.openups1.overcharged", 0, 0, "0.336768 UPS.PowerSummary.OPENUPS1.OverCharged", NULL, "%.0f", 0, NULL }, { "unmapped.0.336780 ups.powersummary.openups1.overtemperature", 0, 0, "0.336780 UPS.PowerSummary.OPENUPS1.OverTemperature", NULL, "%.0f", 0, NULL }, { "unmapped.0.336792 ups.powersummary.openups1.shutdownrequested", 0, 0, "0.336792 UPS.PowerSummary.OPENUPS1.ShutdownRequested", NULL, "%.0f", 0, NULL }, { "unmapped.0.336804 ups.powersummary.openups1.shutdownimminent", 0, 0, "0.336804 UPS.PowerSummary.OPENUPS1.ShutdownImminent", NULL, "%.0f", 0, NULL }, { "unmapped.0.336816 ups.powersummary.openups1.belowremainingcapacitylimit", 0, 0, "0.336816 UPS.PowerSummary.OPENUPS1.BelowRemainingCapacityLimit", NULL, "%.0f", 0, NULL }, { "unmapped.0.336828 ups.powersummary.openups1.remainingtimelimitexpired", 0, 0, "0.336828 UPS.PowerSummary.OPENUPS1.RemainingTimeLimitExpired", NULL, "%.0f", 0, NULL }, { "unmapped.0.336841 ups.powersummary.openups1.charging", 0, 0, "0.336841 UPS.PowerSummary.OPENUPS1.Charging", NULL, "%.0f", 0, NULL }, { "unmapped.0.336853 ups.powersummary.openups1.discharging", 0, 0, "0.336853 UPS.PowerSummary.OPENUPS1.Discharging", NULL, "%.0f", 0, NULL }, { "unmapped.0.336865 ups.powersummary.openups1.conditioningflag", 0, 0, "0.336865 UPS.PowerSummary.OPENUPS1.ConditioningFlag", NULL, "%.0f", 0, NULL }, { "unmapped.0.336877 ups.powersummary.openups1.needreplacement", 0, 0, "0.336877 UPS.PowerSummary.OPENUPS1.NeedReplacement", NULL, "%.0f", 0, NULL }, { "unmapped.0.336889 ups.powersummary.openups1.acpresent", 0, 0, "0.336889 UPS.PowerSummary.OPENUPS1.ACPresent", NULL, "%.0f", 0, NULL }, { "unmapped.0.336901 ups.powersummary.openups1.batterypresent", 0, 0, "0.336901 UPS.PowerSummary.OPENUPS1.BatteryPresent", NULL, "%.0f", 0, NULL }, { "unmapped.0.337503 ups.powersummary.capacitymode", 0, 0, "0.337503 UPS.PowerSummary.CapacityMode", NULL, "%.0f", 0, NULL }, { "unmapped.0.338506 ups.powersummary.designcapacity", 0, 0, "0.338506 UPS.PowerSummary.DesignCapacity", NULL, "%.0f", 0, NULL }, { "unmapped.0.339508 ups.powersummary.remainingcapacity", 0, 0, "0.339508 UPS.PowerSummary.RemainingCapacity", NULL, "%.0f", 0, NULL }, { "unmapped.0.339523 ups.powersummary.remainingcapacity", 0, 0, "0.339523 UPS.PowerSummary.RemainingCapacity", NULL, "%.0f", 0, NULL }, { "unmapped.0.340505 ups.powersummary.fullchargecapacity", 0, 0, "0.340505 UPS.PowerSummary.FullChargeCapacity", NULL, "%.0f", 0, NULL }, { "unmapped.0.341504 ups.powersummary.remainingcapacitylimit", 0, 0, "0.341504 UPS.PowerSummary.RemainingCapacityLimit", NULL, "%.0f", 0, NULL }, { "unmapped.0.342505 ups.powersummary.warningcapacitylimit", 0, 0, "0.342505 UPS.PowerSummary.WarningCapacityLimit", NULL, "%.0f", 0, NULL }, { "unmapped.0.343504 ups.powersummary.capacitygranularity1", 0, 0, "0.343504 UPS.PowerSummary.CapacityGranularity1", NULL, "%.0f", 0, NULL }, { "unmapped.0.344505 ups.powersummary.capacitygranularity2", 0, 0, "0.344505 UPS.PowerSummary.CapacityGranularity2", NULL, "%.0f", 0, NULL }, { "unmapped.0.345508 ups.powersummary.runtimetoempty", 0, 0, "0.345508 UPS.PowerSummary.RunTimeToEmpty", NULL, "%.0f", 0, NULL }, { "unmapped.0.345522 ups.powersummary.runtimetoempty", 0, 0, "0.345522 UPS.PowerSummary.RunTimeToEmpty", NULL, "%.0f", 0, NULL }, { "unmapped.0.openups10.openups19", 0, 0, "0.OPENUPS10.OPENUPS19", NULL, "%.0f", 0, NULL }, { "unmapped.0.openups11.openups19", 0, 0, "0.OPENUPS11.OPENUPS19", NULL, "%.0f", 0, NULL }, { "unmapped.0.openups12.openups19", 0, 0, "0.OPENUPS12.OPENUPS19", NULL, "%.0f", 0, NULL }, { "unmapped.0.openups13.openups19", 0, 0, "0.OPENUPS13.OPENUPS19", NULL, "%.0f", 0, NULL }, { "unmapped.0.openups14.openups19", 0, 0, "0.OPENUPS14.OPENUPS19", NULL, "%.0f", 0, NULL }, { "unmapped.0.openups15.openups19", 0, 0, "0.OPENUPS15.OPENUPS19", NULL, "%.0f", 0, NULL }, { "unmapped.0.openups16.openups19", 0, 0, "0.OPENUPS16.OPENUPS19", NULL, "%.0f", 0, NULL }, { "unmapped.0.openups17.openups19", 0, 0, "0.OPENUPS17.OPENUPS19", NULL, "%.0f", 0, NULL }, { "unmapped.0.openups18.openups19", 0, 0, "0.OPENUPS18.OPENUPS19", NULL, "%.0f", 0, NULL }, { "unmapped.0.openups3.openups19", 0, 0, "0.OPENUPS3.OPENUPS19", NULL, "%.0f", 0, NULL }, { "unmapped.0.openups4.openups19", 0, 0, "0.OPENUPS4.OPENUPS19", NULL, "%.0f", 0, NULL }, { "unmapped.0.openups5.openups19", 0, 0, "0.OPENUPS5.OPENUPS19", NULL, "%.0f", 0, NULL }, { "unmapped.0.openups6.openups19", 0, 0, "0.OPENUPS6.OPENUPS19", NULL, "%.0f", 0, NULL }, { "unmapped.0.openups7.openups19", 0, 0, "0.OPENUPS7.OPENUPS19", NULL, "%.0f", 0, NULL }, { "unmapped.0.openups8.openups19", 0, 0, "0.OPENUPS8.OPENUPS19", NULL, "%.0f", 0, NULL }, { "unmapped.0.openups9.openups19", 0, 0, "0.OPENUPS9.OPENUPS19", NULL, "%.0f", 0, NULL }, /* end of structure. */ { NULL, 0, 0, NULL, NULL, NULL, 0, NULL } }; static const char *openups_format_model(HIDDevice_t *hd) { return hd->Product; } static const char *openups_format_mfr(HIDDevice_t *hd) { return hd->Vendor ? hd->Vendor : "openUPS"; } static const char *openups_format_serial(HIDDevice_t *hd) { return hd->Serial; } /* this function allows the subdriver to "claim" a device: return 1 if * the device is supported by this subdriver, else 0. */ static int openups_claim(HIDDevice_t *hd) { int status = is_usb_device_supported(openups_usb_device_table, hd->VendorID, hd->ProductID); switch (status) { case POSSIBLY_SUPPORTED: /* by default, reject, unless the productid option is given */ if (getval("productid")) { return 1; } possibly_supported("openUPS", hd); return 0; case SUPPORTED: return 1; case NOT_SUPPORTED: default: return 0; } } subdriver_t openups_subdriver = { OPENUPS_HID_VERSION, openups_claim, openups_utab, openups_hid2nut, openups_format_model, openups_format_mfr, openups_format_serial, };
/* openups-hid.h - subdriver to monitor openUPS USB/HID devices with NUT * * Copyright (C) * 2003 - 2009 Arnaud Quette <[email protected]> * 2005 - 2006 Peter Selinger <[email protected]> * 2008 - 2009 Arjen de Korte <[email protected]> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef OPENUPS_HID_H #define OPENUPS_HID_H #include "usbhid-ups.h" extern subdriver_t openups_subdriver; #endif /* OPENUPS_HID_H */
_______________________________________________ Nut-upsdev mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/nut-upsdev
