From 446ab81da2e70ea02e607418b74b1286546bd37a Mon Sep 17 00:00:00 2001 From: dakkar Date: Mon, 8 Oct 2012 12:49:20 +0100 Subject: usb-ir-toy --- src/SW/usb-ir-toy-lirc/.gitignore | 2 + src/SW/usb-ir-toy-lirc/document.en.rest.txt | 108 +++++++++++++++++++++++++++ src/SW/usb-ir-toy-lirc/document.it.rest.txt | 111 ++++++++++++++++++++++++++++ src/SW/usb-ir-toy-lirc/du2html.xsl | 1 + 4 files changed, 222 insertions(+) create mode 100644 src/SW/usb-ir-toy-lirc/.gitignore create mode 100644 src/SW/usb-ir-toy-lirc/document.en.rest.txt create mode 100644 src/SW/usb-ir-toy-lirc/document.it.rest.txt create mode 120000 src/SW/usb-ir-toy-lirc/du2html.xsl (limited to 'src/SW') 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 `_ (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 +`_. Since I sometimes like being overly generic, +I bought `Dangerous Prototypes `_ +`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 +`_ 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 +`_) +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 +`_ +(`here's the 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 +`_, +thanks to Peter Kooiman. If you're running Gentoo, you can add `my +overlay `_ and +install `my patched 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 + `_ + +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 `_. 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 `_ with LIRC +support, and wrote `a |lircrc| for vlc `_. 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 `_ (il sito è orrendo e +difficile da navigare…). Chiaramente voglio poterci controllare il mio +PC! + +Per farlo, mi serviva un ricevitore IR e `LIRC +`_. Visto che mi piace complicarmi la vita, ho +comprato lo `USB Infrared Toy +`_ da `Dangerous +Prototypes `_, 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 +`_ +potrebbero anche funzionare; altrimenti, bisogna studiarci un po'. I +sorgenti del programma ``fw_update`` che potete ottenere da quelle +pagine (o dal `repository Subversion +`_) +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 +`_ +(`questa è la 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 +`_, +grazie a Peter Kooiman. Se usate Gentoo, potete aggiungere `la mia +overlay `_ e +installare `LIRC già modificato +`_. + +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 + `_ + +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 +`_. 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 `_ col +supporto LIRC, e ho scritto `un |lircrc| per vlc `_. 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 -- cgit v1.2.3