Announcement

Collapse
No announcement yet.

Where to find HIDSDI.H

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • José Roca
    replied
    It can be a LONG or a DWORD.

    Leave a comment:


  • Peter Lameijn
    replied
    Thanks,

    So it's mainly a normal variable with limited range of only 0...2. The strange thing is that you cannot see the type of variable. (Is it a byte, or word,...)
    I looked at some VB code, and there an Integer is used...

    Leave a comment:


  • Aleksandr Dobrev
    replied
    The first parameter of HidP_SetData is ReportType, a variable of the type HIDP_REPORT_TYPE.
    But that is an ENUM type. What gets passed?
    ReportType will contain one of possible value of HidP_Input, HidP_Output or HidP_Feature
    A HIDP_REPORT_TYPE struct preloaded with 0, 1, and 2, or something else?
    Yes. Thats how ENUM work. If you have a lot of constants for assign, then C can assign value to them automaticaly increasing by 1 each next constant. C allow asign start value too, but it isn't shown in that structure, so members of HIDP_REPORT_TYPE is equal to
    Code:
      HidP_Input   = 0
      HidP_Output  = 1
      HidP_Feature = 2

    Leave a comment:


  • Peter Lameijn
    replied
    Thanks Michael,

    I'll try it. C still puzzles me from time to time. Another puzzle:
    Code:
    typedef enum _HIDP_REPORT_TYPE {
      HidP_Input,
      HidP_Output,
      HidP_Feature
    } HIDP_REPORT_TYPE;
    
    NTSTATUS HidP_SetData(
      HIDP_REPORT_TYPE ReportType,
      PHIDP_DATA DataList,
      OUT PULONG DataLength,
      PHIDP_PREPARSED_DATA PreparsedData,
      PCHAR Report,
      ULONG ReportLength
    );
    The first parameter of HidP_SetData is ReportType, a variable of the type HIDP_REPORT_TYPE. But that is an ENUM type. What gets passed?
    A HIDP_REPORT_TYPE struct preloaded with 0, 1, and 2, or something else?

    Leave a comment:


  • Michael Mattias
    replied
    Code:
    define HIDP_ERROR_CODES(SEV, CODE) \
            ((NTSTATUS) (((SEV) << 28) | (FACILITY_HID_ERROR_CODE << 16) | (CODE)))
    
    #define HIDP_STATUS_SUCCESS                  (HIDP_ERROR_CODES(0x0,0))
    Those values are constants. Using 'C' it's compile time. But AFAIK you can't do it this in a simple %EQUATE_NAME = something.

    I think you could create some MACROS to do this 'as is' at compile time, or a function to do it at runtime, but I'd probably write a little program to calculate everything and create my own #INCLUDE file. (Do once, use many).

    Something like..

    Code:
    SUB FOO ()
       OPEN "myinclude.INC" FOR OUTPUT AS #1 
    
       PRINT #1, "' MYINCLUDE.INC  " & DATE$ & " " & TIME$
       PRINT #1, 
    
       FOR Z = 1 TO DATACOUNT STEP 3 
         EName$ = READ$(Z)
         Sev$   = READ$(Z+1)
         Code$  = READ$(Z+2)
    
         sevval = VAL("&H" & Sev$)
         codeval= vAL (&h" & Code$)
    
         Equate$ =  MakeHidpValueString (sevVal, codeval)
    
         PRINT #1, "%" & EName$ & "  =  " & Equate$
       NEXT
       PRINT #1, 
       PRINT #1, "' ** END OF INCLUDE FILE **"
       CLOSE 1 
    
    DATA HIDP_STATUS_SUCCESS  , 0,0
    DATA HIDP_STATUS_NULL, 8,1
    ...
    DATA HIDP_STATUS_REPORT_DOES_NOT_EXIST , C, 10
    ...
    END SUB
    
    FUNCTION MakeHidpValueString (sevval AS LONG, codeval AS LONG) AS STRING
      LOCAL Shiftsev AS LONG, Facility AS LONG, SHiftFacility AS LONG, R AS LONG 
    
      ShiftSev      = SevVal
      SHIFT LEFT      Shiftsev, 28 
      ShiftFacility = %FACILITY_HID_ERROR_CODE   ' this must be defined somewhere
      SHIFT LEFT      ShiftFacility, 16
    
      R = Shiftsev OR ShiftFacility OR Codeval
    
      FUNCTION =  "&h" & HEX$(R,4) & "&"
    END FUNCTION
    Something like that, anyway.

    (I am not a 'C' programmer).

    MCM

    Leave a comment:


  • Peter Lameijn
    replied
    I ran into another question while translating:
    Does following code translate into constants, or are they run-time values?
    Code:
    #define HIDP_ERROR_CODES(SEV, CODE) \
            ((NTSTATUS) (((SEV) << 28) | (FACILITY_HID_ERROR_CODE << 16) | (CODE)))
    
    #define HIDP_STATUS_SUCCESS                  (HIDP_ERROR_CODES(0x0,0))
    #define HIDP_STATUS_NULL                     (HIDP_ERROR_CODES(0x8,1))
    #define HIDP_STATUS_INVALID_PREPARSED_DATA   (HIDP_ERROR_CODES(0xC,1))
    #define HIDP_STATUS_INVALID_REPORT_TYPE      (HIDP_ERROR_CODES(0xC,2))
    #define HIDP_STATUS_INVALID_REPORT_LENGTH    (HIDP_ERROR_CODES(0xC,3))
    #define HIDP_STATUS_USAGE_NOT_FOUND          (HIDP_ERROR_CODES(0xC,4))
    #define HIDP_STATUS_VALUE_OUT_OF_RANGE       (HIDP_ERROR_CODES(0xC,5))
    #define HIDP_STATUS_BAD_LOG_PHY_VALUES       (HIDP_ERROR_CODES(0xC,6))
    #define HIDP_STATUS_BUFFER_TOO_SMALL         (HIDP_ERROR_CODES(0xC,7))
    #define HIDP_STATUS_INTERNAL_ERROR           (HIDP_ERROR_CODES(0xC,8))
    #define HIDP_STATUS_I8042_TRANS_UNKNOWN      (HIDP_ERROR_CODES(0xC,9))
    #define HIDP_STATUS_INCOMPATIBLE_REPORT_ID   (HIDP_ERROR_CODES(0xC,0xA))
    #define HIDP_STATUS_NOT_VALUE_ARRAY          (HIDP_ERROR_CODES(0xC,0xB))
    #define HIDP_STATUS_IS_VALUE_ARRAY           (HIDP_ERROR_CODES(0xC,0xC))
    #define HIDP_STATUS_DATA_INDEX_NOT_FOUND     (HIDP_ERROR_CODES(0xC,0xD))
    #define HIDP_STATUS_DATA_INDEX_OUT_OF_RANGE  (HIDP_ERROR_CODES(0xC,0xE))
    #define HIDP_STATUS_BUTTON_NOT_PRESSED       (HIDP_ERROR_CODES(0xC,0xF))
    #define HIDP_STATUS_REPORT_DOES_NOT_EXIST    (HIDP_ERROR_CODES(0xC,0x10))
    #define HIDP_STATUS_NOT_IMPLEMENTED          (HIDP_ERROR_CODES(0xC,0x20))

    Leave a comment:


  • Peter Lameijn
    started a topic Where to find HIDSDI.H

    Where to find HIDSDI.H

    Hello,

    I want to translate the HID headerfile to PB from HIDSDI.H, which is included in the Windows DDK. But I don't want to install/uninstall the complete DDK just to extract one file. Does anybody know where I can find this header file?

    [Edit]
    Found it! A lot of headerfiles can be found here:
    http://www.koders.com/c/fid0B709CF1C...129A950C1.aspx
    [/Edit]
    Last edited by Peter Lameijn; 8 Nov 2007, 05:20 PM.
Working...
X