X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=debug%2Flibb43.py;h=55ff4856f237413c187f29e28fee92764596de20;hb=d28e04de007c7c1a98d59493592e49d6c3e7a9fc;hp=671ad2c6f173a141bb2bbffa984c6200f5c929e4;hpb=98a28c2cd91e0bc78c9420b6b78be81993fe969a;p=b43-tools.git diff --git a/debug/libb43.py b/debug/libb43.py index 671ad2c..55ff485 100644 --- a/debug/libb43.py +++ b/debug/libb43.py @@ -1,7 +1,7 @@ """ # b43 debugging library # -# Copyright (C) 2008 Michael Buesch +# Copyright (C) 2008-2010 Michael Buesch # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License version 3 @@ -19,7 +19,7 @@ import sys import os import re -import md5 +import hashlib from tempfile import * @@ -62,7 +62,7 @@ class B43PsmDebug: class B43: """Hardware access layer. This accesses the hardware through the debugfs interface.""" - def __init__(self, phy): + def __init__(self, phy=None): debugfs_path = self.__debugfs_find() # Construct the debugfs b43 path to the device @@ -71,7 +71,11 @@ class B43: b43_path += phy else: # Get the PHY. - phys = os.listdir(b43_path) + try: + phys = os.listdir(b43_path) + except OSError: + print "Could not find B43's debugfs directory: %s" % b43_path + raise B43Exception if not phys: print "Could not find any b43 device" raise B43Exception @@ -339,7 +343,7 @@ class TextPatcher: self.deleted = False def __init__(self, text, expected_md5sum): - sum = md5.md5(text).hexdigest() + sum = hashlib.md5(text).hexdigest() if sum != expected_md5sum: print "Patcher: The text does not match the expected MD5 sum" print "Expected: " + expected_md5sum @@ -618,13 +622,15 @@ class B43Beautifier(B43AsmParser): def __init__(self, asm_code, headers_dir): """asm_code is the assembly code. headers_dir is a full path to the directory containing the symbolic SPR,SHM,etc... definitions""" + if headers_dir.endswith("/"): + headers_dir = headers_dir[:-1] B43AsmParser.__init__(self, asm_code) self.symSpr = B43SymbolicSpr(headers_dir + "/spr.inc") self.symShm = B43SymbolicShm(headers_dir + "/shm.inc") self.symCond = B43SymbolicCondition(headers_dir + "/cond.inc") - self.preamble = "#include <%s/spr.inc>\n" % headers_dir - self.preamble += "#include <%s/shm.inc>\n" % headers_dir - self.preamble += "#include <%s/cond.inc>\n" % headers_dir + self.preamble = "#include \"%s/spr.inc\"\n" % headers_dir + self.preamble += "#include \"%s/shm.inc\"\n" % headers_dir + self.preamble += "#include \"%s/cond.inc\"\n" % headers_dir self.preamble += "\n" self.__process_code()