avo has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I was just wandering what is the easiest way to get a list of all (possible) hardware vendors in a computer. Mainly the network adapters. For instance in windows you can see that by running getmac /v for the network cards and through WMI for the rest. I am writing simple function to recognize whether the hardware or the computer is changing... Under Windows I was using the mentioned getmac and detecting a PC change by comparing the result of that command ie. the list of hardware vendors for the network card(s).

Any help is highly appreciated.

Thanks a lot.

Replies are listed 'Best First'.
Re: list hardware vendors in linux
by Joost (Canon) on Jun 25, 2007 at 20:58 UTC
    This isn't a perl question, but...

    On linux you can run lspci for a list of the pci and pci-like cards and extensions on your machine, including vendors. Also, lsusb lists some vendor information for connected usb devices.

    Then there are some possibly interesting virtual files in /proc. For instance /proc/cpuinfo gives a lot of details about installed CPUs.

    update: more specifically there are some numerical codes in

    /sys/class/net/*/device/vendor /sys/class/net/*/device/subsystem_vendor
    But you'll have to find out which vendor is which from someone else. :-)

      And if you want to know how to link codes with vendors and products names, see http://pciids.sf.net for an up-to-date list.
      Thanks, sorry for posting it here :) but because I am not sure where to find a good Linux discussion like this Perl one, I decided to ask here. I will anyway use Perl as a back-end to whatever tool / script I decide to use.
      Thanks for the fast reply!
      Highly appreciated!
        Linux forums all devolve into "The reason you can't do x is because you're on y" or "Microsoft problem" or "if you were a real linux geek, you'd code the driver yourself!" This forum is certainly more friendly. There's probably a better category than SOPW to put it in, though.
Re: list hardware vendors in linux
by jfroebe (Parson) on Jun 25, 2007 at 20:58 UTC
Re: list hardware vendors in linux
by tirwhan (Abbot) on Jun 26, 2007 at 08:49 UTC

    For finding the vendor of a network card, look up the cards MAC address (using the system command ifconfig for example) and use Net::MAC::Vendor to find the vendor. For other hardware use lspci or possibly lsusb (for USB devices), hdparm (for IDE drives) or scsiinfo (for SCSI drives).


    All dogma is stupid.