summaryrefslogtreecommitdiffstats
path: root/freestyle_hid/tools/hid_console.py
diff options
context:
space:
mode:
authorDiego Elio Pettenò <flameeyes@flameeyes.com>2021-03-03 14:48:38 +0100
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2021-03-03 17:04:35 +0100
commitee214a1470db58d60b1d7612ed33691ad7cfd370 (patch)
tree3b7ee7b6f65a9d369c43863625323b9680e44ae2 /freestyle_hid/tools/hid_console.py
parentCalculate multirecords checksum based on the raw bytes. (diff)
downloadfreestyle-hid-ee214a1470db58d60b1d7612ed33691ad7cfd370.tar
freestyle-hid-ee214a1470db58d60b1d7612ed33691ad7cfd370.tar.gz
freestyle-hid-ee214a1470db58d60b1d7612ed33691ad7cfd370.tar.bz2
freestyle-hid-ee214a1470db58d60b1d7612ed33691ad7cfd370.tar.lz
freestyle-hid-ee214a1470db58d60b1d7612ed33691ad7cfd370.tar.xz
freestyle-hid-ee214a1470db58d60b1d7612ed33691ad7cfd370.tar.zst
freestyle-hid-ee214a1470db58d60b1d7612ed33691ad7cfd370.zip
Diffstat (limited to '')
-rwxr-xr-xfreestyle_hid/tools/hid_console.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/freestyle_hid/tools/hid_console.py b/freestyle_hid/tools/hid_console.py
index b3b3fee..2c395bd 100755
--- a/freestyle_hid/tools/hid_console.py
+++ b/freestyle_hid/tools/hid_console.py
@@ -39,6 +39,13 @@ click_log.basic_config(logger)
type=int,
help="Optional product ID (in alternative to the device path)",
)
+@click.option(
+ "--encoding",
+ "-e",
+ type=str,
+ help="Encoding to use to decode commands returned by the meter",
+ default="ascii",
+)
@click.argument(
"device-path",
type=click.Path(exists=True, dir_okay=False, writable=True, allow_dash=False),
@@ -51,6 +58,7 @@ def main(
text_reply_type: int,
product_id: Optional[int],
device_path: Optional[pathlib.Path],
+ encoding: str,
):
if not product_id and not device_path:
raise click.UsageError(
@@ -58,7 +66,7 @@ def main(
)
session = freestyle_hid.Session(
- product_id, device_path, text_command_type, text_reply_type
+ product_id, device_path, text_command_type, text_reply_type, encoding=encoding
)
session.connect()