-kd- - 2018-05-21

Synapse problem and solution for non standard serial device under linux

Problem:

Using SUNIX serial card the driver creates "/dev/ttySNX0" device.
During Connect 'No such file or directory' error message appear.

This is caused by line 846 (848) in file synaser.pas version 40 (SVN r207).

For this non standard device name "FComNr" become "-2" at line 846 (848)
and "FDevice" replaced by '/dev/ttyS-2' at line 935(937).

----------------- from synaser.pas --------------------
840(842) procedure TBlockSerial.GetComNr(Value: string);
841(843) begin
842(844) FComNr := PortIsClosed;
843(845) if pos('COM', uppercase(Value)) = 1 then
844(846) FComNr := StrToIntdef(copy(Value, 4, Length(Value) - 3), PortIsClosed + 1) - 1;
845(847) if pos('/DEV/TTYS', uppercase(Value)) = 1 then
846(848) FComNr := StrToIntdef(copy(Value, 10, Length(Value) - 9), PortIsClosed - 1);
847(849) end;
...
909(911) procedure TBlockSerial.Connect(comport: string);
...
934(936) if FComNr <> PortIsClosed then
935(937) FDevice := '/dev/ttyS' + IntToStr(FComNr);
------------------------------------------------------

Solution:

Removing "-1" at the end of line 846 (848) correct this problem:

846(848) FComNr := StrToIntdef(copy(Value, 10, Length(Value) - 9), PortIsClosed );

-kd-