Minor clean up to modprobe() function.
[bootcd.git] / conf_files / pl_hwinit
index b1fc6f0..947a1de 100755 (executable)
@@ -6,9 +6,15 @@ import pypcimap
 import os
 import time
 
-def modprobe(module):
-    ret = os.system("/sbin/modprobe %s" % module)
-    return os.WEXITSTATUS(ret) == 0
+loadedmodules = None
+
+def modprobe(module, args = ""):
+    ret = os.system("/sbin/modprobe %s %s" % (module, args))
+    if os.WEXITSTATUS(ret) == 0:
+        globals()['loadedmodules'].write("%s\n" % module)
+        return True
+    else:
+        return False
 
 def main(argv):
     if len(argv) == 0:
@@ -27,9 +33,10 @@ def main(argv):
     storage_devices = 0
     network_devices = 0
     missing = []
+    globals()['loadedmodules'] = file('/tmp/loadedmodules', 'w')
     for (slot, dev) in devices.iteritems():
         modules = pcimap.get(dev)
-        base = (dev[4] & 0xff00) >> 8
+        base = (dev[4] & 0xff0000) >> 16
         if len(modules) == 0:
             if base == 0x01 or base == 0x02:
                 # storage or network device, in that order
@@ -61,7 +68,7 @@ def main(argv):
     modprobe("usb_storage")
 
     print "pl_hwinit: loading floppy device driver"
-    modprobe("floppy")
+    modprobe("floppy","floppy=0,allowed_drive_mask")
 
     # always wait a bit between loading the usb drivers, and checking /sys/
     # for usb devices (this isn't necessarily for waiting for mass storage files,