LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Kernel (https://www.linuxquestions.org/questions/linux-kernel-70/)
-   -   V4L2 compound read-only custom control (https://www.linuxquestions.org/questions/linux-kernel-70/v4l2-compound-read-only-custom-control-4175658617/)

markus_proeller 08-05-2019 10:00 AM

V4L2 compound read-only custom control
 
Hi,

I have a camera V4L2 driver. Now I want to add the possibility to query the chip's global unique identification. This information is split into 3 registers (each 16 bit). I ended up with a new custom read-only control:
struct cam_ident {
u16 efuseval2;
u16 efuseval3;
u16 efuseval4;
};

The control is configured like this:
.ops = &cam_ctrl_ops,
.id = CAM_CID_IDENT,
.name = "Get ident information",
.type = V4L2_CTRL_COMPOUND_TYPES,
.flags = V4L2_CTRL_FLAG_HAS_PAYLOAD | V4L2_CTRL_FLAG_READ_ONLY,
.min = S32_MIN,
.max = S32_MAX,
.step = 1,
.def = 0,
.elem_size = sizeof(struct cam_ident),
.dims = {1}

1. Question:
Is this the right way to model the identfication?
2. Question:
How can I set the control's value from the kernel side?
I know that there are helper functions like v4l2_ctrl_s_ctrl or v4l2_ctrl_s_ctrl_string (taken from https://www.kernel.org/doc/html/v4.1...-controls.html), but they can't set a compound control.
I also tried setting ctrl->p_new->p and ctrl->p_cur->p also without success.

zeebra 08-17-2019 05:44 AM

How about /sys /proc?


All times are GMT -5. The time now is 08:36 PM.