|
From: Karl B. <ka...@tu...> - 2004-03-23 03:57:49
|
Hi Marc,
Heres a patch of some code to do this, it is a year old and I haven't
tried it since, so your milage may vary.
I recall using it with quotes to trick irsend into being happy about
the number of parameters, like:$irsend SEND_RELAY "message to relay".
Karl.
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));
}
=20
+int send_relay(int fd,char *message,char *arguments)
+{
+ int length;
+ int i;
+
+ /* pass up "SEND_RELAY ", send rest of string */
+ while ((*message !=3D 0) && (*message !=3D ' '))
+ ++message;
+ if (*message =3D=3D ' ')
+ ++message;
+ length =3D strlen(message);
+
+ if(length)
+ {
+ LOGPRINTF(1,"relaying message: \"%s\"",message);
+ for(i=3D0;i<clin;i++)
+ {
+ /* don't relay messages to remote clients */
+ if(cli_type[i]=3D=3DCT_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);
On Sun, Mar 21, 2004 at 11:35:00PM -0800, Marc MERLIN wrote:
> So, before you ask why, let me explain.
> I have an X10 mouseremote, which is already configured on my machine, and
> that i can use to run any unix command (I also use X10 remotes, which
> generate, seperately X10 events that I can use to trigger unix commands
> too).
>=20
> I use mplayer, which does not (AFAIK) accept random commands from a named
> pipe like xmms does, but it does have an lirc interface
>=20
> I also have a TV card, with a remote (haupage), which I have working with
> lirc and mplayer.
>=20
> Now, I'd like to use my X10 remotes to run unix commands so that can feed=
a
> fake IR remote command to lircd, and also control mplayer that way
>=20
> How do I do that?
>=20
> Thanks
> Marc
|