Hi all,

I have a USB based serial port device (/dev/ttySxx) which does not work when
beeing used with cygwin programs (e.g. getty or even python).

It seems this is because the baudrate is initially zero after the device
has been created:

  $ /cygdrive/c/Windows/System32/mode.com COM72
  Status von Gerät COM72:
  -----------------------
      Baudrate:        0
      Parität:         None
      Datenbits:       0
      Stoppbits:       1
      Timeout:       OFF
      XON/XOFF:        OFF
      CTS-Handshaking: OFF
      DSR-Handshaking: OFF
      DSR-Prüfung:     OFF
      DTR-Signal:      OFF
      RTS-Signal:      ON

This makes tcgetattr fail when beeing used on this device.

  119  117652 [main] stty 2325 fcntl: 0 = fcntl(0, 4, 0x10000)
  732  118384 [main] stty 2325 fhandler_serial::tcgetattr: Invalid baud rate 0
  111  118495 [main] stty 2325 __set_errno: virtual int 
fhandler_serial::tcgetattr(termios*):1027 setting errno 22
  116  118611 [main] stty 2325 tcgetattr: -1 = tcgetattr(0, 0x100419060), errno 
22

I assume that allmost all programs use tcgetattr before partially changing
parameters in the struct that is returned.

I suggest not to make tcgetattr fail in this case, but return B0 instead. User 
programs
will most likely change the bitrate setting anyhow.

After setting an initial baudrate with mode.com, the device works well with 
cygwin.

Regards,
Stefan Althöfer

-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

Reply via email to