Ricardo's Place Robotics, machine learning, or simply random thoughts!

Old digital microscope was driving Ubuntu nuts!

Today I needed to check some connections in the PCB of my ST-Link V2 clone because I wanted to add the trace support following the nice explanations from here. However, my old brandless digital microscope (you know, they all look the same and come in a blue box…) refused to work. dmesg helped me find some repeated error messages (Failed to query (GET_DEF) UVC control 4 on unit 1 or Failed to query (GET_MIN) UVC control 4 on unit 1) and a little bit of google-fu did the rest. I found my system was suffering from a problem with libwebcam0 and uvcdynctrl and the log file /var/log/uvcdynctrl-udev.log was already at 68GB (?!?).

I learned this is a super old bug (first message is from 2011!) and it can slow down your system to a halt. Using apt show and the very useful apt-rdepends I noticed libwebcam0 and uvcdynctrl just depended on each other… so following the suggestion and removing libwebcam0, uvcdynctrl and uvcdynctrl-data solved my problem (sudo apt remove libwebcam0 uvcdynctrl uvcdynctrl-data).

I hope this blog post can help other people avoid spending time on google to solve the same 11-year-old problem…

UPDATE (29/01/2023):
Ubuntu Cheese sometimes is too picky and stops the stream with an error message, so I suggest using ffplay. First, connect your microscope (webcam) and check the devices available (v4l2-ctl --list-devices):

USB2.0 UVC PC Camera: USB2.0 UV (usb-0000:00:14.0-2):
	/dev/video2
	/dev/video3

Integrated_Webcam_HD: Integrate (usb-0000:00:14.0-5):
	/dev/video0
	/dev/video1

In my situation, the microscope was the USB2.0 UVC PC Camera. You can get extra info with ffmpeg -f v4l2 -list_formats all -i /dev/video2. Finally, just use ffplay /dev/video2.