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

tripplite_usb.c File Reference

Detailed Description

Driver for Tripp Lite non-PDC/HID USB models.

Definition in file tripplite_usb.c.

#include "main.h"
#include "libusb.h"
#include <math.h>
#include <ctype.h>
#include <usb.h>
#include "usb-common.h"

Go to the source code of this file.


#define DRIVER_NAME   "Tripp Lite OMNIVS / SMARTPRO driver"
#define DRIVER_VERSION   "0.20"
#define ENDCHAR   13
#define MAX_RECV_TRIES   10
#define MAX_SEND_TRIES   10
#define MAX_VOLT   13.4
#define MIN_VOLT   11.0
#define RECV_WAIT_MSEC   1000
#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.
#define TRIPPLITE_VENDORID   0x09ae


enum  tl_model_t {


static int control_outlet (int outlet_id, int state)
 Turn an outlet on or off.
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)
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 int reconnect_ups (void)
 Try to reconnect once.
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)
static int subdriver_match_func (USBDevice_t *hd, void *privdata)
void toprint_str (char *str, int len)
 Convert a string to printable characters (in-place).
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
usb_communication_subdriver_t * 
comm_driver = &usb_subdriver
static USBDevice_t curDevice
static USBDevice_thd = NULL
static int input_voltage_nominal = 120
static int input_voltage_scaled = 120
static unsigned int offdelay = DEFAULT_OFFDELAY
static USBDeviceMatcher_tregex_matcher = NULL
static USBDeviceMatcher_treopen_matcher = NULL
static USBDeviceMatcher_t subdriver_matcher
static int switchable_load_banks = 0
static enum tl_model_t tl_model
static usb_device_id_t tripplite_usb_device_table []
static usb_dev_handle * udev
static int unit_id = -1
upsdrv_info_t upsdrv_info
static double V_interval [2] = {MIN_VOLT, MAX_VOLT}

Generated by  Doxygen 1.6.0   Back to index