3 . /etc/rc.d/init.d/functions
12 echo "$1" | LC_ALL=C tr '[A-Z]' '[a-z]'
15 find_modules_by_class() {
18 # XXX: not sure, which to prefer, /sys or lspci
19 if is_yes "$have_lspci"; then
20 pcimap='modules.pcimap-2.6.33.4-1'
21 lspci='cat lspci-mod-sata.txt'
22 local module vendordev
23 vendordev=$($lspci | awk '/0106/{ gsub(/:/," "); print "0x0000"$4 " " "0x0000"$5}')
24 module=$(grep "$vendordev" "$pcimap" | awk '{print $1}')
28 local path module class="$1"
29 for path in $(grep -l $class $sysfs/bus/pci/devices/*/class); do
30 module=$(readlink ${path%/class}/driver)
32 # 2.6.16 (at least) has this uppercased, workaround
41 find_modules_by_class 0x0101
47 find_modules_by_class 0x0106
51 have_lspci=no sysfs=sysfs find_modules_sata
59 have_lspci=yes find_modules_xata
65 echo "OK: $ok; FAIL: $fail"