Video4Linux2 controls not working

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Video4Linux2 controls not working

1,711 Views
michael_parthei
Contributor III

Dear all,

we are in the process of bringing up a new camera sensor (OV2311) with the iMX8M Mini SoC using Yocto. We created a new driver for the sensor and are able to capture images and stream video using GStreamer.

However, the camera driver supports manual control of the sensor exposure time using standard V4L2 controls (V4L2_CID_EXPOSURE control) but this is not working, opening the camera device and trying to set the exposure time using ioctl call fails.

According to this forum post about the iMX6, the V4L2 implementation in NXP's yocto linux is incomplete, but even the "solution" mentioned in that post, namely controlling the sensor using ioctl, is not working for us on the iMX8M Mini.

Is there any other way of controlling the camera parameters like exposure time from Linux userspace?

Thanks,

Michael

Tags (1)
3 Replies

1,481 Views
kunalkotecha1
Senior Contributor II

Hi michael.partheil@gmail.com,

The link you are referring is using gstreamer-imx-plugins for i.MX6 SoC. Unfortunately, gstreamer-imx-plugins are not supported for i.MX8. Please look at GitHub - Freescale/gstreamer-imx: GStreamer 1.0 plugins for i.MX platforms .

Not tried but just a suggestion, there can be two ways:

  1. You can change the camera paramaters using an i2C. You can have an "reg" property in sysfs and write the address and value of registers you want to modify, or, you can use an application which is opening an I2C device and writing and reading the registers.
  2. You can put your ioctls in generic gstreamer v4l2 plugin.If you have tried this, where it is getting stuck?I mean your v4l2 ioctl is not called or driver api is not getting called?Can you explain this further?

Regards,

Kunal

1,481 Views
michael_parthei
Contributor III

Dear Kunal,

thank you very much for your suggestions!

Regarding the gstreamer plugins: the post I mentioned was just meant as an example of someone else also having similar problems setting the V4L2 controls, we found this problem independently of GStreamer. Basically, in our application, we `open()` the camera device ("/dev/video0") and try to set the exposure using an `ioctl()` which fails (error code 25, "Inappropriate ioctl for device").

Concerning your suggestions:

  1. We tried directly writing to the I2C register using the `i2cset` and `i2cget` command line tools, however, this fails because the I2C address of the camera is associated with the camera driver in the device tree and hence Linux does not allow accessing that device ("resource busy" - yes there is an option to force it but seems a bit too extreme). I'm not really sure what you mean with having a "reg" property in sysfs - could you please clarify how this could be done?
  2. Yes, really the problem is that the `ioctl()` call fails, no matter if done from a gstreamer plugin or just from our application directly. Also putting debug messages in our camera driver in the function that ultimately handles the ioctl this is (unsurprisingly) not called at all. I did look in the v4l2 implementation from NXP and, even without me understanding much, there were tons of "unimplemented" comments so my suspicion was that somehow NXP's implementation simply does not correctly forward the ioctl() calls to the camera driver.

Again, thank you very much for your help, it is much appreciated!

Best,
Michael

0 Kudos

1,481 Views
michael_parthei
Contributor III

Anyone? Is the question not clear? Could someone from NXP please comment on whether this is supported or not.

0 Kudos