ArduCAM / Arducam-Pivariety-V4L2-Driver

This driver is used for Arducam mipi camera with Pivariety board
37 stars 22 forks source link

focuser.py : OSError: [Errno 25] Inappropriate ioctl for device #20

Open deepcoder opened 2 years ago

deepcoder commented 2 years ago

with: Arducam 16MP Autofocus Raspberry Pi Camera Module

I am getting the following error when trying to run your autofocus example.

Traceback (most recent call last):
  File "/home/pi/v4l2_utils.py", line 64, in get_device_controls_by_class
    fcntl.ioctl(fd, v4l2.VIDIOC_QUERYCTRL, queryctrl)
OSError: [Errno 25] Inappropriate ioctl for device

During handling of the above exception, another exception occurred:
kbingham commented 2 years ago

That means the RPi kernel is not using a patched driver for the VCM. I have this working locally, and Arducam also provide the fix (I think in this repository). I'll be working towards getting this integrated in the RPi kernel and upstream too - but I don't know when I'll complete that.

kbingham commented 2 years ago

In fact, I fear 'Inappropriate ioctl' might also be that you are trying to operate the focuser on the wrong device... Have you patched your device tree and kernel sources for the RPi?

arogozhnikov commented 2 years ago

I have same problem with 64mp autofocus camera. I've followed all instructions to install patch to kernel and dt overlay. Autofocusing works on camera, but the code provided in the repo does not

arogozhnikov commented 2 years ago

actually @kbingham above is correct: I used the wrong device, and the correct one was /dev/v4l-subdev1 for arducam64mp

kbingham commented 2 years ago

Glad you resolved it. I hope we'll get the focus support for these devices merged in libcamera which will make sure it gets the right device to prevent this confusion in the future.