Author: janderwald
Date: Tue Aug 30 16:01:00 2011
New Revision: 53500
URL: 
http://svn.reactos.org/svn/reactos?rev=53500&view=rev
Log:
[HIDUSB]
- 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
Added:
    branches/usb-bringup/drivers/usb/hidusb/   (with props)
    branches/usb-bringup/drivers/usb/hidusb/CMakeLists.txt   (with props)
    branches/usb-bringup/drivers/usb/hidusb/hidusb.c   (with props)
    branches/usb-bringup/drivers/usb/hidusb/hidusb.h   (with props)
Propchange: branches/usb-bringup/drivers/usb/hidusb/
------------------------------------------------------------------------------
--- bugtraq:logregex (added)
+++ bugtraq:logregex Tue Aug 30 16:01:00 2011
@@ -1,0 +1,2 @@
+([Ii]ssue|[Bb]ug)s? #?(\d+)(,? ?#?(\d+))*(,? ?(and |or )?#?(\d+))?
+(\d+)
Propchange: branches/usb-bringup/drivers/usb/hidusb/
------------------------------------------------------------------------------
    bugtraq:message = See issue #%BUGID% for more details.
Propchange: branches/usb-bringup/drivers/usb/hidusb/
------------------------------------------------------------------------------
    bugtraq:url = 
http://www.reactos.org/bugzilla/show_bug.cgi?id=%BUGID%
Propchange: branches/usb-bringup/drivers/usb/hidusb/
------------------------------------------------------------------------------
    tsvn:logminsize = 10
Added: branches/usb-bringup/drivers/usb/hidusb/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup/drivers/usb/hidusb/…
==============================================================================
--- branches/usb-bringup/drivers/usb/hidusb/CMakeLists.txt (added)
+++ branches/usb-bringup/drivers/usb/hidusb/CMakeLists.txt [iso-8859-1] Tue Aug 30
16:01:00 2011
@@ -1,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)
Propchange: branches/usb-bringup/drivers/usb/hidusb/CMakeLists.txt
------------------------------------------------------------------------------
    svn:eol-style = native
Added: branches/usb-bringup/drivers/usb/hidusb/hidusb.c
URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup/drivers/usb/hidusb/…
==============================================================================
--- branches/usb-bringup/drivers/usb/hidusb/hidusb.c (added)
+++ branches/usb-bringup/drivers/usb/hidusb/hidusb.c [iso-8859-1] Tue Aug 30 16:01:00 2011
@@ -1,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 (michael.martin(a)reactos.org)
+ *              Johannes Anderwald (johannes.anderwald(a)reactos.org)
+ */
+
+#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;
+}
Propchange: branches/usb-bringup/drivers/usb/hidusb/hidusb.c
------------------------------------------------------------------------------
    svn:eol-style = native
Added: branches/usb-bringup/drivers/usb/hidusb/hidusb.h
URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup/drivers/usb/hidusb/…
==============================================================================
--- branches/usb-bringup/drivers/usb/hidusb/hidusb.h (added)
+++ branches/usb-bringup/drivers/usb/hidusb/hidusb.h [iso-8859-1] Tue Aug 30 16:01:00 2011
@@ -1,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;
+
Propchange: branches/usb-bringup/drivers/usb/hidusb/hidusb.h
------------------------------------------------------------------------------
    svn:eol-style = native