Recent

Author Topic: RasPi: How can i detect the actual local IP of the Ethernet Port  (Read 10730 times)

Thaddy

  • Hero Member
  • *****
  • Posts: 16194
  • Censorship about opinions does not belong here.
Re: RasPi: How can i detect the actual local IP of the Ethernet Port
« Reply #15 on: January 20, 2019, 02:36:41 pm »
I thought this was already fixed.....(because I fixed it, I believe)
« Last Edit: January 20, 2019, 02:38:24 pm by Thaddy »
If I smell bad code it usually is bad code and that includes my own code.

af0815

  • Hero Member
  • *****
  • Posts: 1379
Re: RasPi: How can i detect the actual local IP of the Ethernet Port
« Reply #16 on: January 20, 2019, 03:35:09 pm »
I thought this was already fixed.....(because I fixed it, I believe)
In actual fpc trunk (40937), the baudrates for cpuarm not changed. I am on fpc fixes32.

But i think higher bausrates did not work out of the box. If i read the RasPi Forums, you have to use resistors (33 Ohm) and to deal with the cables for higher baudrates. So it have to fixed in synapse.

Edit: http://fw.hardijzer.nl/?p=138 looks like the baud rate is/was limited to 187500 baud. But you have to fiddle with the kernelinformation and more. See the link from 2012.
« Last Edit: January 20, 2019, 03:43:46 pm by af0815 »
regards
Andreas

af0815

  • Hero Member
  • *****
  • Posts: 1379
Re: RasPi: How can i detect the actual local IP of the Ethernet Port
« Reply #17 on: January 20, 2019, 04:05:59 pm »
The is a patch for the arm issu on the Sourceforge Page https://sourceforge.net/p/synalist/bugs/43/ since April 2018 but not applied.

Code: Pascal  [Select][+][-]
  1. --- synaser_r207.pas    2018-04-14 07:16:03.622511742 -0700
  2. +++ synaser.pas 2018-04-14 07:16:38.146908883 -0700
  3. @@ -200,7 +200,11 @@
  4.    {$IFDEF BSD}
  5.    MaxRates = 18;  //MAC
  6.    {$ELSE}
  7. -   MaxRates = 30; //UNIX
  8. +    {$IFDEF CPUARM}
  9. +    MaxRates = 19; //CPUARM
  10. +    {$ELSE}
  11. +    MaxRates = 30; //UNIX
  12. +    {$ENDIF}
  13.    {$ENDIF}
  14.  {$ELSE}
  15.    MaxRates = 19;  //WIN
  16. @@ -229,6 +233,7 @@
  17.  {$IFNDEF BSD}
  18.      ,(460800, B460800)
  19.    {$IFDEF UNIX}
  20. +    {$IFNDEF CPUARM}
  21.      ,(500000, B500000),
  22.      (576000, B576000),
  23.      (921600, B921600),
  24. @@ -240,6 +245,7 @@
  25.      (3000000, B3000000),
  26.      (3500000, B3500000),
  27.      (4000000, B4000000)
  28. +    {$ENDIF}
  29.    {$ENDIF}
  30.  {$ENDIF}
  31.      );
  32.  

regards
Andreas

mdalacu

  • Full Member
  • ***
  • Posts: 233
    • dmSimpleApps
Re: RasPi: How can i detect the actual local IP of the Ethernet Port
« Reply #18 on: September 26, 2023, 09:45:24 am »
I want to detect the actual IP of the Ethernetport. Only the local IP on a RasPi with (actual) Raspbian. Is this possible to to with Pascal or only with a cmdline Tool and parsing the output ?

I have searched, but the found soloutions are only for an extrenal IP or not working on a RasPi with Rasbian.
using indy 10 its as simple as
Code: Pascal  [Select][+][-]
  1.  
  2. uses  IdStack;
  3.  
  4. procedure TForm1.btnRetreiveIPsClick(Sender :TObject);
  5. begin
  6.   TIdStack.IncUsage;
  7.   try
  8.     GStack.AddLocalAddressesToList(ListBox1.Items);
  9.   finally
  10.     TIdStack.DecUsage;
  11.   end;
  12. end;                      
  13.  

PS.
Listbox1.items can be replaced with any TStringlist variable with out any other changes. eg

Code: Pascal  [Select][+][-]
  1. Function RetreiveIPs(Sender :TObject):TStringList;
  2. begin
  3.   Result := TStringList.Create;
  4.   try
  5.     TIdStack.IncUsage;
  6.     try
  7.       GStack.AddLocalAddressesToList(Result);
  8.     finally
  9.       TIdStack.DecUsage;
  10.     end;
  11.   Except
  12.       On E:Exception do begin
  13.         Result.free; //no memory leaks please.
  14.         Raise E;
  15.      end;
  16.   end;
  17. end;                      
  18.  

The most simple and elegant solution!
Thank you!

 

TinyPortal © 2005-2018