Friday, December 24, 2010

HOWTO: Get working ASRock HT330 remote on XBMC and Ubuntu

HOWTO: Get working ASRock HT330 remote on XBMC and Ubuntu

Note: If you don't care for the details, scroll down and grab the entire script below.

First thing you need to do is get a console. If you are using XBMC, press CTRL+ALT+F1.
In the console, you need to log in with your username and password.

Once you are logged in, create a working folder:
mkdir ir
cd ir


You need lirc for remotes to work:
sudo apt-get install lirc


Now you need to get the CIR drivers from ASRock:

wget "http://europe.asrock.com/downloadsite/drivers/Nettop/Ubuntu/IR(10.04).zip" --output-document=cir.zip
unzip -j cir.zip
unzip -j lirc-nct677x-1.0.4-ubuntu10.04.zip


I found the ASRock drivers here.

Now try to install it:
sudo dpkg -i lirc-nct677x-1.0.4-ubuntu10.04.deb


As explained in another blog you must choose "None" and then "None" again.

It will do work, and then ask you again for receiver type. This time select the
"Nuvoton Transceivers/Remotes" as the receiver and then "None" for the transmitter.

If it fails, your output will look like this:
* Stopping remote control daemon(s): LIRC[ OK ]
patching file /usr/share/lirc/lirc.hwdb
* Stopping execution daemon: irexec [fail]
* Stopping remote control daemon(s): LIRC [fail]
* Starting execution daemon: irexec [fail]


Now try to manually load the module:
sudo modprobe lirc_wb677


You will likely get an error like this:
FATAL: Error inserting lirc_wb677 (/lib/modules/2.6.31-16-generic/kernel/ubuntu/lirc/lirc_wb677/lirc_wb677.ko): Invalid module format


And if you run dmesg you will see:
[  534.630092] lirc_dev: IR Remote Control driver registered, major 61
[ 534.631027] lirc_wb677: disagrees about version of symbol module_layout


What has happened is that the kernel version does not match the version that the driver was made for, so now you need to build your own driver.

First, get the tools to build the driver:
sudo apt-get update
sudo apt-get install dkms build-essential lirc-modules-source


Then install the source for the driver:
unzip -j lirc-nct677x-src-1.0.4-ubuntu10.04.zip
sudo dpkg -i lirc-nct677x-src-1.0.4-ubuntu10.04.deb


You will now get the message:
You can use dkms commands to compile / install nct677x / w836x7 CIR driver now.
e.g.
to build src : dkms build -m lirc-nct677x-src -v 1.0.0-ubuntu9.10
to install binary : dkms install -m lirc-nct677x-src -v 1.0.0-ubuntu9.10
to uninstall binary : dkms uninstall -m lirc-nct677x-src -v 1.0.0-ubuntu9.10
to remove src : dkms remove -m lirc-nct677x-src -v 1.0.0-ubuntu9.10 --all
After updating src, remember to update lirc.hwdb and
reconfigure lirc by the following command:
dpkg-reconfigure lirc


Apart from the fact that the version is 1.0.4, this looks nice, so lets try the build command:
sudo dkms build -m lirc-nct677x-src -v 1.0.4-ubuntu9.10


This gives the rather unhelpfull error:
Error! DKMS tree does not contain: lirc-nct677x-src-1.0.0-ubuntu9.10
Build cannot continue without the proper tree.


After some poking around, it turns out that the "tree" is actually located in /var/lib/dkms,
so we need to make a structure that fits DKMS:
sudo mkdir /var/lib/dkms/lirc-nct677x-src
sudo mkdir /var/lib/dkms/lirc-nct677x-src/1.0.4-ubuntu9.10
sudo cp -R /usr/src/lirc-nct677x-src-1.0.4-ubuntu9.10/ /var/lib/dkms/lirc-nct677x-src/1.0.4-ubuntu9.10/source


Now DKMS should be happy, so build and install the module (we force the module to overwrite the one installed by the package earlier):
sudo dkms build -m lirc-nct677x-src -v 1.0.4-ubuntu9.10
sudo dkms install -m lirc-nct677x-src -v 1.0.4-ubuntu9.10 --force


Lets try modprobe again:
sudo modprobe lirc_wb677


And this time there should be no errors.

Now re-configure lirc:
sudo dpkg-reconfigure lirc


Select the "Nuvoton Transceivers/Remotes" as the reciever and then "None" for the transmitter.

The output should show that it succeeds:
* Loading LIRC modules [ OK ]
* Starting remote control daemon(s) : LIRC [ OK ]
* Starting execution daemon: irexec [ OK ]


Now reboot the machine:
sudo reboot


And it should work!

If you upgrade your kernel at some point, you just need to rebuild the module again:
sudo dkms build -m lirc-nct677x-src -v 1.0.0-ubuntu9.10
sudo dkms install -m lirc-nct677x-src -v 1.0.0-ubuntu9.10 --force


As promised a full script. When asked for the reciever select "Nuvoton Transceivers/Remotes", and if
it is not on the list, select "None". It should show the selection dialog two/three times, with two selections
for each run (a total of 4/6 blue dialogs):

mkdir ir
cd ir
wget "http://europe.asrock.com/downloadsite/drivers/Nettop/Ubuntu/IR(10.04).zip" --output-document=cir.zip
unzip -j cir.zip
unzip -j lirc-nct677x-1.0.4-ubuntu10.04.zip
unzip -j lirc-nct677x-src-1.0.4-ubuntu10.04.zip
sudo apt-get install dkms build-essential lirc-modules-source
sudo dpkg -i lirc-nct677x-1.0.4-ubuntu10.04.deb
sudo dpkg -i lirc-nct677x-src-1.0.4-ubuntu10.04.deb
sudo mkdir /var/lib/dkms/lirc-nct677x-src
sudo mkdir /var/lib/dkms/lirc-nct677x-src/1.0.4-ubuntu9.10
sudo cp -R /usr/src/lirc-nct677x-src-1.0.4-ubuntu9.10/ /var/lib/dkms/lirc-nct677x-src/1.0.4-ubuntu9.10/source
sudo dkms build -m lirc-nct677x-src -v 1.0.4-ubuntu9.10
sudo dkms install -m lirc-nct677x-src -v 1.0.4-ubuntu9.10 --force
sudo modprobe lirc_wb677
sudo dpkg-reconfigure lirc

Thursday, December 16, 2010

The Humble Indie Bundle, part #2



The Humble Indie Bundle is a promotion concept where you can by a bundle of games from independent developers, at a price that you choose.

The current campaign is #2 and contains five games:
I have purchased the set, and so far only tried Machinarium, but I must say that this game is worth at least $20 alone.

It is a fairly regular adventure game with an atmosphere much like Syberia. You control a robot that has an unknown task. For some reason the robot reminds me a little of the animated movie 9.


The hint system is a really nice touch. It is essentially a mini shooter game, but the idea is that it takes a little time before you can get the hint, so you are more likely to try to figure it out rather than just look it up.

The implementation is entirely flash, which I can imagine is nice for the graphical artists, but it does have small subtle bugs, such as items becoming un-clickable, so you must move around to re-activate them.

But overall the game is challenging and has a cool atmosphere, which I find are the two most attractive features.

If you have not already bought the Humble Indie Bundle, you need to hurry, as there is now less than 5 days till the offer expires!

Saturday, December 11, 2010

Why intellisense stops working in Visual Studio 2010

I have some trouble with intellisense in Visual Studio 2010. Occasionally it stops suggesting entries, so it is not really broken, it just does not highlight a suggestion, forcing me to either select it with the mouse, or use arrow keys. The first picture shows it when it is not working, the second picture shows it working:

intellisens not working
intellisense working



The annoying part is that once this happened, I could not fix it, except by restarting Visual Studio, which takes some time. After some searching, it turns out "it's not a bug, it's a feature!".
It is called low-impact intellisense, and it can be toggled with CTRL+ALT+space.

I'm pretty sure that I never type that by mistake, but at least now I know how to turn it back on once it stops working.