尝试将电子 .deb 文件运行到 Raspberry Pi Zero 2 上的 HDMI 端口时出错

尝试将电子 .deb 文件运行到 Raspberry Pi Zero 2 上的 HDMI 端口时出错

我已经构建了一个电子应用程序,我想将其部署到 pi zero w2,并让其在设备插入时自动启动。它的工作原理应该与 Fire Stick 类似。

它将插入电源和 HDMI,然后 pi 将直接启动到应用程序并显示全屏信息亭模式。

我在 mac book 上开发应用程序时运行良好,并且我使用 docker buildx 运行使用 electron-builder 的 ARM 构建。这给了我一个 .deb 文件,我成功地将它安装到我的 Pi 上,几乎没有遇到麻烦。

现在我面临的问题是,当我尝试运行该应用程序时出现以下错误:

ozone_platform_x11.cc(240) Missing X server or $DISPLAY

我刚刚安装了 xinit,并且我已经测试过我可以让这个基本版本与 xterm 一起工作,但我不知道如何让我构建的电子应用程序输出到我的 HDMI 端口。

眼镜

  • Raspberry Pi Zero 2
  • Ubuntu 23.10 服务器

有什么想法可以解决此问题吗?

更新 1

我也刚刚尝试过 XvFb,结果出现以下错误

admin@raspberrypi:~$ DISPLAY=:99 menu-cast
[8825:1220/224041.367004:ERROR:object_proxy.cc(590)] Failed to call method: org.freedesktop.portal.Settings.Read: object_path= /org/freedesktop/portal/desktop: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.portal.Desktop was not provided by any .service files
[8854:1220/224043.732757:ERROR:gl_surface_egl.cc(320)] No suitable EGL configs found.
[8854:1220/224043.733590:ERROR:gl_context_egl.cc(140)] eglGetConfigAttrib failed with error EGL_BAD_CONFIG
[8854:1220/224043.735294:ERROR:gl_surface_egl.cc(320)] No suitable EGL configs found.
[8854:1220/224043.735755:ERROR:gl_surface_egl.cc(1090)] eglCreatePbufferSurface failed with error EGL_BAD_CONFIG
[8854:1220/224043.736283:ERROR:gpu_info_collector.cc(81)] gl::GLContext::CreateOffscreenGLSurface failed
[8854:1220/224043.736657:ERROR:gpu_info_collector.cc(397)] Could not create surface for info collection.
[8854:1220/224043.742806:ERROR:gpu_init.cc(88)] CollectGraphicsInfo failed.
[8854:1220/224043.782362:ERROR:viz_main_impl.cc(186)] Exiting GPU process due to errors during initialization
[8872:1220/224046.738974:ERROR:command_buffer_proxy_impl.cc(128)] ContextResult::kTransientFailure: Failed to send GpuControl.CreateCommandBuffer.

我不确定这会让我远离工作还​​是更接近工作

更新 2

好的,我在这里取得了一些进展

  • 运行xinit并退出 GUI,xterm 仍在运行
  • 通过 SSH 进入我的 PI
  • 跑步DISPLAY=:0 menu-cast

现在我让我的应用程序在我的 xterm GUI 上运行,虽然它还不是全屏,但这很好地证明它可以工作。

我想现在的问题是,如何启动 x11 服务器,并且只有我的应用程序以全屏运行?

答案1

因此,对于我来说,解决方法如下...

  1. 创建一个.sh 脚本 ~/gui.sh
#!/bin/sh
menu-cast
  1. 跑步xinit ~/gui.sh

不确定为什么在 shell 脚本中传递命令时它会起作用,但对我来说这就是所需要的。

相关内容