40 if (EndPos <= StartPos) {
56 if (HidItem->Tag == HID_ITEM_TAG_LONG) {
60 HidItem->Format = HID_ITEM_FORMAT_LONG;
62 if ((EndPos - StartPos) >= 2) {
63 HidItem->Size = *StartPos++;
64 HidItem->Tag = *StartPos++;
66 if ((EndPos - StartPos) >= HidItem->Size) {
67 HidItem->Data.LongData = StartPos;
68 StartPos += HidItem->Size;
73 HidItem->Format = HID_ITEM_FORMAT_SHORT;
76 switch (HidItem->Size) {
87 if ((EndPos - StartPos) >= 1) {
88 HidItem->Data.Uint8 = *StartPos++;
96 if ((EndPos - StartPos) >= 2) {
97 CopyMem (&HidItem->Data.Uint16, StartPos, sizeof (UINT16));
107 if ((EndPos - StartPos) >= 4) {
108 CopyMem (&HidItem->Data.Uint32, StartPos, sizeof (UINT32));
138 switch (HidItem->Size) {
140 return HidItem->Data.Uint8;
142 return HidItem->Data.Uint16;
144 return HidItem->Data.Uint32;
169 switch (HidItem->Type) {
170 case HID_ITEM_TYPE_MAIN:
176 case HID_ITEM_TYPE_GLOBAL:
180 if (HidItem->Tag == HID_GLOBAL_ITEM_TAG_USAGE_PAGE) {
186 UsbMouse->PrivateData.ButtonDetected =
TRUE;
192 case HID_ITEM_TYPE_LOCAL:
193 if (HidItem->Size == 0) {
202 switch (HidItem->Tag) {
203 case HID_LOCAL_ITEM_TAG_USAGE_MINIMUM:
204 if (UsbMouse->PrivateData.ButtonDetected) {
205 UsbMouse->PrivateData.ButtonMinIndex = Data;
210 case HID_LOCAL_ITEM_TAG_USAGE_MAXIMUM:
212 if (UsbMouse->PrivateData.ButtonDetected) {
213 UsbMouse->PrivateData.ButtonMaxIndex = Data;
244 IN UINT8 *ReportDescriptor,
248 UINT8 *DescriptorEnd;
252 DescriptorEnd = ReportDescriptor + ReportSize;
255 while (Ptr !=
NULL) {
256 if (HidItem.Format != HID_ITEM_FORMAT_SHORT) {
260 return EFI_UNSUPPORTED;
268 UsbMouse->NumberOfButtons = (UINT8)(UsbMouse->PrivateData.ButtonMaxIndex - UsbMouse->PrivateData.ButtonMinIndex + 1);
269 UsbMouse->XLogicMax = 127;
270 UsbMouse->YLogicMax = 127;
271 UsbMouse->XLogicMin = -127;
272 UsbMouse->YLogicMin = -127;
UINT8 EFIAPI BitFieldRead8(IN UINT8 Operand, IN UINTN StartBit, IN UINTN EndBit)
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
VOID ParseHidItem(IN USB_MOUSE_ABSOLUTE_POINTER_DEV *UsbMouse, IN HID_ITEM *HidItem)
UINT32 GetItemData(IN HID_ITEM *HidItem)
EFI_STATUS ParseMouseReportDescriptor(OUT USB_MOUSE_ABSOLUTE_POINTER_DEV *UsbMouseAbsolutePointer, IN UINT8 *ReportDescriptor, IN UINTN ReportSize)
UINT8 * GetNextHidItem(IN UINT8 *StartPos, IN UINT8 *EndPos, OUT HID_ITEM *HidItem)