> ## Documentation Index
> Fetch the complete documentation index at: https://docs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# GameInputDeviceInfo（已弃用）

> 描述有关输入设备的所有信息（已在 v4 中移除）。

> [!WARNING]
>
> **已弃用。** 此结构已在 GameInput v4 中移除，当前 API 中不再提供。请改用 [IGameInputDevice](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/igameinputdevice.md) 上的各个 getter 方法。请参阅“备注”部分中的对应关系表。

描述有关输入设备的所有信息。

## 语法

```cpp theme={null}
struct GameInputDeviceInfo
{
    uint16_t               vendorId;
    uint16_t               productId;
    uint16_t               revisionNumber;
    GameInputUsage         usage;
    GameInputVersion       hardwareVersion;
    GameInputVersion       firmwareVersion;
    APP_LOCAL_DEVICE_ID    deviceId;
    APP_LOCAL_DEVICE_ID    deviceRootId;
    GameInputDeviceFamily  deviceFamily;
    GameInputKind          supportedInput;
    GameInputRumbleMotors  supportedRumbleMotors;
    GameInputSystemButtons supportedSystemButtons;
    GUID                   containerId;
    const char*            displayName;
    const char*            pnpPath;

    const GameInputKeyboardInfo* keyboardInfo;
    const GameInputMouseInfo*    mouseInfo;
    const GameInputSensorsInfo*  sensorsInfo;

    const GameInputControllerInfo*  controllerInfo;
    const GameInputArcadeStickInfo* arcadeStickInfo;
    const GameInputFlightStickInfo* flightStickInfo;
    const GameInputGamepadInfo*     gamepadInfo;
    const GameInputRacingWheelInfo* racingWheelInfo;

    uint32_t                               forceFeedbackMotorCount;
    const GameInputForceFeedbackMotorInfo* forceFeedbackMotorInfo;

    uint32_t                            inputReportCount;
    const GameInputRawDeviceReportInfo* inputReportInfo;

    uint32_t                            outputReportCount;
    const GameInputRawDeviceReportInfo* outputReportInfo;
};
```

### 成员

*vendorId*\

类型：uint16\_t

标识输入设备的供应商。

*productId*\

类型：uint16\_t

将输入设备标识为一个产品。

*revisionNumber*\

类型：uint16\_t

设备的硬件修订号（如果有）。

*usage*\

类型：[GameInputUsage](https://docs.xbox.com/zh-CN/reference/input/gameinput/structs/gameinputusage.md)

描述所用输入的两部分索引。

*hardwareVersion*\

类型：[GameInputVersion](https://docs.xbox.com/zh-CN/reference/input/gameinput/structs/gameinputversion.md)

设备的硬件版本（如果有）。

*firmwareVersion*\

类型：[GameInputVersion](https://docs.xbox.com/zh-CN/reference/input/gameinput/structs/gameinputversion.md)

设备的固件版本（如果有）。

*deviceId*\

类型：APP\_LOCAL\_DEVICE\_ID

输入设备的设备 ID。

*deviceRootId*\

类型：APP\_LOCAL\_DEVICE\_ID

输入设备的根 ID。

*deviceFamily*\

类型：[GameInputDeviceFamily](https://docs.xbox.com/zh-CN/reference/input/gameinput/enums/gameinputdevicefamily.md)

指定输入设备所属的输入设备族。

*supportedInput*\

类型：[GameInputKind](https://docs.xbox.com/zh-CN/reference/input/gameinput/enums/gameinputkind.md)

描述设备支持的一种或多种输入类型。

*supportedRumbleMotors*\

类型：[GameInputRumbleMotors](https://docs.xbox.com/zh-CN/reference/input/gameinput/enums/gameinputrumblemotors.md)

描述设备上可访问的震动马达（如果有）。

*supportedSystemButtons*\

类型：[GameInputSystemButtons](https://docs.xbox.com/zh-CN/reference/input/gameinput/enums/gameinputsystembuttons.md)

描述用于控制系统（通常在游戏外部）的可用按钮。

*containerId*\

类型：GUID

输入设备的容器 ID。

*displayName*\

类型：const char\*

描述该设备的友好名称。

*pnpPath*\

类型：const char\*

描述该设备的即插即用能力。可通过此路径经由其他 API 引用底层设备。

*keyboardInfo*\

类型：[GameInputKeyboardInfo](https://docs.xbox.com/zh-CN/reference/input/gameinput/structs/gameinputkeyboardinfo.md) const \*

有关键盘输入设备的信息。

*mouseInfo*\

类型：[GameInputMouseInfo](https://docs.xbox.com/zh-CN/reference/input/gameinput/structs/gameinputmouseinfo.md) const \*

有关鼠标输入设备的信息。

*sensorsInfo*\

类型：[GameInputSensorsInfo](https://docs.xbox.com/zh-CN/reference/input/gameinput/structs/gameinputsensorsinfo.md) const \*

有关设备传感器的信息。

*controllerInfo*\

类型：[GameInputControllerInfo](https://docs.xbox.com/zh-CN/reference/input/gameinput/deprecated/structs/gameinputcontrollerinfo.md) const \*

有关通用控制器输入设备的信息。控制器代表设备上未映射的原始轴、按钮和开关。

*arcadeStickInfo*\

类型：[GameInputArcadeStickInfo](https://docs.xbox.com/zh-CN/reference/input/gameinput/structs/gameinputarcadestickinfo.md) const \*

有关街机摇杆输入设备的信息。

*flightStickInfo*\

类型：[GameInputFlightStickInfo](https://docs.xbox.com/zh-CN/reference/input/gameinput/structs/gameinputflightstickinfo.md) const \*

有关飞行摇杆输入设备的信息。

*gamepadInfo*\

类型：[GameInputGamepadInfo](https://docs.xbox.com/zh-CN/reference/input/gameinput/structs/gameinputgamepadinfo.md) const \*

有关游戏手柄输入设备的信息。

*racingWheelInfo*\

类型：[GameInputRacingWheelInfo](https://docs.xbox.com/zh-CN/reference/input/gameinput/structs/gameinputracingwheelinfo.md) const \*

有关赛车方向盘输入设备的信息。

*forceFeedbackMotorCount*\

类型：uint32\_t

输入设备上的力反馈马达数量。

*forceFeedbackMotorInfo*\

类型：[GameInputForceFeedbackMotorInfo](https://docs.xbox.com/zh-CN/reference/input/gameinput/structs/gameinputforcefeedbackmotorinfo.md) const \*

设备上所有力反馈马达的信息。

*inputReportCount*\

类型：uint32\_t

设备输入报告的数量。

*inputReportInfo*\

类型：[GameInputRawDeviceReportInfo](https://docs.xbox.com/zh-CN/reference/input/gameinput/structs/gameinputrawdevicereportinfo.md) const \*

输入报告信息对象。

*outputReportCount*\

类型：uint32\_t

设备输出报告的数量。

*outputReportInfo*\

类型：[GameInputRawDeviceReportInfo](https://docs.xbox.com/zh-CN/reference/input/gameinput/structs/gameinputrawdevicereportinfo.md) const \*

输出报告。

## 备注

此结构中的所有字符串成员均使用 UTF-8 编码。

`deviceId` 是应用本地 ID：一个能够唯一标识设备的 256 位哈希值。只要设备连接到相同的 USB 端口，该 ID 对于给定设备始终保持不变，即使应用重新运行或系统重启也是如此。应用本地 ID 的哈希值由应用生成，部分使用了调用应用和系统的特定信息。

`deviceRootId` 是另一个应用本地 ID，用于标识组合设备的根设备节点。这允许应用推断各个设备之间的关系。例如，一些游戏键盘通过将自己作为具有多个键盘节点的组合设备来暴露，从而绕过了 8 个同时按键的旧版 USB 限制。这些节点会被合并到“系统”键盘中，因此这一细节对用户通常是透明的。但是当通过 GameInput API 处理每个键盘的输入时，了解这一点可以帮助应用在将功能映射到按键时避免做出不合理的假设（例如，假设按键始终来自特定设备）。如果设备不是组合设备的多个接口之一，则 `deviceId` 和 `deviceRootId` 相同。

`displayName` 字符串包含设备的“友好”名称。你可以在应用的 UI 中显示此字符串，但不保证它已本地化。缺少本地化是因为 GameInput API 会在多个位置搜索此字符串，最后的回退之一来自设备的固件。

`GameInputDeviceInfo` 结构中的最后几个字段是指向可变大小信息数组的指针，例如关于力反馈和触觉反馈支持的信息。`NULL` 指针表示该设备不可用或不支持相应功能。结构中相应的字段指示每个数组的元素数量，如源注释语言 (SAL) 注释所述。

没有任何输入设备为所有属性提供可读值。有些设备只包含相关属性的值。系统通过 [IGameInputDevice::GetDeviceInfo](https://docs.xbox.com/zh-CN/reference/input/gameinput/deprecated/interfaces/igameinputdevice/methods/igameinputdevice_getdeviceinfo.md) 返回此信息。

### GameInput v4 中的替代方法

在 GameInput v4 中，`GameInputDeviceInfo` 的每个成员都由 [IGameInputDevice](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/igameinputdevice.md) 上的一个 getter 方法取代。

| v3 成员 | v4 替代项 |
| - | - |
| `vendorId` | [GetVendorId](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getvendorid.md) |
| `productId` | [GetProductId](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getproductid.md) |
| `revisionNumber` | [GetRevisionNumber](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getrevisionnumber.md) |
| `usage` | [GetUsage](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getusage.md) |
| `hardwareVersion` | [GetHardwareVersion](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_gethardwareversion.md) |
| `firmwareVersion` | [GetFirmwareVersion](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getfirmwareversion.md) |
| `deviceId` | [GetDeviceId](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getdeviceid.md) |
| `deviceRootId` | [GetDeviceRootId](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getdevicerootid.md) |
| `deviceFamily` | [GetDeviceFamily](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getdevicefamily.md) |
| `supportedInput` | [GetSupportedInput](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getsupportedinput.md) |
| `supportedRumbleMotors` | [GetSupportedRumbleMotors](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getsupportedrumblemotors.md) |
| `supportedSystemButtons` | [GetSupportedSystemButtons](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getsupportedsystembuttons.md) |
| `containerId` | [GetContainerId](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getcontainerid.md) |
| `displayName` | [GetDisplayName](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getdisplayname.md) |
| `pnpPath` | [GetPnpPath](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getpnppath.md) |
| `keyboardInfo` | [GetKeyboardInfo](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getkeyboardinfo.md) |
| `mouseInfo` | [GetMouseInfo](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getmouseinfo.md) |
| `sensorsInfo` | [GetSensorsInfo](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getsensorsinfo.md) |
| `controllerInfo` | [GetControllerAxisCount](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getcontrolleraxiscount.md)、[GetControllerAxisLabels](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getcontrolleraxislabels.md)、[GetControllerButtonCount](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getcontrollerbuttoncount.md)、[GetControllerButtonLabels](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getcontrollerbuttonlabels.md)、[GetControllerSwitchCount](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getcontrollerswitchcount.md)、[GetControllerSwitchInfo](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getcontrollerswitchinfo.md) |
| `arcadeStickInfo` | [GetArcadeStickInfo](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getarcadestickinfo.md) |
| `flightStickInfo` | [GetFlightStickInfo](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getflightstickinfo.md) |
| `gamepadInfo` | [GetGamepadInfo](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getgamepadinfo.md) |
| `racingWheelInfo` | [GetRacingWheelInfo](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getracingwheelinfo.md) |
| `forceFeedbackMotorCount` | [GetForceFeedbackMotorCount](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getforcefeedbackmotorcount.md) |
| `forceFeedbackMotorInfo` | [GetForceFeedbackMotorInfo](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getforcefeedbackmotorinfo.md) |
| `inputReportCount` | [GetInputReportCount](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getinputreportcount.md) |
| `inputReportInfo` | [GetInputReportInfo](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getinputreportinfo.md) |
| `outputReportCount` | [GetOutputReportCount](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getoutputreportcount.md) |
| `outputReportInfo` | [GetOutputReportInfo](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getoutputreportinfo.md) |

当设备不具备相应类型的输入时，用于设备特定信息的指针成员（例如 `keyboardInfo` 和 `gamepadInfo`）为 `NULL`。在这种情况下，对应的 v4 getter（例如 `GetKeyboardInfo` 和 `GetGamepadInfo`）返回 `false`。

## 概念文档

* [GameInput 上的力反馈](https://docs.xbox.com/zh-CN/build/core-features/common/input/advanced/input-forcefeedback.md)
* [GameInput 设备](https://docs.xbox.com/zh-CN/build/core-features/common/input/overviews/input-devices.md)

## 另请参阅

[已弃用的 GameInput API 成员](https://docs.xbox.com/zh-CN/reference/input/gameinput/deprecated/gameinput_deprecated_members.md)\
[IGameInputDevice](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/igameinputdevice.md)\
[输入 API 概述](https://docs.xbox.com/zh-CN/build/core-features/common/input/overviews/input-overview.md)\
[GameInput](https://docs.xbox.com/zh-CN/reference/input/gameinput/gameinput_members.md)\
[IGameInputDevice::GetDeviceInfo](https://docs.xbox.com/zh-CN/reference/input/gameinput/deprecated/interfaces/igameinputdevice/methods/igameinputdevice_getdeviceinfo.md)

## 版本历史

| 版本 | 变更 |
| - | - |
| **v4** | 已移除。 |
| **v3** | 将 `uiNavigationInfo` 替换为 `controllerInfo` 指针。将独立的轴/按钮/开关计数+信息字段替换为 `controllerInfo`。新增 `inputReportCount`/`inputReportInfo` 和 `outputReportCount`/`outputReportInfo`。移除 `hapticFeedbackMotorInfo`。 |
| **v2** | **新增** `revisionNumber`、`hardwareVersion`、`firmwareVersion`、`containerId` (GUID) 和 `sensorsInfo` 指针。 |
| **v1** | 相对于 v0 **大幅简化**：移除 `infoSize`、`interfaceNumber`、`collectionNumber`、`capabilities` (GameInputDeviceCapabilities) 以及触摸/触觉/字符串/描述符计数字段；新增 `supportedSystemButtons`、`displayName`（类型为 `const char*`）和 `pnpPath`。 |
| **v0** | 引入。 |

## 附录：以前的版本

### v2

```cpp theme={null}
struct GameInputDeviceInfo
{
    uint16_t               vendorId;
    uint16_t               productId;
    uint16_t               revisionNumber;
    GameInputUsage         usage;
    GameInputVersion       hardwareVersion;
    GameInputVersion       firmwareVersion;
    APP_LOCAL_DEVICE_ID    deviceId;
    APP_LOCAL_DEVICE_ID    deviceRootId;
    GameInputDeviceFamily  deviceFamily;
    GameInputKind          supportedInput;
    GameInputRumbleMotors  supportedRumbleMotors;
    GameInputSystemButtons supportedSystemButtons;
    GUID                   containerId;
    const char*            displayName;
    const char*            pnpPath;

    const GameInputKeyboardInfo* keyboardInfo;
    const GameInputMouseInfo*    mouseInfo;
    const GameInputSensorsInfo*  sensorsInfo;

    const GameInputUiNavigationInfo* uiNavigationInfo;
    const GameInputArcadeStickInfo*  arcadeStickInfo;
    const GameInputFlightStickInfo*  flightStickInfo;
    const GameInputGamepadInfo*      gamepadInfo;
    const GameInputRacingWheelInfo*  racingWheelInfo;

    uint32_t                              controllerAxisCount;
    const GameInputControllerAxisInfo*    controllerAxisInfo;
    uint32_t                              controllerButtonCount;
    const GameInputControllerButtonInfo*  controllerButtonInfo;
    uint32_t                              controllerSwitchCount;
    const GameInputControllerSwitchInfo*  controllerSwitchInfo;

    uint32_t                               forceFeedbackMotorCount;
    const GameInputForceFeedbackMotorInfo* forceFeedbackMotorInfo;

    uint32_t                                hapticFeedbackMotorCount;
    const GameInputHapticFeedbackMotorInfo* hapticFeedbackMotorInfo;
};
```

### v1

```cpp theme={null}
struct GameInputDeviceInfo
{
    uint16_t               vendorId;
    uint16_t               productId;
    GameInputUsage         usage;
    APP_LOCAL_DEVICE_ID    deviceId;
    APP_LOCAL_DEVICE_ID    deviceRootId;
    GameInputDeviceFamily  deviceFamily;
    GameInputKind          supportedInput;
    GameInputRumbleMotors  supportedRumbleMotors;
    GameInputSystemButtons supportedSystemButtons;
    const char*            displayName;
    const char*            pnpPath;

    const GameInputKeyboardInfo* keyboardInfo;
    const GameInputMouseInfo*    mouseInfo;

    const GameInputUiNavigationInfo* uiNavigationInfo;
    const GameInputArcadeStickInfo*  arcadeStickInfo;
    const GameInputFlightStickInfo*  flightStickInfo;
    const GameInputGamepadInfo*      gamepadInfo;
    const GameInputRacingWheelInfo*  racingWheelInfo;

    uint32_t                              controllerAxisCount;
    const GameInputControllerAxisInfo*    controllerAxisInfo;
    uint32_t                              controllerButtonCount;
    const GameInputControllerButtonInfo*  controllerButtonInfo;
    uint32_t                              controllerSwitchCount;
    const GameInputControllerSwitchInfo*  controllerSwitchInfo;

    uint32_t                               forceFeedbackMotorCount;
    const GameInputForceFeedbackMotorInfo* forceFeedbackMotorInfo;

    uint32_t                                hapticFeedbackMotorCount;
    const GameInputHapticFeedbackMotorInfo* hapticFeedbackMotorInfo;
};
```


## Related topics

- [GetDeviceInfo（已弃用）](https://docs.xbox.com/zh-CN/reference/input/gameinput/deprecated/interfaces/igameinputdevice/methods/igameinputdevice_getdeviceinfo.md)
- [GameInputMotionInfo（已弃用）](https://docs.xbox.com/zh-CN/reference/input/gameinput/deprecated/structs/gameinputmotioninfo.md)
- [GameInputControllerInfo（已弃用）](https://docs.xbox.com/zh-CN/reference/input/gameinput/deprecated/structs/gameinputcontrollerinfo.md)
- [GameInputString（已弃用）](https://docs.xbox.com/zh-CN/reference/input/gameinput/deprecated/structs/gameinputstring.md)
- [已弃用的 GameInput API 成员](https://docs.xbox.com/zh-CN/reference/input/gameinput/deprecated/gameinput_deprecated_members.md)
