Author Topic: Turn off PC by power button  (Read 17708 times)

Mikhail

  • Newbie
  • *
  • Posts: 39
  • Karma: +2/-1
    • View Profile
Turn off PC by power button
« on: July 02, 2018, 01:40:31 am »
Faced an unusual problem, there is a question to the public. Really in ArcaOS (OS / 2) does not have a power-off function with the correct completion of tasks by pressing the power button? I searched everything, did not find it in the settings, can I have some additional software?

Dave Yeo

  • Hero Member
  • *****
  • Posts: 4787
  • Karma: +99/-1
    • View Profile
Re: Turn off PC by power button
« Reply #1 on: July 02, 2018, 03:00:35 am »
As far as I know, there is no support for doing a clean shutdown by pressing the power button. In theory APCI should support this and perhaps it does on some laptops but not on most systems.
You have to use the shutdown icon on the xcentre or choose it from the right click menu on the desktop or use cntrl-alt-del

Mikhail

  • Newbie
  • *
  • Posts: 39
  • Karma: +2/-1
    • View Profile
Re: Turn off PC by power button
« Reply #2 on: July 02, 2018, 04:47:37 pm »
If a monitor and keyboard are connected to the computer, there is no problem with this, but if this separate device is performing the function of a network media renderer, there will be difficulties.

Dave Yeo

  • Hero Member
  • *****
  • Posts: 4787
  • Karma: +99/-1
    • View Profile
Re: Turn off PC by power button
« Reply #3 on: July 02, 2018, 05:12:44 pm »
How are you accessing the headless OS/2 box? There is x:\os2\install\shutdown.exe and a few shutdown utilities that I have not tested at http://hobbes.nmsu.edu/h-search.php?button=Search&key=shutdown&dir=%2F.
Most of these probably do not power off the system after shutdown so you'd still have to hold down the power button for a few seconds to power off.

Mikhail

  • Newbie
  • *
  • Posts: 39
  • Karma: +2/-1
    • View Profile
Re: Turn off PC by power button
« Reply #4 on: July 02, 2018, 05:58:32 pm »
The Renderer device does not need to be managed from the local workstation, its task is to receive the http stream and through it the content of the stream is reproduced, for example, audio through the USB audio device.
For the average user it is a box with one Power button and several ports (USB, Ethernet). And this button should be safe for the OS to shut down the box.

Dave Yeo

  • Hero Member
  • *****
  • Posts: 4787
  • Karma: +99/-1
    • View Profile
Re: Turn off PC by power button
« Reply #5 on: July 02, 2018, 06:32:06 pm »
You should probably open a support ticket at Arca Noae, https://www.arcanoae.com/wiki/acpi  as I'm not knowledgeable enough on this.

Andi B.

  • Hero Member
  • *****
  • Posts: 811
  • Karma: +11/-2
    • View Profile
Re: Turn off PC by power button
« Reply #6 on: July 02, 2018, 08:52:35 pm »
In the ACPI toolkit there is a WaitButton sample. Maybe that can be used for some button input. There's also a poweroff sample.

I made something similar with an external micro controller. The controller reads the buttons and send the OS/2 system a message via the com port and the OS/2 daemon which receives the message shuts down the system. I've discussed part of it at comp.os.os2.programmers.misc a few months ago.

But I fear none of them is what you really want. I guess you want the same what the power button does on recent win boxes. Unfortunately TTBOMK we do not have it currently.

Dave Yeo

  • Hero Member
  • *****
  • Posts: 4787
  • Karma: +99/-1
    • View Profile
Re: Turn off PC by power button
« Reply #7 on: July 02, 2018, 09:50:30 pm »
But I fear none of them is what you really want. I guess you want the same what the power button does on recent win boxes. Unfortunately TTBOMK we do not have it currently.

Copy %ETC%\acpid.cfg.sample to %ETC%\acpid.cfg and the line
Code: [Select]
; What do to when the Power button is pressed
; none    = no action (default)
; off     = power off
; suspend = suspend
; reboot  = reboot the system
PowerButton = Off

might work. We'll wait for Mikhall to report.

Andreas Schnellbacher

  • Hero Member
  • *****
  • Posts: 827
  • Karma: +14/-0
    • View Profile
Re: Turn off PC by power button
« Reply #8 on: July 02, 2018, 11:21:31 pm »
I made some tries with both acpid.cfg and WaitButton. AFAIR, I didn't get a working solution. AFAIR, 'off' means simply power off, not shut down. I'm curious if a newer diver gives more comfort.

BTW: A clean shutdown with power-off can be executed by sending the setup string 'XSHUTDOWNNOW=POWEROFF,AUTOCLOSEVIO,NOCONFIRM;' to the desktop.

Andreas Schnellbacher

  • Hero Member
  • *****
  • Posts: 827
  • Karma: +14/-0
    • View Profile
Link to AN ticket (Re: Turn off PC by power button)
« Reply #9 on: July 02, 2018, 11:29:32 pm »
Mikhail has already created a ticket: https://mantis.arcanoae.com/view.php?id=1992

Dave Yeo

  • Hero Member
  • *****
  • Posts: 4787
  • Karma: +99/-1
    • View Profile
Re: Turn off PC by power button
« Reply #10 on: July 03, 2018, 06:27:21 am »
I made some tries with both acpid.cfg and WaitButton. AFAIR, I didn't get a working solution. AFAIR, 'off' means simply power off, not shut down. I'm curious if a newer diver gives more comfort.

Testing with PowerButton=Off here, pressing the power button does cleanly turn the computer off perhaps 10-20 seconds after pressing the button, there is no sign that anything is happening until shutdown.
Restarting, the OS loads cleanly, no chkdsk.

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4713
  • Karma: +41/-1
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: Turn off PC by power button
« Reply #11 on: July 03, 2018, 05:17:40 pm »
Hi

I usually disable any shutdown from the power button on other OSes, since I don't like when I accidentally press them, but I wanted to try this procedure on a Thinkpad SL500 machine I have right here.

- ArcaOS 5.0.2
- Thinkpad SL500 - 2746-CTO - Intel Core 2 Duo P7370 / 2 GHz
- ACPI 3.23.08 - 2 Cores recognized on boot.
- XWorkplace shutdown works and can turn off the computer

I tried the procedure listed by Lewis on the ticket.
Quote
Copy %ETC%\acpid.cfg.sample to %ETC%\acpid.cfg (usually, %ETC% will be <boot volume>\MPTN\ETC).
Open %ETC%\acpid.cfg in your favorite text editor.
Locate the "What to do if the Power button is pressed" section of the [ACPID] stanza.
Ensure that the line reads: PowerButton = Off
If necessary, edit the file and save.
Reboot to activate the settings in the ACPID.CFG file.

The acpid.cfg file is located inside x:\MPTN\ETC.  The ETC on the config.sys points the same.

After the reboot. I preset the power button a there was no shutdown with the button. I hold it for like 3 seconds, trying not to do a "hard power off" and no luck.

I also updated to ACPI 3.23.09 and it does not work also.

I even tried changing "Off" to "off" just in case, rebooted and it also does not work.

Regards
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Andy Willis

  • Sr. Member
  • ****
  • Posts: 292
  • Karma: +7/-0
    • View Profile
Re: Turn off PC by power button
« Reply #12 on: July 04, 2018, 03:05:26 am »
Hi

I usually disable any shutdown from the power button on other OSes, since I don't like when I accidentally press them, but I wanted to try this procedure on a Thinkpad SL500 machine I have right here.

- ArcaOS 5.0.2
- Thinkpad SL500 - 2746-CTO - Intel Core 2 Duo P7370 / 2 GHz
- ACPI 3.23.08 - 2 Cores recognized on boot.
- XWorkplace shutdown works and can turn off the computer

I tried the procedure listed by Lewis on the ticket.
Quote
Copy %ETC%\acpid.cfg.sample to %ETC%\acpid.cfg (usually, %ETC% will be <boot volume>\MPTN\ETC).
Open %ETC%\acpid.cfg in your favorite text editor.
Locate the "What to do if the Power button is pressed" section of the [ACPID] stanza.
Ensure that the line reads: PowerButton = Off
If necessary, edit the file and save.
Reboot to activate the settings in the ACPID.CFG file.

The acpid.cfg file is located inside x:\MPTN\ETC.  The ETC on the config.sys points the same.

After the reboot. I preset the power button a there was no shutdown with the button. I hold it for like 3 seconds, trying not to do a "hard power off" and no luck.

I also updated to ACPI 3.23.09 and it does not work also.

I even tried changing "Off" to "off" just in case, rebooted and it also does not work.

Regards

One other thing,  you can't use the /noacpi switch on the PSD line in the config.sys (I use it so that the screen brightness can be changed via the FN keys).  You need to hold the key down for 1/2s to 1 sec, if it is going to work.  3s-4s will do a BIOS poweroff (bypassing ACPI and thus no processing to do a clean shutdown). 

Dave Yeo

  • Hero Member
  • *****
  • Posts: 4787
  • Karma: +99/-1
    • View Profile
Re: Turn off PC by power button
« Reply #13 on: July 04, 2018, 08:04:10 am »
Here I just have to tap the power button.

Mikhail

  • Newbie
  • *
  • Posts: 39
  • Karma: +2/-1
    • View Profile
Re: Turn off PC by power button
« Reply #14 on: July 05, 2018, 01:55:53 am »
Lucky guy. It remains to understand what helps you to get such a result and prevents it like me.

Of course, I am almost 100% sure that forced shutdown of the operating system with only one network task will not lead to problems, but I would like to believe that there is a normal solution for such a simple task.