Hi, I’m using the Arducam IMX298 USB AF camera (SKU: B0290) on Linux (Raspberry Pi), and I’m trying to control the focus from the command line with v4l2-ctl on /dev/video0.
The problem: when I switch off auto focus and try to set a manual focus position, the value seems to be accepted but nothing happens in the actual image - it stays soft and never refocuses where I want. I’m not even sure I’m using the right control names. Any pointers would be great.
You’re correct that auto/manual focus on this camera is meant to be handled through the v4l2-ctl tool, not some other interface. We tested the camera here and the auto focus control parameter is focus_auto (manual position is set with focus_absolute).
focus_absolute ranges from 0 to 1023, where turning off auto focus (focus_auto=0) should hand control over to you. Let us know what you see, and we’ll look into the second issue you reported as well.
Thanks. First, a question about the procedure: does that mean I have to set the absolute focus once to the minimum and once to the maximum before setting the value I actually want? Because just switching off auto focus and then setting the desired value doesn’t do anything for me.
I also tried to reproduce your steps, but the command focus_auto doesn’t exist on my unit. Here it’s called focus_automatic_continuous instead. And when I set another absolute value with focus_absolute, the new value is displayed correctly (so the write goes through), but the image doesn’t change at all - the focus value just isn’t applied.
One more thing: does this camera have an adjustable aperture? Aperture settings can affect the sharpness depth / depth of field, so I’m wondering if that’s related.
OK, let’s not guess at the names - let’s enumerate everything the camera actually exposes so we can pick the correct focus-related controls from the full list.
Please run this and paste the output here (a screenshot is fine too):
v4l2-ctl -d /dev/video0 -L
That will show all the control parameters the device reports, and from there we can identify the right ones.
Thanks. Since this is the IMX298 USB camera (SKU: B0290), our guess is that the firmware on your unit isn’t the latest version - the naming difference you’re seeing (focus_automatic_continuous instead of focus_auto) is a sign of that.
I’ve sent you the firmware package and the burning steps through private message. Please check it, flash the latest firmware, and then report back whether any problem remains after the update.
Before I burn anything - is it possible that my cameras simply have a different firmware version? Some details on my unit:
Camera marking on the back: UC-724 Rev.D
Connected via USB. Here’s the info from dmesg -T:
[Mi, 17. Aug 2022, 22:11:37] usb 1-3: New USB device found, idVendor=0c45, idProduct=636d, bcdDevice= 1.00
[Mi, 17. Aug 2022, 22:11:37] usb 1-3: New USB device strings: Mfr=2, Product=1, SerialNumber=3
[Mi, 17. Aug 2022, 22:11:37] usb 1-3: Product: Arducam IMX298 AF Camera
[Mi, 17. Aug 2022, 22:11:37] usb 1-3: Manufacturer: Arducam Technology Co., Ltd.
[Mi, 17. Aug 2022, 22:11:37] usb 1-3: SerialNumber: UC724
[Mi, 17. Aug 2022, 22:11:37] usb 1-3: Found UVC 1.00 device Arducam IMX298 AF Camera (0c45:636d)
[Mi, 17. Aug 2022, 22:11:37] input: Arducam IMX298 AF Camera: Arduc as /devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.0/input/input75
Thanks for the dmesg output. It confirms the device enumerates as “Arducam IMX298 AF Camera” (0c45:636d), UVC 1.00, bcdDevice 1.00, serial UC724 - so it is the IMX298 AF camera and it’s being detected fine over USB.
Where we are right now (not fully resolved yet):
Auto/manual focus on this camera is controlled through v4l2-ctl.
On your unit the autofocus control is exposed as focus_automatic_continuous rather than focus_auto, and setting focus_absolute writes the value but doesn’t change the image.
We suspect the firmware isn’t the latest, which is why we asked you to flash it.
Please burn the firmware package we sent you privately, then test again:
If the focus still isn’t applied after the firmware update, post back with the full output of v4l2-ctl -d /dev/video0 -L and we’ll dig deeper from there.