Filter:   InfoImg
download hidtypes.h
Language: C
LOC: 74
Project Info
nut
Server: Debian-SVN
Type: svn
...an‑SVN\n\nut\trunk\drivers\
   al175.c
   al175.h
   apc-hid.c
   apc-hid.h
   apccmib.h
   apcsmart.c
   apcsmart.h
   bcmxcp.c
   bcmxcp.h
   bcmxcp_io.h
   bcmxcp_ser.c
   bcmxcp_usb.c
   belkin-hid.c
   belkin-hid.h
   belkin.c
   belkin.h
   belkinunv.c
   belkinunv.h
   bestfcom.c
   bestfcom.h
   bestuferrups.c
   bestuferrups.h
   bestups.c
   bestups.h
   cpsups.c
   cpsups.h
   cyberpower.c
   cyberpower.h
   dstate-hal.c
   dstate-hal.h
   dstate.c
   dstate.h
   dummy-ups.c
   dummy-ups.h
   energizerups.c
   etapro.c
   etapro.h
   everups.c
   everups.h
   explore-hid.c
   explore-hid.h
   gamatronic.c
   gamatronic.h
   genericups.c
   genericups.h
   hidparser.c
   hidparser.h
   hidtypes.h
   ietfmib.h
   isbmex.c
   isbmex.h
   libhid.c
   libhid.h
   libshut.c
   libshut.h
   libusb.c
   libusb.h
   liebert.c
   liebert.h
   main-hal.c
   main-hal.h
   main.c
   main.h
   Makefile.am
   masterguard.c
   masterguard.h
   megatec.c
   megatec.h
   megatec_usb.c
   metasys.c
   metasys.h
   mge-hid.c
   mge-hid.h
   mge-shut.c
   mge-shut.h
   mge-utalk.c
   mge-utalk.h
   mgemib.h
   netvisionmib.h
   nitram.c
   nitram.h
   nut_usb.c
   nut_usb.h
   oneac.c
   oneac.h
   optiups.c
   optiups.h
   powercom.c
   powercom.h
   powerpanel.c
   powerpanel.h
   pwmib.h
   rhino.c
   safenet.c
   safenet.h
   serial.c
   serial.h
   skel.c
   snmp-ups.c
   snmp-ups.h
   solis.c
   solis.h
   tripplite-hid.c
   tripplite-hid.h
   tripplite.c
   tripplite.h
   tripplite_usb.c
   tripplitesu.c
   tripplitesu.h
   upscode2.c
   upscode2.h
   upsdrvctl.c
   usbhid-ups.c
   usbhid-ups.h
   victronups.c
   victronups.h

/*
 * types.h
 *
 * Types definitions
 *
 * Header GPL 
 * -------------------------------------------------------------------------- */

#ifndef HIDTYPES_H
#define HIDTYPES_H

#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */

#include <sys/types.h>
	
/* 
 * Constants
 * -------------------------------------------------------------------------- */
#define PATH_SIZE			10		/* Deep max for Path							*/
#define USAGE_TAB_SIZE	50		/* Size of usage stack							*/
#define MAX_REPORT		300		/* Including FEATURE, INPUT and OUTPUT	*/
#define REPORT_DSC_SIZE	6144	/* Size max of Report Descriptor				*/
#define MAX_REPORT_TS	3		/* Max time validity of a report				*/

/* 
 * Items
 * -------------------------------------------------------------------------- */
#define SIZE_0						0x00
#define SIZE_1						0x01
#define SIZE_2						0x02
#define SIZE_4						0x03
#define SIZE_MASK					0x03
                              
#define TYPE_MAIN					0x00
#define TYPE_GLOBAL				0x04
#define TYPE_LOCAL				0x08
#define TYPE_MASK					0x0C

/* Main items */
#define ITEM_COLLECTION			0xA0
#define ITEM_END_COLLECTION		0xC0
#define ITEM_FEATURE				0xB0
#define ITEM_INPUT				0x80
#define ITEM_OUTPUT				0x90

/* Global items */
#define ITEM_UPAGE				0x04
#define ITEM_LOG_MIN				0x14
#define ITEM_LOG_MAX				0x24
#define ITEM_PHY_MIN				0x34
#define ITEM_PHY_MAX				0x44
#define ITEM_UNIT_EXP				0x54
#define ITEM_UNIT					0x64
#define ITEM_REP_SIZE				0x74
#define ITEM_REP_ID				0x84
#define ITEM_REP_COUNT			0x94

/* Local items */
#define ITEM_USAGE				0x08
#define ITEM_STRING				0x78

/* Long item */
#define ITEM_LONG                               0xFC

#define ITEM_MASK					0xFC

/* Attribut Flags */
#define ATTR_DATA_CST			0x01
#define ATTR_NVOL_VOL			0x80

/* 
 * HIDNode_t struct
 *
 * Describe a HID Path point: Usage = bits 0..15, UPage = bits 16..31
 * -------------------------------------------------------------------------- */
typedef unsigned int HIDNode_t;

/* 
 * HIDPath struct
 *
 * Describe a HID Path
 * -------------------------------------------------------------------------- */
typedef struct
{
	u_char   Size;					/* HID Path size	*/
	HIDNode_t Node[PATH_SIZE];		/* HID Path		*/
} HIDPath_t;

/* 
 * HIDData struct
 *
 * Describe a HID Data with its location in report 
 * -------------------------------------------------------------------------- */
typedef struct
{
	HIDPath_t Path;		/* HID Path								*/

	u_char   ReportID;	/* Report ID								*/
	u_char   Offset;		/* Offset of data in report					*/
	u_char   Size;		/* Size of data in bit						*/
                            
	u_char   Type;		/* Type : FEATURE / INPUT / OUTPUT	*/
	u_char   Attribute;	/* Report field attribute					*/
                            
	long   Unit;			/* HID Unit								*/
	char    UnitExp;		/* Unit exponent*/
                                                                          
	long    LogMin;		/* Logical Min							*/
	long    LogMax;		/* Logical Max							*/
	long    PhyMin;		/* Physical Min							*/
	long    PhyMax;		/* Physical Max							*/
	long    have_PhyMin;	/* Physical Min defined? */
	long    have_PhyMax;	/* Physical Max defined? */
} HIDData_t;

/* 
 * HIDDesc struct
 *
 * Holds a parsed report descriptor
 * -------------------------------------------------------------------------- */
typedef struct
{
	int nitems;      /* number of items in descriptor */
	HIDData_t *item;   /* list of items */
	int replen[256]; /* list of report lengths, in byte */
} HIDDesc_t;

#ifdef __cplusplus
} /* extern "C" */
#endif /* __cplusplus */

#endif /* HIDTYPES_H */