how to programmatically control the display

  • I just got Ubuntu Touch running on an old Nexus 7 (2013) tablet and the process was really smooth, so great work on that! I am trying to programmatically turn on and off the display. I realized it was not running X so tried looking at Mir and Unity8 documentation but it's not clear how I can do that, compared to xset dpms force on/off in X. Thanks in advance!

  • @adevhasnoname There's is no need to post the exact same question twice. Here is fine. It will not get answered any quicker.

  • Why do you need to do so? Apps are confined on UT, and confined apps do not have permission to do this.

  • @Lakotaubp sorry, I thought the News area where I posted was a different type of thing. Not used to Discourse. Thanks for the heads up!

  • @dobey I was assuming it'd be a command that I ran via ssh outside of the contained area. I want to be able to turn on and off my device screen remotely. Do you need any more details?

  • @dobey I am also looking into making a chroot. Is that still advisable and are there any recent instructions? I really just want to be able to do whatever I want with the device, including the cameras and microphone, using some deb packages like motion and nodejs

  • @adevhasnoname the closest of a supported use case to make a chroot is Libertine:

    For your other questions, take note that you are probably running counter to some of the intentional design choices of UT which I'd describe as more of a consumer device that just works (read-only, image updates, confinement, ...) rather than a hacker device. That being said, it's possible to venture out of that design. E.g. turning off screen, maybe try service lightdm stop. For your "whatever I want" point, maybe look around for discussions about mounting / readwrite and using apt. That will give you all the power and responsibility to mess with your device (and wreck it to your hearts content 😉 ). Just keep in mind that you get to keep the pieces after you broke it. Prepare for reinstalling!

  • @doniks I didn't initially think about the design of UT but once I had to start poking around it makes a lot of sense. It is a really cool platform and I'm looking forward to something like the isolated-containers-by-default model making it to my mainstream devices.

    I was able to set up my own chroot using debootstrap without affecting the rest of the system. I installed nodejs and got a server running, etc.. So, this would at least let me have a way to trigger the display on and off if I figure out how to do that. I'll try playing with lightdm later but by my reading so far it seems like it just has hooks to delegate that work to something else, like xset on X.

    My biggest fail so far was that I didn't realize the cameras wouldn't actually be v4l devices so I'll have to look at how the default Camera app is accessing the cameras through the Android HAL.

    I guess it's back to the drawing board for now...

  • @adevhasnoname I am not sure if UT is the right platform for device hacking like this, everything what you want to do is basically locked down and you would need a lot of time to unblock those things, only to find out that with the next system update everything gets overwritten... Our updates are image-based and the rootfs is read-only and so on. You might be better off with one of the projects that is more like a "desktop" Linux. Like PostmarketOS.

  • @adevhasnoname said in how to programmatically control the display:

    cameras wouldn't actually be v4l devices so I'll have to look at how the default Camera app is accessing the cameras through the Android HAL.

    I guess it's back to the drawing board for now...

    maybe look at the pine phone. all the hardware should be supported by a mostly vanilla linux kernel, thus no android hal...

  • @doniks Thanks, I'll have to take a closer look at the pine phone! Btw I tried service lightdm start and service lightdm stop which does technically turn on and off the display but it also kills everything else and takes time to start. What I was looking for was the instant on/off of just the display, like when a phone responds to a proximity sensor to toggle the display. Thanks for the suggestion anyway! I'm sure there's a way, I just don't know enough about Mir/Unity8 to dig deeper without docs which I can't seem to find or some sense of where to look in the source code.

  • @adevhasnoname Maybe you can explain a little more what you are trying to do. You spoke about controlling the device via ssh. So I assumed you didn't really want to use any of the normal ui and thus my suggestion of shutting down the display manager.

  • @adevhasnoname You probably could do it with an extension to repowerd, to write a new plugin that will wakeup the scren or shut it down. repowerd is the main arbiter when it comes to power-related events.

Log in to reply