Monday, January 13, 2014

Getting the IR receiver to work with Haswell NUCs

The article has moved! You're being redirected to the new address http://nucblog.net/2014/01/getting-the-ir-receiver-to-work-with-haswell-nucs/. If not, please click the link.

There seems to be some issue with the BIOS of the Intel Haswell NUCs that causes the inbuilt IR receiver to be nonfunctional out-of-the-box in OpenELEC. The nuvoton-cir module will load ok, but you'll see something like this in the logs (which you can see by typing dmesg after you've logged in with SSH client into the box)
[   21.815675] nuvoton-cir 00:08: IR PNP Port not valid!
[   22.708027] nuvoton_cir: driver has been successfully loaded
Now nuvoton-cir is the Linux kernel module that handles the consumer infrared adapter on the NUC. After a bit of googling I found the solution from the Intel communities page here. Basically you will need to unload the nuvoton-cir module, change some system properties and then reload the module. You can automate this process by adding the commands into autostart.sh script that will be automatically executed when OpenELEC boots up.

It's really quite simple, even if you're not a Linux guru. Make sure that you have enabled the SSH server in the OpenELEC settings. Then look at the IP address of your NUC and use an SSH client such as PuTTY to log in using that IP address. Username is root and password is openelec.

You should see a command prompt like this:
##############################################
# OpenELEC - The living room PC for everyone #
# ...... visit http://www.openelec.tv ...... #
##############################################

OpenELEC (unofficial) Version: devel-20140106035542-r16865-geb0a7a6
OpenELEC git: eb0a7a68b710736f0cfc72781020d30d91903e88
MediaCenter:~ #
Now create the file autostart.sh and start editing it.
nano /storage/.config/autostart.sh
This opens the text editor nano and edits the file /storage/.config/autostart.sh. In case the file does not exist, a new file will be created. Now copy-paste the following in:
#!/bin/sh
modprobe -r nuvoton-cir
echo "auto" > "/sys/bus/acpi/devices/NTN0530:00/physical_node/resources"
modprobe nuvoton-cir
Finally, press Ctrl-X to quit the editor and press 'y' to save the file. In order to make the file executable permissions need to be modified. This is done by giving the following command:
chmod +x /storage/.config/autostart.sh
And we're done. You can now manually execute the autostart.sh script or just reboot the machine to get the IR receiver working. To execute the script manually, just give the path to the file you just created:
/storage/.config/autostart.sh
Your IR receiver will now work! You can type irw to start a program that monitors the incoming signals from the remote when you press the buttons. Press Ctrl-C when you're done.
69 0 KEY_LEFT devinput
69 0 KEY_LEFT_UP devinput
67 0 KEY_UP devinput
67 0 KEY_UP_UP devinput
201 0 KEY_NUMERIC_1 devinput
201 0 KEY_NUMERIC_1_UP devinput
cf 0 KEY_PLAY devinput
cf 0 KEY_PLAY_UP devinput
^C
Hope you found this simple article useful. Note that this will probably not be necessary in the future, if Intel will fix their BIOS, but until that it's a necessary step in order to make the remote work. I'm running currently BIOS version 22 from November 2013 and this fix is necessary.

Check the latest available version of BIOS for D34010WYK here and for D54250WYK here.

3 comments:

  1. thanks a lot. Saved my day with the fiddle to get the IR working. The NUC is a lovely piece of kit but the bios feels like it is still in beta which scares me a bit.

    ReplyDelete
  2. Thanks for the trick. For those like me that use xbmcbuntu, the bootscript (autostart equivallent) is organized like this :

    XBMCbuntu uses the /etc/xbmc/ dir for script execution at boot.

    /etc/xbmc/setup.d/ -> these script are executed once (at installation boot time)

    /etc/xbmc/live.d/ -> these scripts are executed every time xbmc starts


    (credit to erhnam)

    ReplyDelete
  3. Looks like BIOS v27 fixes this, at least on the i3 Haswell NUC. I no longer need the script anymore.

    ReplyDelete