LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 04-23-2004, 01:53 PM   #1
westcoastangler
LQ Newbie
 
Registered: Apr 2004
Posts: 3

Rep: Reputation: 0
Linux equivelant of hinv?


This may seem like a stupid question but I cannot seem to find a linux version of hinv. Is there one & what is it?

I am trying to find out what devices my machine is actually seeing.

Thanks.
 
Old 04-23-2004, 02:19 PM   #2
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 66
Try looking through "dmesg" and "lspci".
 
Old 04-23-2004, 02:39 PM   #3
Mega Man X
LQ Guru
 
Registered: Apr 2003
Location: ~
Distribution: Ubuntu, FreeBSD, Solaris, DSL
Posts: 5,339

Rep: Reputation: 64
http://linuxshop.ru/linuxbegin/win-l...en/table.shtml
 
Old 04-23-2004, 07:44 PM   #4
comp12345
Member
 
Registered: Feb 2004
Posts: 467

Rep: Reputation: 30
If you do a search under google groups, several people have posted perl scripts that try to replicate hinv. I will just post one that I found to work. There are others if you feel like searching.

Code:
#!/usr/bin/perl -w

#
# hinv v 1.1
# Changes:
#               Fri Nov 28 14:28:31 IST 1997
#       Added support for IDE disks -- Paul Danset (paul@oz.net),
#               Fri Nov 28 14:39:30 IST 1997
#       Changed eth scanning routine to explicitely check for an
#       ethernet-style address in the line. -- Raju Mathur (raju@sgi.com)
#
# Interim maintainer:   Raju Mathur (raju@sgi.com)
#
# Author:               Larry Mcvoy (Where art thou, Larry?) as per last
#                       information received
#
# Try and emulate SGI's hinv command
# We want to figure out the following:
# CPU type, mhz, memory, busses, floppies, disks, tapes, cdroms, ttys,
# networks, graphics.

open(FD, "dmesg|") || die "no dmesg";
while (<FD>) {
        @_ = split;
        if (/^Memory:/) {
                $_[1] =~ s|.*/||;
                $_[1] =~ s|k$||;
                $_[1] /= 1024;
                $mem = "Main memory size: $_[1] Mbytes\n";
        } elsif (/^tty/) {
                $ttys{$_[$#_]}++;
        } elsif (/^Floppy/) {
                $floppy{$_[$#_]}++;
        } elsif (/^FDC /) {
                s/.*is a //;
                chop;
                $fdc{$_}++;
        } elsif (/^scsi : detected/) {
                $scsi = $_;
        } elsif (/^eth\d.* at /) {
                s/\s*at .*:..:..:..:..:.*//;
                push(@eth, $_);
        } elsif (/^hd[a-z].*, /) {
                s/\s*, .*//;
                push(@ide, $_);
        }
}
open(FD, "/proc/cpuinfo");
while (<FD>) {
        @_ = split;
        if (/cpu/) {
                $cpu = $_[$#_];
        }
        if (/vendor/) {
                $cpus{"$_[$#_] $cpu"}++;
        }
}
open(FD, "/proc/ioports");
while (<FD>) {
        if (/kbd/) {
                $kbd++;
        } elsif (/vga/) {
                @_ = split;
                $graphics{$_[$#_]}++;
        }
}

print $mem if (defined $mem);
foreach $key (keys %cpus) {
        print "$cpus{$key} $key processor";
        print $cpus{$key} > 1 ? "s\n" : "\n";
}
foreach $key (keys %ttys) {
        print "$ttys{$key} $key serial port";
        print $ttys{$key} > 1 ? "s\n" : "\n";
}
foreach $key (keys %fdc) {
        print "$fdc{$key} $key floppy controller";
        print $fdc{$key} > 1 ? "s\n" : "\n";
}
foreach $key (keys %floppy) {
        print "$floppy{$key} $key floppy drive";
        print $floppy{$key} > 1 ? "s\n" : "\n";
}
foreach $key (keys %graphics) {
        print "$graphics{$key} $key graphics device";
        print $graphics{$key} > 1 ? "s\n" : "\n";
}
if (defined $kbd) {
        print "$kbd keyboard";
        print $kbd > 1 ? "s\n" : "\n";
}
if ($#ide > -1) {
        $n = $#ide + 1;
        print "$n IDE device";
        print $n > 1 ? "s\n" : "\n";
        foreach $ide (@ide) {
                print "  $ide";
        }
}
if ($#eth > -1) {
        $n = $#eth + 1;
        print "$n ethernet interface";
        print $n > 1 ? "s\n" : "\n";
        foreach $eth (@eth) {
                print "  $eth";
        }
}
if (defined $scsi) {
        $scsi =~ s/.*detected //;
        $scsi =~ s/ total.//;
        print $scsi;
        open(FD, "/proc/scsi/scsi");
        $_ = <FD>;
        while (<FD>) {
                next unless /Vendor/;
                s/.*Vendor:\s*//;
                s/\s*Rev:.*//;
                s/Model:\s*//;
                print "  $_";
        }
}

open(FD, "/proc/pci");
$done = 0;
while (<FD>) {
        if (/^\s*Bus/) {
                if ($done == 0) {
                        print "PCI bus devices:\n";
                        $done++;
                }
                $_ = <FD>;
                print;
        }
}
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Is there an equivelant? mifan Linux - Software 5 08-24-2005 04:38 PM
Direct X Equivelant? golan69 Linux - Software 5 08-06-2004 04:24 PM
linux equivelant to Lotus Screen Cam? salparadise Linux - Software 8 02-16-2004 04:09 PM
Looking for a MASM equivelant... ooagentbender Programming 2 02-07-2004 01:14 AM
Linux equivelant to sndvol32.exe ? shassouneh Linux - Software 3 06-18-2002 05:38 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:47 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration