On Tue, Mar 23, 2004 at 12:31:57AM +0000, Karl Bongers wrote:
> 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".
Thanks for your patch.
I'm having small problems with using it though.
merlin@...:~$ irsend LIST Hauppauge 5
irsend: 0000000000001005 5
merlin@...:~$ grep SEND_RELAY /usr/sbin/lircd
Binary file /usr/sbin/lircd matches
merlin@...:~$ irsend SEND_RELAY SEND_ONCE Hauppauge 5
Mar 24 08:38:33 poltron lircd 0.6.6[8334]: accepted new client on /dev/lircd
Mar 24 08:38:33 poltron lircd 0.6.6[8334]: removed client
Ok, of course, that's one argument too many, but I can't get the correct
combination:
merlin@...:~$ irsend SEND_RELAY 'SEND_ONCE Hauppauge 5'
irsend: not enough arguments
merlin@...:~$ irsend SEND_RELAY SEND_ONCE 'Hauppauge 5'
merlin@...:~$ irsend 'SEND_RELAY SEND_ONCE' Hauppauge 5
merlin@...:~$ irsend SEND_RELAY Hauppauge 5
None of them show 'relaying message' in syslog, and my configured
application for this button doesn't get the message.
Any ideas?
Thanks
Marc
> 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);
--
"A mouse is a device used to point at the xterm you want to type in" - A.S.R.
Microsoft is to operating systems & security ....
.... what McDonalds is to gourmet cooking
Home page: http://marc.merlins.org/ | Finger marc_f@... for PGP key
|