[英]Pyjoystick inside docker container
I am trying to to handle commands from my xbox one controller inside a docker container.我正在尝试在 docker 容器内处理来自我的 xbox 之一 controller 的命令。
I am running the container in privileged mode and using xow as driver.我以特权模式运行容器并使用 xow 作为驱动程序。 It detects the controller and pairs inside my container:它检测到 controller 并在我的容器内配对:
root@5e6c8573010e:/app# ./xow
2022-08-25 08:56:01 INFO - xow v0.5-36-gd335d60 ©Severin v. W.
2022-08-25 08:56:01 INFO - Waiting for device...
2022-08-25 08:56:01 INFO - Wireless address: 62:45:b4:e7:6d:70
2022-08-25 08:56:01 INFO - Dongle initialized
2022-08-25 08:56:05 INFO - Controller '1' connected
2022-08-25 08:56:05 INFO - Device announced, product id: 02dd
2022-08-25 08:56:05 INFO - Serial number: 02980116127538
However, when I run my python script to access the commands但是,当我运行 python 脚本来访问命令时
from pyjoystick.sdl2 import Key, Joystick, run_event_loop
def print_add(joy):
print('Added', joy)
run_event_loop(print_add, print_remove, key_received)
it does not detect the controller.它没有检测到 controller。 The script runs without errors but is just not saying "Added".该脚本运行没有错误,但只是没有说“添加”。 My host system says "Added" if I run the script there, though.不过,如果我在那里运行脚本,我的主机系统会显示“已添加”。
How can this be?怎么会这样? Some missing dependencies in the SDL lib? SDL 库中缺少一些依赖项?
I could solve this issue by observing my device folder after starting the driver.我可以通过在启动驱动程序后观察我的设备文件夹来解决这个问题。 In my host system, the devices在我的主机系统中,设备
/dev/input/event0
/dev/input/js0
were created but not shown in the docker container.已创建但未在 docker 容器中显示。
I solved this by adding this option我通过添加此选项解决了这个问题
-v /dev/input:/dev/input
to my run script.到我的运行脚本。
The driver itself needs司机本身需要
-v /dev/bus/usb:/dev/bus/usb
to access the dongle for remote connection which is plugged into one of my raspberry pis usb ports.访问插入我的树莓派 usb 端口之一的用于远程连接的加密狗。
Now I can cloud deploy some remote container which gives my remote target access to xbox one controllers.现在我可以云部署一些远程容器,使我的远程目标可以访问 Xbox One 控制器。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.