Skip to content

Commit 64d7697

Browse files
committed
asahi_firmware.bluetooth: Fix extraction for 4388
Signed-off-by: Hector Martin <[email protected]>
1 parent b593d8f commit 64d7697

1 file changed

Lines changed: 18 additions & 6 deletions

File tree

asahi_firmware/bluetooth.py

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@
1010
"BluetoothChip", ("chip", "stepping", "board_type", "vendor")
1111
)
1212

13+
# 13.5 is missing PTBs for these. 4388B0 probably never shipped to end users here.
14+
INCOMPLETE_CHIPS = set([
15+
('4388', 'b0', 'apple,tokara'),
16+
('4388', 'b0', 'apple,amami'),
17+
])
1318

1419
class BluetoothFWCollection(object):
1520
VENDORMAP = {
@@ -47,7 +52,7 @@ def load(self, source_path):
4752
continue
4853

4954
if self.fwfiles[chip][idx] is not None:
50-
log.warning(f"duplicate entry for {chip}: {self.fwfiles[chip][idx].name} and now {fname + ext}")
55+
log.warning(f"duplicate entry for {chip}: {self.fwfiles[chip][idx].name} and now {fname}")
5156
continue
5257

5358
path = os.path.join(source_path, fname)
@@ -72,10 +77,16 @@ def parse_fname(self, fname):
7277
log.warning(f"Can't find board type in {fname}")
7378
return None
7479

75-
if fname[pcie_offset + 1] == "macOS":
76-
board_type = fname[pcie_offset + 2]
77-
else:
78-
board_type = fname[pcie_offset + 1]
80+
bt_offset = pcie_offset + 1
81+
if fname[bt_offset] == "macOS":
82+
bt_offset += 1
83+
84+
# 4388 has this extra prefix, meh
85+
if fname[bt_offset] == "Willamette":
86+
bt_offset += 1
87+
88+
board_type = fname[bt_offset]
89+
7990
for i in self.STRIP_SUFFIXES:
8091
board_type = board_type.rstrip(i)
8192
board_type = "apple," + board_type.lower()
@@ -107,7 +118,8 @@ def files(self):
107118
yield fname_base + ".bin", bin
108119

109120
if ptb is None:
110-
log.warning(f"no ptb for {chip}")
121+
if (chip.chip, chip.stepping, chip.board_type) not in INCOMPLETE_CHIPS:
122+
log.warning(f"no ptb for {chip}")
111123
continue
112124
else:
113125
yield fname_base + ".ptb", ptb

0 commit comments

Comments
 (0)