Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pinephone does not stay awake in navigation mode. #60

Open
AndyM48 opened this issue Oct 17, 2023 · 4 comments
Open

Pinephone does not stay awake in navigation mode. #60

AndyM48 opened this issue Oct 17, 2023 · 4 comments

Comments

@AndyM48
Copy link

AndyM48 commented Oct 17, 2023

I checked the operation in navigation mode: cross hairs turned blue, no route set, and the Pinephone continues to go to sleep.

Pinephone 1.2
Linux 6.4.7
PostmarketOS v28

{sleep-inhibitor} /usr/bin/python3 /usr/bin/sleep-inhibitor

@janbar
Copy link
Owner

janbar commented Oct 17, 2023

I don't know of any mechanism that allows us to prohibit programmatically sleep on this OS. For instance I implemented that only for Android OS. In Android I had to code a call using JNI.

void PlatformExtras::setPreventBlanking(bool on)
{
  m_preventBlanking = on;

#ifdef Q_OS_ANDROID
  {
    QtAndroid::runOnAndroidThread([on]
    {
      static const int FLAG_KEEP_SCREEN_ON = QAndroidJniObject::getStaticField<jint>("android/view/WindowManager$LayoutParams", "FLAG_KEEP_SCREEN_ON");
      auto window = QtAndroid::androidActivity().callObjectMethod("getWindow", "()Landroid/view/Window;");
      if (on)
        window.callMethod<void>("addFlags", "(I)V", FLAG_KEEP_SCREEN_ON);
      else
        window.callMethod<void>("clearFlags", "(I)V", FLAG_KEEP_SCREEN_ON);
    });
  }
#endif
}

I haven't any device on Pinphone, and so cannot test. But first we have to find the way to do that on this OS.

@janbar
Copy link
Owner

janbar commented Oct 17, 2023

Having a look in the python script sleep-inhibitor, seems they launch a dummy process with systemd-inihibit or elogind-inhibit, depending of the platform. It is a way, but is the good way ...

@janbar
Copy link
Owner

janbar commented Oct 17, 2023

See link https://www.freedesktop.org/wiki/Software/systemd/inhibit/
Seems to be the best way, because that uses [logind D-Bus API].

janbar added a commit that referenced this issue Oct 17, 2023
janbar added a commit that referenced this issue Oct 18, 2023
Validated with freedesktop/gnome (Ubuntu 22.04)
@AndyM48
Copy link
Author

AndyM48 commented Nov 4, 2023

Seems to be working fine now on my system (see above)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants