psilocervine

but wife city is two words

56k warning


cohost (arknights)
cohost.org/arkmints

cathoderaydude
@cathoderaydude

fun computer limitation which I know is true in Windows but is probably true in all OSes: you cannot catch an event for pressing the power button.

to clarify: you can catch an event for the machine beginning to shut down, but that's an OS process. you only get that long, long after it's started, and by that point taking action has limited value. the best thing you can do is try to interrupt the shutdown, but the problem is, when windows (and probably all OSes) starts the shutdown process, it tells everything to exit simultaneously, so even if you abort, damage will almost certainly still be done.

what i want is for the power button to sound an alarm if its pressed, so i know if udon (or philippe) is standing on it. because, yeah, I could set it to "do nothing" in windows, but then I wouldn't know there's a soft kitty paw on the button until the motherboard unceremoniously powers off the machine, making things even worse. but you can't catch this event unless you allow windows to begin a shutdown, and the problem is, that's a traumatic process to the computer.

last night my stream died, not because udon successfully shut off the machine, and not because OBS actually closed as requested, but because it crashed when it tried to interrupt the shutdown process. so, this has to be a "never event": the shutdown process can never be allowed to begin during a critical moment, but under the constraints of windows, there's no way to safeguard against that without also disabling the ability to find out that it's been pressed.

there are two solutions:

  1. apparently other people have had the idea of changing the power button to suspend instead of shut down, and then using a program to catch and interrupt that. smart! while suspending is certainly not ideal, it's much less harrowing to your software; windows doesn't fire off a "oh shit oh shit the ship is going down" message to all your programs, and thus they have no opportunity to shit the bed with rarely-tested code. as long as whatever you use to catch and interrupt suspending succeeds, the rest of your programs will be completely unbothered; and if it does fail, going to suspend and coming back out is still less destructive than a shutdown

  2. link an amazon product photo of a cat standing on top of a PC that has a plastic cover over the power switch with the incredible caption "A cat without buttons to press. No fun in meow world anymore."


cathoderaydude
@cathoderaydude

as i was taking the second button cover out of the baggie, soba darted in, launched onto the top of my pc and very deliberately pressed the power button

NO more fun in meow world. god damnit

i do not care how bad this glue job is


You must log in to comment.

in reply to @cathoderaydude's post:

I've had windows not shut down because there was an unsaved notepad document open and windows' software shutdown "these programs are preventing your computer from shutting down" will just, stop the whole shutdown process eventually.

Maybe I should start using the power button on that machine.

yeah, it can be frustrating, and particularly because it can't be used to solve my problem since all programs get the shutdown signal very rapidly, in no particular order. if notepad happens to catch and intercept it before it reaches your critical apps, great, but there's no way to control for that. -_-

Oh having an unsaved notepad document open is not a solution lol. Obviously windows has a way of programs saying "Hey, I'm in a state where you should not shut down right now!" and the devs decided that programs in that state should take precedence over the shutdown process.

But, being that it's windows, that whole concept is unreliable, probably harder to implement than it should be, and OBS is not capable of using it reliably so it can just... stop the shutdown on it's own because it's streaming, without crashing. Which sucks, because it should be able to do that.

Mostly just found it funny that someone has had the exact opposite problem I did.

my first and most cursed thought was to detect a power button event by intercepting the physical power button input that then checks with an api to see if shutdown is allowed and only sends the input through if it doesn’t. easy fixes. :eggbug-sob:

oh i meant like have something physical intercept the power button. basically make a daughterboard but just for power button management. so it’s a super cursed idea.

now i am thinking about yet another usb daughterboard that allows you to manage all the case integration. like rate limit or pwn the HDD/power lights so they aren’t blinding at night. and if you made it wifi by basing it on an esp32 or something you could have like basic remote power management.

hang on. hold the phone. wait up. this is brilliant

yes, we can't control the motherboard - but we can control what gets sent to the motherboard. holy shit. this is a game changer.

both power and reset unplug from the board and can easily be processed by simple logic. we route them both into a man in the middle that applies rules:

  1. a single press on the power or reset buttons does nothing

  2. pressing and holding power or reset sounds an alarm

  3. double tapping power or reset causes them to actually send the respective signal to the motherboard, but only briefly; holding either one does not continuously hold down the logic signal on the board

  4. double-tap-and-hold does hold down the logic signal, so you can force a shutdown if needed

this is a product that could be built with three logic chips or a 4-bit MCU, made as a single PCB wrapped in heatshrink, and sold to millions of gamers.

  1. hook power button to unused IDE pin header IORDY or INTRQ
  2. write interrupt service routine that dispatches a shutdown command when called
  3. get surprised when windows shuts down when you insert a CD-ROM

ask me how I know

in reply to @cathoderaydude's post:

I'm very convinced that cats always know exactly what they're doing when they sit on the power button of the PC tower. they might not be able to understand complex concepts like "computers" or "electricity," but they absolutely fuckin know that when they sit on the button it does Something to the warm glowy box, and THAT gets the humans' attention so OBVIOUSLY it's worth doing