From 446ab81da2e70ea02e607418b74b1286546bd37a Mon Sep 17 00:00:00 2001 From: dakkar Date: Mon, 8 Oct 2012 12:49:20 +0100 Subject: usb-ir-toy --- additions/SW/usb-ir-toy-lirc/send | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 additions/SW/usb-ir-toy-lirc/send (limited to 'additions/SW/usb-ir-toy-lirc/send') diff --git a/additions/SW/usb-ir-toy-lirc/send b/additions/SW/usb-ir-toy-lirc/send new file mode 100644 index 0000000..f0f7a1e --- /dev/null +++ b/additions/SW/usb-ir-toy-lirc/send @@ -0,0 +1,33 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use 5.016; +use Time::HiRes 'sleep'; + +my @cmds; + +open my $fh,'<','/etc/lirc/lircd.conf'; +while (my $line=<$fh>) { + $line =~ m{^\s+(b[123]\w+)} or next; + push @cmds,$1; +} + +while (@cmds) { + my $current = shift @cmds; + say "Ready to send $current"; + my $ans=<>; + if ($ans =~ m{^a}) { + unshift @cmds,$current; + $current=pop @cmds; + unshift @cmds,$current; + redo; + } + elsif ($ans =~ m{^n}) { + push @cmds,$current; + next; + } + system('irsend','SEND_START','sonic',$current); + sleep 0.8; + system('irsend','SEND_STOP','sonic',''); + push @cmds,$current; +} -- cgit v1.2.3