Hello everyone.

The Mixed Reality Forums here are no longer being used or maintained.

There are a few other places we would like to direct you to for support, both from Microsoft and from the community.

The first way we want to connect with you is our mixed reality developer program, which you can sign up for at https://aka.ms/IWantMR.

For technical questions, please use Stack Overflow, and tag your questions using either hololens or windows-mixed-reality.

If you want to join in discussions, please do so in the HoloDevelopers Slack, which you can join by going to https://aka.ms/holodevelopers, or in our Microsoft Tech Communities forums at https://techcommunity.microsoft.com/t5/mixed-reality/ct-p/MicrosoftMixedReality.

And always feel free to hit us up on Twitter @MxdRealityDev.

Prevent HoloLens from going to sleep

Is there a way to disable HoloLens from going to sleep. On device portal, I can only choose when will HoloLens go to sleep, but I cannot disable it.

I have a problem because it goes to sleep while my application is active.

Best Answer

Answers

  • I believe (though I'm not positive) that the device will not sleep when the Visual Studio debugger is attached. I understand it is going to sleep while your application is active, but are you saying it's going to sleep when someone is using the device? That shouldn't be happening. If you're saying it's going to sleep when they take the device off and set it on the table, that's by design. Is there a reason you don't want this to happen?

    Our Holographic world is here

    RoadToHolo.com      WikiHolo.net      @jbienz
    I work in Developer Experiences at Microsoft. My posts are based on my own experience and don't represent Microsoft or HoloLens.

  • DaTruAndiDaTruAndi ✭✭
    edited February 2017

    In the device portal you find the following settings.
    Sleep settings
    When on battery, go to sleep after
    When plugged in, go to sleep after
    By default that is
    2 minutes, 3 minutes, 5 minutes, 10 minutes, 20 minutes, 30 minutes.

    I believe you can "hack" the corresponding seconds (see below) in the "inspect" mode of the browser (or set it through code) to other values.
    I set it to "0" for fun (when plugged in) and I BELIEVE it does not go to sleep now.

    
    2 minutes3 minutes5 minutes10 minutes20 minutes30 minutes
    2 minutes3 minutes5 minutes10 minutes20 minutes30 minutes
    
    
  • @jbienzms said:
    I believe (though I'm not positive) that the device will not sleep when the Visual Studio debugger is attached. I understand it is going to sleep while your application is active, but are you saying it's going to sleep when someone is using the device? That shouldn't be happening. If you're saying it's going to sleep when they take the device off and set it on the table, that's by design. Is there a reason you don't want this to happen?

    It does not go to sleep while debugger is attached, and it also does not go to sleep while someone is using it. But as you said it goes to sleep while it is on the table.

    I don't want it to go to sleep because it is connected to my server and sending data, and I am doing tests on server application and need HoloLens to stay awake.

    @DaTruAndi
    Thank you for your answer. I will try your method.

  • @Xarthisius Did that work for you?

  • @danbo2468 said:
    @Xarthisius Did that work for you?

    yes, it works

  • edited May 2017

    http://127.0.0.1:10080/api/power/cfg/SCHEME_CURRENT/SUB_SLEEP/STANDBYIDLE?ValueAC=0&ValueDC=0

    http://127.0.0.1:10080/api/power/cfg/SCHEME_CURRENT/SUB_SLEEP/VIDEOIDLE?ValueAC=0&ValueDC=0

    after testing, it's the above post request that will set the hololens to "non-sleep" mode.

    Above is what you should have after the configuration is set successfully(you have to login first and then send this request, you may consider using postman)

  • http://127.0.0.1:10080/api/power/cfg/SCHEME_CURRENT/SUB_SLEEP/VIDEOIDLE?ValueAC=0&ValueDC=0

    http://127.0.0.1:10080/api/power/cfg/SCHEME_CURRENT/SUB_SLEEP/STANDBYIDLE?ValueAC=0&ValueDC=0

    try these two post requests after connected to your hololens.

  • JayZuoJayZuo mod
    edited January 2018

    The following is one easy way to prevent HoloLens from going to sleep when it is plugged in.

    1. Log into Windows Device Portal.
    2. Press F12 to open Developer Tools on this page.
    3. Select Console in Developer Tools.
    4. Use Fetch API to send the following two post requests.
    fetch("/api/power/cfg/SCHEME_CURRENT/SUB_SLEEP/STANDBYIDLE?ValueAC=0&ValueDC=180", {
        method: "POST",
        headers: new Headers({
            'X-CSRF-Token': document.cookie.match(new RegExp('CSRF-Token=([^;]+)'))[1]
        }),
        credentials: "same-origin"
    })
    
    fetch("/api/power/cfg/SCHEME_CURRENT/SUB_VIDEO/VIDEOIDLE?ValueAC=0&ValueDC=180", {
        method: "POST",
        headers: new Headers({
            'X-CSRF-Token': document.cookie.match(new RegExp('CSRF-Token=([^;]+)'))[1]
        }),
        credentials: "same-origin"
    })
    

    Here we are actually using WDP REST API. ValueAC represents setting when plugged in and ValueDC represents on battery. When it's value set to 0, it means never go to sleep.

    Please note it's not recommended to set ValueDC to 0 and you should only set ValueAC to 0 when you really needed.

Sign In or Register to comment.