Archive:Set up Streamzap PC Remote for Linux

From Official Kodi Wiki
Revision as of 05:47, 26 November 2010 by >Goodwill (→‎Inputlirc)
Jump to navigation Jump to search

This page is all about getting the Streamzap remote to work completely with XBMC for Linux.

Introduction

There are two ways you can set up Stream Zap remote to work with XBMC on Linux.

  • lircd
  • inputlirc

Inputlirc

Inputlirc is "a daemon to utilize /dev/input/event*" and using xinput in X.org.


UDev rule

First you have to create an own udev rule to ensure, that your device nodes are always the same.

We get the physical address from /proc/bus/input/devices:

cat /proc/bus/input/devices

the output is something like this:

...
I: Bus=0000 Vendor=0000 Product=0000 Version=0000
N: Name="Streamzap PC Remote Infrared Receiver (0e9c:0000)"
P: Phys=usb-0000:00:06.0-1/input0
S: Sysfs=/devices/virtual/rc/rc0/input4
U: Uniq=
H: Handlers=kbd event4 
B: EV=100003
B: KEY=3ff 0 0 0 fc000 1 0 0 0 0 18000 4180 c0000801 9e1680 0 0 0

...

What we need are the values behind Phys=. In my case usb-0000:00:06.0-1/input0

Now we write a new rules file for udev:

sudo nano /etc/udev/rules.d/10-irremote.rules

and put the following content in:

SUBSYSTEM=="input",ATTRS{phys}=="usb-0000:00:06.0-1/input0",SYMLINK="input/irremote0"

Now restart udev and trigger a new discovery:

sudo restart udev
sudo udevadm trigger

Under /dev/input should now be a symlink call irremote0:

ls /dev/input

Inputlirc installation

First you have to install inputlirc and lirc:

sudo apt-get update
sudo apt-get install inputlirc lirc

Then you need to configure it properly:

sudo nano /etc/default/inputlirc

and put the following content in:

EVENTS="/dev/input/irremote0"
OPTIONS="-c -g -m 0"

The entries under EVENTS are the devices we created via udev. The OPTION entries mean the following:

-g Grabs the input from the devices, specified under EVENTS, so that no other application interferes with it.
-m 0 By default, all keycodes below 88 are filtered out. This setting ensures, that all keycodes are captured
-c Because some of the keys on the remote are mapped to keys with modifiers, this option maps this codes to single events.


Now restart inputlirc

sudo /etc/init.d/inputlirc restart

You can now test the remote via 'irw':

irw /dev/lircd

This is some sample output from irw when pressing buttons:

6a 0 KEY_RIGHT irremote0
6c 0 KEY_DOWN irremote0
160 0 KEY_OK irremote0
8b 0 KEY_MENU irremote0
ae 0 KEY_EXIT irremote0
191 0 KEY_BLUE irremote0
18e 0 KEY_RED irremote0

Configuring XBMC

The last thing you need to do is let XBMC know to what buttons to respond. This is done via the Lircmap.xml:

sudo nano ~/.xbmc/userdata/Lircmap.xml

and put the following content in:

<lircmap>
  <remote device="irremote0">
    <play>KEY_PLAY</play>
    <pause>KEY_PAUSE</pause>
    <stop>KEY_STOP</stop>
    <forward>KEY_FASTFORWARD</forward>
    <reverse>KEY_REWIND</reverse>
    <left>KEY_LEFT</left>
    <right>KEY_RIGHT</right>
    <up>KEY_UP</up>
    <down>KEY_DOWN</down>
    <pageplus>KEY_CHANNELUP</pageplus>
    <pageminus>KEY_CHANNELDOWN</pageminus>
    <select>KEY_OK</select>
    <back>KEY_EXIT</back>
    <menu>KEY_MENU</menu>
    <title>KEY_RED</title>
    <info>KEY_GREEN</info>
    <skipplus>KEY_FORWARD</skipplus>
    <skipminus>KEY_BACK</skipminus>
    <display>KEY_YELLOW</display>
    <record>KEY_RECORD</record>
    <volumeplus>KEY_VOLUMEUP</volumeplus>
    <volumeminus>KEY_VOLUMEDOWN</volumeminus>
    <mute>KEY_MUTE</mute>
    <record>KEY_RECORD</record>
    <power>KEY_POWER</power>
    <blue>KEY_BLUE</blue>
    <one>KEY_NUMERIC_1</one>
    <two>KEY_NUMERIC_2</two>
    <three>KEY_NUMERIC_3</three>
    <four>KEY_NUMERIC_4</four>
    <five>KEY_NUMERIC_5</five>
    <six>KEY_NUMERIC_6</six>
    <seven>KEY_NUMERIC_7</seven>
    <eight>KEY_NUMERIC_8</eight>
    <nine>KEY_NUMERIC_9</nine>
    <zero>KEY_NUMERIC_0</zero>
  </remote>
</lircmap>