Wednesday, January 21, 2009

2x SunSPOTs + Propellerhead Reason = Air Guitar!

This is a little hack that I have done yesterday, being very bored with learning for my database exam. I took two SunSPOT sensor nodes and Propellerhead Reason to build an air guitar that you can actually play!

But enough talk, here's the video:




As you will have noticed, it's not very accurate and does not replace a real guitar yet ;) Maybe I'll improve it when I have some more time on my hands.
You will probably also have noticed that one of the SunSPOTs, the neck, is still connected over USB. This is because the battery is broken and cannot be charged, so I have to draw power over USB. It would probably rock much more if neither of the SPOTs would be connected.

The software is written in Java: The stuff on the SunSPOTs as well as the application running on the PC. MIDI output from the PC application is redirected to Reason using MIDI Yoke.

At the end of the week I'll post the source code and a little tutorial for those interested in playing air guitar as well :)

Sunday, January 18, 2009

Getting your web cam to work with Skype and Xubuntu 8.10 (Intrepid Ibex)

Since Xubuntu 8.10, the video from my web cam is broken. When I test the web cam, all I see is noise, where as my partner does not receive any of my video. This is related to bug 260918. However, there's a simple workaround.

First of all, install libv4l-0. Open a terminal and type the following:

frederik@lolcat:~$ sudo apt-get install libv4l-0


Then, you need to make sure that the newly installed library is used when you start Skype. Make sure Skype is not running yet, then enter this in your terminal:

frederik@lolcat:~$ LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so skype


Go to the Options -> Video devices menu in Skype. Your web cam should work correctly now.

It's a bit awkward to type the above command every time you want to start Skype, so I suggest creating a script for it. Just open up your favorite text editor and put the following lines in the empty file:

#!/bin/bash
LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so skype


Now save the file in your home directory under the name skype.sh.

Now you need to make the script executable. To do this, in the terminal type:

frederik@lolcat:~$ chmod +x skype.sh


Now you can execute skype.sh whenever you want to start Skype.

The last thing to fix is the menu entry. This is located in the file /usr/share/applications/skype.desktop. Open this file as root with a text editor of your choice and find the line "Exec=skype". Replace this line with the following:

Exec=/home/frederik/skype.sh


Be sure to replace frederik with your username. Save the file.

You may now need to restart XFCE for the change to take effect.

Saturday, January 17, 2009

Using the VGA output of your laptop's Intel graphics card

I have been a Linux user for quite some time now, and even though I am much more comfortable with using Linux than with any other operating system, there still are some things that really annoy me.

One of these things is enabling the VGA output (i.e. the external monitor) on a laptop. I own a rather old Acer TravelMate 290 laptop that comes with an Intel 855GM graphics card. When using Xubuntu 8.04 and trying to enable the VGA output by hitting the Fn+F5 key, all my system did is ... crash. As you can imagine, this is especially annoying when you're supposed to give a talk! (Shame on me for not testing before.)

With Xubuntu 8.10 (Intrepid Ibex), the system doesn't crash on Fn+F5 any more, but it will not enable the VGA output either. So after I spent quite some time researching and trying things out, here is how to enable your VGA output:

  1. Attach a monitor/projector/something else to the VGA output of your laptop.
  2. Open a terminal and run "xrand -q". It will show all your graphics card's outputs and the available modes. VGA is your VGA output (duh!) and LVDS is your laptop's LCD display.
  3. To enable the VGA output, enter "xrandr --output VGA --mode 1024x768", where you substitute "1024x768" with the resolution of your LCD display (LVDS).
  4. Voilá! VGA output is enabled and you're ready to give a great presentation.
This information is valid for all graphics cards that use the X intel driver. These are: G45, Q45, G43, Q43, GM45, G35, Q35, Q33, G33, 965GM, 965G, 965Q, 946GZ, 945G, 945GM, 915G, 915GM, 865G, 855GM, 845G, i830M, 815, 810, 810-DC100.
For more information, see the X intel driver's homepage. It also has a tutorial on how to setup a dual-screen environment.

About the function keys: Unfortunately, it is not possible to capture Fn+F5 to run the xrandr-related magic automatically. It tried finding out the appropriate event using xev, but to no avail. Thus, for now, you're stuck with the command line.

Hope this helps you to enable you VGA and give a good presentation, watch a cool movie, or use a dual-screen environment.