[Novalug] Wireless

Russell Evans russell-evans at qwest.net
Sun Jun 3 11:40:26 EDT 2007


On Sun, 3 Jun 2007 09:53:07 -0400
"Ben Creitz" <creitz at gmail.com> wrote:

> > On Sat, Jun 02, 2007 at 10:55:06PM -0400, Dan Arico wrote:
> > > I discovered that my laptop running OpenSUSE 10.2 does not use my
> > > wireless card. The card is seen correctly, but apparently there aren't
> > > any drivers.
> 
> Problems like this beg the question: Is there a straightforward and
> relatively standard way to identify what driver is bound to a given
> device under Linux?  I can eyeball dmesg and find my wireless driver,
> but that's because I know beforehand what I'm looking for.
> 
> I found a trick wherein you look for the IRQ number for a NIC in the
> output of ifconfig, then you look at /proc/interrupts to see the
> driver associated with the device using that interrupt.  In my case, I
> don't see the IRQ given by ifconfig in /proc/interrupts.  I do see
> another interrupt bound to my wifi driver there, but again, I knew in
> advance what I was looking for.
> 
> Is there a more general solution that works for any device provided I
> can properly identify it (maj/min number?)  I want a command like
> this:
> 
> $ devdriver eth1
> $ -->bcm43xx

SuSE has had for a long time used the SuSE tool hwinfo. I believe the only other distribution that has packaged the tool is Debian so Debian and derivatives can install the tool easily.  

hwinfo --network | grep -B3 "Device File"
  SysFS ID: /class/net/lo
  Hardware Class: network interface
  Model: "Loopback network interface"
  Device File: lo
--
  Model: "Ethernet network interface"
  Driver: "e100"
  Driver Modules: "e100"
  Device File: eth0
--
  Model: "Network Interface"
  Driver: "hostap_cs"
  Driver Modules: "hostap_cs"
  Device File: wifi0
--
  Model: "WLAN network interface"
  Driver: "hostap_cs"
  Driver Modules: "hostap_cs"
  Device File: wlan0


To create the utility you wanted,install hwinfo on your machine, copy the following into a file,  save the file as devdriver, chmod +x devdriver, and then run ./devdriver eth1 to make sure it works, then move the script into your path ($HOME/bin should work).

#!/bin/sh
#

### MAIN ###
HELP="${0##*/} [ -i intereface ]"  

while getopts i:h ARG ; do
  case "$ARG" in
    i) INTERFACE="$OPTARG" ;;
    h) echo "$HELP" ; exit 1 ;;
  esac
done

if [ "${INTERFACE}" ] ; then
  hwinfo --network | grep -B3 "Device File: ${INTERFACE}"
else
  echo "$HELP" 
  exit 1
fi
exit 0


Thank you
Russell



More information about the Novalug mailing list