Labels

03/05/2012

Display Current System IP Address

arguments << "-c" << "ifconfig wlan0 | grep 'inet ' | awk '{print $2}' | sed 's/addr://'";
// or arguments << "-c" << "ifconfig eth1 | grep 'inet ' | awk '{print $2}' | sed 's/addr://'";
QProcess* process = new QProcess(this);
process->start(prog , arguments);
process->waitForFinished();
QString tmp = process->readAll();
//qDebug() << tmp;
ui->label_ip->setText(tmp);

20/04/2012

Black screen after running an application

I put my application in /etc/rc5.d/S99rmnologin to let it automatically start.
The application is running well. But the screen turns black after 1 minute. When I touched the screen, a small area, where my finger pointed, of my application GUI show up. My application GUI gradually appears if I continuously moving my finger on the screen. It looks like using a mop to wipe the screen.

Solution:

Take a look in /etc/rcS.d/S01psplash file. At the end of line, there is a "sleep 120 ..." command which caused the problem. After comment out this line, everything goes fine.

# Timetrap against hanging with splash hiding console messages.
(sleep 120; psplash-write "QUIT") &

13/04/2012

Change Gumstix Overo Booting Screen (Logo image)


By default, overo boots up with its own image with progress bar. I want to display my own picture when it boots up.

I follow the below website, but it is for Angstrom. I did some modification to suit my overo COM.

https://support.bluetechnix.at/wiki/Changing_the_splash_screen_picture

1) bitbake psplash

$ cd /build/czhang/overo-oe
$ source build/profile
$ bitbake psplash
...

2) copy make-image-header.sh file to proper place.

$ cp /build/czhang/overo-oe/tmp/work/armv7a-angstrom-linux-gnueabi/psplash-angstrom-0.0+svnr422-r33/psplash/make-image-header.sh /build/czhang/overo-oe/org.openembedded.dev/recipes/psplash/files/overo

3) create your own image file, make sure it is in right dimensions.

$ cd /build/czhang/overo-oe/org.openembedded.dev/recipes/psplash/files/overo
$ ./make-image-header.sh [your-image].png HAND

    back up original image head file:
$ mv psplash-hand-img.h psplash-hand-img.h_orig
$ mv [your-imge]-img.h psplash-hand-img.h
$ cd /build/czhang/overo-oe
$ source build/profile
$ bitbake psplash

Error occurred:

| psplash.c: In function 'main':
| psplash.c:271: error: 'POKY_IMG_WIDTH' undeclared (first use in this function)
| psplash.c:271: error: (Each undeclared identifier is reported only once
| psplash.c:271: error: for each function it appears in.)
| psplash.c:272: error: 'POKY_IMG_HEIGHT' undeclared (first use in this function)
| psplash.c:275: error: 'POKY_IMG_BYTES_PER_PIXEL' undeclared (first use in this function)
| psplash.c:276: error: 'POKY_IMG_RLE_PIXEL_DATA' undeclared (first use in this function)
| make[1]: *** [psplash.o] Error 1
| make[1]: *** Waiting for unfinished jobs....
| mv -f .deps/psplash-write.Tpo .deps/psplash-write.Po
| mv -f .deps/psplash-console.Tpo .deps/psplash-console.Po
| mv -f .deps/psplash-fb.Tpo .deps/psplash-fb.Po
| make[1]: Leaving directory `/build/czhang/overo-oe/tmp/work/armv7a-angstrom-linux-gnueabi/psplash-0.0+svnr422-r33/psplash'
| make: *** [all] Error 2
| FATAL: oe_runmake failed

it took me a long time to figure it out. In

/build/czhang/overo-oe/tmp/work/armv7a-angstrom-linux-gnueabi/psplash-0.0+svnr422-r33/psplash

there are three files:
psplash-hand-img.h
psplash-poky-img.h
psplash-bar-img.h

take a look psplash-poky-img.h content where the error occurred:
$ less psplash-poky-img.h

/* GdkPixbuf RGB C-Source image dump 1-byte-run-length-encoded */

#define HAND_IMG_ROWSTRIDE (816)
#define HAND_IMG_WIDTH (272)
#define HAND_IMG_HEIGHT (363)
#define HAND_IMG_BYTES_PER_PIXEL (3) /* 3:RGB, 4:RGBA */
#define HAND_IMG_RLE_PIXEL_DATA ((uint8*) \

After I replaced the HAND with POKY, and bitbake again, error disappeared.

4) bitbake console image

$ bitbake omap3-console-image

5) remember to install psplash_0.0+svnr422-r33.6_armv7a.ipk (maybe psplash-support_0.0+svnr422-r33.6_armv7a.ipk too), this is a software which can load booting image.

Done! you will see the pretty image in the booting procedure.

Modify booting scrip for Gumstix Overo Tide COM

The Tide COM has no NAND built in. When I try to change environment parameter, such as rotate screen or change default display, it just won't work.

The solution is to create a boot command file, e.g. ubootenvcmd, and add it into a boot.scr.

Here is how I do it:

1) create a ubootenvcmd file by using gedit. The content is something like:

setenv ethaddr 00:00:00:FF:FF:FF
setenv mpurate 720
setenv vram 4M
setenv linuxmem 176M
setenv defaultdisplay lcd43
setenv dvimode 480x272MR-16@60
setenv mmcargs ${mmcargs} omapfb.rotate=1
setenv bootcmd 'mmc init; run loaduimage; run mmcboot'
boot

2) install mkimage:
$ sudo apt-get install uboot-mkimage

3) create boot.scr file:
$ mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n "Overo boot script" -d ubootenvcmd boot.scr

ps. remember to put the ubootenvcmd file in current directory.

4) copy boot.scr to your FAT partition of your SD card.

Done :)

10/04/2012

Cross compile for i386 on 86_64 system

Down load  qt-everywhere-opensource-src-4.7.0

"configure -help" will tell you how to do the cross compile for different OS.

1) tell machine to compile program to 32bit OS
$  ./configure -platform linux-g++-32

Error:
/usr/include/gnu/stubs.h:7:27: error: gnu/stubs-32.h: No such file or directory
make: *** [project.o] Error 1

Solution:
$ sudo apt-get install libc6-dev-i386

Error:
/usr/bin/ld: cannot find -lstdc++
collect2: ld returned 1 exit status

Solution:
$ sudo apt-get install g++-multilib

2) make all libraries
$ make

3) create a "projects" folder under  "qt-everywhere-opensource-src-4.7.0". put your project folder, i.e. m4works, in "projects". and also copy relative folders, qextserialport, qwt-5.2.1, into "projects".

4) compile project relative libraries first to get 32bit libraries.
$ qmake qextserialport.pro
$ make
...

5) modify project .pro file to point libraries in right directory.

6) compile project.
$ qmake m4.pro
$ make




23/03/2012

Rotate Screen in Ubuntu


The screen rotation function in Nvidia graphics driver is normally disabled. But We can enable it by modifying xorg.conf file.

To do this, we need to back up xorg.conf file first.

$ sudo cp /etc/X11/xorg.conf /etc/X11/xorg.conf.bak

Now edit the file:
$ sudo gedit /etc/X11/xorg.conf

In the Device section that includes the line:

         Driver    "nvidia"

Add:
         Option "RandRRotation"   "on"

It will looks like:

Section "Device"
    Identifier            "Device0"
    Driver                "nvidia"
    VendorName     "NVIDIA Corporation"
    Option                "RandRRotation" "on"
EndSection


Then, we need to log out and log back in to restart X server.

To rotate screen to left, use:
$ xrandr -o left

To rotate screen to right, use:
$ xrandr -o right

To flip screen upside down, use:
$ xrandr -o inverted

To go back to normal, use:
$ xrandr -o normal