简体   繁体   English

如何使基于tslib的校准永久保留?

[英]How to make a tslib-based calibration stay permanent?

I'm having problem making a permanent calibration in my embedded solution. 我在嵌入式解决方案中进行永久校准时遇到问题。 I'm developing a Qt-based app for a Embedded Linux environment with touch screen. 我正在为带触摸屏的嵌入式Linux环境开发基于Qt的应用程序。 For this last part, I use tslib (configured by previous developers). 对于最后一部分,我使用tslib (由以前的开发人员配置)。

In what comes to simply calibrate the touch screen, everything is fine: ts_calibrate runs and creates the pointercal file correctly. 在简单地校准触摸屏方面,一切都很好:ts_calibrate运行并正确创建了pointercal文件。 If after calling ts_calibrate I run my Qt app (or ts_test), I can notice that the calibration is successful. 如果在调用ts_calibrate之后运行我的Qt应用程序(或ts_test),我可以注意到校准成功。

The problem is that the calibration results only works for 1 opening of my app: I calibrate with ts_calibrate, run my app, close it and if I run my app again, the screen is one again non-calibrated. 问题在于,校准结果仅适用于1次打开我的应用程序:我使用ts_calibrate进行校准,运行我的应用程序,将其关闭,如果再次运行我的应用程序,则屏幕将再次未校准。

Now obviously I don't want to have to call the calibration each time my app is closed and reopened. 现在显然我不需要每次关闭并重新打开应用程序时都需要调用校准。 The question is: how to make the calibration results become permanent? 问题是: 如何使校准结果永久化? (that is, till another calibration is made) (也就是说,直到再次进行校准为止)


Extra info: 额外信息:

I did some research on the web and I found this SO thread telling about a way to handle this problem using QWSServer . 我在Web上进行了一些研究,发现此SO线程说明了使用QWSServer处理此问题的方法。 At first I disliked this solution since it depends on the Qt framework to do the job (I was expecting a more general, "C++ solution" (or a call to a script, whatever)). 起初,我不喜欢这种解决方案,因为它依靠Qt框架来完成工作(我期望有一个更通用的“ C ++解决方案”(或调用脚本,无论如何))。 But I implemented it and it worked - but only in a specific case, namely, if I calibrate, open my software, close it and reopen it, then the calibration is maintained. 但是我实现了它并使其起作用-但仅在特定情况下,即,如果我进行校准,打开软件,关闭它并重新打开它,则可以保持校准。 But the problem nevertheless persists if I shut down the hardware completely, turn it on and run my app without a call to ts_calibrate (reloading the Linux kernel in the process); 但是,如果我完全关闭硬件,打开硬件并运行我的应用程序而没有调用ts_calibrate(在过程中重新加载Linux内核),问题仍然存在。 so this show to be only a partial solution and, therefore, not acceptable. 因此,这仅是部分解决方案,因此是不可接受的。

Trying to find the source of the problem, I created a copy of the pointercal file just after calibration and another copy of it after shutting down and turning up my hardware (and confirming that the calibration was over) and I noticed that the file was changed in the middle despite no call to the ts_calibrate or similar app was made: 为了找到问题的根源,我在校准后pointercal创建了一个pointercal文件的副本,并在关闭并打开了硬件(并确认校准已结束)之后创建了该文件的另一个副本,并注意到该文件已更改在中间,尽管没有调用ts_calibrate或类似应用程序:

After calibration: 55438 118 -1920736 -543 -36058 34531168 65536 800 480 校准后:55438 118 -1920736 -543 -36058 34531168 65536 800480

After hardware shutdown: -55040 1280 2526720 -288 35040 -34398240 -62768 硬件关闭后:-55040 1280 2526720 -288 35040 -34398240 -62768

The terminal log for the linux boot ( tftp; bootm command) don't mention pointercal or a relevant calibration process. linux引导的终端日志( tftp; bootm命令)没有提到pointercal校准或相关的校准过程。

Edit 编辑

I recently learned that the pointercal file located inside /etc/ is changing between sections because that entire folder is made new when the hardware is restarted. 我最近了解到/etc/内的pointercal文件在各节之间更改,因为重新启动硬件后整个文件夹都变成了新的。 So what is essentially happening is that Tslib is going after a file that is constantly reset to default each time the hardware is restarted, and what I need to do is to configure Tslib not to look there, but to a more secure folder (in my case, the SD Card). 因此,实际上发生的是,Tslib会跟踪每次重启硬件时都会不断重置为默认值的文件,而我需要做的就是将Tslib配置为不在该目录中,而是配置为一个更安全的文件夹(在我的情况下,SD卡)。 The new question now is: how to do that? 现在的新问题是:该怎么做? I know I have to configure the tslib.sh file making the TSLIB_CALIBFILE variable point to the new location of pointerscal , but tslib.sh is itself inside /etc/ , being itself temporary. 我知道我必须配置tslib.sh文件使得TSLIB_CALIBFILE变量指向的新位置pointerscal ,但tslib.sh是自身内部/etc/ ,存在本身暂时的。

You have to change TSLIB_CALIBFILE in the image loaded via tftp. 您必须更改通过tftp加载的映像中的TSLIB_CALIBFILE

That should do it, since you just have to change that once. 应该这样做,因为您只需更改一次即可。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM