diff options
author | Joachim StroĢmbergson <joachim@secworks.se> | 2014-12-20 08:58:05 +0100 |
---|---|---|
committer | Joachim StroĢmbergson <joachim@secworks.se> | 2014-12-20 08:58:05 +0100 |
commit | 670e21811e2a118dca194da01ff5187907d6ed44 (patch) | |
tree | a79e685ff4919fbca0e589d1ca3ac8df00955fd7 /src/sw | |
parent | ed4f66d8c2868e5196aba61b5fc23e223a657ad4 (diff) |
Adding initial version of the argparser.
Diffstat (limited to 'src/sw')
-rwxr-xr-x | src/sw/trng_extract.py | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/src/sw/trng_extract.py b/src/sw/trng_extract.py index a47fb54..9492f53 100755 --- a/src/sw/trng_extract.py +++ b/src/sw/trng_extract.py @@ -318,22 +318,40 @@ def looptest(dev): # main #---------------------------------------------------------------- def main(): - if VERBOSE: - print("Starting trng data extraction.") - - my_commdev = Comm() + # my_commdev = Comm() # looptest(my_commdev) # get_avalanche_entropy() # get_avalanche_delta() - get_rosc_entropy(my_commdev) + # get_rosc_entropy(my_commdev) # get_rosc_raw() # get_rng_data() + parser = argparse.ArgumentParser() + + parser.add_argument('-d', '--debug', dest='debug', action='store_true', + help='Pring debug information.') + + parser.add_argument('-v', '--verbose', dest='verbose', action='store_true', + help='Increase verbosity.') + + parser.add_argument('-i', dest='device', default=I2C_DEVICE, + help='I2C device name (default ' + I2C_DEVICE + ')') + + parser.add_argument('-n', dest='num_words', default=NUM_WORDS, + help='Number of 32-bit words to extract (default ' + + str(NUM_WORDS) + ')') + + + args = parser.parse_args() + DEBUG = args.debug + VERBOSE = args.verbose + + #------------------------------------------------------------------- # __name__ # Python thingy which allows the file to be run standalone as |