WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: v4l2 driver not loading with dtoverlay  (Read 1896 times)

Offline zharr

  • Newbie
  • *
  • Posts: 29
v4l2 driver not loading with dtoverlay
« on: May 16, 2022, 11:24:07 PM »
Hey,
I'm having trouble loading the built-in driver for the OV9281.
On Raspbian, instead of loading the camera with "start_x" etc, the OV9281 driver is loaded with "dtoverlay=ov9281".
However, this does not seem to work on piCore.
The cameras I2C ports are there, I can adress it manually using i2c-tools and read/write the registers.
So the camera is there and working, and I could potentially manually implement the driver.
The v4l2 device /dev/video0 is also there (unicam driver), and after I load my program and it sets the format, that format is retained when I check "v4l2-ctl --all", so I think v4l2 itself is functioning fine as well.
But no info about device capabilities, driver, the controls it exposes, etc., hence I conclude everything works, except for the driver not being loaded/assigned to the camera.

Any idea how to load it manually or debug what piCore does with dtoverlay on startup?

As a side note, I update wifi.sh to have a mode that autoconnects to the best available known network, which is very useful for headless setups.
I also made a script that allows for a completely headless setup without ever using a keyboard or screen.
It sets up the SD card, configures the device, loads and installs extensions, etc. from a linux host machine, and on first boot it immediately sets up SSH on whichever of the known networks is closest.
Took me a while to get there as the wiki is down, so if there's a place I can put it (besides my project repo), please tell me.

Thanks!

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11659
Re: v4l2 driver not loading with dtoverlay
« Reply #1 on: May 16, 2022, 11:36:21 PM »
Hi zharr
Welcome to the forum.

While you may not post binaries (or direct links to binaries) you are free to attach scripts to your post. Or if you
wish, you can start a separate topic and attach your script there.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11659
Re: v4l2 driver not loading with dtoverlay
« Reply #2 on: May 17, 2022, 12:12:37 AM »
Hi zharr
The  ov9281.ko  driver is located in  v4l-dvb-KERNEL.tcz.

Offline zharr

  • Newbie
  • *
  • Posts: 29
Re: v4l2 driver not loading with dtoverlay
« Reply #3 on: May 17, 2022, 12:33:59 AM »
Hi zharr
Welcome to the forum.

While you may not post binaries (or direct links to binaries) you are free to attach scripts to your post. Or if you
wish, you can start a separate topic and attach your script there.

Thanks, posted it here: http://forum.tinycorelinux.net/index.php/topic,25760.0.html

Hi zharr
The  ov9281.ko  driver is located in  v4l-dvb-KERNEL.tcz.

Thanks for the info, my script installed it automatically and I verified it is loaded, so that was not the issue, unfortunately.

Offline zharr

  • Newbie
  • *
  • Posts: 29
Re: v4l2 driver not loading with dtoverlay
« Reply #4 on: May 17, 2022, 12:42:18 AM »
Huh, lsmod shows ov9281 is loaded and it says it is used by 1.
So maybe this is more a v4l2 misbehaving issue, or I made some other error.

Offline zharr

  • Newbie
  • *
  • Posts: 29
Re: ov9281 v4l2 driver not working properly
« Reply #5 on: May 19, 2022, 03:38:20 AM »
Verified driver loads, very similar behaviour to raspbian on startup
- Detected OV009281 sensor - same
- Consider updating driver ov9281 to match on endpoints - only piCore
- and three regulators dvdd, dovdd, avdd being disabled - same
So the update note worries me a bit, but can't find where it even originates from

 Once I start the app, "unicam_log_status" shows the status on both systems in dmesg.
Interestingly, the Raspbian version initialises into a valid state for the ov9281, that is 1280x800 @ 10bit (MEDIA_BUS_FMT_Y10_1X10)
The piCore version initialises to 640x480 (MEDIA_BUS_FMT_YUYV8_2X8), which is NOT a valid mode, neither the mediabus format nor the resolution is valid.
Upon starting the program, both get set to a valid state (1280x800, MEDIA_BUS_FMT_Y8_1X8), but the piCore one spews errors.
With v4l2 logging enabled (echo 1 > /sys/class/video4linux/video0/dev_debug) it shows the following:
Code: [Select]
VIDEOC_LOG_STATUS
VIDEOC_TRY_FMT
VIDEOC_S_FMT
VIDEOC_G_FMT
VIDEOC_QUERYCTRL: error -25 (repeated)
VIDEOC_REQBUFS
VIDEOC_QUERYBUF (repeated)
unicam 3f801000.csi: Failed to start media pipeline: -22
VIDEOC_STREAMON: error -22
VIDEOC_REQBUFS
These controls I'm querying should all be supported by the driver.
Once it tries to start the stream it fails with -22 (does this refer to EINVAL?)
But all generic camera opterations supported by (I assume) all drivers work.
So I still don't know if its loaded, or just at the beginning? Something is weird for sure.
Unfortunately I don't know a way to verify it's loaded, it always only says unicam as the driver.

Any ideas are greatly appreciated.

Offline zharr

  • Newbie
  • *
  • Posts: 29
Re: v4l2 driver not loading with dtoverlay
« Reply #6 on: May 19, 2022, 05:41:37 AM »
Welp, there we have it
https://forums.raspberrypi.com/viewtopic.php?t=322076
Old image used an older version so didn't have this problem.
New config.txt line fixed it:
dtoverlay=ov9281,media-controller=0
Very annoying breaking changes.
In conclusion: Not piCore related at all.