Live data from Hacker News

How to programmatically find out if computer is on

haiku-os.org

31–40 of 197 posts

Re: How to programmatically find out if computer is on

#33

is_computer_on_fire() seems more usable...

weird how it's returning a constant https://github.com/haiku/haiku/blob/8f16317a5b6db5c672f33181... Interesting it seems to come from BeOS: https://github.com/haiku/haiku/commit/bcf475ec65f1060c0a8abf... where the same function had a hn thread about it already a couple years ago :D https://news.ycombinator.com/item?id=8780606

Not 451. I'm disappointed at the missed opportunity.

Re: How to programmatically find out if computer is on

#37

is_computer_on_fire() seems more usable...

weird how it's returning a constant https://github.com/haiku/haiku/blob/8f16317a5b6db5c672f33181... Interesting it seems to come from BeOS: https://github.com/haiku/haiku/commit/bcf475ec65f1060c0a8abf... where the same function had a hn thread about it already a couple years ago :D https://news.ycombinator.com/item?id=8780606

I can find various results where that number is negative (Faltings height of LMFDB elliptic curve 1688.c1; north east longitude of el Baix Segura) but not where the number is positive. It's part of a DOI string though, but that's not really a number.

Probably I'm being nerd sniped. https://xkcd.com/356/

Re: How to programmatically find out if computer is on

#39
post #29

Earlier quoted context omitted.

Hmm, it seems like you need to make sure the computer is on before calling this function, or else you run the risk of getting back undefined data. Seems like we also need a function that can be used to tell if the computer is on...

Nah. Just bump that responsibility to the caller, and power supply manufacturer. Have the caller call power_on_computer() first always. This will ensure you always get defined state! ...What do you mean not every power supply manufacturer implements the power_on_computer() function as a NOOP if the computer is already on?!

Some implement it that way, some it returns and error message or throws an NMI; then ya got the cheap clones that use it to frob a toggle without regard to the state it was in (which there's no way to read)... Then ya got the weird ones (HP) where it only works right if you call it twice with a 40ms delay between while streaming a sample from "Swan Lake" over their NDA'd 1wire thingy.
Post reply on HN