microsoft / WSL

Issues found on WSL
https://docs.microsoft.com/windows/wsl
MIT License
17.54k stars 823 forks source link

Error with rshell & serial ports #3668

Closed CedricMi closed 10 months ago

CedricMi commented 6 years ago

Please fill out the below information:

But with rshell (https://github.com/dhylands/rshell) rshell --port /dev/ttyS3 Connecting to /dev/ttyS3 ... Welcome to rshell. Use Control-D (or the exit command) to exit rshell. /home/cedric> Exception in thread AutoConnect: Traceback (most recent call last): File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner self.run() File "/usr/lib/python3.6/threading.py", line 864, in run self._target(*self._args, **self._kwargs) File "/usr/local/lib/python3.6/dist-packages/rshell/main.py", line 256, in autoconnect_thread monitor.filter_by('tty') File "/usr/local/lib/python3.6/dist-packages/pyudev/monitor.py", line 172, in filter_by self._libudev.udev_monitor_filter_update(self) File "/usr/local/lib/python3.6/dist-packages/pyudev/_ctypeslib/_errorcheckers.py", line 91, in check_errno_on_nonzero_return raise exception_from_errno(errnum) ValueError: Invalid argument

I suspect this is because of the non-linux way of naming ports.

therealkenc commented 6 years ago

Going to need a the threaded strace(1) log at a minimum, since no one here has a "ESP8266 chip on a Witty Cloud" (my cloud hasn't said anything clever recently). Also would be worth stepping back to first principles and see if you can stty(1) and echo(1) to your /dev/ttyS3. It isn't clear from the OP whether we're talking about a rshell fail or whether your serial tty is just not working in WSL. This hint doesn't bode well though:

File "/usr/local/lib/python3.6/dist-packages/pyudev/monitor.py", line 172, in filter_by
self._libudev.udev_monitor_filter_update(self)

WSL doesn't have a functioning udev (though some parts are stubbed) so it might be choking on that. An strace would tell more.

CedricMi commented 6 years ago

stty cedric@SPRO-CM:~$ stty -F /dev/ttyS3 -a speed 1200 baud; rows 0; columns 0; line = 0; intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = <undef>; eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; discard = ^O; min = 1; time = 0; -parenb -parodd -cmspar cs7 hupcl -cstopb cread clocal -crtscts -ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl -ixon -ixoff -iuclc -ixany -imaxbel -iutf8 opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0 isig icanon iexten -echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke -flusho -extproc cedric@SPRO-CM:~$

echo It works

strace https://gist.github.com/CedricMi/15fadee34ef08a63ed631be1cda761da

Note: after the error message I waited a little to see if anything happens, then pressed Ctrl-D to exit rshell.

An overview of the Witty Cloud Board https://www.faranux.com/product/witty-cloud-board/

sebi5361 commented 5 years ago

Try: sudo rshell Then under rshell prompt: connect serial /dev/ttyS3 Worked for me~~

therealkenc commented 3 years ago

Thank-you for the strace(1) logs. There are a couple of EINVALs in there:

setsockopt(8, SOL_SOCKET, SO_PASSCRED, [1], 4) = -1 EINVAL (Invalid argument)
setsockopt(8, SOL_SOCKET, SO_ATTACH_FILTER, {len=8, filter=0x7ff84693de80}, 16) = -1 EINVAL (Invalid argument)

The first is an AF_UNIX socket. The second is an AF_NETLINK socket. Not sure which one is the fatal blow. Both syscalls will be better on WSL2. WSL2 currently lacks support for /dev/ttyS?. RS-232 on WSL2 is LZ #4322

microsoft-github-policy-service[bot] commented 10 months ago

This issue has been automatically closed since it has not had any activity for the past year. If you're still experiencing this issue please re-file this as a new issue or feature request.

Thank you!