Skip to content

Conversation

@sorig
Copy link

@sorig sorig commented Jan 16, 2026

Hey Folk maintainers!

I had some problems getting my camera (Logitech C270) to work. Other cameras could also hit these code paths, so I'm sharing the fix here.

Problem and identified causes

When I was setting up my folk instance, I got stuck at the calibration step. Although the device was showing up in the cameras list, the camera preview was not showing anything on the /setup and /calibrate pages. Looking at the Folk log I could see that camera selection was failing:

folk-esben make[9387]: camera/usb: Loaded /dev/v4l/... -> (Camera*) 0x75c4440f7a90
folk-esben make[9387]: camera/usb: VIDIOC_S_FMT: ret = 0 (0) (Success)
folk-esben make[9387]: Error in builtin-programs/camera/usb.folk: selection failed of fd 7

After a bit of experimentation, it looks like my camera was too slow to start up. Extending the timeout to 2 seconds and adding a retry mechanism fixed this issue for me. The C270 often only starts streaming on the second attempt with my fix:

folk-esben make[3561]: camera/usb: select timeout on fd 18, retry 1/4

At this point I could now see the camera preview on /setup and /calibrate, but when I started the calibration process, the AprilTags weren't being recognised at all. The tag grid was showing but nothing happened when I positioned the calibration board correctly.

Looking at the logs I was now seeing lots of these messages:

camera/usb: Error cameraDecompressGray: Decompression failed: Corrupt JPEG data: 3 extraneous bytes before marker 0xd6

Turns out that this Turbo jpeg message was actually a warning rather than a fatal error. I guess my particular camera streams slightly weird data. Folk treated the warning as a fatal error hence no AprilTag detection.

@osnr osnr requested a review from cwervo January 17, 2026 08:13
@osnr osnr requested a review from ppkn January 17, 2026 08:19
@osnr osnr unassigned ppkn Jan 17, 2026
@osnr
Copy link
Collaborator

osnr commented Jan 17, 2026

Can you guys test this? If it works on 2 different tabletop systems (I can test here too but only have gadget) I think fine to merge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants