On 15/01/2021 12:53, Sebastian Fricke wrote: > Hello, > > I believe you are the creator of v4l2-compliance, right? My hope is that you might be able to lead me in the right direction. > I am currently finishing up a sensor driver that I ported from a downstream kernel. And I try to clear up the last compliance error: > > ``` > info: checking control event 'User Controls' (0x00980001) > VIDIOC_SUBSCRIBE_EVENT returned -1 (Inappropriate ioctl for device) This returns ENOTTY, which is weird... > fail: v4l2-test-controls.cpp(818): subscribe event for control 'User Controls' failed > test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: FAIL > ``` > > I notice that it calls a normal v4l2 ioctl on my subdevice. I implemented the event handling just like I was able to find in other devices like: > imx219, imx355, ov2640 by adding: > > ``` > #include <media/v4l2-event.h> > ... > sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE | > V4L2_SUBDEV_FL_HAS_EVENTS; > ... > static const struct v4l2_subdev_core_ops ov13850_core_ops = { > ... > .subscribe_event = v4l2_ctrl_subdev_subscribe_event, > .unsubscribe_event = v4l2_event_subdev_unsubscribe > ... > ``` ...since this looks exactly as it should be. > > Am I supposed to correct that error, or asked in another way is it actually an error when a subdevice doesn't implement VIDIOC_SUBSCRIBE_EVENT? Yes, it is an error if subscribe_event isn't implemented, but you DO have controls in your driver. Are you compiling v4l2-compliance from the git repo? You shouldn't use the version packages by distros since that is typically much too old. I can't give support either if you are using an old version. > Additionally, I noticed that the compliance check doesn't look at my VIDIOC_SUBDEV_G_SELECTION implementation but instead searches for any implementation of the VIDIOC_G_SELECTION ioctl. It shouldn't, at least v4l2-test-subdevs.cpp only uses VIDIOC_SUBDEV_G_SELECTION. Regards, Hans > > I invoked the compliance test with: > > v4l2-compliance -u /dev/v4l-subdev3 -v -T > > My current code can be located here: https://github.com/initBasti/Linux_kernel_media_tree_fork/blob/fix_subscribe_event_user_controls/drivers/media/i2c/ov13850.c > > Greetings and thanks in advance, > Sebastian >