Logo Search packages:      
Sourcecode: nut version File versions

libhid.c File Reference

Detailed Description

HID Library - User API (Generic HID Access using MGE HIDParser).

Copyright (C) 2003 Arnaud Quette <arnaud.quette@free.fr> && <arnaud.quette@mgeups.com> Philippe Marzouk <philm@users.sourceforge.net> (dump_hex())
This program is sponsored by MGE UPS SYSTEMS - opensource.mgeups.com

The logic of this file is ripped from mge-shut driver (also from Arnaud Quette), which is a "HID over serial link" UPS driver for Network UPS Tools <http://www.networkupstools.org/>

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., 675 Mass Ave, Cambridge, MA 02139, USA.


Definition in file libhid.c.

#include <stdio.h>
#include <string.h>
#include "hidparser.h"
#include "hidtypes.h"
#include "libhid.h"
#include "hid-usb.h"
#include <errno.h>

Go to the source code of this file.


struct  usage_lkp_t


#define MAX_REPORT_SIZE   0x1800
#define MAX_STRING   64
#define NB_HID_UNITS   10
#define NIBBLE(_i)   (((_i) < 10) ? '0' + (_i) : 'A' + (_i) - 10)
#define TRACE   upsdebugx


void dump_hex (const char *msg, const unsigned char *buf, int len)
float expo (int a, int b)
long get_unit_expo (long UnitType)
const char * hid_lookup_path (int usage)
int hid_lookup_usage (char *name)
void HIDCloseDevice (HIDDevice *dev)
void HIDDumpTree (HIDDevice *hd)
HIDItemHIDGetItem (const char *ItemPath)
char * HIDGetItemString (const char *path)
float HIDGetItemValue (const char *path, float *Value)
HIDItemHIDGetNextEvent (HIDDevice *dev)
HIDDeviceHIDOpenDevice (const char *port, MatchFlags *flg, int mode)
bool HIDSetItemValue (const char *path, float value)
void logical_to_physical (HIDData *Data)
ushort lookup_path (const char *HIDpath, HIDData *data)
void physical_to_logical (HIDData *Data)
void upsdebugx (int level, const char *fmt,...)


HIDDevice curDevice
int errno
static HIDData hData
const long HIDUnits [NB_HID_UNITS][2]
static HIDParser hParser
static int prev_report
static time_t prev_report_ts = 0
unsigned char raw_buf [100]
int replen
unsigned char ** report_buf
unsigned char ReportDesc [4096]
static usage_lkp_t usage_lkp []

Generated by  Doxygen 1.6.0   Back to index