def disable(self): '''Prevent the OS from using it even if the hardware is available. This adds the module to the modprobe blacklist. ''' Handler.disable(self) if self.do_blacklist: OSLib.inst.blacklist_module(self.module, True) self._modinfo = detection.get_modinfo(self.module) return False # TODO: can we make this automatic?
def enable(self): '''Allow the OS to use it if the hardware is available. This removes the module from the modprobe blacklist. ''' Handler.enable(self) OSLib.inst.blacklist_module(self.module, False) subprocess.call([OSLib.inst.modprobe_path, self.module]) self._modinfo = detection.get_modinfo(self.module) self.read_loaded_modules() if self._do_rebind: return self.rebind(self.module)
def disable(self): '''Prevent the OS from using it even if the hardware is available. This adds the module to the modprobe blacklist. ''' Handler.disable(self) # Reload modules for cases in which firmware changes subprocess.call([OSLib.inst.modprobe_path, '-r', self.module]) subprocess.call([OSLib.inst.modprobe_path, self.module]) if self.do_blacklist: OSLib.inst.blacklist_module(self.module, True) self._modinfo = detection.get_modinfo(self.module) return False # TODO: can we make this automatic?
def __init__(self, backend, kernel_module, name=None, description=None, rationale=None, do_blacklist=False): '''Create handler for a kernel module. If not given explicitly, the name is read from modinfo's 'description' field. ''' self.module = kernel_module self.do_blacklist = do_blacklist self._modinfo = detection.get_modinfo(self.module) if not name: assert self._modinfo, 'kernel module %s exists' % self.module name = '\n'.join(self._modinfo.get('description', [self.module])) Handler.__init__(self, backend, name, description, rationale) self._do_rebind = True
def __init__(self, backend, kernel_module, name=None, description=None, rationale=None, do_blacklist=True): '''Create handler for a kernel module. If not given explicitly, the name is read from modinfo's 'description' field. ''' self.module = kernel_module self.do_blacklist = do_blacklist self._modinfo = detection.get_modinfo(self.module) if not name: assert self._modinfo, 'kernel module %s exists' % self.module name = '\n'.join(self._modinfo.get('description', [self.module])) Handler.__init__(self, backend, name, description, rationale) self._do_rebind = True