泊坞窗容器无法看到的SerialPort设备 [英] Docker container can't see a serialport device

查看:180
本文介绍了泊坞窗容器无法看到的SerialPort设备的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想可以访问的主机的SerialPort跑码头工人的容器。
下面是我所做的:

I'm trying to run a docker container with access to a 'serialport' in the host. Here is what I did:

  • I used MAC
  • installed drivers on the host (http://www.prolific.com.tw/US/ShowProduct.aspx?p_id=229&pcid=41)
  • plugged in the device
  • run ls /dev/t* that returned /dev/tty.usbserial - so it works
  • run the container docker run -it --privileged -v /dev:/dev node:4.4.0 /bin/bash and then ls /dev/t* inside the container which didn't return the /dev/tty.usbserial device...

我打了很多的参数不同的变化,但还没有找到工作的:)另外, - 设备标志不适合我,因为该设备可能重新连接和名称可能从 /dev/tty.usbserial

I played a lot with different variations of parameters but haven't found the working one :) Also the --device flag is not suitable for me since the device might be reconnected and the name could differ from /dev/tty.usbserial

推荐答案

您可以检查中所描述的剧本的在泊坞窗容器新的USB设备的通知(摘自的圭多Diepen - gdiepen )可帮助

You can check if the script described in "Notification of new USB devices in docker container" (from Guido Diepen -- gdiepen) can help.

他也经营着与容器 - 特权参数允许它访问的设备。他登上了主机目录的/ dev /巴士/ USB 容器内的/ dev /巴士/ USB 目录用参数 -v的/ dev /巴士/ USB:为/ dev /巴士/ USB 当启动该容器

He too runs his container with the --privileged argument to allow it to access the devices. And he mounts the host directory /dev/bus/usb to the /dev/bus/usb directory within the container with the argument -v /dev/bus/usb:/dev/bus/usb when starting said container.

该脚本同时使用 inotifywait 的lsusb 等待设备对(联合国)插上电源,检查它是否在设备,我们感兴趣的东西。

The script uses both inotifywait and lsusb to wait for devices to be (un)plugged and check if it was the device we are interested in.

inotifywait 将继续倾听的inode 下创建/删除事件开发/巴士/ USB 目录每当的inode 对应于相关设备已刚刚创建将执行命令。

The inotifywait will keep on listening to inodes create/delete events under the dev/bus/usb directory and will execute commands whenever an inode corresponding to a relevant device has been just created.

又见,一旦检测到一个插入USB设备,如何获得总线和设备关系的的/ dev / ttyUSB (不涉及码头工人,但仍相关)

See also, once you have detected an plugged USB device, How to get Bus and Device relationship for a /dev/ttyUSB (not related to docker, but still relevant)

这篇关于泊坞窗容器无法看到的SerialPort设备的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆