X10

From ArchWiki

X10 is a radio remote compatible with LIRC.

Install LIRC

Install the lirc package.

To support power actions directly from Kodi (like shutdown option) upower needs to be installed.

Blacklist not working module

For some reason udev loads the wrong kernel module for this radio remote, so you need to blacklist it. This is done in /etc/modprobe.d/

Errors in dmesg with the wrong module:

ati_remote 1-1.1:1.0: Unknown input from channel 0x00: data 72,9d
ati_remote: Weird data, len=5 20 fa 5b 65 b6 20 ...
ati_remote: Weird data, len=5 20 fa db 5d b6 00 ...

To blacklist the module create the following file:

/etc/modprobe.d/remote_blacklist.conf
# For some reason udev loads the wrong kernel module for the X10 radio remote, so blacklist it
blacklist ati_remote

Create /etc/lirc/lircd.conf

This maps the keys from your remote to strings you can use for programs like mplayer.

It can automatically generated or copied from one of the provided examples in /usr/share/lirc/remotes.

To generate your own lircd.conf use:

# irrecord -H atilibusb --disable-namespace lircd.conf

More details are available at LIRC#Creating remote configuration.

Here is one for a Medion X10 Remote:

# Please make this file available to others
# by sending it to <[email protected]>
#
# this config file was automatically generated
# using lirc-0.8.2(default) on Sun Aug 12 02:13:30 2007
#
# contributed by Ben Adler @ gmx dot net
#
# brand: Medion / X10 (part of https://www.medion.de/md8824/)
# remote control: RF Vista Remote Control (OR24V)
# P/N: 2003 5335
# devices being controlled by this remote: USB RF remote receiver (CM20E), P/N 2003 1776

begin remote

  name  Medion_X10
  bits           16
  eps            30
  aeps          100

  one             0     0
  zero            0     0
  pre_data_bits   8
  pre_data       0x14
  post_data_bits  16
  post_data      0x0
  gap          227978
  toggle_bit_mask 0x80800000

      begin codes
          red                      0x87B2
          yellow                   0x0934
          blue                     0x8AB5
          green                    0x0833
          power                    0xD702
          text                     0xEB16
          tvrecord                 0x6D98
          disc                     0xD904
          table                    0x86B1
          tvplay                   0xF11C
          back                     0x75A0
          info                     0x042F
          volume_up                0x5E89
          volume_down              0xDD08
          mute                     0x5580
          channel_up               0xE00B
          channel_down             0x618C
          cursor_up                0xEF1A
          cursor_down              0x77A2
          cursor_left              0xF21D
          cursor_right             0x749F
          ok                       0xF31E
          start                    0x709B
          track_previous           0xF621
          track_next               0x78A3
          record                   0xFC27
          pause                    0x7EA9
          stop                     0xFD28
          seek_backward            0x79A4
          play                     0xFA25
          seek_forward             0x7BA6
          1                        0xE20D
          2                        0x638E
          3                        0xE40F
          4                        0x6590
          5                        0xE611
          6                        0x6792
          7                        0xE813
          8                        0x6994
          9                        0xEA15
          0                        0x6C97
          asterisk                 0x0C37
          hash                     0x8DB8
          clear                    0x0530
          enter                    0x8BB6
          photo                    0x5A85
          music                    0xDB06
          video                    0x82AD
      end codes

end remote

Alternate config file:

begin remote

  name        mceusb
  bits           16
  eps            30
  aeps          100

  one             0     0
  zero            0     0
  pre_data_bits   8
  pre_data       0x14
  post_data_bits  16
  post_data      0x0
  gap          227978
  suppress_repeat  12
  min_repeat     3
  toggle_bit_mask 0x80800000

     begin codes
BDelete                 0xF520
BBlue                   0x0A35
BChanUp                 0xE00B
BChanDown               0x618C
BChannelList            0x85B0
BDown                   0x77A2
BDVD                    0xD904
BEight                  0xE914
BReneme                 0x0B36
BFive                   0x6691
BForward                0x7BA6
BFour                   0xE510
BGreen                  0x88B3
BVideoDesktop           0x0631
BEditImage              0x0D38
BSetup                  0x709B
BSnapshot               0x6D98
BLeft                   0x729D
BChannelSearch          0x719C
BTvPreview              0x84AF
BMute                   0xD500
BNine                   0x6A95
BOK                     0xF31E
BOne                    0x628D
BPause                  0xFE29
BPlay                   0xFA25
BPower                  0xD702
BRecord                 0xFC27
BRed                    0x87B2
BPrevious               0x76A1
BRewind                 0x79A4
BRight                  0xF41F
BSeven                  0x6893
BSix                    0xE712
BNext                   0xF823
BAcquireImage           0x8CB7
BStop                   0x7DA8
BTxt                    0x6B96
BThree                  0x648F
BTwo                    0xE30E
BUp                     0xEF1A
BVolDown                0x5D88
BVolUp                  0xDE09
BYellow                 0x0934
BZero                   0xEC17
BTv                     0x012C
BVcr                    0x022D
BMusic                  0xDB06
BRadio                  0x032E
BPhoto                  0xDA05
BFullscreen             0x0E39
BDvdmenu                0xEE19
BDvdaudio               0x0F3A
      end codes
end remote

Edit /etc/conf.d/lircd.conf

Recent versions of LIRC drop support for the lirc_atiusb kernel module and so it is now necessary to use the atilibusb driver.

Simply add "atilibusb" to the LIRC_DRIVER field so that the file looks like this:

# Parameters for lirc daemon
#

LIRC_DEVICE="/dev/lirc0"
LIRC_DRIVER="atilibusb"
LIRC_EXTRAOPTS=""
LIRC_CONFIGFILE=""

Starting lircd

Start/enable lircd.service.

Example mplayer config

You need to remove --disable-lirc from mplayer's PKGBUILD and recompile it, as it is disabled by default (04.02.09)

You can check if LIRC support is compiled in with mplayer -v someplayablefile.xyz, look for Setting up LIRC support.

~/.lircrc is the default MPlayer filename for the LIRC config, see mplayer(1) to change this.

Change in ~/.lircrc:

begin
     button = VOLUME_UP       #VOLUME_UP is the string defined in /etc/lirc/lircd.conf
     prog = mplayer            
     config = volume 1         #this is mplayers internal command, see "mplayer -input cmdlist" for more
end

begin
    button = VOLUME_DOWN
    prog = mplayer
    config = volume -1
end

begin
	button = RIGHT
	prog = mplayer
	config = seek +1
end

begin
	button = LEFT
	prog = mplayer
	config = seek -1
end

begin
	button = UP
	prog = mplayer
	config = seek +50
end

begin
	button = DOWN
	prog = mplayer
	config = seek -50
end

begin
	button = PLAY
	prog = mplayer
	config = pause
end

begin
	button = PAUSE
	prog = mplayer
	config = pause 
end
#show elapse/total time in the upper left corner
#Source: https://web.archive.org/web/20200808073444/http://prasinos.eu/articles/mplayer-lirc-elapsed-time
begin
	button = GUIDE
	prog = mplayer
	config = osd_show_property_text "${time_pos} / ${length}"
end

Kodi

Please see Kodi#Using a remote control.

The below example ~/.xbmc/userdata/Lircmap.xml file is compatible with the alternate lircd.conf posted above.

<!-- This file contains the mapping of LIRC keys to XBMC keys used in Keymap.xml  -->

<lircmap>
        <remote device="mceusb">
                <pause>BPause</pause>
                <stop>BStop</stop>
                <forward>BForward</forward>
                <reverse>BRewind</reverse>
                <left>BLeft</left>
                <right>BRight</right>
                <up>BUp</up>
                <down>BDown</down>
                <select>BOK</select>
                <pageplus>BChanUp</pageplus>
                <pageminus>BChanDown</pageminus>
                <back>BDelete</back>
                <menu></menu>
                <title>BChannelSearch</title>
                <info>BSnapshot</info>
                <skipplus>BNext</skipplus>
                <skipminus>BPrevious</skipminus>
                <display></display>
                <start>BPlay</start>
                <record>BRecord</record>
                <volumeplus>BVolUp</volumeplus>
                <volumeminus>BVolDown</volumeminus>
                <mute>BMute</mute>
                <myvideo>BRed</myvideo>
                <mymusic>BYellow</mymusic>
                <mypictures>BGreen</mypictures>
                <mytv>BBlue</mytv>
                <one>BOne</one>
                <two>BTwo</two>
                <three>BThree</three>
                <four>BFour</four>
                <five>BFive</five>
                <six>BSix</six>
                <seven>BSeven</seven>
                <eight>BEight</eight>
                <nine>BNine</nine>
                <zero>BZero</zero>
                <PlayDVD>BDVD</PlayDVD>
                <ShowVideoMenu>BDvdmenu</ShowVideoMenu>
                <NextSubtitle>BTxt</NextSubtitle>
                <AudioNextLanguage>BDvdaudio</AudioNextLanguage>
                <ContextMenu>BSetup</ContextMenu>
        </remote>
</lircmap>