Share via


HidP_SetScaledUsageValue (Compact 2013)

3/26/2014

This function converts a signed and scaled physical number to a HID usage's logical value and sets the usage value in a specified HID report.

Syntax

NTSTATUS HidP_SetScaledUsageValue(
  HIDP_REPORT_TYPE ReportType,
  USAGE UsagePage, 
  USHORT LinkCollection,
  USAGE Usage,
  LONG UsageValue,
  PHIDP_PREPARSED_DATA PreparsedData,
  PCHAR Report,
  ULONG ReportLength
);

Parameters

  • ReportType
    [in] HIDP_REPORT_TYPE enumerator value that indicates the type of HID report located at Report.
  • UsagePage
    [in] Usage page of a usage.
  • LinkCollection
    [in] Optional. Link collection that contains the usage. If LinkCollection is nonzero, the function only sets the usage, if one exists, in this link collection. If LinkCollection is zero, the function sets the first usage it finds in the top-level collection associated with PreparsedData.
  • Usage
    [in] Usage.
  • UsageValue
    [in] Signed and scaled physical number, which the function converts to the logical value of Usage.
  • PreparsedData
    [in] Pointer to a top-level's preparsed data.
  • Report
    [in, out] On input, an initialized HID report. On output, a pointer to a HID report.
  • ReportLength
    [in] Size, in bytes, of the HID report located at Report, which must be equal to the report length for the specified report type that the HidP_GetCaps function returns in a collection's HIDP_CAPS structure.

Return Value

The following table shows the possible return values.

Value

Description

HIDP_STATUS_SUCCESS

The function has successfully set the usage value.

HIDP_STATUS_BAD_LOG_PHY_VALUES

Usage has an illegal logical or physical range that prevents scaling.

HIDP_STATUS_VALUE_OUT_OF_RANGE

Specified physical value is out-of-range and the usage does not have null value.

HIDP_STATUS_INVALID_REPORT_LENGTH

Report length is not valid.

HIDP_STATUS_INVALID_REPORT_TYPE

Specified report type is not valid.

HIDP_STATUS_INCOMPATIBLE_REPORT_ID

Report contains a collection with buttons in the specified usage page, but there are no such usages in the report.

HIDP_STATUS_INVALID_PREPARSED_DATA

Preparsed data is not valid.

HIDP_STATUS_USAGE_NOT_FOUND

Report contains a requested usage that is not in any report supported by the top-level collection.

HIDP_STATUS_NULL

Specified physical value is out-of-range, the usage has a NULL value, and the function has set the NULL value.

Remarks

The terms button and usage are used synonymously.

HidP_SetScaledUsageValue sets the sign bit.

If the function returns HIDP_STATUS_INCOMPATIBLE_REPORT_ID, the specified report does contain the usage. However, a HID client driver can set the usage in a zero-initialized report.

Requirements

Header

hidpi.h

Library

Hidparse_lib.lib

See Also

Reference

HID Parser Functions
HIDP_CAPS
HidP_GetCaps
HIDP_REPORT_TYPE
HidP_SetUsageValue
HidP_SetUsageValueArray