20250408在荣品的PRO-RK3566开发板使用Rockchip原厂的buildroot系统时加入gnome-screenshot命令【直接编译进IMG】

root@ok3588-buildroot:/etc/init.d# vi S49weston 
./buildroot/package/weston/S49weston

rootroot@rootroot-X99-Turbo:~/RK3566_RK3568_Linux5.10_V1.2.0$ ./build.sh cleanall
rootroot@rootroot-X99-Turbo:~/RK3566_RK3568_Linux5.10_V1.2.0$ ./build.sh


20250408在荣品的PRO-RK3566开发板使用Rockchip原厂的buildroot系统时加入gnome-screenshot命令【直接编译进IMG】
2025/4/7 17:57


荣品的PRO-RK3566开发板,4GB+32GB内存。
缘起:请问在飞凌的OK3588-C_Linux5.10.209+Qt5.15.10_用户资料_R1如果使用 weston-screenshooter 截屏?
在Android12/13下都可以很方便的使用screencap截屏。
现在 在linux/Buildroot千辛万苦中找到了weston-screenshooter,失败/异常了。
请问该如何使用?语法错误?还是该如何配置呢?


root@ok3588-buildroot:/#
root@ok3588-buildroot:/# weston-screenshooter
Output capture error: unauthorized
Error: screenshot or protocol failure
root@ok3588-buildroot:/#
root@ok3588-buildroot:/# weston-screenshooter 01.png
Output capture error: unauthorized
Error: screenshot or protocol failure
root@ok3588-buildroot:/#
root@ok3588-buildroot:/# uname -a
Linux ok3588-buildroot 5.10.209 #1 SMP Thu Feb 13 10:19:48 CST 2025 aarch64 GNU/Linux
root@ok3588-buildroot:/#
root@ok3588-buildroot:/#


修改步骤:
将/etc/init.d/S49weston中的:
    /usr/bin/weston&
修改成为:
    /usr/bin/weston --debug &
重启就可以使用weston-screenshooter了!

root@ok3588-buildroot:/# 
root@ok3588-buildroot:/# 
root@ok3588-buildroot:/# 
root@ok3588-buildroot:/# cd /sdcard/
root@ok3588-buildroot:/sdcard# 
root@ok3588-buildroot:/sdcard# ls -l
total 0
root@ok3588-buildroot:/sdcard# 
root@ok3588-buildroot:/sdcard# weston-screenshooter 
root@ok3588-buildroot:/sdcard# 
root@ok3588-buildroot:/sdcard# ls -l
total 116
-rw-r--r-- 1 root root 116979 Jan  1 08:00 wayland-screenshot-1970-01-01_08-00-44.png
root@ok3588-buildroot:/sdcard# 
root@ok3588-buildroot:/sdcard# weston-screenshooter 01.png
root@ok3588-buildroot:/sdcard# 
root@ok3588-buildroot:/sdcard# ls -l
total 232
-rw-r--r-- 1 root root 116979 Jan  1 08:00 wayland-screenshot-1970-01-01_08-00-44.png
-rw-r--r-- 1 root root 116979 Jan  1 08:00 wayland-screenshot-1970-01-01_08-00-54.png
root@ok3588-buildroot:/sdcard# 
root@ok3588-buildroot:/sdcard# 


root@ok3588-buildroot:/etc/init.d# vi S49weston 
root@ok3588-buildroot:/etc/init.d# cat S49weston 
#!/bin/sh -e
### BEGIN INIT INFO
# Provides:          weston
# Required-Start:    mountvirtfs
# Required-Stop:
# Should-Start:
# Should-Stop:
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Linux weston daemon
### END INIT INFO

PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin"

# Load default env variables from profiles(e.g. /etc/profile.d/weston.sh)
/etc/forlinx_env.sh
. /etc/profile

start_weston()
{
    /usr/bin/weston --debug &


现在需要将S49weston的修改直接编译进IMG里。
rootroot@rootroot-X99-Turbo:~/RK3566_RK3568_Linux5.10_V1.2.0$ 
rootroot@rootroot-X99-Turbo:~/RK3566_RK3568_Linux5.10_V1.2.0$ find . -name S49weston
./buildroot/output/rockchip_rk3566/target/etc/init.d/S49weston
./buildroot/package/weston/S49weston

rootroot@rootroot-X99-Turbo:~/RK3566_RK3568_Linux5.10_V1.2.0$ 


直接修改output目中的./buildroot/output/rockchip_rk3566/target/etc/init.d/S49weston
之后直接打包,是否可行,没有验证。


修改:./buildroot/package/weston/S49weston
Z:\RK3566_RK3568_Linux5.10_V1.2.0\buildroot\package\weston\S49weston
Z:\source\buildroot\package\weston\S49weston

#!/bin/sh
### BEGIN INIT INFO
# Provides:          weston
# Required-Start:    mountvirtfs
# Required-Stop:
# Should-Start:
# Should-Stop:
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Linux weston daemon
### END INIT INFO

PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin"

# Load default env variables from profiles(e.g. /etc/profile.d/weston.sh)
. /etc/profile

start_weston()
{
    /usr/bin/weston --debug 2>&1 | tee /var/log/weston.log &
}

stop_weston()
{
    killall weston
}

case "$1" in
    start)
        echo -n "starting weston... "
        start_weston
        echo "done."
        ;;
    stop)
        echo -n "stoping weston... "
        stop_weston || true
        echo "done."
        ;;
    restart|reload)
        echo -n "stoping weston... "
        stop_weston

        while pgrep -x weston; do
            sleep .1
        done
        echo "done."

        echo -n "starting weston... "
        start_weston
        echo "done."
        ;;
    *)
        echo "Usage: $0 {start|stop|restart}"
        exit 1
esac

exit 0


rootroot@rootroot-X99-Turbo:~/RK3566_RK3568_Linux5.10_V1.2.0$ ./build.sh cleanall
rootroot@rootroot-X99-Turbo:~/RK3566_RK3568_Linux5.10_V1.2.0$ ./build.sh


root@rk3566-buildroot:/etc# cd init.d
root@rk3566-buildroot:/etc/init.d# ll
total 128
drwxr-xr-x  2 root root 4096 Apr  7  2025 ./
drwxr-xr-x 25 root root 4096 Aug  4 09:01 ../
-rwxr-xr-x  1 root root  427 Apr  7  2025 S00mountall.sh*
-rwxr-xr-x  1 root root  392 Apr  7  2025 S01log-guardian.sh*
-rwxr-xr-x  1 root root 1012 Apr  7  2025 S01syslogd*
-rwxr-xr-x  1 root root 1004 Apr  7  2025 S02klogd*
-rwxr-xr-x  1 root root 2804 Apr  7  2025 S02sysctl*
-rwxr-xr-x  1 root root  368 Apr  7  2025 S05async-commit.sh*
-rwxr-xr-x  1 root root 1594 Apr  7  2025 S10udev*
-rwxr-xr-x  1 root root  620 Apr  7  2025 S13irqbalance*
-rwxr-xr-x  1 root root 1684 Apr  7  2025 S20urandom*
-rwxr-xr-x  1 root root 1619 Apr  7  2025 S30dbus*
-rwxr-xr-x  1 root root  358 Apr  7  2025 S36wifibt-init.sh*
-rwxr-xr-x  1 root root 1001 Apr  7  2025 S40bluetoothd*
-rwxr-xr-x  1 root root  438 Apr  7  2025 S40network*
-rwxr-xr-x  1 root root  457 Apr  3  2024 S40rkaiq_3A*
-rwxr-xr-x  1 root root  653 Apr  7  2025 S41dhcpcd*
-rwxr-xr-x  1 root root  390 Apr  7  2025 S49chrony*
-rwxr-xr-x  1 root root  954 Apr  7  2025 S49weston*
-rwxr-xr-x  1 root root 1354 Apr  7  2025 S50dropbear*
-rwxr-xr-x  1 root root  592 Apr  7  2025 S50pulseaudio*
-rwxr-xr-x  1 root root  386 Apr  7  2025 S50usbdevice.sh*
-rwxr-xr-x  1 root root  427 Apr  7  2025 S80dnsmasq*
-rwxr-xr-x  1 root root  287 Apr  7  2025 S98iodomain.sh*
-rwxr-xr-x  1 root root  546 Apr  7  2025 S99-auto-reboot*
-rwxr-xr-x  1 root root  293 Apr  7  2025 S99chromium-wayland.sh*
-rwxr-xr-x  1 root root  933 Apr  7  2025 S99fstrim*
-rwxr-xr-x  1 root root  447 Apr  7  2025 S99input-event-daemon*
-rwxr-xr-x  1 root root 1950 Apr  7  2025 fuse3*
-rw-r--r--  1 root root  471 Apr  7  2025 ninfod.sh
-rwxr-xr-x  1 root root  423 Apr  7  2025 rcK*
-rwxr-xr-x  1 root root  408 Apr  7  2025 rcS*
root@rk3566-buildroot:/etc/init.d# 
root@rk3566-buildroot:/etc/init.d# cat S49weston 

参考资料:
百度:weston-screenshooter 01.png Output capture error: unauthorized
BING:weston-screenshooter 01.png Error: screenshot or protocol failure

https://kira-96.github.io/notes/weston-screenshot/
weston桌面系统截屏方法
二月 3, 2023

使用weston-screenshooter

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

[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选项。

......
# 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选项。

$ vi /lib/systemd/system/weston.service
# 修改如下
# ExecStart=/usr/bin/weston --debug --log=${XDG_RUNTIME_DIR}/weston.log $OPTARGS
然后重启系统,之后就可以使用weston-screenshooter截取屏幕了。


https://blog.csdn.net/qq_40177571/article/details/124989542?ops_request_misc=%257B%2522request%255Fid%2522%253A%252238e8168a9636ee7d6f3f6129ebc177b9%2522%252C%2522scm%2522%253A%252220140713.130102334..%2522%257D&request_id=38e8168a9636ee7d6f3f6129ebc177b9&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~all~sobaiduend~default-2-124989542-null-null.142^v101^pc_search_result_base6&utm_term=weston-screenshooter&spm=1018.2226.3001.4187
LS1028 weston桌面weston-screenshooter截图方法
https://blog.csdn.net/qq_40177571/article/details/124989542

vim /lib/systemd/system/weston.service
//修改如下所示:
ExecStart=/usr/bin/weston --debug --log=${XDG_RUNTIME_DIR}/weston.log $OPTARGS


CSDN:weston-screenshooter

猜你喜欢

转载自blog.csdn.net/wb4916/article/details/147060504
今日推荐