Slashdot is powered by your submissions, so send in your scoop

 



Forgot your password?
typodupeerror
×
News

Intercepting the Reset Button 24

Jeff Brubaker asks: "I've always wanted to have it so that when I hit the reset button on my computer it would run "restart". I do not have a clue as how to do this and was wondering if it is even possible." This has the added advantage of allowing you to cleanly shut down the machine if you lose complete control over the console. Definitely a good thing.
This discussion has been archived. No new comments can be posted.

Intercepting the Reset Button

Comments Filter:
  • by bano ( 410 )
    If the console is in-operable.
    Most likely the machine is hardlocked?
    And needs a reset.
    (machine + hardlocked = how the hell are you
    gonna do a clean shutdown?)

  • Posted by Lord Kano-The Gangster Of Love:

    As far as I know on Macs after the MacPlus and before the iMac it was a hardware thing. If you hit a Mac's power key and before the machine finishes it's memory check you CMD-CTL-PWR it it'll chime again and reboot. This is before anything except the ROM loads.

    You can three finger salute it in rapid succession before the previos chime ends, you can reboot it again.

    iMacs and the Blue and White G3s often lose the ability to use the keyboard after a good crash, but that's because it's USB. If you plugged an ADB keyboard into the G3 I bet that you'd be able to force the reboot.

    LK
  • Somewhere there are patches floating around to enhance Linux support for ACPI power management... I guess you can try looking for ACPI in the Linux portion of Google. Although the driver I saw was specific to VIA-chipset mobos.

    This will only work with newer ATX mobos, that have the funky power button. (The action performed is BIOS configurable, but on mine, a single hit is supposed to tell the OS to suspend, while holding it for 4 seconds kills the machine.)
  • You missed the point. If the console is hozed, 3 fingers aren't going to reboot it.
  • That's how it was with AT style systems. Not so with ATX -- it's a software thing. Now, that doesn't mean it's necessarily something the OS can do anything about: it might be at a lower level than that. I dunno.

    --

  • I'm pretty sure the three-fingered salute on Macintosh is still handled in software, albeit very low level software. You actually can crash your Mac hard enough that the key combo will not work -- I've had a friend do it. If I recall, he was trying to run some ancient, poorly ported kludge of a program compiled for an old 68K (emulation!). His system went down so hard, the reset switch didn't work. He had to pull the power cable to get the system to reboot.

    Now that's some serious crashing...
    --Lenny
  • by Vince ( 4999 )
    All of the time I see the console lock, the computer is still up, and available over the network. Just X hung the display or something. You could do a clean restart by logging in over the net and running restart. Now, if you don't have any daemons running, you're SOL and would want a contraption like this.
  • On the historical side, the reset button on the Commodore 128 was a redirectable interrupt. This made for some interesting pieces of code when someone would try to reset the machine. Of course, on this box the power switch was less than an inch from the reset button, so the joke might not last very long :-)
  • Perhaps the use of the power button instead? Some ATX motherboards do not allow the power button to powerdown the machine immediately. I suppose that it would be possible to have the machine do powerdown if the powerbutton is depressed, but that's probably not the desired effect.

    Can the 'Magic SysRQ' key somehow be programmed to do this? I've never actually tried to use it (hard to test crash-level stuff if linux never crashes :), but does it have the capability to be mapped to a 'restart'?
  • This is changed with the 2.2.x kernel. The three finger salute to Mr. Gates no longer causes the shutdown command to run, but bounces the box giving you the same effect as if you were in *ugh* DOS.
  • I seem to remember reading somewhere that the reset button connects the "POWER GOOD" pin on the CPU to earth, at wich point the cpu reboots....
  • The only way to do this, as someone suggested, would be to physically disconnect your reset switch from the motherboard and run that to a serial interface with a custom program monitoring it. When connected to the motherboard, the reset switch lowers the POWER GOOD signal, which is set high after a power check when the system is powered on. As long as POWER GOOD stays high, the system keeps running.
  • Maybe a circuit could be placed inbetween the reset button and the reset circuitry. If the reset button was pressed once, the machine would properly shutdown. If for some reason that would not work, the user could double click the reset button to do a real reset. Of course Linux would have to be looking for the reset signal.
  • Does anyone here know how to make their (ix86) keyboard have a real vulcan nerve pinch? Basically, reset buttons annoy me, and I'd like a hardware-reset VNP like on the Mac & Amiga.

    P.S. No, Ctl-Alt-Del is NOT a vulcan nerve pinch. Real VNPs work *all the time*.
    --------
  • Oh yeah, and if you want to fix your machine, something that works better than Ctl-Alt-Del, is the Magic SysRq Keys. Enable them in the kernel, then. Here's what I posted earlier:

    Well, for some consolation, you can still do a safe reboot with the Magic SysRQ keys:
    1) SysRq-E - Send SigTERM to all processes
    2) wait for disk activity to stop
    3) SysRq-I - Send SigKILL to all processes
    4) wait for disk activity to stop
    5) SysRq-S - Sync
    6) wait for disk activity to stop
    7) SysRq-U - Remount all FSs read-only
    8) wait for disk activity to stop
    9) SysRq-B - Reboot

    EISUB! Very useful for recovering from a dead console.
    -
    --------
  • If I remember right from my days of doing systems programming on 386's, after a reset the processor starts executing code at memory location FFFF:FFFC, which is just a jump to somewhere in the bios.

    Also, I believe that the contents of memory and registers stay intact through the reset, and are only cleared later... Didn't they use a register in the keyboard as a pointer to the last known context during swaps between real and protected mode (which required a reset)?

    Anyway, it might be possible to install a routine to recover the current context after a reset, but it would definitely require burning the eprom.
  • Forgive me if I'm mistaken but i was under the impression that the reset button physically cut the power momentarily. That would leave you nothing to catch. Maybe if you rewired the reset button to a spare serial port and wrote a program that detects when the loop is broken and takes appropriate action...
  • When the Pentium III news broke about the serial number, I was theorizing that the keyboard trick could be used similarly to re-enable the PSN without a hard restart. I never heard more about the actual technique tho.

    The Reset button, however, does ground the Power Good signal as was suggested earlier. Perhaps by rewiring it to the _reset line on the CPU, you could have it run the code at FFFF:FFFC, instead of HARD-resetting the whole PC. Or maybe my understanding of PG's role is lacking. Anyone here ever build a POST card? Hehe..
  • Oddly enough, one of the screensavers in the new version of XScreensaver would always cause my console to get munged-until-no-good to the point where a three-fingered salute wouldn't work.

    I was able to log in on my serial terminal ($8 from a garage sale) and run 'shutdown -r now' to restart. Needless to say, that particular screensaver is now commented out of my .xscreensaver.

  • If I remember correctly, the reset button triggers a signal that runs to nearly everything on the system board, including stuff on PCI/ISA busses. Basically, the signal from the button goes to a little chip (a 'debouncer') which makes a nice TTL signal (to make the electrical engineer happy) and then that signal is fed to all the stuff in the system. It tells everything to immediately drop whatever they're doing and do what they're supposed to do on power-up. Power isn't actually cut, but everything restarts as if it had been cut. Disk drives are likely to spin down and up again because they are normally at a standstill when a power-up happens.

    As far as intercepting the reset signal, I think FizzyPop had a good idea with hooking something to the serial port and making a program monitor it. You could probably do something like connecting the RTS/CTS or DTR/DSR pins, possibly the TX/RX pins, together and watching for any change in the status register of the serial port in question.

Friction is a drag.

Working...