synaser.pas - Detect more serial devices on Linux, return all devices with full name include '/dev/'

git-svn-id: https://svn.code.sf.net/p/synalist/code/trunk@195 7c85be65-684b-0410-a082-b2ed4fbef004
This commit is contained in:
geby 2015-02-14 13:09:51 +00:00
parent b0f8121ce8
commit d167a5f48c

View File

@ -1,9 +1,9 @@
{==============================================================================| {==============================================================================|
| Project : Ararat Synapse | 007.005.006 | | Project : Ararat Synapse | 007.006.000 |
|==============================================================================| |==============================================================================|
| Content: Serial port support | | Content: Serial port support |
|==============================================================================| |==============================================================================|
| Copyright (c)2001-2014, Lukas Gebauer | | Copyright (c)2001-2015, Lukas Gebauer |
| All rights reserved. | | All rights reserved. |
| | | |
| Redistribution and use in source and binary forms, with or without | | Redistribution and use in source and binary forms, with or without |
@ -33,7 +33,7 @@
| DAMAGE. | | DAMAGE. |
|==============================================================================| |==============================================================================|
| The Initial Developer of the Original Code is Lukas Gebauer (Czech Republic).| | The Initial Developer of the Original Code is Lukas Gebauer (Czech Republic).|
| Portions created by Lukas Gebauer are Copyright (c)2001-2014. | | Portions created by Lukas Gebauer are Copyright (c)2001-2015. |
| All Rights Reserved. | | All Rights Reserved. |
|==============================================================================| |==============================================================================|
| Contributor(s): | | Contributor(s): |
@ -2319,13 +2319,29 @@ var
begin begin
Result := ''; Result := '';
if FindFirst('/dev/ttyS*', $FFFFFFFF, sr) = 0 then if FindFirst('/dev/ttyS*', $FFFFFFFF, sr) = 0 then
begin
repeat repeat
if (sr.Attr and $FFFFFFFF) = Sr.Attr then if (sr.Attr and $FFFFFFFF) = Sr.Attr then
begin begin
if Result <> '' then if Result <> '' then
Result := Result + ','; Result := Result + ',';
Result := Result + sr.Name; Result := Result + '/dev/' + sr.Name;
end;
until FindNext(sr) <> 0;
FindClose(sr);
if FindFirst('/dev/ttyUSB*', $FFFFFFFF, sr) = 0 then begin
repeat
if (sr.Attr and $FFFFFFFF) = Sr.Attr then begin
if Result <> '' then Result := Result + ',';
Result := Result + '/dev/' + sr.Name;
end;
until FindNext(sr) <> 0;
end;
FindClose(sr);
if FindFirst('/dev/ttyAM*', $FFFFFFFF, sr) = 0 then begin
repeat
if (sr.Attr and $FFFFFFFF) = Sr.Attr then begin
if Result <> '' then Result := Result + ',';
Result := Result + '/dev/' + sr.Name;
end; end;
until FindNext(sr) <> 0; until FindNext(sr) <> 0;
end; end;