Skip to content

Commit ad1a86e

Browse files
committed
asahi_firmware: Configure logging
Signed-off-by: Hector Martin <[email protected]>
1 parent 66e5001 commit ad1a86e

3 files changed

Lines changed: 12 additions & 7 deletions

File tree

asahi_firmware/bluetooth.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
from .core import FWFile
66

7+
log = logging.getLogger("asahi_firmware.bluetooth")
8+
79
BluetoothChip = namedtuple(
810
"BluetoothChip", ("chip", "stepping", "board_type", "vendor")
911
)
@@ -42,7 +44,7 @@ def load(self, source_path):
4244
continue
4345

4446
if self.fwfiles[chip][idx] is not None:
45-
logging.warning(f"duplicate entry for {chip}: {self.fwfiles[chip][idx].name} and now {fname + ext}")
47+
log.warning(f"duplicate entry for {chip}: {self.fwfiles[chip][idx].name} and now {fname + ext}")
4648
continue
4749

4850
path = os.path.join(source_path, fname)
@@ -56,15 +58,15 @@ def parse_fname(self, fname):
5658

5759
match = re.fullmatch("bcm(43[0-9]{2})([a-z][0-9])", fname[0].lower())
5860
if not match:
59-
logging.warning(f"Unexpected firmware file: {fname}")
61+
log.warning(f"Unexpected firmware file: {fname}")
6062
return None
6163
chip, stepping = match.groups()
6264

6365
# board type is either preceeded by PCIE_macOS or by PCIE
6466
try:
6567
pcie_offset = fname.index("PCIE")
6668
except:
67-
logging.warning(f"Can't find board type in {fname}")
69+
log.warning(f"Can't find board type in {fname}")
6870
return None
6971

7072
if fname[pcie_offset + 1] == "macOS":
@@ -79,7 +81,7 @@ def parse_fname(self, fname):
7981
if vendor in fname:
8082
otp_values.add(otp_value)
8183
if len(otp_values) != 1:
82-
logging.warning(f"Unable to determine vendor ({otp_values}) in {fname}")
84+
log.warning(f"Unable to determine vendor ({otp_values}) in {fname}")
8385
return None
8486
vendor = otp_values.pop()
8587

@@ -94,13 +96,13 @@ def files(self):
9496
fname_base += f"-{chip.vendor}"
9597

9698
if bin is None:
97-
logging.warning(f"no bin for {chip}")
99+
log.warning(f"no bin for {chip}")
98100
continue
99101
else:
100102
yield fname_base + ".bin", bin
101103

102104
if ptb is None:
103-
logging.warning(f"no ptb for {chip}")
105+
log.warning(f"no ptb for {chip}")
104106
continue
105107
else:
106108
yield fname_base + ".ptb", ptb

asahi_firmware/update.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ def update_firmware(source, dest, manifest):
2626

2727
if __name__ == "__main__":
2828
import argparse
29+
import logging
30+
logging.basicConfig()
2931

3032
parser = argparse.ArgumentParser(description='Update vendor firmware tarball')
3133
parser.add_argument('source', metavar='DIR', type=pathlib.Path,

asahi_firmware/wifi.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
# SPDX-License-Identifier: MIT
22
import sys, os, os.path, pprint, statistics, logging
3-
43
from .core import FWFile
54

5+
log = logging.getLogger("asahi_firmware.wifi")
6+
67
class FWNode(object):
78
def __init__(self, this=None, leaves=None):
89
if leaves is None:

0 commit comments

Comments
 (0)