martinling / libserialport

Unofficial personal repository for libserialport - see git://sigrok.org/libserialport for official repo
http://sigrok.org/wiki/Libserialport
GNU Lesser General Public License v3.0
65 stars 34 forks source link

Add support for WSL1 #31

Open soul4soul opened 5 years ago

soul4soul commented 5 years ago

It is now possible to access windows serial devices from WSL. It would be great to see support for this in libserialport.

The first issue I ran into when attempting to use libserialport on WSL was port enumeration using sp_list_ports. The directory /sys/class/tty doesn't exist on WSL. I was using the Ubuntu 18.04 image.

thestumbler commented 5 years ago

I would be very interested in this as well. My team is developing some multiplatform software, and due to a variety of factors my main machine with this client has to be a Windows box on which I run WSL extensively. Is it as simple as copying linux.c to, say, wsl.c, and changing the directory names? Surely not...

thestumbler commented 3 years ago

Any further thoughts on this issue? On a project of mine, I'm finally getting around to refactoring a multi-platform flash programming tool stm32flash so that it uses libserialport instead of its own internal code. Problem is, now I won't be able to use it within WSL any more once the change is complete. While I haven't dug deep into the code, it appears that this project uses posix calls to access the serial port, not unlike libserialport. Since it is able to work under WSL, this leads me to think (without really knowing the details), that making libserialport to work under WSL isn't a huge task.

soul4soul commented 3 years ago

From what I remember the main code change is related to port enumeration. The way WSL exposes and shows available ports is different but once the port handle is identified the control of the port is the same. I haven't looked since I opened this issue so I could be all wet.