aboutsummaryrefslogtreecommitdiff
path: root/src/sw
diff options
context:
space:
mode:
authorJoachim StroĢˆmbergson <joachim@secworks.se>2014-12-20 08:58:05 +0100
committerJoachim StroĢˆmbergson <joachim@secworks.se>2014-12-20 08:58:05 +0100
commit670e21811e2a118dca194da01ff5187907d6ed44 (patch)
treea79e685ff4919fbca0e589d1ca3ac8df00955fd7 /src/sw
parented4f66d8c2868e5196aba61b5fc23e223a657ad4 (diff)
Adding initial version of the argparser.
Diffstat (limited to 'src/sw')
-rwxr-xr-xsrc/sw/trng_extract.py28
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