iotdeveloper
iotdeveloper

Reputation: 1

How can I use a USB/COM port inside of a VSCode Docker development container + PlatformIO?

I'm trying to deploy VS Code in Docker on Windows 10.

I found this nice guide: https://www.linkedin.com/pulse/connecting-microcontrollers-platformio-running-linux-windows-jenssen-c6ulf and followed it, but unfortunately I can't see the USB target port (e.g. connected ESP32) in VS Code (PlatformIO extension), which is connected to a running Docker container using WSL2.

I have the device binded and: attached, in Ubuntu app after lsusb command I can see: output

When I run the command lsusb I get this: output

so ubuntu sees the USB device connected. But after running ls /dev I don't see something like /dev/ttyUSBx or /dev/ttyACMx there but the device can be found in /dev/usb/... directory.

I also tried adding the file 99-platformio-udev.rules file in /etc/udev/rules.d according this tutorial: https://docs.platformio.org/en/latest/core/installation/udev-rules.html#platformio-udev-rules

and even add these permissions:

$ sudo adduser <username> dialout
$ sudo chmod a+rw /dev/ttyUSB0

but it didn't make any changes.

Could you please advise me if it is possible to ensure that, even when VS Code is running in a Docker container, USB devices can be seen in VS Code PlatformIO extension and therefore it is possible to upload a program to them?

Thanks

Upvotes: 0

Views: 233

Answers (1)

Bayrem Gharsellaoui
Bayrem Gharsellaoui

Reputation: 308

Make sure you do this:

sudo usermod -a -G dialout $USER

sudo service udev restart

And you can use the GUI version of USBIP to attach your port on WSL2

If it didn't work from the first time try restarting VSCode and WSL2

Upvotes: 0

Related Questions