Back to index

lshw  02.16
Functions
pnp.h File Reference
#include "hw.h"
#include <string>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

const char * vendorname (const char *id)
hw::hwClass pnp_class (const string &pnpid)

Function Documentation

hw::hwClass pnp_class ( const string &  pnpid)

Definition at line 109 of file pnp.cc.

{
  long numericid = 0;

  if (pnpid.substr(0, 3) != "PNP")
    return hw::generic;

  numericid = strtol(pnpid.substr(3).c_str(), NULL, 16);

  if (numericid < 0x0300)
    return hw::system;
  if (numericid >= 0x300 && numericid < 0x0400)
    return hw::input;                             // keyboards
  if (numericid >= 0x400 && numericid < 0x0500)
    return hw::printer;                           // parallel
  if (numericid >= 0x500 && numericid < 0x0600)
    return hw::communication;                     // serial
  if (numericid >= 0x600 && numericid < 0x0800)
    return hw::storage;                           // ide
  if (numericid >= 0x900 && numericid < 0x0A00)
    return hw::display;                           // vga
  if (numericid == 0x802)
    return hw::multimedia;                        // Microsoft Sound System compatible device
  if (numericid >= 0xA00 && numericid < 0x0B00)
    return hw::bridge;                            // isa,pci...
  if (numericid >= 0xE00 && numericid < 0x0F00)
    return hw::bridge;                            // pcmcia
  if (numericid >= 0xF00 && numericid < 0x1000)
    return hw::input;                             // mice
  if (numericid < 0x8000)
    return hw::system;

  if (numericid >= 0x8000 && numericid < 0x9000)
    return hw::network;                           // network
  if (numericid >= 0xA000 && numericid < 0xB000)
    return hw::storage;                           // scsi&cd
  if (numericid >= 0xB000 && numericid < 0xC000)
    return hw::multimedia;                        // multimedia
  if (numericid >= 0xC000 && numericid < 0xD000)
    return hw::communication;                     // modems

  return hw::generic;
}
const char* vendorname ( const char *  id)

Definition at line 92 of file pnp.cc.

{
  int i = 0;
  if (id == NULL)
    return "";

  while (pnp_vendors[i])
  {
    if (strncmp(pnp_vendors[i], id, strlen(pnp_vendors[i])) == 0)
      return pnp_vendors[i + 1];
    i += 2;
  }

  return "";
}