Class: Yast::HotplugClass
- Inherits:
-
Module
- Object
- Module
- Yast::HotplugClass
- Defined in:
- ../../src/modules/Hotplug.rb
Instance Method Summary (collapse)
- - (Object) main
-
- (Object) startController(controller)
start a controller (by loading its module) return true if successfull return false if failed.
-
- (void) StartFireWire
probe for firewire type, load appropriate modules, and mount usbfs to /proc/bus/usb.
-
- (void) StartUSB
probe for usb type, load appropriate modules, and mount usbfs to /proc/bus/usb.
Instance Method Details
- (Object) main
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File '../../src/modules/Hotplug.rb', line 42 def main Yast.import "Arch" Yast.import "ModuleLoading" Yast.import "HwStatus" Yast.import "Linuxrc" Yast.import "Mode" # if a usb controller was found and initialized @haveUSB = false # if a firewire controller was found and initialized @haveFireWire = false end |
- (Object) startController(controller)
start a controller (by loading its module) return true if successfull return false if failed
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
# File '../../src/modules/Hotplug.rb', line 62 def startController(controller) controller = deep_copy(controller) # check module information # skip controller if no module info available module_drivers = Ops.get_list(controller, "drivers", []) return true if Builtins.size(module_drivers) == 0 # loop through all drivers checking if one is already active already_active = false Builtins.foreach(module_drivers) do |modulemap| already_active = true if Ops.get_boolean(modulemap, "active", true) end # save unique key for HwStatus::Set() unique_key = Ops.get_string(controller, "unique_key", "") if already_active HwStatus.Set(unique_key, :yes) return true end stop_loading = false one_module_failed = false # loop through all drivers defined for this controller # break after first successful load # no need to check "active", already done before ! Builtins.foreach(module_drivers) do |modulemap| Builtins.y2milestone("modulemap: %1", modulemap) module_modprobe = Ops.get_boolean(modulemap, "modprobe", false) all_modules_loaded = true if !stop_loading Builtins.foreach(Ops.get_list(modulemap, "modules", [])) do |module_entry| module_name = Ops.get_string(module_entry, 0, "") module_args = Ops.get_string(module_entry, 1, "") load_result = :ok if Linuxrc.manual vendor_device = ModuleLoading.prepareVendorDeviceInfo(controller) load_result = ModuleLoading.Load( module_name, module_args, Ops.get_string(vendor_device, 0, ""), Ops.get_string(vendor_device, 1, ""), true, module_modprobe ) else load_result = ModuleLoading.Load( module_name, module_args, "", "", false, module_modprobe ) end if load_result == :fail all_modules_loaded = false elsif load_result == :dont all_modules_loaded = true end # break out of module load loop if one module failed one_module_failed = true if !all_modules_loaded end # foreach module of current driver info end # stop_loading # break out of driver load loop if all modules of # the current driver loaded successfully stop_loading = true if all_modules_loaded end # foreach driver HwStatus.Set(unique_key, one_module_failed ? :no : :yes) !one_module_failed end |
- (void) StartFireWire
This method returns an undefined value.
probe for firewire type, load appropriate modules, and mount usbfs to /proc/bus/usb
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 |
# File '../../src/modules/Hotplug.rb', line 171 def StartFireWire return if Arch.sparc # why this and why here ??? firewire_controllers = Convert.convert( SCR.Read(path(".probe.ieee1394ctrl")), :from => "any", :to => "list <map>" ) Builtins.foreach(firewire_controllers) do |controller| start_result = startController(controller) @haveFireWire = true if start_result end Builtins.y2milestone("haveFireWire = %1", @haveFireWire) nil end |
- (void) StartUSB
This method returns an undefined value.
probe for usb type, load appropriate modules, and mount usbfs to /proc/bus/usb
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 |
# File '../../src/modules/Hotplug.rb', line 148 def StartUSB usb_controllers = Convert.convert( SCR.Read(path(".probe.usbctrl")), :from => "any", :to => "list <map>" ) Builtins.foreach(usb_controllers) do |controller| start_result = startController(controller) @haveUSB = true if start_result end Builtins.y2milestone("haveUSB = %1", @haveUSB) nil end |