summaryrefslogtreecommitdiffstats
path: root/reversing_tools/abbott/freestyle_hid_console.py
diff options
context:
space:
mode:
authorBen <b-schaefer@posteo.de>2020-02-21 10:45:40 +0100
committerDiego Elio Pettenò <flameeyes@flameeyes.com>2020-03-08 00:36:39 +0100
commite72b02d84e7f67cdf6107862ad580e951a5bbda1 (patch)
tree0887513d2478f55b27abccfeb307f313231bd994 /reversing_tools/abbott/freestyle_hid_console.py
parentpre-commit guide in README (diff)
downloadglucometerutils-e72b02d84e7f67cdf6107862ad580e951a5bbda1.tar
glucometerutils-e72b02d84e7f67cdf6107862ad580e951a5bbda1.tar.gz
glucometerutils-e72b02d84e7f67cdf6107862ad580e951a5bbda1.tar.bz2
glucometerutils-e72b02d84e7f67cdf6107862ad580e951a5bbda1.tar.lz
glucometerutils-e72b02d84e7f67cdf6107862ad580e951a5bbda1.tar.xz
glucometerutils-e72b02d84e7f67cdf6107862ad580e951a5bbda1.tar.zst
glucometerutils-e72b02d84e7f67cdf6107862ad580e951a5bbda1.zip
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()