diff -u jockey-0.9.7/data/handlers/broadcom_wl.py jockey-0.9.7/data/handlers/broadcom_wl.py --- jockey-0.9.7/data/handlers/broadcom_wl.py +++ jockey-0.9.7/data/handlers/broadcom_wl.py @@ -14,12 +14,22 @@ class BroadcomWLHandler(KernelModuleHandler): '''Handler for Broadcom Wifi chipsets which use the wl module.''' - def __init__(self, ui): + def __init__(self, ui, fake_kernel=None): self._free = False KernelModuleHandler.__init__(self, ui, 'wl', - name=_('Broadcom STA wireless driver')) + name=_('Broadcom STA wireless driver'), fake_kernel=fake_kernel) self.package = 'bcmwl-kernel-source' - self._auto_install = True + + # There are issues with rebinding on Linux >= 3.8. + # See LP: #1247712 + if self._linux_major_ver == 3 and self._linux_minor_ver >= 8: + self._do_rebind = False + + # The open driver should be preferred on Linux >= 3.11 + # See LP: #1306928 + if self._linux_major_ver == 3 and self._linux_minor_ver < 11: + self._auto_install = True + self.needs_kernel_headers = True def enabled(self): diff -u jockey-0.9.7/debian/changelog jockey-0.9.7/debian/changelog --- jockey-0.9.7/debian/changelog +++ jockey-0.9.7/debian/changelog @@ -1,3 +1,15 @@ +jockey (0.9.7-0ubuntu7.15) precise-proposed; urgency=medium + + * data/handlers/broadcom_wl.py, jockey/handlers.py: + - Add an argument to pass a fake the kernel version for testing. + - Do not autoinstall if Linux >= 3.11 (LP: #1306928). + - Disable device rebinding if Linux >= 3.8 (LP: #1247712). + * tests/shipped_handlers.py: + - Test rebinding and autoinstalling the broadcom driver with + different kernels. + + -- Alberto Milone Fri, 18 Apr 2014 12:30:43 +0200 + jockey (0.9.7-0ubuntu7.14) precise-proposed; urgency=low * jockey/oslib.py, jockey/xorg_driver.py: diff -u jockey-0.9.7/tests/shipped_handlers.py jockey-0.9.7/tests/shipped_handlers.py --- jockey-0.9.7/tests/shipped_handlers.py +++ jockey-0.9.7/tests/shipped_handlers.py @@ -62,6 +62,48 @@ self._run_tests() + def test_broadcom_handler(self): + '''Test rebinding and autoinstalling for the broadcom driver''' + basedir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) + if os.path.isdir(os.path.join(basedir, 'examples')): + handler_dir=[os.path.join(basedir, 'data', 'handlers')] + else: + handler_dir=['/usr/share/jockey/handlers'] + + symb = {} + mod = os.path.join(handler_dir[0], 'broadcom_wl.py') + execfile(mod, symb) + + broadcom_obj = None + + # Look for the broadcom handler + for name, obj in symb.iteritems(): + if name == 'BroadcomWLHandler': + broadcom_obj = obj + break + else: + continue + + self.assert_(broadcom_obj) + + # Instantiate the handler faking Linux 3.5.0 + inst = broadcom_obj(self.backend, fake_kernel='3.5.0') + # It should rebind and autoinstall + self.assert_(inst._do_rebind) + self.assert_(inst._auto_install) + + # Instantiate the handler faking Linux 3.8.0 + inst_no_rebind = broadcom_obj(self.backend, fake_kernel='3.8.0') + # It should not rebind but it should autoinstall + self.assertEqual(inst_no_rebind._do_rebind, False) + self.assert_(inst_no_rebind._auto_install) + + # Instantiate the handler faking Linux 3.11.0 + inst_no_rebind_no_auto = broadcom_obj(self.backend, fake_kernel='3.11.0') + # It should neither rebind nor autoinstall + self.assertEqual(inst_no_rebind_no_auto._do_rebind, False) + self.assertEqual(inst_no_rebind_no_auto._auto_install, False) + def _run_tests(self): log_offset = sandbox.log.tell() basedir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) only in patch2: unchanged: --- jockey-0.9.7.orig/jockey/handlers.py +++ jockey-0.9.7/jockey/handlers.py @@ -408,7 +408,7 @@ _loaded_modules = None def __init__(self, backend, kernel_module, name=None, description=None, rationale=None, - do_blacklist=True): + do_blacklist=True, fake_kernel=None): '''Create handler for a kernel module. If not given explicitly, the name is read from modinfo's 'description' @@ -421,8 +421,25 @@ 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._linux_major_ver, self._linux_minor_ver = self._get_kernel_version(fake_kernel) self._do_rebind = True + def _get_kernel_version(self, fake_kernel=None): + if fake_kernel: + kernel = (fake_kernel and fake_kernel or + os.uname()[2]) + else: + kernel = os.uname()[2] + + # Strip ABI and label + if '-' in kernel: + kernel = kernel[:kernel.find('-')] + # Get linux major and minor version + major, minor = kernel.split('.')[:2] + + return int(major), int(minor) + def id(self): '''Return an unique identifier of the handler.'''