Sonix Webcam doesn't work (/dev/video0: not a v4l2 node)

After a recent Stable update (2022-09-12 or 2022-10-05 or 2022-10-10) my webcam stopped being recognized by the system. It was working fine before.

I have also traveled with the laptop during this time, so might be a hardware issue.

The webcam is built into the laptop.

What happens is that the webcam is being recognized by the system, but after about 5 seconds an error happens ('/dev/video0' VIDIOC_QUERYCTRL: Protocol error; Cannot open '/dev/video0': 2, No such file or directory) and the recognition process starts anew.

I have tried googling the problem & tried several fixes (adding my user to video group, loading uvcvideo in quirks mode, adding custom config to udev/rules.d). I’m not sure if I did it right, but it didn’t help.

Any suggestions on how to debug/fix it are greatly appreciated.

Below is the different diagnostic output that I gathered.

inxi
System:
  Host: computer1 Kernel: 6.0.6-1-MANJARO arch: x86_64 bits: 64
    Desktop: KDE Plasma v: 5.26.2 Distro: Manjaro Linux
Machine:
  Type: Laptop System: ASUSTeK product: ASUS TUF Gaming A17 FA706IU_FX706IU
    v: 1.0 serial: M4NRCX04813616D
  Mobo: ASUSTeK model: FA706IU v: 1.0 serial: M416NRCX00CHTKMB
    UEFI: American Megatrends v: FA706IU.315 date: 01/29/2021
Battery:
  ID-1: BAT1 charge: 81.8 Wh (98.3%) condition: 83.2/90.2 Wh (92.2%)
    volts: 16.4 min: 15.9
CPU:
  Info: 8-core AMD Ryzen 7 4800H with Radeon Graphics [MT MCP] speed (MHz):
    avg: 1493 min/max: 1400/2900
Graphics:
  Device-1: NVIDIA TU116M [GeForce GTX 1660 Ti Mobile] driver: nvidia
    v: 520.56.06
  Device-2: AMD Renoir driver: amdgpu v: kernel
  Device-3: Sonix USB2.0 HD UVC WebCam type: USB driver: uvcvideo
  Display: x11 server: X.Org v: 21.1.4 driver: X: loaded: amdgpu,nvidia
    unloaded: modesetting,nouveau dri: radeonsi gpu: amdgpu
    resolution: 1920x1080~120Hz
  API: OpenGL v: 4.6 Mesa 22.2.1 renderer: RENOIR (renoir LLVM 14.0.6 DRM
    3.48 6.0.6-1-MANJARO)
Network:
  Device-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet
    driver: r8169
  Device-2: Realtek RTL8822CE 802.11ac PCIe Wireless Network Adapter
    driver: rtw_8822ce
Drives:
  Local Storage: total: 476.94 GiB used: 329.84 GiB (69.2%)
Info:
  Processes: 405 Uptime: 21h 20m Memory: 15.05 GiB used: 6.86 GiB (45.6%)
  Shell: Bash inxi: 3.3.23
journald

There logs repeat themselves every 5 seconds. In each iteration there is different input number input6660 and different device number device 13

05.11.2022 09:36:36:659	pipewire	spa.v4l2: '/dev/video0' VIDIOC_QUERYCTRL: Protocol error
05.11.2022 09:36:36:659	pipewire	spa.v4l2: Cannot open '/dev/video0': 2, No such file or directory
05.11.2022 09:36:36:659	kernel	usb 3-4: USB disconnect, device number 12
05.11.2022 09:36:36:660	kernel	usb 3-4: Failed to query (GET_DEF) UVC control 2 on unit 2: -71 (exp. 2).
05.11.2022 09:36:36:660	pipewire-media-session	ms.core: error id:76 seq:346665 res:-71 (Protocol error): enum params id:1 (Spa:Enum:ParamId:PropInfo) failed
05.11.2022 09:36:36:996	kernel	usb 3-4: new high-speed USB device number 13 using xhci_hcd
05.11.2022 09:36:37:166	kernel	usb 3-4: New USB device found, idVendor=322e, idProduct=202c, bcdDevice= 1.03
05.11.2022 09:36:37:167	kernel	usb 3-4: New USB device strings: Mfr=2, Product=1, SerialNumber=0
05.11.2022 09:36:37:167	kernel	usb 3-4: Product: USB2.0 HD UVC WebCam
05.11.2022 09:36:37:167	kernel	usb 3-4: Manufacturer: Sonix Technology Co., Ltd.
05.11.2022 09:36:37:176	kernel	usb 3-4: Found UVC 1.00 device USB2.0 HD UVC WebCam (322e:202c)
05.11.2022 09:36:37:189	kernel	input: USB2.0 HD UVC WebCam: USB2.0 HD as /devices/pci0000:00/0000:00:08.1/0000:05:00.3/usb3/3-4/3-4:1.0/input/input6660
05.11.2022 09:36:37:194	mtp-probe	checking bus 3, device 13: "/sys/devices/pci0000:00/0000:00:08.1/0000:05:00.3/usb3/3-4"
05.11.2022 09:36:37:195	mtp-probe	bus: 3, device: 13 was not an MTP device
05.11.2022 09:36:37:867	mtp-probe	checking bus 3, device 13: "/sys/devices/pci0000:00/0000:00:08.1/0000:05:00.3/usb3/3-4"
05.11.2022 09:36:37:870	mtp-probe	bus: 3, device: 13 was not an MTP device
dmesg
[computer1 ~]# dmesg
[38292.892912] usb 3-4: USB disconnect, device number 106
[38292.893210] usb 3-4: Failed to query (GET_DEF) UVC control 2 on unit 2: -71 (exp. 2).
[38293.245896] usb 3-4: new high-speed USB device number 107 using xhci_hcd
[38293.409853] usb 3-4: New USB device found, idVendor=322e, idProduct=202c, bcdDevice= 1.03
[38293.409863] usb 3-4: New USB device strings: Mfr=2, Product=1, SerialNumber=0
[38293.409868] usb 3-4: Product: USB2.0 HD UVC WebCam
[38293.409871] usb 3-4: Manufacturer: Sonix Technology Co., Ltd.
[38293.418034] usb 3-4: Found UVC 1.00 device USB2.0 HD UVC WebCam (322e:202c)
[38293.432397] input: USB2.0 HD UVC WebCam: USB2.0 HD as /devices/pci0000:00/0000:00:08.1/0000:05:00.3/usb3/3-4/3-4:1.0/input/input6379
[38298.926679] usb 3-4: USB disconnect, device number 107
[38298.926943] usb 3-4: Failed to query (GET_DEF) UVC control 2 on unit 2: -71 (exp. 2).
[38299.272502] usb 3-4: new high-speed USB device number 108 using xhci_hcd
[38299.440241] usb 3-4: New USB device found, idVendor=322e, idProduct=202c, bcdDevice= 1.03
[38299.440245] usb 3-4: New USB device strings: Mfr=2, Product=1, SerialNumber=0
[38299.440247] usb 3-4: Product: USB2.0 HD UVC WebCam
[38299.440248] usb 3-4: Manufacturer: Sonix Technology Co., Ltd.
[38299.450394] usb 3-4: Found UVC 1.00 device USB2.0 HD UVC WebCam (322e:202c)
[38299.464952] input: USB2.0 HD UVC WebCam: USB2.0 HD as /devices/pci0000:00/0000:00:08.1/0000:05:00.3/usb3/3-4/3-4:1.0/input/input6380
[38304.958929] usb 3-4: USB disconnect, device number 108
[38304.959203] usb 3-4: Failed to query (GET_DEF) UVC control 2 on unit 2: -71 (exp. 2).
[38305.282584] usb 3-4: new high-speed USB device number 109 using xhci_hcd
[38305.446900] usb 3-4: New USB device found, idVendor=322e, idProduct=202c, bcdDevice= 1.03
[38305.446910] usb 3-4: New USB device strings: Mfr=2, Product=1, SerialNumber=0
[38305.446914] usb 3-4: Product: USB2.0 HD UVC WebCam
[38305.446917] usb 3-4: Manufacturer: Sonix Technology Co., Ltd.
[38305.454392] usb 3-4: Found UVC 1.00 device USB2.0 HD UVC WebCam (322e:202c)
[38305.468865] input: USB2.0 HD UVC WebCam: USB2.0 HD as /devices/pci0000:00/0000:00:08.1/0000:05:00.3/usb3/3-4/3-4:1.0/input/input6381
v4l2-ctl --list-devices
[computer1 ~]# v4l2-ctl --list-devices
USB2.0 HD UVC WebCam: USB2.0 HD (usb-0000:05:00.3-4):
        /dev/video0
        /dev/video1
        /dev/media0

Or alternatively:

[computer1 ~]# v4l2-ctl --list-devices
USB2.0 HD UVC WebCam: USB2.0 HD (usb-0000:05:00.3-4):
        /dev/video0
        /dev/video1
        /dev/media0

VIDIOC_QUERYCAP: failed: No such device
/dev/video0: not a v4l2 node

Or alternatively:

[computer1 ~]# v4l2-ctl --list-devices
Cannot open device /dev/video0, exiting.
v4l2-ctl -d /dev/video0 --list-ctrls

Sometimes command below will give empty output, probably when device is being rediscovered (see dmesg logs above)

[computer1 ~]# v4l2-ctl -d /dev/video0 --list-ctrls
VIDIOC_QUERYCAP: failed: No such device
/dev/video0: not a v4l2 node
ls -la /dev/video*
[computer1 ~]# ls -la /dev/video*
crw-rw----+ 1 root video 81, 0 Nov  5 09:57 /dev/video0
crw-rw----+ 1 root video 81, 1 Nov  5 09:57 /dev/video1
lsusb
[computer1 ~]# lsusb
Bus 006 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 005 Device 002: ID 04ca:4005 Lite-On Technology Corp. Bluetooth Radio
Bus 005 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 076: ID 322e:202c Sonix Technology Co., Ltd. USB2.0 HD UVC WebCam
Bus 003 Device 002: ID 046d:c092 Logitech, Inc. G102/G203 LIGHTSYNC Gaming Mouse
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
[computer1 ~]# lsusb -vt
/:  Bus 06.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/2p, 10000M
    ID 1d6b:0003 Linux Foundation 3.0 root hub
/:  Bus 05.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 480M
    ID 1d6b:0002 Linux Foundation 2.0 root hub
    |__ Port 1: Dev 2, If 0, Class=Wireless, Driver=btusb, 12M
        ID 04ca:4005 Lite-On Technology Corp.
    |__ Port 1: Dev 2, If 1, Class=Wireless, Driver=btusb, 12M
        ID 04ca:4005 Lite-On Technology Corp.
/:  Bus 04.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/2p, 10000M
    ID 1d6b:0003 Linux Foundation 3.0 root hub
/:  Bus 03.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 480M
    ID 1d6b:0002 Linux Foundation 2.0 root hub
    |__ Port 3: Dev 2, If 0, Class=Human Interface Device, Driver=usbhid, 12M
        ID 046d:c092 Logitech, Inc. G102/G203 LIGHTSYNC Gaming Mouse
    |__ Port 3: Dev 2, If 1, Class=Human Interface Device, Driver=usbhid, 12M
        ID 046d:c092 Logitech, Inc. G102/G203 LIGHTSYNC Gaming Mouse
    |__ Port 4: Dev 13, If 0, Class=Video, Driver=uvcvideo, 480M
        ID 322e:202c
    |__ Port 4: Dev 13, If 1, Class=Video, Driver=uvcvideo, 480M
        ID 322e:202c
usb-devices
[computer1 ~]# usb-devices

T:  Bus=03 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#=  1 Spd=480 MxCh= 4
D:  Ver= 2.00 Cls=09(hub  ) Sub=00 Prot=01 MxPS=64 #Cfgs=  1
P:  Vendor=1d6b ProdID=0002 Rev=06.00
S:  Manufacturer=Linux 6.0.6-1-MANJARO xhci-hcd
S:  Product=xHCI Host Controller
S:  SerialNumber=0000:05:00.3
C:  #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=0mA
I:  If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=hub
E:  Ad=81(I) Atr=03(Int.) MxPS=   4 Ivl=256ms

T:  Bus=03 Lev=01 Prnt=01 Port=02 Cnt=01 Dev#=  2 Spd=12  MxCh= 0
D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=046d ProdID=c092 Rev=52.00
S:  Manufacturer=Logitech
S:  Product=G102 LIGHTSYNC Gaming Mouse
S:  SerialNumber=207D31785542
C:  #Ifs= 2 Cfg#= 1 Atr=a0 MxPwr=300mA
I:  If#= 0 Alt= 0 #EPs= 1 Cls=03(HID  ) Sub=01 Prot=02 Driver=usbhid
E:  Ad=81(I) Atr=03(Int.) MxPS=   8 Ivl=1ms
I:  If#= 1 Alt= 0 #EPs= 1 Cls=03(HID  ) Sub=00 Prot=00 Driver=usbhid
E:  Ad=82(I) Atr=03(Int.) MxPS=  20 Ivl=1ms

T:  Bus=04 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#=  1 Spd=10000 MxCh= 2
D:  Ver= 3.10 Cls=09(hub  ) Sub=00 Prot=03 MxPS= 9 #Cfgs=  1
P:  Vendor=1d6b ProdID=0003 Rev=06.00
S:  Manufacturer=Linux 6.0.6-1-MANJARO xhci-hcd
S:  Product=xHCI Host Controller
S:  SerialNumber=0000:05:00.3
C:  #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=0mA
I:  If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=hub
E:  Ad=81(I) Atr=03(Int.) MxPS=   4 Ivl=256ms

T:  Bus=05 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#=  1 Spd=480 MxCh= 4
D:  Ver= 2.00 Cls=09(hub  ) Sub=00 Prot=01 MxPS=64 #Cfgs=  1
P:  Vendor=1d6b ProdID=0002 Rev=06.00
S:  Manufacturer=Linux 6.0.6-1-MANJARO xhci-hcd
S:  Product=xHCI Host Controller
S:  SerialNumber=0000:05:00.4
C:  #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=0mA
I:  If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=hub
E:  Ad=81(I) Atr=03(Int.) MxPS=   4 Ivl=256ms

T:  Bus=05 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  2 Spd=12  MxCh= 0
D:  Ver= 1.00 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs=  1
P:  Vendor=04ca ProdID=4005 Rev=00.00
S:  Manufacturer=Realtek
S:  Product=Bluetooth Radio
S:  SerialNumber=00e04c000001
C:  #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=500mA
I:  If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E:  Ad=02(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=81(I) Atr=03(Int.) MxPS=  16 Ivl=1ms
E:  Ad=82(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
I:  If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E:  Ad=03(O) Atr=01(Isoc) MxPS=   0 Ivl=1ms
E:  Ad=83(I) Atr=01(Isoc) MxPS=   0 Ivl=1ms

T:  Bus=06 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#=  1 Spd=10000 MxCh= 2
D:  Ver= 3.10 Cls=09(hub  ) Sub=00 Prot=03 MxPS= 9 #Cfgs=  1
P:  Vendor=1d6b ProdID=0003 Rev=06.00
S:  Manufacturer=Linux 6.0.6-1-MANJARO xhci-hcd
S:  Product=xHCI Host Controller
S:  SerialNumber=0000:05:00.4
C:  #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=0mA
I:  If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=hub
E:  Ad=81(I) Atr=03(Int.) MxPS=   4 Ivl=256ms
lspci
[computer1 ~]# lspci
00:00.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Renoir/Cezanne Root Complex
00:00.2 IOMMU: Advanced Micro Devices, Inc. [AMD] Renoir/Cezanne IOMMU
00:01.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Renoir PCIe Dummy Host Bridge
00:01.1 PCI bridge: Advanced Micro Devices, Inc. [AMD] Renoir PCIe GPP Bridge
00:02.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Renoir PCIe Dummy Host Bridge
00:02.1 PCI bridge: Advanced Micro Devices, Inc. [AMD] Renoir/Cezanne PCIe GPP Bridge
00:02.2 PCI bridge: Advanced Micro Devices, Inc. [AMD] Renoir/Cezanne PCIe GPP Bridge
00:02.4 PCI bridge: Advanced Micro Devices, Inc. [AMD] Renoir/Cezanne PCIe GPP Bridge
00:08.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Renoir PCIe Dummy Host Bridge
00:08.1 PCI bridge: Advanced Micro Devices, Inc. [AMD] Renoir Internal PCIe GPP Bridge to Bus
00:08.2 PCI bridge: Advanced Micro Devices, Inc. [AMD] Renoir Internal PCIe GPP Bridge to Bus
00:14.0 SMBus: Advanced Micro Devices, Inc. [AMD] FCH SMBus Controller (rev 51)
00:14.3 ISA bridge: Advanced Micro Devices, Inc. [AMD] FCH LPC Bridge (rev 51)
00:18.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Renoir Device 24: Function 0
00:18.1 Host bridge: Advanced Micro Devices, Inc. [AMD] Renoir Device 24: Function 1
00:18.2 Host bridge: Advanced Micro Devices, Inc. [AMD] Renoir Device 24: Function 2
00:18.3 Host bridge: Advanced Micro Devices, Inc. [AMD] Renoir Device 24: Function 3
00:18.4 Host bridge: Advanced Micro Devices, Inc. [AMD] Renoir Device 24: Function 4
00:18.5 Host bridge: Advanced Micro Devices, Inc. [AMD] Renoir Device 24: Function 5
00:18.6 Host bridge: Advanced Micro Devices, Inc. [AMD] Renoir Device 24: Function 6
00:18.7 Host bridge: Advanced Micro Devices, Inc. [AMD] Renoir Device 24: Function 7
01:00.0 VGA compatible controller: NVIDIA Corporation TU116M [GeForce GTX 1660 Ti Mobile] (rev a1)
01:00.1 Audio device: NVIDIA Corporation TU116 High Definition Audio Controller (rev a1)
02:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 15)
03:00.0 Network controller: Realtek Semiconductor Co., Ltd. RTL8822CE 802.11ac PCIe Wireless Network Adapter
04:00.0 Non-Volatile memory controller: Micron Technology Inc Device 5404 (rev 03)
05:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Renoir (rev c6)
05:00.1 Audio device: Advanced Micro Devices, Inc. [AMD/ATI] Renoir Radeon High Definition Audio Controller
05:00.2 Encryption controller: Advanced Micro Devices, Inc. [AMD] Family 17h (Models 10h-1fh) Platform Security Processor
05:00.3 USB controller: Advanced Micro Devices, Inc. [AMD] Renoir/Cezanne USB 3.1
05:00.4 USB controller: Advanced Micro Devices, Inc. [AMD] Renoir/Cezanne USB 3.1
05:00.5 Multimedia controller: Advanced Micro Devices, Inc. [AMD] ACP/ACP3X/ACP6x Audio Coprocessor (rev 01)
05:00.6 Audio device: Advanced Micro Devices, Inc. [AMD] Family 17h/19h HD Audio Controller
06:00.0 SATA controller: Advanced Micro Devices, Inc. [AMD] FCH SATA Controller [AHCI mode] (rev 81)
06:00.1 SATA controller: Advanced Micro Devices, Inc. [AMD] FCH SATA Controller [AHCI mode] (rev 81)
[computer1 ~]# lspci -nnnkkkvt
-[0000:00]-+-00.0  Advanced Micro Devices, Inc. [AMD] Renoir/Cezanne Root Complex [1022:1630]
           +-00.2  Advanced Micro Devices, Inc. [AMD] Renoir/Cezanne IOMMU [1022:1631]
           +-01.0  Advanced Micro Devices, Inc. [AMD] Renoir PCIe Dummy Host Bridge [1022:1632]
           +-01.1-[01]--+-00.0  NVIDIA Corporation TU116M [GeForce GTX 1660 Ti Mobile] [10de:2191]
           |            \-00.1  NVIDIA Corporation TU116 High Definition Audio Controller [10de:1aeb]
           +-02.0  Advanced Micro Devices, Inc. [AMD] Renoir PCIe Dummy Host Bridge [1022:1632]
           +-02.1-[02]----00.0  Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller [10ec:8168]
           +-02.2-[03]----00.0  Realtek Semiconductor Co., Ltd. RTL8822CE 802.11ac PCIe Wireless Network Adapter [10ec:c822]
           +-02.4-[04]----00.0  Micron Technology Inc Device [1344:5404]
           +-08.0  Advanced Micro Devices, Inc. [AMD] Renoir PCIe Dummy Host Bridge [1022:1632]
           +-08.1-[05]--+-00.0  Advanced Micro Devices, Inc. [AMD/ATI] Renoir [1002:1636]
           |            +-00.1  Advanced Micro Devices, Inc. [AMD/ATI] Renoir Radeon High Definition Audio Controller [1002:1637]
           |            +-00.2  Advanced Micro Devices, Inc. [AMD] Family 17h (Models 10h-1fh) Platform Security Processor [1022:15df]
           |            +-00.3  Advanced Micro Devices, Inc. [AMD] Renoir/Cezanne USB 3.1 [1022:1639]
           |            +-00.4  Advanced Micro Devices, Inc. [AMD] Renoir/Cezanne USB 3.1 [1022:1639]
           |            +-00.5  Advanced Micro Devices, Inc. [AMD] ACP/ACP3X/ACP6x Audio Coprocessor [1022:15e2]
           |            \-00.6  Advanced Micro Devices, Inc. [AMD] Family 17h/19h HD Audio Controller [1022:15e3]
           +-08.2-[06]--+-00.0  Advanced Micro Devices, Inc. [AMD] FCH SATA Controller [AHCI mode] [1022:7901]
           |            \-00.1  Advanced Micro Devices, Inc. [AMD] FCH SATA Controller [AHCI mode] [1022:7901]
           +-14.0  Advanced Micro Devices, Inc. [AMD] FCH SMBus Controller [1022:790b]
           +-14.3  Advanced Micro Devices, Inc. [AMD] FCH LPC Bridge [1022:790e]
           +-18.0  Advanced Micro Devices, Inc. [AMD] Renoir Device 24: Function 0 [1022:1448]
           +-18.1  Advanced Micro Devices, Inc. [AMD] Renoir Device 24: Function 1 [1022:1449]
           +-18.2  Advanced Micro Devices, Inc. [AMD] Renoir Device 24: Function 2 [1022:144a]
           +-18.3  Advanced Micro Devices, Inc. [AMD] Renoir Device 24: Function 3 [1022:144b]
           +-18.4  Advanced Micro Devices, Inc. [AMD] Renoir Device 24: Function 4 [1022:144c]
           +-18.5  Advanced Micro Devices, Inc. [AMD] Renoir Device 24: Function 5 [1022:144d]
           +-18.6  Advanced Micro Devices, Inc. [AMD] Renoir Device 24: Function 6 [1022:144e]
           \-18.7  Advanced Micro Devices, Inc. [AMD] Renoir Device 24: Function 7 [1022:144f]
lsmod | grep uvcvideo
[computer1 ~]# lsmod | grep uvcvideo
uvcvideo              163840  1
videobuf2_vmalloc      20480  1 uvcvideo
videobuf2_v4l2         40960  1 uvcvideo
videobuf2_common       86016  4 videobuf2_vmalloc,videobuf2_v4l2,uvcvideo,videobuf2_memops
videodev              315392  4 videobuf2_v4l2,uvcvideo,videobuf2_common
mc                     73728  4 videodev,videobuf2_v4l2,uvcvideo,videobuf2_common
ffplay (and related commands)
[computer1 ~]# ffplay /dev/video0
ffplay version n5.1.2 Copyright (c) 2003-2022 the FFmpeg developers
  built with gcc 12.2.0 (GCC)
  configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-amf --enable-avisynth --enable-cuda-llvm --enable-lto --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libdav1d --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libjack --enable-libmfx --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librav1e --enable-librsvg --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-libzimg --enable-nvdec --enable-nvenc --enable-opencl --enable-opengl --enable-shared --enable-version3 --enable-vulkan
  libavutil      57. 28.100 / 57. 28.100
  libavcodec     59. 37.100 / 59. 37.100
  libavformat    59. 27.100 / 59. 27.100
  libavdevice    59.  7.100 / 59.  7.100
  libavfilter     8. 44.100 /  8. 44.100
  libswscale      6.  7.100 /  6.  7.100
  libswresample   4.  7.100 /  4.  7.100
  libpostproc    56.  6.100 / 56.  6.100
[video4linux2,v4l2 @ 0x7f56e0000c80] Cannot open video device /dev/video0: No such file or directory
/dev/video0: No such file or directory
    nan    :  0.000 fd=   0 aq=    0KB vq=    0KB sq=    0B f=0/0

Or alternatively:

[computer1 ~]# ffplay /dev/video0
ffplay version n5.1.2 Copyright (c) 2003-2022 the FFmpeg developers
  built with gcc 12.2.0 (GCC)
  configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-amf --enable-avisynth --enable-cuda-llvm --enable-lto --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libdav1d --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libjack --enable-libmfx --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librav1e --enable-librsvg --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-libzimg --enable-nvdec --enable-nvenc --enable-opencl --enable-opengl --enable-shared --enable-version3 --enable-vulkan
  libavutil      57. 28.100 / 57. 28.100
  libavcodec     59. 37.100 / 59. 37.100
  libavformat    59. 27.100 / 59. 27.100
  libavdevice    59.  7.100 / 59.  7.100
  libavfilter     8. 44.100 /  8. 44.100
  libswscale      6.  7.100 /  6.  7.100
  libswresample   4.  7.100 /  4.  7.100
  libpostproc    56.  6.100 / 56.  6.100
/dev/video0: Input/output error    0KB vq=    0KB sq=    0B f=0/0
[computer1 ~]# fuser /dev/video0
/dev/video0:          5180
[computer1 ~]# readlink /proc/5180/exe
/usr/bin/pipewire
External links

Similar problems I’ve been able to find.

What about?

ffplay /dev/video1

:question:

Possible that the device numbers just switches and that happens randomly with any device. So targeting the device name is not a good permanent solution.

Check the availability like that:

file /dev/video[0-9]

Maybe that section helps: https://wiki.archlinux.org/title/Udev#udev_rule_example

1 Like

I have tried adding udev config to /etc/udev/rules.d/10-webcam.rules. This config:
ATTR{idVendor}=="322e", ATTR{idProduct}=="202c", MODE="0664", GROUP="video", RUN+="/sbin/rmmod uvcvideo", RUN+="/sbin/modprobe uvcvideo"

This leads to following logs in dmesg:

With udev rule
[53206.536733] usb 3-4: USB disconnect, device number 80
[53206.536934] usb 3-4: Failed to query (GET_DEF) UVC control 2 on unit 2: -71 (exp. 2).
[53206.877676] usb 3-4: new high-speed USB device number 81 using xhci_hcd
[53207.045196] usb 3-4: New USB device found, idVendor=322e, idProduct=202c, bcdDevice= 1.03
[53207.045201] usb 3-4: New USB device strings: Mfr=2, Product=1, SerialNumber=0
[53207.045202] usb 3-4: Product: USB2.0 HD UVC WebCam
[53207.045204] usb 3-4: Manufacturer: Sonix Technology Co., Ltd.
[53207.053585] usb 3-4: Found UVC 1.00 device USB2.0 HD UVC WebCam (322e:202c)
[53207.067904] input: USB2.0 HD UVC WebCam: USB2.0 HD as /devices/pci0000:00/0000:00:08.1/0000:05:00.3/usb3/3-4/3-4:1.0/input/input8906
[53207.073626] usbcore: deregistering interface driver uvcvideo
[53207.187484] usb 3-4: Found UVC 1.00 device USB2.0 HD UVC WebCam (322e:202c)
[53207.201781] input: USB2.0 HD UVC WebCam: USB2.0 HD as /devices/pci0000:00/0000:00:08.1/0000:05:00.3/usb3/3-4/3-4:1.0/input/input8907
[53207.201850] usbcore: registered new interface driver uvcvideo

Instead of

Without udev rule
[41463.971288] usb 3-4: USB disconnect, device number 7
[41463.971437] usb 3-4: Failed to query (GET_DEF) UVC control 2 on unit 2: -71 (exp. 2).
[41464.308844] usb 3-4: new high-speed USB device number 8 using xhci_hcd
[41464.473441] usb 3-4: New USB device found, idVendor=322e, idProduct=202c, bcdDevice= 1.03
[41464.473452] usb 3-4: New USB device strings: Mfr=2, Product=1, SerialNumber=0
[41464.473456] usb 3-4: Product: USB2.0 HD UVC WebCam
[41464.473459] usb 3-4: Manufacturer: Sonix Technology Co., Ltd.
[41464.482326] usb 3-4: Found UVC 1.00 device USB2.0 HD UVC WebCam (322e:202c)
[41464.496577] input: USB2.0 HD UVC WebCam: USB2.0 HD as /devices/pci0000:00/0000:00:08.1/0000:05:00.3/usb3/3-4/3-4:1.0/input/input6905

What this tells me is that webcam is being recognized twice, so it works even without the rule. Maybe there has to be some custom rule for it to work, but at the moment I can’t figure out what causes disconnect every 5 seconds in the first place.

I have looked in /etc/udev/rules.d/ and /usr/lib/udev/rules.d/ and haven’t found any webcam-related configs:

grep -ir webcam /usr/lib/udev/rules.d/
[computer1 ~]# grep -ir webcam /usr/lib/udev/rules.d/
/usr/lib/udev/rules.d/78-sound-card.rules:# Devices that also support Image/Video interfaces are most likely webcams
/usr/lib/udev/rules.d/78-sound-card.rules:SUBSYSTEMS=="usb", ENV{ID_USB_INTERFACES}=="*:0e????:*", ENV{SOUND_FORM_FACTOR}="webcam", GOTO="sound_end"
/usr/lib/udev/rules.d/70-uaccess.rules:# Webcams, frame grabber, TV cards
/usr/lib/udev/rules.d/70-uaccess.rules:# industrial cameras, some webcams, camcorders, set-top boxes, TV sets, audio devices, and more

More diagnostics:

ffplay /dev/video1
[computer1 ~]# ffplay /dev/video1
ffplay version n5.1.2 Copyright (c) 2003-2022 the FFmpeg developers
  built with gcc 12.2.0 (GCC)
  configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-amf --enable-avisynth --enable-cuda-llvm --enable-lto --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libdav1d --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libjack --enable-libmfx --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librav1e --enable-librsvg --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-libzimg --enable-nvdec --enable-nvenc --enable-opencl --enable-opengl --enable-shared --enable-version3 --enable-vulkan
  libavutil      57. 28.100 / 57. 28.100
  libavcodec     59. 37.100 / 59. 37.100
  libavformat    59. 27.100 / 59. 27.100
  libavdevice    59.  7.100 / 59.  7.100
  libavfilter     8. 44.100 /  8. 44.100
  libswscale      6.  7.100 /  6.  7.100
  libswresample   4.  7.100 /  4.  7.100
  libpostproc    56.  6.100 / 56.  6.100
[video4linux2,v4l2 @ 0x7fc6e4000c80] ioctl(VIDIOC_G_INPUT): Inappropriate ioctl for device
/dev/video1: Inappropriate ioctl for device
    nan    :  0.000 fd=   0 aq=    0KB vq=    0KB sq=    0B f=0/0
file /dev/video[0-9

Either:

[computer1 ~]# file /dev/video[0-9]
/dev/video0: character special (81/0)
/dev/video1: character special (81/1)

Or:

[computer1 ~]# file /dev/video[0-9]
/dev/video[0-9]: cannot open `/dev/video[0-9]' (No such file or directory)

Probably depends on where in the device recognition loop the system is when command is being executed.

P.S. From what I’ve seen it’s always /dev/video0 that is mentioned in logs.

Well since it is connected via usb I would say it automatically suspends and therefore disconnects. Happens mostly when in battery mode.

sudo tlp-stat --usb

You should be able to disable that at /etc/tlp.conf

1 Like

Thank you, it worked!

I have set TLP_ENABLE=0 in /etc/tlp.conf & restarted. After that webcam started working. Then I reenabled TLP & it continued working.

To avoid future problems I added device id to /etc/tlp.d/disable_bluetooth_autosuspend.conf as USB_DENYLIST="04ca:4005 322e:202c"

I remembered that I already had a similar problem a couple of month back with a Bluetooth module (first device in USB_DENYLIST). Both time it happened when I switched laptop to a battery mode temporarily. But bringing it back to AC didn’t stop autosuspend.

Must be something wrong with the TLP config (in my case it’s the default one except for the line above). But error logs are cryptic so it’s hard to tell what is exactly the problem.

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.