serialport / serialport-rs

A cross-platform serial port library in Rust. Provides a blocking I/O interface and port enumeration including USB device information.
Other
469 stars 115 forks source link

Windows Subsystem for Linux (WSL) Port '/dev/ttySX' not available: Not a typewriter #2

Open jessebraham opened 2 years ago

jessebraham commented 2 years ago

This issue was migrated from GitLab. The original issue can be found here: https://gitlab.com/susurrus/serialport-rs/-/issues/52

Hello and thank you for a great library. I was using WSL to try and run your clear_input_buffer and received the error: Error: port '/dev/ttyS4' not available: Not a typewriter. I then tried to run list_ports I received No ports found

I then ran the program on windows using the COM4 name and it ran successfully. Am i doing something wrong or is there something going on with WSL? (I am on Ubuntu 18.04 Windows 10 version 1809).

Also, I am able to cat /dev/ttyS4 and read input from WSL.

Thank you.

Qix- commented 1 year ago

Running into this, too. COM ports are exposed to WSL via the /dev/ttyS# (where # is the COM#). So far I haven't been able to read/write them under Rust, but can under cat if the baud rate is 38400.

mlsvrts commented 1 year ago

@Qix-

Serialport support in WSL2 is pretty new and limited, so I'm inclined to think that this is a WSL issue.

Since you can talk to it with cat, I wonder if this is a DTR/RTS/etc problem? You could try fiddling with some of those settings when opening the port.

Qix- commented 11 months ago

This isn't any of those issues. I have no problems talking to serial ports under WSL in other applications, including socat, cat, stty, etc.

I take all of this back, serial ports under WSL1 are seriously broken. Data is received sometimes and not other times, and it's a complete grab-bag as to when that happens. Receiving over COM ports shows no issues whatsoever.