使用weston-screenshooter

但必须启用weston桌面--debug选项,否则会出现以下错误:

1
2
3
[root@RK356X:/]# weston-screenshooter
[02:41:05.145] libwayland: error in client communication (pid 776)
weston_screenshooter@5: error 0: screenshooter failed: permission denied. Debug protocol must be enabled

以RK3568开发板,buildroot系统为例,修改/etc/init.d/S50launcher,找到weston所在行,添加--debug选项。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
......
# Uncomment to disable mirror mode
# unset WESTON_DRM_MIRROR

export XDG_RUNTIME_DIR=${XDG_RUNTIME_DIR:-/var/run}
export QT_QPA_PLATFORM=${QT_QPA_PLATFORM:-wayland}

weston --tty=2 --debug --idle-time=0&
{
    # Wait for weston ready
    while [ ! -e ${XDG_RUNTIME_DIR}/wayland-0 ]; do
        sleep .1
    done
    /usr/bin/QLauncher &
}&
......

forlinx开发板使用的yocto系统也类似,修改/lib/systemd/system/weston.service,在weston后添加--debug选项。

1
2
3
$ vi /lib/systemd/system/weston.service
# 修改如下
# ExecStart=/usr/bin/weston --debug --log=${XDG_RUNTIME_DIR}/weston.log $OPTARGS

然后重启系统,之后就可以使用weston-screenshooter截取屏幕了。

链接