GithubHelp home page GithubHelp logo

golightlyb / pnp-id Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 1.0 151 KB

given a PNP (Plug and Play) industry-unique Vendor ID, return the Vendor name

Python 1.59% C 98.22% Shell 0.20%
plug-and-play pnp spec vendor device-detection hardware-information edid uefi-specifications

pnp-id's Introduction

README

"Given a PNP (Plug and Play) industry-unique Vendor ID, return the Vendor name"

This is free-to-use C code that, given a PNP (Plug and Play) industry-unique Vendor ID, returns the Vendor name. You might find this ID when querying Computer Monitor EDID.

This file contains a script, update.sh to automatically download the PNP ID REGISTRY from the UEFI Forum body, and generate and compile a C program and a test binary. The C program uses a binary search to efficiently resolve a PNP Vendor ID to the Vendor name.

If you're writing code for Linux, the proper way to do this is with libudev. But! If you're writing cross platform code / udev might not be available / this is all you need / want to keep things simple... this'll do it! :)

Features:

  • Exhaustively tested
  • Efficient binary search lookup

Optional requirements:

These are only needed if you want to download the latest list from the UEFI Forum body and use it to generate updated C code.

  • python3
  • gnumeric for ssconvert (xls -> csv)

Usage Example:

// gcc -std=c99 -Wall -Wextra pnpid.c example.c -o examplebin

// function prototype
const char *pnp_name(const char *key);

int main(void)
{
    const char *id = "SAM";
    const char *name = pnp_name(id);

    if (name == NULL)
    {
        printf("Couldn't find the name for PNP ID %s", id);
    }
    else
    {
        printf("%s => %s\n", id, name);
        // prints SAM => Samsung Electric Company
    }
}

License

Author: Ben Golightly [email protected]

I believe the generated file should be free to use. The UEFI Forum states:

"There is no charge for use of the specification itself. The promoters of UEFI specifications have agreed that any IP needed to implement the specification will be made available on reasonable and non-discriminatory terms."

pnp-id's People

Contributors

golightlyb avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.