Author: janderwald
Date: Mon Jan 12 09:57:49 2009
New Revision: 38723
URL:
http://svn.reactos.org/svn/reactos?rev=38723&view=rev
Log:
- Implement PcRequestNewPowerState
Modified:
trunk/reactos/drivers/wdm/audio/backpln/portcls/power.c
trunk/reactos/drivers/wdm/audio/backpln/portcls/stubs.c
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/power.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/power.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/power.c [iso-8859-1] Mon Jan 12
09:57:49 2009
@@ -36,3 +36,50 @@
DeviceExt->AdapterPowerManagement = pPower;
return STATUS_SUCCESS;
}
+
+
+static
+VOID
+NTAPI
+PwrCompletionCallback(
+ IN PDEVICE_OBJECT DeviceObject,
+ IN UCHAR MinorFunction,
+ IN POWER_STATE PowerState,
+ IN PVOID Context,
+ IN PIO_STATUS_BLOCK IoStatus)
+{
+ KeSetEvent((PRKEVENT)Context, IO_NO_INCREMENT, FALSE);
+}
+
+/*
+ * @implemented
+ */
+NTSTATUS NTAPI
+PcRequestNewPowerState(
+ IN PDEVICE_OBJECT DeviceObject,
+ IN DEVICE_POWER_STATE RequestedNewState)
+{
+ KEVENT Event;
+ NTSTATUS Status;
+ POWER_STATE PowerState;
+ PCExtension* DeviceExt;
+
+ if (!DeviceObject || !RequestedNewState)
+ return STATUS_INVALID_PARAMETER;
+
+ DeviceExt = (PCExtension*)DeviceObject->DeviceExtension;
+ KeInitializeEvent(&Event, SynchronizationEvent, FALSE);
+
+ PowerState.DeviceState = RequestedNewState;
+ PowerState.SystemState = PowerSystemUnspecified;
+
+ Status = PoRequestPowerIrp(DeviceExt->PhysicalDeviceObject, IRP_MN_SET_POWER,
PowerState, PwrCompletionCallback, (PVOID)&Event, NULL);
+ if (NT_SUCCESS(Status))
+ {
+ KeWaitForSingleObject((PVOID)&Event, Executive, KernelMode, FALSE, NULL);
+ }
+
+
+ return Status;
+}
+
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/stubs.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/stubs.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/stubs.c [iso-8859-1] Mon Jan 12
09:57:49 2009
@@ -11,29 +11,6 @@
#include "private.h"
#include <portcls.h>
-
-/*
- Factory Stubs
-*/
-
-
-
-/* ===============================================================
- Power Management
-*/
-
-/*
- * @unimplemented
- */
-NTSTATUS NTAPI
-PcRequestNewPowerState(
- IN PDEVICE_OBJECT pDeviceObject,
- IN DEVICE_POWER_STATE RequestedNewState)
-{
- UNIMPLEMENTED;
- return STATUS_UNSUCCESSFUL;
-}
-
/* ===============================================================
Properties