Bash-based hardware detection for PCI and USB

DISCOVERY SCRIPTS

Article from Issue 60/2005
Author(s):

If you need fast answers for what's inside, you can use a Bash script to obtain an inventory of hardware on your Linux system.

If you operate outside of the mainstream distributions or compile your own Linux system, whether an em-bedded Linux, a rescue system, or just a do-it-yourself distro, you need to solve the issue of finding the right kernel modules for your collection of hardware. Armed with some background know-ledge, you can use almost any programming language to create a system for PCI or USB hardware detection. In this article, I’ll show you a method for obtaining information about devices on your Linux system with a Bash script. Using sysfs or proc, you can find all the information you need about the manufacturer, device, and device class just by asking the kernel.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Hotplugging

    Hardware which just works is what every user wants. Current Linux distributions go a long way to fulfilling that dream. In this article, we will be investigating how the hotplug system works.

  • Udev

    After three years of hanging around on the sidelines, Udev has finally ousted the legacy Dev-FS system. We take a look under the hood at the Udev device management system inside your Linux system.

  • Command Line: Using udev

    Learn how to create your own udev rules and deploy command-line tools to monitor and control udev events to clear your way through the Linux device jungle.

  • Debian Hotplug

    Debian hotplug is designed for little more than loading drivers and configuring devices. The collection of scripts discussed in this article helps Linux to respond when a network cable is plugged in or when a cellphone is in the vicinity. Read on for more on how to define custom hotplug events.

  • Ask Klaus!
comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More

News