問題
您好,我有一台凌陽 USB 攝影機 (Siri A9 UVC),我正在嘗試將其用作 PC 網路攝影機。無論我嘗試什麼,它在 v4l2 中都是可見的,但是會破壞使用它的應用程式。例如,當我切換到 USB 攝影機時,Cheese 停止運行。
作為測試,我使用 fswebcam 拍照。它停頓了一段時間,然後輸出:
karol@karol-hp2:~$ fswebcam --jpeg 85 -d /dev/video2 web-cam-shot.jpg
--- Opening /dev/video2...
Trying source module v4l2...
/dev/video2 opened.
No input was specified, using the first. (here stalls)
Unable to find a compatible palette format.
在Win10(在同一台筆記型電腦上)上,相機工作沒有任何問題。然而,在這裡,它不僅破壞了使用它的應用程序,而且還破壞了脈衝音頻。插入相機後,我的所有音訊設備都會從設定中消失。
系統
我在用著烏班圖21.04;
核心版本 -5.11.0-34-通用
設備/驅動程式規格:
USB 裝置( lsusb
):
Bus 001 Device 008: ID 04fc:6333 Sunplus Technology Co., Ltd Siri A9 UVC chipset
硬體規格( lshf
):
*-usb:1
description: Video
product: Mass Storage
vendor: iCatchtek Co Ltd
physical id: 2
bus info: usb@1:2
version: 1.00
serial: 01.00.00
capabilities: usb-2.00
configuration: driver=snd-usb-audio maxpower=100mA speed=480Mbit/s
v4l2 設備 ( v4l2-ctl --list-devices
):
'OBS (platform:v4l2loopback-000):
/dev/video13
Mass Storage (usb-0000:00:14.0-2):
/dev/video2
/dev/video3
/dev/media1
HP Wide Vision HD Camera: HP Wi (usb-0000:00:14.0-5):
/dev/video0
/dev/video1
/dev/media0
最後,v4l2 相機詳細資料(v4l2-ctl -d 2 -D
):
Driver Info:
Driver name : uvcvideo
Card type : Mass Storage
Bus info : usb-0000:00:14.0-2
Driver version : 5.11.22
Capabilities : 0x84a00001
Video Capture
Metadata Capture
Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x04200001
Video Capture
Streaming
Extended Pix Format
Media Driver Info:
Driver name : uvcvideo
Model : Mass Storage
Serial : 01.00.00
Bus info : usb-0000:00:14.0-2
Media version : 5.11.22
Hardware revision: 0x00000100 (256)
Driver version : 5.11.22
Interface Info:
ID : 0x03000002
Type : V4L Video
Entity Info:
ID : 0x00000001 (1)
Name : Mass Storage
Function : V4L2 I/O
Flags : default
Pad 0x01000007 : 0: Sink
Link 0x02000010: from remote pad 0x100000a of entity 'Extension 3': Data, Enabled, Immutable
答案1
許多裝置存取問題可以透過群組成員身分變更來解決。
具體來說,如果ls -l
顯示群組權限(第二個「rwx
」三元組)為「rw
」(例如「-rw-rw----
」),則將自己新增至擁有該裝置的群組將授予rw
存取權限。
就是這樣:
device="/dev/whatever"
sudo adduser $USER $(stat -c "%G" $device)
這允許您成為可以使用該設備的群組的成員身份rw
,但還有一步。
若要使所有進程成為新群組的成員,請登出並登入。小組成員資格是按時間設立的login
。
若要在新群組中建立單一進程(用於測試,在登出/登入之前):
newgrp $(stat -c "%G" $device)
或者,只需鍵入群組名稱。看man newgrp
。