diff options
-rw-r--r-- | Makefile | 29 | ||||
-rw-r--r-- | gram.l | 15 | ||||
-rw-r--r-- | gram.y | 15 | ||||
-rw-r--r-- | irbox.conf | 0 | ||||
-rwxr-xr-x | irbox.init | 46 | ||||
-rw-r--r-- | irdev.c | 17 | ||||
-rw-r--r-- | irdev.h | 16 | ||||
-rwxr-xr-x | irdumptable | 165 | ||||
-rw-r--r-- | version.h | 29 |
9 files changed, 303 insertions, 29 deletions
@@ -1,29 +1,36 @@ # -# IRBOX, an Ivy driver for infra-red remote controls +# IRBOX, an Ivy driver for infra-red remote controls # -# Copyright 1998-1999 -# Centre d'Etudes de la Navigation Aerienne +# Copyright 1998-1999 +# Centre d'Etudes de la Navigation Aerienne # -# Makefile +# Makefile # -# $Id$ +# Authors: Stephane Chatty <chatty@cenatoulouse.dgac.fr> +# +# $Id$ +# +# Please refer to file version.h for the +# copyright notice regarding this software # SHELL = /bin/sh CC = gcc -SRCS = irdev.c irtable.c irman.c -OBJS = irdev.o irtable.o lex.yy.o y.tab.o irman.o +SRCS = irdev.c irtable.c irbox.c +OBJS = irdev.o irtable.o lex.yy.o y.tab.o irbox.o CDEFS = COPTS = -g -Wall -CINCS = +CINCS = -I../../../libraries/ivy-c/src +CLIBS = -I../../../libraries/ivy-c/src CFLAGS = $(CDEBUGFLAGS) $(CDEFS) $(COPTS) $(CINCS) +LDFLAGS = $(COPTS) $(CLIBS) -all: irman +all: irbox -irman: $(OBJS) - $(CC) $(CFLAGS) -o irbox $(OBJS) -L../IVY_C/src -livy +irbox: $(OBJS) + $(CC) $(LDFLAGS) -o irbox $(OBJS) -livy irdev.o: irdev.h @@ -1,11 +1,20 @@ %{ + /* - * This is a lexical analyzer * - * It comes with an associated grammar. + * IRBOX, an Ivy driver for infra-red remote controls + * + * Copyright 1998-1999 + * Centre d'Etudes de la Navigation Aerienne + * + * This is the lexical analyser for reading tables + * + * Authors: Stephane Chatty <chatty@cenatoulouse.dgac.fr> * - * + * $Id$ * + * Please refer to file version.h for the + * copyright notice regarding this software */ #include <stdio.h> @@ -2,17 +2,22 @@ /* * - * IRBOX, an Ivy driver for infra-red remote controls + * IRBOX, an Ivy driver for infra-red remote controls * - * Copyright 1998-1999 - * Centre d'Etudes de la Navigation Aerienne + * Copyright 1998-1999 + * Centre d'Etudes de la Navigation Aerienne * - * This is the grammar for reading tables + * This is the grammar for reading tables * - * $Id$ + * Authors: Stephane Chatty <chatty@cenatoulouse.dgac.fr> * + * $Id$ + * + * Please refer to file version.h for the + * copyright notice regarding this software */ + extern const char* const ResWords; diff --git a/irbox.conf b/irbox.conf new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/irbox.conf diff --git a/irbox.init b/irbox.init new file mode 100755 index 0000000..04d83f2 --- /dev/null +++ b/irbox.init @@ -0,0 +1,46 @@ +#!/bin/sh +# +# irbox: Starts the irbox Ivy agent +# +# Version: @(#) /etc/rc.d/init.d/irbox.init 1.0 +# +# chkconfig: - 98 02 +# description: This is a daemon that drives an Irman infra-red device and \ +# emits its events on an Ivy bus +# processname: irbox +# config: /etc/irbox.conf + +# Source function library. +. /etc/rc.d/init.d/functions + +# See how we were called. +case "$1" in + start) + echo -n "Infra-red Ivy driver... " + daemon irbox + echo + touch /var/lock/subsys/irbox + ;; + stop) + echo -n "Shutting down Infra-red Ivy driver: " + killproc irbox + rm -f /var/lock/subsys/ypbind + echo + ;; + status) + status irbox + ;; + reload) + killproc -HUP irbox + ;; + restart) + $0 stop + $0 start + ;; + *) + echo "*** Usage: irbox {start|stop|status|restart¦reload}" + exit 1 +esac + +exit 0 + @@ -1,14 +1,21 @@ /* * - * IRBOX, an Ivy driver for infra-red remote controls + * IRBOX, an Ivy driver for infra-red remote controls * - * Copyright 1998-1999 - * Centre d'Etudes de la Navigation Aerienne + * Copyright 1998-1999 + * Centre d'Etudes de la Navigation Aerienne * - * Device driver + * Device driver * - * $Id$ + * Authors: Francois-Regis Colin <fcolin@cenatoulouse.dgac.fr> + * Yann Malichecq + * Stephane Chatty <chatty@cenatoulouse.dgac.fr> * + * + * $Id$ + * + * Please refer to file version.h for the + * copyright notice regarding this software */ #include <stdio.h> @@ -1,14 +1,20 @@ /* * - * IRBOX, an Ivy driver for infra-red remote controls + * IRBOX, an Ivy driver for infra-red remote controls * - * Copyright 1998-1999 - * Centre d'Etudes de la Navigation Aerienne + * Copyright 1998-1999 + * Centre d'Etudes de la Navigation Aerienne * - * Device driver + * Device driver * - * $Id$ + * Authors: Francois-Regis Colin <fcolin@cenatoulouse.dgac.fr> + * Yann Malichecq + * Stephane Chatty <chatty@cenatoulouse.dgac.fr> * + * $Id$ + * + * Please refer to file version.h for the + * copyright notice regarding this software */ diff --git a/irdumptable b/irdumptable new file mode 100755 index 0000000..94554e0 --- /dev/null +++ b/irdumptable @@ -0,0 +1,165 @@ +#!/usr/bin/perl -w +# +# IRBOX, an Ivy driver for infra-red remote controls +# +# Copyright 1998-1999 +# Centre d'Etudes de la Navigation Aerienne +# +# Authors: Johnny Accot <accot@cenatoulouse.dgac.fr> +# Stephane Chatty <chatty@cenatoulouse.dgac.fr> +# +# A utility for creating code tables from an RCA programmable remote +# +# $Id$ +# +# Please refer to file version.h for the +# copyright notice regarding this software +# + +$SIG{HUP} = $SIG{INT} = $SIG{KILL} = 'Quit'; + +use strict; +use Ivy; +use File::Basename; + +$| = 1; + +my @vcrkeys = ('power', 'channel up', 'channel down', 'rew', 'play', 'ff', 'rec', 'stop', 'pause'); +my @tvkeys = ('mute', 'power', 'volume up', 'volume down', 'channel up', 'channel down'); +my @cablekeys = ('power', 'channel up', 'channel down'); + +my %typekeys = ('VCR', \@vcrkeys, 'TV', \@tvkeys, 'CABLE', \@cablekeys); + +my $me = basename ($0); +die ("Usage: $me [<brand:class:id>] [RCA mode number]\n") unless @ARGV < 3; + + +# retrieve various IR control identification items + +my ($id, $mode) = @ARGV; + +if (!defined $id) { + print "ID of the IR remote control (eg: Sony:VCR:1)? "; + chop ($id = <>); +} + +my ($brand, $type, $num) = split (':', $id, 3); + +if (!defined ($brand) || !defined ($type)) { + die "Brand and type must be defined"; +} + + +my $comment; +$comment = "# obtained on an RCA SystemLink 3 in $type mode $mode" if (defined $mode); + +# we only handle types we know + +if (!defined ($typekeys{$type})) { + die "Type $type unknown\n"; +} + +# +# OK, let's go +# + +# first, prepare to receive key presses from Ivy bus + +my $host = 'nebul'; +Ivy::bindRegexp ("$host\.IRBOX unknown code ([0-9]+ [0-9]+ [0-9]+ [0-9]+ [0-9]+ [0-9]+)", [\&ReceiveCode]); +Ivy::bindRegexp ("$host\.IRBOX Down (.*)", [\&PrintCode]); + + +Ivy::start (-loopMode => 'LOCAL', + -appName => 'IR Remote Control Map dumper', + -broadcastPort => 2019); + + +# then create list of keys the user will have to press, +# and ask for the first one + +my @keylist = @{$typekeys{$type}}; +my %table; + +my $key = shift @keylist; +print "Please press on '$key'..."; + +# then loop + +Ivy::mainLoop (); + +&Dump(); +exit 1; + + + + +sub ReceiveCode { + my $code = $_[1]; + print "ok, code = $code\n"; + $table{$key} = $code; + $key = shift @keylist; + if (defined $key) { + print "Please press on '$key'..."; + } else { + print "Done, thank you\n"; + + # should exit loop, but Ivy does not allow that + # Ivy::stop (); + # So, let's be brutal! + Dump (); + exit 1; + } +} + +sub PrintCode { + my $name = $_[1]; + print "$name\n"; +} + +sub Quit { + Ivy::stop (); + exit 1; +} + +sub Dump { + my $lowbrand = $brand; + $lowbrand =~ tr/[A-Z]/[a-z]/; + my $brandnum; + if (defined ($num)) { + $brandnum = "$brand $num"; + } else { + $brandnum = $brand; + $num = ""; + } + my $filename = "$lowbrand$type$num.ir"; + print "Saving table $filename\n"; + + if (-s "$filename") { + my $choice; + print "File $filename exists... Overwrite? (y/[n]) "; + chop ($choice = <>); + until ($choice eq 'y' or $choice eq 'n') { + print "Please answer by 'y' or 'n': "; + chop ($choice = <>); + } + die ("Aborting.\n") if $choice eq 'n'; + } + + open Table, ">$filename"; + print Table "name $brand$type$num\n"; + print Table "type: $type\n"; + print Table "\n"; + print Table "brand: $brandnum\n"; + print Table "brand: RCA SystemLink 3 [mode $mode]\n" if defined $mode; + print Table "\n$comment\n" if defined $comment; + print Table "\n"; + + foreach my $key (@{$typekeys{$type}}) { + print Table "$key:\t$table{$key}\n"; + } + close Table; + + exit; + +} diff --git a/version.h b/version.h new file mode 100644 index 0000000..1c32c3f --- /dev/null +++ b/version.h @@ -0,0 +1,29 @@ +/* + * + * IRBOX, an Ivy driver for infra-red remote controls + * + * Copyright 1998-1999 + * Centre d'Etudes de la Navigation Aerienne + * + * Version 1.0 + * + * Authors: Stephane Chatty <chatty@cenatoulouse.dgac.fr> + * Francois-Regis Colin <fcolin@cenatoulouse.dgac.fr> + * Yann Malichecq + * + * $Id$ + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ |