FriendlyDesktop 18.04 for RK3399

From FriendlyELEC WiKi
Jump to: navigation, search

查看中文

1 Introduction

Friendlydesktop-home.png

Arduino
Firefox
Scratch

FriendlyDesktop is a light-weighted Ubuntu desktop system. It is based on LXDE and has the following features:
    Latest Version - Based on Ubuntu 18.04 64
    Various Development Utilities - It is compatible with FriendlyCore and has integrated an optimized Qt5.10, QtCreator and Arduino IDE.
    Light-weighted - it consumes relatively less CPU resources than a common desktop system. When a system's RAM is sufficient it can achieve much better performance.
    Less Power Consumption - it consumes relatively less power or resources than a common desktop system to achieve the same performance.
    Compact and Neat - its desktop is based on GTK+ 2 and it supports multiple languages.
    Easy to Use - its GUI looks similar to MS Windows'.
    Customizable - Users can customize LXDE's GUI.
    Compatible - it is compatible with freedesktop.org.
FriendlyELEC has optimized support for Mali GPU and VPU in FriendlyDesktop for RK3399 and integrated drivers for X.org. FriendlyDesktop supports Hardware Cursor, OpenGL graphic acceleration, 4K video playing with hardware decoding.

1.1 System Features

Board Models Version OpenGL ES Hardware accelerated video decoding Kernel Version
NanoPC T4 Ubuntu 18.04 64bit Yes gstreamer 1.0 4.x

1.2 Image Download

You can click on this link to download its image files.

2 Settings & Applications

2.1 Account & Password

Regular Account:

   User Name: pi
   Password: pi

Root:

   User Name: root
   Password: fa

2.2 WiFi Connection

Click on the icon on the top right in the FriendlyDesktop's main window, select your wanted WiFi hotspot and proceed with prompts

2.3 HDMI/DP LCD Resolution

Open the system's menu and go to Perferences -> Monitor Settings to customize your settings.
Recommended resolution: 1920x1080@60Hz

2.4 Adjust HDMI overscan

Open the command line terminal and enter the command to operate, Note:
1) You need to login to the desktop;
2) If you are using ssh terminal, please use the same username as the desktop login. The default is pi. You cannot use the root user. you also need to assign the DISPLAY variable:

export DISPLAY=:0.0

2.4.1 Query which resolutions the display supports

xrandr -q

2.4.2 Set resolution

For example set to 1920X1080@60Hz:

xrandr --output HDMI-1 --mode 1920x1080 --refresh 60

2.4.3 Adjust the HDMI overscan

For example, the transformation scaling horizontal coordinates by 0.8, vertical coordinates by 1.04 and moving the screen by 35 pixels right and 19 pixels down:

xrandr --output HDMI-1 --transform 0.80,0,-35,0,1.04,-19,0,0,1

2.4.4 Automatic adjustment at boot

Edit ~/.config/autostart/lxrandr-autostart.desktop,Write the full xrandr command to the key at the beginning of "Exec= as shown below:

[Desktop Entry]
Type=Application
Name=LXRandR autostart
Comment=Start xrandr with settings done in LXRandR
Exec=sh -c 'xrandr --output HDMI-1 --mode 1920x1080 --refresh 50 --transform 1.04,0,-35,0,1.05,-30,0,0,1'
OnlyShowIn=LXDE

2.5 eDP LCD Display Rotation

If you want to rotate an eDP LCD's display you can do it by commanding "xrotate.sh" to rotate its display to 90/180/270 degrees. You can rotate display clockwise by 90 degrees by running the following command as root. This command calls lightdm to make your change effective immediately:

sudo xrotate.sh -m CW -r

For more details about its options you can run "xrotate -h".
Note: this command doesn't support HDMI display's rotation. If you want to rorate an HDMI's display you need to refer to X11's tech documents and make changes in "/etc/X11/xorg.conf".

Note: when you play a video with hardware decoding your player's display window doesn't rotate with your LCD's display

2.6 Test OpenGL ES

You can test it by clicking on the Terminator icon to start a commandline utility in the System Tools and run the following commands:

taskset -c 4-5 glmark2-es2

Friendlydesktop-glmark-es.png
Friendlydesktop-glmark-es2-score.jpg

2.7 4K Video Playing

2.7.1 Play with Qt Player with Hardware Decoding

FriendlyDesktop has integrated a Qt5-VideoPlayer utility. This utility has support for Rockchip's gstreamer plug-in and supports 4K video playing with hardware decoding. You can start it by following the steps below: On FriendlyDesktop's main window open "Sound & Video" and click on "Qt5-VideoPlayer".

On the player's main window click on the bottom left's "Open" button to load a video file and double-click on its name on the file list to start video playing. Here is how it looks like. You can set the display window to full screen and adjust the volume:
Friendlydesktop-player.jpg
Qt5-VideoPlayer source code: https://github.com/friendlyarm/rk-player-qt

2.7.2 Play with Linux Command

You can play it by running the following command in a commandline utility:

gst-player.sh

By default its voice will be output to audio jack. You can locate this script by commanding "which gst-player.sh". You can customize its behavior by making changes in this script.

2.8 Work with USB Camera

Insert the USB camera (such as Logitech C270/C920) into the development board. Double click the "USB Camera" icon on desktop will pop up the luvcview gui (need to use the 2019/05/11+ version firmware).
the luvcview tool is an open source software that you can compile yourself:

git clone https://github.com/ksv1986/luvcview
cd luvcview
make

View the usage of luvcview:

./luvcview -h

Parameter Description:

luvcview version 0.2.1
Usage: uvcview [-h -d -g -f -s -i -c -o -C -S -L -l -r]
-h print this message
-d /dev/videoX use videoX device
-g use read method for grab instead mmap
-w disable SDL hardware accel.
-f video format default jpg others options are yuv jpg
-i fps use specified frame interval
-s widthxheight use specified input size
-c enable raw frame capturing for the first frame
-C enable raw frame stream capturing from the start
-S enable raw stream capturing from the start
-o avifile create avifile, default video.avi
-L query valid video formats
-l query valid controls and settings
-r read and set control settings from luvcview.cfg

To preview USB camera (640x360@30fps), you can use the following command:

./luvcview -d /dev/video8 -i 30 -s 640x360

As you can see from the output of luvcview, hardware acceleration has been turned on:

pi@NanoPC-T4:/etc/xrdp$ luvcview -d /dev/video8 -i 30 -s 640x360
luvcview version 0.2.1
 interval: 30 fps
Hardware acceleration available
video /dev/video8

2.9 File Transfer with Bluetooth

Click on the "Preferences" in the main window's menu to start Bluetooth Manager and click on "Search" to search surrounding Bluetooth devices. Click on your wanted device, pair the device with your board and you will be able to do file transfer, here is how it looks like:
Friendlydesktop-ble-sendfile.jpg

2.10 Install OpenCV

OpenCV has been pre-installed in FriendlyCore/FriendlyDesktop (Version after 201905) and does not require manual installation.
Please refre this link: https://github.com/friendlyarm/install-opencv-on-friendlycore/blob/rk3399/README.md

2.11 Develop Qt Applications

FriendlyDesktop has a Qt 5.10.0 which supports RK3399's OpenGL ES and Gstreamer 1.0 hardware acceleration and a QtCreator IDE which is ready and can be used to compile and run applications. Here is how it looks like:
Friendlydesktop-qtcreator.png
When running the Qt app, you need to specify the platform parameter to xcb as follows:

./HelloQt --platform xcb

2.12 WiringPi and Python Wrapper

2.13 Switch audio default output device

2.13.1 View the current default output device

On the terminal of the non-root user, enter the following command:

pactl info -vvv

The information displayed contains the following, indicating that the current audio output is directed to the headset:

Default Sink: alsa_output.platform-rt5651-sound.stereo-fallback

The information displayed contains the following, indicating that the current audio output is to HDMI:

Default Sink: alsa_output.platform-hdmi-sound.stereo-fallback

2.13.2 Set headphone jack as the default output device

On the terminal of the non-root user, enter the following command:

pactl set-default-sink  alsa_output.platform-rt5651-sound.stereo-fallback

Set default volume to 20%:

pactl -- set-sink-volume alsa_output.platform-rt5651-sound.stereo-fallback 20%

2.13.3 Set hdmi as the default output device

On the terminal of the non-root user, enter the following command:

pactl set-default-sink  alsa_output.platform-hdmi-sound.stereo-fallback

2.13.4 View settings have taken effect

cat /var/lib/pulse/*-default-sink

2.13.5 Temporary switching during playback

This method is only valid for the current playback process:
Open the menu "Sound & Video" -> "PulseAudio Volume Control", click the "Built-in Audio Stereo" button on the interface to switch between different output devices, such as switching between HDMI and headphone jack.

2.14 Play RTSP video stream (or IP Camera)

Open a command line terminal and enter the following command:

gst-launch-1.0 rtspsrc location="rtsp://admin:12345@192.168.1.120:554/live/main" ! rtph264depay ! decodebin ! rkximagesink

Change the address after rtsp:// to the real address.

2.15 Chromium web browser

Chromium web browser has enabled hardware acceleration by default, supports WebGL, and can view hardware acceleration details by entering the URL chrome://gpu, as shown below:
Chromium-gpu.png

2.16 Screen saver and auto sleep related settings

The screen saver configuration file is /etc/xdg/autostart/xset_command.desktop. The default factory settings are that the screen saver and DPMS are both closed. You can change the configuration by modifying this file.

2.17 Install Scratch

enter the following command:

sudo apt-get install scratch:arm64

2.18 Install Arduino IDE

enter the following command:

sudo apt-get install arduino:arm64

2.19 Start the program automatically at startup

Put the desktop file in the ~/.config/autostart/ directory, for example:

cp /usr/share/applications/org.qt-project.qtcreator.desktop ~/.config/autostart/

2.20 Login to the desktop as the root user

Edit the /root/.profile file:

sudo vim /root/.profile

Replace with the following:

if [ -n "$BASH_VERSION" ]; then
    if [ -f "$HOME/.bashrc" ]; then
	. "$HOME/.bashrc"
    fi
fi
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi

Run the following command to modify the lightdm configuration file and change the automatically logged-in user name to root:

sudo sed -i 's/autologin-user=pi/autologin-user=root/g' /usr/share/lightdm/lightdm.conf.d/20-defaultsession.conf

Run the reboot command to restart:

sudo reboot

If you want to log in, the desktop icons and configuration are the same as the pi user, you can copy the relevant directory from the /home/pi directory:

sudo rm -rf /root/Desktop /root/Pictures /root/.config
sudo cp -af /home/pi/Desktop /home/pi/Pictures /home/pi/.config /root/
sudo chown root:root /root/Desktop /root/Pictures /root/.config

3 Update Log

3.1 August-23-2018

  • Released English version