Author: janderwald
Date: Fri Jan 6 20:37:13 2012
New Revision: 54856
URL:
http://svn.reactos.org/svn/reactos?rev=54856&view=rev
Log:
[KBDHID]
- Implement KbdHid_ReadCompletion routine
- Start implementing KbdHid_InsertScanCodes routine
Modified:
branches/usb-bringup/drivers/hid/kbdhid/kbdhid.c
branches/usb-bringup/drivers/hid/kbdhid/kbdhid.h
Modified: branches/usb-bringup/drivers/hid/kbdhid/kbdhid.c
URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup/drivers/hid/kbdhid/…
==============================================================================
--- branches/usb-bringup/drivers/hid/kbdhid/kbdhid.c [iso-8859-1] (original)
+++ branches/usb-bringup/drivers/hid/kbdhid/kbdhid.c [iso-8859-1] Fri Jan 6 20:37:13
2012
@@ -13,8 +13,7 @@
VOID
KbdHid_DispatchInputData(
IN PKBDHID_DEVICE_EXTENSION DeviceExtension,
- IN PKEYBOARD_INPUT_DATA InputData,
- IN ULONG InputDataLength)
+ IN PKEYBOARD_INPUT_DATA InputData)
{
KIRQL OldIrql;
ULONG InputDataConsumed;
@@ -30,11 +29,37 @@
KeRaiseIrql(DISPATCH_LEVEL, &OldIrql);
/* dispatch input data */
-
(*(PSERVICE_CALLBACK_ROUTINE)DeviceExtension->ClassService)(DeviceExtension->ClassDeviceObject,
InputData, InputData + InputDataLength + 1, &InputDataConsumed);
+
(*(PSERVICE_CALLBACK_ROUTINE)DeviceExtension->ClassService)(DeviceExtension->ClassDeviceObject,
InputData, InputData + 1, &InputDataConsumed);
/* lower irql to previous level */
KeLowerIrql(OldIrql);
}
+
+BOOLEAN
+NTAPI
+KbdHid_InsertScanCodes(
+ IN PVOID Context,
+ IN PCHAR NewScanCodes,
+ IN ULONG Length)
+{
+ KEYBOARD_INPUT_DATA InputData;
+ ULONG Index;
+
+ for(Index = 0; Index < Length; Index++)
+ {
+ DPRINT1("[KBDHID] ScanCode Index %lu ScanCode %x\n", Index,
NewScanCodes[Index] & 0xFF);
+ //
+ // TODO: set up input data
+ //
+ //KbdHid_DispatchInputData((PKBDHID_DEVICE_EXTENSION)Context, &InputData);
+ }
+
+ //
+ // done
+ //
+ return TRUE;
+}
+
NTSTATUS
NTAPI
@@ -44,6 +69,8 @@
IN PVOID Context)
{
PKBDHID_DEVICE_EXTENSION DeviceExtension;
+ NTSTATUS Status;
+ ULONG ButtonLength;
/* get device extension */
DeviceExtension = (PKBDHID_DEVICE_EXTENSION)Context;
@@ -67,11 +94,27 @@
return STATUS_MORE_PROCESSING_REQUIRED;
}
- UNIMPLEMENTED
- ASSERT(FALSE);
-
- /* dispatch mouse action */
- //KbdHid_DispatchInputData(DeviceExtension, &InputData);
+ /* get current usages */
+ ButtonLength = DeviceExtension->UsageListLength;
+ Status = HidP_GetUsagesEx(HidP_Input, HIDP_LINK_COLLECTION_UNSPECIFIED,
DeviceExtension->CurrentUsageList, &ButtonLength,
DeviceExtension->PreparsedData, DeviceExtension->Report,
DeviceExtension->ReportLength);
+ ASSERT(Status == HIDP_STATUS_SUCCESS);
+
+ /* FIXME check if needs mapping */
+
+ /* get usage difference */
+ Status = HidP_UsageAndPageListDifference(DeviceExtension->PreviousUsageList,
DeviceExtension->CurrentUsageList, DeviceExtension->BreakUsageList,
DeviceExtension->MakeUsageList, DeviceExtension->UsageListLength);
+ ASSERT(Status == HIDP_STATUS_SUCCESS);
+
+ /* replace previous usage list with current list */
+ RtlMoveMemory(DeviceExtension->PreviousUsageList,
DeviceExtension->CurrentUsageList, sizeof(USAGE_AND_PAGE) *
DeviceExtension->UsageListLength);
+
+ /* translate break usage list */
+ HidP_TranslateUsageAndPagesToI8042ScanCodes(DeviceExtension->BreakUsageList,
DeviceExtension->UsageListLength, HidP_Keyboard_Break,
&DeviceExtension->ModifierState, KbdHid_InsertScanCodes, DeviceExtension);
+ ASSERT(Status == HIDP_STATUS_SUCCESS);
+
+ /* translate new usage list */
+ HidP_TranslateUsageAndPagesToI8042ScanCodes(DeviceExtension->MakeUsageList,
DeviceExtension->UsageListLength, HidP_Keyboard_Make,
&DeviceExtension->ModifierState, KbdHid_InsertScanCodes, DeviceExtension);
+ ASSERT(Status == HIDP_STATUS_SUCCESS);
/* re-init read */
KbdHid_InitiateRead(DeviceExtension);
Modified: branches/usb-bringup/drivers/hid/kbdhid/kbdhid.h
URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup/drivers/hid/kbdhid/…
==============================================================================
--- branches/usb-bringup/drivers/hid/kbdhid/kbdhid.h [iso-8859-1] (original)
+++ branches/usb-bringup/drivers/hid/kbdhid/kbdhid.h [iso-8859-1] Fri Jan 6 20:37:13
2012
@@ -67,7 +67,7 @@
//
// preparsed data
//
- PVOID PreparsedData;
+ PHIDP_PREPARSED_DATA PreparsedData;
//
// mdl for reading input report
@@ -77,7 +77,7 @@
//
// input report buffer
//
- PUCHAR Report;
+ PCHAR Report;
//
// input report length
@@ -104,6 +104,11 @@
//
KEYBOARD_ATTRIBUTES Attributes;
+ //
+ // keyboard modifier state
+ //
+ HIDP_KEYBOARD_MODIFIER_STATE ModifierState;
+
}KBDHID_DEVICE_EXTENSION, *PKBDHID_DEVICE_EXTENSION;
/* defaults from kbfiltr.h */