Running VNC Server on Embedded Linux
Ravikiran V N
I want to run VNC Server session on embedded Linux so that other display systems such as Desktop PCs within network to connect to it as VNC Client. I am using Qt 5.5.1 on my target and want to publish my HMI on multiple displays using VNC protocol. I know there is/was some option available on Qt 4.x based QWS applications. Is the same can be used to QPA based apps or not? is it we have to do something different? if any body has done the same thing, please give some inputs on the same.
Hi @Ravikiran-V-N ,
Maybe i can "help" you on this.
As you said there was a vnc plugin in the previous version of Qt (4.X). And you were able to call your application like this:
./myCuteQt4XApp -display VNC:size=500x400
With the version 5.5.x opr 5.6.x, up to now , there is no such support of VNC, unfortunately (i don't know why, but i'm sure there is a good reason).
But the "good news" is that you can have a VNC server on your embedded device and remotely access to your application. I'm using x11vnc, which is an application that you can have on your embedded device. I'm using Buildroot to build my filesystem, it's easy to add this application directly on the rootfs (make sure to have all the required libraries to have x11vnc enabled). I don't know if on Yocto it's the same because i've never used Yocto.
So once you have x11vnc on your target serious things can start. You If you are able to run your application on your target, it means that you know all the things related to plugin, libraries and other stuff so i'm doing to bother you with this.
So once x11vnc is installed, you can use it like this:
1) Start your Qt5 application:
./myCuteQt551App -platform linuxfb -geometry WxH &
Where W and H are respectively the Width and the Height of your graphical view (in integer, for instance 240x320).
2) Start your x11vnc server
x11vnc -noipv6 -rawfb /dev/fb0 -clip WxH+0+0
You should see the x11vnc printing some information about the port number (which should be 5900). I'm using the default framebuffer (/dev/fb0) because, i specify when launching the application linuxfb which point directly to the default framebuffer device whose the node is /dev/fb0.
If there is no errors, it means everything is Ok!
3) Start your VNC Client
You can start your VNC client to connect to your embedded device on the port specified by x11vnc (which should be 5900 by default). After that you should see your cute Qt5.5.1 application (Yeah!!).
4) ... BUTs
As you will see, things are not perfect, because in my case for instance i'm not able to make the mouse working;
and i think you will probably have the same issue (if not let me know ;) ).
I was able to make mouse working, but i must connect my mouse directly to my embedded device and launch my Qt5.x app with some options (-evdevmouse:/dev/input/event0), which is not the best practice. So up to now, i'm stuck at this point, but if i find something useful i will post something on this forum.
5) More about Qt5.x
There is many options to use when you call your Qt5.x option, -evdevmouse, -evdevkeyboard etc.
Don't forget to use these options during your work ;) .
6) Support of VNC on Qt5.x
Finally, i've asked to an official member of Qt about the support of VNC on the versions 5.x. And unfortunately she answer me that, after having a discussion with some "official" technical guys working on Qt, the answer was unfortunately NO .. at least up to now.
Ravikiran V N
Hi @bignumb ,
Thanks for the details and interest to reply to my query.
I am using Yocto , so will check the possibilities and revert to you if I face any issues.
Thanks a lot! You saved my day!
@bignumb Hi, I'm sorry for reply this old topic, but I followed the steps you described to configure x11vnc and my Qt app to work together, and when I tried to connect to my VNC Server with a client, the image appeared distorted. Look the image bellow.
My app is built with Qt 5.7.0 and is running on a Raspberry pi 3, without GUI.
Do you have some idea of how can I resolve this issue?
Hi just guessing but it looks like there is a WxH (width and height) mismatch somewhere in the settings on the Raspberry.
@hskoglund Hi, thank's for your answer, but I think this is not the problem.
I tried to put WxH fixed in x11vnc and in my app settings, persisting on the same problem.
If you have some other idea, please let me know! :)
My problem was solved.