Author: janderwald
Date: Wed Feb 1 13:34:20 2012
New Revision: 55368
URL:
http://svn.reactos.org/svn/reactos?rev=55368&view=rev
Log:
[HIDPARSER]
- A key break code indicator is 0x80, not 0x1
[USBCCGP]
- Silence debug print
[KBDHID]
- Implement IOCTL_KEYBOARD_QUERY_INDICATORS, IOCTL_KEYBOARD_SET_INDICATORS
- Partly implement dispatching to kbdclass
- Kbdclass now receives keys from kbdhid. Not yet fully working
- Tested in XP+ ReactOS USB Stack + ReactOS HID stack + USB Composite Device Keyboard
Modified:
branches/usb-bringup-trunk/drivers/hid/kbdhid/kbdhid.c
branches/usb-bringup-trunk/drivers/hid/kbdhid/kbdhid.h
branches/usb-bringup-trunk/drivers/usb/usbccgp/pdo.c
branches/usb-bringup-trunk/lib/drivers/hidparser/api.c
Modified: branches/usb-bringup-trunk/drivers/hid/kbdhid/kbdhid.c
URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup-trunk/drivers/hid/k…
==============================================================================
--- branches/usb-bringup-trunk/drivers/hid/kbdhid/kbdhid.c [iso-8859-1] (original)
+++ branches/usb-bringup-trunk/drivers/hid/kbdhid/kbdhid.c [iso-8859-1] Wed Feb 1
13:34:20 2012
@@ -42,16 +42,36 @@
IN PCHAR NewScanCodes,
IN ULONG Length)
{
- //KEYBOARD_INPUT_DATA InputData;
+ KEYBOARD_INPUT_DATA InputData;
ULONG Index;
+ PKBDHID_DEVICE_EXTENSION DeviceExtension;
+
+ /* get device extension */
+ DeviceExtension = (PKBDHID_DEVICE_EXTENSION)Context;
for(Index = 0; Index < Length; Index++)
{
DPRINT1("[KBDHID] ScanCode Index %lu ScanCode %x\n", Index,
NewScanCodes[Index] & 0xFF);
+
//
- // TODO: set up input data
+ // set up input data
//
- //KbdHid_DispatchInputData((PKBDHID_DEVICE_EXTENSION)Context, &InputData);
+ RtlZeroMemory(&InputData, sizeof(KEYBOARD_INPUT_DATA));
+
+ /* use keyboard unit id */
+ InputData.UnitId = DeviceExtension->KeyboardIndicator.UnitId;
+
+ if (NewScanCodes[Index] > 0x7F)
+ {
+ /* scan codes greater than 0x7F are a key break */
+ InputData.Flags |= KEY_BREAK;
+ }
+
+ /* store key code */
+ InputData.MakeCode = NewScanCodes[Index];
+
+ /* dispatch scan codes */
+ KbdHid_DispatchInputData((PKBDHID_DEVICE_EXTENSION)Context, &InputData);
}
//
@@ -391,9 +411,20 @@
}
else if (IoStack->Parameters.DeviceIoControl.IoControlCode ==
IOCTL_KEYBOARD_QUERY_INDICATORS)
{
- /* not implemented */
- DPRINT1("IOCTL_KEYBOARD_QUERY_INDICATORS not implemented\n");
- Irp->IoStatus.Status = STATUS_NOT_IMPLEMENTED;
+ if (IoStack->Parameters.DeviceIoControl.OutputBufferLength <
sizeof(KEYBOARD_INDICATOR_PARAMETERS))
+ {
+ /* invalid parameter */
+ Irp->IoStatus.Status = STATUS_INVALID_PARAMETER;
+ IoCompleteRequest(Irp, IO_NO_INCREMENT);
+ return STATUS_INVALID_PARAMETER;
+ }
+
+ /* copy indicators */
+ RtlCopyMemory(Irp->AssociatedIrp.SystemBuffer,
&DeviceExtension->KeyboardIndicator, sizeof(KEYBOARD_INDICATOR_PARAMETERS));
+
+ /* complete request */
+ Irp->IoStatus.Status = STATUS_SUCCESS;
+ Irp->IoStatus.Information = sizeof(KEYBOARD_INDICATOR_PARAMETERS);
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return STATUS_NOT_IMPLEMENTED;
}
@@ -407,11 +438,22 @@
}
else if (IoStack->Parameters.DeviceIoControl.IoControlCode ==
IOCTL_KEYBOARD_SET_INDICATORS)
{
- /* not implemented */
- DPRINT1("IOCTL_KEYBOARD_SET_INDICATORS not implemented\n");
- Irp->IoStatus.Status = STATUS_NOT_IMPLEMENTED;
+ if (IoStack->Parameters.DeviceIoControl.InputBufferLength <
sizeof(KEYBOARD_INDICATOR_PARAMETERS))
+ {
+ /* invalid parameter */
+ Irp->IoStatus.Status = STATUS_INVALID_PARAMETER;
+ IoCompleteRequest(Irp, IO_NO_INCREMENT);
+ return STATUS_INVALID_PARAMETER;
+ }
+
+ /* copy indicators */
+ RtlCopyMemory(&DeviceExtension->KeyboardIndicator,
Irp->AssociatedIrp.SystemBuffer, sizeof(KEYBOARD_INDICATOR_PARAMETERS));
+
+ /* done */
+ Irp->IoStatus.Status = STATUS_SUCCESS;
+ Irp->IoStatus.Information = 0;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
- return STATUS_NOT_IMPLEMENTED;
+ return STATUS_SUCCESS;
}
else if (IoStack->Parameters.DeviceIoControl.IoControlCode ==
IOCTL_KEYBOARD_SET_TYPEMATIC)
{
Modified: branches/usb-bringup-trunk/drivers/hid/kbdhid/kbdhid.h
URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup-trunk/drivers/hid/k…
==============================================================================
--- branches/usb-bringup-trunk/drivers/hid/kbdhid/kbdhid.h [iso-8859-1] (original)
+++ branches/usb-bringup-trunk/drivers/hid/kbdhid/kbdhid.h [iso-8859-1] Wed Feb 1
13:34:20 2012
@@ -109,6 +109,12 @@
//
HIDP_KEYBOARD_MODIFIER_STATE ModifierState;
+ //
+ // keyboard indicator state
+ //
+ KEYBOARD_INDICATOR_PARAMETERS KeyboardIndicator;
+
+
}KBDHID_DEVICE_EXTENSION, *PKBDHID_DEVICE_EXTENSION;
/* defaults from kbfiltr.h */
Modified: branches/usb-bringup-trunk/drivers/usb/usbccgp/pdo.c
URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup-trunk/drivers/usb/u…
==============================================================================
--- branches/usb-bringup-trunk/drivers/usb/usbccgp/pdo.c [iso-8859-1] (original)
+++ branches/usb-bringup-trunk/drivers/usb/usbccgp/pdo.c [iso-8859-1] Wed Feb 1 13:34:20
2012
@@ -850,7 +850,7 @@
//
Urb = (PURB)IoStack->Parameters.Others.Argument1;
ASSERT(Urb);
- DPRINT1("IOCTL_INTERNAL_USB_SUBMIT_URB Function %x\n",
Urb->UrbHeader.Function);
+ DPRINT("IOCTL_INTERNAL_USB_SUBMIT_URB Function %x\n",
Urb->UrbHeader.Function);
if (Urb->UrbHeader.Function == URB_FUNCTION_SELECT_CONFIGURATION)
{
Modified: branches/usb-bringup-trunk/lib/drivers/hidparser/api.c
URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup-trunk/lib/drivers/h…
==============================================================================
--- branches/usb-bringup-trunk/lib/drivers/hidparser/api.c [iso-8859-1] (original)
+++ branches/usb-bringup-trunk/lib/drivers/hidparser/api.c [iso-8859-1] Wed Feb 1
13:34:20 2012
@@ -663,9 +663,9 @@
if (KeyAction == HidP_Keyboard_Break)
{
//
- // add break
- //
- ScanCodes[Index] |= KEY_BREAK;
+ // add break - see USB HID to PS/2 Scan Code Translation Table
+ //
+ ScanCodes[Index] |= 0x80;
}
//
@@ -711,7 +711,6 @@
//
// FIXME: translate modifier states
//
- DPRINT1("Usage %x ScanCode %x\n", Usage, ScanCode);
HidParser_DispatchKey((PCHAR)&ScanCode, KeyAction, InsertCodesProcedure,
InsertCodesContext);
//