Author: janderwald
Date: Sun Dec 25 20:21:34 2011
New Revision: 54759
URL:
http://svn.reactos.org/svn/reactos?rev=54759&view=rev
Log:
[USB-BRINGUP]
- add template for hidclass driver
- fix hidusb build
Added:
branches/usb-bringup/drivers/hid/hidclass/ (with props)
branches/usb-bringup/drivers/hid/hidclass/CMakeLists.txt (with props)
branches/usb-bringup/drivers/hid/hidclass/hidclass.c (with props)
branches/usb-bringup/drivers/hid/hidclass/hidclass.rc (with props)
branches/usb-bringup/drivers/hid/hidclass/hidclass.spec (with props)
branches/usb-bringup/drivers/hid/hidclass/precomp.h (with props)
branches/usb-bringup/drivers/hid/hidusb/hidusb.rc (with props)
Modified:
branches/usb-bringup/drivers/hid/CMakeLists.txt
branches/usb-bringup/drivers/hid/hidusb/CMakeLists.txt
branches/usb-bringup/drivers/hid/hidusb/hidusb.c
branches/usb-bringup/include/ddk/hidclass.h
branches/usb-bringup/include/ddk/hidport.h
Modified: branches/usb-bringup/drivers/hid/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup/drivers/hid/CMakeLi…
==============================================================================
--- branches/usb-bringup/drivers/hid/CMakeLists.txt [iso-8859-1] (original)
+++ branches/usb-bringup/drivers/hid/CMakeLists.txt [iso-8859-1] Sun Dec 25 20:21:34 2011
@@ -1,2 +1,3 @@
+add_subdirectory(hidclass)
add_subdirectory(hidparse)
add_subdirectory(hidusb)
Propchange: branches/usb-bringup/drivers/hid/hidclass/
------------------------------------------------------------------------------
--- bugtraq:logregex (added)
+++ bugtraq:logregex Sun Dec 25 20:21:34 2011
@@ -1,0 +1,2 @@
+([Ii]ssue|[Bb]ug)s? #?(\d+)(,? ?#?(\d+))*(,? ?(and |or )?#?(\d+))?
+(\d+)
Propchange: branches/usb-bringup/drivers/hid/hidclass/
------------------------------------------------------------------------------
bugtraq:message = See issue #%BUGID% for more details.
Propchange: branches/usb-bringup/drivers/hid/hidclass/
------------------------------------------------------------------------------
bugtraq:url =
http://www.reactos.org/bugzilla/show_bug.cgi?id=%BUGID%
Propchange: branches/usb-bringup/drivers/hid/hidclass/
------------------------------------------------------------------------------
tsvn:logminsize = 10
Added: branches/usb-bringup/drivers/hid/hidclass/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup/drivers/hid/hidclas…
==============================================================================
--- branches/usb-bringup/drivers/hid/hidclass/CMakeLists.txt (added)
+++ branches/usb-bringup/drivers/hid/hidclass/CMakeLists.txt [iso-8859-1] Sun Dec 25
20:21:34 2011
@@ -1,0 +1,19 @@
+
+spec2def(hidclass.sys hidclass.spec)
+
+list(APPEND SOURCE
+ hidclass.c
+ hidclass.rc
+ ${CMAKE_CURRENT_BINARY_DIR}/hidclass.def)
+
+add_library(hidclass SHARED ${SOURCE})
+
+set_entrypoint(hidclass 0)
+set_image_base(hidclass 0x00010000)
+set_subsystem(hidclass native)
+set_target_properties(hidclass PROPERTIES SUFFIX ".sys")
+
+
+add_importlibs(hidclass ntoskrnl hidparse hal)
+add_cab_target(hidclass 2)
+add_importlib_target(hidclass.spec)
Propchange: branches/usb-bringup/drivers/hid/hidclass/CMakeLists.txt
------------------------------------------------------------------------------
svn:eol-style = native
Added: branches/usb-bringup/drivers/hid/hidclass/hidclass.c
URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup/drivers/hid/hidclas…
==============================================================================
--- branches/usb-bringup/drivers/hid/hidclass/hidclass.c (added)
+++ branches/usb-bringup/drivers/hid/hidclass/hidclass.c [iso-8859-1] Sun Dec 25 20:21:34
2011
@@ -1,0 +1,116 @@
+/*
+ * PROJECT: ReactOS Universal Serial Bus Human Interface Device Driver
+ * LICENSE: GPL - See COPYING in the top level directory
+ * FILE: drivers/hid/hidclass/hidclass.c
+ * PURPOSE: HID Class Driver
+ * PROGRAMMERS:
+ * Michael Martin (michael.martin(a)reactos.org)
+ * Johannes Anderwald (johannes.anderwald(a)reactos.org)
+ */
+
+#include "precomp.h"
+
+static LPWSTR ClientIdentificationAddress = L"HIDCLASS";
+
+ULONG
+NTAPI
+DllInitialize(ULONG Unknown)
+{
+ return 0;
+}
+
+ULONG
+NTAPI
+DllUnload()
+{
+ return 0;
+}
+
+NTSTATUS
+NTAPI
+HidClassAddDevice(
+ IN PDRIVER_OBJECT DriverObject,
+ IN PDEVICE_OBJECT PhysicalDeviceObject)
+{
+ UNIMPLEMENTED
+ ASSERT(FALSE);
+ return STATUS_NOT_IMPLEMENTED;
+}
+
+NTSTATUS
+NTAPI
+HidClassDriverUnload(
+ IN PDRIVER_OBJECT DriverObject)
+{
+ UNIMPLEMENTED
+ ASSERT(FALSE);
+ return STATUS_NOT_IMPLEMENTED;
+}
+
+NTSTATUS
+NTAPI
+HidClassDispatch(
+ IN PDEVICE_OBJECT DeviceObject,
+ IN PIRP Irp)
+{
+ UNIMPLEMENTED
+ ASSERT(FALSE);
+ return STATUS_NOT_IMPLEMENTED;
+}
+
+NTSTATUS
+NTAPI
+HidRegisterMinidriver(
+ IN PHID_MINIDRIVER_REGISTRATION MinidriverRegistration)
+{
+ NTSTATUS Status;
+ PHIDCLASS_DRIVER_EXTENSION DriverExtension;
+
+ /* check if the version matches */
+ if (MinidriverRegistration->Revision > HID_REVISION)
+ {
+ /* revision mismatch */
+ ASSERT(FALSE);
+ return STATUS_REVISION_MISMATCH;
+ }
+
+ /* now allocate the driver object extension */
+ Status = IoAllocateDriverObjectExtension(MinidriverRegistration->DriverObject,
(PVOID)ClientIdentificationAddress, sizeof(HIDCLASS_DRIVER_EXTENSION),
(PVOID*)&DriverExtension);
+ if (!NT_SUCCESS(Status))
+ {
+ /* failed to allocate driver extension */
+ ASSERT(FALSE);
+ return Status;
+ }
+
+ /* zero driver extension */
+ RtlZeroMemory(DriverExtension, sizeof(HIDCLASS_DRIVER_EXTENSION));
+
+ /* init driver extension */
+ DriverExtension->DriverObject = MinidriverRegistration->DriverObject;
+ DriverExtension->DeviceExtensionSize =
MinidriverRegistration->DeviceExtensionSize;
+ DriverExtension->DevicesArePolled = MinidriverRegistration->DevicesArePolled;
+ DriverExtension->AddDevice =
MinidriverRegistration->DriverObject->DriverExtension->AddDevice;
+ DriverExtension->DriverUnload =
MinidriverRegistration->DriverObject->DriverUnload;
+
+ /* copy driver dispatch routines */
+ RtlCopyMemory(DriverExtension->MajorFunction,
MinidriverRegistration->DriverObject->MajorFunction, sizeof(PDRIVER_DISPATCH) *
IRP_MJ_MAXIMUM_FUNCTION);
+
+ /* initialize lock */
+ KeInitializeSpinLock(&DriverExtension->Lock);
+
+ /* now replace dispatch routines */
+ DriverExtension->DriverObject->DriverExtension->AddDevice =
HidClassAddDevice;
+ DriverExtension->DriverObject->DriverUnload = HidClassDriverUnload;
+ DriverExtension->DriverObject->MajorFunction[IRP_MJ_CREATE] =
HidClassDispatch;
+ DriverExtension->DriverObject->MajorFunction[IRP_MJ_CLOSE] = HidClassDispatch;
+ DriverExtension->DriverObject->MajorFunction[IRP_MJ_READ] = HidClassDispatch;
+ DriverExtension->DriverObject->MajorFunction[IRP_MJ_WRITE] = HidClassDispatch;
+ DriverExtension->DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] =
HidClassDispatch;
+ DriverExtension->DriverObject->MajorFunction[IRP_MJ_INTERNAL_DEVICE_CONTROL] =
HidClassDispatch;
+ DriverExtension->DriverObject->MajorFunction[IRP_MJ_POWER] = HidClassDispatch;
+ DriverExtension->DriverObject->MajorFunction[IRP_MJ_PNP] = HidClassDispatch;
+
+ /* done */
+ return STATUS_SUCCESS;
+}
Propchange: branches/usb-bringup/drivers/hid/hidclass/hidclass.c
------------------------------------------------------------------------------
svn:eol-style = native
Added: branches/usb-bringup/drivers/hid/hidclass/hidclass.rc
URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup/drivers/hid/hidclas…
==============================================================================
--- branches/usb-bringup/drivers/hid/hidclass/hidclass.rc (added)
+++ branches/usb-bringup/drivers/hid/hidclass/hidclass.rc [iso-8859-1] Sun Dec 25 20:21:34
2011
@@ -1,0 +1,5 @@
+#define REACTOS_VERSION_DLL
+#define REACTOS_STR_FILE_DESCRIPTION "USB HID Bus Driver\0"
+#define REACTOS_STR_INTERNAL_NAME "hidclass\0"
+#define REACTOS_STR_ORIGINAL_FILENAME "hidclass.sys\0"
+#include <reactos/version.rc>
Propchange: branches/usb-bringup/drivers/hid/hidclass/hidclass.rc
------------------------------------------------------------------------------
svn:eol-style = native
Added: branches/usb-bringup/drivers/hid/hidclass/hidclass.spec
URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup/drivers/hid/hidclas…
==============================================================================
--- branches/usb-bringup/drivers/hid/hidclass/hidclass.spec (added)
+++ branches/usb-bringup/drivers/hid/hidclass/hidclass.spec [iso-8859-1] Sun Dec 25
20:21:34 2011
@@ -1,0 +1,4 @@
+@ stdcall -private DllInitialize(long)
+@ stdcall -private DllUnload()
+@ stdcall HidRegisterMinidriver(ptr)
+
Propchange: branches/usb-bringup/drivers/hid/hidclass/hidclass.spec
------------------------------------------------------------------------------
svn:eol-style = native
Added: branches/usb-bringup/drivers/hid/hidclass/precomp.h
URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup/drivers/hid/hidclas…
==============================================================================
--- branches/usb-bringup/drivers/hid/hidclass/precomp.h (added)
+++ branches/usb-bringup/drivers/hid/hidclass/precomp.h [iso-8859-1] Sun Dec 25 20:21:34
2011
@@ -1,0 +1,19 @@
+#pragma once
+
+#define _HIDPI_NO_FUNCTION_MACROS_
+#include <ntddk.h>
+#include <hidport.h>
+#include <debug.h>
+
+
+typedef struct
+{
+ PDRIVER_OBJECT DriverObject;
+ ULONG DeviceExtensionSize;
+ BOOLEAN DevicesArePolled;
+ PDRIVER_DISPATCH MajorFunction[IRP_MJ_MAXIMUM_FUNCTION];
+ PDRIVER_ADD_DEVICE AddDevice;
+ PDRIVER_UNLOAD DriverUnload;
+ KSPIN_LOCK Lock;
+
+}HIDCLASS_DRIVER_EXTENSION, *PHIDCLASS_DRIVER_EXTENSION;
Propchange: branches/usb-bringup/drivers/hid/hidclass/precomp.h
------------------------------------------------------------------------------
svn:eol-style = native
Modified: branches/usb-bringup/drivers/hid/hidusb/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup/drivers/hid/hidusb/…
==============================================================================
--- branches/usb-bringup/drivers/hid/hidusb/CMakeLists.txt [iso-8859-1] (original)
+++ branches/usb-bringup/drivers/hid/hidusb/CMakeLists.txt [iso-8859-1] Sun Dec 25
20:21:34 2011
@@ -1,11 +1,11 @@
list(APPEND SOURCE
hidusb.c
- usbhub.rc)
+ hidusb.rc)
add_library(hidusb SHARED ${SOURCE})
set_module_type(hidusb kernelmodedriver)
add_importlibs(hidusb hidclass ntoskrnl usbd)
-add_cab_target(usbhub 2)
+add_cab_target(hidusb 2)
Modified: branches/usb-bringup/drivers/hid/hidusb/hidusb.c
URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup/drivers/hid/hidusb/…
==============================================================================
--- branches/usb-bringup/drivers/hid/hidusb/hidusb.c [iso-8859-1] (original)
+++ branches/usb-bringup/drivers/hid/hidusb/hidusb.c [iso-8859-1] Sun Dec 25 20:21:34
2011
@@ -89,7 +89,7 @@
//
// submit request
//
- return IoCallDriver(DeviceExtension->NextDeviceObject);
+ return IoCallDriver(DeviceExtension->NextDeviceObject, Irp);
}
NTSTATUS
Added: branches/usb-bringup/drivers/hid/hidusb/hidusb.rc
URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup/drivers/hid/hidusb/…
==============================================================================
--- branches/usb-bringup/drivers/hid/hidusb/hidusb.rc (added)
+++ branches/usb-bringup/drivers/hid/hidusb/hidusb.rc [iso-8859-1] Sun Dec 25 20:21:34
2011
@@ -1,0 +1,5 @@
+#define REACTOS_VERSION_DLL
+#define REACTOS_STR_FILE_DESCRIPTION "USB HID Interface Driver\0"
+#define REACTOS_STR_INTERNAL_NAME "hidusb\0"
+#define REACTOS_STR_ORIGINAL_FILENAME "hidusb.sys\0"
+#include <reactos/version.rc>
Propchange: branches/usb-bringup/drivers/hid/hidusb/hidusb.rc
------------------------------------------------------------------------------
svn:eol-style = native
Modified: branches/usb-bringup/include/ddk/hidclass.h
URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup/include/ddk/hidclas…
==============================================================================
--- branches/usb-bringup/include/ddk/hidclass.h [iso-8859-1] (original)
+++ branches/usb-bringup/include/ddk/hidclass.h [iso-8859-1] Sun Dec 25 20:21:34 2011
@@ -75,14 +75,6 @@
#define IOCTL_HID_SET_DRIVER_CONFIG HID_BUFFER_CTL_CODE(101)
#define IOCTL_HID_GET_INDEXED_STRING HID_OUT_CTL_CODE(120)
#define IOCTL_HID_GET_MS_GENRE_DESCRIPTOR HID_OUT_CTL_CODE(121)
-
-/* FIXME: these values are wrong! */
-#define IOCTL_HID_GET_STRING 0
-#define IOCTL_HID_GET_DEVICE_ATTRIBUTES 1
-#define IOCTL_HID_GET_DEVICE_DESCRIPTOR 2
-#define IOCTL_HID_READ_REPORT 3
-#define IOCTL_HID_WRITE_REPORT 4
-#define IOCTL_HID_GET_REPORT_DESCRIPTOR 5
typedef enum _HID_STRING_TYPE
{
Modified: branches/usb-bringup/include/ddk/hidport.h
URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup/include/ddk/hidport…
==============================================================================
--- branches/usb-bringup/include/ddk/hidport.h [iso-8859-1] (original)
+++ branches/usb-bringup/include/ddk/hidport.h [iso-8859-1] Sun Dec 25 20:21:34 2011
@@ -50,8 +50,8 @@
typedef
VOID
-(*HID_SEND_IDLE_CALLBACK)(
- __in PVOID Context
+(NTAPI *HID_SEND_IDLE_CALLBACK)(
+ IN PVOID Context
);
typedef struct _HID_SUBMIT_IDLE_NOTIFICATION_CALLBACK_INFO