How can I use COM and USB ports within Cygwin?

好久不见. 提交于 2019-12-05 01:23:58

If Hyperterminal can access it, then it's installed as a "virtual COM port". Cygwin will let you access it as /dev/ttyS26 (called COM27 by Windows). You may still have an issue with the input blocking until a CR is received--I do. (Trying to solve that, is how I found this.)

Tomasz Janicki

My fav is

socat.exe `tty`,raw,echo=0 /dev/ttyS15,raw,echo=0,setsid,sane

it is COM16 (already setup by Windows to 115200, noparity, no-flow, 8b)

you need:

tty and socat


socat.exe - /dev/ttyS15,raw,echo=0,setsid,sane

Probably will also work (no tty package then), or just simply specify the dev node of the current terminal (might be tricky without tty package)

tty - print the file name of the terminal connected to standard input

my fav links:

  1. Using socat for raw serial connection
  2. https://superuser.com/questions/123790/socat-and-rich-terminals-with-ctrlc-ctrlz-ctrld-propagation

U have better options? Then please refine.

U can use:

stty -F /dev/ttyS15 115200 cs8

to set ur COM

TJ

Serial ports in windows are mapped to cygwin as:

COM -> /dev/ttyS

For example COM3 -> /dev/ttyS2

The example.py can be rewritten for opening COM3 as:

import serial
ser = serial.Serial()
ser.baudrate = 9600
ser.port = "/dev/ttyS2"
ser
ser.open()
ser.isOpen()
Thomas

If you are using a laptop without a COM port, you can't open this port and start make operations.

In Windows, there is a function to open this port and change the state of some line (RST), read states and make the transmission. For an LPT port you can't do it in Windows, you have to use some library. For USB it is also problem, you must know the device connected to USB.

I found Brad Grantham's tool VERY useful and have been using it extensively at work. It is so easy to build and use.

I am just posting here to mention that I fixed a bug in it where it would exit if you typed tilde, some other text, then a dot. So for example typing:

vim ~/.tmux.confwould eject you from the serial session.

You can find it here: https://github.com/lime45/serial

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!