Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » KVM Switch Hacking.

This thread is locked; no one can reply to it. rss feed Print
KVM Switch Hacking.
James Stanley
Member #7,275
May 2006
avatar

Hi, I've been playing around with the set_leds() function today, and I've found that I can make my KVM switch go to my other machine with the following program, I was wondering if anybody could test it. Compile it, linked with allegro, open a terminal window, run it for 10 seconds or so, then close it with Ctrl-C, then close the terminal window. See what happens. For reference, I have a Belkin USB 2-Port KVM Switch. Underneath it says '2-port KVM Switch with Built-in Cabling'. Here's the code:

#include <allegro.h>

int main() {
  allegro_init();
  install_keyboard();

  while(1) {
    set_leds(KB_SCROLOCK_FLAG);
    set_leds(-1);
  }

  return(0);
}

Do not run it without opening a terminal, else you'll have a harder time closing it. Also note that it didn't break my KVM switch at all, and I was able to switch back by pressing the button. I'd like it if people tried it with different makes and models, and if anybody knew the reason.

EDIT:
I don't know if install_keyboard() is required, I left it because I couldn't be bothered finding out, and seeing as I use set_leds, a keyboard function, I thought it would probably be needed.

BAF
Member #2,981
December 2002
avatar

Im guessing flashing the scroll lock key is a code to tell the kvm to switch. What if you rapidly hit the scroll lock button?

James Stanley
Member #7,275
May 2006
avatar

No, that doesn't do anything, also the code only turns the light on, it doesn't press the key, and when I press the key the light doesn't come on, I don't know why.

And the terminal has to be closed before the screen changes, it doesn't work if you just close the program. This is what I don't understand.

EDIT:
Ignore the bottom section above, it's just because there's a slight delay, and I always close the terminal just before it switches.

BAF
Member #2,981
December 2002
avatar

I still think it has something to do with some code. The fact that scroll lock doesn't turn on a light tells me something right there. Perhaps there's a computer driver that can switch your stuff by flashing scroll lock?

James Stanley
Member #7,275
May 2006
avatar

The only driver was for Windows, so I can't tell. You're probably right about it being something in the switch.

Go to: