MiniGUI在SkyEye模拟的s3c2410上的移植还是比较容易的,注意下触摸屏的移植即可。这里用的tslib 1.4作为触摸屏的适配层,下面是具体步骤。
1. 下载libminigui-1.6.10.tar.gz(http://nchc.dl.sourceforge.net/project/minigui/minigui/GPL-V1.6.10/libminigui-1.6.10.tar.gz )、minigui-res-1.6.10.tar.gz(http://cdnetworks-kr-1.dl.sourceforge.net/project/minigui/minigui/GPL-V1.6.10/minigui-res-1.6.10.tar.gz )和mg-samples-1.6.10.tar.gz(http://nchc.dl.sourceforge.net/project/minigui/minigui/GPL-V1.6.10/mg-samples-1.6.10.tar.gz )
2. 安装tslib 1.4(http://blog.csdn.net/Matrix_Designer/archive/2010/12/10/6068629.aspx )
3. 执行下列脚本:
tar zxvf libminigui-1.6.10.tar.gz
cd libminigui-1.6.10/
rm config.cache config.status -f
CC=arm-linux-gcc ./configure --prefix=/opt/minigui1.6.10/ --build=i386-linux --host=arm-linux --target=arm-linux CFLAGS="-I/opt/tslib/include -L/opt/tslib/lib -lts"
4. gedit src/ial/dummy.c &
将其内容改成如下内容:
/*
** $Id: dummy.c 7335 2007-08-16 03:38:27Z xgwang $
**
** dummy.c: The dummy IAL engine.
**
** Copyright (C) 2003 ~ 2007 Feynman Software.
** Copyright (C) 2001 ~ 2002 Wei Yongming.
**
** Created by Wei Yongming, 2001/09/13
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "common.h"
#include "tslib.h"
#ifdef _DUMMY_IAL
#include "misc.h"
#include "ial.h"
#include "dummy.h"
static int mouse_x, mouse_y, mouse_button;
static struct tsdev *ts;
typedef struct tagPOS
{
short x;
short y;
short b;
} POS;
#define SCREEN_WIDTH 640
#define SCREEN_HEIGHT 480
/************************ Low Level Input Operations **********************/
/*
* Mouse operations -- Event
*/
static int mouse_update(void)
{
return 1;
}
static void mouse_getxy (int* x, int* y)
{
*x = (mouse_x<0 ? 0 : (mouse_x>=SCREEN_WIDTH ? SCREEN_WIDTH-1 : mouse_x));
*y = (mouse_y<0 ? 0 : (mouse_y>=SCREEN_HEIGHT ? SCREEN_HEIGHT-1 : mouse_y));
/* printf ("mouse_getxy: %d, %d/n", *x, *y); */
}
static int mouse_getbutton(void)
{
/* printf ("mouse_getbutton: %d/n", mouse_button); */
return mouse_button;
}
static int keyboard_update(void)
{
return 0;
}
static const char * keyboard_get_state (void)
{
return NULL;
}
#ifdef _LITE_VERSION
static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *except,
struct timeval *timeout)
#else
static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except,
struct timeval *timeout)
#endif
{
struct ts_sample sample;
int ret = 0;
int fd;
fd_set rfds;
int e;
if (!in) {
in = &rfds;
FD_ZERO (in);
}
fd = ts_fd(ts);
if ((which & IAL_MOUSEEVENT) && fd >= 0) {
FD_SET (fd, in);
#ifdef _LITE_VERSION
if (fd > maxfd) maxfd = fd;
#endif
}
#ifdef _LITE_VERSION
e = select (maxfd + 1, in, out, except, timeout) ;
#else
e = select (FD_SETSIZE, in, out, except, timeout) ;
#endif
if (e > 0) {
// input events is coming
if (fd > 0 && FD_ISSET (fd, in)) {
FD_CLR (fd, in);
mouse_button = 0;
ret = ts_read(ts, &sample, 1);
if (ret < 0) {
perror("ts_read()");
exit(-1);
}
else if(ret > 0) {
mouse_x = sample.x;
mouse_y = sample.y;
mouse_button = (sample.pressure>0 ? IAL_MOUSE_LEFTBUTTON : 0);
ret |= IAL_MOUSEEVENT;
}
}
}
else if (e < 0) {
return -1;
}
return (ret);
}
BOOL InitDummyInput (INPUT* input, const char* mdev, const char* mtype)
{
char *ts_device = NULL;
if ((ts_device = getenv("TSLIB_TSDEVICE")) != NULL) {
// open touch screen event device in blocking mode
ts = ts_open(ts_device, 0);
} else {
#ifdef USE_INPUT_API
ts = ts_open("/dev/input/0raw", 0);
#else
ts = ts_open("/dev/touchscreen/ucb1x00", 0);
#endif
}
if (!ts) {
perror("ts_open()");
exit(-1);
}
if (ts_config(ts)) {
perror("ts_config()");
exit(-1);
}
input->update_mouse = mouse_update;
input->get_mouse_xy = mouse_getxy;
input->set_mouse_xy = NULL;
input->get_mouse_button = mouse_getbutton;
input->set_mouse_range = NULL;
input->update_keyboard = keyboard_update;
input->get_keyboard_state = keyboard_get_state;
input->set_leds = NULL;
input->wait_event = wait_event;
mouse_x = 0;
mouse_y = 0;
mouse_button = 0;
return TRUE;
}
void TermDummyInput (void)
{
if (ts)
ts_close(ts);
}
#endif /* _DUMMY_IAL */
5. 执行下面脚本
make
make install
cd ..
tar zxvf minigui-res-1.6.10.tar.gz
tar zxvf mg-samples-1.6.10.tar.gz
mkdir test
cp ../mg-samples-1.6.10/src/animation.c ./
arm-linux-gcc -I/opt/minigui1.6.10/include -L/opt/minigui1.6.10/lib -O2 -o animation animation.c -lminigui -lmgext -lm -ljpeg -lpng -lpthread
成功编译MiniGUI。现在得到了MiniGUI的lib库和测试程序animation。需要将/opt/minigui1.6.10/lib下面的:
libminigui-1.6.so.10
libminigui-1.6.so.10.0.0
libmgext-1.6.so.10
libmgext-1.6.so.10.0.0
四个库文件拷贝到板子,和arm-linux-gcc的:
libjpeg.so.62
libjpeg.so.62.0.0
libpng.so.3
libpng.so.3.35.0
四个库文件,以及
/opt/minigui1.6.10/etc/MiniGUI.cfg需要拷贝到板子上的/etc/目录下。然后执行:
gedit MiniGUI.cfg &
将:
[system]
# GAL engine and default options
gal_engine=qvfb
defaultmode=800x600-16bpp
# IAL engine
ial_engine=qvfb
mdev=/dev/input/mice
mtype=IMPS2
[fbcon]
defaultmode=1024x768-16bpp
改成:
[system]
# GAL engine and default options
gal_engine=fbcon
defaultmode=640x480-16bpp
# IAL engine
ial_engine=dummy
mdev=/dev/ts
mtype=def
[fbcon]
defaultmode=640x480-16bpp
将所有的:
/usr/local/lib/minigui
替换成:
/opt/minigui1.6.10
最后,执行:
gedit etc/profile &
添加以下内容:
export MINIGUI_ROOT=/opt/minigui1.6.10
export PATH=$MINIGUI_ROOT/bin:$PATH
export LD_LIBRARY_PATH=$MINIGUI_ROOT/lib:$LD_LIBRARY_PATH
至此,搞定MiniGUI,可以在SkyEye中运行测试程序animation了。