status: extend to provide all camera options and properties in JSON payload

- control: add `device_option_is_equal`
- libcamera: provide human readable configurable options
- v4l2: include camera control values
- libcamera: store all applied controls
- libcamera: use `device_option_is_equal`
This commit is contained in:
Kamil Trzcinski
2023-06-01 23:42:18 +02:00
parent 8df8dcf2e5
commit 899f2c5e62
18 changed files with 800 additions and 163 deletions

View File

@ -4,17 +4,23 @@
#include <stdbool.h>
#include <stdio.h>
static bool isalnum_dot(char c)
{
return isalnum(c) || c == '.';
}
int device_option_normalize_name(const char *in, char *outp)
{
// The output is always shorter, so `outp=in`
// colour_correction_matrix => colourcorrectionmatrix
// Colour Correction Matrix => colourcorrectionmatrix
// ColourCorrectionMatrix => colourcorrectionmatrix
// Colour.Correction.Matrix => colour.correction.matrix
char *out = outp;
while (*in) {
if (isalnum(*in)) {
if (isalnum_dot(*in)) {
*out++ = tolower(*in++);
} else {
in++;
@ -22,5 +28,26 @@ int device_option_normalize_name(const char *in, char *outp)
}
*out++ = 0;
return out - outp;
return out - outp - 1;
}
bool device_option_is_equal(const char *a, const char *b)
{
// Similar to device_option_normalize_name
// but ignore case sensitiveness
while (*a || *b) {
while (*a && !isalnum_dot(*a))
a++;
while (*b && !isalnum_dot(*b))
b++;
if (tolower(*a) != tolower(*b))
return 0;
a++;
b++;
}
return 1;
}

View File

@ -1 +1,4 @@
#include <stdbool.h>
int device_option_normalize_name(const char *in, char *out);
bool device_option_is_equal(const char *a, const char *b);