SpacePoint Fusion plugin 1.0

hid/hidpi.h

00001  /*++
00002 
00003 Copyright (c) 1996      Microsoft Corporation
00004 
00005 Module Name:
00006 
00007         HIDPI.H
00008 
00009 Abstract:
00010 
00011    Public Interface to the HID parsing library.
00012 
00013 Environment:
00014 
00015     Kernel & user mode
00016 
00017 Revision History:
00018 
00019     09-29-95 : created by Kenneth D. Ray
00020 
00021 --*/
00022 
00023 #ifndef   __HIDPI_H__
00024 #define   __HIDPI_H__
00025 
00026 #include <pshpack4.h>
00027 
00028 // Please include "hidsdi.h" to use the user space (dll / parser)
00029 // Please include "hidpddi.h" to use the kernel space parser
00030 
00031 
00032 typedef enum _HIDP_REPORT_TYPE
00033 {
00034     HidP_Input,
00035     HidP_Output,
00036     HidP_Feature
00037 } HIDP_REPORT_TYPE;
00038 
00039 typedef struct _USAGE_AND_PAGE
00040 {
00041     USAGE Usage;
00042     USAGE UsagePage;
00043 } USAGE_AND_PAGE, *PUSAGE_AND_PAGE;
00044 
00045 typedef struct _HIDP_BUTTON_CAPS
00046 {
00047     USAGE    UsagePage;
00048     UCHAR    ReportID;
00049     BOOLEAN  IsAlias;
00050 
00051     USHORT   BitField;
00052     USHORT   LinkCollection;   // A unique internal index pointer
00053 
00054     USAGE    LinkUsage;
00055     USAGE    LinkUsagePage;
00056 
00057     BOOLEAN  IsRange;
00058     BOOLEAN  IsStringRange;
00059     BOOLEAN  IsDesignatorRange;
00060     BOOLEAN  IsAbsolute;
00061 
00062     ULONG    Reserved[10];
00063     union {
00064         struct {
00065             USAGE    UsageMin,         UsageMax;
00066             USHORT   StringMin,        StringMax;
00067             USHORT   DesignatorMin,    DesignatorMax;
00068             USHORT   DataIndexMin,     DataIndexMax;
00069         } Range;
00070         struct  {
00071             USAGE    Usage,            Reserved1;
00072             USHORT   StringIndex,      Reserved2;
00073             USHORT   DesignatorIndex,  Reserved3;
00074             USHORT   DataIndex,        Reserved4;
00075         } NotRange;
00076     };
00077 
00078 } HIDP_BUTTON_CAPS, *PHIDP_BUTTON_CAPS;
00079 
00080 
00081 typedef struct _HIDP_VALUE_CAPS
00082 {
00083     USAGE    UsagePage;
00084     UCHAR    ReportID;
00085     BOOLEAN  IsAlias;
00086 
00087     USHORT   BitField;
00088     USHORT   LinkCollection;   // A unique internal index pointer
00089 
00090     USAGE    LinkUsage;
00091     USAGE    LinkUsagePage;
00092 
00093     BOOLEAN  IsRange;
00094     BOOLEAN  IsStringRange;
00095     BOOLEAN  IsDesignatorRange;
00096     BOOLEAN  IsAbsolute;
00097 
00098     BOOLEAN  HasNull;        // Does this channel have a null report   union
00099     UCHAR    Reserved;
00100     USHORT   BitSize;        // How many bits are devoted to this value?
00101 
00102     USHORT   ReportCount;    // See Note below.  Usually set to 1.
00103     USHORT   Reserved2[5];
00104 
00105     ULONG    UnitsExp;
00106     ULONG    Units;
00107 
00108     LONG     LogicalMin,       LogicalMax;
00109     LONG     PhysicalMin,      PhysicalMax;
00110 
00111     union {
00112         struct {
00113             USAGE    UsageMin,         UsageMax;
00114             USHORT   StringMin,        StringMax;
00115             USHORT   DesignatorMin,    DesignatorMax;
00116             USHORT   DataIndexMin,     DataIndexMax;
00117         } Range;
00118 
00119         struct {
00120             USAGE    Usage,            Reserved1;
00121             USHORT   StringIndex,      Reserved2;
00122             USHORT   DesignatorIndex,  Reserved3;
00123             USHORT   DataIndex,        Reserved4;
00124         } NotRange;
00125     };
00126 } HIDP_VALUE_CAPS, *PHIDP_VALUE_CAPS;
00127 
00128 //
00129 // Notes:
00130 //
00131 // ReportCount:  When a report descriptor declares an Input, Output, or
00132 // Feature main item with fewer usage declarations than the report count, then
00133 // the last usage applies to all remaining unspecified count in that main item.
00134 // (As an example you might have data that required many fields to describe,
00135 // possibly buffered bytes.)  In this case, only one value cap structure is
00136 // allocated for these associtated fields, all with the same usage, and Report
00137 // Count reflects the number of fields involved.  Normally ReportCount is 1.
00138 //
00139 
00140 //
00141 // The link collection tree consists of an array of LINK_COLLECTION_NODES
00142 // where the index into this array is the same as the collection number.
00143 //
00144 // Given a collection A which contains a subcollection B, A is defined to be
00145 // the parent B, and B is defined to be the child.
00146 //
00147 // Given collections A, B, and C where B and C are children of A, and B was
00148 // encountered before C in the report descriptor, B is defined as a sibling of
00149 // C.  (This implies, of course, that if B is a sibling of C, then C is NOT a
00150 // sibling of B).
00151 //
00152 // B is defined as the NextSibling of C if and only if there exists NO
00153 // child collection of A, call it D, such that B is a sibling of D and D
00154 // is a sibling of C.
00155 //
00156 // E is defined to be the FirstChild of A if and only if for all children of A,
00157 // F, that are not equivalent to E, F is a sibling of E.
00158 // (This implies, of course, that the does not exist a child of A, call it G,
00159 // where E is a sibling of G).  In other words the first sibling is the last
00160 // link collection found in the list.
00161 //
00162 // With that in mind, the following describes conclusively a data structure
00163 // that provides direct traversal up, down, and accross the link collection
00164 // tree.
00165 //
00166 //
00167 typedef struct _HIDP_LINK_COLLECTION_NODE
00168 {
00169     USAGE    LinkUsage;
00170     USAGE    LinkUsagePage;
00171     USHORT   Parent;
00172     USHORT   NumberOfChildren;
00173     USHORT   NextSibling;
00174     USHORT   FirstChild;
00175     ULONG    CollectionType: 8;  // As defined in 6.2.2.6 of HID spec
00176     ULONG    IsAlias : 1; // This link node is an allias of the next link node.
00177     ULONG    Reserved: 23;
00178     PVOID    UserContext; // The user can hang his coat here.
00179 } HIDP_LINK_COLLECTION_NODE, *PHIDP_LINK_COLLECTION_NODE;
00180 //
00181 // When a link collection is described by a delimiter, alias link collection
00182 // nodes are created.  (One for each usage within the delimiter).
00183 // The parser assigns each capability description listed above only one
00184 // link collection.
00185 //
00186 // If a control is defined within a collection defined by
00187 // delimited usages, then that control is said to be within multiple link
00188 // collections, one for each usage within the open and close delimiter tokens.
00189 // Such multiple link collecions are said to be aliases.  The first N-1 such
00190 // collections, listed in the link collection node array, have their IsAlias
00191 // bit set.  The last such link collection is the link collection index used
00192 // in the capabilities described above.
00193 // Clients wishing to set a control in an aliased collection, should walk the
00194 // collection array once for each time they see the IsAlias flag set, and use
00195 // the last link collection as the index for the below accessor functions.
00196 //
00197 // NB: if IsAlias is set, then NextSibling should be one more than the current
00198 // link collection node index.
00199 //
00200 
00201 typedef PUCHAR  PHIDP_REPORT_DESCRIPTOR;
00202 typedef struct _HIDP_PREPARSED_DATA * PHIDP_PREPARSED_DATA;
00203 
00204 typedef struct _HIDP_CAPS
00205 {
00206     USAGE    Usage;
00207     USAGE    UsagePage;
00208     USHORT   InputReportByteLength;
00209     USHORT   OutputReportByteLength;
00210     USHORT   FeatureReportByteLength;
00211     USHORT   Reserved[17];
00212 
00213     USHORT   NumberLinkCollectionNodes;
00214 
00215     USHORT   NumberInputButtonCaps;
00216     USHORT   NumberInputValueCaps;
00217     USHORT   NumberInputDataIndices;
00218 
00219     USHORT   NumberOutputButtonCaps;
00220     USHORT   NumberOutputValueCaps;
00221     USHORT   NumberOutputDataIndices;
00222 
00223     USHORT   NumberFeatureButtonCaps;
00224     USHORT   NumberFeatureValueCaps;
00225     USHORT   NumberFeatureDataIndices;
00226 } HIDP_CAPS, *PHIDP_CAPS;
00227 
00228 typedef struct _HIDP_DATA
00229 {
00230     USHORT  DataIndex;
00231     USHORT  Reserved;
00232     union {
00233         ULONG   RawValue; // for values
00234         BOOLEAN On; // for buttons MUST BE TRUE for buttons.
00235     };
00236 } HIDP_DATA, *PHIDP_DATA;
00237 //
00238 // The HIDP_DATA structure is used with HidP_GetData and HidP_SetData
00239 // functions.
00240 //
00241 // The parser contiguously assigns every control (button or value) in a hid
00242 // device a unique data index from zero to NumberXXXDataIndices, exclusive.
00243 // This value is found in HidP_ButtonCaps and HIDP_VALUE_CAPS and
00244 // HIDP_BUTTON_CAPS structures.
00245 //
00246 // Most clients will find the Get/Set Buttons / Value accessor functions
00247 // sufficient to their needs, as it will allow them to access the data known
00248 // to them, while ignoring the other controls.
00249 //
00250 // More complex clients, which actually read the Button / Value Caps, and which
00251 // do a value add service to these routines (EG Direct Input), will need to
00252 // access all the data in the device without interest in the individual usage
00253 // or link collection location.  These are the clients that will find
00254 // HidP_Data useful.
00255 //
00256 
00257 NTSTATUS __stdcall
00258 HidP_GetCaps (
00259    IN      PHIDP_PREPARSED_DATA      PreparsedData,
00260    OUT     PHIDP_CAPS                Capabilities
00261    );
00262 /*++
00263 Routine Description:
00264    Returns a list of capabilities of a given hid device as described by its
00265    preparsed data.
00266 
00267 Arguments:
00268    PreparsedData    The preparsed data returned from Hidclass.
00269    Capabilities     a HIDP_CAPS structure
00270 
00271 Return Value:
00272 ·  HIDP_STATUS_SUCCESS
00273 ·  HIDP_STATUS_INVALID_PREPARSED_DATA
00274 --*/
00275 
00276 NTSTATUS __stdcall
00277 HidP_GetLinkCollectionNodes (
00278    OUT      PHIDP_LINK_COLLECTION_NODE LinkCollectionNodes,
00279    IN OUT   PULONG                     LinkCollectionNodesLength,
00280    IN       PHIDP_PREPARSED_DATA       PreparsedData
00281    );
00282 /*++
00283 Routine Description:
00284    Return a list of PHIDP_LINK_COLLECTION_NODEs used to describe the link
00285    collection tree of this hid device.  See the above description of
00286    struct _HIDP_LINK_COLLECTION_NODE.
00287 
00288 Arguments:
00289    LinkCollectionNodes - a caller allocated array into which
00290                  HidP_GetLinkCollectionNodes will store the information
00291 
00292    LinKCollectionNodesLength - the caller sets this value to the length of the
00293                  the array in terms of number of elements.
00294                  HidP_GetLinkCollectionNodes sets this value to the actual
00295                  number of elements set. The total number of node required to
00296                  describe this HID device can be found in the
00297                  NumberLinkCollectionNodes field in the HIDP_CAPS structure.
00298 
00299 --*/
00300 
00301 NTSTATUS __stdcall
00302 HidP_GetButtonCaps (
00303    IN       HIDP_REPORT_TYPE     ReportType,
00304    OUT      PHIDP_BUTTON_CAPS    ButtonCaps,
00305    IN OUT   PUSHORT              ButtonCapsLength,
00306    IN       PHIDP_PREPARSED_DATA PreparsedData
00307 );
00308 #define HidP_GetButtonCaps(_Type_, _Caps_, _Len_, _Data_) \
00309         HidP_GetSpecificButtonCaps (_Type_, 0, 0, 0, _Caps_, _Len_, _Data_)
00310 NTSTATUS __stdcall
00311 HidP_GetSpecificButtonCaps (
00312    IN       HIDP_REPORT_TYPE     ReportType,
00313    IN       USAGE                UsagePage,      // Optional (0 => ignore)
00314    IN       USHORT               LinkCollection, // Optional (0 => ignore)
00315    IN       USAGE                Usage,          // Optional (0 => ignore)
00316    OUT      PHIDP_BUTTON_CAPS    ButtonCaps,
00317    IN OUT   PUSHORT              ButtonCapsLength,
00318    IN       PHIDP_PREPARSED_DATA PreparsedData
00319    );
00320 /*++
00321 Description:
00322    HidP_GetButtonCaps returns all the buttons (binary values) that are a part
00323    of the given report type for the Hid device represented by the given
00324    preparsed data.
00325 
00326 Parameters:
00327    ReportType  One of HidP_Input, HidP_Output, or HidP_Feature.
00328 
00329    ButtonCaps A _HIDP_BUTTON_CAPS array contain information about all the
00330                binary values in the given report.  This buffer is provided by
00331                the caller.
00332 
00333    ButtonLength   Starts off as the length of the caller provided buffer, and
00334                   ends up the length of the button values.  Both are in units
00335                   array elemenst, not byte length.  The number of button caps
00336                   returned can be found in the HIDP_CAPS structure.
00337 
00338    PreparsedData  The preparsed data returned from Hidclass.
00339 
00340 
00341 Return Value
00342 HidP_GetButtonCaps returns the following error codes:
00343 · HIDP_STATUS_SUCCESS.
00344 · HIDP_STATUS_BUFFER_TOO_SMALL
00345 
00346 --*/
00347 
00348 NTSTATUS __stdcall
00349 HidP_GetValueCaps (
00350    IN       HIDP_REPORT_TYPE     ReportType,
00351    OUT      PHIDP_VALUE_CAPS     ValueCaps,
00352    IN OUT   PUSHORT              ValueCapsLength,
00353    IN       PHIDP_PREPARSED_DATA PreparsedData
00354 );
00355 #define HidP_GetValueCaps(_Type_, _Caps_, _Len_, _Data_) \
00356         HidP_GetSpecificValueCaps (_Type_, 0, 0, 0, _Caps_, _Len_, _Data_)
00357 NTSTATUS __stdcall
00358 HidP_GetSpecificValueCaps (
00359    IN       HIDP_REPORT_TYPE     ReportType,
00360    IN       USAGE                UsagePage,      // Optional (0 => ignore)
00361    IN       USHORT               LinkCollection, // Optional (0 => ignore)
00362    IN       USAGE                Usage,          // Optional (0 => ignore)
00363    OUT      PHIDP_VALUE_CAPS     ValueCaps,
00364    IN OUT   PUSHORT              ValueCapsLength,
00365    IN       PHIDP_PREPARSED_DATA PreparsedData
00366    );
00367 /*++
00368 Description:
00369    HidP_GetValueCaps returns all the values (non-binary) that are a part
00370    of the given report type for the Hid device represented by the given
00371    preparsed data.
00372 
00373 Parameters:
00374    ReportType  One of HidP_Input, HidP_Output, or HidP_Feature.
00375 
00376    ValueCaps   A _HIDP_Value_CAPS array contain information about all the
00377                binary values in the given report.  This buffer is provided by
00378                the caller.
00379 
00380    ValueLength    Starts off as the length of the caller provided buffer, and
00381                   ends up the length of the button values.  Both are in units
00382                   array elemenst, not byte length.  The number returned
00383                   can be found in the HIDP_CAPS structure.
00384 
00385    PreparsedData  The preparsed data returned from Hidclass.
00386 
00387 
00388 Return Value
00389 HidP_GetValueCaps returns the following error codes:
00390 · HIDP_STATUS_SUCCESS.
00391 · HIDP_STATUS_BUFFER_TOO_SMALL (all given entries however have been filled in)
00392 
00393 --*/
00394 
00395 NTSTATUS __stdcall
00396 HidP_SetData (
00397    IN       HIDP_REPORT_TYPE      ReportType,
00398    IN       PHIDP_DATA            DataList,
00399    IN OUT   PULONG                DataLength,
00400    IN       PHIDP_PREPARSED_DATA  PreparsedData,
00401    IN OUT   PCHAR                 Report,
00402    IN       ULONG                 ReportLength
00403    );
00404 /*++
00405 
00406 Routine Description:
00407 
00408     Please Note: For obvious reasons HidP_SetData and HidP_GetData will not
00409     access UsageValueArrays.
00410 
00411 Parameters:
00412 
00413 Return Value
00414     HidP_SetData returns the following error codes.  Upon an error the report
00415     packet is in an unknown state.
00416 
00417 · HIDP_STATUS_SUCCESS upon successful insertion of usages into the report packet.
00418 · HIDP_STATUS_INVALID_REPORT_TYPE if reportType is not valid.
00419 · HIDP_STATUS_USAGE_NOT_FOUND if there exists a byte in the usage list for
00420             which there is no corresponding control.
00421 · HIDP_STATUS_INVALID_REPORT_LENGTH the length of the report packet is not the
00422             size expected.
00423 · HIDP_STATUS_BUFFER_TOO_SMALL if there are not enough entries in a given Main
00424             Array Item to list all of the given usages.  The user needs
00425             to split his request to set usages up.
00426 --*/
00427 
00428 NTSTATUS __stdcall
00429 HidP_GetData (
00430    IN       HIDP_REPORT_TYPE      ReportType,
00431    OUT      PHIDP_DATA            DataList,
00432    IN OUT   PULONG                DataLength,
00433    IN       PHIDP_PREPARSED_DATA  PreparsedData,
00434    IN       PCHAR                 Report,
00435    IN       ULONG                 ReportLength
00436    );
00437 /*++
00438 
00439 Routine Description:
00440 
00441     Please Note: For obvious reasons HidP_SetData and HidP_GetData will not
00442     access UsageValueArrays.
00443 
00444 Parameters:
00445 
00446 Return Value
00447 
00448 --*/
00449 
00450 ULONG __stdcall
00451 HidP_MaxDataListLength (
00452    IN HIDP_REPORT_TYPE      ReportType,
00453    IN PHIDP_PREPARSED_DATA  PreparsedData
00454    );
00455 /*++
00456 Routine Description:
00457 
00458    This function returns the maximum length of HIDP_DATA elements that
00459    HidP_GetData could return for the given report type.
00460 
00461 Parameters:
00462 
00463    ReportType  One of HidP_Input or HidP_Feature.
00464 
00465    UsagePage   All of the usages in the usage array, for which HidP_GetUsage will
00466                search in the report, refer to this same usage page.
00467 
00468    PreparsedData the preparsed data recevied from the HidClass device object.
00469 
00470 Return Value:
00471 
00472    The length of the usage list array required for the HidpGetUsage
00473    function call.
00474 
00475    If UsagePage is set to zero, then MaxUsageListLength returns the number
00476    of
00477 
00478 --*/
00479 
00480 #define HidP_SetButtons(Rty, Up, Lco, ULi, ULe, Ppd, Rep, Rle) \
00481         HidP_SetUsages(Rty, Up, Lco, ULi, ULe, Ppd, Rep, Rle)
00482 
00483 NTSTATUS __stdcall
00484 HidP_SetUsages (
00485    IN       HIDP_REPORT_TYPE      ReportType,
00486    IN       USAGE                 UsagePage,
00487    IN       USHORT                LinkCollection, // Optional
00488    IN       PUSAGE                UsageList,
00489    IN OUT   PULONG                UsageLength,
00490    IN       PHIDP_PREPARSED_DATA  PreparsedData,
00491    IN OUT   PCHAR                 Report,
00492    IN       ULONG                 ReportLength
00493    );
00494 /*++
00495 
00496 Routine Description:
00497    This function sets binary values (buttons) in the report.  Given an
00498    initialized packet of correct length, it modifies the report packet so that
00499    each element in the given list of usages has been set in the report packet.
00500    For example, in an output report with 5 LED’s, each with a given usage,
00501    an application could turn on any subset of these lights by placing their
00502    usages in any order into the byte array (usageList).  HidP_SetUsage would,
00503    in turn, set the appropriate bit or add the corresponding byte into the
00504    HID Main Array Item.
00505 
00506    A properly initialized Report packet is one of the correct byte length,
00507    and all zeros.
00508 
00509 Parameters:
00510    ReportType One of HidP_Output or HidP_Feature.
00511 
00512    UsagePage  All of the usages in the usage array, which HidP_SetUsage will
00513               set in the report, refer to this same usage page.
00514               If the client wishes to set usages in a packet for multiple
00515               usage pages then that client needs to make subsequent SetUsages
00516               calls.
00517 
00518    UsageList  A byte array containing the usages that HidP_SetUsage will set in
00519               the report packet.
00520 
00521    UsageLength The length of the given byte array.
00522                The parser sets this value to the position in the usage array at
00523                where it stoped processing.  In the successful case UsageList
00524                will be unchanged.  In any error condition this parameter
00525                reflects how many of the usages in the usage list have
00526                actually been set by the parser.  This is useful for finding
00527                the usage in the list which caused the error.  However, in
00528                the event of an error condition, the report packet itself is in
00529                an unknown state.
00530 
00531    PreparsedData the preparsed data recevied from the HidClass device object.
00532 
00533    Report      The report packet.
00534 
00535    ReportLength   Length of the given report packet.
00536 
00537 
00538 Return Value
00539 HidP_SetUsage returns the following error codes.  Upon an error the report
00540 packet is in an unknown state.
00541 
00542 · HIDP_STATUS_SUCCESS upon successful insertion of usages into the report packet.
00543 · HIDP_STATUS_INVALID_REPORT_TYPE if reportType is not valid.
00544 · HIDP_STATUS_USAGE_NOT_FOUND if there exists a byte in the usage list for
00545             which there is no corresponding control.
00546 · HIDP_STATUS_INVALID_REPORT_LENGTH the length of the report packet is not the
00547             size expected.
00548 · HIDP_STATUS_BUFFER_TOO_SMALL if there are not enough entries in a given Main
00549             Array Item to list all of the given usages.  The user needs
00550             to split his request to set usages up.
00551 --*/
00552 
00553 #define HidP_UnsetButtons(Rty, Up, Lco, ULi, ULe, Ppd, Rep, Rle) \
00554         HidP_UnsetUsages(Rty, Up, Lco, ULi, ULe, Ppd, Rep, Rle)
00555 
00556 NTSTATUS __stdcall
00557 HidP_UnsetUsages (
00558    IN       HIDP_REPORT_TYPE      ReportType,
00559    IN       USAGE                 UsagePage,
00560    IN       USHORT                LinkCollection, // Optional
00561    IN       PUSAGE                UsageList,
00562    IN OUT   PULONG                UsageLength,
00563    IN       PHIDP_PREPARSED_DATA  PreparsedData,
00564    IN OUT   PCHAR                 Report,
00565    IN       ULONG                 ReportLength
00566    );
00567 /*++
00568 
00569 Routine Description:
00570    This function sets binary values (buttons) in the report.  Given an
00571    initialized packet of correct length, it modifies the report packet so that
00572    each element in the given list of usages has been set in the report packet.
00573    For example, in an output report with 5 LED’s, each with a given usage,
00574    an application could turn on any subset of these lights by placing their
00575    usages in any order into the byte array (usageList).  HidP_SetUsage would,
00576    in turn, set the appropriate bit or add the corresponding byte into the
00577    HID Main Array Item.
00578 
00579    A properly initialized Report packet is one of the correct byte length,
00580    and all zeros.
00581 
00582 Parameters:
00583    ReportType One of HidP_Output or HidP_Feature.
00584 
00585    UsagePage  All of the usages in the usage array, which HidP_SetUsage will
00586               set in the report, refer to this same usage page.
00587               If the client wishes to set usages in a packet for multiple
00588               usage pages then that client needs to make subsequent SetUsages
00589               calls.
00590 
00591    UsageList  A byte array containing the usages that HidP_SetUsage will set in
00592               the report packet.
00593 
00594    UsageLength The length of the given byte array.
00595                The parser sets this value to the position in the usage array at
00596                where it stoped processing.  In the successful case UsageList
00597                will be unchanged.  In any error condition this parameter
00598                reflects how many of the usages in the usage list have
00599                actually been set by the parser.  This is useful for finding
00600                the usage in the list which caused the error.  However, in
00601                the event of an error condition, the report packet itself is in
00602                an unknown state.
00603 
00604    PreparsedData the preparsed data recevied from the HidClass device object.
00605 
00606    Report      The report packet.
00607 
00608    ReportLength   Length of the given report packet.
00609 
00610 
00611 Return Value
00612 HidP_SetUsage returns the following error codes.  Upon an error the report
00613 packet is in an unknown state.
00614 
00615 · HIDP_STATUS_SUCCESS upon successful insertion of usages into the report packet.
00616 · HIDP_STATUS_INVALID_REPORT_TYPE if reportType is not valid.
00617 · HIDP_STATUS_USAGE_NOT_FOUND if there exists a byte in the usage list for
00618             which there is no corresponding control.
00619 · HIDP_STATUS_INVALID_REPORT_LENGTH the length of the report packet is not the
00620             size expected.
00621 · HIDP_STATUS_BUFFER_TOO_SMALL if there are not enough entries in a given Main
00622             Array Item to list all of the given usages.  The user needs
00623             to split his request to set usages up.
00624 --*/
00625 
00626 #define HidP_GetButtons(Rty, UPa, LCo, ULi, ULe, Ppd, Rep, RLe) \
00627         HidP_GetUsages(Rty, UPa, LCo, ULi, ULe, Ppd, Rep, RLe)
00628 
00629 NTSTATUS __stdcall
00630 HidP_GetUsages (
00631    IN       HIDP_REPORT_TYPE     ReportType,
00632    IN       USAGE                UsagePage,
00633    IN       USHORT               LinkCollection, // Optional
00634    OUT      USAGE *              UsageList,
00635    IN OUT   ULONG *              UsageLength,
00636    IN       PHIDP_PREPARSED_DATA PreparsedData,
00637    IN       PCHAR                Report,
00638    IN       ULONG                ReportLength
00639    );
00640 
00641 /*++
00642 
00643 Routine Description:
00644 This function returns the binary values (buttons) in a HID report.
00645 Given a report packet of correct length, it searches the report packet
00646 for each usage for the given usage page and returns them in the usage list.
00647 
00648 Parameters:
00649 
00650    ReportType One of HidP_Output or HidP_Feature.
00651 
00652    UsagePage  All of the usages in the usage array, which HidP_SetUsage will
00653               retrieve in the report, refer to this same usage page.
00654               If the client wishes to get usages in a packet for multiple
00655               usage pages then that client needs to make subsequent getUsages
00656               calls.
00657 
00658    UsageList  A byte array containing the usages that HidP_GetUsage found in
00659               the report packet.
00660 
00661    UsageLength The length of the given byte array.
00662                This value initially describes the length of the usage list,
00663                but HidP_GetUsage sets this value to the length of found usages.
00664                Use HidP_MaxUsageListLength to determine the maximum length list
00665                of usages that a given report packet may contain.
00666 
00667    PreparsedData the preparsed data recevied from the HidClass device object.
00668 
00669    Report      The report packet.
00670 
00671    ReportLength   Length of the given report packet.
00672 
00673 
00674 Return Value
00675 HidpGetUsage returns the following error codes:
00676 · HIDP_STATUS_SUCCESS.
00677 · HIDP_STATUS_INVALID_REPORT_TYPE if reportType is not valid.
00678 · HIDP_STATUS_USAGE_NOT_FOUND if no control for this device matches the given
00679                              usagePage.
00680 · HIDP_STATUS_BUFFER_TOO_SMALL if the given usageList is not long enough to
00681                           hold the usages found in the given report packet.
00682                           HidP_MaxUsageListLength should be used to prevent
00683                           this error.
00684 · HIDP_STATUS_INVALID_PREPARSED_DATA if the given preparsed data is invalid
00685 · HIDP_STATUS_INVALID_REPORT_LENGTH if the length of the report packet is not
00686                         the size expected.
00687 --*/
00688 
00689 #define HidP_GetButtonsEx(Rty, LCo, BLi, ULe, Ppd, Rep, RLe)  \
00690         HidP_GetUsagesEx(Rty, LCo, BLi, ULe, Ppd, Rep, RLe)
00691 
00692 NTSTATUS __stdcall
00693 HidP_GetUsagesEx (
00694    IN       HIDP_REPORT_TYPE     ReportType,
00695    IN       USHORT               LinkCollection, // Optional
00696    OUT      PUSAGE_AND_PAGE      ButtonList,
00697    IN OUT   ULONG *              UsageLength,
00698    IN       PHIDP_PREPARSED_DATA PreparsedData,
00699    IN       PCHAR                Report,
00700    IN       ULONG                ReportLength
00701    );
00702 
00703 /*++
00704 
00705 Routine Description:
00706 This function returns the binary values (buttons) in a HID report.
00707 Given a report packet of correct length, it searches the report packet
00708 for each usage for the given usage page and returns them in the usage list.
00709 
00710 Parameters:
00711 
00712    ReportType One of HidP_Output or HidP_Feature.
00713 
00714    ButtonList An array of USAGE_AND_PAGE structures describing all the
00715               buttons currently ``down'' in the device.
00716 
00717    UsageLength The length of the given array in terms of elements.
00718                This value initially describes the length of the usage list,
00719                but HidP_GetUsage sets this value to the length of found usages.
00720                Use HidP_MaxUsageListLength to determine the maximum length list
00721                of usages that a given report packet may contain.
00722 
00723    PreparsedData the preparsed data recevied from the HidClass device object.
00724 
00725    Report      The report packet.
00726 
00727    ReportLength   Length of the given report packet.
00728 
00729 
00730 Return Value
00731 HidpGetUsage returns the following error codes:
00732 · HIDP_STATUS_SUCCESS.
00733 · HIDP_STATUS_INVALID_REPORT_TYPE if reportType is not valid.
00734 · HIDP_STATUS_USAGE_NOT_FOUND if no button controls are found for this device.
00735 · HIDP_STATUS_BUFFER_TOO_SMALL if the given usageList is not long enough to
00736                           hold the usages found in the given report packet.
00737                           HidP_MaxUsageListLength should be used to prevent
00738                           this error.
00739 · HIDP_STATUS_INVALID_PREPARSED_DATA if the given preparsed data is invalid
00740 · HIDP_STATUS_INVALID_REPORT_LENGTH if the length of the report packet is not
00741                         the size expected.
00742 --*/
00743 
00744 #define HidP_GetButtonListLength(RTy, UPa, Ppd) \
00745         HidP_GetUsageListLength(Rty, UPa, Ppd)
00746 
00747 ULONG __stdcall
00748 HidP_MaxUsageListLength (
00749    IN HIDP_REPORT_TYPE      ReportType,
00750      IN USAGE                 UsagePage, // Optional
00751    IN PHIDP_PREPARSED_DATA  PreparsedData
00752    );
00753 /*++
00754 Routine Description:
00755 
00756    This function returns the maximum length of usages that a HidpGetUsage
00757    could return for the given HID Report and Usage Page.
00758 
00759 Parameters:
00760 
00761    ReportType  One of HidP_Input or HidP_Feature.
00762 
00763    UsagePage   All of the usages in the usage array, for which HidP_GetUsage will
00764                search in the report, refer to this same usage page.
00765 
00766    PreparsedData the preparsed data recevied from the HidClass device object.
00767 
00768 Return Value:
00769 
00770    The length of the usage list array required for the HidpGetUsage
00771    function call.
00772 
00773    If UsagePage is set to zero, then MaxUsageListLength returns the number
00774    of
00775 
00776 --*/
00777 
00778 NTSTATUS __stdcall
00779 HidP_SetUsageValue (
00780    IN       HIDP_REPORT_TYPE     ReportType,
00781    IN       USAGE                UsagePage,
00782    IN       USHORT               LinkCollection, // Optional
00783    IN       USAGE                Usage,
00784    IN       ULONG                UsageValue,
00785    IN       PHIDP_PREPARSED_DATA PreparsedData,
00786    IN OUT   PCHAR                Report,
00787    IN       ULONG                ReportLength
00788    );
00789 
00790 /*++
00791 Description:
00792    HidpSetUsageValue inserts the given value into the given HID Report Packet,
00793    in the field corresponding to the given usage page and usage.
00794    HidP_SetUsageValue casts this value to the appropriate bit length.  If there
00795    are two channel in the report packet with the same usage and UsagePage, then
00796    they can be destinguished with the optional LinkCollection Field.
00797 
00798 Parameters:
00799 
00800    ReportType  One of HidP_Output or HidP_Feature.
00801 
00802    UsagePage   The usage page to which the given usage refers.
00803 
00804    LinkCollection  (Optional)  If there are more than one channel with the
00805                given usage and usage page, then the client may used this field
00806                to distinguish them.  A LinkValue of zero is ingnored.  The
00807                first channel that matches the given usage page, usage page, and
00808                Link number is the one affected.
00809 
00810    Usage       The usage whose value HidP_SetUsageValue will set.
00811 
00812    UsageValue  The value.  This value must be within the logical range or
00813                null value specified by the Report Descriptor.
00814 
00815    PreparsedData The data retreived from the HID device
00816 
00817    Report      The report packet.
00818 
00819    ReportLength   Length of the given report packet.
00820 
00821 
00822 Return Value:
00823    HidpSetUsageValue returns the following error codes:
00824 
00825 · HIDP_STATUS_SUCCESS.
00826 · HIDP_STATUS_INVALID_REPORT_TYPE if reportType is not valid.
00827 · HIDP_STATUS_USAGE_NOT_FOUND if the given usage does not correspond to a
00828                              control on the device, or if it refers to a button
00829                              style control.
00830 · HIDP_STATUS_INVALID_REPORT_LENGTH if the length of the report packet is not
00831          the size expected given the HIDP_CHANNELS structure.
00832 --*/
00833 
00834 
00835 
00836 NTSTATUS __stdcall
00837 HidP_SetScaledUsageValue (
00838    IN       HIDP_REPORT_TYPE     ReportType,
00839    IN       USAGE                UsagePage,
00840    IN       USHORT               LinkCollection, // Optional
00841    IN       USAGE                Usage,
00842    IN       LONG                 UsageValue,
00843    IN       PHIDP_PREPARSED_DATA PreparsedData,
00844    IN OUT   PCHAR                Report,
00845    IN       ULONG                ReportLength
00846    );
00847 
00848 /*++
00849 Description:
00850    HidpSetUsageValue inserts the given value into the given HID Report Packet,
00851    in the field corresponding to the given usage page and usage.
00852    HidP_SetUsageValue casts this value to the appropriate bit length.  If there
00853    are two channel in the report packet with the same usage and UsagePage, then
00854    they can be destinguished with the optional LinkCollection Field.
00855    ScaledUsageValue converts from the signed physical value given as UsageValue
00856    to the logical value placed in the report.
00857 
00858 Parameters:
00859 
00860    ReportType  One of HidP_Output or HidP_Feature.
00861 
00862    UsagePage   The usage page to which the given usage refers.
00863 
00864    LinkCollection  (Optional)  If there are more than one channel with the
00865                given usage and usage page, then the client may used this field
00866                to distinguish them.  A LinkValue of zero is ingnored.  The
00867                first channel that matches the given usage page, usage page, and
00868                Link number is the one affected.
00869 
00870    Usage       The usage whose value HidP_SetUsageValue will set.
00871 
00872    UsageValue  The value.  This value must be within the logical range or
00873                null value specified by the Report Descriptor.
00874 
00875    PreparsedData The data retreived from the HID device
00876 
00877    Report      The report packet.
00878 
00879    ReportLength   Length of the given report packet.
00880 
00881 
00882 Return Value:
00883    HidpSetUsageValue returns the following error codes:
00884 
00885 · HIDP_STATUS_SUCCESS.
00886 · HIDP_STATUS_INVALID_REPORT_TYPE if reportType is not valid.
00887 · HIDP_STATUS_USAGE_NOT_FOUND if the given usage does not correspond to a
00888                              control on the device, or if it refers to a button
00889                              style control.
00890 · HIDP_STATUS_INVALID_REPORT_LENGTH if the length of the report packet is not
00891          the size expected given the HIDP_CHANNELS structure.
00892 · HIDP_STATUS_VALUE_OUT_OF_RANGE The physical value given was out of range,
00893                     but this field does not accept null values.  In this
00894                     case the field remains unchanged.
00895 · HIDP_STATUS_BAD_LOG_PHY_VALUES
00896 · HIDP_STATUS_NULL  A null value was written into the field, because the
00897                     physical value given was out of range and this field
00898                     supports null values.  The value written was outside the
00899                     range of LogicalMin and LogicalMax and is specifically
00900                     set to the most negative value.
00901 --*/
00902 
00903 NTSTATUS __stdcall
00904 HidP_SetUsageValueArray (
00905     IN    HIDP_REPORT_TYPE     ReportType,
00906     IN    USAGE                UsagePage,
00907     IN    USHORT               LinkCollection, // Optional
00908     IN    USAGE                Usage,
00909     IN    PCHAR                UsageValue,
00910     IN    USHORT               UsageValueByteLength,
00911     IN    PHIDP_PREPARSED_DATA PreparsedData,
00912     OUT   PCHAR                Report,
00913     IN    ULONG                ReportLength
00914     );
00915 
00916 /*++
00917 Routine Descripton:
00918     The last usage in the list of usages describing a main item must be
00919     repeated if there are less usages than there are report counts declared
00920     for the given main item.  In this case a single value cap is allocated
00921     for that usage and the report count of that value cap is set to refect the
00922     numer of fields to which that usage refers.
00923 
00924     HidP_SetUsageValueArray sets the raw bits for that usage which spans
00925     more than one field in a report.
00926 
00927 Parameters:
00928 
00929    ReportType  One of HidP_Output or HidP_Feature.
00930 
00931    UsagePage   The usage page to which the given usage refers.
00932 
00933    LinkCollection  (Optional)  If there are more than one channel with the
00934                given usage and usage page, then the client may used this field
00935                to distinguish them.  A LinkValue of zero is ingnored.  The
00936                first channel that matches the given usage page, usage page, and
00937                Link number is the one affected.
00938 
00939    Usage       The usage whose value HidP_SetUsageValueArray will set.
00940 
00941    UsageValue  A pointer to an array characters where the value will be placed.
00942                The number of BITS required is found by multiplying the
00943                BitSize and ReportCount fields of the given Value Cap for this
00944                control.  The least significant bit of this control found in the
00945                given report will be placed in the least significan bit location
00946                of the array given (little-endian format), regardless of whether
00947                or not the field is byte alligned or if the BitSize is a multiple
00948                of sizeof (CHAR).
00949 
00950    UsageValueByteLength
00951                the length of the given UsageValue buffer.
00952 
00953    PreparsedData The data retreived from the HID device
00954 
00955    Report      The report packet.
00956 
00957    ReportLength   Length of the given report packet.
00958 
00959 
00960 Return Value:
00961     Same as others
00962 
00963     HIDP_STATUS_NOT_VALUE_ARRAY this is not a value array control use instead
00964     HidP_SetUsageValue.
00965 
00966 --*/
00967 
00968 
00969 NTSTATUS __stdcall
00970 HidP_GetUsageValue (
00971    IN    HIDP_REPORT_TYPE     ReportType,
00972    IN    USAGE                UsagePage,
00973    IN    USHORT               LinkCollection, // Optional
00974    IN    USAGE                Usage,
00975    OUT   PULONG               UsageValue,
00976    IN    PHIDP_PREPARSED_DATA PreparsedData,
00977    IN    PCHAR                Report,
00978    IN    ULONG                ReportLength
00979    );
00980 
00981 /*
00982 Description
00983    HidP_GetUsageValue retrieves the given value from the given HID Report
00984    Packet, for the specified usage.
00985 
00986 Parameters:
00987 
00988    ReportType  One of HidP_Output or HidP_Feature.
00989 
00990    UsagePage   The usage page to which the given usage refers.
00991 
00992    LinkCollection  (Optional)  If there are more than one channel with the
00993                given usage and usage page, then the client may used this field
00994                to distinguish them.  A LinkValue of zero is ingnored.  The
00995                first channel that matches the given usage page, usage page, and
00996                Link number is the one affected.
00997 
00998    Usage       The usage whose value HidP_GetUsageValue will retreive.
00999 
01000    UsageValue  The value.  This value must be within the logical range or
01001                null value specified by the Report Descriptor.
01002 
01003    PreparsedData The data retreived from the HID device
01004 
01005    Report      The report packet.
01006 
01007    ReportLength   Length of the given report packet.
01008 
01009 
01010 Return Value:
01011    HidpSetUsageValue returns the following error codes:
01012 
01013 · HIDP_STATUS_SUCCESS.
01014 · HIDP_STATUS_INVALID_REPORT_TYPE if reportType is not valid.
01015 · HIDP_STATUS_USAGE_NOT_FOUND if the given usage does not correspond to a
01016                              control on the device, or if it refers to a button
01017                              style control.
01018 · HIDP_STATUS_INVALID_REPORT_LENGTH if the length of the report packet is
01019                       not the size expected given the HIDP_CHANNELS structure.
01020 --*/
01021 
01022 
01023 NTSTATUS __stdcall
01024 HidP_GetScaledUsageValue (
01025    IN    HIDP_REPORT_TYPE     ReportType,
01026    IN    USAGE                UsagePage,
01027    IN    USHORT               LinkCollection, // Optional
01028    IN    USAGE                Usage,
01029    OUT   PLONG                UsageValue,
01030    IN    PHIDP_PREPARSED_DATA PreparsedData,
01031    IN    PCHAR                Report,
01032    IN    ULONG                ReportLength
01033    );
01034 
01035 /*++
01036 Description
01037    HidP_GetScaledUsageValue retrieves the given value from the given HID Report
01038    Packet, for the specified usage.  This function assums a linear
01039    extrapolation between the physical Max/min and the Logical Max/min.
01040    (Where logical is the values reported by the device, and physical is the
01041     value returned by this function.)
01042    If the data field requested is of fewer bytes than 32, then
01043    HidP_GetScaledUsageValue will sign extend those bits to 32.
01044 
01045 
01046 Parameters:
01047 
01048    ReportType  One of HidP_Output or HidP_Feature.
01049 
01050    UsagePage   The usage page to which the given usage refers.
01051 
01052    LinkCollection  (Optional)  If there are more than one channel with the
01053                given usage and usage page, then the client may used this field
01054                to distinguish them.  A LinkValue of zero is ingnored.  The
01055                first channel that matches the given usage page, usage page, and
01056                Link number is the one affected.
01057 
01058    Usage       The usage whose value HidP_GetUsageValue will retreive.
01059 
01060    UsageValue  The value.  This value must be within the logical range or
01061                null value specified by the Report Descriptor.
01062 
01063    PreparsedData The data retreived from the HID device
01064 
01065    Report      The report packet.
01066 
01067    ReportLength   Length of the given report packet.
01068 
01069 
01070 Return Value:
01071    HidpSetUsageValue returns the following error codes:
01072 
01073 · HIDP_STATUS_SUCCESS.
01074 · HIDP_STATUS_INVALID_REPORT_TYPE if reportType is not valid.
01075 · HIDP_STATUS_USAGE_NOT_FOUND if the given usage does not correspond to a
01076                              control on the device, or if it refers to a button
01077                              style control.
01078 · HIDP_STATUS_INVALID_REPORT_LENGTH if the length of the report packet is
01079                       not the size expected given the HIDP_CHANNELS structure.
01080 · HIDP_STATUS_VALUE_OUT_OF_RANGE
01081 · HIDP_STATUS_BAD_LOG_PHY_VALUES
01082 · HIDP_STATUS_NULL
01083 --*/
01084 
01085 NTSTATUS __stdcall
01086 HidP_GetUsageValueArray (
01087     IN    HIDP_REPORT_TYPE     ReportType,
01088     IN    USAGE                UsagePage,
01089     IN    USHORT               LinkCollection, // Optional
01090     IN    USAGE                Usage,
01091     OUT   PCHAR                UsageValue,
01092     IN    USHORT               UsageValueByteLength,
01093     IN    PHIDP_PREPARSED_DATA PreparsedData,
01094     IN    PCHAR                Report,
01095     IN    ULONG                ReportLength
01096     );
01097 
01098 /*++
01099 Routine Descripton:
01100     The last usage in the list of usages describing a main item must be
01101     repeated if there are less usages than there are report counts declared
01102     for the given main item.  In this case a single value cap is allocated
01103     for that usage and the report count of that value cap is set to refect the
01104     numer of fields to which that usage refers.
01105 
01106     HidP_GetUsageValueArray retrieved the raw bits for that usage which spans
01107     more than one field in a report.
01108 
01109 Parameters:
01110 
01111    ReportType  One of HidP_Output or HidP_Feature.
01112 
01113    UsagePage   The usage page to which the given usage refers.
01114 
01115    LinkCollection  (Optional)  If there are more than one channel with the
01116                given usage and usage page, then the client may used this field
01117                to distinguish them.  A LinkValue of zero is ingnored.  The
01118                first channel that matches the given usage page, usage page, and
01119                Link number is the one affected.
01120 
01121    Usage       The usage whose value HidP_GetUsageValueArray will retreive.
01122 
01123    UsageValue  A pointer to an array characters where the value will be placed.
01124                The number of BITS required is found by multiplying the
01125                BitSize and ReportCount fields of the given Value Cap for this
01126                control.  The least significant bit of this control found in the
01127                given report will be placed in the least significan bit location
01128                of the array given (little-endian format), regardless of whether
01129                or not the field is byte alligned or if the BitSize is a multiple
01130                of sizeof (CHAR).
01131 
01132    UsageValueByteLength
01133                the length of the given UsageValue buffer.
01134 
01135    PreparsedData The data retreived from the HID device
01136 
01137    Report      The report packet.
01138 
01139    ReportLength   Length of the given report packet.
01140 
01141 
01142 
01143 --*/
01144 
01145 NTSTATUS __stdcall
01146 HidP_UsageListDifference (
01147     IN    PUSAGE   PreviousUsageList,
01148     IN    PUSAGE   CurrentUsageList,
01149     OUT   PUSAGE   BreakUsageList,
01150     OUT   PUSAGE   MakeUsageList,
01151     IN    ULONG    UsageListLength
01152     );
01153 /*++
01154 Routine Description:
01155    Given two list of usages (as might be returned from HidP_GetUsages),
01156    determine the difference; that is, return a list of usages that are in
01157    the current list but not in the previous list (NewUsageList), as well as a
01158    list of usages that are in the previous list but not the current list
01159    (OldUsageList).
01160 
01161 Parameters:
01162 
01163    PreviousUsageList The list of usages before.
01164    CurrentUsageList  The list of usages now.
01165    BreakUsageList      Previous - Current.
01166    MakeUsageList       Current - Previous.
01167 
01168    All usage lists have a maximum of UsageListLength bytes.
01169    Any zero found in the list indicates early termination of the list.
01170    Any characters found after the first zero will be ignored.
01171 
01172 --*/
01173 
01174 //
01175 // Produce Make or Break Codes
01176 //
01177 typedef enum _HIDP_KEYBOARD_DIRECTION {
01178     HidP_Keyboard_Break,
01179     HidP_Keyboard_Make
01180 } HIDP_KEYBOARD_DIRECTION;
01181 
01182 //
01183 // A bitmap of the current shift state of the keyboard when using the
01184 // below keyboard usages to i8042 translation function.
01185 //
01186 typedef struct _HIDP_KEYBOARD_MODIFIER_STATE {
01187    union {
01188       struct {
01189          ULONG LeftControl: 1;
01190          ULONG LeftShift: 1;
01191          ULONG LeftAlt: 1;
01192          ULONG LeftGUI: 1;
01193          ULONG RightControl: 1;
01194          ULONG RightShift: 1;
01195          ULONG RightAlt: 1;
01196          ULONG RigthGUI: 1;
01197          ULONG CapsLock: 1;
01198          ULONG ScollLock: 1;
01199          ULONG NumLock: 1;
01200          ULONG Reserved: 21;
01201       };
01202       ULONG ul;
01203    };
01204 
01205 } HIDP_KEYBOARD_MODIFIER_STATE, * PHIDP_KEYBOARD_MODIFIER_STATE;
01206 
01207 //
01208 // A call back function to give the i8042 scan codes to the caller of
01209 // the below translation function.
01210 //
01211 typedef BOOLEAN (* PHIDP_INSERT_SCANCODES) (
01212                   IN PVOID Context,  // Some caller supplied context.
01213                   IN PCHAR NewScanCodes, // A list of i8042 scan codes.
01214                   IN ULONG Length // the length of the scan codes.
01215                   );
01216 
01217 NTSTATUS __stdcall
01218 HidP_TranslateUsagesToI8042ScanCodes (
01219    IN     PUSAGE                        ChangedUsageList,
01220    IN     ULONG                         UsageListLength,
01221    IN     HIDP_KEYBOARD_DIRECTION       KeyAction,
01222    IN OUT PHIDP_KEYBOARD_MODIFIER_STATE ModifierState,
01223    IN     PHIDP_INSERT_SCANCODES        InsertCodesProcedure,
01224    IN     PVOID                         InsertCodesContext
01225    );
01226 /*++
01227 Routine Description:
01228 Parameters:
01229 --*/
01230 
01231 
01232 
01233 //
01234 // Define NT Status codes with Facility Code of FACILITY_HID_ERROR_CODE
01235 //
01236 
01237 // BUGBUG defined in ntstatus.h
01238 #ifndef FACILITY_HID_ERROR_CODE
01239 #define FACILITY_HID_ERROR_CODE 0x11
01240 #endif
01241 
01242 #define HIDP_ERROR_CODES(SEV, CODE) \
01243         ((NTSTATUS) (((SEV) << 28) | (FACILITY_HID_ERROR_CODE << 16) | (CODE)))
01244 
01245 #define HIDP_STATUS_SUCCESS                  (HIDP_ERROR_CODES(0x0,0))
01246 #define HIDP_STATUS_NULL                     (HIDP_ERROR_CODES(0x8,1))
01247 #define HIDP_STATUS_INVALID_PREPARSED_DATA   (HIDP_ERROR_CODES(0xC,1))
01248 #define HIDP_STATUS_INVALID_REPORT_TYPE      (HIDP_ERROR_CODES(0xC,2))
01249 #define HIDP_STATUS_INVALID_REPORT_LENGTH    (HIDP_ERROR_CODES(0xC,3))
01250 #define HIDP_STATUS_USAGE_NOT_FOUND          (HIDP_ERROR_CODES(0xC,4))
01251 #define HIDP_STATUS_VALUE_OUT_OF_RANGE       (HIDP_ERROR_CODES(0xC,5))
01252 #define HIDP_STATUS_BAD_LOG_PHY_VALUES       (HIDP_ERROR_CODES(0xC,6))
01253 #define HIDP_STATUS_BUFFER_TOO_SMALL         (HIDP_ERROR_CODES(0xC,7))
01254 #define HIDP_STATUS_INTERNAL_ERROR           (HIDP_ERROR_CODES(0xC,8))
01255 #define HIDP_STATUS_I8242_TRANS_UNKNOWN      (HIDP_ERROR_CODES(0xC,9))
01256 #define HIDP_STATUS_INCOMPATIBLE_REPORT_ID   (HIDP_ERROR_CODES(0xC,0xA))
01257 #define HIDP_STATUS_NOT_VALUE_ARRAY          (HIDP_ERROR_CODES(0xC,0xB))
01258 #define HIDP_STATUS_IS_VALUE_ARRAY           (HIDP_ERROR_CODES(0xC,0xC))
01259 #define HIDP_STATUS_DATA_INDEX_NOT_FOUND     (HIDP_ERROR_CODES(0xC,0xD))
01260 #define HIDP_STATUS_DATA_INDEX_OUT_OF_RANGE  (HIDP_ERROR_CODES(0xC,0xE))
01261 #define HIDP_STATUS_BUTTON_NOT_PRESSED       (HIDP_ERROR_CODES(0xC,0xF))
01262 #define HIDP_STATUS_REPORT_DOES_NOT_EXIST    (HIDP_ERROR_CODES(0xC,0x10))
01263 #define HIDP_STATUS_NOT_IMPLEMENTED          (HIDP_ERROR_CODES(0xC,0x20))
01264 
01265 #include <poppack.h>
01266 
01267 #endif