XELK-AN-005: Qt5 application remoted using VNC server

From DAVE Developer's Wiki
Jump to: navigation, search
Info Box
Axel-lite 02.png Applies to Axel Lite

History

Version Date Notes
1.0.0 Apr 2018 First release

Introduction

This application note describes how to display remotely the local Qt5 application using standard connectivity application like VNC.

The SBCX platform and the AxelLite module is used as Embedded Platform running a Qt 5.6.2 example and displaying it remotely on a PC and a TV.

VNC

Starting from original Yocto based root file system provided here, more packages need to be added for using the well known VNC remote desktop (screen sharing) application.

We assume that network interface has been already configured for Internet access. In any case, simple configuration can be done directly on serial console with the following commands:

root@axellite:~# ifconfig eth0 192.168.0.94
root@axellite:~# route add default gw 192.168.0.254
root@axellite:~# echo "nameserver 8.8.8.8" > /etc/resolv.conf

where 192.168.0.254 is the gateway address and 8.8.8.8 is the DNS server (in this case Google's one).

It is possibile to install the VNC server using the smart package manager on DAVE's XELK kit Yocto distribution:

Firts of all, SMART channels must be added for accessing DAVE's server for Yocto pre-built packages, and the smart database has to be updated using the following commands:

root@sbc-lynx:~# smart channel --add cortexa9hf_neon type=rpm-md baseurl=http://yocto.dave.eu/xelk-latest/cortexa9hf_neon
Alias: cortexa9hf_neon
Type: rpm-md
Base URL: http://yocto.dave.eu/xelk-latest/cortexa9hf_neon

Include this channel? (y/N): y

root@axellite:~# smart update
Updating cache...                               ################################################################## [100%]

Fetching information for 'cortexa9hf_neon'...
-> http://yocto.dave.eu/xelk-latest/cortexa9hf_neon/repodata/repomd.xml
repomd.xml                                      ################################################################## [ 50%]
-> http://yocto.dave.eu/xelk-latest/cortexa9hf_neon/repodata/filelists.xml.gz
-> http://yocto.dave.eu/xelk-latest/cortexa9hf_neon/repodata/primary.xml.gz
filelists.xml.gz                                ################################################################## [ 75%]
primary.xml.gz                                  ################################################################## [100%]

Updating cache...                               ################################################################## [100%]

Channels have 17503 new packages.
Saving cache...

root@axellite:~# 

Then, once the smart database has been updated, it is possible to use the install option for smart:

root@axellite:~# smart install x11vnc
Loading cache...
Updating cache...                               ################################################################## [100%]

Computing transaction...

Installing packages (23):
  libatk-1.0-0-2.18.0-r0@cortexa9hf_neon                      libxcomposite1-1:0.4.4-r0@cortexa9hf_neon
  libgdk-pixbuf-2.0-loader-gif-2.32.3-r0@cortexa9hf_neon      libxcursor1-1:1.1.14-r0@cortexa9hf_neon
  libgdk-pixbuf-2.0-loader-jpeg-2.32.3-r0@cortexa9hf_neon     libxdamage1-1:1.1.4-r0@cortexa9hf_neon
  libgdk-pixbuf-2.0-loader-png-2.32.3-r0@cortexa9hf_neon      libxdmcp6-1:1.1.2-r0@cortexa9hf_neon
  libgdk-pixbuf-2.0-loader-xpm-2.32.3-r0@cortexa9hf_neon      libxext6-1:1.3.3-r0@cortexa9hf_neon
  libgtk-2.0-2.24.29-r0@cortexa9hf_neon                       libxfixes3-1:5.0.1-r0@cortexa9hf_neon
  libvncserver-0.9.10-r0@cortexa9hf_neon                      libxi6-1:1.7.6-r0@cortexa9hf_neon
  libx11-6-1:1.6.3-r0@cortexa9hf_neon                         libxrandr2-1:1.5.0-r0@cortexa9hf_neon
  libxau6-1:1.0.8-r0@cortexa9hf_neon                          libxrender1-1:0.9.9-r0@cortexa9hf_neon
  libxcb-render0-1.11.1-r0@cortexa9hf_neon                    libxtst6-1:1.2.2-r0@cortexa9hf_neon
  libxcb-shm0-1.11.1-r0@cortexa9hf_neon                       x11vnc-0.9.13-r0@cortexa9hf_neon
  libxcb1-1.11.1-r0@cortexa9hf_neon

4.5MB of package files are needed. 9.5MB will be used.

Confirm changes? (Y/n): Y

Fetching packages...
-> http://yocto.dave.eu/xelk-latest/cortexa9hf_neon/libxext6-1.3.3-r0.cortexa9hf_neon.rpm
-> http://yocto.dave.eu/xelk-latest/cortexa9hf_neon/libgdk-pixbuf-2.0-loader-png-2.32.3-r0.cortexa9hf_neon.rpm
libgdk-pixbuf-2.0-loader-png-2.32.3-r0.cortex.. ################################################################## [  4%]
-> http://yocto.dave.eu/xelk-latest/cortexa9hf_neon/libxtst6-1.2.2-r0.cortexa9hf_neon.rpm
libxtst6-1.2.2-r0.cortexa9hf_neon.rpm           ################################################################## [  8%]
libxext6-1.3.3-r0.cortexa9hf_neon.rpm           ################################################################## [ 13%]
-> http://yocto.dave.eu/xelk-latest/cortexa9hf_neon/libxcb-render0-1.11.1-r0.cortexa9hf_neon.rpm
-> http://yocto.dave.eu/xelk-latest/cortexa9hf_neon/libxrandr2-1.5.0-r0.cortexa9hf_neon.rpm
libxrandr2-1.5.0-r0.cortexa9hf_neon.rpm         ################################################################## [ 17%]
-> http://yocto.dave.eu/xelk-latest/cortexa9hf_neon/libvncserver-0.9.10-r0.cortexa9hf_neon.rpm
libvncserver-0.9.10-r0.cortexa9hf_neon.rpm      ################################################################## [ 21%]
-> http://yocto.dave.eu/xelk-latest/cortexa9hf_neon/libxau6-1.0.8-r0.cortexa9hf_neon.rpm
libxau6-1.0.8-r0.cortexa9hf_neon.rpm            ################################################################## [ 26%]
-> http://yocto.dave.eu/xelk-latest/cortexa9hf_neon/libxi6-1.7.6-r0.cortexa9hf_neon.rpm
libxi6-1.7.6-r0.cortexa9hf_neon.rpm             ################################################################## [ 30%]
libxcb-render0-1.11.1-r0.cortexa9hf_neon.rpm    ################################################################## [ 34%]
-> http://yocto.dave.eu/xelk-latest/cortexa9hf_neon/libxcursor1-1.1.14-r0.cortexa9hf_neon.rpm
-> http://yocto.dave.eu/xelk-latest/cortexa9hf_neon/libxcb1-1.11.1-r0.cortexa9hf_neon.rpm
libxcb1-1.11.1-r0.cortexa9hf_neon.rpm           ################################################################## [ 39%]
-> http://yocto.dave.eu/xelk-latest/cortexa9hf_neon/libatk-1.0-0-2.18.0-r0.cortexa9hf_neon.rpm
libatk-1.0-0-2.18.0-r0.cortexa9hf_neon.rpm      ################################################################## [ 43%]
libxcursor1-1.1.14-r0.cortexa9hf_neon.rpm       ################################################################## [ 47%]
-> http://yocto.dave.eu/xelk-latest/cortexa9hf_neon/x11vnc-0.9.13-r0.cortexa9hf_neon.rpm
-> http://yocto.dave.eu/xelk-latest/cortexa9hf_neon/libgdk-pixbuf-2.0-loader-jpeg-2.32.3-r0.cortexa9hf_neon.rpm
libgdk-pixbuf-2.0-loader-jpeg-2.32.3-r0.corte.. ################################################################## [ 52%]
-> http://yocto.dave.eu/xelk-latest/cortexa9hf_neon/libxcb-shm0-1.11.1-r0.cortexa9hf_neon.rpm
libxcb-shm0-1.11.1-r0.cortexa9hf_neon.rpm       ################################################################## [ 56%]
-> http://yocto.dave.eu/xelk-latest/cortexa9hf_neon/libxdamage1-1.1.4-r0.cortexa9hf_neon.rpm
libxdamage1-1.1.4-r0.cortexa9hf_neon.rpm        ################################################################## [ 60%]
-> http://yocto.dave.eu/xelk-latest/cortexa9hf_neon/libxrender1-0.9.9-r0.cortexa9hf_neon.rpm
libxrender1-0.9.9-r0.cortexa9hf_neon.rpm        ################################################################## [ 65%]
-> http://yocto.dave.eu/xelk-latest/cortexa9hf_neon/libgdk-pixbuf-2.0-loader-gif-2.32.3-r0.cortexa9hf_neon.rpm
libgdk-pixbuf-2.0-loader-gif-2.32.3-r0.cortex.. ################################################################## [ 69%]
-> http://yocto.dave.eu/xelk-latest/cortexa9hf_neon/libx11-6-1.6.3-r0.cortexa9hf_neon.rpm
libx11-6-1.6.3-r0.cortexa9hf_neon.rpm           ################################################################## [ 73%]
x11vnc-0.9.13-r0.cortexa9hf_neon.rpm            ################################################################## [ 78%]
-> http://yocto.dave.eu/xelk-latest/cortexa9hf_neon/libxdmcp6-1.1.2-r0.cortexa9hf_neon.rpm
libxdmcp6-1.1.2-r0.cortexa9hf_neon.rpm          ################################################################## [ 82%]
-> http://yocto.dave.eu/xelk-latest/cortexa9hf_neon/libgdk-pixbuf-2.0-loader-xpm-2.32.3-r0.cortexa9hf_neon.rpm
-> http://yocto.dave.eu/xelk-latest/cortexa9hf_neon/libxcomposite1-0.4.4-r0.cortexa9hf_neon.rpm
libxcomposite1-0.4.4-r0.cortexa9hf_neon.rpm     ################################################################## [ 86%]
-> http://yocto.dave.eu/xelk-latest/cortexa9hf_neon/libxfixes3-5.0.1-r0.cortexa9hf_neon.rpm
libxfixes3-5.0.1-r0.cortexa9hf_neon.rpm         ################################################################## [ 91%]
libgdk-pixbuf-2.0-loader-xpm-2.32.3-r0.cortex.. ################################################################## [ 95%]
-> http://yocto.dave.eu/xelk-latest/cortexa9hf_neon/libgtk-2.0-2.24.29-r0.cortexa9hf_neon.rpm
libgtk-2.0-2.24.29-r0.cortexa9hf_neon.rpm       ################################################################## [100%]


Committing transaction...
Preparing...                                    ################################################################## [  0%]
   1:Installing libxau6                         ################################################################## [  4%]
   2:Installing libgdk-pixbuf-2.0-loader-gif    ################################################################## [  8%]
   3:Installing libgdk-pixbuf-2.0-loader-jpeg   ################################################################## [ 13%]
   4:Installing libgdk-pixbuf-2.0-loader-xpm    ################################################################## [ 17%]
   5:Installing libgdk-pixbuf-2.0-loader-png    ################################################################## [ 21%]
   6:Installing libxdmcp6                       ################################################################## [ 26%]
   7:Installing libatk-1.0-0                    ################################################################## [ 30%]
   8:Installing libxcb1                         ################################################################## [ 34%]
   9:Installing libxcb-shm0                     ################################################################## [ 39%]
  10:Installing libxcb-render0                  ################################################################## [ 43%]
  11:Installing libx11-6                        ################################################################## [ 47%]
  12:Installing libxfixes3                      ################################################################## [ 52%]
  13:Installing libxcomposite1                  ################################################################## [ 56%]
  14:Installing libxext6                        ################################################################## [ 60%]
  15:Installing libxrender1                     ################################################################## [ 65%]
  16:Installing libxdamage1                     ################################################################## [ 69%]
  17:Installing libxi6                          ################################################################## [ 73%]
  18:Installing libxcursor1                     ################################################################## [ 78%]
  19:Installing libxrandr2                      ################################################################## [ 82%]
  20:Installing libxtst6                        ################################################################## [ 86%]
  21:Installing libgtk-2.0                      ################################################################## [ 91%]
Output from libgtk-2.0-2.24.29-r0@cortexa9hf_neon:
update-alternatives: Linking /usr/bin/gtk-update-icon-cache to /usr/bin/gtk-update-icon-cache-2.0
  22:Installing libvncserver                    ################################################################## [ 95%]
  23:Installing x11vnc                          ################################################################## [100%]


root@axellite:~#

server command line

The command line used is the following one:

x11vnc -noipv6 -rawfb /dev/fb0 -clip WxH

where the W and H parameters are the width and height size of the screen to be remoted.

Test bed

  • lcd panel is 800x480
root@axellite:~# x11vnc -noipv6 -rawfb /dev/fb0 -passwd qt5remote

14/02/2018 09:50:43 passing arg to libvncserver: -passwd
14/02/2018 09:50:43 x11vnc version: 0.9.13 lastmod: 2011-08-10  pid: 367
14/02/2018 09:50:43 Not opening DISPLAY in -rawfb mode (force via -rawfb +str)
14/02/2018 09:50:43 Continuing without X display in -rawfb mode.
14/02/2018 09:50:43 console_guess: file is /dev/fb0
14/02/2018 09:50:43 console_guess: file pipeinput CONSOLE0
14/02/2018 09:50:43 pipeinput: using linux console: /dev/tty0
14/02/2018 09:50:43 console_guess returned: map:/dev/fb0@800x480x16:f800/7e0/1f
14/02/2018 09:50:43 raw fb is non-regular file: /dev/fb0
14/02/2018 09:50:43 rawfb: mmap file: /dev/fb0
14/02/2018 09:50:43    w: 800 h: 480 b: 16 addr: 0x763df000 sz: 768000
14/02/2018 09:50:43 pipeinput: using linux console: /dev/tty0
14/02/2018 09:50:43 initialize_screen: fb_depth/fb_bpp/fb_Bpl 16/16/1600
14/02/2018 09:50:43
14/02/2018 09:50:43 Raw fb at addr 0x763df000 is 16bpp depth=16 true color
14/02/2018 09:50:43
14/02/2018 09:50:43 Autoprobing TCP port
14/02/2018 09:50:43 Autoprobing selected TCP port 5900
14/02/2018 09:50:43 Autoprobing TCP6 port
14/02/2018 09:50:43 Autoprobing selected TCP6 port 5900
14/02/2018 09:50:43 Not listening on IPv6 interface.
14/02/2018 09:50:44 fb read rate: 79 MB/sec
14/02/2018 09:50:44 screen setup finished.
14/02/2018 09:50:44

The VNC desktop is:      axellite:0
PORT=5900

Connection

On a Windows PC, it is possible to start the VNC viewer, like UltraVNC Viewer, and selecting the SBCX board's IP address:

UltraVNC Viewer running on Windows PC

On the target, the VNC server shows the remote connection is accepted:

14/02/2018 09:51:29 Got connection from client 192.168.0.21
14/02/2018 09:51:29   other clients:
14/02/2018 09:51:29 Normal socket connection
14/02/2018 09:51:29 incr accepted_client=1 for 192.168.0.21:62093  sock=9
14/02/2018 09:51:29 Client Protocol Version 3.8
14/02/2018 09:51:29 Protocol version sent 3.8, using 3.8
14/02/2018 09:51:29 rfbProcessClientSecurityType: executing handler for type 2
14/02/2018 09:51:33 client useCopyRect: 192.168.0.21 0
14/02/2018 09:51:33 client_set_net: 192.168.0.21  0.0310
14/02/2018 09:51:33 Pixel format for client 192.168.0.21:
14/02/2018 09:51:33   16 bpp, depth 16, little endian
14/02/2018 09:51:33   true colour: max r 31 g 63 b 31, shift r 11 g 5 b 0
14/02/2018 09:51:33 no translation needed
14/02/2018 09:51:33 rfbProcessClientNormalMessage: ignoring unsupported encoding type Enc(0x0000000A)
14/02/2018 09:51:33 rfbProcessClientNormalMessage: ignoring unsupported encoding type zlibhex
14/02/2018 09:51:33 Using compression level 6 for client 192.168.0.21
14/02/2018 09:51:33 Enabling full-color cursor updates for client 192.168.0.21
14/02/2018 09:51:33 Enabling cursor position updates for client 192.168.0.21
14/02/2018 09:51:33 Using image quality level 6 for client 192.168.0.21
14/02/2018 09:51:33 Using JPEG subsampling 0, Q79 for client 192.168.0.21
14/02/2018 09:51:33 rfbProcessClientNormalMessage: ignoring unsupported encoding type xorEnable
14/02/2018 09:51:33 Enabling LastRect protocol extension for client 192.168.0.21
14/02/2018 09:51:33 Enabling NewFBSize protocol extension for client 192.168.0.21
14/02/2018 09:51:33 rfbProcessClientNormalMessage: ignoring unsupported encoding type cacheEnable
14/02/2018 09:51:33 rfbProcessClientNormalMessage: ignoring unsupported encoding type Enc(0xFFFF8000)
14/02/2018 09:51:33 rfbProcessClientNormalMessage: ignoring unsupported encoding type Enc(0xFFFF8001)
14/02/2018 09:51:33 rfbProcessClientNormalMessage: ignoring unsupported encoding type Enc(0xFFFF8002)
14/02/2018 09:51:33 rfbProcessClientNormalMessage: ignoring unsupported encoding type Enc(0xFFFF8003)
14/02/2018 09:51:33 rfbProcessClientNormalMessage: ignoring unsupported encoding type Enc(0xC0A1E5CE)
14/02/2018 09:51:33 Using ZRLE encoding for client 192.168.0.21
14/02/2018 09:51:34 Pixel format for client 192.168.0.21:
14/02/2018 09:51:34   16 bpp, depth 16, little endian
14/02/2018 09:51:34   true colour: max r 31 g 63 b 31, shift r 11 g 5 b 0
14/02/2018 09:51:34 no translation needed
14/02/2018 09:51:34 rfbProcessClientNormalMessage: ignoring unsupported encoding type Enc(0x0000000A)
14/02/2018 09:51:34 rfbProcessClientNormalMessage: ignoring unsupported encoding type zlibhex
14/02/2018 09:51:34 Using compression level 6 for client 192.168.0.21
14/02/2018 09:51:34 Enabling full-color cursor updates for client 192.168.0.21
14/02/2018 09:51:34 Enabling cursor position updates for client 192.168.0.21
14/02/2018 09:51:34 Using image quality level 6 for client 192.168.0.21
14/02/2018 09:51:34 Using JPEG subsampling 0, Q79 for client 192.168.0.21
14/02/2018 09:51:34 rfbProcessClientNormalMessage: ignoring unsupported encoding type xorEnable
14/02/2018 09:51:34 Enabling LastRect protocol extension for client 192.168.0.21
14/02/2018 09:51:34 Enabling NewFBSize protocol extension for client 192.168.0.21
14/02/2018 09:51:34 rfbProcessClientNormalMessage: ignoring unsupported encoding type Enc(0xFFFF8000)
14/02/2018 09:51:34 rfbProcessClientNormalMessage: ignoring unsupported encoding type Enc(0xFFFF8001)
14/02/2018 09:51:34 rfbProcessClientNormalMessage: ignoring unsupported encoding type Enc(0xFFFF8002)
14/02/2018 09:51:34 rfbProcessClientNormalMessage: ignoring unsupported encoding type Enc(0xFFFF8003)
14/02/2018 09:51:34 rfbProcessClientNormalMessage: ignoring unsupported encoding type Enc(0xC0A1E5CE)
14/02/2018 09:51:34 Switching from ZRLE to hextile Encoding for client 192.168.0.21
14/02/2018 09:51:34 client 1 network rate 196.5 KB/sec (6073.7 eff KB/sec)
14/02/2018 09:51:34 client 1 latency:  1.5 ms
14/02/2018 09:51:34 dt1: 0.0669, dt2: 0.0605 dt3: 0.0015 bytes: 24866
14/02/2018 09:51:34 link_rate: LR_UNKNOWN - 1 ms, 196 KB/s

Demo on youtube

Qt5 application with VNC server running on i.MX6