mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 17:45:41 +00:00
[USB-BRINGUP]
- Implement HidP_UsageListDifference, HidP_GetUsagesEx, HidP_UsageAndPageListDifference - Fix api prototypes - Fix HidP_GetUsages linking svn path=/branches/usb-bringup/; revision=54752
This commit is contained in:
parent
df17bddc0f
commit
1205becf05
3 changed files with 248 additions and 17 deletions
|
@ -12,6 +12,7 @@
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
|
NTAPI
|
||||||
HidP_FreeCollectionDescription (
|
HidP_FreeCollectionDescription (
|
||||||
IN PHIDP_DEVICE_DESC DeviceDescription)
|
IN PHIDP_DEVICE_DESC DeviceDescription)
|
||||||
{
|
{
|
||||||
|
@ -26,14 +27,10 @@ HidP_FreeCollectionDescription (
|
||||||
// free report ids
|
// free report ids
|
||||||
//
|
//
|
||||||
ExFreePool(DeviceDescription->ReportIDs);
|
ExFreePool(DeviceDescription->ReportIDs);
|
||||||
|
|
||||||
//
|
|
||||||
// free description itself
|
|
||||||
//
|
|
||||||
ExFreePool(DeviceDescription);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#undef HidP_GetButtonCaps
|
||||||
|
|
||||||
HIDAPI
|
HIDAPI
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
|
@ -43,7 +40,7 @@ HidP_GetButtonCaps(
|
||||||
PUSHORT ButtonCapsLength,
|
PUSHORT ButtonCapsLength,
|
||||||
PHIDP_PREPARSED_DATA PreparsedData)
|
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
|
HIDAPI
|
||||||
|
@ -77,6 +74,7 @@ HidP_GetCaps(
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
|
NTAPI
|
||||||
HidP_GetCollectionDescription(
|
HidP_GetCollectionDescription(
|
||||||
IN PHIDP_REPORT_DESCRIPTOR ReportDesc,
|
IN PHIDP_REPORT_DESCRIPTOR ReportDesc,
|
||||||
IN ULONG DescLength,
|
IN ULONG DescLength,
|
||||||
|
@ -180,9 +178,123 @@ HidP_UsageListDifference(
|
||||||
OUT PUSAGE MakeUsageList,
|
OUT PUSAGE MakeUsageList,
|
||||||
IN ULONG UsageListLength)
|
IN ULONG UsageListLength)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED
|
ULONG Index, SubIndex, bFound, BreakUsageIndex = 0, MakeUsageIndex = 0;
|
||||||
ASSERT(FALSE);
|
USAGE CurrentUsage, Usage;
|
||||||
return STATUS_NOT_IMPLEMENTED;
|
|
||||||
|
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
|
HIDAPI
|
||||||
|
@ -234,6 +346,7 @@ HidP_GetUsages(
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
|
NTAPI
|
||||||
HidP_SysPowerEvent (
|
HidP_SysPowerEvent (
|
||||||
IN PCHAR HidPacket,
|
IN PCHAR HidPacket,
|
||||||
IN USHORT HidPacketLength,
|
IN USHORT HidPacketLength,
|
||||||
|
@ -246,6 +359,7 @@ HidP_SysPowerEvent (
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
|
NTAPI
|
||||||
HidP_SysPowerCaps (
|
HidP_SysPowerCaps (
|
||||||
IN PHIDP_PREPARSED_DATA Ppd,
|
IN PHIDP_PREPARSED_DATA Ppd,
|
||||||
OUT PULONG OutputBuffer)
|
OUT PULONG OutputBuffer)
|
||||||
|
@ -286,9 +400,7 @@ HidP_GetUsagesEx(
|
||||||
IN PCHAR Report,
|
IN PCHAR Report,
|
||||||
IN ULONG ReportLength)
|
IN ULONG ReportLength)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED
|
return HidP_GetUsages(ReportType, HID_USAGE_PAGE_UNDEFINED, LinkCollection, (PUSAGE)ButtonList, UsageLength, PreparsedData, Report, ReportLength);
|
||||||
ASSERT(FALSE);
|
|
||||||
return STATUS_NOT_IMPLEMENTED;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -302,9 +414,123 @@ HidP_UsageAndPageListDifference(
|
||||||
OUT PUSAGE_AND_PAGE MakeUsageList,
|
OUT PUSAGE_AND_PAGE MakeUsageList,
|
||||||
IN ULONG UsageListLength)
|
IN ULONG UsageListLength)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED
|
ULONG Index, SubIndex, BreakUsageListIndex = 0, MakeUsageListIndex = 0, bFound;
|
||||||
ASSERT(FALSE);
|
PUSAGE_AND_PAGE CurrentUsage, Usage;
|
||||||
return STATUS_NOT_IMPLEMENTED;
|
|
||||||
|
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
|
HIDAPI
|
||||||
|
@ -473,6 +699,8 @@ HidP_InitializeReportForID(
|
||||||
return STATUS_NOT_IMPLEMENTED;
|
return STATUS_NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#undef HidP_GetValueCaps
|
||||||
|
|
||||||
HIDAPI
|
HIDAPI
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
@ stdcall HidP_GetSpecificValueCaps(long long long long ptr ptr ptr)
|
@ stdcall HidP_GetSpecificValueCaps(long long long long ptr ptr ptr)
|
||||||
@ stdcall HidP_GetUsageValue(long long long long ptr ptr ptr long)
|
@ 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_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_GetUsagesEx(long long ptr ptr ptr ptr long)
|
||||||
@ stdcall HidP_GetValueCaps(long ptr ptr ptr)
|
@ stdcall HidP_GetValueCaps(long ptr ptr ptr)
|
||||||
@ stdcall HidP_InitializeReportForID(long long ptr ptr long)
|
@ stdcall HidP_InitializeReportForID(long long ptr ptr long)
|
||||||
|
|
|
@ -52,11 +52,13 @@ HidP_GetCollectionDescription(
|
||||||
);
|
);
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
|
NTAPI
|
||||||
HidP_FreeCollectionDescription (
|
HidP_FreeCollectionDescription (
|
||||||
IN PHIDP_DEVICE_DESC DeviceDescription
|
IN PHIDP_DEVICE_DESC DeviceDescription
|
||||||
);
|
);
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
|
NTAPI
|
||||||
HidP_SysPowerEvent (
|
HidP_SysPowerEvent (
|
||||||
IN PCHAR HidPacket,
|
IN PCHAR HidPacket,
|
||||||
IN USHORT HidPacketLength,
|
IN USHORT HidPacketLength,
|
||||||
|
@ -65,6 +67,7 @@ HidP_SysPowerEvent (
|
||||||
);
|
);
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
|
NTAPI
|
||||||
HidP_SysPowerCaps (
|
HidP_SysPowerCaps (
|
||||||
IN PHIDP_PREPARSED_DATA Ppd,
|
IN PHIDP_PREPARSED_DATA Ppd,
|
||||||
OUT PULONG OutputBuffer
|
OUT PULONG OutputBuffer
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue