hid

package
v0.0.0-...-f2919f2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 6, 2022 License: MIT Imports: 3 Imported by: 0

README

go.w32/hid

Provides generated and tested syscall functions and structs for Win32 API hid.dll

Documentation

Overview

generated and tested syscall functions and structs for Win32 API `hid.dll`

Index

Constants

View Source
const (
	// HIDP_REPORT_TYPE
	HidP_Input = iota
	HidP_Output
	HidP_Feature
)
View Source
const (
	HIDP_STATUS_SUCCESS                = 0x00110000 // The routine successfully returned the capability data.
	HIDP_STATUS_INVALID_PREPARSED_DATA = 0xc0110001 // The preparsed data is not valid.
	HIDP_STATUS_USAGE_NOT_FOUND        = 0xc0110004 // The usage does not exist in any report of the specified report type.
	HIDP_STATUS_BUFFER_TOO_SMALL       = 0xc0110007
)

HidP return codes

Variables

This section is empty.

Functions

func HidD_FreePreparsedData

func HidD_FreePreparsedData(preparsedData uintptr) (err error)

func HidD_GetHidGuid

func HidD_GetHidGuid(HidGuid *windows.GUID) (err error)

func HidD_GetIndexedString

func HidD_GetIndexedString(hidDeviceObject windows.Handle, stringIndex uint64, buffer *uint16, bufferLength int) (err error)

func HidD_GetManufacturerString

func HidD_GetManufacturerString(hidDeviceObject windows.Handle, buffer *uint16, bufferLength int) (err error)

func HidD_GetPreparsedData

func HidD_GetPreparsedData(hidDeviceObject windows.Handle, preparsedData *uintptr) (err error)

func HidD_GetProductString

func HidD_GetProductString(hidDeviceObject windows.Handle, buffer *uint16, bufferLength int) (err error)

func HidD_GetSerialNumberString

func HidD_GetSerialNumberString(hidDeviceObject windows.Handle, buffer *uint16, bufferLength int) (err error)

func HidD_SetFeature

func HidD_SetFeature(hidDeviceObject windows.Handle, buffer []byte) (err error)

func HidP_GetButtonCaps

func HidP_GetButtonCaps(reportType uint, buttonCaps *HIDP_BUTTON_CAPS, buttonCapsLength *uint16, preparsedData uintptr) (status windows.NTStatus, err error)

func HidP_GetCaps

func HidP_GetCaps(preparsedData uintptr, capabilities *HIDP_CAPS) (status windows.NTStatus, err error)

func HidP_GetLinkCollectionNodes

func HidP_GetLinkCollectionNodes(linkCollectionNodes *HIDP_LINK_COLLECTION_NODE, linkCollectionNodesLength *uint16, preparsedData uintptr) (status windows.NTStatus, err error)

func HidP_GetValueCaps

func HidP_GetValueCaps(reportType uint, valueCaps *HIDP_VALUE_CAPS, valueCapsLength *uint16, preparsedData uintptr) (status windows.NTStatus, err error)

Types

type HIDP_BUTTON_CAPS

type HIDP_BUTTON_CAPS struct {
	UsagePage         uint16 // Specifies the usage page for a usage or usage range
	ReportID          uint8  // Specifies the report ID of the HID report that contains the usage or usage range
	IsAlias           bool   // Indicates, if TRUE, that a button has a set of aliased usages. Otherwise, if IsAlias is FALSE, the button has only one usage
	BitField          uint16 // Contains the data fields (one or two bytes) associated with an input, output, or feature main item
	LinkCollection    uint16 // Specifies the index of the link collection in a top-level collection's link collection array that contains the usage or usage range. If LinkCollection is zero, the usage or usage range is contained in the top-level collection
	LinkUsage         uint16 // Specifies the usage of the link collection that contains the usage or usage range. If LinkCollection is zero, LinkUsage specifies the usage of the top-level collection
	LinkUsagePage     uint16 // Specifies the usage page of the link collection that contains the usage or usage range. If LinkCollection is zero, LinkUsagePage specifies the usage page of the top-level collection
	IsRange           bool   // Specifies, if TRUE, that the structure describes a usage range. Otherwise, if IsRange is FALSE, the structure describes a single usage
	IsStringRange     bool   // Specifies, if TRUE, that the usage or usage range has a set of string descriptors. Otherwise, if IsStringRange is FALSE, the usage or usage range has zero or one string descriptor
	IsDesignatorRange bool   // Specifies, if TRUE, that the usage or usage range has a set of designators. Otherwise, if IsDesignatorRange is FALSE, the usage or usage range has zero or one designator
	IsAbsolute        bool   // Specifies, if TRUE, that the button usage or usage range provides absolute data. Otherwise, if IsAbsolute is FALSE, the button data is the change in state from the previous value
	ReportCount       uint16 // HID defined report count. Available starting with API version 2.0. Call the HIDP_GetVersion function to get the API version
	Reserved2         uint16
	Reserved          [9]uint32
	UnionValues       [8]uint16 // 0-1: usage range, 2-3: string range, 4-5: designator range, 6-7: data index range

}

https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/hidpi/ns-hidpi-_hidp_button_caps

type HIDP_CAPS

type HIDP_CAPS struct {
	Usage                     uint16
	UsagePage                 uint16
	InputReportByteLength     uint16
	OutputReportByteLength    uint16
	FeatureReportByteLength   uint16
	Reserved                  [17]uint16
	NumberLinkCollectionNodes uint16
	NumberInputButtonCaps     uint16
	NumberInputValueCaps      uint16
	NumberInputDataIndices    uint16
	NumberOutputButtonCaps    uint16
	NumberOutputValueCaps     uint16
	NumberOutputDataIndices   uint16
	NumberFeatureButtonCaps   uint16
	NumberFeatureValueCaps    uint16
	NumberFeatureDataIndices  uint16
}

https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/hidpi/ns-hidpi-_hidp_caps

type HIDP_LINK_COLLECTION_NODE struct {
	LinkUsage        uint16
	LinkUsagePage    uint16
	Parent           uint16
	NumberOfChildren uint16
	NextSibling      uint16
	FirstChild       uint16
	CollectionType   uint32  // : 8   // NOTE: : 8 etc are bitfields, how many bits are used.
	IsAlias          uint32  // : 1
	Reserved         uint32  // : 23
	UserContext      uintptr // pvoid
}

https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/hidpi/ns-hidpi-_hidp_link_collection_node

type HIDP_VALUE_CAPS

type HIDP_VALUE_CAPS struct {
	UsagePage         uint16 // Specifies the usage page for a usage or usage range.
	ReportID          uint8  // Specifies the report ID of the HID report that contains the usage or usage range
	IsAlias           bool   // Indicates, if TRUE, that a button has a set of aliased usages. Otherwise, if IsAlias is FALSE, the button has only one usage
	BitField          uint16 // Contains the data fields (one or two bytes) associated with an input, output, or feature main item
	LinkCollection    uint16 // Specifies the index of the link collection in a top-level collection's link collection array that contains the usage or usage range. If LinkCollection is zero, the usage or usage range is contained in the top-level collection
	LinkUsage         uint16 // Specifies the usage of the link collection that contains the usage or usage range. If LinkCollection is zero, LinkUsage specifies the usage of the top-level collection
	LinkUsagePage     uint16 // Specifies the usage page of the link collection that contains the usage or usage range. If LinkCollection is zero, LinkUsagePage specifies the usage page of the top-level collection
	IsRange           bool   // Specifies, if TRUE, that the structure describes a usage range. Otherwise, if IsRange is FALSE, the structure describes a single usage
	IsStringRange     bool   // Specifies, if TRUE, that the usage or usage range has a set of string descriptors. Otherwise, if IsStringRange is FALSE, the usage or usage range has zero or one string descriptor
	IsDesignatorRange bool   // Specifies, if TRUE, that the usage or usage range has a set of designators. Otherwise, if IsDesignatorRange is FALSE, the usage or usage range has zero or one designator
	IsAbsolute        bool   // Specifies, if TRUE, that the button usage or usage range provides absolute data. Otherwise, if IsAbsolute is FALSE, the button data is the change in state from the previous value
	HasNull           bool   // Specifies, if TRUE, that the usage supports a NULL value, which indicates that the data is not valid and should be ignored. Otherwise, if HasNull is FALSE, the usage does not have a NULL value
	Reserved          uint8
	BitSize           uint16 // Specifies the size, in bits, of a usage's data field in a report. If ReportCount is greater than one, each usage has a separate data field of this size
	ReportCount       uint16 // Specifies the number of usages that this structure describes
	Reserved2         [5]uint16
	UnitsExp          uint32    // Specifies the usage's exponent, as described by the USB HID standard
	Units             uint32    // Specifies the usage's units, as described by the USB HID Standard
	LogicalMin        int32     // Range of values for each field in this report start from LogicalMin...
	LogicalMax        int32     // ...and end in LogicalMax. [LogicalMin, LogicalMax]
	PhysicalMin       int32     // Specifies a usage's signed lower bound after scaling is applied to the logical minimum value
	PhysicalMax       int32     // Specifies a usage's signed upper bound after scaling is applied to the logical maximum value
	UnionValues       [8]uint16 // 0-1: usage range, 2-3: string range, 4-5: designator range, 6-7: data index range

}

https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/hidpi/ns-hidpi-_hidp_value_caps

type UsagePage

type UsagePage struct {
	Usage, Page uint16
}

Basically 32 bit value split into two 16 bit parts

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL