コード例 #1
0
def parse_commandline_args():
    """
    Parses the program commandline arguments.
    Args must be an array containing all arguments.
    """

    epilog = '''
    The configuration file must contained a JSON-encoded map. Example: "{"name":"foo"}".
    '''

    parser = utils.ConnectionArgumentParser(
        description='Update config (key/value pairs) on a board',
        epilog=epilog)
    parser.add_argument("-c",
                        "--config",
                        help="JSON file to load config from (default stdin)",
                        type=open,
                        default=sys.stdin,
                        dest='file')
    parser.add_argument("ids",
                        metavar='DEVICEID',
                        nargs='+',
                        type=int,
                        help="Device IDs to flash")

    return parser.parse_args()
コード例 #2
0
def parse_commandline_args(args=None):
    """
    Parses the program commandline arguments.
    Args must be an array containing all arguments.
    """
    parser = utils.ConnectionArgumentParser(description=__doc__)
    parser.add_argument('-b', '--binary', dest='binary_file',
                        help='Path to the binary file to upload',
                        required=True,
                        metavar='FILE')

    parser.add_argument('-a', '--base-address', dest='base_address',
                        help='Base address of the firmware',
                        metavar='ADDRESS',
                        required=True,
                        # automatically convert value to hex
                        type=lambda s: int(s, 16))

    parser.add_argument('-c', '--device-class',
                        dest='device_class',
                        help='Device class to flash', required=True)
    parser.add_argument('-r', '--run',
                        help='Run application after flashing',
                        action='store_true')
    parser.add_argument("--page-size", type=int, default=2048,
                        help="Page size in bytes (default 2048)")
    parser.add_argument("ids",
                        metavar='DEVICEID',
                        nargs='+', type=int,
                        help="Device IDs to flash")

    return parser.parse_args(args)
コード例 #3
0
def parse_commandline_args():
    parser = utils.ConnectionArgumentParser(
        description='Change a single node ID.')
    parser.add_argument("old", type=int, help="Old device ID")
    parser.add_argument("new", type=int, help="New device ID")

    return parser.parse_args()
コード例 #4
0
def parse_commandline_args():
    parser = utils.ConnectionArgumentParser(
        description='Send a jump to application command.')
    parser.add_argument("ids",
                        metavar='DEVICEID',
                        nargs='*',
                        type=int,
                        help="Device IDs to send jump command")
    parser.add_argument('-a',
                        '--all',
                        help="Try to scan all network.",
                        action='store_true')

    return parser.parse_args()
コード例 #5
0
def parse_commandline_args(args=None):
    """
    Parses the program commandline arguments.
    Args must be an array containing all arguments.
    """
    parser = utils.ConnectionArgumentParser(description=__doc__)
    parser.add_argument(
        "-b",
        "--binary",
        dest="binary_file",
        help="Path to the binary file to upload",
        required=True,
        metavar="FILE",
    )

    parser.add_argument(
        "-a",
        "--base-address",
        dest="base_address",
        help="Base address of the firmware",
        metavar="ADDRESS",
        required=True,
        # automatically convert value to hex
        type=lambda s: int(s, 16),
    )

    parser.add_argument(
        "-c",
        "--device-class",
        dest="device_class",
        help="Device class to flash",
        required=True,
    )
    parser.add_argument("-r",
                        "--run",
                        help="Run application after flashing",
                        action="store_true")
    parser.add_argument("--page-size",
                        type=int,
                        default=2048,
                        help="Page size in bytes (default 2048)")
    parser.add_argument("ids",
                        metavar="DEVICEID",
                        nargs="+",
                        type=int,
                        help="Device IDs to flash")

    return parser.parse_args(args)
コード例 #6
0
def parse_commandline_args():
    parser = utils.ConnectionArgumentParser(
        description="Send a jump to application command."
    )
    parser.add_argument(
        "ids",
        metavar="DEVICEID",
        nargs="*",
        type=int,
        help="Device IDs to send jump command",
    )
    parser.add_argument(
        "-a", "--all", help="Try to scan all network.", action="store_true"
    )

    return parser.parse_args()
コード例 #7
0
def parse_commandline_args():
    """
    Parses the program commandline arguments.
    """
    DESCRIPTION = "Read board configs and dumps to JSON"
    parser = utils.ConnectionArgumentParser(description=DESCRIPTION)
    parser.add_argument("ids",
                        metavar="DEVICEID",
                        nargs="*",
                        type=int,
                        help="Device IDs to query")

    parser.add_argument("-a",
                        "--all",
                        help="Try to scan the whole bus.",
                        action="store_true")

    return parser.parse_args()
コード例 #8
0
def parse_commandline_args():
    """
    Parses the program commandline arguments.
    """
    DESCRIPTION = 'Read board configs and dumps to JSON'
    parser = utils.ConnectionArgumentParser(description=DESCRIPTION)
    parser.add_argument("ids",
                        metavar='DEVICEID',
                        nargs='*',
                        type=int,
                        help="Device IDs to query")

    parser.add_argument('-a',
                        '--all',
                        help="Try to scan the whole bus.",
                        action='store_true')

    return parser.parse_args()