Windows Device Power API

Discussion in 'Operating Systems' started by mbk1969, Jul 5, 2019.

  1. mbk1969

    mbk1969 Ancient Guru

    Messages:
    15,543
    Likes Received:
    13,562
    GPU:
    GF RTX 4070
    I just stumbled across Device Power API functions which can be used to enumerate devices capable to wake the system from the sleep state(s) and to enable\disable this feature.

    I can write an app to do that. Any interested gurus?

    Update:
    http://www.mediafire.com/file/ova8c4gxd4o62fy/DeviceWakeUtil.zip/file
    MD5 hash for zip-file: 16B3FCD69B8413FA4D1826E8F3F468B9
    Features:
    - Utility shows devices that are capable of being programmed to wake the system from a sleep state.
    - Utility shows both present and absent devices.
    - Devices can be sorted by name or hardware Id.
    - No need for elevation.
    - Built for .Net Framework 4.5.1 and newer.
    [​IMG]
     
    Last edited: Mar 16, 2020
    MerolaC likes this.
  2. EdKiefer

    EdKiefer Ancient Guru

    Messages:
    3,128
    Likes Received:
    394
    GPU:
    ASUS TUF 3060ti
  3. mbk1969

    mbk1969 Ancient Guru

    Messages:
    15,543
    Likes Received:
    13,562
    GPU:
    GF RTX 4070
  4. EdKiefer

    EdKiefer Ancient Guru

    Messages:
    3,128
    Likes Received:
    394
    GPU:
    ASUS TUF 3060ti
    I always go through Device manager after each update to make sure they're all off for ones I want off (I only leave Kb/mouse for wake up).
    I wondered if any hidden ones are there from device manager, it looks like there might be from the long list shown there.
    I think I only have network and USB in device manager.
     

  5. mbk1969

    mbk1969 Ancient Guru

    Messages:
    15,543
    Likes Received:
    13,562
    GPU:
    GF RTX 4070
    @EdKiefer
    There is a command "powercfg /devicequery wake_programmable" which should list devices that are user-configurable to wake the system from a sleep state.
     
    Last edited: Jul 6, 2019
  6. mbk1969

    mbk1969 Ancient Guru

    Messages:
    15,543
    Likes Received:
    13,562
    GPU:
    GF RTX 4070
    OP is updated with the link to utility bundle.

    @EdKiefer
    You can try the utility.
     
  7. EdKiefer

    EdKiefer Ancient Guru

    Messages:
    3,128
    Likes Received:
    394
    GPU:
    ASUS TUF 3060ti
    Yeah, that matches what I am familiar with in Device Manager.

    PS C:\WINDOWS\system32> powercfg /devicequery wake_programmable
    HID-compliant vendor-defined device
    Logitech G500s Gaming Mouse
    HID-compliant vendor-defined device (001)
    Intel(R) 82579V Gigabit Network Connection
    HID-compliant vendor-defined device (002)
    HID-compliant consumer control device
    HID Keyboard Device
    HID Keyboard Device (001)
    HID Keyboard Device (002)
    HID-compliant consumer control device (001)
    HID-compliant vendor-defined device (003)
     
  8. mbk1969

    mbk1969 Ancient Guru

    Messages:
    15,543
    Likes Received:
    13,562
    GPU:
    GF RTX 4070
    Problem with "powercfg -devicequery wake_from_any" command is it actually shows all devices which support wake from device sleep states D1, D2, D3. Devices do not understand system sleep states S0, S1, S2, ... But device sleep states can be mapped to system sleep states and so the query "powercfg -devicequery wake_from_any" show all devices which supports device sleep states and wake from them.
     
  9. EdKiefer

    EdKiefer Ancient Guru

    Messages:
    3,128
    Likes Received:
    394
    GPU:
    ASUS TUF 3060ti
    Ok, your app works, I didn't try to change anything as its all good but seems to match what I have set.
     
  10. mbk1969

    mbk1969 Ancient Guru

    Messages:
    15,543
    Likes Received:
    13,562
    GPU:
    GF RTX 4070
    I tested it with the help of "powercfg -devicequery wake_armed" command.

    PS Only bonus of utility - hardware Id along with the name of device.

    PPS May be I will add another column - whether device is currently present or not.
     

  11. EdKiefer

    EdKiefer Ancient Guru

    Messages:
    3,128
    Likes Received:
    394
    GPU:
    ASUS TUF 3060ti
    Maybe you know the answer, when you use device manager> view by the connection for example on kB and mouse, I see a few "HID-compliant vender-defined device" also "HID-compliant consumer control device" are these entries for extra features of the mouse KB?

    PS; I forgot you can see them in my post above.
     
  12. mbk1969

    mbk1969 Ancient Guru

    Messages:
    15,543
    Likes Received:
    13,562
    GPU:
    GF RTX 4070
    When I played Final Fantasy XIII (on PC) without gamepad the game suffered severe stuttering, and the workaround was to disable all these HID-compliant devices. Judging by the fact that keyboard and mouse do still work without those disabled devices all of them are optional.
     
  13. EdKiefer

    EdKiefer Ancient Guru

    Messages:
    3,128
    Likes Received:
    394
    GPU:
    ASUS TUF 3060ti
    Funny, you mention disabling them as I was googling them and that was most hits I got on info, many users said disabling to stop stutters in some circumstances. I don't suffer from these but I guess it is easy to see if they interfere with anything.
     
  14. mbk1969

    mbk1969 Ancient Guru

    Messages:
    15,543
    Likes Received:
    13,562
    GPU:
    GF RTX 4070
    Well, in case of FFXIII it is understandable - the game is developed with gamepad only. Then it was ported to PC, support for keyboard and mouse was added, but game still prefers gamepad, and the theory was the game constantly polls HID devices in search for gamepad.
     
    Last edited: Jul 7, 2019
  15. EdKiefer

    EdKiefer Ancient Guru

    Messages:
    3,128
    Likes Received:
    394
    GPU:
    ASUS TUF 3060ti
    So you think if win10 just had a default 2 button mouse and OEM KB, those entries would still be there, maybe they auto load for MS gamepads, but that doesn't sound right to do that, I would think on connecting gamepad those should pop up.

    I guess it would be easy to test.

    Edit; I can't disable any of them as I lose function to volume on KB and function Fx keys.
     
    Last edited: Jul 7, 2019

  16. Astyanax

    Astyanax Ancient Guru

    Messages:
    17,016
    Likes Received:
    7,355
    GPU:
    GTX 1080ti
  17. mbk1969

    mbk1969 Ancient Guru

    Messages:
    15,543
    Likes Received:
    13,562
    GPU:
    GF RTX 4070
  18. EdKiefer

    EdKiefer Ancient Guru

    Messages:
    3,128
    Likes Received:
    394
    GPU:
    ASUS TUF 3060ti
  19. mbk1969

    mbk1969 Ancient Guru

    Messages:
    15,543
    Likes Received:
    13,562
    GPU:
    GF RTX 4070
    After initial research I believe I can do that in this tool
    https://forums.guru3d.com/threads/utility-to-view-some-info-on-pci-devices.424175/

    Update: No, WMI does not implement methods for controlling power management on devices...
     
  20. MerolaC

    MerolaC Ancient Guru

    Messages:
    4,370
    Likes Received:
    1,082
    GPU:
    AsRock RX 6700XT
    Nice, this is great!
    Thank you, mbk!
     

Share This Page