I want to programmatically discover the name of the serial port that a USB serial device is plugged into in Ubuntu WSL on Windows 10. For example, COM9 in Windows would correspond to /dev/ttyS9 in Ubuntu WSL.
From Windows 10,
reg query \HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\SERIALCOMM
So it seems like the way to do this would be to run the above query in a Bash-style command, assuming that the Windows registry is even visible to Ubuntu WSL. Is it?
Other dead-ends:
Unexplored:
If you have the correct Port/Serial drivers installed (check device manager), then run:
for tty in $(ls /dev/ttyS*); do stty -F $tty -a; done
Any recongnized device will not show ... Input/output error
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With