From de5cc942773bcf1fd93b86202a350d97f05183c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= Date: Sun, 8 Sep 2019 20:12:45 +0100 Subject: freestyle_hid_console: allow feeding a list of known commands. This makes it easier to identify the expected command range of a FreeStyle device. --- reversing_tools/abbott/freestyle_hid_console.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/reversing_tools/abbott/freestyle_hid_console.py b/reversing_tools/abbott/freestyle_hid_console.py index 5acd958..908fb4e 100755 --- a/reversing_tools/abbott/freestyle_hid_console.py +++ b/reversing_tools/abbott/freestyle_hid_console.py @@ -4,6 +4,7 @@ import argparse import logging +import sys from glucometerutils import exceptions from glucometerutils.support import freestyle @@ -36,7 +37,12 @@ def main(): device.connect() while True: - command = input('>>> ') + if sys.stdin.isatty(): + command = input('>>> ') + else: + command = input() + print(f'>>> {command}') + try: print(device._send_text_command(bytes(command, 'ascii'))) except exceptions.InvalidResponse as error: -- cgit v1.2.3