ioctl Errors and Intermediate Vision sample not working

ioctl Errors:
ERROR: ioctl VIDIOC_S_CTRL failed at UsbCameraProperty.cpp:72: Input/output error (UsbUtil.cpp:122)
ERROR: ioctl VIDIOC_S_EXT_CTRLS failed at UsbCameraProperty.cpp:66: Input/output error (UsbUtil.cpp:122)
ERROR: ioctl VIDIOC_S_EXT_CTRLS failed at UsbCameraProperty.cpp:66: Input/output error (UsbUtil.cpp:122)

What do they mean and how do I fix them?

Additionaly, I tried running the Intermediate VIsion example and when I changed the camera properties to the OpenCV output I got the following error:
ERROR: serve_Processed: : Too many simultaneous client streams (MjpegServerImpl.cpp:403)

What do these errors mean and how do I fix them?

Thanks in advance!

Well, I fixed the problem that the template did not work, but the CvSource keeps sending the error that it has no connection, why does this happen?

For the first errors, which properties are you trying to set? There as some properties that will fail to be set if a certain other property is at a specific setting. For an example, if the exposure type is set to auto (which it is by default) any attempt to set the exposure manually will print that error. Knowing which camera, and which property you are trying to set will help debug that.

We’re taking a look into the too many streams issue. For now, make sure all dashboards are closed, all internet browsers are closed, and restart the program. It seems like something is opening multiple stream connections.

Thanks!

We fixed the too many streams issue and we got into another issue, when we try to grab the frame, it returns 0 (meaning there’s an issue). The issue is that there is no connection. How do we fix that? I mean, when we use the normal camera without processing it (in the smartdashboard just setting the property to USB Camera 0) it works and shows a consistent stream. When we switch the property to the one that’s processing, it starts making these errors.

Hi, our team uses C++, but we currently have the same “Too many simultaneous client streams” error when sending a CvSource to the SmartDashboard. Could you explain how you solved it? Thanks!

I’m actually not quite sure, we just re-created the file and wrote it from scratch. I guess some line there was a mistake that didn’t repeat.

We seem to be having the same issue.

We are just trying to initialize the USB camera (using Java) by doing this:

camera = CameraServer.getInstance().startAutomaticCapture()

and we are getting this:

CS: ERROR: ioctl VIDIOC_S_EXT_CTRLS failed at UsbCameraProperty.cpp:66: Input/output error (UsbUtil.cpp:122)
Exception in thread “NTListener” VideoException [edu.wpi.cscore.VideoException: property write failed]
at edu.wpi.cscore.CameraServerJNI.setProperty(Native Method)
at edu.wpi.cscore.VideoProperty.set(VideoProperty.java:68)
at edu.wpi.first.wpilibj.CameraServer.lambda$new$1(CameraServer.java:498)
at edu.wpi.first.wpilibj.CameraServer$$Lambda$2/3326003.apply(Unknown Source)
CS: USB Camera 0: set FPS to 0
CS: ERROR: ioctl VIDIOC_S_EXT_CTRLS failed at UsbCameraProperty.cpp:66: Input/output error (UsbUtil.cpp:122)
Exception in thread “NTListener” VideoException [edu.wpi.cscore.VideoException: property write failed]
at edu.wpi.cscore.CameraServerJNI.setProperty(Native Method)
at edu.wpi.cscore.VideoProperty.set(VideoProperty.java:68)
at edu.wpi.first.wpilibj.CameraServer.lambda$new$1(CameraServer.java:498)
at edu.wpi.first.wpilibj.CameraServer$$Lambda$2/3326003.apply(Unknown Source)
CS: ERROR: ioctl VIDIOC_S_CTRL failed at UsbCameraProperty.cpp:72: Input/output error (UsbUtil.cpp:122)
Exception in thread “NTListener” VideoException [edu.wpi.cscore.VideoException: property write failed]
at edu.wpi.cscore.CameraServerJNI.setProperty(Native Method)
at edu.wpi.cscore.VideoProperty.set(VideoProperty.java:68)
at edu.wpi.first.wpilibj.CameraServer.lambda$new$1(CameraServer.java:498)
at edu.wpi.first.wpilibj.CameraServer$$Lambda$2/3326003.apply(Unknown Source)

im getting a “too many camera streams” as well. also, has anyone managed to switch cameras on the fly? mine keep throwing a fit.

Any update on the IOCTL errors? This is a problem for us too.

Our team has a switching camera now, and one thing that I’ve seen is these errors. They didn’t seem to affect anything, so I left the code as it was. At one point I named our cameras “Front facing” and “rear facing”, but noticed there was another stream for “USB Camera 0”. It took a few minutes, but I located a place in the code where I was accidentally starting a second stream for the camera with id 0. After removing this declaration, these errors disappeared.

This may or may not be your problem, a lot of things in my code were being changed around and moved. I’m not certain this was the cause of the problem, so take it with a grain of salt.

Ehhh… take a look at that last line. You aren’t trying to set your FPS rate to 0 anywhere, are you? I could see why the ioctl call would pitch a fit if you did.

On the topic of camera stream properties we had a horrible time trying to set exposure and white balance through wpilib last year. This year we’ve put v4l-utils on the roboRio and are calling out to the shell to set them via v4l2-ctl instead. Works much better and you can run through them on the command line and get a lot better information about what’s a valid setting and what isn’t. One example being wpilib says exposure goes from 0 to 100 in the JavaDocs. It doesn’t… it’s not even constant across cameras. The Logitechs we use go from 3 to 2047.

I’ve seen that “set FPS to 0” problem too - not sure what’s causing it as it is definitely not our code.

We seem to have worked around the ioctl errors by calling the camera setters multiple times from different places in the code. (e.g. in robotInit() and teleopInit()). Not sure why exactly that works…

We’ve gotten it to work. It’s not too tricky. I’d say the only “gotcha” is that you should pull a frame from each camera well before you want to stream them as it can take the v4l subsystem a while to open everything up. If you try to open the new camera and grab that first frame upon switching you’ll hang for a couple of seconds.