Модератор: Модераторы
a) grep serial /proc/ioports
b) cat /proc/tty/driver/serial
c) dmesg | grep ttyS
d) setserial -g /dev/ttyS[0-9] | grep -v unknownprogram launchprogram;
 
// Here we include files that have useful functions
// and procedures we will need.
uses 
  Classes, SysUtils, Process;
 
// This is defining the var "AProcess" as a variable 
// of the type "TProcess"
// Also now we are adding a TStringList to store the 
// data read from the programs output.
var 
  AProcess: TProcess;
  AStringList: TStringList;
 
// This is where our program starts to run
begin
  // Now we will create the TProcess object, and
  // assign it to the var AProcess.
  AProcess := TProcess.Create(nil);
 
  // Tell the new AProcess what the command to execute is.
  AProcess.Executable := '/usr/bin/ppc386'; 
  AProcess.Parameters.Add('-h'); 
 
  // We will define an option for when the program
  // is run. This option will make sure that our program
  // does not continue until the program we will launch
  // has stopped running. Also now we will tell it that
  // we want to read the output of the file.
  AProcess.Options := AProcess.Options + [poWaitOnExit, poUsePipes];
 
  // Now that AProcess knows what the commandline is it can be run.
  AProcess.Execute;
 
  // After AProcess has finished, the rest of the program will be executed.
 
  // Now read the output of the program we just ran into a TStringList.
  AStringList := TStringList.Create;
  AStringList.LoadFromStream(AProcess.Output);
 
  // Save the output to a file and clean up the TStringList.
  AStringList.SaveToFile('output.txt');
  AStringList.Free;
 
  // Now that the output from the process is processed, it can be freed.
  AProcess.Free;   
end.{ for Linux }
procedure TForm1.Read_port_list;
var
    Info : TSearchRec;
    Count : Longint;
    begin
       ComboBox1.Items.Clear;
       Count := 0;
       if FindFirst('/dev/tty???*', faAnyFile, Info)=0 then
         begin
           repeat
             inc(Count);
             with Info do
                begin
                  Memo1.Lines.Add(Name);
                  ComboBox1.Items.Add(Name);
                end
           until FindNext(Info)<>0 ;
         end;
       FindClose(Info);
    end;tema писал(а):Думаю проще всего через команду. Варианты, например:
Var
  t:text;
begin
  assign(t,'/proc/ioports');
..Var s:TStringList;
begin
s:=TStringList.Create();
s.LoadFromFile('/proc/ioports');olegy123 писал(а):tema писал(а):Думаю проще всего через команду. Варианты, например:
Зачем вы так усложнили?
все три первые - решение через чтения файла..
- Код: Выделить всё
Var
t:text;
begin
assign(t,'/proc/ioports');
..
проще
- Код: Выделить всё
Var s:TStringList;
begin
s:=TStringList.Create();
s.LoadFromFile('/proc/ioports');

alien308 писал(а):P. S. Вы ничего не видите, потому что Arduino не подсоединили! Так и задумано.
Вернуться в Free Pascal Compiler
Сейчас этот форум просматривают: Google [Bot] и гости: 1