Reputation: 226
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:
Upvotes: 4
Views: 5735
Reputation: 39
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
Upvotes: 3