1

This may well be a daft question and/or a failure to google effectively (and apologies if this would be a better fit on SuperUser or somewhere else?) but is it possible, in low-level hardware, to detect the "run" status (possibly ACPI state) of a PC?

As in - can we know whether it's powering up, shutting down, running, rebooting, hibernating, etc. from some signal on the motherboard? Perhaps a status pin on the PSU or PCI bus, sniffing I2C/SMBus messages or something else that can be hooked into at a low level.

I feel like it must be possible as a lot of peripheral stuff needs to know this too, ideally without a driver / software.

I've seen PCI cards that display the POST code / state, I'm after doing something similar for the power state.

What triggered my interest is I've got a server that takes a fair while to reboot, and it would be nice to have a little LED on the front that indicates "I'm rebooting" / "I'm running".

Sure it would be doable with a CRON job and a message out of the serial port to a microcontroller or somesuch, but that feels like more tinkering than just "getting" the status straight out of the hardware.

John U
  • 7,041
  • 2
  • 21
  • 34
  • 2
    It is possible. But you should narrow it down to which level you want it for (and why). The "I'm rebooting/ I'm running" LED is not much related to what you are asking for. ACPI states are not "dynamic" they only switch at reset/sleep/wake/power on/off. – Eugene Sh. Feb 07 '22 at 15:57
  • If there is no power, only the OS that turned the hardware off knows if the PC was asked to shut down or to hibernate. And if you simply unplugged the mains, not even the OS knows what happened. – Justme Feb 07 '22 at 16:02
  • 1
    @Justme BIOS and/or some lower level components will also "know" it *at some point*, but it might be too late to have this indication any useful. And it is very system-specific. – Eugene Sh. Feb 07 '22 at 16:05
  • Also consider something like [Hardware Monitoring](https://linux-hardware.org/?view=monitoring), get an e-mail upon changes. Perhaps not that particular package, but you get the idea. – rdtsc Feb 07 '22 at 16:49
  • @EugeneSh. on reboot/restart the power supply definitely does _something_, I assume something in the chain takes the restart command and instructs it to power up again after the shutdown phase. – John U Feb 07 '22 at 17:37
  • @Justme I'm aware that nothing can do much about being unplugged from the wall. However, the hardware (BIOS/PSU/Support chips) surely does _something_ when in other states as the ACPI sleep/hibernate still stop the CPU and/or refresh the RAM, spin down disks, notify USB devcies, etc. so there's some low-level activity there. – John U Feb 07 '22 at 17:38
  • @rdtsc - I think you're misunderstanding my use case, it's not about warning me in advance or remote monitoring, more just "at-a-glance" front panel indication on a headless machine so that I can see if I should wait a minute before trying to SSH into it or curse it for not responding. – John U Feb 07 '22 at 17:41
  • 1
    the "quick and dirty" test is to press the num-lock key on the keyboard and watch the indicator ... of course, it does not give you anything more than "I appear to be alive" – jsotola Feb 07 '22 at 17:45
  • @JohnU BIOS is just code that is executed by CPU, though it controls underlying hardware to do stuff or go into various modes and so maybe it can be asked what the state is, but state is controlled by OS, and if OS is not running yet only the BIOS knows the OS loading has started but only OS knows when it is ready. PSU can be controlled to either on or off by the motherboard, under control from the OS that has requested shutdown, which means either the PC has full power or only standby 5V supply, so power supply does not know much either. – Justme Feb 07 '22 at 17:46
  • @john if this is a headless Linux machine and you have gpio you can use, then a couple of bootloader scripts or init scripts to toggle an led would work. – Passerby Feb 07 '22 at 21:19

0 Answers0