Monthly Archives: December 2011

Christmas Toy: Gumstix

Today I received a Gumstix FireSTORM and some accessories I ordered for my PhD project. For people in Brazil, the price was U$ 500,00 (about R$ 1.000,00) and the taxes were also R$ 1.000,00 (!!). Yes, the import taxes were the same price as the products, doubling their price.

The gadgets came very well packaged in organized and separated boxes. I simply mounted FireSTORM in the top of Tobi, powered Tobi with a 5V power supply, and got Angstrom-Linux running in less than 5 minutes after opening the box with ethernet, wifi, bluetooth, ssh, etc. Also, the USB console was very useful in the first boot so that I could setup the network interfaces.

Some photos:

https://picasaweb.google.com/113280981037754135094/Gumstix

Sending keys to Linux’ programs

Source: http://www.semicomplete.com/projects/xdotool/

#apt-get install xdotool

#Send a Ctrl+P to Google Earth -> “File -> Print”

WID=`xdotool search “Google Earth” | head -1`
xdotool windowactivate $WID
xdotool key ctrl+p

#Copy Google Earth current view image to clipboard

WID=`xdotool search “Google Earth” | head -1`
xdotool windowactivate $WID
xdotool key ctrl+alt+c

And so on….there are several other possibilities described in the mentioned page.

Getting a text or a image from the Linux clipboard and saving it to a file using QT

#include <QApplication>
#include <QClipboard>
#include <QMimeData>
#include <stdio.h>
#include "window.h"

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    QClipboard *clipboard = QApplication::clipboard();
    const QMimeData *mimeData = clipboard->mimeData();
    QPixmap pixmap;

    if (clipboard == 0) {
        printf("Error");
        return 1;
    }

    if (mimeData->hasImage()) {
        printf("Found an image. Saving to /tmp/test.ppm\r\n");
        pixmap = qvariant_cast<QPixmap>(mimeData->imageData());
        pixmap.save("/tmp/test.ppm");

    } else if (mimeData->hasText()) {
        printf("Found a text. Writing to stdout\r\n");
        printf("Text: %s\r\n", clipboard->text().toStdString().c_str());
    } else
        printf("Unknown data\r\n");

}