Saturday, January 25, 2014

Mapping the buttons on the remote control

The page has moved to http://nucblog.net/2014/01/mapping-the-buttons-on-the-remote-control/! You are being redirected. If not, please click the link.


Allright, time to make the remote controller work as I want it to. At this point I have a clean installation of OpenELEC and XBMC, the remote controller works, but the buttons on my remote do not work exactly as I would like. Luckily the XBMC is very flexible when it comes to mapping the buttons - it's basically possibly to control fully how the system will function when a certain button is pressed. I've got an HP MCE-compatible remote controller and I'm using the inbuilt infrared receiver of my Haswell NUC. In order to make the inbuilt receiver work in OpenELEC, I first had to do a small trick described here. I also have an HP IR receiver that came with the remote (OVU400102/71). That works straight out of the box in OpenELEC.

HP MediaCenter Remote

Verify that the remote controller works

First, let's make sure that the IR receiver is receiving something from the remote controller and that the keypresses are understood by the system. If you have an MCE-compatible remote and an IR receiver (such as the one inbuilt in the Haswell NUCs) this should be the case. Open an SSH connection to your NUC and run the command irw to see the keypresses recognized by the system. If you see lines on the screen when you press buttons on your remote, you're good to go. Press Ctrl-C to stop irw.
MediaCenter:/ # irw
166 0 KEY_INFO devinput
166 0 KEY_INFO_UP devinput
174 0 KEY_ZOOM devinput
174 0 KEY_ZOOM_UP devinput
72 0 KEY_VOLUMEDOWN devinput
72 0 KEY_VOLUMEDOWN_UP devinput
73 0 KEY_VOLUMEUP devinput
73 0 KEY_VOLUMEUP_UP devinput
80 0 KEY_STOP devinput
80 0 KEY_STOP_UP devinput
^C

Files for keymapping

There are two files that control how the buttons on your remote work and both are needed. The other one is called Lircmap.xml and the other one is remote.xml. If you want to modify these files, you should copy them under /storage/.xbmc/userdata. This way your settings will be retained, even if the system would be updated and the default files get overwritten with new versions. So copy the default files first using the cp command.
# cp /usr/share/xbmc/system/Lircmap.xml /storage/.xbmc/userdata
# cp /usr/share/xbmc/system/keymaps/remote.xml /storage/.xbmc/userdata/keymaps
The XBMC will first load the values from these files, and if they're not present, then the default files will be used.

Editing Lircmap.xml

The Lircmap.xml is a text file that you can edit either inside the terminal using nano text editor, or you can transfer the file to another PC, edit it there and move it back. I'm using nano inside the terminal. The file contains several different types of devices. You only need to edit the section that is applicable for your device. The name of the device is shown in the irw printout above. In my case, it is devinput so I will need to edit only the section that is under <remote device="devinput">.

<remote device="devinput">
        <left>KEY_LEFT</left>
        <right>KEY_RIGHT</right>
        <up>KEY_UP</up>
        <down>KEY_DOWN</down>
        <select>KEY_OK</select>
        ... clip ...

In this file, the key presses are mapped to XBMC button labels. For example, in the small clip above the key press KEY_LEFT has been mapped to XBMC button label left and key press KEY_OK has been mapped to XBMC label select. You can map several key presses to the same XBMC button label, but not the other way around. To see which physical button on your remote controller corresponds to which key press tag, use the irw command and press the buttons on your remote.

Editing remote.xml

The other file, remote.xml binds the XBMC button labels with actual actions that take place when you press the button. There are a lot of comments in the beginning of the file that you can just skip. The first section starts by defining the global actions. These are valid in every different mode in XBMC.

<keymap>
  <global>
    <remote>
      <play>Play</play>
      <pause>Pause</pause>
      <stop>Stop</stop>
      <forward>FastForward</forward>
      <reverse>Rewind</reverse>
      <left>Left</left>
      <right>Right</right>
      <up>Up</up>
      <down>Down</down>
      <select>Select</select>
      ... clip ...

Here you can see that the XBMC button label left has been tied to action Left. Not that surprising example maybe, but there are more complicated actions as well that you can define. If you scroll down further down in the file you can see that there are smaller lists of button labels and actions under various sections. This is a section called FullscreenLiveTV.

  <FullscreenLiveTV>
    <remote>
      <left>PreviousChannelGroup</left>
      <right>NextChannelGroup</right>
      <up>ChannelUp</up>
      <down>ChannelDown</down>
    </remote>
  </FullscreenLiveTV>

Here we can see that the button labels left, right, up and down have been redefined. This means that if you are watching live TV, the arrow up on your remote controller is tied to action ChannelUp instead of Up like it was in the global section. This is a way for you to fine tune the behaviour of the system according to your preferences.

Concrete example

But let's take a concrete example. I've got a button Guide on my remote and I'd expect that when I press that I will see the EPG. Instead of EPG it seems to pop up the context menu. The first thing I need to do is to understand which key press takes place when I press the Guide button. I run the irw to find out that.

MediaCenter:~ # irw
16d 0 KEY_EPG devinput
16d 0 KEY_EPG_UP devinput
^C

Allright, so the key press is called KEY_EPG and my device is called devinput. Good stuff. Now I will need to have a look at the Lircmap.xml file that is stored under /storage/.xbmc/userdata folder. I find that under the section for device devinput the KEY_EPG is defined like this:

                <title>KEY_EPG</title>

This means that the actual key is bound to XBMC button label title. Now when I look at the remote.xml file that is stored under /storage/.xbmc/userdata/keymaps I find that the button label title is tied to action ContextMenu.

      <title>ContextMenu</title>

No wonder it pops up the context menu when I press the Guide button on the remote! I find that further down in this file, there is a button label guide that had been tied to a complex looking action that actually pops up the EPG.

      <guide>XBMC.ActivateWindowAndFocus(MyPVR, 31,0, 10,0)</guide>

Now I would have two options. Either change the action for the XBMC button label title to XBMC.ActivateWindowAndFocus(MyPVR, 31,0, 10,0), or I can change the KEY_EPG to point to XBMC button label guide instead of title. I take another look at the Lircmap.xml and notice that under devinput section there's not a single button tied to XBMC button guide, so I decide to change my Lircmap.

                <guide>KEY_EPG</guide>

In order for the change to take place, I restart my system. After booting up, the button Guide on my remote now brings up the EPG for live TV. Yay!

List of button labels and actions

There's a list of possible actions on the XBMC wiki page here. For different button labels that are available, it's best to have a look at the existing remote.xml file. There's also a page on the Keymap in the XBMC wiki, but I found that a little bit of confusing initially.

Thursday, January 23, 2014

BIOS version 23 released for Haswell NUCs

Intel has released new BIOS versions for the Haswell NUCs. According to the release notes at least the POST time has been improved and some USB related issues have been fixed. Some people have been having issues with their USB 3.0 sticks getting detached automatically, this should help.

Release notes:
  • Date: December 24, 2013
  • ME Firmware: 9.5.13.1706
  • Integrated Graphics:
    Option ROM: Build 2177 PC 14.34
    UEFI Driver: 5.0.1034
  • LAN Option ROM: v1543 PXE 2.1 Build 092
  • SATA RAID Option ROM: 12.7.0.1936
  • EFI driver (GOP): 5.0.1034
  • Visual BIOS: 2.1.5

New Fixes/Features:
  • Fixed issue with random USB loss.
  • Fixed issue where the Event count does not match the number of times the event occurred.
  • Reduced POST time.
  • Updated help information in Visual BIOS.
  • Fixed issue where system won’t boot to Linux Mint.

Download your BIOS update from Intel's Download Center:

Thursday, January 16, 2014

The NUCs with a 2.5" HDD/SSD slot are here!

The lack of space for a 2.5 inch drive has been putting off some people. Finally, the D34010WYKH and D54250WYKH are here! The 'H' in the end of the model name stands for a higher chassis, so you can fit in a single 2.5" drive. Have a look at the Legit Reviews article on D54250WYKH for an overview!

The model with Intel Core i3 CPU is already available at Amazon.
 


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.

A look around (and inside) the i3 NUC D34010WYK

Allright, the NUC is finally here! My NUC is a D34010WYK ($289 / £252 / €279 at the time of writing, Amazon), which is equipped with an Intel Core i3 Haswell processor including the HD Graphics 4400 graphics adapter. That makes it powerful enough for almost any HTPC usage these days. When 4k video will come, this might not be (or might be) enough, but we're still too far from 4k for me to worry about it.

So, let's have a look at the thing. When you open the package, it will play the Intel tune (seriously) and reveal a power cord, power brick, some quick start guides and warranty papers and the NUC itself. I had seen all the pictures online before, but it's still hard to comprehend how small the thing is before you actually see it live. For perspective I placed a PS3 controller next to the thing.

D34010WYK NUC next to a PS3 controller

So let's have a look at the chassis. The glossy black top looks rather nice with aluminum chassis, even if I would have preferred a full aluminum chassis. The front side houses 2 USB 3.0 connectors, combined heaphone/microphone jack and the IR receiver. The power button sits on the top.

The front side

In the rear we have a 19-volt DC connector, mini DisplayPort 1.2a connector, mini HDMI 1.4a connector, RJ45 Ethernet connector and 2 USB 3.0 ports. It's worth noting that all external USB ports are of the latest 3.0 type. There's an internal USB 2.0 header on the mainboard, that's currently unused in my setup.

Connectivity on the back side

There are 4 regular Phillips-head screws on the bottom, one inside each rubber foot. After popping off the bottom cover the mainboard is exposed. As you probably already know, you will need to install at least a single DDR3L (1.35V) memory module in the NUC, but you can install another one to enable dual channel memory mode, which is a bit faster as well as an mSATA SSD disk and a WiFi card. Or you could think of something else to put in the full and half size mini PCIe slots.

The mainboard with the components
I've annotated the picture above to show you what's on the bottom side of the board. Note that while you do have a SATA connector that does support 6Gb/s speed, there is no space in the chassis for a drive. Intel is later on releasing models that do have a bit more space inside the case. DN2820FYKH is the Celeron model, D34010WYKH is the Core i3 model (with the same mainboard as the one here) and D54250WYKH is the Core i5 model. The letter H at the end of the model name denotes a bit higher case with a space for a single 2.5" SSD or HDD drive.

My WiFi card and mSATA SSD drive had not arrived yet, so I only had to install my memory at this point. Installing the memory is easy, just insert it in a slight angle and push down until it clicks down. There's a good pictured quick start guide with the NUC that will explain you all this in details. Even if you've never built a PC yourself, it's fairly simple to build the NUC.

On the top side of the board you have the CPU and the fan assembly as well as a custom solutions header, which will give you additional possibilities if you're building a system in a custom casing instead of the Intel provided one. I did not have any use for it, so I did not take off the board to see the other side.

Single DDR3L 1.35V SODIMM module installed
I'll need to add the SSD and the WiFi card later, but now it's time to replace the screws and boot up the thing! I hooked it up with my TV using the mini DisplayPort connector because that's the only cable I had lying around the house. Will use the HDMI connector later on. Intel NUC logo popped up on the screen and I quickly pressed F2 on the keyboard to enter the visual BIOS. The fan is barely audible and can be made even quieter by adjusting the BIOS settings.

Allright, that's it for now, I'll have a look at the BIOS settings later on and talk about installing the OpenELEC operating system which is the soul of my future home theater machine. My first impressions of the latest OpenELEC nightly are very positive - after a bit of tweaking almost everything works as I want.

Saturday, January 4, 2014

Building up a NUC on a budget

While I bought myself the Intel Core i3 NUC for about €350 ($400) with all the accessories, maybe you have much less resource demanding needs for your PC or just want to try out a NUC system without investing too much. I wanted to see how much you'd actually need to invest in order to build a minimum cost machine out of a NUC.

Obviously the choice of the NUC is the first thing you need to make. The Celeron based models are obviously the cheapest ones, but currently you can find an Ivy Bridge i3 model with a very low cost as well since they're being replaced by the Haswell models. It might pay to look around a bit before deciding. Keep in mind that the processor and the graphics adapter in the i3 model are clearly more powerful. Have a look at the Intel NUC Line-up page I've made to make it easier to see the differences of each model.

Basically the minimum things needed for a NUC is memory modules and a storage media (maybe you could boot over network without a storage media even but I haven't tried out). Depending on your needs you might need to add network adapters, IR receivers, TV tuners or other peripherals.

The NUC



The i3-based DC3217BYThe Celeron-based DCCP847DYE

I chose to include two options here, the previous generation Core i3 model DC3217BY and the current Celeron model DCCP847DYE since they're so close to each other in price. Both fit in the $150-175 / 135-150€ price range (see DC3217BY and DCCP847DYE on Amazon). Their capabilities are quite different though.

First of all, it's important to notice that the i3 model does not have a wired Ethernet port. If you need fixed connectivity you need either an USB Ethernet adapter or a Thunderbolt-to-Ethernet adapter. Another important point of course is the CPU - the i3 is definitely faster than the Celeron. The integrated graphics adapter in the i3 model is also faster.

Do note that the upcoming DN2820FYKH model might change things a bit. I'll keep you posted when the model is available (according to Intel January 2014).

Memory


So we need some memory for our device. With prices falling and both NUCs taking the common DDR3 SODIMM modules, I'd say buy as much as you can, but in order to keep the price as low as possible let's go with a single 2-gigabyte SODIMM module. The DC3217BY takes the faster PC3-12800 (1600) memory, whereas the Celeron is fine with PC3-10600 (1333) memory. There's almost no price difference, so just get yourself one. A quick look at eBay reveals that you can get one for approximately $15 / 10€.

Keep in mind that installing 2 identical memory modules in the system will enable the dual channel mode which will make the memory work a bit faster, so it might be worth buying two modules.

The Storage Media


While an mSATA SSD drive would definitely be the preferred option we need to look to lower cost options if ultimate low-budget NUC is the goal. It is entirely possible to use a USB flash memory as the main storage of a computer these days. Since neither of the NUCs have a USB 3.0 port, a simple USB 2.0 stick will do. A good quality stick such as one from Kingston or Sandisk is recommended as the lifetime of a low quality USB stick may be rather short.

Using an SSD drive instead of a USB stick can bring enormous speed increase though. Especially booting up the operating system from an SSD is such a joy that I haven't looked back at hard disks since I got my first SSD. Thus I'd recommend giving it a serious thought. If you decide on an SSD, do make sure it supports TRIM. A-Data SP310 or Transcend MSA740 drives in 32 gig size are available around $40 / 40€, both support TRIM and are fast enough. There are several other good options as well.

Additional Peripherals


Now depending on what you want to do with your NUC, you might need some additional devices attached to your system.

Wireless Connectivity


If you do need wireless connectivity, you have two options. Either you populate the internal half-size PCIe mini slot with a wireless card or you buy an external USB adapter. Even if the USB adapters have come a long way, I'd still recommend a proper PCIe mini card. All Intel NUCs have the antennas built in, so it's easy to add an adapter. Just remember to get an adapter that's half-sized.

If you don't need BlueTooth get an Atheros AR5B95 or Intel WifiLink 5100 adapter. Those can be bought cheap as chips these days in eBay. Linux support exists for both.

If you want BlueTooth connectivity as well, Intel 6235AN can be had for about $20 / 15€ and includes BlueTooth 4.0 support.

Wired Ethernet Connectivity


In case you chose DC3217BY and need wired Ethernet port, you'll need to install an USB adapter or a Thunderbolt to Ethernet adapter. The former is a bit cheaper and the latter is a bit faster.

Remote Control


If you intend to use your NUC as a HTPC you'll definitely need a remote control. Now modern smartphones or tablets can be used as a remote via your local network, but if you're looking for something more conventional then an USB IR receiver and a Microsoft MCE compatible remote controller is the way to go.

HP IR Receiver model OVU400103/00 seems to work well, does support discrete power on and power off commands (not all of the receivers do) and can be had cheaply online. There are tens of other options for an MCE compatible remote and I'm sure most of them are fine as well.

Summary


I've collected here a few example systems to show the total price of full built economy NUC. Note that these do not include operating system, so I'm assuming you are going to use Linux or have an existing Windows license you can use with your NUC. All the configurations below are fully functional but very bare bones - even the performance builds are equipped with a pretty modest SSD drive, so if you need more from your NUC change the components as necessary. While the links below take you to Amazon for convenience, keep in mind that by searching eBay you'll find some of the components with even lower prices. For example there are a host of WiFi cards with rock bottom prices and you can also find good deals on used memory chips.


The NUCDC3217BY (Core i3)DCCP847DYE (Celeron)
Memory (low-cost option)2Gb DDR3-1600 SODIMM2Gb DDR3-1333 SODIMM
Memory (performance option)2x2Gb DDR3-1600 SODIMM2x2Gb DDR3-1333 SODIMM
Storage media (low-cost option)16Gb USB Flash memory
Storage media (performance option)32Gb mSATA SSD drive
WiFi card (optional)Atheros AR5B95 or Intel WifiLink 5100 (eBay for less than $10 delivered)
WiFi card with BlueTooth (optional)Intel 6235AN PCIe mini card
Wired EthernetUSB Ethernet ControllerNot needed
Remote ControlMicrosoft MCE compatible remote and IR receiver
Total (absolute low-cost) Approx $230/£165/€210 (with WiFi, no wired Ethernet)
Check the current price at:
Approx $190/£145/€170 (with wired Ethernet)
Check the current price at:
Total (SSD drive/Dual-channel memory/WiFi/BlueTooth) Approx $295/£225/€260
Check the current price at:
Approx $270/£210/€245
Check the current price at:

Friday, January 3, 2014

Intel NUC - What the NUC is that?

Intel's NUC (Next Unit of Computing, eh?) is a line of motherboards or barebone PC kits that are extremely tiny. The size of the board and the enclosure is approximately 10 cm by 10 cm or 4x4 inches - not a lot larger than your cell phone! Despite their size they offer very reasonable performance for several tasks. Intel describes many uses for the ultra compact PC from digital signage to thin clients, but it's the capabilities as a HTPC that got me interested.

Intel NUC DC3217IYE next to a USB stick. The thing is tiny!

The different NUCs have several good qualities that are essential for a HTPC:
  • It has enough processing power to run your media center (yes, even the slowest Celeron-based models pack enough punch)
  • It has an integrated graphics adapter that will decode those videos
  • It is small and stylish (so your wife will accept it in the living room)
  • It's got HDMI connectors to hook it up with your TV
  • The later models do include an IR receiver integrated in the box
  • It's quiet (even if it has a fan, fanless cases are available though)
So I was convinced pretty easily that this was the thing I needed in my living room and ordered one.

My setup will be following:
  • The Core i3 model with Haswell CPU, D34010WYK
  • 4 Gb of RAM (2 x 2Gb SODIMM)
  • 24 gigabyte cheap Sandisk SDSA5DK SSD drive found from eBay
  • OpenELEC operating system
Why did I choose those components?

I believe the Haswell Core i3 represents best value at this point. The processor is fast enough for any HTPC needs that I might have, even for running the more fancy skins in XBMC. The display adapter in the Haswell NUCs is also supposed to handle 23.976 near perfectly. I also like the fact that the IR receiver is already integrated so I don't need to use an USB port for that. Unlike the previous models, the Haswell NUCs are also supposed to wake up from S5 idle state using the remote control.

The OpenELEC requires only about 1 gigabyte of memory, but it's difficult to find smaller than 2 gigabyte memory modules that are low-voltage DDR3L modules. The Haswell NUCs only accept 1.35V SODIMM modules, so pay attention when you're shopping! I bought two SODIMMs (Hynix HMT325S6CFR8A-PB) since that enables dual channel mode, which is supposed to be slightly faster (not sure if that's noticeable at all in HTPC use though).

Finally the operating system takes only a small amount of space (less than 1 gig should be enough), but will store some cache files on the storage media, so I bought myself a modest 24 gigabyte mSATA SSD drive. All my media is stored on a Synology NAS drive that I got myself a couple of years ago. That's connected to the NUC using gigabit Ethernet network to keep the content flowing nicely. Note that my setup does not include a WiFi interface, since I plan to connect only with a wired Ethernet connection. I find the wired internet more responsive and more reliable than the wireless, and I don't want to see my movie stuttering because someone else started a major download on a laptop in another room...

I will be running the OpenELEC operating system, which is tailor made to run the XBMC media center. OpenELEC makes the HTPC as close to an appliance as it can get. Updates are automatic and you really do not need to know anything about the internals of the system, so the rest of the family is able to use it as well. Of course there is Linux running under the hood, so you have the possibility go down on the command line should you wish and I definitely will be spending some serious time there.

That's it, next time I'll write you how to install the components in the chassis.