[libcamera-devel,4/5] py: Fix SceneFlicker enum values
diff mbox series

Message ID 20220519103347.33295-5-tomi.valkeinen@ideasonboard.com
State Accepted
Headers show
Series
  • More misc Python patches
Related show

Commit Message

Tomi Valkeinen May 19, 2022, 10:33 a.m. UTC
Stripping 'SceneFlicker' prefix from the enum value names leads to
'50Hz' and '60Hz', which are not valid names. So add another heuristics
to keep the prefix for SceneFlicker.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
---
 src/py/libcamera/gen-py-control-enums.py | 3 +++
 1 file changed, 3 insertions(+)

Comments

Laurent Pinchart May 19, 2022, 10:51 a.m. UTC | #1
Hi Tomi,

Thank you for the patch.

On Thu, May 19, 2022 at 01:33:46PM +0300, Tomi Valkeinen wrote:
> Stripping 'SceneFlicker' prefix from the enum value names leads to
> '50Hz' and '60Hz', which are not valid names. So add another heuristics
> to keep the prefix for SceneFlicker.
> 
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  src/py/libcamera/gen-py-control-enums.py | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/src/py/libcamera/gen-py-control-enums.py b/src/py/libcamera/gen-py-control-enums.py
> index dcc28b1a..6b2b5362 100755
> --- a/src/py/libcamera/gen-py-control-enums.py
> +++ b/src/py/libcamera/gen-py-control-enums.py
> @@ -42,6 +42,9 @@ def generate_py(controls):
>  
>          if name == 'LensShadingMapMode':
>              prefix = 'LensShadingMapMode'
> +        elif name == 'SceneFlicker':
> +            # If we strip the prefix, we would get '50Hz', which is illegal name
> +            prefix = ''
>          else:
>              prefix = find_common_prefix([e['name'] for e in enum])
>

Patch
diff mbox series

diff --git a/src/py/libcamera/gen-py-control-enums.py b/src/py/libcamera/gen-py-control-enums.py
index dcc28b1a..6b2b5362 100755
--- a/src/py/libcamera/gen-py-control-enums.py
+++ b/src/py/libcamera/gen-py-control-enums.py
@@ -42,6 +42,9 @@  def generate_py(controls):
 
         if name == 'LensShadingMapMode':
             prefix = 'LensShadingMapMode'
+        elif name == 'SceneFlicker':
+            # If we strip the prefix, we would get '50Hz', which is illegal name
+            prefix = ''
         else:
             prefix = find_common_prefix([e['name'] for e in enum])