diff options
author | Diego Elio Pettenò <flameeyes@flameeyes.com> | 2023-08-03 17:41:12 +0200 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2023-08-03 17:51:20 +0200 |
commit | fcb76c9ef2524315335e22edaa624f01ecab60d2 (patch) | |
tree | 2b97930ceb8e0477f4237d63adfb2b67c3366547 /freestyle_hid/tools | |
parent | Use empty `__init__.py` files. (diff) | |
download | freestyle-hid-main.tar freestyle-hid-main.tar.gz freestyle-hid-main.tar.bz2 freestyle-hid-main.tar.lz freestyle-hid-main.tar.xz freestyle-hid-main.tar.zst freestyle-hid-main.zip |
Diffstat (limited to '')
-rwxr-xr-x | freestyle_hid/tools/hid_console.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/freestyle_hid/tools/hid_console.py b/freestyle_hid/tools/hid_console.py index 6eec4e2..a9a133c 100755 --- a/freestyle_hid/tools/hid_console.py +++ b/freestyle_hid/tools/hid_console.py @@ -60,6 +60,11 @@ click_log.basic_config(logger) callback=lambda ctx, param, value: pathlib.Path(value) if value else None, required=False, ) +@click.argument( + "command", + type=str, + required=False, +) def main( *, text_command_type: int, @@ -68,6 +73,7 @@ def main( device_path: Optional[pathlib.Path], encoding: str, encrypted_protocol: bool, + command: Optional[str], ): if not product_id and not device_path: raise click.UsageError( @@ -85,6 +91,14 @@ def main( session.connect() + if command is not None: + try: + print(session.send_text_command(bytes(command, "ascii"))) + except freestyle_hid.CommandError as error: + print(f"! {error!r}") + + return + while True: if sys.stdin.isatty(): command = input(">>> ") |