Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker serial #462

Open
zhushaoan opened this issue Oct 10, 2024 · 4 comments
Open

docker serial #462

zhushaoan opened this issue Oct 10, 2024 · 4 comments

Comments

@zhushaoan
Copy link

version: '3.8'

services:
  nodered:
    image: registry.xiangyuniot.com/edge/nodered:4.0.3-arm
    container_name: nodered
    user: root
    network_mode: host
    cap_add:
      - NET_ADMIN
    volumes:
      - node-red-data:/data
      - /sys/class/leds:/sys/class/leds
      - /sys/devices/platform/leds:/sys/devices/platform/leds
      - /dev/ttyS3:/dev/ttyS3_4851
      - /dev/ttyS4:/dev/ttyS4_485422
      - /dev/ttyS9:/dev/ttyS9_232
    tty: true
    stdin_open: true
    
volumes:
  node-red-data:
 docker logs f99e0dd2bad3
10 Oct 07:11:40 - [info]

Welcome to Node-RED
===================

10 Oct 07:11:40 - [info] Node-RED version: v4.0.3
10 Oct 07:11:40 - [info] Node.js  version: v20.17.0
10 Oct 07:11:40 - [info] Linux 5.10.110-rockchip-rk3588 arm64 LE
10 Oct 07:11:40 - [info] Loading palette nodes
10 Oct 07:11:41 - [info] Settings file  : /data/settings.js
10 Oct 07:11:41 - [info] Context store  : 'default' [module=memory]
10 Oct 07:11:41 - [info] User directory : /data
10 Oct 07:11:41 - [warn] Projects disabled : editorTheme.projects.enabled=false
10 Oct 07:11:41 - [info] Flows file     : /data/flows.json
10 Oct 07:11:41 - [warn]

root@hanweiai200:/home/hanweiai# ls /dev/ttyS* /dev/ttyUSB*
/dev/ttyS0  /dev/ttyS3  /dev/ttyS4  /dev/ttyS9  /dev/ttyUSB0  /dev/ttyUSB1  /dev/ttyUSB2  /dev/ttyUSB3
root@hanweiai200:/home/hanweiai# docker exec -it f99e0dd2bad3 /bin/bash
hanweiai200:/usr/src/node-red# ls /dev/ttyS* /dev/ttyUSB*
ls: /dev/ttyUSB*: No such file or directory
/dev/ttyS3_4851    /dev/ttyS4_485422  /dev/ttyS9_232
hanweiai200:/usr/src/node-red# ls -l /dev/ttyS3
ls: /dev/ttyS3: No such file or directory
hanweiai200:/usr/src/node-red# ls -l /dev/ttyS3_4851
crw-rw----    1 root     dialout     4,  67 Oct 10 08:28 /dev/ttyS3_4851

image
Why is the serial port list displayed the serial port list of the host machine instead of the docker container?

@hardillb
Copy link
Member

That is probably a question for the node-serial developers.

@zhushaoan
Copy link
Author

这可能是节点序列开发人员的一个问题。

image
The two different nodes encountered the same situation

@hardillb
Copy link
Member

What I meant was both those nodes make use of node-serial (https://www.npmjs.com/package/node-serial) to list the available serial ports.

@hardillb
Copy link
Member

The list of available ports is generated by this code:

https://github.com/node-red/node-red-nodes/blob/442576e838a267cde7ee3dd2fad634ea39eb5b0d/io/serialport/25-serial.js#L580-L590

Which just asks the node-serial code to list the available ports.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants