Skip to content

Commit

Permalink
brom-dump: spft-replay: refactor code (part 2 of 2)
Browse files Browse the repository at this point in the history
Rename device.py and its Device class to brom.py and BromProtocol accordingly
  • Loading branch information
arzam16 committed Dec 1, 2023
1 parent bf6ee8f commit 9cb6847
Show file tree
Hide file tree
Showing 4 changed files with 168 additions and 164 deletions.
8 changes: 4 additions & 4 deletions brom-dump/spft-replay/spft-replay.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import logging
from functools import partial, partialmethod

from src.brom import BromProtocol
from src.common import as_0x
from src.device import Device
from src.manager import DeviceManager
from src.transport import UsbTransport

Expand Down Expand Up @@ -99,13 +99,13 @@ def main():
transport = UsbTransport()
transport.start()

device = Device(transport)
brom = BromProtocol(transport)
try:
device.handshake()
brom.handshake()
except:
logging.critical("Handshake error!", exc_info=True)

manager = DeviceManager(device)
manager = DeviceManager(brom)
if args.mode_identify:
identify_mode(manager)
elif args.mode_payload or args.mode_simple_payload:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from src.common import as_0x, as_hex, from_bytes, to_bytes


class Device:
class BromProtocol:
def __init__(self, transport):
self.transport = transport

Expand Down
2 changes: 1 addition & 1 deletion brom-dump/spft-replay/src/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def identify(self):
def replay(self, payload, simple_mode, skip_remaining_data):
self.payload = payload

hw_code = self.dev.get_hw_code()
hw_code = self.brom.get_hw_code()
logging.replay(f"HW code: {as_hex(hw_code, 2)}")

if hw_code == 0x6573:
Expand Down
Loading

0 comments on commit 9cb6847

Please sign in to comment.