summaryrefslogtreecommitdiff
path: root/src/SW/usb-ir-toy-lirc/document.en.rest.txt
blob: 9c9afe7f3dd6d0ed5f675b161f688388ba569fde (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
==============================
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
<https://www.thewandcompany.com/eleventh-doctors-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
<https://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
=============
 
.. note::
 
   ``lircd`` 0.10 has native support for the USB IR Toy, using the
   ``irtoy`` driver
 
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
<https://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 <https://www.thenautilus.net/cgit/gentoo-overlay/>`_ and
install `my patched LIRC
<https://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
   <https://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 <https://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``