~mvo/jockey/b43-firmware-loading-fixes

« back to all changes in this revision

Viewing changes to data/handlers/b43.py

  • Committer: Michael Vogt
  • Date: 2010-10-11 10:00:54 UTC
  • Revision ID: michael.vogt@ubuntu.com-20101011100054-yrf4zs7i9jjb34il
use modalias file to detect lpphy

Show diffs side-by-side

added added

removed removed

Lines of Context:
8
8
from jockey.oslib import OSLib
9
9
from jockey.handlers import KernelModuleHandler
10
10
 
11
 
# PCI ID data gathered from the firmware-b43* postinst scripts
12
 
BASE_ID = "14e4"
13
 
PCIID_TO_DRIVER = {
14
 
    # legacy
15
 
    "4301" : "firmware-b43legacy-installer",
16
 
    "4306" : "firmware-b43legacy-installer",
17
 
    # low power
18
 
    "4315" : "firmware-b43-lpphy-installer",
19
 
    # regular
20
 
    "4321" : "firmware-b43-installer",
21
 
    "4324" : "firmware-b43-installer",
22
 
    "4325" : "firmware-b43-installer",
23
 
    "4328" : "firmware-b43-installer",
24
 
    "4329" : "firmware-b43-installer",
25
 
    "43b5" : "firmware-b43-installer",
26
 
    }
27
 
 
28
 
 
29
11
class B43Handler(KernelModuleHandler):
30
12
    '''Handler for Broadcom Wifi chipsets which use the b43 module and
31
13
    b43-fwcutter.'''
32
14
 
33
15
    def __init__(self, ui):
34
16
        KernelModuleHandler.__init__(self, ui, 'b43')
35
 
        # ideally we would look at self._modinfo and the alias field
36
 
        # in there. but for b43 this is ssb: and mapping that to a 
37
 
        # PCI id seems to be not straightforward (like walking the sysfs
38
 
        # tree, finding the right uevent file with the matching ssb ID,
39
 
        # and then walking "up" (cd ..) to the pci device and then checking
40
 
        # that modinfo file
41
 
        # so a simpler apparoch is used
42
 
        for line in OSLib.inst.lspci():
43
 
            try:
44
 
                (vendor_id, device_id) = line.split()[2].split(":")
45
 
                if vendor_id == BASE_ID and device_id in PCIID_TO_DRIVER:
46
 
                    self.package = PCIID_TO_DRIVER[device_id]
47
 
                    break
48
 
            except IndexError:
49
 
                continue
50
 
        else:
51
 
            raise SystemError, "Unknown/Unsupported pciid"
 
17
        if not self.package:
 
18
            self.package = "firmware-b43-installer"
52
19
 
53
20
    def enabled(self):
54
21
        '''Return if the handler is enabled.
88
55
 
89
56
    def __init__(self, ui):
90
57
        B43Handler.__init__(self, ui)
 
58
        if not self.package:
 
59
            self.package = "firmware-b43legacy-installer"