DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

Carlos Saltos
Carlos Saltos

Posted on

Fix Chicony camera on Linux

Almost there

A couple of days ago I installed a brand new Debian bullseye 11 and everything works smoothly, the video GPU, the sound, the microphone, everything but ... the embedded camera :(

The bug

At the system logs I discovered somehow that the camera was discovered as a keyboard ... that's crazy ... what the udev system did that ?!?

The first fix attempt

I've tried to set some ignore rules at the udev configuration, it was really crazy, when I isolate the camera as a keyboard then the whole camera has isolated and if not the keyboard part wrongly appeared again.

These are all the udev rules I tried and failed miserably:

SUBSYSTEM=="input", ENV{PRODUCT}=="3/4f2/b685/5404", ATTR{authorized}="0"
ACTION=="add", SUBSYSTEM=="input", ATTR{idVendor}=="04f2", RUN="/bin/sh -c 'echo 1 >/sys/\$devpath/remove'"
SUBSYSTEM=="input", ATTRS{idVendor}=="04f2", ATTR{authorized}="0"
ATTRS{idVendor}=="04f2", ATTR{authorized}="0"
SUBSYSTEM="input", ATTRS{idVendor}=="04f2", ATTR{authorized}="0"
ATTRS{idVendor}=="04f2", ATTRS{idProduct}=="b685", ATTR{authorized}="0"
ATTRS{idVendor}=="04f2", ATTRS{idBustype}=="003", ATTR{authorized}="0"
ATTRS{idVendor}=="04f2", ATTR{authorized}="0"
Enter fullscreen mode Exit fullscreen mode

Some of them did not even do nothing ... and other did too much

Second fix attempt

I tried to ignored at the X11 configuration (the place the logs were actually picking up the error)

This is the configuration I've added to X11:

Section "InputClass"
    Identifier "catchall"
    MatchProduct "Chicony USB2.0 Camera: Chicony "
    Option "Ignore" "true"
EndSection
Enter fullscreen mode Exit fullscreen mode

And I also add a more specific configuration for the actual system keyboard to X11 like this:

Section "InputClass"
        Identifier "system-keyboard"
        MatchIsKeyboard "on"
    MatchProduct "AT Translated Set 2 keyboard"
        Option "XkbLayout" "de"
        Option "XkbVariant" "deadtilde"
EndSection
Enter fullscreen mode Exit fullscreen mode

I've have to use input, libinput, none, keyboard, system-keyboard and some variations from the vendor and product names until this trick works, the camera was not recognized as a keyboard anymore but the camera was still not working

The actual fix

After hours and hours of trying and trying and errors and errors, I've just upgraded to Debian bookworm 12 and everything magically works :) ... thank God for the great Debian community, you are the best !!

Corolary

Even after the failed attempts, I learn a lot ... I learned about udev, udevadm, hwinfo, xinput, the Linux kernels, cameras, Debian, Chinese hardware and a lot of things more ... it's a lot of fun ... but overall ... my laptop has everything working and very fast and beautiful with the new Debian bookworm 12 Linux and Gnome 3 ... thank you all always !!

Top comments (0)

16 Libraries You Should Know as a React Developer

Being a modern React developer is not about knowing just React itself. To stay competitive, it is highly recommended to explore the whole ecosystem. This article contains some of the most useful React component libraries to speed up your developer workflow.