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/JessH.patch | 44 ++++++++++++++++ additions/SW/usb-ir-toy-lirc/lircrc | 90 ++++++++++++++++++++++++++++++++ additions/SW/usb-ir-toy-lirc/send | 33 ++++++++++++ 3 files changed, 167 insertions(+) create mode 100644 additions/SW/usb-ir-toy-lirc/JessH.patch create mode 100644 additions/SW/usb-ir-toy-lirc/lircrc create mode 100644 additions/SW/usb-ir-toy-lirc/send (limited to 'additions') diff --git a/additions/SW/usb-ir-toy-lirc/JessH.patch b/additions/SW/usb-ir-toy-lirc/JessH.patch new file mode 100644 index 0000000..798314b --- /dev/null +++ b/additions/SW/usb-ir-toy-lirc/JessH.patch @@ -0,0 +1,44 @@ +Index: pic_bootloader.cpp +=================================================================== +--- pic_bootloader.cpp (revision 2023) ++++ pic_bootloader.cpp (working copy) +@@ -187,7 +187,7 @@ + switch (memory) + { + case MEM_FLASH: +- return 2; ++ return 32; + case MEM_EEPROM: + return 8; + case MEM_ID: +@@ -215,11 +215,17 @@ + { + show_progress(OP_ERASING, type(), memory, 0); + open(params); +- // erase 0x800-0x4000 //!!! 18f24j50 change ++ // erase 0x800-0x4000 + command.erase_flash.echo = ++command_id; + command.erase_flash.addr_hi = 0x08; + command.erase_flash.addr_lo = 0x00; +- command.erase_flash.size_x64 = 0x0D; ++ command.erase_flash.size_x64 = 0xE0; ++ transaction(&command, &response); ++ // erase 0x4000-0x6000 ++ command.erase_flash.echo = ++command_id; ++ command.erase_flash.addr_hi = 0x40; ++ command.erase_flash.addr_lo = 0x00; ++ command.erase_flash.size_x64 = 0x80; + transaction(&command, &response); + close(); + show_progress(OP_ERASING, type(), memory, OPERATION_DONE); +@@ -379,9 +385,8 @@ + command.write_flash.echo = ++command_id; + command.write_flash.addr_hi = (unsigned char)((address >> 8) & 0xFF); + command.write_flash.addr_lo = (unsigned char)(address & 0xFF); +- command.write_flash.flush = (unsigned char) 0xff; + // size must be 8 dividable +- //eAssert(size % 8 == 0); ++ eAssert(size % 8 == 0); + command.write_flash.size8 = size; + transaction(&command, &response); + show_progress(OP_PROGRAMMING, type(), memory, buffer->progress()); diff --git a/additions/SW/usb-ir-toy-lirc/lircrc b/additions/SW/usb-ir-toy-lirc/lircrc new file mode 100644 index 0000000..51c93db --- /dev/null +++ b/additions/SW/usb-ir-toy-lirc/lircrc @@ -0,0 +1,90 @@ +begin + prog=vlc + button=b1_push + config=key-play-pause +end +begin + prog=vlc + button=b1_pull + config=key-stop +end +begin + prog=vlc + button=b1_rot_cw + config=key-vol-up +end +begin + prog=vlc + button=b1_rot_ccw + config=key-vol-down +end +begin + prog=vlc + button=b1_press_back + config=key-toggle-fullscreen +end +begin + prog=vlc + button=b1_move_left + config=key-jump-medium +end +begin + prog=vlc + button=b1_move_right + config=key-jump+medium +end +begin + prog=vlc + button=b1_tap_left + config=key-chapter-prev +end +begin + prog=vlc + button=b1_tap_right + config=key-chapter-next +end +begin + prog=vlc + button=b2_move_up + config=key-nav-up +end +begin + prog=vlc + button=b2_move_left + config=key-nav-left +end +begin + prog=vlc + button=b2_move_right + config=key-nav-right +end +begin + prog=vlc + button=b2_move_down + config=key-nav-down +end +begin + prog=vlc + button=b2_push + config=key-nav-activate +end +begin + prog=vlc + button=b2_tap_left + config=key-audio-track +end +begin + prog=vlc + button=b2_tap_right + config=key-audio-track +end +begin + prog=vlc + button=b2_tap_top + config=key-subtitle-track +end +begin + prog=vlc + button=b2_tap_bottom + config=key-subtitle-track +end 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