From aa9807303adbbc56ab93c835e463a49e3d410a4a Mon Sep 17 00:00:00 2001 From: aler9 <46489434+aler9@users.noreply.github.com> Date: Tue, 19 Sep 2023 11:23:17 +0200 Subject: [PATCH] rpi camera: add additional checks on configuration --- internal/conf/path.go | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/internal/conf/path.go b/internal/conf/path.go index 69b6b655718..2d2607f55ca 100644 --- a/internal/conf/path.go +++ b/internal/conf/path.go @@ -256,6 +256,48 @@ func (pconf *PathConf) check(conf *Conf, name string) error { } } + switch pconf.RPICameraExposure { + case "normal", "short", "long", "custom": + default: + return fmt.Errorf("invalid 'rpiCameraExposure' value") + } + + switch pconf.RPICameraAWB { + case "auto", "incandescent", "tungsten", "fluorescent", "indoor", "daylight", "cloudy", "custom": + default: + return fmt.Errorf("invalid 'rpiCameraAWB' value") + } + + switch pconf.RPICameraDenoise { + case "off", "cdn_off", "cdn_fast", "cdn_hq": + default: + return fmt.Errorf("invalid 'rpiCameraDenoise' value") + } + + switch pconf.RPICameraMetering { + case "centre", "spot", "matrix", "custom": + default: + return fmt.Errorf("invalid 'rpiCameraMetering' value") + } + + switch pconf.RPICameraAfMode { + case "auto", "manual", "continuous": + default: + return fmt.Errorf("invalid 'rpiCameraAfMode' value") + } + + switch pconf.RPICameraAfRange { + case "normal", "macro", "full": + default: + return fmt.Errorf("invalid 'rpiCameraAfRange' value") + } + + switch pconf.RPICameraAfSpeed { + case "normal", "fast": + default: + return fmt.Errorf("invalid 'rpiCameraAfSpeed' value") + } + default: return fmt.Errorf("invalid source: '%s'", pconf.Source) }