v1.9.0 #175

Merged
muellerr merged 623 commits from develop into main 2022-03-08 10:32:41 +01:00
2 changed files with 48 additions and 16 deletions
Showing only changes of commit 8ee3e18327 - Show all commits

View File

@ -146,6 +146,7 @@ void ObjectFactory::produce(void* args) {
I2cCookie* imtqI2cCookie = I2cCookie* imtqI2cCookie =
new I2cCookie(addresses::IMTQ, IMTQ::MAX_REPLY_SIZE, q7s::I2C_DEFAULT_DEV); new I2cCookie(addresses::IMTQ, IMTQ::MAX_REPLY_SIZE, q7s::I2C_DEFAULT_DEV);
auto imtqHandler = new IMTQHandler(objects::IMTQ_HANDLER, objects::I2C_COM_IF, imtqI2cCookie); auto imtqHandler = new IMTQHandler(objects::IMTQ_HANDLER, objects::I2C_COM_IF, imtqI2cCookie);
static_cast<void>(imtqHandler);
#if OBSW_DEBUG_IMTQ == 1 #if OBSW_DEBUG_IMTQ == 1
imtqHandler->setToGoToNormal(true); imtqHandler->setToGoToNormal(true);
imtqHandler->setStartUpImmediately(); imtqHandler->setStartUpImmediately();

View File

@ -1,44 +1,75 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import argparse import argparse
import os import os
import sys
def main(): def main():
args = handle_args() args = handle_args()
cmd = build_cmd(args) cmd = build_cmd(args)
# Run the command # Run the command
print(f'Running command: {cmd}') print(f"Running command: {cmd}")
result = os.system(cmd) result = os.system(cmd)
if result != 0: if result != 0:
print('') print("")
print('Removing problematic SSH key and trying again..') print("Removing problematic SSH key and trying again..")
remove_ssh_key_cmd = 'ssh-keygen -f "${HOME}/.ssh/known_hosts" -R "[localhost]:1535"' remove_ssh_key_cmd = (
'ssh-keygen -f "${HOME}/.ssh/known_hosts" -R "[localhost]:1535"'
)
os.system(remove_ssh_key_cmd) os.system(remove_ssh_key_cmd)
print(f'Running command "{cmd}"')
result = os.system(cmd) result = os.system(cmd)
def handle_args(): def handle_args():
help_string = 'This script copies files to the Q7S as long as port forwarding is active.\n' help_string = (
help_string += 'You can set up port forwarding with ' \ "This script copies files to the Q7S as long as port forwarding is active.\n"
'"ssh -L 1535:192.168.133.10:22 <eive-flatsat-ip>" -t /bin/bash'
parser = argparse.ArgumentParser(
description=help_string
) )
help_string += (
"You can set up port forwarding with "
'"ssh -L 1535:192.168.133.10:22 <eive-flatsat-ip>" -t /bin/bash'
)
parser = argparse.ArgumentParser(description=help_string)
# Optional arguments # Optional arguments
parser.add_argument('-r', '--recursive', dest='recursive', default=False, action='store_true') parser.add_argument(
parser.add_argument('-t', '--target', help='Target destination', default='/tmp') "-r", "--recursive", dest="recursive", default=False, action="store_true"
parser.add_argument('-P', '--port', help='Target port', default=1535) )
parser.add_argument(
"-t",
"--target",
help="Target destination. If files are copied to Q7S, will be /tmp by default. "
"If files are copied back to host, will be current directory by default",
default="",
)
parser.add_argument("-P", "--port", help="Target port", default=1535)
parser.add_argument(
"-i",
"--invert",
default=False,
action="store_true",
help="Copy from Q7S to host instead. Always copies to current directory.",
)
# Positional argument(s) # Positional argument(s)
parser.add_argument('source', help='Source files to copy') parser.add_argument(
"source", help="Source files to copy or target files to copy back to host"
)
return parser.parse_args() return parser.parse_args()
def build_cmd(args): def build_cmd(args):
# Build run command # Build run command
cmd = 'scp ' cmd = "scp "
if args.recursive: if args.recursive:
cmd += '-r ' cmd += "-r "
cmd += f'-P {args.port} {args.source} root@localhost:' target = args.target
if args.invert and target == "":
target = "."
elif target == "":
target = f"/tmp"
if args.invert:
cmd += f"-P {args.port} root@localhost:{args.source} {target}"
else:
cmd += f"-P {args.port} {args.source} root@localhost:{target}"
if args.target: if args.target:
cmd += args.target cmd += args.target
return cmd return cmd