嵌入式linux实现vnc功能

2019-07-12 15:12发布

现在有一个想法准备在嵌入式设备和pc之间通过网络实现一种类似远程桌面的功能,在pc端可以看到嵌入式设备显示的内容,并且可以使用鼠标和键盘操作嵌入式设备的程序。查看了网络上的一些资料后,准备使用vnc功能来实现,在嵌入式设备端启动vncserver,在pc端启动vncclient,建立连接后能实现需要的功能。准备尝试的方法有两种:一种是在编译Qt时加入vnc的支持。参考的资料是http://doc.qt.io/archives/qt-4.8/qt-embedded-vnc.htmlhttp://www.friendlyarm.net/forum/topic/5029
http://bbs.csdn.net/topics/380149017
具体做法是编译Qt时加入编译选项-qt-gfx-vnc-plugin-gfx-vnc-qt-gfx-linuxfb-plugin-gfx-linuxfb
编译完成后把生成的libqgfxvnc.so和libqscreenlinuxfb.so拷贝到开发板 qt路径/plugins/gfxdrivers/然后在嵌入式设备启动应用程序 ./myapp -qws -display VNC:0这时出现了VNC: driver not found Aborted最后这个问题没有解决掉,放弃了这个方法。第二种方法是使用x11vnc。参考的资料是https://forum.qt.io/topic/66162/running-vnc-server-on-embedded-linux/2
http://blog.csdn.net/xiaolangyangyang/article/details/52950690
具体做法是1.先下载x11vnc源码地址在http://www.karlrunge.com/x11vnc/#downloading2.编译源码:
# tar -xjvf x11vnc-0.9.13.tar.gz# cd x11vnc-0.9.13# CC=arm-fsl-linux-gnueabi-gcc CFLAGS=-O2 ./configure --host=arm-linux --without-x --prefix=./_INSTALL/# make# make install
3.拷贝生成的x11vnc到设备上。4.启动x11vnc。/app/x11vnc-noipv6 -rawfb /dev/fb0 -pipeinput UINPUT:touch,tslib_cal=/etc/pointercal,direct_abs=/dev/input/event2,nouinput,dragskip=4 -clip 640x480+0+0
其中校准文件tslib_cal和触摸屏设备direct_abs的路径要换成自己设备中的路径。5.在pc端通过vnc客户端工具如vncviewer连接设备,这时就能看到设备显示的内容了,而且可以通过鼠标操作设备了。