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

libhid.c File Reference

Detailed Description

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

Copyright (C) 2003 - 2007 Arnaud Quette <arnaud.quette@free.fr> && <arnaud.quette@mgeups.com> John Stamp <kinsayder@hotmail.com> Peter Selinger <selinger@users.sourceforge.net> Arjen de Korte <adkorte-guest@alioth.debian.org>
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 "libhid.h"
#include "hidparser.h"
#include "common.h"
#include "libusb.h"

Go to the source code of this file.


#define NB_HID_UNITS   10


static double exponent (double a, int b)
static int file_report_buffer (reportbuf_t *rbuf, unsigned char *buf, int buflen)
void free_report_buffer (reportbuf_t *rbuf)
static int get_item_buffered (reportbuf_t *rbuf, hid_dev_handle_t udev, HIDData_t *pData, long *Value, int age)
static long get_unit_expo (const long UnitType)
static const char * hid_lookup_path (const HIDNode_t usage, usage_tables_t *utab)
static long hid_lookup_usage (const char *name, usage_tables_t *utab)
const char * HIDDataType (const HIDData_t *hiddata)
void HIDDumpTree (hid_dev_handle_t udev, usage_tables_t *utab)
char * HIDGetDataItem (const HIDData_t *hiddata, usage_tables_t *utab)
int HIDGetDataValue (hid_dev_handle_t udev, HIDData_t *hiddata, double *Value, int age)
int HIDGetEvents (hid_dev_handle_t udev, HIDData_t **event, int eventsize)
char * HIDGetIndexString (hid_dev_handle_t udev, const int Index, char *buf, size_t buflen)
HIDData_t * HIDGetItemData (const char *hidpath, usage_tables_t *utab)
char * HIDGetItemString (hid_dev_handle_t udev, const char *hidpath, char *buf, size_t buflen, usage_tables_t *utab)
int HIDGetItemValue (hid_dev_handle_t udev, const char *hidpath, double *Value, usage_tables_t *utab)
int HIDSetDataValue (hid_dev_handle_t udev, HIDData_t *hiddata, double Value)
bool_t HIDSetItemValue (hid_dev_handle_t udev, const char *hidpath, double Value, usage_tables_t *utab)
static double logical_to_physical (HIDData_t *Data, long logical)
reportbuf_t * new_report_buffer (HIDDesc_t *pDesc)
static int path_to_string (char *string, size_t size, const HIDPath_t *path, usage_tables_t *utab)
static long physical_to_logical (HIDData_t *Data, double physical)
static int refresh_report_buffer (reportbuf_t *rbuf, hid_dev_handle_t udev, HIDData_t *pData, int age)
static int set_item_buffered (reportbuf_t *rbuf, hid_dev_handle_t udev, HIDData_t *pData, long Value)
static int string_to_path (const char *string, HIDPath_t *path, usage_tables_t *utab)


communication_subdriver_t * comm_driver = &usb_subdriver
usage_lkp_t hid_usage_lkp []
static const long HIDUnits [NB_HID_UNITS][2]

Generated by  Doxygen 1.6.0   Back to index