<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>KVM Switch Hacking.</title>
		<link>http://www.allegro.cc/forums/view/587071</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Wed, 16 Aug 2006 23:08:35 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Hi, I&#39;ve been playing around with the set_leds() function today, and I&#39;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 &#39;2-port KVM Switch with Built-in Cabling&#39;. Here&#39;s the code:</p><div class="source-code snippet"><div class="inner"><pre><span class="p">#include &lt;allegro.h&gt;</span>

<span class="k1">int</span> main<span class="k2">(</span><span class="k2">)</span> <span class="k2">{</span>
  <a href="http://www.allegro.cc/manual/allegro_init" target="_blank"><span class="a">allegro_init</span></a><span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
  <a href="http://www.allegro.cc/manual/install_keyboard" target="_blank"><span class="a">install_keyboard</span></a><span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>

  <span class="k1">while</span><span class="k2">(</span><span class="n">1</span><span class="k2">)</span> <span class="k2">{</span>
    <a href="http://www.allegro.cc/manual/set_leds" target="_blank"><span class="a">set_leds</span></a><span class="k2">(</span>KB_SCROLOCK_FLAG<span class="k2">)</span><span class="k2">;</span>
    <a href="http://www.allegro.cc/manual/set_leds" target="_blank"><span class="a">set_leds</span></a><span class="k2">(</span><span class="k3">-</span><span class="n">1</span><span class="k2">)</span><span class="k2">;</span>
  <span class="k2">}</span>

  <span class="k1">return</span><span class="k2">(</span><span class="n">0</span><span class="k2">)</span><span class="k2">;</span>
<span class="k2">}</span>
</pre></div></div><p>

Do not run it without opening a terminal, else you&#39;ll have a harder time closing it. Also note that it didn&#39;t break my KVM switch at all, and I was able to switch back by pressing the button. I&#39;d like it if people tried it with different makes and models, and if anybody knew the reason.</p><p>EDIT:<br />I don&#39;t know if install_keyboard() is required, I left it because I couldn&#39;t be bothered finding out, and seeing as I use set_leds, a keyboard function, I thought it would probably be needed.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (James Stanley)</author>
		<pubDate>Wed, 16 Aug 2006 20:23:51 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>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?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (BAF)</author>
		<pubDate>Wed, 16 Aug 2006 22:34:48 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>No, that doesn&#39;t do anything, also the code only turns the light on, it doesn&#39;t press the key, and when I press the key the light doesn&#39;t come on, I don&#39;t know why.</p><p>And the terminal has to be closed before the screen changes, it doesn&#39;t work if you just close the program. This is what I don&#39;t understand.</p><p>EDIT:<br />Ignore the bottom section above, it&#39;s just because there&#39;s a slight delay, and I always close the terminal just before it switches.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (James Stanley)</author>
		<pubDate>Wed, 16 Aug 2006 22:37:44 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I still think it has something to do with some code. The fact that scroll lock doesn&#39;t turn on a light tells me something right there. Perhaps there&#39;s a computer driver that can switch your stuff by flashing scroll lock?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (BAF)</author>
		<pubDate>Wed, 16 Aug 2006 22:41:46 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>The only driver was for Windows, so I can&#39;t tell. You&#39;re probably right about it being something in the switch.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (James Stanley)</author>
		<pubDate>Wed, 16 Aug 2006 23:08:35 +0000</pubDate>
	</item>
</rss>
