Author: janderwald
Date: Sun Dec 25 17:09:09 2011
New Revision: 54752
URL:
http://svn.reactos.org/svn/reactos?rev=54752&view=rev
Log:
[USB-BRINGUP]
- Implement HidP_UsageListDifference, HidP_GetUsagesEx, HidP_UsageAndPageListDifference
- Fix api prototypes
- Fix HidP_GetUsages linking
Modified:
branches/usb-bringup/drivers/usb/hidparse/hidparse.c
branches/usb-bringup/drivers/usb/hidparse/hidparse.spec
branches/usb-bringup/include/ddk/hidpddi.h
Modified: branches/usb-bringup/drivers/usb/hidparse/hidparse.c
URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup/drivers/usb/hidpars…
==============================================================================
--- branches/usb-bringup/drivers/usb/hidparse/hidparse.c [iso-8859-1] (original)
+++ branches/usb-bringup/drivers/usb/hidparse/hidparse.c [iso-8859-1] Sun Dec 25 17:09:09
2011
@@ -12,6 +12,7 @@
VOID
+NTAPI
HidP_FreeCollectionDescription (
IN PHIDP_DEVICE_DESC DeviceDescription)
{
@@ -26,13 +27,9 @@
// free report ids
//
ExFreePool(DeviceDescription->ReportIDs);
-
- //
- // free description itself
- //
- ExFreePool(DeviceDescription);
-
-}
+}
+
+#undef HidP_GetButtonCaps
HIDAPI
NTSTATUS
@@ -43,7 +40,7 @@
PUSHORT ButtonCapsLength,
PHIDP_PREPARSED_DATA PreparsedData)
{
- return HidP_GetSpecificButtonCaps(ReportType, 0, 0, 0, ButtonCaps,
(PULONG)ButtonCapsLength, PreparsedData);
+ return HidP_GetSpecificButtonCaps(ReportType, HID_USAGE_PAGE_UNDEFINED, 0, 0,
ButtonCaps, (PULONG)ButtonCapsLength, PreparsedData);
}
HIDAPI
@@ -77,6 +74,7 @@
}
NTSTATUS
+NTAPI
HidP_GetCollectionDescription(
IN PHIDP_REPORT_DESCRIPTOR ReportDesc,
IN ULONG DescLength,
@@ -180,9 +178,123 @@
OUT PUSAGE MakeUsageList,
IN ULONG UsageListLength)
{
- UNIMPLEMENTED
- ASSERT(FALSE);
- return STATUS_NOT_IMPLEMENTED;
+ ULONG Index, SubIndex, bFound, BreakUsageIndex = 0, MakeUsageIndex = 0;
+ USAGE CurrentUsage, Usage;
+
+ if (UsageListLength)
+ {
+ Index = 0;
+ do
+ {
+ /* get current usage */
+ CurrentUsage = PreviousUsageList[Index];
+
+ /* is the end of list reached? */
+ if (!CurrentUsage)
+ break;
+
+ /* start searching in current usage list */
+ SubIndex = 0;
+ bFound = FALSE;
+ do
+ {
+ /* get usage of current list */
+ Usage = CurrentUsageList[SubIndex];
+
+ /* end of list reached? */
+ if (!Usage)
+ break;
+
+ /* check if it matches the current one */
+ if (CurrentUsage == Usage)
+ {
+ /* it does */
+ bFound = TRUE;
+ break;
+ }
+
+ /* move to next usage */
+ SubIndex++;
+ }while(SubIndex < UsageListLength);
+
+ /* was the usage found ?*/
+ if (!bFound)
+ {
+ /* store it in the break usage list */
+ BreakUsageList[BreakUsageIndex] = CurrentUsage;
+ BreakUsageIndex++;
+ }
+
+ /* move to next usage */
+ Index++;
+
+ }while(Index < UsageListLength);
+
+ /* now process the new items */
+ Index = 0;
+ do
+ {
+ /* get current usage */
+ CurrentUsage = CurrentUsageList[Index];
+
+ /* is the end of list reached? */
+ if (!CurrentUsage)
+ break;
+
+ /* start searching in current usage list */
+ SubIndex = 0;
+ bFound = FALSE;
+ do
+ {
+ /* get usage of previous list */
+ Usage = PreviousUsageList[SubIndex];
+
+ /* end of list reached? */
+ if (!Usage)
+ break;
+
+ /* check if it matches the current one */
+ if (CurrentUsage == Usage)
+ {
+ /* it does */
+ bFound = TRUE;
+ break;
+ }
+
+ /* move to next usage */
+ SubIndex++;
+ }while(SubIndex < UsageListLength);
+
+ /* was the usage found ?*/
+ if (!bFound)
+ {
+ /* store it in the make usage list */
+ MakeUsageList[MakeUsageIndex] = CurrentUsage;
+ MakeUsageIndex++;
+ }
+
+ /* move to next usage */
+ Index++;
+
+ }while(Index < UsageListLength);
+ }
+
+ /* does the break list contain empty entries */
+ if (BreakUsageIndex < UsageListLength)
+ {
+ /* zeroize entries */
+ RtlZeroMemory(&BreakUsageList[BreakUsageIndex], sizeof(USAGE) *
(UsageListLength - BreakUsageIndex));
+ }
+
+ /* does the make usage list contain empty entries */
+ if (MakeUsageIndex < UsageListLength)
+ {
+ /* zeroize entries */
+ RtlZeroMemory(&MakeUsageList[MakeUsageIndex], sizeof(USAGE) *
(UsageListLength - MakeUsageIndex));
+ }
+
+ /* done */
+ return HIDP_STATUS_SUCCESS;
}
HIDAPI
@@ -234,6 +346,7 @@
}
NTSTATUS
+NTAPI
HidP_SysPowerEvent (
IN PCHAR HidPacket,
IN USHORT HidPacketLength,
@@ -246,6 +359,7 @@
}
NTSTATUS
+NTAPI
HidP_SysPowerCaps (
IN PHIDP_PREPARSED_DATA Ppd,
OUT PULONG OutputBuffer)
@@ -286,9 +400,7 @@
IN PCHAR Report,
IN ULONG ReportLength)
{
- UNIMPLEMENTED
- ASSERT(FALSE);
- return STATUS_NOT_IMPLEMENTED;
+ return HidP_GetUsages(ReportType, HID_USAGE_PAGE_UNDEFINED, LinkCollection,
(PUSAGE)ButtonList, UsageLength, PreparsedData, Report, ReportLength);
}
@@ -302,9 +414,123 @@
OUT PUSAGE_AND_PAGE MakeUsageList,
IN ULONG UsageListLength)
{
- UNIMPLEMENTED
- ASSERT(FALSE);
- return STATUS_NOT_IMPLEMENTED;
+ ULONG Index, SubIndex, BreakUsageListIndex = 0, MakeUsageListIndex = 0, bFound;
+ PUSAGE_AND_PAGE CurrentUsage, Usage;
+
+ if (UsageListLength)
+ {
+ /* process removed usages */
+ Index = 0;
+ do
+ {
+ /* get usage from current index */
+ CurrentUsage = &PreviousUsageList[Index];
+
+ /* end of list reached? */
+ if (CurrentUsage->Usage == 0 && CurrentUsage->UsagePage == 0)
+ break;
+
+ /* search in current list */
+ SubIndex = 0;
+ bFound = FALSE;
+ do
+ {
+ /* get usage */
+ Usage = &CurrentUsageList[SubIndex];
+
+ /* end of list reached? */
+ if (Usage->Usage == 0 && Usage->UsagePage == 0)
+ break;
+
+ /* does it match */
+ if (Usage->Usage == CurrentUsage->Usage &&
Usage->UsagePage == CurrentUsage->UsagePage)
+ {
+ /* found match */
+ bFound = TRUE;
+ }
+
+ /* move to next index */
+ SubIndex++;
+
+ }while(SubIndex < UsageListLength);
+
+ if (!bFound)
+ {
+ /* store it in break usage list */
+ BreakUsageList[BreakUsageListIndex].Usage = CurrentUsage->Usage;
+ BreakUsageList[BreakUsageListIndex].UsagePage =
CurrentUsage->UsagePage;
+ BreakUsageListIndex++;
+ }
+
+ /* move to next index */
+ Index++;
+
+ }while(Index < UsageListLength);
+
+ /* process new usages */
+ Index = 0;
+ do
+ {
+ /* get usage from current index */
+ CurrentUsage = &CurrentUsageList[Index];
+
+ /* end of list reached? */
+ if (CurrentUsage->Usage == 0 && CurrentUsage->UsagePage == 0)
+ break;
+
+ /* search in current list */
+ SubIndex = 0;
+ bFound = FALSE;
+ do
+ {
+ /* get usage */
+ Usage = &PreviousUsageList[SubIndex];
+
+ /* end of list reached? */
+ if (Usage->Usage == 0 && Usage->UsagePage == 0)
+ break;
+
+ /* does it match */
+ if (Usage->Usage == CurrentUsage->Usage &&
Usage->UsagePage == CurrentUsage->UsagePage)
+ {
+ /* found match */
+ bFound = TRUE;
+ }
+
+ /* move to next index */
+ SubIndex++;
+
+ }while(SubIndex < UsageListLength);
+
+ if (!bFound)
+ {
+ /* store it in break usage list */
+ MakeUsageList[MakeUsageListIndex].Usage = CurrentUsage->Usage;
+ MakeUsageList[MakeUsageListIndex].UsagePage =
CurrentUsage->UsagePage;
+ MakeUsageListIndex++;
+ }
+
+ /* move to next index */
+ Index++;
+ }while(Index < UsageListLength);
+ }
+
+ /* are there remaining free list entries */
+ if (BreakUsageListIndex < UsageListLength)
+ {
+ /* zero them */
+ RtlZeroMemory(&BreakUsageList[BreakUsageListIndex], (UsageListLength -
BreakUsageListIndex) * sizeof(USAGE_AND_PAGE));
+ }
+
+ /* are there remaining free list entries */
+ if (MakeUsageListIndex < UsageListLength)
+ {
+ /* zero them */
+ RtlZeroMemory(&MakeUsageList[MakeUsageListIndex], (UsageListLength -
MakeUsageListIndex) * sizeof(USAGE_AND_PAGE));
+ }
+
+ /* done */
+ return HIDP_STATUS_SUCCESS;
}
HIDAPI
@@ -473,6 +699,8 @@
return STATUS_NOT_IMPLEMENTED;
}
+#undef HidP_GetValueCaps
+
HIDAPI
NTSTATUS
NTAPI
Modified: branches/usb-bringup/drivers/usb/hidparse/hidparse.spec
URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup/drivers/usb/hidpars…
==============================================================================
--- branches/usb-bringup/drivers/usb/hidparse/hidparse.spec [iso-8859-1] (original)
+++ branches/usb-bringup/drivers/usb/hidparse/hidparse.spec [iso-8859-1] Sun Dec 25
17:09:09 2011
@@ -10,7 +10,7 @@
@ stdcall HidP_GetSpecificValueCaps(long long long long ptr ptr ptr)
@ stdcall HidP_GetUsageValue(long long long long ptr ptr ptr long)
@ stdcall HidP_GetUsageValueArray(long long long long ptr long ptr ptr long)
-@ stdcall HidP_GetUsages(long long ptr ptr ptr ptr long)
+@ stdcall HidP_GetUsages(long long long ptr ptr ptr ptr long)
@ stdcall HidP_GetUsagesEx(long long ptr ptr ptr ptr long)
@ stdcall HidP_GetValueCaps(long ptr ptr ptr)
@ stdcall HidP_InitializeReportForID(long long ptr ptr long)
Modified: branches/usb-bringup/include/ddk/hidpddi.h
URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup/include/ddk/hidpddi…
==============================================================================
--- branches/usb-bringup/include/ddk/hidpddi.h [iso-8859-1] (original)
+++ branches/usb-bringup/include/ddk/hidpddi.h [iso-8859-1] Sun Dec 25 17:09:09 2011
@@ -52,11 +52,13 @@
);
VOID
+NTAPI
HidP_FreeCollectionDescription (
IN PHIDP_DEVICE_DESC DeviceDescription
);
NTSTATUS
+NTAPI
HidP_SysPowerEvent (
IN PCHAR HidPacket,
IN USHORT HidPacketLength,
@@ -65,6 +67,7 @@
);
NTSTATUS
+NTAPI
HidP_SysPowerCaps (
IN PHIDP_PREPARSED_DATA Ppd,
OUT PULONG OutputBuffer