summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordakkar <dakkar@thenautilus.net>2012-10-08 12:49:20 +0100
committerdakkar <dakkar@thenautilus.net>2012-10-08 12:49:20 +0100
commit446ab81da2e70ea02e607418b74b1286546bd37a (patch)
tree2849036a6e32060fa6a242e498d4c43e4d1ccaf2
parentimport all reviews (diff)
downloadthenautilus-446ab81da2e70ea02e607418b74b1286546bd37a.tar.gz
thenautilus-446ab81da2e70ea02e607418b74b1286546bd37a.tar.bz2
thenautilus-446ab81da2e70ea02e607418b74b1286546bd37a.zip
usb-ir-toy
-rw-r--r--additions/SW/usb-ir-toy-lirc/JessH.patch44
-rw-r--r--additions/SW/usb-ir-toy-lirc/lircrc90
-rw-r--r--additions/SW/usb-ir-toy-lirc/send33
-rw-r--r--src/SW/usb-ir-toy-lirc/.gitignore2
-rw-r--r--src/SW/usb-ir-toy-lirc/document.en.rest.txt108
-rw-r--r--src/SW/usb-ir-toy-lirc/document.it.rest.txt111
l---------src/SW/usb-ir-toy-lirc/du2html.xsl1
7 files changed, 389 insertions, 0 deletions
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;
+}
diff --git a/src/SW/usb-ir-toy-lirc/.gitignore b/src/SW/usb-ir-toy-lirc/.gitignore
new file mode 100644
index 0000000..08d33d4
--- /dev/null
+++ b/src/SW/usb-ir-toy-lirc/.gitignore
@@ -0,0 +1,2 @@
+/document.en.du.xml
+/document.it.du.xml
diff --git a/src/SW/usb-ir-toy-lirc/document.en.rest.txt b/src/SW/usb-ir-toy-lirc/document.en.rest.txt
new file mode 100644
index 0000000..9f7169e
--- /dev/null
+++ b/src/SW/usb-ir-toy-lirc/document.en.rest.txt
@@ -0,0 +1,108 @@
+==============================
+Using the USB IR Toy with LIRC
+==============================
+:CreationDate: 2012-10-08 10:49:07
+:Id: SW/usb-ir-toy-lirc
+:tags: - software
+ - configs
+
+So I got myself a `programmable remote control in the shape of Eleven's
+sonic screwdriver <http://thewandcompany.com/sonic/>`_ (sorry,
+horrible in-accessible website). Of course I want to control my PC
+with it!
+
+To do that, I needed a IR receiver and `LIRC
+<http://www.lirc.org/>`_. Since I sometimes like being overly generic,
+I bought `Dangerous Prototypes <http://dangerousprototypes.com/>`_
+`USB Infrared Toy
+<http://dangerousprototypes.com/docs/USB_Infrared_Toy>`_, which allows
+me to send & receive any kind of IR pulse stream.
+
+Getting the three pieces (remote, toy, LIRC) to play together was more
+effort than I'd really liked, so here's what I did, to help everybody
+else.
+
+Flash a newer firmware
+======================
+
+Your IR Toy is probably running an old version of the firmware. If
+you're running Windows, the `instructions provided
+<http://dangerousprototypes.com/docs/USB_IR_Toy_firmware_update>`_ may
+work; otherwise, you have to dig deeper. The source code for the
+``fw_update`` program that you can get from those pages (or from `the
+Subversion repository
+<http://dangerous-prototypes-open-hardware.googlecode.com/svn/trunk/Bootloaders/USB-HID-Diolan/18F24J50/fw_update/>`_)
+does not even compile (it "forgets" to include half the header files
+it needs), and when you get it to compile it segfaults. User
+"JessH" of the Dangerous Prototypes forums `posted a working version
+<http://dangerousprototypes.com/forum/viewtopic.php?t=3697&p=37398#p37371>`_
+(`here's the patch <JessH.patch>`_ if you want to see it, it should
+apply to the SVN version).
+
+.. note::
+
+ Yes, I know I'm pointing at the updater source for the 18F24J50, but
+ the chip on the actual IR Toy says "18F2550". What can I say, it
+ works!
+
+Having compiled it, I was able to update the firmware to version 22::
+
+ $ echo '$' > /dev/ttyACM0
+ $ ./fw_update -e -w -v -m all -vid 0x04D8 -pid 0xFD0B \
+ -ix ~/src/dangerous-prototypes-open-hardware/USB_IR_Toy/package/firmware/USBIRToy.v22.hex
+
+Unplug, re-plug, and we're set.
+
+Patching LIRC
+=============
+
+LIRC can use the IR Toy in ``irman`` compatibility mode, but I needed
+full send capability, to program the sonic screwdriver. I found `a
+patch to add full support
+<http://sourceforge.net/mailarchive/forum.php?thread_name=4ebf97df-17f8-48bb-ba65-32e4b9983ac4%40devleno&forum_name=lirc-list>`_,
+thanks to Peter Kooiman. If you're running Gentoo, you can add `my
+overlay <http://www.thenautilus.net/cgit/gentoo-overlay/>`_ and
+install `my patched LIRC
+<http://www.thenautilus.net/cgit/gentoo-overlay/tree/app-misc/lirc/>`_.
+
+Configuring LIRC
+================
+
+This may well be written down somewhere, but I had problems finding a
+useful guide, so I'll just show what I did:
+
+1) get a full Philips RC-5 code list from `the LIRC remotes repository
+ <http://lirc.sourceforge.net/remotes/rc-5/>`_
+
+2) assign, arbitrarily, the first 39 codes to the 13 gestures on 3
+ memory banks of the screwdriver::
+
+ begin remote
+ name sonic
+ # snip
+ begin codes
+ b1_tap_top 0x1000
+ b1_tap_left 0x1001
+ #etc etc
+
+Programming the remote
+======================
+
+I wrote `a simple Perl program to send the IR codes <send>`_. Run it
+with ``lircd`` running and ``irsend`` in your path. When it say
+``Ready to send $something``, press "enter" to send it, ``a`` to go
+back to the previous code (useful if the screwdriver didn't get it),
+``n`` to go the next code without sending anything.
+
+I put the screwdriver in programming mode, performed all 39 gestures
+one after the other, and programmed all of them. LIRC now uses
+sensible names for the 39 gestures.
+
+Using it
+========
+
+Finally, I re-compiled `vlc <http://www.videolan.org/>`_ with LIRC
+support, and wrote `a |lircrc| for vlc <lircrc>`_. With that, I can
+control ``vlc`` with my sonic screwdriver!
+
+.. |lircrc| replace:: ``~/.lircrc``
diff --git a/src/SW/usb-ir-toy-lirc/document.it.rest.txt b/src/SW/usb-ir-toy-lirc/document.it.rest.txt
new file mode 100644
index 0000000..953bd22
--- /dev/null
+++ b/src/SW/usb-ir-toy-lirc/document.it.rest.txt
@@ -0,0 +1,111 @@
+=================================
+Come usare lo USB IR Toy con LIRC
+=================================
+:CreationDate: 2012-10-08 10:49:07
+:Id: SW/usb-ir-toy-lirc
+:tags: - software
+ - configs
+
+Mi son comprato un `telecomando universale a forma di cacciavite
+sonico <http://thewandcompany.com/sonic/>`_ (il sito è orrendo e
+difficile da navigare…). Chiaramente voglio poterci controllare il mio
+PC!
+
+Per farlo, mi serviva un ricevitore IR e `LIRC
+<http://www.lirc.org/>`_. Visto che mi piace complicarmi la vita, ho
+comprato lo `USB Infrared Toy
+<http://dangerousprototypes.com/docs/USB_Infrared_Toy>`_ da `Dangerous
+Prototypes <http://dangerousprototypes.com/>`_, che permette di
+inviare e ricevere qualsiasi sequenza di impulsi a infrarossi.
+
+Convincere i tre pezzi (telecomando, Toy, LIRC) a funzionare assieme è
+stato più complicato di quel che avrei gradito, per cui descrivo qua
+quel che ho fatto, per aiutare i prossimi.
+
+Aggiornare il firmware
+======================
+
+Il vostro IR Top ha probabilmente una versione vecchia del
+firmware. Se usate Windows, le `instruzioni fornite
+<http://dangerousprototypes.com/docs/USB_IR_Toy_firmware_update>`_
+potrebbero anche funzionare; altrimenti, bisogna studiarci un po'. I
+sorgenti del programma ``fw_update`` che potete ottenere da quelle
+pagine (o dal `repository Subversion
+<http://dangerous-prototypes-open-hardware.googlecode.com/svn/trunk/Bootloaders/USB-HID-Diolan/18F24J50/fw_update/>`_)
+non compilano neppure (si sono "scordati" di includere metà degli
+header che servono), e quando riuscite a compilarli, vanno in
+segfault. L'utente "JessH" dei forum di Dangerous Prototypes `ha
+postato una versione che funziona
+<http://dangerousprototypes.com/forum/viewtopic.php?t=3697&p=37398#p37371>`_
+(`questa è la patch <JessH.patch>`_ se la volete vedere, dovrebbe
+applicarsi alla versione SVN).
+
+.. note::
+
+ Sì, lo so che sto puntando ai sorgenti per il 18F24J50, ma il chip
+ sul IR Toy dice "18F2550". Che ci posso fare, così funziona!
+
+Dopo averlo compilato, sono finalmente riuscito ad aggiornare il
+firmware alla versione 22::
+
+ $ echo '$' > /dev/ttyACM0
+ $ ./fw_update -e -w -v -m all -vid 0x04D8 -pid 0xFD0B \
+ -ix ~/src/dangerous-prototypes-open-hardware/USB_IR_Toy/package/firmware/USBIRToy.v22.hex
+
+Stacca, ri-attacca, e siamo pronti.
+
+Patch per LIRC
+==============
+
+LIRC può usare lo IR Toy in modalità compatibile ``irman``, ma a me
+serviva la funzione completa di invio segnali, per programmare il
+cacciavite. Ho trovato `una patch per aggiungere il supporto completo
+<http://sourceforge.net/mailarchive/forum.php?thread_name=4ebf97df-17f8-48bb-ba65-32e4b9983ac4%40devleno&forum_name=lirc-list>`_,
+grazie a Peter Kooiman. Se usate Gentoo, potete aggiungere `la mia
+overlay <http://www.thenautilus.net/cgit/gentoo-overlay/>`_ e
+installare `LIRC già modificato
+<http://www.thenautilus.net/cgit/gentoo-overlay/tree/app-misc/lirc/>`_.
+
+Configurare LIRC
+================
+
+Questo dovrebbe essere scritto da qualche parte, ma non sono riuscito
+a trovare usa spiegazione usabile, per cui mostro quel che ho fatto:
+
+1) mi son procurato un set completo di codici Philips RC-5 dal
+ `repository di telecomandi LIRC
+ <http://lirc.sourceforge.net/remotes/rc-5/>`_
+
+2) ho assegnato, arbitrariamente, i primi 39 codici ai 13 gesti su 3
+ banchi di memoria del cacciavite::
+
+ begin remote
+ name sonic
+ # snip
+ begin codes
+ b1_tap_top 0x1000
+ b1_tap_left 0x1001
+ #etc etc
+
+Programmare il telecomando
+==========================
+
+Ho scritto `un semplice programma Perl per inviare i codici IR
+<send>`_. Eseguitelo mentre ``lircd`` è in esecuzione, e con
+``irsend`` nel path. Quando dice ``Ready to send $something``, premete
+"enter" per inviare il codice, ``a`` per tornare al codice precedente
+(utile se il cacciavite non l'ha ricevuto), ``n`` per saltare al
+codice successivo senza inviare nulla.
+
+Ho messo il cacciavite in modalità programmazione, ho eseguito i 39
+gesti uno alla volta, e li ho programmati tutti. LIRC ora usa nomi
+sensati per tutti e 39 i gesti.
+
+Usarlo
+======
+
+Finalmente, ho ri-compilato `vlc <http://www.videolan.org/>`_ col
+supporto LIRC, e ho scritto `un |lircrc| per vlc <lircrc>`_. A questo
+punto, posso controllare ``vlc`` col cacciavite sonico!
+
+.. |lircrc| replace:: ``~/.lircrc``
diff --git a/src/SW/usb-ir-toy-lirc/du2html.xsl b/src/SW/usb-ir-toy-lirc/du2html.xsl
new file mode 120000
index 0000000..e2487e0
--- /dev/null
+++ b/src/SW/usb-ir-toy-lirc/du2html.xsl
@@ -0,0 +1 @@
+../../../templates/du2html.xsl \ No newline at end of file