====== Getting Started with the Iguanaworks USB IR Transceiver (Linux) ======
{{https://www.iguanaworks.net/wp-content/uploads/products/usb-ir-transceiver/USB-LED-300x113.jpg}}
Unlike our serial version of this product, to use and communicate with the USB device, a kernel driver or the igdaemon software must be used. The igclient program (or libiguanaIR.so library) communicates with our device through the igdaemon, but most people can use our devices with LIRC without installing our software.
This guide will help you install and configure the necessary software to use the USB IR Transceiver. If you've read through this and still have questions please submit a [[https://www.iguanaworks.net/projects/IguanaIR/newticket|Support Ticket]]
- Installing the iguanaIR software (daemon and client).
- Testing iguanaIR using igclient.
- Installing LIRC and testing it with iguanaIR.
- Getting a valid lircd.conf.
- Using it all.
===== Step 0: Shortcut =====
On most modern distros, there is built in support for our device! This support works out of the box for
many users without further configuration (and without LIRC, described below). The first steps should
be to just plug in the USB IR Transciever and check if your remote works e. g., the volume up/down buttons
If this works (as it does for many users) there is no more configuration needed.
There are a some common reasons to configure LIRC instead:
- The remote does not work. LIRC is more flexible with respect to "unknown" remotes.
- You plan to use the sending (blasting) capabilities of our device; this requires LIRC.
- You want to use some part of the plethora of possibilities LIRC offer: multiple
applications getting input from one remote, multiple remotes, remote decoding...
If you have a working setup, this is the last step. Else:
===== Step 1: Checking low-level device handling =====
The first step is to check if the kernel module handling of the lirc device works (which it
should on all modern kernels). After plugging in the USB device, check if the /dev/lirc0
device exists using
$ ls /dev/lirc0
If it does, you need to use mode2 from the lirc package. All known Linux distros have a way of
installing this package using tools like apt-get, dnf, yum or various GUI tools. Pick one, and
install the lirc package. Then do
$ mode2 --raw --device /dev/lirc0
When you push buttons on your remote, mode2 should print lines like
space 101788
pulse: 448
space: 384
pulse: 448
space: 1237
pulse: 426
space: 405
pulse: 426
space: 362
r
If this works, the low-level handling is OK and you can proceed to step 4: Configure LIRC. Otherwise, or
if you need to use the iguana driver for other reasons:
===== Step 2: Installing iguanaIR =====
Install the iguanair software package. You can get the software and installation instructions at [[https://iguanaworks.net/downloads.php|downloads page]]. We provide rpm and deb software repositories in addition to direct links to the .deb and .rpm files. A source tarball is also available. We recommend adding our repository to your list of source repositories. Then you can get the iguanair package installed by running (as root or with sudo) the command:
==== Debian-based Distros ====
- Add our package repository to your sources list by running one of the following three commands based on your computer architecture.
* i386
echo "deb http://iguanaworks.net/downloads/debian binary-i386/" | sudo tee /etc/apt/sources.list.d/iguanaworks.list>/dev/null
* amd64
echo "deb http://iguanaworks.net/downloads/debian binary-amd64/" | sudo tee /etc/apt/sources.list.d/iguanaworks.list>/dev/null
* Raspberry Pi (raspbian)
echo "deb http://iguanaworks.net/downloads/debian binary-rasp/" | sudo tee /etc/apt/sources.list.d/iguanaworks.list>/dev/null
- Update your package list and install our package by running
sudo apt-get update
sudo apt-get install iguanair
==== RPM-based Distros ====
- Create a file like /etc/yum.repos.d/iguanair
[iguanair]
name=iguanair
baseurl=http://iguanaworks.net/downloads/${basearch}
enabled=1
gpgcheck=0
2. Install our software by running
yum install iguanair
or
dnf install iguanair
==== From Source ====
For the source tarball, you will need to compile our software with the commands:
tar -xjf iguanaIR-0.24.tar.bz2
cd iguanaIR-0.24
./runCmake
make -C build
==== Start igdaemon ====
Our packages have only been tested on Fedora and Ubuntu systems, but should be compatible with most rpm or deb-based distributions. If you have to make changes for your specific distribution, please let us know and we'll include the details in our packages.
Before proceeding, we will need to disable the kernel driver as it takes exclusive control over the USB IR Transceiver. Run
sudo rmmod iguanair
This will revert on a reboot. To permanently disable the kernel driver create a new file /etc/modprobe.d/iguanair.conf with the content:
blacklist iguanair
With not done and the software is installed, connect the device (or reconnect it if you plugged it in before) and start the igdaemon. This should be as simple as running the command:
sudo service iguanaIR start
That's it. Now to test the daemon is running and communicating with the USB device, you can the following command (as a regular user, no need to run as root or use sudo):
igclient --get-version
and you should see something close to:
get version: success: version=0x0308
If you see what version of the device you have, you have the daemon installed and working properly. If you do not get this message, see our [[:usbir:faq#Gettingdebugmessagesfromigdaemon|FAQ]].
===== Step 3: Testing iguanaIR =====
Try running:
igclient --receiver-on --sleep 100
This will cause the usb device to enable its receiver and start streaming data in the form of space and pulse timings to the client. The sleep tells the igclient to wait for 100 seconds before exiting, during which time it prints all received signals. The signals will not be translated in any way, and so should be an accurate description of what the igclient is seeing.
This is our equivalent to the mode2 program. The output is not as pretty, but is primarily used to ensure that the device is working, the basic configuration is correct and our IR receiver can see something from your remote.
When this igclient command is executed data will stream past in the terminal. It looks something like:
received 1 signal(s):
space: 152917
received 1 signal(s):
space: 152917
received 1 signal(s):
space: 114688
received 4 signal(s):
space: 6400
pulse: 3498
space: 1664
pulse: 426
received 7 signal(s):
space: 384
pulse: 448
space: 1237
pulse: 426
space: 405
pulse: 426
space: 362
received 7 signal(s):
and so on. What we can see from this output is that the device was idle for around 0.4 seconds before a 6.4 millisecond header pulse was detected. All the numbers printed above are times in microseconds. This is not actually the raw data received from the USB device, but the daemon translates that rather odd format to microsecond pulses and spaces. If this command fails, please check for the error on the TroubleShooting page.
===== Step 4: Installing and Testing LIRC =====
You have already installed the lirc package in step 2. However, LIRC needs a iguanair driver which you
most likely need to add. The procedure for adding the iguana driver is different depending on
LIRC version and your distribtution. *lircd --version* prints the lirc version.
==== lirc version 0.9.3+ (all distros) ====
First, check if the iguana driver exists by
$ lirc-lsplugins -q iguana*
If nothing is printed you need to add the driver. First try is to check if it can be
installed as a package, normally named *lirc-drv-iguanair*. This works at least on Fedora.
If not, you need to install it from source. A prerequisite is to install the LIRC development
files which typically lives in a package like lirc-devel (Fedora) or liblircclient-dev (Debian).
After installing this, do:
$ git clone https://github.com/iguanaworks/iguanair-lirc.git
$ cd iguanair-lirc
$ make
$ sudo make install
$ lirc-lsplugins -q iguana*
iguanair -as /usr/lib64/lirc/plugins/iguanair.so
At this point you need to configure LIRC. There is a comprehensive guide at
http://lirc.org/html/configuration-guide.html. LIRC is a very flexible
and powerful software, but it comes at price. Be prepared to spend some time
with this configuration.
==== Fedora < 23 ====
Has the iguanaIR support compiled in lirc. Check with
$ lircd -H ? | grep iguana
iguana
See above for configuring LIRC
==== Debian and Ubuntu (lirc version 0.9.0) ====
I will not go into the details of installing LIRC. Please refer to http://lirc.org for such details. The one thing I will say about LIRC installation is that you **must** make sure that your version of LIRC supports the iguanaIR driver. Most linux distros do not LIRC with support for our driver, altough newer versions of Fedora do. Take a look at [[https://www.iguanaworks.net/2012/compile-lirc-on-fedora-rpm/|here for rpm]] and [[https://www.iguanaworks.net/2012/compile-lirc-into-deb-package/|here for deb]] for compiling LIRC with our driver the easy way. To check if you have our driver compiled into LIRC, run:
[[:user@server|~]]$ lircd -H '?' | grep iguana
The output is either empty (driver does not exist) or lists the *iguanaIR* driver.
Under Ubuntu LIRC, you will want the file /etc/lirc/hardware.conf to look similar to this
#Chosen Remote Control
REMOTE="Iguanaworks USB IR Transceiver"
REMOTE_MODULES=""
DRIVER="iguanaIR"
REMOTE_LIRCD_CONF=""
REMOTE_LIRCD_ARGS="-r"
LIRCD_CONF="/etc/lirc/lircd.conf"
#Chosen IR Transmitter
TRANSMITTER="None"
TRANSMITTER_MODULES=""
TRANSMITTER_DRIVER=""
TRANSMITTER_DEVICE=""
TRANSMITTER_LIRCD_CONF=""
TRANSMITTER_LIRCD_ARGS=""
If you are NOT using the kernel module, but you installed iguanaIR yourself, then you have to disable the kernel module usage from LIRC conf too (otherwise you will get "irsend: could not connect to socket" while trying to send IR commands):
LOAD_MODULES="false"
and if you want to specify which device to use (if you have multiple), you will also need to add to hardware.conf:
REMOTE_DEVICE="0"
or:
REMOTE_DEVICE="fred"
where the remote device is the ID/label of the transceiver.
If your version of LIRC does not contain the iguanaIR driver which was introduced between versions 0.8.0 and 0.8.1 you may need to download and compile a newer version of LIRC. From here on I'll assume you have a version of LIRC with many drivers enabled, and so require a -H iguanaIR option to some commands. At this point you'll need a /etc/lircd.conf. I'd suggest downloading one from https://sourceforge.net/projects/lirc-remotes/, but if you cannot find one for your device you may have to learn the signals using irrecord.
**N.B. for now** you just need **a** /etc/lircd.conf. It doesn't matter if it's the correct one for your hardware.
Now that the lircd daemon is passed the correct option we need to test it with irsend. I use:
[[:jdunn@porkrind|~]]$ irsend set_transmitters 1 2 3 4
[[:jdunn@porkrind|~]]$ irsend send_once panasonic KEY_POWER
[[:jdunn@porkrind|~]]$ irsend send_once panasonic KEY_POWER
This assumes that there's a remote defined in the /etc/lircd.conf named "panasonic" and it has a button defined in the same file called "KEY_POWER". Pick a remote and button from your own configuration file and use that. Also, that's not a typo, send the command //twice//. Success will be if there is no output from either command, however, if you have irsend compiled with debugging support it may print additional informational messages. If either command fails, please see the TroubleShooting page. After this test to make sure things are working sending a command twice is not necessary although you may find that LIRC will send commands multiple times due to the min_repeat option in the lircd.conf.
Note: We recommend that you only send on the channels that you are using. Particularly with mono IR blasters connected directly to our sockets (no stereo->mono adapter) using channels 2 and 4 can cause problems.
Once lircd is tested with irsend command we can be certain that the igdaemon and lircd daemon are both working, and properly communicating. Congratulations, the iguanaIR specific stuff is done.
===== Step 5: Getting a LIRC remote onfiguration =====
As stated above, I'd suggest downloading your lirc configuration from https://sourceforge.net/projects/lirc-remotes/. Even if you can start with a configuration where only a few buttons work that is //far// preferable to starting from scratch. But, assuming that you can't find such a configuration file check our page about [[:lirc]], and why I'm not real fond of it. But it's not like we have another option.
===== Step 6: Using it all =====
So most likely you want your remote to work with mplayer, or mythtv. This is not my department, but a little is said on the [[:lirc]] page.
===== Something isn't working? =====
If you've read through these pages and haven't been able to get your hardware working please [[http://iguanaworks.net/contact-iguanaworks/|contact us]].