2 * PROJECT: ReactOS Universal Serial Bus Human Interface Device Driver
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: drivers/usb/hidusb/hidusb.c
5 * PURPOSE: HID USB Interface Driver
7 * Michael Martin (michael.martin@reactos.org)
8 * Johannes Anderwald (johannes.anderwald@reactos.org)
16 IN PDEVICE_OBJECT DeviceObject
,
19 PIO_STACK_LOCATION IoStack
;
22 // get current irp stack location
24 IoStack
= IoGetCurrentIrpStackLocation(Irp
);
27 // sanity check for hidclass driver
29 ASSERT(IoStack
->MajorFunction
== IRP_MJ_CREATE
|| IoStack
->MajorFunction
== IRP_MJ_CLOSE
);
34 Irp
->IoStatus
.Information
= 0;
35 Irp
->IoStatus
.Status
= STATUS_SUCCESS
;
36 IoCompleteRequest(Irp
, IO_NO_INCREMENT
);
39 // informal debug print
41 DPRINT1("HIDUSB Request: %x\n", IoStack
->MajorFunction
);
46 return STATUS_SUCCESS
;
51 HidInternalDeviceControl(
52 IN PDEVICE_OBJECT DeviceObject
,
57 return STATUS_NOT_IMPLEMENTED
;
63 IN PDEVICE_OBJECT DeviceObject
,
68 return STATUS_NOT_IMPLEMENTED
;
74 IN PDEVICE_OBJECT DeviceObject
,
77 PHID_DEVICE_EXTENSION DeviceExtension
;
80 // get hid device extension
82 DeviceExtension
= (PHID_DEVICE_EXTENSION
)DeviceObject
->DeviceExtension
;
85 // copy stack location
87 IoCopyCurrentIrpStackLocationToNext(Irp
);
92 return IoCallDriver(DeviceExtension
->NextDeviceObject
, Irp
);
98 IN PDEVICE_OBJECT DeviceObject
,
103 return STATUS_NOT_IMPLEMENTED
;
109 IN PDRIVER_OBJECT DriverObject
,
110 IN PUNICODE_STRING RegPath
)
112 HID_MINIDRIVER_REGISTRATION Registration
;
116 // initialize driver object
118 DriverObject
->MajorFunction
[IRP_MJ_CREATE
] = HidCreate
;
119 DriverObject
->MajorFunction
[IRP_MJ_CLOSE
] = HidCreate
;
120 DriverObject
->MajorFunction
[IRP_MJ_INTERNAL_DEVICE_CONTROL
] = HidInternalDeviceControl
;
121 DriverObject
->MajorFunction
[IRP_MJ_POWER
] = HidPower
;
122 DriverObject
->MajorFunction
[IRP_MJ_SYSTEM_CONTROL
] = HidSystemControl
;
123 DriverObject
->MajorFunction
[IRP_MJ_PNP
] = HidPnp
;
126 // prepare registration info
128 RtlZeroMemory(&Registration
, sizeof(HID_MINIDRIVER_REGISTRATION
));
131 // fill in registration info
133 Registration
.Revision
= HID_REVISION
;
134 Registration
.DriverObject
= DriverObject
;
135 Registration
.RegistryPath
= RegPath
;
136 Registration
.DeviceExtensionSize
= sizeof(HID_USB_DEVICE_EXTENSION
);
137 Registration
.DevicesArePolled
= FALSE
;
142 Status
= HidRegisterMinidriver(&Registration
);
147 DPRINT1("********* HIDUSB *********\n");
148 DPRINT1("HIDUSB Registration Status %x\n", Status
);