[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 

svn path=/branches/usb-bringup-trunk/; revision=55368
This commit is contained in:
Johannes Anderwald 2012-02-01 13:34:20 +00:00
parent 5ab8673f32
commit 704bae2492
4 changed files with 61 additions and 14 deletions

View file

@ -42,16 +42,36 @@ KbdHid_InsertScanCodes(
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 @@ KbdHid_InternalDeviceControl(
}
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 @@ KbdHid_InternalDeviceControl(
}
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)
{

View file

@ -109,6 +109,12 @@ typedef struct
//
HIDP_KEYBOARD_MODIFIER_STATE ModifierState;
//
// keyboard indicator state
//
KEYBOARD_INDICATOR_PARAMETERS KeyboardIndicator;
}KBDHID_DEVICE_EXTENSION, *PKBDHID_DEVICE_EXTENSION;
/* defaults from kbfiltr.h */

View file

@ -850,7 +850,7 @@ PDO_HandleInternalDeviceControl(
//
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)
{

View file

@ -663,9 +663,9 @@ HidParser_DispatchKey(
if (KeyAction == HidP_Keyboard_Break)
{
//
// add break
// add break - see USB HID to PS/2 Scan Code Translation Table
//
ScanCodes[Index] |= KEY_BREAK;
ScanCodes[Index] |= 0x80;
}
//
@ -711,7 +711,6 @@ HidParser_TranslateUsage(
//
// FIXME: translate modifier states
//
DPRINT1("Usage %x ScanCode %x\n", Usage, ScanCode);
HidParser_DispatchKey((PCHAR)&ScanCode, KeyAction, InsertCodesProcedure, InsertCodesContext);
//