Back to index

lshw  02.16
Functions | Variables
pnp.cc File Reference
#include "version.h"
#include "pnp.h"
#include <stdlib.h>
#include <string.h>

Go to the source code of this file.

Functions

 __ID ("@(#) $Id: pnp.cc 2433 2012-01-10 22:01:30Z lyonel $")
const char * vendorname (const char *id)
hw::hwClass pnp_class (const string &pnpid)

Variables

static const char * pnp_vendors []

Function Documentation

__ID ( "@(#) $Id: pnp.cc 2433 2012-01-10 22:01:30Z lyonel $"  )
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 "";
}

Variable Documentation

const char* pnp_vendors[] [static]

Definition at line 17 of file pnp.cc.