Giter VIP home page Giter VIP logo

pciutils_rb's Introduction

OVERVIEW

pciutils is a Linux wrapper for libpci and libpciaccess, written in the C-Ruby API, and it provides the ability to access data about PCI devices on the system. The output is uniform and can allow for the data to be used in other programs, such as attaching PCI information to objects with data that is otherwise unrelated and extracted via some other means -- for example combining PCI device information with lmsensors values of a graphics card or processor.

This interface allows for filtering by types and exports the base-type definitions from the C-side (such as PCI_BASE_CLASS_MULTIMEDIA -> PciUtils::PCI_MEDIA [which would include PCI devices, such as audio cards, for example]).

NOTES

The information is made to emulate the Linux command, lspci. Most of the information is able to be acquired from the C-side of the code and, therefore, incurs very little overhead, even with a full, unfiltered device listing. However, driver information is mapped from the devices generated there, to the data in /proc/bus/pci/devices. Still incurring lower overhead than mapping the text to be parsed from a shell call, this can be run as needed.

Because the information does not need to be refreshed for every device, with new data on every call, this library utilizes a Singleton approach and caches the data in PciUtils::Cache, which inherits the abstract class, PciCore::AbsPci, but updates can and should be performed every-so-often, if devices are likely to be added or removed from the system, or else if drivers may be swapped in and out (e.g.: an Open-Source graphics driver for games with a proprietary professional rendering or AI/ML driver).

Generally speaking, the update process is not necessary during a single run, for most use cases, but some hot-swap devices may benefit from it, so looping the update on a Thread or Ractor in the host program, every several seconds, is probably more than enough.

INSTALLATION

This library requires Ruby extensions to be built natively, so you will need to install the package on your system correlating to ruby-dev. It also requires additional headers from libpci and libpciaccess, which can usually be installed like:

# Debian, Ubuntu, Mint, etc.
sudo apt install libpci-dev libpciaccess-dev ruby-dev libmruby-dev

# Fedora, RHEL, CentOS, etc.
sudo [yum, dnf] install libpci-devel libpciaccess-devel ruby-devel[-version]

# Arch, etc.
# Ruby libs are included with a Ruby environment,
# and libpci appears to come with pciutils.
sudo [pacman, yay] -Sy libpciaccess pciutils

TO-DO

pciutils_rb's People

Contributors

kleineedelweiss avatar

Watchers

 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.