This patch allows you to send fake IR events to lircd, so that you can
control your lirc aware programs (like mplayer) from another program (like
an X10 remote) or cron or whatever.

Note that the syntax is a bit weird.
Look at lircd.conf, and if you have
begin remote
  name  Hauppauge
(...)
  5                        0x0000000000001005

you can send commands as such:
irsend SEND_RELAY "0000000000001005 00 5" Hauppauge
                                    ^^
			always 00 as far as I can tell

The patch is from Karl Bongers <karl@turbobit.com>

Compiled by Marc MERLIN <marc_soft@merlins.org>


diff -urN lirc-4-01-03/daemons/lircd.c lirc-4-01-03-relay/daemons/lircd.c
--- lirc-4-01-03/daemons/lircd.c    Sun Mar 30 06:22:11 2003
+++ lirc-4-01-03-relay/daemons/lircd.c      Tue Apr  1 23:56:15 2003
@@ -103,6 +103,7 @@
    {"SEND_START",send_start},
    {"SEND_STOP",send_stop},
    {"VERSION",version},
+   {"SEND_RELAY",send_relay},
    {NULL,NULL}
    /*
    {"DEBUG",debug},
@@ -1216,6 +1217,38 @@
    return(send_core(fd,message,arguments,0));
 }

+int send_relay(int fd,char *message,char *arguments)
+{
+   int length;
+   int     i;
+
+   /* pass up "SEND_RELAY ", send rest of string */
+   while ((*message != 0) && (*message != ' '))
+           ++message;
+   if (*message == ' ')
+           ++message;
+   length = strlen(message);
+
+   if(length)
+   {
+           LOGPRINTF(1,"relaying message: \"%s\"",message);
+           for(i=0;i<clin;i++)
+           {
+                   /* don't relay messages to remote clients */
+                   if(cli_type[i]==CT_REMOTE)
+                           continue;
+                   LOGPRINTF(1,"writing to client %d",i);
+                   if(write_socket(clis[i],message,length)<length)
+                   {
+                           remove_client(clis[i]);
+                           i--;
+                   }
+           }
+   }
+   /* return close client(to close rc/irsend without timeout/pause  */
+   return(0);
+}
+
 int send_core(int fd,char *message,char *arguments,int once)
 {
    struct ir_remote *remote;
diff -urN lirc-4-01-03/daemons/lircd.h lirc-4-01-03-relay/daemons/lircd.h
--- lirc-4-01-03/daemons/lircd.h    Sat Feb 15 03:00:58 2003
+++ lirc-4-01-03-relay/daemons/lircd.h      Tue Apr  1 23:33:44 2003
@@ -76,6 +76,7 @@
 int send_once(int fd,char *message,char *arguments);
 int send_start(int fd,char *message,char *arguments);
 int send_stop(int fd,char *message,char *arguments);
+int send_relay(int fd,char *message,char *arguments);
 int send_core(int fd,char *message,char *arguments,int once);
 int version(int fd,char *message,char *arguments);
 int get_pid(int fd,char *message,char *arguments);
