I'm trying to reuse an old laptop webcam that uses an USB interface to communicate, is a Ricoh camera with chipset r5u870.
I found a repository on github that I forked since it doesn't work with the latest kernel and I made it compilable.
Once installed the driver it recognizes the webcam but when I use an application to access the video stream I receive the error VIDIO_QUERYCAP failed inappropriate ioctl for device; this seems strange to me since I see the ioctl related callbacks connected, so probably I'm missing something of the inner working of a v4l2 driver.
Is there any resource for understanding the failing point of a v4l2 driver? or any debugging hints?
It may be too late, but I'll answer anyway.
So, the main problem with that driver is outdated kernel interfaces. The driver itself was written back in the days of 2.6.X. Since then, a lot has changed in the kernel.
Some time ago I purchased a UMPC VGN-UX. It uses one of these cameras. I started trying to get the camera to work and found this module. At that time it was already broken and its assembly was failing with errors.
I started by trying to figure out the problem and fix the driver. I even found some problems and wrote about them here https://github.com/3pei/r5u870/issues/6 and here https://github.com/3pei/r5u870/issues/7
I started digging deeper and came to the conclusion that the querycap error was not the main problem at all.
The kernel documentation states that this call is used to determine the capabilities of the device. https://www.kernel.org/doc/html/v5.10/userspace-api/media/v4l/vidioc-querycap.html
But, as I indicated above, this is not the main problem. The main problem is outdated interfaces. In particular, the module uses legacy v4l1 calls, which have been replaced by v4l2 in the modern kernel. In addition, if my memory serves me correctly, that module has problems with V4L2 Controls.
As a result, I read the book Linux Device Drivers and started rewriting the module, trying to find and fix errors. As a result, the module had to be rewritten almost completely, because... it contained a lot of outdated code. You can get my version of the module here https://notabug.org/64coreCPU/r5u870v2
It compiles and runs on more or less modern kernels. At least on the 5.X.X line. It works without problems on my camera. Unfortunately, I don’t have all the cameras to check and debug their operation either. What I didn't have the strength and desire to do was work with DMA.