From d0a282b552922f31f80b2e979b79d5697fbbbcda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= Date: Sun, 22 Mar 2020 16:41:48 +0000 Subject: Make HID support a "session" class rather than a base class. This in turn allows wrapping the FreeStyle access in its own session class, which the freestyle_hid_console can use without dirty tricks, and without triggering the now-abstract class. --- reversing_tools/abbott/freestyle_hid_console.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'reversing_tools/abbott') diff --git a/reversing_tools/abbott/freestyle_hid_console.py b/reversing_tools/abbott/freestyle_hid_console.py index 654a97c..0ed4705 100755 --- a/reversing_tools/abbott/freestyle_hid_console.py +++ b/reversing_tools/abbott/freestyle_hid_console.py @@ -45,11 +45,11 @@ def main(): logging.basicConfig(level=args.vlog) - device = freestyle.FreeStyleHidDevice(args.device) - device.TEXT_CMD = args.text_cmd_type - device.TEXT_REPLY_CMD = args.text_reply_type + session = freestyle.FreeStyleHidSession( + None, args.device, args.text_cmd_type, args.text_reply_type + ) - device.connect() + session.connect() while True: if sys.stdin.isatty(): @@ -59,7 +59,7 @@ def main(): print(f">>> {command}") try: - print(device._send_text_command(bytes(command, "ascii"))) + print(session.send_text_command(bytes(command, "ascii"))) except exceptions.InvalidResponse as error: print(f"! {error}") -- cgit v1.2.3