summaryrefslogtreecommitdiffstats
path: root/reversing_tools/abbott/freestyle_hid_console.py
diff options
context:
space:
mode:
Diffstat (limited to 'reversing_tools/abbott/freestyle_hid_console.py')
-rwxr-xr-xreversing_tools/abbott/freestyle_hid_console.py42
1 files changed, 29 insertions, 13 deletions
diff --git a/reversing_tools/abbott/freestyle_hid_console.py b/reversing_tools/abbott/freestyle_hid_console.py
index 4697da9..5005e4a 100755
--- a/reversing_tools/abbott/freestyle_hid_console.py
+++ b/reversing_tools/abbott/freestyle_hid_console.py
@@ -9,22 +9,37 @@ import sys
from glucometerutils import exceptions
from glucometerutils.support import freestyle
+
def main():
parser = argparse.ArgumentParser()
parser.add_argument(
- '--text_cmd_type', action='store', type=int, default=0x60,
- help='Message type for text commands sent to the device.')
+ "--text_cmd_type",
+ action="store",
+ type=int,
+ default=0x60,
+ help="Message type for text commands sent to the device.",
+ )
parser.add_argument(
- '--text_reply_type', action='store', type=int, default=0x60,
- help='Message type for text replies received from the device.')
+ "--text_reply_type",
+ action="store",
+ type=int,
+ default=0x60,
+ help="Message type for text replies received from the device.",
+ )
parser.add_argument(
- 'device', action='store',
- help='Path to the HID device to open.')
+ "device", action="store", help="Path to the HID device to open."
+ )
parser.add_argument(
- '--vlog', action='store', required=False, type=int,
- help=('Python logging level. See the levels at '
- 'https://docs.python.org/3/library/logging.html#logging-levels'))
+ "--vlog",
+ action="store",
+ required=False,
+ type=int,
+ help=(
+ "Python logging level. See the levels at "
+ "https://docs.python.org/3/library/logging.html#logging-levels"
+ ),
+ )
args = parser.parse_args()
@@ -38,15 +53,16 @@ def main():
while True:
if sys.stdin.isatty():
- command = input('>>> ')
+ command = input(">>> ")
else:
command = input()
- print('>>> {command}'.format(command=command))
+ print(">>> {command}".format(command=command))
try:
- print(device._send_text_command(bytes(command, 'ascii')))
+ print(device._send_text_command(bytes(command, "ascii")))
except exceptions.InvalidResponse as error:
- print('! {error}'.format(error=error))
+ print("! {error}".format(error=error))
+
if __name__ == "__main__":
main()