- Add stub hidusb driver
- Hidusb driver is reponsible to connect with the hidclass driver (not yet present) and connect hid framework with usb hid devices

svn path=/branches/usb-bringup/; revision=53500
This commit is contained in:
Johannes Anderwald
2011-08-30 16:01:00 +00:00
parent 326fe80f8b
commit 6cd3e83d47
3 changed files with 184 additions and 0 deletions
+11
View File
@@ -0,0 +1,11 @@
list(APPEND SOURCE
hidusb.c
usbhub.rc)
add_library(hidusb SHARED ${SOURCE})
set_module_type(hidusb kernelmodedriver)
add_importlibs(hidusb hidclass ntoskrnl usbd)
add_cab_target(usbhub 2)
+151
View File
@@ -0,0 +1,151 @@
/*
* PROJECT: ReactOS Universal Serial Bus Human Interface Device Driver
* LICENSE: GPL - See COPYING in the top level directory
* FILE: drivers/usb/hidusb/hidusb.c
* PURPOSE: HID USB Interface Driver
* PROGRAMMERS:
* Michael Martin ([email protected])
* Johannes Anderwald ([email protected])
*/
#include "hidusb.h"
NTSTATUS
NTAPI
HidCreate(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
{
PIO_STACK_LOCATION IoStack;
//
// get current irp stack location
//
IoStack = IoGetCurrentIrpStackLocation(Irp);
//
// sanity check for hidclass driver
//
ASSERT(IoStack->MajorFunction == IRP_MJ_CREATE || IoStack->MajorFunction == IRP_MJ_CLOSE);
//
// complete request
//
Irp->IoStatus.Information = 0;
Irp->IoStatus.Status = STATUS_SUCCESS;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
//
// informal debug print
//
DPRINT1("HIDUSB Request: %x\n", IoStack->MajorFunction);
//
// done
//
return STATUS_SUCCESS;
}
NTSTATUS
NTAPI
HidInternalDeviceControl(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
{
UNIMPLEMENTED
ASSERT(FALSE);
return STATUS_NOT_IMPLEMENTED;
}
NTSTATUS
NTAPI
HidPower(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
{
UNIMPLEMENTED
ASSERT(FALSE);
return STATUS_NOT_IMPLEMENTED;
}
NTSTATUS
NTAPI
HidSystemControl(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
{
PHID_DEVICE_EXTENSION DeviceExtension;
//
// get hid device extension
//
DeviceExtension = (PHID_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
//
// copy stack location
//
IoCopyCurrentIrpStackLocationToNext(Irp);
//
// submit request
//
return IoCallDriver(DeviceExtension->NextDeviceObject);
}
NTSTATUS
NTAPI
HidPnp(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
{
UNIMPLEMENTED
ASSERT(FALSE);
return STATUS_NOT_IMPLEMENTED;
}
NTSTATUS
NTAPI
DriverEntry(
IN PDRIVER_OBJECT DriverObject,
IN PUNICODE_STRING RegPath)
{
HID_MINIDRIVER_REGISTRATION Registration;
NTSTATUS Status;
//
// initialize driver object
//
DriverObject->MajorFunction[IRP_MJ_CREATE] = HidCreate;
DriverObject->MajorFunction[IRP_MJ_CLOSE] = HidCreate;
DriverObject->MajorFunction[IRP_MJ_INTERNAL_DEVICE_CONTROL] = HidInternalDeviceControl;
DriverObject->MajorFunction[IRP_MJ_POWER] = HidPower;
DriverObject->MajorFunction[IRP_MJ_SYSTEM_CONTROL] = HidSystemControl;
DriverObject->MajorFunction[IRP_MJ_PNP] = HidPnp;
//
// prepare registration info
//
RtlZeroMemory(&Registration, sizeof(HID_MINIDRIVER_REGISTRATION));
//
// fill in registration info
//
Registration.Revision = HID_REVISION;
Registration.DriverObject = DriverObject;
Registration.RegistryPath = RegPath;
Registration.DeviceExtensionSize = sizeof(HID_USB_DEVICE_EXTENSION);
Registration.DevicesArePolled = FALSE;
//
// register driver
//
Status = HidRegisterMinidriver(&Registration);
//
// informal debug
//
DPRINT1("********* HIDUSB *********\n");
DPRINT1("HIDUSB Registration Status %x\n", Status);
return Status;
}
+22
View File
@@ -0,0 +1,22 @@
#pragma once
#define _HIDPI_
#define _HIDPI_NO_FUNCTION_MACROS_
#include <ntddk.h>
#include <hidport.h>
#include <debug.h>
typedef struct
{
//
// event for completion
//
KEVENT Event;
//
// list for pending requests
//
LIST_ENTRY PendingRequests;
}HID_USB_DEVICE_EXTENSION, *PHID_USB_DEVICE_EXTENSION;