Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!

 



Forgot your password?
typodupeerror
×
X GUI

X11 Serial Killer? 14

Chris Benard asks: "I frequently have problems with X just taking control of my keyboard, but not my mouse. My mouse still moves, but it isn't able to interact with X (not unlike a windows freeze). However, I would like to know if there is a program to listen on a serial port for commands and execute them as root. I have an HP48G calculator, and I would like to make a few short commands to execute from it to my serial port, such as killall -9 X and killall -9 netscape-communicator. Please let me know of any programs existing and any SDKs that I might use to produce my own program. " Has anyone managed to come up with a hack that might work for this situation?
This discussion has been archived. No new comments can be posted.

X11 Serial Killer?

Comments Filter:
  • All I did is run getty to ttyS1 (where my palm is) and run a palm telnet app on the PDA, login just like a dumb terminal except dumb terminals don't have graffiti. :) login in as root, kill X, whatever ya want to do. Also came in handy for me when SVGAlib froze my console playing quake2. Not sure how this can work with the Ti, but if it has a telnet app and a serial cable of some sort, it might work.

    bash: ispell: command not found
  • Go to the HP48 Terminal Emulation Programs [hpcalc.org] page and download a terminal emulator.

    I think this is what you are looking for.
  • Add line to /etc/inittab (assuming SysVinit based system, e.g. RedHat, Mandrake, SuSE):

    s1:2345:respawn:/sbin/mingetty ttyS1

    Substitute your favorite getty program if mingetty doesn't get it for you. Note that mingetty is very minimal; it won't set the baud rate, for instance, so it would already have to be set, e.g. with setserial, elsewhere in the init scripts. Or use another getty which does support setting the baud rate. (I don't need serial terminals on this computer, so I don't have any other getty programs installed right now...)
    ---

  • if I were to do this while logged in as david and do an 'alt-SysRq-l' will I be able to bring the machine down to its knees?

    Yes.

    ObComment: Since this isn't a default part of any binary distribution I know of, you'll have to compile it. While there, it should take only a few minutes to remove the keyboard commands you don't want users to have...but then you won't have them either.

  • Try this:

    perl -ne 'system $_' /dev/ttyS0

    Replace "ttyS0" with whatever serial port you really want to use, of course, and make sure that you're serial port is set up with the correct baud rate and such, probably using stty.
  • Also, I found that in RH6.1, the /etc/rc.d/rc.sysinit was killing my magic sysrequest key:

    # Turn off sysrq
    if [ -f /proc/sys/kernel/sysrq -a "$MAGIC_SYSRQ" = "no" ]; then
    echo "0" > /proc/sys/kernel/sysrq
    action "Turning off Magic SysRq key" /bin/true
    fi

    So, you can just set the $MAGIC_SYSRQ variable to "yes" at top of the script (it doesn't currently exist, but you can add it) or comment out this section. Otherwise, a '0' will get catted to /proc/sys/kernel/sysrq which will shut off the magic sysrq functionality!
  • A standard getty and a HP term emulator will work great if you need an extensive set of stuff to be run, and you are on a 'secure' system. If you don't care about security on the box, and only need a couple of commands run, there is a getty out there called rungetty that can run other programs instead of login; All you'd need is to 'fake' a serial connection to have it run said program. (I keep one running on a spare serial port that runs reboot; All I needed was a momentary toggle to complete it)
  • That's interesting...it looks like they took it out in 6.2 (I just looked at a 'fresh' test system).
  • Occasionally even getting into your box another way and killing off X or the svgalib program won't give you back normal control.

    Take a moment and read /usr/src/linux/Documentation/sysrq.txt [usrsrclinu...onsysrqtxt] and see if compiling that capability into your kernel isn't really what you want.
  • Theres an application called jslaunch with which you can assign applications to joystick buttons and sequences. I use it exactly for this reason. I have a 4 button joystick. The neat thing is that you can assign sequences to buttons also; so effectively (2^4)-1 possible combinations of programs are possible. But it's much easier to assin the "red" button to "killall -9 X". Hope this helps.
  • jump on another pc and telnet to your box and kill X that way
  • Have you tried Ctrl-Alt-Backspace?
    I find that even when X seems locked up pretty tight that will kill it.
  • by SEWilco ( 27983 )
    Type "man gpm" and you'll see that it can be told to execute commands when mouse buttons are pressed in special ways. I often use it on keyboardless servers to allow an operator to initiate a controlled shutdown or restart.
  • I read the documentation and I'm wondering if you use the key combo to kill processes, does it do this regardless of the user? i.e. if I were to do this while logged in as david and do an 'alt-SysRq-l' will I be able to bring the machine down to its knees?

    David

1 + 1 = 3, for large values of 1.

Working...