USB 网络摄像头 (Logitech C922 Pro Stream) 间歇性出现故障

USB 网络摄像头 (Logitech C922 Pro Stream) 间歇性出现故障

我的 USB 网络摄像头有时被识别为键盘,并且 - 我假设 - 因此无法工作。重新启动通常可以解决此问题,但这很烦人,所以我想知道是否还有其他方法。

编辑

我首先发布这个问题是基于看到来自 udev 的奇怪消息,认为它是 udev,但我了解到(感谢@tecloM)这不相关

请说明这是否是一个 XY 问题 - 我看到 udev 的胡言乱语(网络摄像头设备是键盘),所以我假设这是一个 udev 问题,但可能不是。我只是想让网络摄像头可靠地工作!也许 udev 只是命名事物,而问题更深层次?

以下是插入网络摄像头后出现的系统日志行:

Apr  8 16:56:21 meowko kernel: [561385.593298] usb 1-2.1: new high-speed USB device number 78 using xhci_hcd
Apr  8 16:56:23 meowko kernel: [561387.935896] usb 1-2.1: New USB device found, idVendor=046d, idProduct=085c, bcdDevice= 0.16
Apr  8 16:56:23 meowko kernel: [561387.935902] usb 1-2.1: New USB device strings: Mfr=0, Product=2, SerialNumber=1
Apr  8 16:56:23 meowko kernel: [561387.935905] usb 1-2.1: Product: C922 Pro Stream Webcam
Apr  8 16:56:23 meowko kernel: [561387.935908] usb 1-2.1: SerialNumber: 80ADA8BF
Apr  8 16:56:23 meowko kernel: [561387.937534] uvcvideo: Found UVC 1.00 device C922 Pro Stream Webcam (046d:085c)
Apr  8 16:56:23 meowko kernel: [561387.939350] input: C922 Pro Stream Webcam as /devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2.1/1-2.1:1.0/input/input230
Apr  8 16:56:24 meowko mtp-probe: checking bus 1, device 78: "/sys/devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2.1"
Apr  8 16:56:24 meowko mtp-probe: bus: 1, device: 78 was not an MTP device
Apr  8 16:56:24 meowko systemd-udevd[1153237]: controlC1: Process '/usr/sbin/alsactl -E HOME=/run/alsa -E XDG_RUNTIME_DIR=/run/alsa/runtime restore 1' failed with exit code 99.
Apr  8 16:56:24 meowko /usr/lib/gdm3/gdm-x-session[1047636]: (II) config/udev: Adding input device C922 Pro Stream Webcam (/dev/input/event28)
Apr  8 16:56:24 meowko /usr/lib/gdm3/gdm-x-session[1047636]: (**) C922 Pro Stream Webcam: Applying InputClass "libinput keyboard catchall"
Apr  8 16:56:24 meowko /usr/lib/gdm3/gdm-x-session[1047636]: (II) Using input driver 'libinput' for 'C922 Pro Stream Webcam'
Apr  8 16:56:24 meowko /usr/lib/gdm3/gdm-x-session[1047636]: (II) systemd-logind: got fd for /dev/input/event28 13:92 fd 107 paused 0
Apr  8 16:56:24 meowko /usr/lib/gdm3/gdm-x-session[1047636]: (**) C922 Pro Stream Webcam: always reports core events
Apr  8 16:56:24 meowko /usr/lib/gdm3/gdm-x-session[1047636]: (**) Option "Device" "/dev/input/event28"
Apr  8 16:56:24 meowko /usr/lib/gdm3/gdm-x-session[1047636]: (**) Option "_source" "server/udev"
Apr  8 16:56:24 meowko /usr/lib/gdm3/gdm-x-session[1047636]: (II) event28 - C922 Pro Stream Webcam: is tagged by udev as: Keyboard
Apr  8 16:56:24 meowko /usr/lib/gdm3/gdm-x-session[1047636]: (II) event28 - C922 Pro Stream Webcam: device is a keyboard
Apr  8 16:56:24 meowko /usr/lib/gdm3/gdm-x-session[1047636]: (II) event28 - C922 Pro Stream Webcam: device removed
Apr  8 16:56:24 meowko /usr/lib/gdm3/gdm-x-session[1047636]: (**) Option "config_info" "udev:/sys/devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2.1/1-2.1:1.0/input/input230/event28"
Apr  8 16:56:24 meowko /usr/lib/gdm3/gdm-x-session[1047636]: (II) XINPUT: Adding extended input device "C922 Pro Stream Webcam" (type: KEYBOARD, id 27)
Apr  8 16:56:24 meowko /usr/lib/gdm3/gdm-x-session[1047636]: (**) Option "xkb_model" "pc105"
Apr  8 16:56:24 meowko /usr/lib/gdm3/gdm-x-session[1047636]: (**) Option "xkb_layout" "gb"
Apr  8 16:56:24 meowko /usr/lib/gdm3/gdm-x-session[1047636]: (WW) Option "xkb_variant" requires a string value
Apr  8 16:56:24 meowko /usr/lib/gdm3/gdm-x-session[1047636]: (WW) Option "xkb_options" requires a string value
Apr  8 16:56:24 meowko /usr/lib/gdm3/gdm-x-session[1047636]: (II) event28 - C922 Pro Stream Webcam: is tagged by udev as: Keyboard
Apr  8 16:56:24 meowko /usr/lib/gdm3/gdm-x-session[1047636]: (II) event28 - C922 Pro Stream Webcam: device is a keyboard
Apr  8 16:56:24 meowko gnome-shell[1047764]: Window manager warning: Overwriting existing binding of keysym 31 with keysym 31 (keycode a).
...various versions of last line (don't think relevant?)...
Apr  8 16:56:24 meowko mtp-probe: checking bus 1, device 78: "/sys/devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2.1"
Apr  8 16:56:24 meowko mtp-probe: bus: 1, device: 78 was not an MTP device

运行:udevadm info -ap /sys/devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2.1给出:

  looking at device '/devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2.1':
    KERNEL=="1-2.1"
    SUBSYSTEM=="usb"
    DRIVER=="usb"
    ATTR{bNumConfigurations}=="1"
    ATTR{configuration}==""
    ATTR{quirks}=="0x42"
    ATTR{busnum}=="1"
    ATTR{ltm_capable}=="no"
    ATTR{bDeviceSubClass}=="02"
    ATTR{avoid_reset_quirk}=="0"
    ATTR{urbnum}=="130"
    ATTR{serial}=="80ADA8BF"
    ATTR{bMaxPower}=="500mA"
    ATTR{removable}=="unknown"
    ATTR{speed}=="480"
    ATTR{idProduct}=="085c"
    ATTR{tx_lanes}=="1"
    ATTR{bMaxPacketSize0}=="64"
    ATTR{bDeviceProtocol}=="01"
    ATTR{version}==" 2.00"
    ATTR{bmAttributes}=="80"
    ATTR{devnum}=="78"
    ATTR{rx_lanes}=="1"
    ATTR{authorized}=="1"
    ATTR{idVendor}=="046d"
    ATTR{bConfigurationValue}=="1"
    ATTR{devpath}=="2.1"
    ATTR{maxchild}=="0"
    ATTR{product}=="C922 Pro Stream Webcam"
    ATTR{bDeviceClass}=="ef"
    ATTR{bNumInterfaces}==" 4"
    ATTR{bcdDevice}=="0016"

  looking at parent device '/devices/pci0000:00/0000:00:14.0/usb1/1-2':
    KERNELS=="1-2"
    SUBSYSTEMS=="usb"
    DRIVERS=="usb"
    ATTRS{speed}=="480"
    ATTRS{maxchild}=="4"
    ATTRS{tx_lanes}=="1"
    ATTRS{bNumConfigurations}=="1"
    ATTRS{bConfigurationValue}=="1"
    ATTRS{avoid_reset_quirk}=="0"
    ATTRS{bDeviceSubClass}=="00"
    ATTRS{product}=="USB2.0 Hub"
    ATTRS{bDeviceProtocol}=="01"
    ATTRS{bmAttributes}=="e0"
    ATTRS{devpath}=="2"
    ATTRS{urbnum}=="336"
    ATTRS{quirks}=="0x0"
    ATTRS{bNumInterfaces}==" 1"
    ATTRS{authorized}=="1"
    ATTRS{version}==" 2.00"
    ATTRS{bcdDevice}=="0288"
    ATTRS{removable}=="removable"
    ATTRS{idProduct}=="3431"
    ATTRS{devnum}=="68"
    ATTRS{bDeviceClass}=="09"
    ATTRS{bMaxPacketSize0}=="64"
    ATTRS{idVendor}=="2109"
    ATTRS{configuration}==""
    ATTRS{rx_lanes}=="1"
    ATTRS{ltm_capable}=="no"
    ATTRS{bMaxPower}=="100mA"
    ATTRS{busnum}=="1"


  looking at parent device '/devices/pci0000:00/0000:00:14.0/usb1':
    KERNELS=="usb1"
    SUBSYSTEMS=="usb"
    DRIVERS=="usb"
    ATTRS{idProduct}=="0002"
    ATTRS{authorized_default}=="1"
    ATTRS{bDeviceProtocol}=="01"
    ATTRS{bConfigurationValue}=="1"
    ATTRS{bNumConfigurations}=="1"
    ATTRS{speed}=="480"
    ATTRS{avoid_reset_quirk}=="0"
    ATTRS{version}==" 2.00"
    ATTRS{ltm_capable}=="no"
    ATTRS{tx_lanes}=="1"
    ATTRS{serial}=="0000:00:14.0"
    ATTRS{quirks}=="0x0"
    ATTRS{busnum}=="1"
    ATTRS{bMaxPacketSize0}=="64"
    ATTRS{bmAttributes}=="e0"
    ATTRS{bcdDevice}=="0504"
    ATTRS{bMaxPower}=="0mA"
    ATTRS{bDeviceSubClass}=="00"
    ATTRS{product}=="xHCI Host Controller"
    ATTRS{devnum}=="1"
    ATTRS{idVendor}=="1d6b"
    ATTRS{authorized}=="1"
    ATTRS{maxchild}=="16"
    ATTRS{bNumInterfaces}==" 1"
    ATTRS{rx_lanes}=="1"
    ATTRS{devpath}=="0"
    ATTRS{configuration}==""
    ATTRS{bDeviceClass}=="09"
    ATTRS{urbnum}=="32052"
    ATTRS{removable}=="unknown"
    ATTRS{interface_authorized_default}=="1"
    ATTRS{manufacturer}=="Linux 5.4.0-66-generic xhci-hcd"

  looking at parent device '/devices/pci0000:00/0000:00:14.0':
    KERNELS=="0000:00:14.0"
    SUBSYSTEMS=="pci"
    DRIVERS=="xhci_hcd"
    ATTRS{class}=="0x0c0330"
    ATTRS{numa_node}=="-1"
    ATTRS{dma_mask_bits}=="64"
    ATTRS{revision}=="0x31"
    ATTRS{local_cpus}=="ff"
    ATTRS{driver_override}=="(null)"
    ATTRS{device}=="0xa12f"
    ATTRS{consistent_dma_mask_bits}=="64"
    ATTRS{subsystem_vendor}=="0x1028"
    ATTRS{dbc}=="disabled"
    ATTRS{broken_parity_status}=="0"
    ATTRS{ari_enabled}=="0"
    ATTRS{enable}=="1"
    ATTRS{msi_bus}=="1"
    ATTRS{local_cpulist}=="0-7"
    ATTRS{vendor}=="0x8086"
    ATTRS{subsystem_device}=="0x06e4"
    ATTRS{d3cold_allowed}=="1"
    ATTRS{irq}=="133"

  looking at parent device '/devices/pci0000:00':
    KERNELS=="pci0000:00"
    SUBSYSTEMS==""
    DRIVERS==""

我上线了Linux 5.4.0-66-generic #74-Ubuntu SMP Wed Jan 27 22:54:38 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

提前致谢!

编辑

输出lsinput(当相机工作时):

/dev/input/event27
   bustype : BUS_USB
   vendor  : 0x46d
   product : 0x85c
   version : 22
   name    : "C922 Pro Stream Webcam"
   phys    : "usb-0000:00:14.0-2/button"
   bits ev : (null) (null)

答案1

我有和你一模一样的 Logitech C922 网络摄像头。

我在日志中看到类似的消息,尽管它们并不全部在 systemd 日志中,因为我的系统是 Debian 10。

这些特定消息由 X11 显示服务器创建。

[   121.255] (II) config/udev: Adding input device C922 Pro Stream Webcam (/dev/input/event31)
[   121.255] (**) C922 Pro Stream Webcam: Applying InputClass "evdev keyboard catchall"
[   121.255] (**) C922 Pro Stream Webcam: Applying InputClass "libinput keyboard catchall"
[   121.255] (II) Using input driver 'libinput' for 'C922 Pro Stream Webcam'
[   121.255] (**) C922 Pro Stream Webcam: always reports core events
[   121.255] (**) Option "Device" "/dev/input/event31"
[   121.255] (**) Option "_source" "server/udev"
[   121.259] (II) event31 - C922 Pro Stream Webcam: is tagged by udev as: Keyboard
[   121.259] (II) event31 - C922 Pro Stream Webcam: device is a keyboard
[   121.259] (II) event31 - C922 Pro Stream Webcam: device removed
[   121.293] (**) Option "config_info" "udev:/sys/devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4.4/1-4.4.2/1-4.4.2:1.0/input/input40/event31"
[   121.293] (II) XINPUT: Adding extended input device "C922 Pro Stream Webcam" (type: KEYBOARD, id 19)
[   121.293] (**) Option "xkb_model" "pc105"
[   121.293] (**) Option "xkb_layout" "fi"
[   121.293] (**) Option "xkb_options" "compose:menu,ctrl:nocaps"
[   121.297] (II) event31 - C922 Pro Stream Webcam: is tagged by udev as: Keyboard
[   121.297] (II) event31 - C922 Pro Stream Webcam: device is a keyboard

但我的网络摄像头工作得很好。

就我而言,该设备被列为/dev/input/event31。因此,我们可以使用该工具进行更深入的挖掘lsinput

# lsinput -v -s 31
/dev/input/event31
   id   : 046d:085c, USB, v22
   phys : "usb-0000:00:14.0-4.4.2/button"
   name : "C922 Pro Stream Webcam"
   KEY  : CAMERA

这与真正的 USB 键盘相比如何?好吧,我的键盘显示如下/dev/input/event7lsinput结果如下:

# lsinput -v -s 7
/dev/input/event7
   id   : 04d9:2221, USB, v272
   phys : "usb-0000:00:14.0-13/input0"
   name : "USB Keyboard"
   KEY  : [ 143 codes ]
   MSC  : SCAN
   LED  : NUML CAPSL SCROLLL

因此,lsinput来自真实键盘的信息表明它可以发送大约 143 个不同的键代码。网络摄像头“键盘”只有一个,它甚至被命名为CAMERA

事实证明,一些网络摄像头可能有一个或两个用于各种目的的按钮。网络uvcvideo摄像头驱动程序通过呈现网络摄像头来支持这些按钮作为“键盘”设备,此外它的主要网络摄像头功能。这允许使用任何键盘事件映射工具来自定义网络摄像头按钮的功能,而不需要定制软件来专门处理网络摄像头按钮。

罗技 C922 Pro Stream 网络摄像头实际上似乎没有任何物理按钮:也许网络摄像头内部的硬件支持按钮,但罗技选择从该特定型号中省略它,但没有更改网络摄像头固件以表明该功能实际上并不存在。

我的旧电脑有一个 Logitech QuickCam 9000,它确实有一个这样的按钮。在 Windows 中,按下该按钮确实会触发网络摄像头软件使用相机捕获最高分辨率的静态图像。

因此,除非您有进一步的证据,否则我强烈怀疑您在寻找有关网络摄像头不可靠性问题的线索时,您可能会关注错误的事情,因为您不知道网络摄像头可以有按钮,并且将uvcvideo它们呈现给系统类似到键盘按键。

也许您的网络摄像头当前插入的 USB 端口无法提供足够的电量或连接器松动。您是否尝试过将其插入另一个 USB 端口?

如果相机通过总线供电的 USB 集线器连接,请尝试将其直接连接到计算机的内置 USB 端口,或连接到具有自己电源的集线器(以便集线器可以为插入其中的设备提供更多电源) )。

当网络摄像头无法工作时,拔掉并重新插入 USB 线是否可以解决问题?如果没有,您可以尝试卸载并重新加载uvcvideo驱动程序:

sudo modprobe -r uvcvideo
sudo modprobe uvcvideo

卸载和重新加载驱动程序会强制完全重新初始化驱动程序状态,以防驱动程序内部出现问题。

如果modprobe -r uvcvideo失败,则某物正在使用网络摄像头,或者至少是其某些功能,例如麦克风,或者驾驶员与网络摄像头之间的通信已经崩溃。

检查 dmesg输出中的错误,并尝试fuser /dev/video*以 root 身份尝试识别可能正在使用网络摄像头的视频部分和fuser /dev/input/event27输入设备部分的任何进程。

不幸的是,检查音频部分的使用情况更加复杂;还有其他人知道一个好的低级命令来识别使用特定 ALSA 音频设备的任何进程吗? (如果您知道,请随意编辑此答案或添加您自己的答案。)

相关内容