python-3.x - 在 azure edge python 模块中使用 pyserial
问题描述
我正在尝试在使用 azure edge python 模块时从 docker 实现串行通信,似乎 pyserial 不起作用。它无法从 docker 中找到物理设备端口。
{
"TestPythonModule": {
"version": "1.0",
"type": "docker",
"status": "running",
"restartPolicy": "always",
"settings": {
"image": "${MODULES.TestPythonModule}",
"createOptions": {
"HostConfig": {
"Devices": [
{
"PathOnHost": "/dev/ttyS0",
"PathInContainer": "/dev/ttyS0",
"CgroupPermissions": "rwm"
}
]
}
}
}
}
}
}
}
解决方案
您是否通过模块配置中的创建选项将串行端口映射到容器中......像这样:
{
"HostConfig": {
"Devices": [
{
"PathOnHost": "<device name on host machine>",
"PathInContainer": "<device name in container>",
"CgroupPermissions": "rwm"
}
]
}
}
主机上的设备名称在哪里类似于 /dev/ttys0 或任何串行端口映射到您的机器上?(我假设Linux)
推荐阅读
- python - 如何在创建过程中反转数据框的轴
- pascal - 帕斯卡输入方式
- api - Lumen JWT Auth always return 401 in other route after login success
- swift - Gap between navigation bar and first UITableViewCell
- xml - Transforming Date Formats in cXML document
- c# - Json Serialization in Unity - NullReferenceException : Object reference not set to an instance of an object
- firebase - Firebase 使用 customClaim 创建用户
- hadoop - InvalidAuxServiceException in MapReduce Job
- hibernate - 如何使用 JPQL、复合主键/外键和 MySQL 方言查找缺失的 @ManyToOne 关系
- java - How to use KeyListener for moving Rectangles