Sign in Join

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

Mailing lists / fpc-pascal / 2010-01

Hardware information: Linux and Windows

4 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

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

Osvaldo Filho

How do I get information about the hardware in Linux and Windows?
- Identification of the processor: model, manufacturer, serial number
- Identification of Hard Disk: model, manufacturer, physical serial number
- Identification of Memory: model, manufacturer, size, type
- Identification of Motherboard: model, manufacturer

Reply by email

Frank Peelo
to Osvaldo Filho
Osvaldo Filho wrote
How do I get information about the hardware in Linux and Windows? - Identification of the processor: model, manufacturer, serial number

Reading /proc/cpuinfo will give you the model and manufacturer. Don't know how to get the serial number. Was that not a controversial feature that was added by Intel and then removed because people complained?

- Identification of Hard Disk: model, manufacturer, physical serial number

Parsing the output of
hdparm -i /dev/hda
might get you something useful, if your hard drive is /dev/hda. You'd have to be root, though. And hdparm might not be installed. But I'm sure Google can point you at its source code.

- Identification of Memory: model, manufacturer, size, type

/proc/meminfo should give you the size.

- Identification of Motherboard: model, manufacturer

Don't know.

Looking forward to someone more knowledgable giving better info :)

FP

Reply by email

David Emerson
to Osvaldo Filho: How do I get information about the hardware in Linux and Windows? - Identification of the…

in linux... just google list hardware linux. Below are some results. Probably not all of them will be available, but you should be able to work with whatever is available on your machine.

lshal
lshw
lspci
lsusb
lsscsi
systool
fdisk -l
dmidecode
cat /proc/cpuinfo
cat /proc/meminfo

dmesg | egrep ‘(SCSI|scsi0|ide0|hd[a-z]|sd[a-z]|serio|mice|eth[0-9])’

~David.

Osvaldo Filho wrote
How do I get information about the hardware in Linux and Windows? - Identification of the processor: model, manufacturer, serial number - Identification of Hard Disk: model, manufacturer, physical serial

number

Show quoted text 6 lines
- Identification of Memory: model, manufacturer, size, type - Identification of Motherboard: model, manufacturer _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply by email

Mark Morgan Lloyd
to Osvaldo Filho: How do I get information about the hardware in Linux and Windows? - Identification of the…
Osvaldo Filho wrote
How do I get information about the hardware in Linux and Windows? - Identification of the processor: model, manufacturer, serial number

That depends very much on the type of the processor, i.e. whether it's x86, ARM and so on. On x86 the info is available from processor registers, on Linux you can use /proc/cpuinfo (noting that the format of this depends on processor type and the whim of the kernel developers).

- Identification of Hard Disk: model, manufacturer, physical serial number

With difficulty on Linux. I see that somebody has suggested dmesg|grep but that won't be reliable if something's trickling messages into the kernel buffer that eventually flush out the boot stuff.

- Identification of Memory: model, manufacturer, size, type

In general depends on the chipset. To get this info reliably you need to access the serial bus that runs to each DIMM to get its parameters, and then you need to know how to decode them.

- Identification of Motherboard: model, manufacturer

With extreme difficulty. On Linux there might possibly be info in /proc/acpi, /proc/openprom etc. but again it depends very much on the architecture, kernel version and so on. A good place to start is looking at lspci or /proc/bus/pci, you should find that most models of computer have a distinct arrangement of devices and with modest expenditure of effort you should be able to characterise each one :-)

Again, there's a whole lot of stuff that you can get by parsing dmesg output on Linux. However that's basically debugging info from the kernel as it starts and if it's not also presented in /proc, /sys or /dev then it might only be available for a limited time.

Sorry I can't say more about Windows, Solaris, or the other OSes that FPC supports.

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email