[USBSTOR]
authorJohannes Anderwald <johannes.anderwald@reactos.org>
Sun, 26 May 2013 17:18:19 +0000 (17:18 +0000)
committerJohannes Anderwald <johannes.anderwald@reactos.org>
Sun, 26 May 2013 17:18:19 +0000 (17:18 +0000)
- Hackplement IRP_MJ_POWER support
- Inspired by Thomas (Blame him ;))

svn path=/trunk/; revision=59084

reactos/drivers/usb/usbstor/usbstor.c

index fb7f70f..44daca0 100644 (file)
@@ -212,12 +212,24 @@ USBSTOR_DispatchPower(
     PDEVICE_OBJECT DeviceObject,
     PIRP Irp)
 {
-    UNIMPLEMENTED
+    PFDO_DEVICE_EXTENSION DeviceExtension;
 
-    Irp->IoStatus.Information = 0;
-    Irp->IoStatus.Status = STATUS_SUCCESS;
-    IoCompleteRequest(Irp, IO_NO_INCREMENT);
-    return STATUS_SUCCESS;
+    // get common device extension
+    DeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
+
+    if (DeviceExtension->Common.IsFDO)
+    {
+        PoStartNextPowerIrp(Irp);
+        IoSkipCurrentIrpStackLocation(Irp);
+        return PoCallDriver(DeviceExtension->LowerDeviceObject, Irp);
+    }
+    else
+    {
+        PoStartNextPowerIrp(Irp);
+        Irp->IoStatus.Status = STATUS_SUCCESS;
+        IoCompleteRequest(Irp, IO_NO_INCREMENT);
+        return STATUS_SUCCESS;
+    }
 }