Logo Search packages:      
Sourcecode: nut version File versions  Download package

tripplite_usb.c File Reference

Detailed Description

Driver for Tripp Lite entry-level USB models. (tested with: "OMNIVS1000").

Definition in file tripplite_usb.c.

#include "main.h"
#include "libhid.h"
#include "libusb.h"
#include <math.h>
#include <ctype.h>

Go to the source code of this file.


#define DRV_VERSION   "0.6"
#define ENDCHAR   13
#define MAX_RECV_TRIES   3
#define MAX_SEND_TRIES   3
#define MAX_VOLT   13.4
#define MIN_VOLT   11.0
#define RECV_WAIT_MSEC   100
#define SEND_WAIT_NSEC   (1000*1000*100)
#define SEND_WAIT_SEC   0
#define toprint(x)   (isalnum((unsigned)x) ? (x) : '.')
 If a character is not printable, return a dot.




void debug_message (const char *msg, int len)
 Send an unknown command to the UPS, and store response in a variable.
enum tl_model_t decode_protocol (unsigned int proto)
void decode_v (const unsigned char *value)
int find_tripplite_ups (void)
static int hex2d (const unsigned char *start, unsigned int len)
 Convert N characters from hex to decimal.
static const char * hexascdump (unsigned char *msg, size_t len)
 Dump message in both hex and ASCII.
static int instcmd (const char *cmdname, const char *extra)
 Handler for "instant commands".
static void reconnect_ups (void)
static int send_cmd (const unsigned char *msg, size_t msg_len, unsigned char *reply, size_t reply_len)
 Send a command to the UPS, and wait for a reply.
static int setvar (const char *varname, const char *val)
static int soft_shutdown (void)
void toprint_str (char *str, int len)
 Convert a string to printable characters (in-place).
void upsdrv_banner (void)
void upsdrv_cleanup (void)
void upsdrv_help (void)
void upsdrv_initinfo (void)
void upsdrv_initups (void)
 Initialize UPS and variables from ups.conf.
void upsdrv_makevartable (void)
void upsdrv_shutdown (void)
void upsdrv_updateinfo (void)
void usb_comm_fail (int res, const char *msg)
 Report a USB comm failure, and reconnect if necessary.


static int battery_voltage_nominal = 12
static HIDDevice curDevice
static HIDDevicehd = NULL
static int input_voltage_nominal = 120
static int input_voltage_scaled = 120
static unsigned int offdelay = DEFAULT_OFFDELAY
static HIDDeviceMatcher_t * regex_matcher = NULL
static HIDDeviceMatcher_t * reopen_matcher = NULL
static int switchable_load_banks = 0
static enum tl_model_t tl_model
static usb_dev_handle * udev
static float V_interval [2] = {MIN_VOLT, MAX_VOLT}

Generated by  Doxygen 1.6.0   Back to index