[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#224745: hw-detect: Reports errors for sd_mod and sr_mod when support is compiled statically into the kernel



On Mon, Dec 22, 2003 at 12:58:03AM +0100, Karsten Merker wrote:

> [patch snipped]
> 
> Unfortunately the patch does not work fully as expected.
> It worked on the machines it was tested on originally, but those
> had both SCSI disks as well as SCSI CDROMs. It looks as if
> /proc/devices lists the device driver entry only for device
> classes of which at least one device is attached.
> So if e.g. the SCSI CDROM driver is compiled in but no SCSI
> CDROM is attached, sr is not listed in /proc/devices.
> 
> Therefore the patch is not really suitable to solve the problem.

Here is a patch which takes care of this case as well.

Index: debian-installer/tools/ddetect/hw-detect.sh
===================================================================
RCS file: /cvsroot/d-i/debian-installer/tools/ddetect/hw-detect.sh,v
retrieving revision 1.43
diff -u -p -r1.43 hw-detect.sh
--- debian-installer/tools/ddetect/hw-detect.sh	19 Dec 2003 04:06:27 -0000	1.43
+++ debian-installer/tools/ddetect/hw-detect.sh	22 Dec 2003 19:15:20 -0000
@@ -17,7 +17,7 @@ log () {
 }
 
 is_not_loaded() {
-    module="$1"
+    local module="$1"
     if cut -d" " -f1 /proc/modules | grep -q "^${module}\$" ; then
 	false
     else
@@ -26,7 +26,7 @@ is_not_loaded() {
 }
 
 load_module() {
-    module="$1"
+    local module="$1"
     db_fset hw-detect/module_params seen false
     db_subst hw-detect/module_params MODULE "$module"
     db_input low hw-detect/module_params || [ $? -eq 30 ]
@@ -218,12 +218,24 @@ if [ -e /proc/scsi/scsi ] ; then
     if grep -q "Attached devices: none" /proc/scsi/scsi ; then
         :
     else
-	for module in sd_mod sr_mod; do
-		if is_not_loaded "$module" ; then
-			load_modules $module
-			register-module $module
+    	if grep -q "Type:.*Direct-Access" /proc/scsi/scsi ; then
+	    if is_not_loaded "sd_mod" ; then
+		if [ "$(cat /proc/devices | sed -e 's/[^[:alpha:]]*//' |grep sd|head -n 1)" = "sd" ]; then
+		    log "Module sd_mod is compiled in statically"
+		else
+		    load_modules sd_mod
 		fi
-	done
+	    fi
+	fi
+    	if grep -q "Type:.*CD-ROM" /proc/scsi/scsi ; then
+	    if is_not_loaded "sr_mod" ; then
+		if [ "$(cat /proc/devices | sed -e 's/[^[:alpha:]]*//' |grep sr|head -n 1)" = "sr" ]; then
+		    log "Module sr_mod is compiled in statically"
+		else
+		    load_modules sr_mod
+		fi
+	    fi
+	fi
     fi
 fi
 

Regards,
Karsten
-- 
#include <standard_disclaimer>
Nach Paragraph 28 Abs. 3 Bundesdatenschutzgesetz widerspreche ich der Nutzung
oder Uebermittlung meiner Daten fuer Werbezwecke oder fuer die Markt- oder
Meinungsforschung.



Reply to: