Commit graph

35 commits

Author SHA1 Message Date
Laurent Pinchart
a83d6ac901 utils: raspberrypi: ctt: json_pretty_print: Add newline at end of output
Make sure the output ends with a newline.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
Tested-by: David Plowman <david.plowman@raspberrypi.com>
2020-07-03 18:15:56 +03:00
Laurent Pinchart
f128acc325 utils: raspberrypi: ctt: json_pretty_print: Avoid spaces at end of lines
Avoid outputting spaces at end of lines by recording the need for a
space and outputting it before the next character only if not a newline.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
Tested-by: David Plowman <david.plowman@raspberrypi.com>
2020-07-03 18:15:54 +03:00
Laurent Pinchart
bfad33c3ef utils: raspberrypi: ctt: json_pretty_print: Collapse newlines
Simplify the newline skipping logic by simply collapsing newlines. If a
newline has been output, all subsequent newlines will be skipped until
the next non-newline character is output.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
Tested-by: David Plowman <david.plowman@raspberrypi.com>
2020-07-03 18:15:50 +03:00
Laurent Pinchart
d9617a499a utils: raspberrypi: ctt: json_pretty_print: Fix indentation handling
Indentation is handled by outputting spaces right after outputting a
newline character. That works in most cases, but would result in the
input '{}' being printed as

{
    }

instead of

{
}

Fix it by outputting the indentation before outputting the next
character after a newline. The indentation value will be updated by
then.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
Tested-by: David Plowman <david.plowman@raspberrypi.com>
2020-07-03 18:15:47 +03:00
Laurent Pinchart
606741deb9 utils: raspberrypi: ctt: json_pretty_print: Add character write method
Add a write method to the JSONPrettyPrinter class to output a character.
This will be used to handle state updates when outputting individual
characters.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
Tested-by: David Plowman <david.plowman@raspberrypi.com>
2020-07-03 18:15:45 +03:00
Laurent Pinchart
e101c78e03 utils: raspberrypi: ctt: json_pretty_print: Skip all spaces
Skip all white space characters, not just ' '. This makes a difference
if the input JSON data is already formatted.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
Tested-by: David Plowman <david.plowman@raspberrypi.com>
2020-07-03 18:15:42 +03:00
Laurent Pinchart
5224f471ca utils: raspberrypi: ctt: json_pretty_print: Make test output to stdout
The standalone test mode output to a file name "pretty.json". To make
the test mode more versatile, output to stdout instead. The user can
then decide how to use the output.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
Tested-by: David Plowman <david.plowman@raspberrypi.com>
2020-07-03 18:15:40 +03:00
Laurent Pinchart
4321f6e96e utils: raspberrypi: ctt: json_pretty_print: Make output file a class member
Instead of passing the output file to every method of the printer class,
make it a class member.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
Tested-by: David Plowman <david.plowman@raspberrypi.com>
2020-07-03 18:15:38 +03:00
Laurent Pinchart
926fe94e4c utils: raspberrypi: ctt: json_pretty_print: Turn printer into a class
Instead of passing a state dictionary to every method, turn the printer
into a class and store the state internally.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
Tested-by: David Plowman <david.plowman@raspberrypi.com>
2020-07-03 18:15:32 +03:00
Laurent Pinchart
1a5b168592 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>
2020-07-03 18:15:19 +03:00
Laurent Pinchart
e7aa92a883 utils: raspberrypi: ctt: Fix pycodestyle W605
W605 invalid escape sequence '\.'

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
2020-06-29 17:38:18 +03:00
Laurent Pinchart
e8655c2161 utils: raspberrypi: ctt: Fix pycodestyle E302
E302 expected 2 blank lines, found 0

Note that issues are still flagged, due to the use of docstrings as
multi-lines comments. This will be addressed separately.

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>
2020-05-13 17:00:25 +03:00
Laurent Pinchart
33c4221e87 utils: raspberrypi: ctt: Fix pycodestyle E305
E305 expected 2 blank lines after class or function definition

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>
2020-05-13 17:00:13 +03:00
Laurent Pinchart
2b21c6ac86 utils: raspberrypi: ctt: Fix pycodestyle E741
E741 ambiguous variable name 'l'

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>
2020-05-13 17:00:07 +03:00
Laurent Pinchart
4939e114b6 utils: raspberrypi: ctt: Fix pycodestyle W504
W504 line break after binary operator

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>
2020-05-13 17:00:04 +03:00
Laurent Pinchart
57e999a4ae utils: raspberrypi: ctt: Fix pycodestyle E722
E722 do not use bare 'except'

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>
2020-05-13 17:00:01 +03:00
Laurent Pinchart
5eae909293 utils: raspberrypi: ctt: Fix pycodestyle E721
E721 do not compare types, use 'isinstance()'

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>
2020-05-13 16:59:58 +03:00
Laurent Pinchart
f8e9810020 utils: raspberrypi: ctt: Fix pycodestyle E713
E713 test for membership should be 'not in'

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>
2020-05-13 16:59:55 +03:00
Laurent Pinchart
a49fd8ea1d utils: raspberrypi: ctt: Fix pycodestyle E116 and E117
E116 unexpected indentation (comment)
E117 over-indented (comment)

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>
2020-05-13 16:59:51 +03:00
Laurent Pinchart
67f9605a7f utils: raspberrypi: ctt: Fix pycodestyle E123 and E126
E123 closing bracket does not match indentation of opening bracket's line
E126 continuation line over-indented for hanging indent

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>
2020-05-13 16:59:47 +03:00
Laurent Pinchart
ca73168e75 utils: raspberrypi: ctt: Fix pycodestyle E711 and E712
E711 comparison to None should be 'if cond is None:'
E711 comparison to None should be 'if cond is not None:'
E712 comparison to False should be 'if cond is False:' or 'if not cond:'
E712 comparison to True should be 'if cond is True:' or 'if cond:'

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>
2020-05-13 16:59:07 +03:00
Laurent Pinchart
5f2160cc96 utils: raspberrypi: ctt: Fix pycodestyle E222
E222 multiple spaces after operator

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>
2020-05-13 16:59:01 +03:00
Laurent Pinchart
23cb30918c utils: raspberrypi: ctt: Fix pycodestyle E261 and E262
E261 at least two spaces before inline comment
E262 inline comment should start with '# '

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>
2020-05-13 16:58:58 +03:00
Laurent Pinchart
23db936a1f utils: raspberrypi: ctt: Fix pycodestyle E303
E303 too many blank lines

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>
2020-05-13 16:58:54 +03:00
Laurent Pinchart
e31b104fd1 utils: raspberrypi: ctt: Fix pycodestyle E701
E701 multiple statements on one line (colon)

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>
2020-05-13 16:58:37 +03:00
Laurent Pinchart
863e31fa52 utils: raspberrypi: ctt: Fix pycodestyle E228
E228 missing whitespace around modulo operator

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>
2020-05-13 16:58:32 +03:00
Laurent Pinchart
641c6ebe9b utils: raspberrypi: ctt: Fix pycodestyle E225
E225 missing whitespace around operator

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>
2020-05-13 16:58:22 +03:00
Laurent Pinchart
23f9f46c8a utils: raspberrypi: ctt: Fix pycodestyle E128
E128 continuation line under-indented for visual indent

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>
2020-05-13 16:58:12 +03:00
Laurent Pinchart
965cae72a7 utils: raspberrypi: ctt: Fix pycodestyle E251
E251 unexpected spaces around keyword / parameter equals

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>
2020-05-13 16:58:07 +03:00
Laurent Pinchart
6eb1bce9c7 utils: raspberrypi: ctt: Fix pycodestyle E211
E211 whitespace before '['

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>
2020-05-13 16:57:50 +03:00
Laurent Pinchart
adb5dedb8f utils: raspberrypi: ctt: Fix pycodestyle E241
E241 multiple spaces after ':'
E241 multiple spaces after ','

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>
2020-05-13 16:57:48 +03:00
Laurent Pinchart
d6527d382e utils: raspberrypi: ctt: Fix pycodestyle E203
E203 whitespace before ':'

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>
2020-05-13 16:57:43 +03:00
Laurent Pinchart
da88fcec0d utils: raspberrypi: ctt: Fix pycodestyle E201 and E202
E201 whitespace after '('
E201 whitespace after '{'
E201 whitespace after '['
E202 whitespace before '}'
E202 whitespace before ']'

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>
2020-05-13 16:57:30 +03:00
Laurent Pinchart
93a133fb17 utils: raspberrypi: ctt: Fix pycodestyle E231
E231 missing whitespace after ','
E231 missing whitespace after ':'

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>
2020-05-13 16:56:39 +03:00
Naushir Patuck
c01cfe14f5 libcamera: utils: Raspberry Pi Camera Tuning Tool
Initial implementation of the Raspberry Pi (BCM2835) Camera Tuning Tool.

All code is licensed under the BSD-2-Clause terms.
Copyright (c) 2019-2020 Raspberry Pi Trading Ltd.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-05-11 23:54:45 +03:00