Rename drivers to their right name
[reactos.git] / reactos / drivers / usb / usbport / usbcore.c
1 /*
2 ReactOS specific functions for usbcore module
3 by Aleksey Bragin (aleksey@reactos.com)
4 */
5
6 #include <ddk/ntddk.h>
7 #include <debug.h>
8 #include "../usb_wrapper.h"
9
10 USBPORT_INTERFACE UsbPortInterface;
11
12 void STDCALL RegisterPortDriver(PDRIVER_OBJECT pDrvObj, PUSBPORT_INTERFACE pUsbPortIntf)
13 {
14 // copy struct to global var
15 DPRINT("Miniport 0x%08X registered\n", (ULONG)pDrvObj);
16 memcpy(&UsbPortInterface.KbdConnectData, &pUsbPortIntf->KbdConnectData, sizeof(CONNECT_DATA));
17 memcpy(&UsbPortInterface.MouseConnectData, &pUsbPortIntf->MouseConnectData, sizeof(CONNECT_DATA));
18 }
19
20 NTSTATUS STDCALL
21 AddDevice(PDRIVER_OBJECT DriverObject, PDEVICE_OBJECT pdo)
22 {
23 DbgPrint("usbcore: AddDevice called\n");
24
25 /* we need to do kind of this stuff here (as usual)
26 PDEVICE_OBJECT fdo;
27 IoCreateDevice(..., &fdo);
28 pdx->LowerDeviceObject =
29 IoAttachDeviceToDeviceStack(fdo, pdo);*/
30
31 return STATUS_SUCCESS;
32 }
33
34 VOID STDCALL
35 DriverUnload(PDRIVER_OBJECT DriverObject)
36 {
37 // nothing to do here yet
38 }
39
40 // Dispatch PNP
41 NTSTATUS STDCALL
42 DispatchPnp(PDEVICE_OBJECT fdo, PIRP Irp)
43 {
44 ULONG fcn;
45 PIO_STACK_LOCATION stack;
46
47 stack = IoGetCurrentIrpStackLocation(Irp);
48 fcn = stack->MinorFunction;
49 DbgPrint("IRP_MJ_PNP, fcn=%d\n", fcn);
50
51 if (fcn == IRP_MN_REMOVE_DEVICE)
52 {
53 IoDeleteDevice(fdo);
54 }
55
56 return STATUS_SUCCESS;
57 }
58
59 NTSTATUS STDCALL
60 DispatchPower(PDEVICE_OBJECT fido, PIRP Irp)
61 {
62 DbgPrint("IRP_MJ_POWER dispatch\n");
63 return STATUS_SUCCESS;
64 }
65
66 /*
67 * Standard DriverEntry method.
68 */
69 NTSTATUS STDCALL
70 DriverEntry(IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegPath)
71 {
72 DriverObject->DriverUnload = DriverUnload;
73 DriverObject->DriverExtension->AddDevice = AddDevice;
74 DriverObject->MajorFunction[IRP_MJ_PNP] = DispatchPnp;
75 DriverObject->MajorFunction[IRP_MJ_POWER] = DispatchPower;
76
77 return STATUS_SUCCESS;
78 }