Guest Hyper-V (Ubuntu) VM access to host COM serial port on Win10 host issues

I’ve been working to get an Ubuntu 19.04 O/S running on a Windows 10 Hyper-V for personal use.

I am currently getting issues when attempting to get PlatformIO to communicate with my ESP32, attached via a USB adapter to my laptop.

When I run PlatformIO via VSCode on the Windows 10 machine, everything works well, however as this environment is not stable, I’d prefer to code my embedded projects on an Ubuntu instance.

I’ve tried several methods to connect the device which is detected on the Win10 on COM5 to the Ubuntu instance.

  1. Comm Tunnel (COM to TCP, then SOCAT to map ‘sudo socat pty,link=/dev/virtualcom0,raw tcp:’ to the virtualcom0 device terminal.)

When using this technique, I can successfully listen to the device using ‘cat /dev/virtualcom0’ or ‘screen /dev/virtualcom0’

This fails when I attempt to upload the application firmware to the device,
File “/home/ian/.platformio/penv/local/lib/python2.7/site-packages/serial/”, line 636, in _update_dtr_state
fcntl.ioctl(self.fd, TIOCMBIC, TIOCM_DTR_str)
IOError: [Errno 22] Invalid argument
*** [upload] Error 1

I’ve traced this error back to an old PySerial dependency which I upgraded with success from 2.7 to 3.4, using the command ‘pip install pyserial==3.4

Is there a way to force PlatformIO to use Pyserial 3.4, as it still appears to be using old behavior.

  1. I’ve tried using a Gen 1 HyperV VM instance with Ubuntu then mapping the COM5 to a virtual COM0 port

Ubuntu on startup detects the COM0 device as /dev/ttyS0 however the port (terminal) is unresponsive. I cannot ‘cat’ or ‘screen’ the device terminal. PlatformIO cannot open the port.

  • Is there an existing VM image available for use in Hyper-V with PlatformIO already installed and configured to access host ports? (Optimistic)
  • Is there a way to build PlatformIO natively on my machine to force the use of Pyserial 3.4?
  • Is there a recommended path for doing this development on a virtual machine?

Much thanks in advance for your assistance.