Phytec中国的wiki
support@phytec.cn
热线:0755-61802110-803
适用平台:IMX6UL, IMX6, AM335X
PHYTEC开发板上默认镜像上带的qtdemo是phytec-qtdemo,
这个demo中的systemd服务文件是/lib/systemd/system/phytec-qtdemo.service
/lib/systemd/system/phytec-qtdemo.service
[Unit] Description=Autostart Qt 5 Demo Wants=systemd-udev-settle.service After=systemd-udev-settle.service [Service] Type=simple User=root ExecStart=/usr/bin/qtLauncher /usr/bin/QtDemo # Detach the framebuffer console from fb0 before starting the QtDemo and # reattach it after QtDemo has stopped. # See <linux>/Documentation/fb/fbcon.txt for details. # NOTE: The dash "-" allows the commands to fail, e.g. if no virtual console # was started. # FIXME Is there a better command without shell invocation? ExecStartPre=-/bin/sh -c "echo 0 > /sys/devices/virtual/vtconsole/vtcon1/bind" ExecStopPost=-/bin/sh -c "echo 1 > /sys/devices/virtual/vtconsole/vtcon1/bind; echo -n -e '\033[9;0]' > /dev/tty0" [Install] WantedBy=multi-user.target
从service文件可以看出QtDemo是通过qtLauncher文件打开的,
/usb/bin/qtLauncher
#!/bin/sh # use interactive shell environment for machine specific env vars . /etc/profile if [ -e /dev/input/res-touchscreen ] && [ -e /dev/input/touchscreen0 ]; then if [ ! -e /etc/pointercal ]; then #res. touchscreen is not calibrate. We should do this first /usr/bin/ts_calibrate fi #forbid libinput when using resistive touchscreens export QT_QPA_EGLFS_NO_LIBINPUT=1 #enable tslib export QT_QPA_EGLFS_TSLIB=1 export QT_QPA_FB_TSLIB=1 export TSLIB_TSDEVICE="/dev/input/touchscreen0" fi # disable qt's audiosink if no audio present ls -1 /dev/snd/pcm* > /dev/null 2>&1 if [ "$?" != "0" ]; then export QT_GSTREAMER_PLAYBIN_AUDIOSINK=fakesink fi export QT_QPA_PLATFORM=eglfs export QT_QPA_EGLFS_KMS_CONFIG=/etc/eglfs_kms.config # Common Debug Settings #export QT_DEBUG_PLUGINS=1 #export QT_LOGGING_RULES=qt.qpa.*=true if [ $# -eq 0 ]; then echo 'usage: qtLauncher <your_qt_application>' else $@ #run the application fi
从qtLauncher的内容上看, 是导入了一些qt的环境变量.
如果使用其他的qt程序, 可以通过qtLauncher来打开qt程序, 就不用另外导入qt环境了.
qtLauncher <your_qt_application>
如果qt的PLATFORM是使用linuxfb的情况下, 使用电阻触摸屏的情况下, 还需要增加以下环境变量才会调用tslib接口:
export QT_QPA_FB_NO_LIBINPUT=1
Overview
Content Tools
Activity
Tasks