~ubuntu-branches/ubuntu/saucy/nut/saucy

« back to all changes in this revision

Viewing changes to drivers/hidtypes.h

  • Committer: Bazaar Package Importer
  • Author(s): Arnaud Quette
  • Date: 2005-10-07 23:35:55 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20051007233555-yreo209eww1bo665
Tags: 2.0.2-2
* debian/nut-cgi.postinst: load confmodule
* debian/nut-hidups/*: remove this unneeded directory
* debian/control:
  - Update build dependency from libsnmp5-dev to libsnmp9-dev (closes:
  #326410)
  - Changes nut-usb wrong dependency from libusb-dev to libusb-0.1-4 (closes:
  #320315)
  - add debconf (>= 0.5.00) and adduser to nut/nut-cgi Depends
* debian/copyright: update the FSF address and the Authors
* debian/po/vi.po: add the Vietnamese translation for debconf, from Clytie
  Siddall ((closes: #316327)

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
#endif /* __cplusplus */
15
15
 
16
16
#include <sys/types.h>
17
 
 
18
 
/* 
19
 
 * Types
20
 
 * -------------------------------------------------------------------------- */
21
 
#if !AIX
22
 
typedef unsigned char  uchar;
23
 
#endif
24
 
 
25
 
#if HPUX || __APPLE__
26
 
typedef unsigned long  ulong;
27
 
#endif
28
 
 
29
 
typedef short          wchar;
30
 
 
 
17
        
31
18
/* 
32
19
 * Constants
33
20
 * -------------------------------------------------------------------------- */
34
 
#define PATH_SIZE               10  /* Deep max for Path                      */
35
 
#define USAGE_TAB_SIZE          50  /* Size of usage stack                    */
36
 
#define MAX_REPORT             300  /* Including FEATURE, INPUT and OUTPUT    */
37
 
#define REPORT_DSC_SIZE       6144  /* Size max of Report Descriptor          */
 
21
#define PATH_SIZE                       10              /* Deep max for Path                                                    */
 
22
#define USAGE_TAB_SIZE  50              /* Size of usage stack                                                  */
 
23
#define MAX_REPORT              300             /* Including FEATURE, INPUT and OUTPUT  */
 
24
#define REPORT_DSC_SIZE 6144    /* Size max of Report Descriptor                                */
 
25
#define MAX_REPORT_TS   3               /* Max time validity of a report                                */
38
26
 
39
27
/* 
40
28
 * Items
41
29
 * -------------------------------------------------------------------------- */
42
 
#define SIZE_0                0x00
43
 
#define SIZE_1                0x01
44
 
#define SIZE_2                0x02
45
 
#define SIZE_4                0x03
46
 
#define SIZE_MASK             0x03
 
30
#define SIZE_0                                          0x00
 
31
#define SIZE_1                                          0x01
 
32
#define SIZE_2                                          0x02
 
33
#define SIZE_4                                          0x03
 
34
#define SIZE_MASK                                       0x03
47
35
                              
48
 
#define TYPE_MAIN             0x00
49
 
#define TYPE_GLOBAL           0x04
50
 
#define TYPE_LOCAL            0x08
51
 
#define TYPE_MASK             0xC0
 
36
#define TYPE_MAIN                                       0x00
 
37
#define TYPE_GLOBAL                             0x04
 
38
#define TYPE_LOCAL                              0x08
 
39
#define TYPE_MASK                                       0xC0
52
40
 
53
41
/* Main items */
54
 
#define ITEM_COLLECTION       0xA0
55
 
#define ITEM_END_COLLECTION   0xC0
56
 
#define ITEM_FEATURE          0xB0
57
 
#define ITEM_INPUT            0x80
58
 
#define ITEM_OUTPUT           0x90
 
42
#define ITEM_COLLECTION                 0xA0
 
43
#define ITEM_END_COLLECTION             0xC0
 
44
#define ITEM_FEATURE                            0xB0
 
45
#define ITEM_INPUT                              0x80
 
46
#define ITEM_OUTPUT                             0x90
59
47
 
60
48
/* Global items */
61
 
#define ITEM_UPAGE            0x04
62
 
#define ITEM_LOG_MIN          0x14
63
 
#define ITEM_LOG_MAX          0x24
64
 
#define ITEM_PHY_MIN          0x34
65
 
#define ITEM_PHY_MAX          0x44
66
 
#define ITEM_UNIT_EXP         0x54
67
 
#define ITEM_UNIT             0x64
68
 
#define ITEM_REP_SIZE         0x74
69
 
#define ITEM_REP_ID           0x84
70
 
#define ITEM_REP_COUNT        0x94
 
49
#define ITEM_UPAGE                              0x04
 
50
#define ITEM_LOG_MIN                            0x14
 
51
#define ITEM_LOG_MAX                            0x24
 
52
#define ITEM_PHY_MIN                            0x34
 
53
#define ITEM_PHY_MAX                            0x44
 
54
#define ITEM_UNIT_EXP                           0x54
 
55
#define ITEM_UNIT                                       0x64
 
56
#define ITEM_REP_SIZE                           0x74
 
57
#define ITEM_REP_ID                             0x84
 
58
#define ITEM_REP_COUNT                  0x94
71
59
 
72
60
/* Local items */
73
 
#define ITEM_USAGE            0x08
74
 
#define ITEM_STRING           0x78
 
61
#define ITEM_USAGE                              0x08
 
62
#define ITEM_STRING                             0x78
75
63
 
76
 
#define ITEM_MASK             0xFC
 
64
#define ITEM_MASK                                       0xFC
77
65
 
78
66
/* Attribut Flags */
79
 
#define ATTR_DATA_CST         0x01
80
 
#define ATTR_NVOL_VOL         0x80
 
67
#define ATTR_DATA_CST                   0x01
 
68
#define ATTR_NVOL_VOL                   0x80
81
69
 
82
70
/* 
83
71
 * HIDNode struct
86
74
 * -------------------------------------------------------------------------- */
87
75
typedef struct
88
76
{
89
 
  ushort UPage;
90
 
  ushort Usage;
 
77
        u_short UPage;
 
78
        u_short Usage;
91
79
} HIDNode;
92
80
 
93
81
/* 
97
85
 * -------------------------------------------------------------------------- */
98
86
typedef struct
99
87
{
100
 
  uchar   Size;             /* HID Path size                                  */
101
 
  HIDNode Node[PATH_SIZE];  /* HID Path                                       */
 
88
        u_char   Size;                                  /* HID Path size        */
 
89
        HIDNode Node[PATH_SIZE];                /* HID Path             */
102
90
} HIDPath;
103
91
 
104
92
/* 
108
96
 * -------------------------------------------------------------------------- */
109
97
typedef struct
110
98
{
111
 
  long    Value;            /* HID Object Value                               */
112
 
  HIDPath Path;             /* HID Path                                       */
 
99
        long    Value;          /* HID Object Value                                             */
 
100
        HIDPath Path;           /* HID Path                                                             */
113
101
 
114
 
  uchar   ReportID;         /* Report ID                                      */
115
 
  uchar   Offset;           /* Offset of data in report                       */
116
 
  uchar   Size;             /* Size of data in bit                            */
117
 
                            
118
 
  uchar   Type;             /* Type : FEATURE / INPUT / OUTPUT                */
119
 
  uchar   Attribute;        /* Report field attribute                         */
120
 
                            
121
 
  long   Unit;             /* HID Unit                                       */
122
 
  char    UnitExp;          /* Unit exponent                                  */
 
102
        u_char   ReportID;      /* Report ID                                                            */
 
103
        u_char   Offset;                /* Offset of data in report                                     */
 
104
        u_char   Size;          /* Size of data in bit                                          */
 
105
                            
 
106
        u_char   Type;          /* Type : FEATURE / INPUT / OUTPUT      */
 
107
        u_char   Attribute;     /* Report field attribute                                       */
 
108
                            
 
109
        long   Unit;                    /* HID Unit                                                             */
 
110
        char    UnitExp;                /* Unit exponent*/
123
111
                                                                          
124
 
  long    LogMin;           /* Logical Min                                    */
125
 
  long    LogMax;           /* Logical Max                                    */
126
 
  long    PhyMin;           /* Physical Min                                   */
127
 
  long    PhyMax;           /* Physical Max                                   */
 
112
        long    LogMin;         /* Logical Min                                                  */
 
113
        long    LogMax;         /* Logical Max                                                  */
 
114
        long    PhyMin;         /* Physical Min                                                 */
 
115
        long    PhyMax;         /* Physical Max                                                 */
128
116
} HIDData;
129
117
 
130
118
/*
132
120
 * -------------------------------------------------------------------------- */
133
121
typedef struct
134
122
{
135
 
  uchar   ReportDesc[REPORT_DSC_SIZE];  /* Store Report Descriptor            */
136
 
  ushort  ReportDescSize;               /* Size of Report Descriptor          */
137
 
  ushort  Pos;                          /* Store current pos in descriptor    */
138
 
  uchar   Item;                         /* Store current Item                 */
139
 
  long    Value;                        /* Store current Value                */
140
 
 
141
 
  HIDData Data;                         /* Store current environment          */
142
 
 
143
 
  uchar   OffsetTab[MAX_REPORT][3];     /* Store ID, Type & offset of report  */
144
 
  uchar   ReportCount;                  /* Store Report Count                 */
145
 
  uchar   Count;                        /* Store local report count           */
146
 
 
147
 
  ushort  UPage;                        /* Global UPage                       */
148
 
  HIDNode UsageTab[USAGE_TAB_SIZE];     /* Usage stack                        */
149
 
  uchar   UsageSize;                    /* Design number of usage used        */
150
 
 
151
 
  uchar   nObject;                      /* Count Objects in Report Descriptor */
152
 
  uchar   nReport;                      /* Count Reports in Report Descriptor */
 
123
        u_char   ReportDesc[REPORT_DSC_SIZE];   /* Store Report Descriptor                                      */
 
124
        u_short  ReportDescSize;                                        /* Size of Report Descriptor                                    */
 
125
        u_short  Pos;                                                   /* Store current pos in descriptor                              */
 
126
        u_char   Item;                                                  /* Store current Item                                                   */
 
127
        long    Value;                                                  /* Store current Value                                          */
 
128
 
 
129
        HIDData Data;                                                   /* Store current environment                                    */
 
130
 
 
131
        u_char   OffsetTab[MAX_REPORT][4];              /* Store ID, Type, offset & timestamp of report */
 
132
        u_char   ReportCount;                                   /* Store Report Count                                           */
 
133
        u_char   Count;                                                 /* Store local report count                                     */
 
134
 
 
135
        u_short  UPage;                                                 /* Global UPage                                                         */
 
136
        HIDNode UsageTab[USAGE_TAB_SIZE];       /* Usage stack                                                          */
 
137
        u_char   UsageSize;                                             /* Design number of usage used                          */
 
138
 
 
139
        u_char   nObject;                                               /* Count Objects in Report Descriptor                   */
 
140
        u_char   nReport;                                               /* Count Reports in Report Descriptor                   */
153
141
} HIDParser;
154
142
 
155
143
#ifdef __cplusplus