Re: hinv (hardware inventory)

Malcolm Beattie (
Thu, 25 Sep 1997 10:43:27 +0100 (BST)

Larry McVoy writes:
> This is a poor man's copy of hinv. Please try it and send me patches. If it
> gets good enough maybe the distributions will pick it up.

You've commented out the floppy controller counter in the main program:
but it's still present in the commented examples.
The floppy drive counter doesn't work for more than one floppy disk.
The dmesg output is of the form:

Floppy drive(s): fd0 is 1.44M, fd1 is 1.2M

but you only ever pick up the last word on the line. Here's a patch:
------------------------------ cut here ------------------------------
--- hinv.ORI Thu Sep 25 10:27:34 1997
+++ hinv Thu Sep 25 10:35:30 1997
@@ -67,7 +67,7 @@
} elsif (/^tty/) {
} elsif (/^Floppy/) {
- $floppy{$_[$#_]}++;
+ $floppy{$1}++ while /is ([\w.]+)/g;
} elsif (/^hd(.): /) {
$which = $1;
s/hd.: //;
------------------------------ cut here ------------------------------

It also doesn't pick up devices whose drivers are loaded as modules
(unless there's both no /var/log/dmesg and the real dmesg buffer
hasn't lost the module load line off the top). This will prevent
picking up ethernet cards which are typically both popular and
loaded as modules. Nevertheless, it's a good and useful start.


Malcolm Beattie <>
Unix Systems Programmer
Oxford University Computing Services