嵌入式爱好者

5718关于桌面、QT应用和HDMI做主显的问题总结

2021-6-22 10:02| 发布者: ljb2019001| 查看: 820| 评论: 0

类目: 知识库  >  AM5718系列产品     文档编号: 512

1.桌面显示到HDMI
vi arch/arm/boot/dts/ok5718-idk.dts
修改:
aliases {
display0 = &lcd0;
display1 = &hdmi0;
sound0 = &sound0;
sound1 = &hdmi;
rtc0 = &rtc1;
};
改为:
aliases {
display0 = &hdmi0;
display1 = &lcd0;
sound0 = &sound0;
sound1 = &hdmi;
rtc0 = &rtc1;
};
2.桌面显示到HDMI并支持热插拔
vi drivers/gpu/drm/omapdrm/displays/encoder-tpd12s015.c
static irqreturn_t tpd_hpd_isr(int irq, void *data)
  if (tpd_detect(&ddata->dssdev))
  status = connector_status_connected;
  else
- status = connector_status_disconnected;
+ status = connector_status_connected;
 
  ddata->hpd_cb(ddata->hpd_cb_data, status);
  }
  mutex_unlock(&ddata->hpd_lock);
  return IRQ_HANDLED;
 }
另外,由于Matrix 界面依赖 weston 显示服务器,因此运行 Matrix 界面之前,请确保 weston显示服务器已经运行。
如果不插入HDMI启动,weston 初始化完成后,就一直找不到HDMI,所以需要写一个脚本检测插入事件,并重新启动weston服务
1)添加脚本
vi hdmi.sh
#!/bin/sh
while [ 1 ] //利用循环检查HDMI是否插入
do
output=$(cat /var/log/weston.log | grep HDMI-A-1) //查找HDMI是否插入
if [ "$output" == "" ] //如果没插入则为空
then
        sleep 1 //设置每1s检测一次
else
//Matrix 界面依赖 weston 显示服务器,因此运行 Matrix 界面之前,请确保 westo显示服务器已经运行。
        /etc/init.d/weston restart
        sleep 1
        /etc/init.d/matrix-gui-2.0 start //启动界面
        str=`ps aux | grep "hdmi.sh" | grep -v grep | awk '{print $2}'` //获取自己的进程号
        kill $str //由于只需要启动一次,重启完成后,把自己杀掉
fi
done
保存退出

2)添加到开机自启动
cd /lib/systemd/system
vi hdmi.service
[Unit]
Description=helloworld
After=basic.service X.service thermal-zone-init.service
[Service]
Type=forking
ExecStart=/home/root/hdmi.sh    //该行根据自己脚本的实际路径和名称填写
[Install]
WantedBy=multi-user.target
保存退出
3)启动自启动服务 : systemctl -f enable /lib/systemd/system/hdmi.service

3.将qt程序添加到桌面
相关文件:参考对应路径下的其他程序,添加自己的程序即可

.Desktop文件:         /usr/share/matrix-gui-2.0/apps/

应用程序的图标: /usr/share/matrix-gui-2.0/apps/images/forlinx/

应用程序路径: /home/forlinx/qt/

总的配置文件: /usr/share/matrix-gui-2.0/json.txt 


4.开机不显示桌面,直接启动自己的qt程序

vi  /etc/init.d/matrix-gui-2.0

修改为如下内容

红色字体为添加内容,即启动指令,此例是启动/home/forlinx/qt/下的keypad

紫色字体需要注释掉如下

即可完成自启

#! /bin/sh

 

matrixgui="/home/forlinx/qt/matrix_browser"

GUI_OPTS="http://127.0.0.1:80/ """

PIDFILE="/var/run/matrix-gui-2.0.pid"

 

# Important System Environment Variables

for sh in /etc/profile.d/*.sh ; do

    [ -r "$sh" ] && . "$sh"

done

/home/forlinx/qt/keypad

 

#itest -x "$matrixgui" || exit 0

 

#case "$1" in

#  start)

 

 

    #Clear out the the tmp and lock directory

#    cd /usr/share/matrix-gui-2.0

#   rm -rf tmp/*

#    rm -rf lock/*

#    cd -

 

#       if [ -e $PIDFILE ]; then

#      PIDDIR=/proc/$(cat $PIDFILE)

#      if [ -d ${PIDDIR} -a  "$(readlink -f ${PIDDIR}/exe)" = "${matrixgui}" ]; then

#        echo "$DESC already started; not starting."

#      else

#        echo "Removing stale PID file $PIDFILE."

#        rm -f $PIDFILE

#      fi

#    fi

 

#    echo -n "Starting Matrix GUI application"

#    start-stop-daemon --start --quiet --background -m --pidfile $PIDFILE --exec $matrixgui -- $GUI_OPTS

#    echo "."

#   ;;

 

#  stop)

#    echo -n "Stopping Matrix GUI application"

#    start-stop-daemon --stop --quiet --pidfile $PIDFILE

#    echo "."

#    ;;

#  *)

#    echo "Usage: /etc/init.d/matrix-gui-2.0 {start|stop}"

#    exit 1

esac

 

exit 0


已解决

未解决

只是看看

最新评论

QQ|小黑屋| 飞凌嵌入式 ( 冀ICP备12004394号-1 )

GMT+8, 2024-4-26 01:07

Powered by Discuz! X3.4

© 2001-2013 Comsenz Inc.

返回顶部