Code Monkey home page Code Monkey logo

Comments (10)

mcbridematt avatar mcbridematt commented on July 17, 2024 1

I'm using --privileged, which shares the entire /dev tree.

docker create --privileged --net=host --name=mozilla-iot-gateway-dev ...

Using --device would be safer but this would not give you access to the /dev/bus/usb and other things required to enumerate USB devices, hence I suggested the zigbee adapter have a way to specify a device manually.

from gateway-docker.

mrstegeman avatar mrstegeman commented on July 17, 2024

@dhylands Do you have any tips for serial port debugging?

from gateway-docker.

dhylands avatar dhylands commented on July 17, 2024

The zigbee adapter uses the SerialPort module, which internally uses udev to detect serial ports. The error indicates that the container isn't seeing the dongle, which presumably means that something needs to be done to allow it to do so.

If you cd into the gateway/tools directory and run the following commands:

npm install serialport
node ./list_ports.js

then it should list of the serial ports which can be seen. If you don't see the Digi dongle using list_ports.js, then the zigbee adapter won't be able to see it either.

So you need to adjust whatever it is that's required with docker to allow it to see the usb dongle.

from gateway-docker.

nasahlpa avatar nasahlpa commented on July 17, 2024

The device is correctly showing up in the container:
lsusb: Bus 001 Device 004: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC
But with ./list_ports.js not:

Serial Device found @ /dev/ttyUSB0
Serial Device found @ /dev/ttyS0
Serial Device found @ /dev/ttyS1
Serial Device found @ /dev/ttyS2
Serial Device found @ /dev/ttyS3

On my host machine I see following:

USB Serial Device 0403:6001 Vendor: Digi found @ /dev/ttyUSB0
Serial Device found @ /dev/ttyS0
Serial Device found @ /dev/ttyS1
Serial Device found @ /dev/ttyS2
Serial Device found @ /dev/ttyS3

Since lsusb detects the stick in the container, I think its not an issue of docker. What does list_ports.js require to detect devices?

from gateway-docker.

dhylands avatar dhylands commented on July 17, 2024

It looks like its showing up as a serial port, but that the USB information isn't making it through.

There is a script called udevadm in gateway/tools which you can copy to someplace in the PATH and see if list_ports.js shows the USB information. usbdevadm was created for OpenWRT which doesn't have udev support.

The node SerialPort module calls udevadm internally.

from gateway-docker.

mcbridematt avatar mcbridematt commented on July 17, 2024

You were on the right track @dhylands.

The container itself has a normal udevadm (/bin/udevadm) which does not identify the manufacturer/serial information on the USB. If it's replaced with the one included in the tools folder it works.

You also have to add the 'node' user to the relevant group for tty's on your host system otherwise it won't be able to access it at all.

See my fixes here:
https://github.com/mcbridematt/gateway-docker/commits/zigbee-under-container

I can send a pull for substituting udevadm if that is OK with everyone.
The tty groupid is better fixed at runtime rather than in the container image for reasons I mentioned in the commit.

IMO it would be better to pass through the ZigBee TTY using docker run --device /dev/ttyUSB0:/dev/tty.zigbee or similar, rather than trying to detect it via sysfs/udev methods (using -d on its own won't require --privileged). Chances are the user or script launching the container on the host has a very clear idea of what tty the Zigbee adaptor is on.. but I can take this discussion over to the zigbee adapter repo.

from gateway-docker.

mrstegeman avatar mrstegeman commented on July 17, 2024

@mcbridematt I'm glad you got this working! Please submit a PR and I will happily merge and build a new image.

from gateway-docker.

nasahlpa avatar nasahlpa commented on July 17, 2024

thanks @mcbridematt !
I tried your fix and the device is found: USB Serial Device 0403:6001 Vendor: Digi found @ /dev/ttyUSB*
However, it should be /dev/ttyUSB0 and not /dev/ttyUSB*, because of this, the gateway shows me: ```

Opening serial port /dev/ttyUSB*
SerialPort open err = Error: Error: No such file or directory, cannot open /dev/ttyUSB*

Any ideas on that?

from gateway-docker.

nasahlpa avatar nasahlpa commented on July 17, 2024

Thanks for the merge. However, this was not solving the issue. After freshly building and starting the docker container, I still get this problem:

zigbee: Opening serial port /dev/ttyUSB*
zigbee: SerialPort open err = Error: Error: No such file or directory, cannot open /dev/ttyUSB*

from gateway-docker.

mrstegeman avatar mrstegeman commented on July 17, 2024

@mcbridematt What docker argument are you using to share in your device node?

from gateway-docker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.