def __init__(self, backend): Handler.__init__(self, backend, name=_('Software modem'), rationale=_( 'This driver enables the usage of many software modems, as ' 'commonly found in laptops.\n\n' 'If this driver is not enabled, you will not be able to use ' 'your modem.')) self.package = 'sl-modem-daemon' self.modem_re = re.compile('^\s*\d+\s*\[Modem\s*\]') self.modem_as_subdevice_re = re.compile('^card [0-9].*[mM]odem')
def __init__(self, backend): Handler.__init__( self, backend, name=_('Software modem'), rationale=_( 'This driver enables the usage of many software modems, as ' 'commonly found in laptops.\n\n' 'If this driver is not enabled, you will not be able to use ' 'your modem.')) self.package = 'sl-modem-daemon' self.modem_re = re.compile('^\s*\d+\s*\[Modem\s*\]') self.modem_as_subdevice_re = re.compile('^card [0-9].*[mM]odem')
def available(self): '''Check /proc/asound/cards and aplay -l for a "Modem" card.''' if Handler.available(self) == False: return False try: for l in open('/proc/asound/cards'): if self.modem_re.match(l): return True except IOError as e: logging.error('could not open /proc/asound/cards: %s' % str(e)) try: aplay = subprocess.Popen(['aplay', '-l'], env={}, stdout=subprocess.PIPE, stderr=subprocess.PIPE) (aplay_out, aplay_err) = aplay.communicate() except OSError as e: logging.error('could not open aplay -l: %s' % str(e)) return False if aplay.returncode != 0: logging.error('aplay -l failed with %i: %s' % (aplay.returncode, aplay_err)) return False for row in aplay_out.splitlines(): if self.modem_as_subdevice_re.match(row): return True return False
def disable(self): self._update_blacklist(self.module) self.read_loaded_modules() Handler.disable(self) return False
def enable(self): Handler.enable(self) self._update_blacklist("ath5k") subprocess.call([OSLib.inst.modprobe_path, self.module]) self.read_loaded_modules() return self.rebind(self.module)
def enable(self): Handler.enable(self) self._update_blacklist('ath5k') subprocess.call([OSLib.inst.modprobe_path, self.module]) self.read_loaded_modules() return self.rebind(self.module)