TianoCore EDK2 master
Loading...
Searching...
No Matches
MouseHid.c File Reference

Go to the source code of this file.

Functions

UINT8 * GetNextHidItem (IN UINT8 *StartPos, IN UINT8 *EndPos, OUT HID_ITEM *HidItem)
 
UINT32 GetItemData (IN HID_ITEM *HidItem)
 
VOID ParseHidItem (IN USB_MOUSE_ABSOLUTE_POINTER_DEV *UsbMouse, IN HID_ITEM *HidItem)
 
EFI_STATUS ParseMouseReportDescriptor (OUT USB_MOUSE_ABSOLUTE_POINTER_DEV *UsbMouseAbsolutePointer, IN UINT8 *ReportDescriptor, IN UINTN ReportSize)
 

Detailed Description

Helper functions to parse HID report descriptor and items.

Copyright (c) 2004 - 2010, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file MouseHid.c.

Function Documentation

◆ GetItemData()

UINT32 GetItemData ( IN HID_ITEM HidItem)

Get data from HID item.

This function retrieves data from HID item. It only supports short items, which has 4 types of data: 0, 1, 2, or 4 bytes.

Parameters
HidItemPointer to the HID item.
Returns
The data of HID item.

Definition at line 131 of file MouseHid.c.

◆ GetNextHidItem()

UINT8 * GetNextHidItem ( IN UINT8 *  StartPos,
IN UINT8 *  EndPos,
OUT HID_ITEM HidItem 
)

Get next HID item from report descriptor.

This function retrieves next HID item from report descriptor, according to the start position. According to USB HID Specification, An item is piece of information about the device. All items have a one-byte prefix that contains the item tag, item type, and item size. There are two basic types of items: short items and long items. If the item is a short item, its optional data size may be 0, 1, 2, or 4 bytes. Only short item is supported here.

Parameters
StartPosStart position of the HID item to get.
EndPosEnd position of the range to get the next HID item.
HidItemBuffer for the HID Item to return.
Returns
Pointer to end of the HID item returned. NULL if no HID item retrieved.

Definition at line 32 of file MouseHid.c.

◆ ParseHidItem()

VOID ParseHidItem ( IN USB_MOUSE_ABSOLUTE_POINTER_DEV UsbMouse,
IN HID_ITEM HidItem 
)

Parse HID item from report descriptor.

There are three item types: Main, Global, and Local. This function parses these types of HID items according to tag info.

Parameters
UsbMouseThe instance of USB_MOUSE_ABSOLUTE_POINTER_DEV
HidItemThe HID item to parse

Definition at line 162 of file MouseHid.c.

◆ ParseMouseReportDescriptor()

EFI_STATUS ParseMouseReportDescriptor ( OUT USB_MOUSE_ABSOLUTE_POINTER_DEV UsbMouseAbsolutePointer,
IN UINT8 *  ReportDescriptor,
IN UINTN  ReportSize 
)

Parse Mouse Report Descriptor.

According to USB HID Specification, report descriptors are composed of pieces of information. Each piece of information is called an Item. This function retrieves each item from the report descriptor and updates USB_MOUSE_ABSOLUTE_POINTER_DEV.

Parameters
UsbMouseAbsolutePointerThe instance of USB_MOUSE_ABSOLUTE_POINTER_DEV
ReportDescriptorReport descriptor to parse
ReportSizeReport descriptor size
Return values
EFI_SUCCESSReport descriptor successfully parsed.
EFI_UNSUPPORTEDReport descriptor contains long item.

Definition at line 242 of file MouseHid.c.