Rpi2 OSMC Alpha 4 and IR GPIO

#7

thx Sam for replies, i’ll stay tunned.

#8

OK. That’s great. Alpha 5? OSMC looks great but I guess I’ll stick with raspbmc for the moment.

#9

Maybe the GPIO error is related to this?

#10

This seem a good idea… I will try asap.

#11

someone tried the fix ?

#13

Hello Guys,
In the weekend I’ve managed to make the GPIO receiver work with the RPi 2.
Here’s how:
First, you do the steps described here until you manage to teach the remote control.


You don’t need to do the stuff at the beginning, lircd is able to load the kernel module, but if not, you can add it manually to /etc/modules, as described there.
Make sure you get the pulses and spaces (to assure the IR receiver HW is working) when you issue the
mode2 -d /dev/lirc0 command.
Then teach the remote as usual, and generate the config file lircd.conf.
Now, i’ve placed mine in /etc/lirc/lircd.conf. Make sure there are no other lircd.conf files hanging around in /home/osmc or /root/ homefolder, as the lircd script file searches for them.
Then open the /etc/lircd/hardware.conf file and make sure
LOAD_MODULES=true is set. This way, the script will try to load the appropriate kernel module.
Then, make sure the DRIVER=default is set, MODULES=“lirc_rpi” and DEVICE="/dev/lirc0".
Also, you can specify here the LIRCD_CONF file’s path (like LIRCD_CONF="/etc/lirc/lircd.conf"
If this is done, restart the lircd server (/etc/init.d/lirc restart) and if you made no mistakes, the LIRC part shall be done.
To verify, issue the irw command and start pressing the keys on the remote. It should display the ids of the keys you’ve pressed.

Next, it’s time to configure kodi to use the remote keycodes.
You will need to configure a Lircmap.xml file and place it in /home/osmc/.kodi/userdata folder.
If there is none avaialable there, take the default one from here
/usr/share/xbmc/system/
and modify it.
Keep only one entry and make sure that the LIRC button names are correct (keep onet hat has KEY_LEFT, KEY_RIGHT, etc. in it).
Make sure you use the same name for the remote device name with the one configured in /etc/lirc/lircd.conf (if it’s generated, the name is the path where it was created. Feel free to rename it to something more handy, like ‘myremote’)
More info here:
http://kodi.wiki/view/Userdata/lircmap.xml
Place the edited Lircmap.xml file in the /home/osmc/.kodi/userdata/Lircmap.xml and then restart kodi (or the RPi).
Your remote should work now.
If not, start debugging from the beginning. Make sure the spaces pulses are received, then make sure irw is displaying the keycode, then make sure the xml file is correct.
You can issue a ps -aux | grep lirc to check if the lirc daemon is running correctly and that the pid file is available.

EDIT: It looks like eventlircd is messing up somehow the config, as after starting / restarting eventlircd/pi , the lircd was not transmitting keys. Neither was ‘irw’ command working. I’ve tried digging the /etc/eventlirc.d files without success. In the end, i’ve disable enventlircd (service disable eventlircd.service) and then everything was working again. It seems kodi work well without eventlircd.
Maybe somebody know why it’s useful to have this process :).

1 Like
#14

nice @trex_daemon !! i’ll try as soon as possible. i have an harmony one, will config it as an MCE remote like on raspbmc. it’ll be a good idea to share our conf file between users, as people will pick the ones they want. whta do you think about this ? @sam_nazarko do you think it’s a good idea ? it’ll help ya in some way ?

#15

In the last 24 hours we have replaced lircd with a different version and overhauled the whole remote subsystem, so what you describe above is no longer necessary and is probably not valid now. There is still a bit more work to be done but in short:

  1. Make sure you check for and install updates so the latest lirc and eventlircd packages are installed.
  2. Save your lircd.conf at /home/osmc/lircd.conf
  3. If you have a Pi 1 enable GPIO IR remote support in hardware in the OSMC Settings addon, then reboot.

Your remote should now work, but be aware that your lircd.conf key names should adhere to linux-input-layer naming conventions - such as KEY_OK, KEY_UP and so on. (For an example look at /etc/lirc/osmc-remote-lircd.conf)

Currently loading the GPIO module from the hardware support option in the Settings addon is not working on the Pi 2 - but should be working for Alpha 5.

For a quick and dirty hack to load the lirc_rpi module on boot for a Pi 2 you can add the following to /etc/rc.local just before the exit 0 line:

modprobe lirc_rpi

[solved] Honey Pi GPIO IR Reciever on Pi 2
#16

@DBMandrake, The above steps are not working for me on the RPi 1.

I checked for and installed the updates.
I copied the rc6-mce-lircd.conf file to /home/osmc and renamed it lircd.conf
I enabled GPIO IR remote support.

I’m using a Harmony and I programmed it to match the rc6-mce. It worked perfectly in RaspBMC on the same Pi.

#17

Have you rebooted since setting it up?
Can you post the contents of /boot/config.txt

#18

Yes we need more information.

Please post:

/boot/config.txt

Your lircd.conf file.

The output of the following commands:

dpkg -l | grep lirc

and

sudo systemctl status lircd_helper@lirc0

Also please try running the following then pressing buttons on your remote to see if anything is logged:

irw /var/run/lirc/lircd-lirc0

Paste a small sample of what you see (if anything)

Then try:

irw /var/run/lircd

And do the same.

Also please confirm whether you are using a GPIO IR receiver or some other USB based receiver. Thanks.

#19

Yes, I did reboot, sorry, forgot that.

osmc@osmc:~$ cat /boot/config.txt
sdram_freq=400
core_freq=375
over_voltage=0
force_turbo=0
over_voltage_sdram=0
arm_freq=850
initial_turbo=0
start_x=1
dtoverlay=lirc-rpi-overlay
disable_overscan=1
gpu_mem_256=112
gpu_mem_512=144
hdmi_ignore_cec_init=1

The lircd.conf file is a copy of /etc/lircd/rc6-mce-lircd.conf. I’m pretty sure that’s what I did with RaspBMC, but can’t go back and check because I overwrote that SD card.

osmc@osmc:~$ sudo systemctl status lircd_helper@lirc0
* lircd_helper@lirc0.service - lircd remote support
   Loaded: loaded (/lib/systemd/system/lircd_helper@.service; static)
   Active: active (running) since Thu 1970-01-01 00:00:12 UTC; 45 years 1 months ago
  Process: 191 ExecStart=/bin/sh -c /var/run/lirc/lircd-%I.sh (code=exited, status=0/SUCCESS)
 Main PID: 275 (lircd)
   CGroup: /system.slice/system-lircd_helper.slice/lircd_helper@lirc0.service
           `-275 /usr/sbin/lircd --driver=default --device=/dev/lirc0 --uinpu...

Jan 01 00:00:12 osmc sh[191]: lircd: could not open config file '/etc/lirc/...f'
Jan 01 00:00:12 osmc sh[191]: lircd: No such device
Hint: Some lines were ellipsized, use -l to show in full.

dpgk:

osmc@osmc:~$ dpkg -l | grep lirc
rc  liblircclient0                       0.9.0~pre1-1.2            armhf        infra-red remote control support - client library
rc  lirc                                 0.9.0~pre1-1.2            armhf        infra-red remote control support
ii  rbp-eventlircd-osmc                  1.0.13                    armhf        eventlircd for OSMC
ii  rbp-lirc-osmc                        0.9.0-4                   armhf        lirc for osmc
ii  rbp-remote-osmc                      1.0.7                     armhf        Remote support for OSMC, achieved with lirc and eventlircd

Nothing is returned while pressing buttons with:

irw /var/run/lircd/lircd-lirc0

This is what I get with:

osmc@osmc:~$ irw /var/run/lircd
connect: No such file or directory

And yes, I’m using a GPIO IR receiver.

#20
sudo systemctl status lircd_helper@lirc0

That was the clue I needed! I’m using an NFS mount (in /etc/fstab) for /home/osmc (to try and keep read/writes on the SD card to a minimum) and I’m wondering if lircd was trying to start before the mount. I could read the conf file via /etc/lirc/lircd.conf after the boot, but I guess it couldn’t read it when starting?

I removed the sym link for /etc/lirc/lircd.conf and replaced it with my real conf file and now the remote works!

Thanks for the help!

#21

Cool

#22

Glad you sorted it. :smile:

One comment though, make sure you are using the right fstab mount options - with the correct mount options it will wait for nfs to mount on first access to files on the nfs share - the mount options you need are different to raspbmc. Please see my comments in this thread:

In theory this should prevent the problem you saw where lirc started before your nfs share was mounted - because as soon as lirc tried to access a file in your nfs share it would trigger the share to automatically mount and wait until it did so.

x-systemd.automount,noauto are the recommended options for nfs mounts in osmc. (Don’t use auto or _netdev)

#23

I used the post you reference to update /etc/fstab as I was having the problem where it wouldn’t automount.

Here’s my /etc/fstab:

osmc@osmc:~$ cat /etc/fstab
/dev/mmcblk0p1  /boot    vfat     defaults,noatime    0   0
/dev/mmcblk0p2  /    ext4      defaults,noatime    0   0
blah:/homes/xbmc        /home/osmc      nfs     defaults,noauto,x-systemd.automount     0       0

I did notice this message on boot today (hadn’t noticed it before). But it boots into OSMC and when I connect via SSH, /home/osmc is mounted.

osmc@osmc:~$ systemctl status home-osmc.mount
* home-osmc.mount - /home/osmc
   Loaded: loaded (/etc/fstab)
   Active: active (mounted) since Thu 1970-01-01 00:00:17 UTC; 45 years 1 months ago
    Where: /home/osmc
     What: blah:/homes/xbmc
     Docs: man:fstab(5)
           man:systemd-fstab-generator(8)
  Process: 304 ExecMount=/bin/mount -n blah:/homes/xbmc /home/osmc -t nfs -o defaults,noauto,x-systemd.automount (code=exited, status=0/SUCCESS)
#24

Hi,

Thanks for the screenshot. I think there is a problem with the ordering of system service start-up where it is trying to mount NFS before the network is up (hence the failure in your screenshot) but because x-systemd.automount creates an automounter service for the share, it gets retried later so does eventually get mounted by the time you try to use Kodi.

Thanks to your screenshot I’ve spotted another startup ordering issue - eventlircd needs to start before lircd for remote support to work properly, so I will look at addressing this.

#25

@DBMandrake i just can’t get this to work, it worked seamless in xbian but now i don’t have a clue.
I’m using a GPIO IR receiver and i’m getting pulse and space in mode2.

Can someone please tell me what i’m doing wrong? :smile:

/boot/config.txt

hdmi_ignore_cec=1
core_freq=375
dtoverlay=lirc-rpi-overlay
arm_freq=850
start_x=1
disable_overscan=1
gpu_mem_256=112
gpu_mem_512=144
hdmi_ignore_cec_init=1

/etc/lirc/lircd.conf

begin remote

name Microsoft_Xbox360
bits 16
flags RC6|CONST_LENGTH
eps 30
aeps 100

header 2676 870
one 454 429
zero 454 429
pre_data_bits 21
pre_data 0x37FF0
gap 106291
min_repeat 1
toggle_bit_mask 0x8000

rc6_mask 0x100000000

  begin codes
      KEY_OPEN                 0x8BD7                    #  Was: OpenClose
      XboxFancyButton          0x0B9B
      KEY_POWER                0x8BF3                    #  Was: OnOff
      KEY_STOP                 0x0BE6                    #  Was: Stop
      KEY_PAUSE                0x8BE7                    #  Was: Pause
      KEY_REWIND               0x0BEA                    #  Was: Rewind
      KEY_FASTFORWARD          0x8BEB                    #  Was: FastForward
      KEY_PREVIOUS             0x0BE4                    #  Was: Prev
      KEY_NEXT                 0x8BE5                    #  Was: Next
      KEY_PLAY                 0x0BE9                    #  Was: Play
      Display                  0x8BB0
      KEY_TITLE                0x0BAE                    #  Was: Title
      KEY_MENU                 0x8BDB                    #  Was: DVD_Menu
      KEY_BACK                 0x0BDC                    #  Was: Back
      KEY_INFO                 0x8BF0                    #  Was: Info
      UpArrow                  0x0BE1
      LeftArrow                0x8BDF
      RightArrow               0x0BDE
      DownArrow                0x8BE0
      KEY_OK                   0x0BDD                    #  Was: OK
      KEY_Y                    0x8BD9                    #  Was: Y
      KEY_X                    0x0B97                    #  Was: X
      KEY_A                    0x8B99                    #  Was: A
      KEY_B                    0x0BDA                    #  Was: B
      KEY_CHANNELUP            0x8BED                    #  Was: ChUp
      KEY_CHANNELDOWN          0x0BEC                    #  Was: ChDown
      KEY_VOLUMEDOWN           0x0BEE                    #  Was: VolDown
      KEY_VOLUMEUP             0x0BEF                    #  Was: VolUp
      KEY_MUTE                 0x0BF1                    #  Was: Mute
      KEY_PLAY                 0x0BF2                    #  Was: Start
      KEY_PLAY                 0x8BE9                    #  Was: Play
      KEY_ENTER                0x0BF4                    #  Was: Enter
      KEY_RECORD               0x8BE8                    #  Was: Record
      KEY_CLEAR                0x0BF5                    #  Was: Clear
      KEY_1                    0x8BFE                    #  Was: 1
      KEY_2                    0x0BFD                    #  Was: 2
      KEY_3                    0x8BFC                    #  Was: 3
      KEY_4                    0x0BFB                    #  Was: 4
      KEY_5                    0x8BFA                    #  Was: 5
      KEY_6                    0x0BF9                    #  Was: 6
      KEY_7                    0x8BF8                    #  Was: 7
      KEY_8                    0x0BF7                    #  Was: 8
      KEY_9                    0x8BF6                    #  Was: 9
      KEY_0                    0x0BE2                    #  Was: 100
      KEY_0                    0x8BFF                    #  Was: 0
      Reload                   0x8BE3
  end codes

end remote

dpkg -l | grep lirc

ii liblircclient0 0.9.0~pre1-1.2 armhf infra-red remote control support - client library
ii lirc 0.9.0~pre1-1.2 armhf infra-red remote control support
ii rbp-eventlircd-osmc 1.0.1 armhf eventlircd for OSMC
ii rbp-remote-osmc 1.0.3 armhf Remote support for OSMC, achieved with lirc and eventlircd

sudo systemctl status lircd_helper@lirc0

● lircd_helper@lirc0.service
Loaded: not-found (Reason: No such file or directory)
Active: inactive (dead)

irw /var/run/lirc/lircd-lirc0

connect: No such file or directory

irw /var/run/lircd

connect: No such file or directory

#26

Only key codes beginning with KEY_ are valid (as we are using eventlircd) so some of your button mappings will not work until fixed.

It seems that you haven’t run an update - GPIO remote is not working in Alpha 4 until you run an update. Here are my package versions:

ii  rbp-eventlircd-osmc                  1.0.13                    armhf        eventlircd for OSMC
ii  rbp-lirc-osmc                        0.9.0-4                   armhf        lirc for osmc
ii  rbp-remote-osmc                      1.0.9                     armhf        Remote support for OSMC, achieved with lirc and eventlircd

This is because of the above - you have outdated package versions.

Also if you have a Raspberry Pi 2 you’ll need to manually load the gpio module - at least until the next release. (dtoverlay is not working on Pi 2 on Alpha 4)

You can do this by adding

modprobe lirc_rpi

into /etc/rc.local before the exit 0 line.

#27

Hi, Was wondering how close you were with IR remote support over GPIO or USB.