<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/1.5.2" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
	<title>Comments on: Switch load using COM port</title>
	<link>http://blog.savel.org/2007/02/03/switch-load-using-com-port/</link>
	<description>Same chaos as in my room or DIY guide for you.</description>
	<pubDate>Tue, 06 Jan 2009 06:36:06 +0000</pubDate>
	<generator>http://wordpress.org/?v=1.5.2</generator>

	<item>
 		<title>Comment on Switch load using COM port by: Administrator</title>
		<link>http://blog.savel.org/2007/02/03/switch-load-using-com-port/#comment-70</link>
		<pubDate>Fri, 02 Feb 2007 23:12:29 +0000</pubDate>
		<guid>http://blog.savel.org/2007/02/03/switch-load-using-com-port/#comment-70</guid>
					<description>Control program by Eimis.

execute &quot;gcc file.c -o executable&quot; to compile.

&lt;code&gt;#include &amp;#60;sys/types.h&amp;#62;
  #include &amp;#60;sys/ioctl.h&amp;#62;
  #include &amp;#60;fcntl.h&amp;#62;
  #include &amp;#60;errno.h&amp;#62;
  #include &amp;#60;stdlib.h&amp;#62;
  #include &amp;#60;unistd.h&amp;#62;
  #include &amp;#60;stdio.h&amp;#62;
  #include &amp;#60;signal.h&amp;#62;
  #include &amp;#60;termios.h&amp;#62;
  /* Main program. */
  int main(int argc, char **argv)
  {
int fd;
int status;
int set_bits;
 /* Open monitor device. */
  if ((fd = open(argv[1], O_RDWR &amp;#166; O_NDELAY)) &amp;#60; 0) {
  fprintf(stderr, &amp;#34;ar-2: %s: %s\n&amp;#34;,
  argv[1], sys_errlist[errno]);
  exit(1);
  }
 ioctl(fd, TIOCMGET, &amp;#38;status);
  set_bits=2;
  ioctl(fd, TIOCMSET, &amp;#38;set_bits);
// Nutraukus maitinim&amp;#261; laukti 10 sekund&amp;#382;i&amp;#371;
  sleep(10);
  ioctl(fd, TIOCMGET, &amp;#38;status);
  if (status &amp;#38; TIOCM_DTR) {
  set_bits=0;
  ioctl(fd, TIOCMSET, &amp;#38;set_bits);
  }
  close(fd);
  }&lt;/code&gt;</description>
		<content:encoded><![CDATA[	<p>Control program by Eimis.</p>
	<p>execute &#8220;gcc file.c -o executable" to compile.</p>
	<p><code>#include &lt;sys/types.h&gt;<br />
  #include &lt;sys/ioctl.h&gt;<br />
  #include &lt;fcntl.h&gt;<br />
  #include &lt;errno.h&gt;<br />
  #include &lt;stdlib.h&gt;<br />
  #include &lt;unistd.h&gt;<br />
  #include &lt;stdio.h&gt;<br />
  #include &lt;signal.h&gt;<br />
  #include &lt;termios.h&gt;<br />
  /* Main program. */<br />
  int main(int argc, char **argv)<br />
  {<br />
int fd;<br />
int status;<br />
int set_bits;<br />
 /* Open monitor device. */<br />
  if ((fd = open(argv[1], O_RDWR | O_NDELAY)) &lt; 0) {<br />
  fprintf(stderr, &quot;ar-2: %s: %s\n&quot;,<br />
  argv[1], sys_errlist[errno]);<br />
  exit(1);<br />
  }<br />
 ioctl(fd, TIOCMGET, &amp;status);<br />
  set_bits=2;<br />
  ioctl(fd, TIOCMSET, &amp;set_bits);<br />
// Nutraukus maitinim&#261; laukti 10 sekund&#382;i&#371;<br />
  sleep(10);<br />
  ioctl(fd, TIOCMGET, &amp;status);<br />
  if (status &amp; TIOCM_DTR) {<br />
  set_bits=0;<br />
  ioctl(fd, TIOCMSET, &amp;set_bits);<br />
  }<br />
  close(fd);<br />
  }</code>
</p>
]]></content:encoded>
				</item>
</channel>
</rss>
