summaryrefslogtreecommitdiff
path: root/utils/raspberrypi
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-07-03 01:43:57 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-07-03 18:15:19 +0300
commit1a5b1685922db0b8c6c243df635cb0984e1372e5 (patch)
tree71b921fdb199e98dd5f093036b1ce55c716e5684 /utils/raspberrypi
parentfd2b55cb3f2b50e273e01f422c251c18ffa441ef (diff)
utils: raspberrypi: ctt: json_pretty_print: Fix printer test
The ctt_pretty_print_json.py file supports being run standalone to test the code. It however suffers from multiple issues: - The same input file name is hardcoded, and doesn't exist in the repository - The input file name is used instead of JSON data Fix both issues and make the input file selectable on the command line. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Tested-by: David Plowman <david.plowman@raspberrypi.com>
Diffstat (limited to 'utils/raspberrypi')
-rw-r--r--utils/raspberrypi/ctt/ctt_pretty_print_json.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/utils/raspberrypi/ctt/ctt_pretty_print_json.py b/utils/raspberrypi/ctt/ctt_pretty_print_json.py
index 73383ea0..18938c82 100644
--- a/utils/raspberrypi/ctt/ctt_pretty_print_json.py
+++ b/utils/raspberrypi/ctt/ctt_pretty_print_json.py
@@ -4,6 +4,8 @@
#
# ctt_pretty_print_json.py - camera tuning tool JSON formatter
+import sys
+
"""
takes a collapsed json file and makes it more readable
@@ -72,4 +74,10 @@ def pretty_print_json(str_in, output_filename):
if __name__ == '__main__':
- pretty_print_json("../ctt/ref_json/final_imx477.json", "pretty.json")
+ if len(sys.argv) != 2:
+ print("Usage: %s filename" % sys.argv[0])
+ sys.exit(1)
+
+ input_filename = sys.argv[1]
+ with open(input_filename, "r") as fin:
+ pretty_print_json(fin.read(), "pretty.json")