Author Topic: Turn off Laptop Display  (Read 1101 times)

Neil Waldhauer

  • Hero Member
  • *****
  • Posts: 880
  • Karma: +22/-0
    • View Profile
    • Blonde Guy
Turn off Laptop Display
« on: October 17, 2022, 10:29:36 pm »
I'd like to turn off the laptop display. Actually the screen saver ought to do it, but it doesn't.

Is there any way to turn off the display. Can it be turned on again later?

Test machine is a Lenovo Thinkpad T450s, in case it matters.
Expert consulting for ArcaOS, OS/2 and eComStation
http://www.blondeguy.com

Dave Yeo

  • Hero Member
  • *****
  • Posts: 4007
  • Karma: +81/-0
    • View Profile
Re: Turn off Laptop Display
« Reply #1 on: October 17, 2022, 11:04:14 pm »
On my T42, I have to use the function key to turn it off/on. Arca Noae's Snap claims it supports DPMS, while the stock ATI Snap correctly says it doesn't.
If the Screensaver doesn't turn it off, likely it is the same, no DPMS support. Likely it is supposed to use ACPI to control the screen, unluckily our ACPI doesn't support much in the way of things like turning off the screen unless the function keys are defined in the BIOS.
If the function keys don't work, likely you are out of luck. If really brave, you could try suspending the laptop, forget how now.
BTW, DPMS doesn't work at all in an UEFI boot.

Ibrahim Hakeem

  • Full Member
  • ***
  • Posts: 109
  • Karma: +5/-0
    • View Profile
Re: Turn off Laptop Display
« Reply #2 on: October 18, 2022, 03:16:22 am »
Hi Neil, I just wanted to chime in as a T450S user.

Aside from closing the laptop, there doesn't seem to be a way to turn off the screen.
Dave raises a good point - however, the function keys for screen controls don't even seem to register in the BIOS as they should. I split the blame between our limited ACPI support and negligence from Lenovo.

Interesting note to add: I recall asking about brightness controls for the T450S in a previous Warpstock event. Forgive me for not remembering who it was, but someone from ArcaNoae responded in IRC saying it might be possible, but upon looking at a few tables/resources then recanted by stating it isn't feasible without some serious work.

I personally reckon it wouldn't hurt for there to be at least some research undertaken for improved ACPI support, that way it could perhaps be outsourced to a passionate enough developer or maybe even BitWise. I can't imagine AN themselves would be taking up writing the necessary drivers anytime soon as it seems they've already got a lot on their plate with the current roadmap.

Neil Waldhauer

  • Hero Member
  • *****
  • Posts: 880
  • Karma: +22/-0
    • View Profile
    • Blonde Guy
Re: Turn off Laptop Display
« Reply #3 on: October 18, 2022, 05:15:04 am »
The only hack I have figured out is that if I use an external monitor, then the internal screen is off. If I then turn off the external monitor, then the laptop is running with the screen off. I can also adjust the brightness of the external monitor.

This behavior started with the T60 and has continued through eight generations to the T450s. (at least eight -- I haven't tested some of the newer laptops)
Expert consulting for ArcaOS, OS/2 and eComStation
http://www.blondeguy.com

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3878
  • Karma: +38/-0
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: Turn off Laptop Display
« Reply #4 on: October 18, 2022, 04:11:03 pm »
Hi Dave

If I don't recall it wrong you modified Doodle Screen Saver to support DPMS with Panorama so it can turn off the display, right?. And I tested it sometime ago and it worked. Is it something related that can work to turn off the screens with Panorama?

I'm not sure if I got it right, within some  David Azarewicz presentation, he told that with the ACPI toolkit something can be developed to recognize some actions like presing the power button and closing the lid  and execute something.

Regards
« Last Edit: October 18, 2022, 04:27:24 pm by Martin Iturbide »
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Dave Yeo

  • Hero Member
  • *****
  • Posts: 4007
  • Karma: +81/-0
    • View Profile
Re: Turn off Laptop Display
« Reply #5 on: October 18, 2022, 06:17:19 pm »
Hi Martin.
David added DPMS capability to Panorama, gave me an example program on how it worked and I added it to the screensaver. It only works with the latest (and maybe the 2nd to latest?) Panorama. It is up to Panorama to query the video BIOS and monitor whether DPMS is supported and report to the screensaver. If you do a UEFI boot for example, the DPMS settings in the screensaver are greyed out. That part seems buggy with Neil's laptop reporting support when it doesn't.
As for the ACPI stuff. According to the documentation, if support for function keys is in the BIOS, they'll work. For lots of systems there isn't enough support from the BIOS and you need a device driver to control the function keys along with things like turning off the monitor. I believe most systems would need a dedicated driver so not simple or easy.

Roderick Klein

  • Hero Member
  • *****
  • Posts: 547
  • Karma: +14/-0
    • View Profile
Re: Turn off Laptop Display
« Reply #6 on: October 19, 2022, 11:02:15 pm »
I do not even think DPMS support can work under UEFI for 1 very simple reason. The interface that is offered by the video card is stripped.
Deep under the bonnet there is a mini VESA BIOS providing SOME of the INT10 support under a UEFI boot. The INT 10 interface is the BIOS int10 used to talk to the video card in gone mostly. In UEFI boot you only have a frame buffer to write to its video data. Hence the reason the DPMS will most likely not work.  I am almost certain off this.

You are spot on about "if the BIOS supports" these buttons. Most UEFI firmwares do not support these buttons at all. The basic trend of UEFI is an as stripped down as possible OS loader compared to a classic BIOS. The OS needs to deal with everything.

* Switching to an external beamer on your laptop. The button does not do anything. Why ? Because the UEFI GOP has no way of switching the HDMI port to for example an external port. It only works when Windows or Linux has started at the OS can make a call to the video driver to switch the HDMI video output port.

* Dimming the screen or switching off. Sadly with UEFI yet again game over. I would LOVE to have the ability to change the brightness of the screen.
The video driver MOSTLY deals with this. However this MIGHT somehow be able to made work on ArcaOS:
https://wiki.archlinux.org/title/backlight
The problem is I do not know how much work this is and how many machine support this route. Being able to reduce the brightness of your backlight can help increase the uptime of your laptop while running on battery power.

* The only thing that could be made to work "easy" volume up volume down buttons and do something with the UNIAUD mixer.

Roderick

Dave Yeo

  • Hero Member
  • *****
  • Posts: 4007
  • Karma: +81/-0
    • View Profile
Re: Turn off Laptop Display
« Reply #7 on: October 20, 2022, 12:34:17 am »
I do not even think DPMS support can work under UEFI for 1 very simple reason. The interface that is offered by the video card is stripped.
Deep under the bonnet there is a mini VESA BIOS providing SOME of the INT10 support under a UEFI boot. The INT 10 interface is the BIOS int10 used to talk to the video card in gone mostly. In UEFI boot you only have a frame buffer to write to its video data. Hence the reason the DPMS will most likely not work.  I am almost certain off this.


Really it depends on whether the miniature VGA driver can control the vertical and horizontal refresh rates. To put most monitors to sleep is just a matter of having a zero vertical and horizontal refresh rate, at that, for most LCD's, either one being zero should be enough. So save the state of the vertical, horizontal refresh rate registers and setting them to zero should turn most monitors off. The reverse should turn them back on.
It does raise the question of how resolutions are changed in UEFI mode. Does it depend on the hardware or does the mini driver take care of it? And have things changed, it is hard to find current info.

Andi B.

  • Hero Member
  • *****
  • Posts: 710
  • Karma: +10/-1
    • View Profile
Re: Turn off Laptop Display
« Reply #8 on: October 20, 2022, 09:34:02 am »
Quote
It does raise the question of how resolutions are changed in UEFI mode. Does it depend on the hardware or does the mini driver take care of it?
I don't understand your question here. But beside UEFI or not, the list of possible resolutions does depend on 'current' (at boot time) hardware and BIOS and BIOS settings. F.i. on a desktop system the list of resolutions is different (and has to be different) based on the external monitor you connect AND based on the interface on which you connect it. Afterwards (after booting) it usually depends on the OS to react on changes (undocking, connect external monitor, ...) 

I think for us it does not change very much. On modern systems you have to read out the information from the (UEFI-)BIOS and act on what it offers. There seems to be no standard way anymore to deal with such things. Even worse when the system runs we should detect new monitor on other interface at least and at least activate this interface too with the same resolutions as before if possible. The traditional way, activate all interfaces and send out same signal to all, does not work since a while. F.i. HDMI is not capable to transport the same resolutions than DP.

Maybe things would improve if we would have enough interested and talented developers and if we had open source Panorama and if we had open source ACPI. Could be that some people would try to improve there own system in some aspects (resolution, power saving, ...) and other people would benefit. But too much 'if' and speculating here.

Rich Walsh

  • Full Member
  • ***
  • Posts: 179
  • Karma: +7/-0
  • ONU! (OS/2 is NOT Unix!)
    • View Profile
Re: Turn off Laptop Display
« Reply #9 on: October 20, 2022, 09:38:05 am »
It does raise the question of how resolutions are changed in UEFI mode. Does it depend on the hardware or does the mini driver take care of it?

When using Panorama in UEFI mode, AOS 5.1 is incapable of changing any video setting itself because it doesn't contain a bona-fide video driver - i.e. code that knows how to manipulate a video card's registers.. This "mini-driver" is a really thin BIOS emulation that returns data cached by os2ldr at boot time and (I believe) allows you to issue video commands that will be ignored. Instead, AOS uses a workaround that capitalizes on the fact that OS/2 has never been able to change resolutions on-the-fly.

When 'aosldr' starts up, it uses the UEFI firmware's boot-time services to read 'os2.ini' and determine the desired resolution / refresh rate / color depth. It then uses the firmware to set the video accordingly. Later, when it loads the OS/2 kernel, it loses access to those boot-time video services, but the video settings remain in place, unchanged and unchangable for the rest of the session.

Consequently, if turning off the display requires any sort of direct manipulation of the video card, you are S-O-L.

Roderick Klein

  • Hero Member
  • *****
  • Posts: 547
  • Karma: +14/-0
    • View Profile
Re: Turn off Laptop Display
« Reply #10 on: October 20, 2022, 10:17:29 pm »
Rich his summary is correct. If you want to control the video output port, or the brightness a screen on a UEFI booted system you need a native video driver. The UEFI interface does not provide standards for this. The only thing that MIGHT work is look if the ACPI backlight can be implemented. But I know not enough about the code and what more code is needed. (See the link my previous post in this thread).  But this will not work on all equipment...

The bottom line you should see UEFI is that compared to BIOS it provides as little services to an OS as possible. The OS should do as much stuff as possible.  UEFI does provide services to itself so an UEFI OS loader can load the needed files from a boot device for example. But when exitfrombootservices is called, the disc I/O services go away.

Roderick


Lars

  • Hero Member
  • *****
  • Posts: 1069
  • Karma: +53/-0
    • View Profile
Re: Turn off Laptop Display
« Reply #11 on: October 21, 2022, 01:47:14 pm »
When using Panorama in UEFI mode, AOS 5.1 is incapable of changing any video setting itself because it doesn't contain a bona-fide video driver - i.e. code that knows how to manipulate a video card's registers.. This "mini-driver" is a really thin BIOS emulation that returns data cached by os2ldr at boot time and (I believe) allows you to issue video commands that will be ignored. Instead, AOS uses a workaround that capitalizes on the fact that OS/2 has never been able to change resolutions on-the-fly.

When 'aosldr' starts up, it uses the UEFI firmware's boot-time services to read 'os2.ini' and determine the desired resolution / refresh rate / color depth. It then uses the firmware to set the video accordingly. Later, when it loads the OS/2 kernel, it loses access to those boot-time video services, but the video settings remain in place, unchanged and unchangable for the rest of the session.

Consequently, if turning off the display requires any sort of direct manipulation of the video card, you are S-O-L.

So how about any INT10h calls that do not change the resolution but actually want to write something to the screen like int 10h / AH = 0Ah or int 10h / AH = 13h ? Will these work ? Or is AN int10h support limited to only the calls that control/query the resolution ?

Rich Walsh

  • Full Member
  • ***
  • Posts: 179
  • Karma: +7/-0
  • ONU! (OS/2 is NOT Unix!)
    • View Profile
Re: Turn off Laptop Display
« Reply #12 on: October 21, 2022, 05:38:14 pm »
So how about any INT10h calls that do not change the resolution but actually want to write something to the screen like int 10h / AH = 0Ah or int 10h / AH = 13h ? Will these work ? Or is AN int10h support limited to only the calls that control/query the resolution ?

I did not participate in the development of the driver, so I can only comment on implementation details at the level of "informed observer". My understanding is that any call that is required to boot was implemented. So, if the kernel needs to output a string while still in real mode, the specific subfunction it uses is operational. Anything else is a no-op.

Among those no-ops is the one to change video mode. PM still issues it as always, thinks it succeeded, then adjusts other settings accordingly. The fact that it doesn't actually do anything is of no consequence because the loader has already set the mode using the exact same parameters that PM will use. True emulation: the code thinks it's doing one thing, the underlying system does something completely different, but the end result is the same so everyone is happy :)

FYI... OEMHLP has been greatly extended for UEFI to provide boot and video info that may not be available elsewhere. Refer to 'oemhelpex.h' for details.

Dave Yeo

  • Hero Member
  • *****
  • Posts: 4007
  • Karma: +81/-0
    • View Profile
Re: Turn off Laptop Display
« Reply #13 on: October 21, 2022, 06:54:59 pm »
So how about any INT10h calls that do not change the resolution but actually want to write something to the screen like int 10h / AH = 0Ah or int 10h / AH = 13h ? Will these work ? Or is AN int10h support limited to only the calls that control/query the resolution ?

I tried loading the Xfree/2 VESA driver on a UEFI boot, it failed with,
Code: [Select]
(EE) VESA(0): V_BIOS address 0x98000 out of range
Whereas on a BIOS boot,
Code: [Select]
II) VESA(0): Primary V_BIOS segment is: 0xc000

X11 uses an int10 module to access int10 BIOS calls, including on Linux (back when our version was released) and on other platforms, there's actually Scitech code in the form of a x86emulator to call them.
Seems that the "VGA BIOS" is emulated at 9xxx for boot and Panorama.
While on the subject of X11, there were also changes to Panorama and Snap to support UEFI that broke X11 returning to the Presentation Manager, where it now just hangs the system instead of redrawing the PM desktop on a BIOS boot.
Another thing of interest is that if I use my Display Port to DVI connector to connect my monitor, X11 doesn't even find a VGA BIOS (BIOS boot), which is weird. Also the screensaver fails to wake up my monitor with DPMS, puts it to sleep fine and works fine using a VGA cable.

Roderick Klein

  • Hero Member
  • *****
  • Posts: 547
  • Karma: +14/-0
    • View Profile
Re: Turn off Laptop Display
« Reply #14 on: October 21, 2022, 08:16:47 pm »
When using Panorama in UEFI mode, AOS 5.1 is incapable of changing any video setting itself because it doesn't contain a bona-fide video driver - i.e. code that knows how to manipulate a video card's registers.. This "mini-driver" is a really thin BIOS emulation that returns data cached by os2ldr at boot time and (I believe) allows you to issue video commands that will be ignored. Instead, AOS uses a workaround that capitalizes on the fact that OS/2 has never been able to change resolutions on-the-fly.

When 'aosldr' starts up, it uses the UEFI firmware's boot-time services to read 'os2.ini' and determine the desired resolution / refresh rate / color depth. It then uses the firmware to set the video accordingly. Later, when it loads the OS/2 kernel, it loses access to those boot-time video services, but the video settings remain in place, unchanged and unchangable for the rest of the session.

Consequently, if turning off the display requires any sort of direct manipulation of the video card, you are S-O-L.

So how about any INT10h calls that do not change the resolution but actually want to write something to the screen like int 10h / AH = 0Ah or int 10h / AH = 13h ? Will these work ? Or is AN int10h support limited to only the calls that control/query the resolution ?

You mean during boot when device drivers are loading or when the OS is started ?
Or are you talking ab0ut DOS session that use that INT 10 interface. in DOS sessions that should work via VEFI.SYS (replacement for VSVGA.SYS).

Roderick


Roderick