1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Windows Device Power API

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

  1. mbk1969

    mbk1969 Ancient Guru

    Messages:
    7,312
    Likes Received:
    3,828
    GPU:
    GeForce GTX 1070
    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
    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: Jul 6, 2019
  2. EdKiefer

    EdKiefer Ancient Guru

    Messages:
    2,202
    Likes Received:
    160
    GPU:
    MSI 970 Gaming 4G
  3. mbk1969

    mbk1969 Ancient Guru

    Messages:
    7,312
    Likes Received:
    3,828
    GPU:
    GeForce GTX 1070
  4. EdKiefer

    EdKiefer Ancient Guru

    Messages:
    2,202
    Likes Received:
    160
    GPU:
    MSI 970 Gaming 4G
    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:
    7,312
    Likes Received:
    3,828
    GPU:
    GeForce GTX 1070
    @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:
    7,312
    Likes Received:
    3,828
    GPU:
    GeForce GTX 1070
    OP is updated with the link to utility bundle.

    @EdKiefer
    You can try the utility.
     
  7. EdKiefer

    EdKiefer Ancient Guru

    Messages:
    2,202
    Likes Received:
    160
    GPU:
    MSI 970 Gaming 4G
    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:
    7,312
    Likes Received:
    3,828
    GPU:
    GeForce GTX 1070
    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:
    2,202
    Likes Received:
    160
    GPU:
    MSI 970 Gaming 4G
    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:
    7,312
    Likes Received:
    3,828
    GPU:
    GeForce GTX 1070
    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:
    2,202
    Likes Received:
    160
    GPU:
    MSI 970 Gaming 4G
    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:
    7,312
    Likes Received:
    3,828
    GPU:
    GeForce GTX 1070
    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:
    2,202
    Likes Received:
    160
    GPU:
    MSI 970 Gaming 4G
    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:
    7,312
    Likes Received:
    3,828
    GPU:
    GeForce GTX 1070
    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:
    2,202
    Likes Received:
    160
    GPU:
    MSI 970 Gaming 4G
    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

Share This Page