Ignore:
Timestamp:
Aug 20, 2012, 8:32:04 AM (12 years ago)
Author:
chronos
Message:
  • Fixed: Serial COM port enumeration on Windows.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • PinConnection/USerialPort.pas

    r409 r415  
    88  Classes, SysUtils, SynaSer, StdCtrls, Dialogs, UCommon, UThreading,
    99  DateUtils, FileUtil, SpecializedList;
     10
     11const
     12  MaxPort = 255;
    1013
    1114type
     
    180183  try
    181184    TestPort := TSerialPort.Create;
    182     for I := 0 to Strings.Count - 1 do
     185    for I := 0 to MaxPort - 1 do
    183186    with TestPort do begin
    184       Name := Strings[I];
     187      Name := 'COM' + IntToStr(I);
    185188      Active := True;
    186189      if Active then begin
    187         Strings.AddObject(Name, TObject(I));
     190        Strings.AddObject(Name, nil);
    188191      end;
    189192      Active := False;
     
    192195    TestPort.Free;
    193196  end else begin
    194     for I := 1 to 255 do
     197    for I := 1 to MaxPort do
    195198      Strings.AddObject('COM' + IntToStr(I), nil);
    196199  end;
    197200  {$ENDIF}
    198201  {$IFDEF Linux}
    199   if Check then begin
     202  if Check then
     203  try
    200204    Files := FindAllFiles('/dev', 'tty*', False);
    201205    Strings.Assign(Files);
     206  finally
    202207    Files.Free;
    203208  end else begin
Note: See TracChangeset for help on using the changeset viewer.