Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results

Home NTDEV

Before Posting...

Please check out the Community Guidelines in the Announcements and Administration Category.

More Info on Driver Writing and Debugging


The free OSR Learning Library has more than 50 articles on a wide variety of topics about writing and debugging device drivers and Minifilters. From introductory level to advanced. All the articles have been recently reviewed and updated, and are written using the clear and definitive style you've come to expect from OSR over the years.


Check out The OSR Learning Library at: https://www.osr.com/osr-learning-library/


NIDS PowerManagementCapabilitiesEx parameters

mark-4mark-4 Member Posts: 73

Hello. I'm an NDIS newbie so apologies if I'm not explaining this well. I'm trying to enable wake on lan functionality for a NDIS miniport (6.40) . As as starting point I've enabled set the PowerManagementCapabilitiesEx of the NDIS_MINIPORT_ADAPTER_REGISTRATION_ATTRIBUTES
to variations of the following

NdisZeroMemory(npmc, sizeof(NDIS_PM_CAPABILITIES));

npmc->Header.Type = NDIS_OBJECT_TYPE_DEFAULT;
npmc->Header.Revision = NDIS_PM_CAPABILITIES_REVISION_2; // NDIS 6.30
npmc->Header.Size = NDIS_SIZEOF_NDIS_PM_CAPABILITIES_REVISION_2; // NDIS 6.30

npmc->MinMagicPacketWakeUp = NdisDeviceStateD3;
npmc->MinPatternWakeUp = NdisDeviceStateD3;
npmc->MinLinkChangeWakeUp = NdisDeviceStateUnspecified;
npmc->SupportedWoLPacketPatterns = NDIS_PM_WOL_MAGIC_PACKET_SUPPORTED | NDIS_PM_WOL_BITMAP_PATTERN_SUPPORTED;
npmc->SupportedProtocolOffloads = NDIS_PM_PROTOCOL_OFFLOAD_ARP_SUPPORTED;

And I've cleared the NDIS_MINIPORT_ATTRIBUTES_NO_HALT_ON_SUSPEND flag in the registration attributes per the guidance in https://community.osr.com/discussion/comment/193372#Comment_193372.

When I run !ndiskd.miniport ffffe502bef741a0 -pm it reports that none of these are set

Wake event Minimum power required
Magic packet Not supported
Bitmap pattern Not supported
Link change Not supported

Active Capabilities (OID_PM_PARAMETERS):
WoL patterns       [No flags set]
Protocol offloads  [No flags set]
Wake flags         [No flags set]

I don't see the Power managemnt tab in device manager. Moreover if I look at the power data via device manager's details tab I see

Power Capabiliies
PDCAP_D0_D3_SUPPORTED
PDCAP_D3_SUPPORTED

But not for exmaple the PDCAP_WAKE_FROM_D3_SUPPORTED

In addition I'm not seeing the query for power related OIDs: Specifically OID_PM_PARAMETERS.
It feels lke the parameters I set via PowerManagementCapabilitiesEx. Can anybody see anything obviously wrong with this? And should I expect to at least see the power management tab once I've enabled this?

Comments

  • Mark_RoddyMark_Roddy Member - All Emails Posts: 4,559

    You seem to be missing a lot of the pm settings used in the sample ndis6.3 on github here:
    https://github.com/microsoft/Windows-driver-samples/blob/110e8c201d5a929fc01e333ceac0dc71b0267237/network/wlan/WDI/PLATFORM/NDIS6/SDIO/N6Sdio_main.c#L6376

    For example, are you setting npmc->NumTotalWoLPatterns ?

  • mark-4mark-4 Member Posts: 73

    Hi Mark. Thanks for the helpful response and the reference. I've been experimenting with various permutations of these but not really making any progress. I'm wondering now whether this is even possible in my scenario. This is basically a research task for a virtual adapter on a split-tunnel to see if we can wake the computer when a magic packet is sent to the virtual adapter. I was perhaps naively thinking to forward any WOL packets for the virtual adapter to the physical network interface which already supports WOL. Am I correct in understanding that the virtual adapter's driver should still be active when the machine is sleeping (I thought this was the case but it's difficult to debug over the network while the target is sleeping. The USB ports on my target don't support Debugging though I assume I would have the same problem with USB debugging too?

  • Mark_RoddyMark_Roddy Member - All Emails Posts: 4,559

    If you are trying to wake the host by sending something to one of its vms, that seems not likely to work.
    However, if the PM property page for your virtual adapter is not showing up then you are not setting the poorly documented fields for PM correctly. I would get that working first, or maybe not at all if in fact you really are attempting to wake up the host by sending a packet to it's vm. I think you need to wake up the host first?

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. Sign in or register to get started.

Upcoming OSR Seminars
OSR has suspended in-person seminars due to the Covid-19 outbreak. But, don't miss your training! Attend via the internet instead!
Writing WDF Drivers 12 September 2022 Live, Online
Internals & Software Drivers 23 October 2022 Live, Online
Kernel Debugging 14 November 2022 Live, Online
Developing Minifilters 5 December 2022 Live, Online