Shop OBEX P1 Docs P2 Docs Learn Events
Windows Subsystem for Linux + COM Ports? — Parallax Forums

Windows Subsystem for Linux + COM Ports?

Has anyone read anything about Microsoft's support of COM ports via the new "Windows Subsystem for Linux?" I've been playing a bit with WSL and like it a lot - great idea and pretty good implementation it seems. But... for us embedded guys, it's only so useful without access to serial ports.

I found this: http://stackoverflow.com/questions/38444497/trouble-locating-my-serial-ports-using-bash-on-windows-10
Haven't tried yet... More hoops than I care to jump through tonight.

Comments

  • Heater.Heater. Posts: 21,230
    This not going to help at all but you prompted me to install WSL. I was never tempted before because...well, Ubuntu. Now I have both of my least favorite least favorite operating systems installed on one machine. :)

    Oddly I can see: /dev/ttyS0 and /dev/ttyS0 listed. The first does not seem to be connected to anything and the second seems to be the console:
    heater@SURFACE:/mnt/c/Users/heater$ echo "klksldjflsdjkflsjkdflkjsd" > /dev/tty0
    bash: /dev/tty0: Input/output error
    heater@SURFACE:/mnt/c/Users/heater$ echo "klksldjflsdjkflsjkdflkjsd" > /dev/tty1
    klksldjflsdjkflsjkdflkjsd
    

    It does not show my PropPlug.

    So I wrote a little node program to list serial ports:
    var SerialPort = require('serialport');
    
    SerialPort.list(function (err, ports) {
        console.log('Serial ports:');
        if (err) {
            console.log(err);
        }
        ports.forEach(function(port) {
            console.log(port.comName);
            console.log(port.pnpId);
            console.log(port.manufacturer);
        });
    });
    
    It does not find any at all.

    Meanwhile I have cygwin. Which has no problem:
    $ ls /dev/tty*
    /dev/tty  /dev/ttyS3
    

    My program lists finds the PropPlug:
    $ node index.js
    Serial ports:
    COM4
    FTDIBUS\VID_0403+PID_6001+A8007B38A\0000
    FTDI
    

    The following goes out over my PropPlug OK.

    $ echo "kjsdfhksdhfksjdhfksdjhfksdjf" > /dev/ttyS3

    I love the url that you get linked to during installing WSL:

    https://aka.ms/wslusers

    :)

  • FYI: new feature adds serial port support: https://blogs.msdn.microsoft.com/wsl/2017/04/14/serial-support-on-the-windows-subsystem-for-linux/

    I'm playing with it now, trying to get it to work with propeller-load and therefore PropWare. I'll update here and probably the PropWare thread when (if) I get it working
  • Heater.Heater. Posts: 21,230
    What, we have to hack the Windows registry to make this work?

    Grrr...

    Better than nothing I guess.
  • I wasn't sure about that... I don't have it working yet... so maybe...? I tried just upgrading to the right version of Windows and that got a bunch TTYs to show up, including /dev/ttyS3, which I think is the right one (since Windows only shows a single COM port: COM 3). However, propeller-load couldn't auto-detect the Activity Board, and using "-p /dev/ttyS3" threw a permission error. Trying propeller-load with root access threw some error about incorrect ioctl access I think. I gave up at that point.
  • Heater.Heater. Posts: 21,230
    How did you do that?

    My Win 10 on my Surface Pro 4, which recently updated itself, shows no /dev/ttySwhatever. I have a working Prop Plug connected that shows up as COM4 under SimpleIDE and works there.

  • I had to enable Insider Preview mode and set it to the "fast" stream. Once that was done, I had to let it update. I didn't time it, but I'm pretty sure if one wanted to, they would need a calendar instead of a stopwatch. Finally, I just opened bash and did "ls /dev/ttyS*" and got a big list.

    Now, I have two Windows 10 devices: a laptop that shipped with Windows 10 and is only a month old, and a virtual machine that was upgraded from Windows 8. The laptop didn't run into any trouble (other than the problems described above), but the virtual machine did. It attempted to install the update and failed, but I was able to easily get past with the help of this webpage. In short, do this:

    1. Go to Start > type Regedit
    2. Launch “regedit (run command)“
    3. Navigate to and select the following registry key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RequestedAppCategories\8b24b027-1dee-babb-9a95-3517dfb9c552
    4. Delete the selected registry key
    5. Reboot your PC
    6. Re-scan for updates.
  • Heater.Heater. Posts: 21,230
    I'm lost at:

    1. Go to Start > type Regedit

    If by "start" you mean the Windows Icon in the panel at the bottom of the screen.

    There is no place to type anything there when that list of applications pops up.

  • Heater.Heater. Posts: 21,230
    edited 2017-04-15 21:38
    OK. I found my way into regedit.

    However I do not have a registry key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RequestedAppCategories\8b24b027-1dee-babb-9a95-3517dfb9c552

    I have some other weird hex key numbers down there.

    Jees. They say Linux config files are cryptic! This is insane.




  • Heater. wrote: »
    OK. I found my way into regedit.

    However I do not have a registry key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RequestedAppCategories\8b24b027-1dee-babb-9a95-3517dfb9c552

    I have some other weird hex key numbers down there.

    Jees. They say Linux config files are cryptic! This is insane.

    Did you run into the issue described on that page? I would think that, if you don't have the registry key, you wouldn't run into the problem and it would be a moot point.
  • Heater.Heater. Posts: 21,230
    I don't know what issue.

    And that web page describes some funky registry hacking that I see no reason for.

    My issue is that inside the "winbuntu" subsystem for Windows I cannot see any attached serial devices:
    $ ls /dev -l
    ls: cannot access /dev/lxss: Operation not permitted
    ls: /dev/random: Invalid argument
    total 0
    drwxr-xr-x 2 root    root    0 Apr 15 21:21 block
    lrwxrwxrwx 1 root    root   13 Apr 15 21:21 fd -> /proc/self/fd
    crw------- 1 root    root 0, 0 Apr 16 05:08 kmsg
    c????????? ? ?       ?       ?            ? lxss
    crw-rw-rw- 1 root    root 1, 3 Jan  1  1970 null
    crw-rw-rw- 0 root    tty  5, 2 Apr 15 21:21 ptmx
    drwxr-xr-x 0 root    root    0 Apr 15 21:21 pts
    crw-rw-rw- 1 root    root 1, 8 Apr 16 05:08 random
    lrwxrwxrwx 1 root    root    8 Apr 15 21:21 shm -> /run/shm
    lrwxrwxrwx 1 root    root   15 Apr 15 21:21 stderr -> /proc/self/fd/2
    lrwxrwxrwx 1 root    root   15 Apr 15 21:21 stdin -> /proc/self/fd/0
    lrwxrwxrwx 1 root    root   15 Apr 15 21:21 stdout -> /proc/self/fd/1
    crw------- 1 michael tty  4, 1 Apr 16  2017 tty
    crw-rw-rw- 1 root    tty  4, 0 Apr 16  2017 tty0
    crw------- 1 michael tty  4, 1 Apr 16  2017 tty1
    crw-rw-rw- 1 root    root 1, 9 Apr 16 05:08 urandom
    crw-rw-rw- 1 root    root 0, 0 Apr 16 05:08 zero
    

    But I know my PropPlug is on COM4 and works fine.






Sign In or Register to comment.