mini2440 P43 移植tslib1.16

1 资源申明:ubuntu16.04
开发板用的linux 2.32.2

2之前在网上看别人的移植tslib,自己也试着移植,但是无赖错误太多,因为自己是看韦东山大神的视频学习的,所以用的 他的书里面的linux2.22, 交叉工具gcc3.4的好像。然后移植tslib1.4时错误太多,很多都是未定义的错误。所以当时感觉内核和交叉编译工具太老了。所以重新换回友善提供的资料。
之所以选择tslib1.16,是因为这个版本支持友善之臂的单线通信屏,我的P43就是单线的。

3 获取tslib源码 https://github.com/kergoth/tslib/releases
目前最新的是tslib1.16,支持友善之臂的单线触摸屏
这里写图片描述

4.下面是配置编译tslib,进到tslib目录下面
# cd tslib1.16
# ./autogen.sh
#./configure –host=arm-linux ac_cv_func_malloc_0_nonnull=yes –cache-file=arm-linux.cache –prefix=/usr/local/tslib
这里写图片描述
one-write-ts-input 修改成yes
# make
# make install

注意make时 ts_seup.c会出现xxxx没有定义的错误,这是因为友善的gcc4.4.3工具链比较老了新内核的一些东西并有包含。所以我们将ts_setup.c都删掉,然后将tslib1.4中的ts_setup换过去就行
这里写图片描述

/*
 *  tslib/src/ts_setup.c
 *
 *  Copyright (C) 2017 Piotr Figlarek
 *
 * This file is placed under the LGPL.  Please see the file
 * COPYING for more details.
 *
 *
 * Find, open and configure a touchscreen device.
 */

#include "tslib.h"
#include "tslib-private.h"
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
static const char * const ts_name_default[] = {
        "/dev/input/ts",
        "/dev/input/touchscreen",
        "/dev/input/event0",
        "/dev/touchscreen/ucb1x00",
        NULL
};

struct tsdev *ts_setup(const char *dev_name, int nonblock)
{
    const char * const *defname;
    struct tsdev *ts = NULL;

    dev_name = dev_name ? dev_name : getenv("TSLIB_TSDEVICE");

    if (dev_name!= NULL) {
        ts = ts_open(dev_name, nonblock);
    } else {
        defname = &ts_name_default[0];
        while (*defname != NULL) {
            ts = ts_open(*defname, nonblock);
            if (ts != NULL)
                break;
            else
                ++defname;
        }
    }

    /* if detected try to configure it */
    if (ts && ts_config(ts) != 0) {
        perror("ts_config");
        ts_close(ts);
        return NULL;
    }

    return ts;
}

5.修改配置文件 (开发板上)
vi /usr/local/tslib/etc/ts.conf

# Access plugins
################

# Uncomment if you wish to use the linux input layer event interface
#module_raw input
module_raw one_wire_ts_input
# For other driver modules, see the ts.conf man page


# Filter plugins
################

# Uncomment if first or last samples are unreliable
# module skip nhead=1 ntail=1

# Uncomment if needed for devices that measure pressure
module pthres pmin=1

# Uncomment if needed
# module debounce drop_threshold=40

# Uncomment if needed to filter spikes
# module median depth=5

# Uncomment to enable smoothing of fraction N/D
# module iir N=6 D=10

# Uncomment if needed
# module lowpass factor=0.1 threshold=1

# Uncomment if needed to filter noise samples
module dejitter delta=100

# Uncomment and adjust if you need to invert an axis or both
# module invert x0=800 y0=480

# Uncomment to use ts_calibrate's settings
module linear

6.配置开发板etc/profile文件:

#! /bin/sh
export TSLIB_ROOT=/usr/local/tslib
export TSLIB_TSDEVICE=/dev/touchscreen-1wire
export TSLIB_CONFFILE=/usr/local/tslib/etc/ts.conf
export TSLIB_PLUGINDIR=/usr/local/tslib/lib/ts
export TSLIB_CALIBFILE=/etc/pointeral
export TSLIB_FBDEVICE=/dev/fb0
export TSLIB_CONSOLEDEVICE=none
export QWS_MOUSE_PROTO=tslib:/dev/touchscreen-1wire
export QWS_SIZE=480*272 
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$TSLIB_ROOT/lib

7:把tslib移植到开发板的/usr/local/下面
cp -R tslib /home/hg/mylab/system/fs/first_fs/usr/local/
最后一步进入到/usr/local/tslib/bin下面运行./ts_calibrate,如果出现校准的界面,说明移植成功。

附上在板子上可以运行的tslib文件
https://download.csdn.net/download/qq_39971579/10640406

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值