We Recommend

bash Cookbook: Solutions and Examples for bash Users bash Cookbook: Solutions and Examples for bash Users
bash Cookbook teaches shell scripting the way Unix masters practice the craft. It presents a variety of recipes and tricks for all levels of shell programmers so that anyone can become a proficient user of the most common Unix shell -- the bash shell -- and cygwin or other popular Unix emulation packages.


Posted By

Juanje on 05/08/08


Tagged

linux MODULES hardware kernel


Versions (?)


Who likes this?

1 person has marked this snippet as a favorite

alexxx


Get the linux modules for our pci devices


Published in: Bash 


  1. # search modules for pci devices
  2. get_pci_modules () {
  3. while read IGNORE ID IGNORE
  4. do
  5. VENDOR=`echo $ID | cut -b1-4`
  6. DEVICE=`echo $ID | cut -b5-8`
  7. DEVENTRY=`echo 0x0000${VENDOR} 0x0000${DEVICE}`
  8. cat /lib/modules/`uname -r`/*.pcimap | grep "$DEVENTRY" | cut -d ' ' -f1
  9. done
  10. }
  11.  
  12. for MODULE in `get_pci_modules < /proc/bus/pci/devices | sort -u` ; do
  13. echo $MODULE
  14. done

Report this snippet 

You need to login to post a comment.