On 04/19/2013 11:40 AM, Aleksandar Kuktin wrote:
>> On Fri, 19 Apr 2013 17:25:03 +0200
>> [email protected] wrote:
>>
>> Hey guys!
>> I'm now searched a long while through the net for a information which
>> option in the kernel (compilation) contains the driver for my
>> soundcard (Realtek ALC662), i found nothing. So my question is: Where
>> is a good place to look which deviece needs which kernel
>> configuration.
> Practice.
>
> Option A: enable all drivers for that piece of hardware an
>            then tick them off one-by-one untill you find the one that is
>            required for the device to work.
> Option B: enable all drivers, then use lspci to find the device on your
>            bus and see which driver it uses.
> Option C: compile all drivers as modules and set the module-auto-load
>            option. After booting, use lsmod and lspci to see which
>            driver is used.
>
Here is a bash script to output all kernel drivers (modules).
One can boot to a live dvd and run it and it will tell you the kernel
driver modules for all the hardware that it found.

#!/bin/bash
for i in `find /sys/ -name modalias -exec cat {} \;`; do
     /sbin/modprobe --config /dev/null --show-depends $i ;
done | rev | cut -f 1 -d '/' | rev | sort -u

This one will find the drivers for a given class/device

#!/bin/sh
#
# Find all modules and drivers for a given class device.
#

if [ $# != "1" ] ; then
     echo
     echo "Script to display the drivers and modules for a specified 
sysfs class device"
     echo "usage: $0 <CLASS_NAME>"
     echo
     echo "example usage:"
     echo "      $0 sda"
     echo "Will show all drivers and modules for the sda block device."
     echo
     exit 1
fi

DEV=$1

if test -e "$1"; then
     DEVPATH=$1
else
     # find sysfs device directory for device
     DEVPATH=$(find /sys/class -name "$1" | head -1)
     test -z "$DEVPATH" && DEVPATH=$(find /sys/block -name "$1" | head -1)
     test -z "$DEVPATH" && DEVPATH=$(find /sys/bus -name "$1" | head -1)
     if ! test -e "$DEVPATH"; then
         echo "no device found"
         exit 1
     fi
fi

echo "looking at sysfs device: $DEVPATH"

if test -L "$DEVPATH"; then
     # resolve class device link to device directory
     DEVPATH=$(readlink -f $DEVPATH)
     echo "resolve link to: $DEVPATH"
fi

if test -d "$DEVPATH"; then
     # resolve old-style "device" link to the parent device
     PARENT="$DEVPATH";
     while test "$PARENT" != "/"; do
         if test -L "$PARENT/device"; then
             DEVPATH=$(readlink -f $PARENT/device)
             echo "follow 'device' link to parent: $DEVPATH"
             break
         fi
         PARENT=$(dirname $PARENT)
     done
fi

while test "$DEVPATH" != "/"; do
     DRIVERPATH=
     DRIVER=
     MODULEPATH=
     MODULE=
     if test -e $DEVPATH/driver; then
         DRIVERPATH=$(readlink -f $DEVPATH/driver)
         DRIVER=$(basename $DRIVERPATH)
         echo -n "found driver: $DRIVER"
         if test -e $DRIVERPATH/module; then
             MODULEPATH=$(readlink -f $DRIVERPATH/module)
             MODULE=$(basename $MODULEPATH)
             echo -n " from module: $MODULE"
         fi
         echo
     fi

     DEVPATH=$(dirname $DEVPATH)
done

-- 
http://linuxfromscratch.org/mailman/listinfo/blfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Reply via email to