Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2011-10

Getting Hardware information in Linux

9 messages · 7 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

ik

Hello list,

I'm trying to figure out how to get hardware information about the machine i'm running at in Linux OS.
For example: hard-drive size, manufacture etc...
BIOS information, screen information (regardless of X, that is the hardware itself), cards that are assigned and the whole information about such cards. Disks of any kind etc... CPU Information (can use the /proc/cpuinfo)

Does anyone know or can point me on how to do it ?

Thanks,
Ido

LINESIP - Opening the source for communication
http://www.linesip.com
http://www.linesip.co.il

Michael Van Canneyt
to ik
ik wrote 9 lines
Hello list, I'm trying to figure out how to get hardware information about the machine i'm running at in Linux OS. For example: hard-drive size, manufacture etc... BIOS information, screen information (regardless of X, that is the hardware itself), cards that are assigned and the whole information about such cards. Disks of any kind etc... CPU Information (can use the /proc/cpuinfo) Does anyone know or can point me on how to do it ?

use DBUS to query HAL. Normally you should get most of the info.

I wrote an article on how to do this in FPC. if you want, I can send it to you.

Michael.

ik
to Michael Van Canneyt
Michael Van Canneyt wrote 19 lines
On Tue, 18 Oct 2011, ik wrote: Hello list, > > I'm trying to figure out how to get hardware information about the machine > i'm running at in Linux OS. > For example: hard-drive size, manufacture etc... > BIOS information, screen information (regardless of X, that is the > hardware itself), cards that are assigned and the > whole information about such cards. > Disks of any kind etc... CPU Information (can use the /proc/cpuinfo) > > Does anyone know or can point me on how to do it ? > use DBUS to query HAL. Normally you should get most of the info.

HAL is deprecated :(

I wrote an article on how to do this in FPC. if you want, I can send it to you.

Sure, it can help me, thanks.

Show quoted text 6 lines
Michael. ______________________________**_________________ fpc-pascal maillist - http://lists.freepascal.org/**mailman/listinfo/fpc-pascal<http://lists.freepascal.org/mailman/listinfo/fpc-pascal>

Ido

Sven Barth
to ik
ik wrote 24 lines
On Tue, Oct 18, 2011 at 21:44, Michael Van Canneyt < > wrote: On Tue, 18 Oct 2011, ik wrote: Hello list, I'm trying to figure out how to get hardware information about the machine i'm running at in Linux OS. For example: hard-drive size, manufacture etc... BIOS information, screen information (regardless of X, that is the hardware itself), cards that are assigned and the whole information about such cards. Disks of any kind etc... CPU Information (can use the /proc/cpuinfo) Does anyone know or can point me on how to do it ? use DBUS to query HAL. Normally you should get most of the info. HAL is deprecated :(

You can then take a look at its successor, DeviceKit (see here: http://en.wikipedia.org/wiki/DeviceKit ). According to the wiki entry you might also try to take a look at "libudev". I've found a guide here: http://www.signal11.us/oss/udev/ (I haven't read it and thus can't say whether it's good or not).

Regards,
Sven

Jorge Aldo G. de F. Junior
to ik: I'm trying to figure out how to get hardware information about the machine i'm running at…

I think all this info can be found on /proc directory...

2011/10/18 ik :

Show quoted text 25 lines
Hello list, I'm trying to figure out how to get hardware information about the machine i'm running at in Linux OS. For example: hard-drive size, manufacture etc... BIOS information, screen information (regardless of X, that is the hardware itself), cards that are assigned and the whole information about such cards. Disks of any kind etc... CPU Information (can use the /proc/cpuinfo) Does anyone know or can point me on how to do it ? Thanks, Ido LINESIP - Opening the source for communication http://www.linesip.com http://www.linesip.co.il _______________________________________________ fpc-pascal maillist  -   http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Graeme Geldenhuys
to Michael Van Canneyt: use DBUS to query HAL. Normally you should get most of the info. I wrote an article on…
Michael Van Canneyt wrote
use DBUS to query HAL. Normally you should get most of the info. I wrote an article on how to do this in FPC. if you want, I can send it to you.

Would you mind sending me that article too, please.

I'm using Turbo Power's OnGuard in our products, and improved the hardware detection code under Linux (CPU, network card, OS, user, HDD etc), but I did not use DBUS at all, I simply parsed the data in /proc/* and /dev/disk/*

The hard drive make and serial number was a tough one, especially without forcing root access, but I did manage. I also asked in the mailing list about other distros and if they have the same /dev/disk/* information, and most modern Linux distros did.

Regards,
- Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/
Graeme Geldenhuys
to Den Jean: read the output of lshw or read its source on how to do it yourself.
Den Jean wrote
read the output of lshw or read its source on how to do it yourself.

problems with that is that to get most of the information you must run lshw as super-user (root).

eg: Serial numbers, product codes, vendor names etc are all missing from the output if you don't run it as root. :-(

I guess Linux takes security really serious when it comes to hardware information.

Regards,
- Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/