ubuntu open usb camera


foreword

Make a record to solve the problem of black screen when opening the usb camera interface under Linux.


1. Identify the usb camera

1. Stay on the ubuntu interface, plug in the usb camera, and connect the usb camera to the virtual machine.
insert image description here
2. Use the dmesg command to see the print information when the device is connected

Gnep@lpvm:~$ sudo dmesg
[168141.518252] usb 1-1: new high-speed USB device number 9 using ehci-pci
[168141.868678] usb 1-1: New USB device found, idVendor=1e4e, idProduct=0110, bcdDevice= 1.01
[168141.868688] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[168141.868693] usb 1-1: Product: USB2.0 Camera
[168141.868699] usb 1-1: Manufacturer: Etron Technology, Inc.
[168141.881822] usb 1-1: Found UVC 1.00 device USB2.0 Camera (1e4e:0110)
[168141.915224] input: USB2.0 Camera: USB2.0 Camera as /devices/pci0000:00/0000:00:11.0/0000:02:03.0/usb1/1-1/1-1:1.0/input/input12

You can see that the VID:PID of the camera we just connected is 1e4e:0110, and the ID number here can be further confirmed in the official UVC document whether it is supported. A green tick indicates support.
注:UVC(USB Video Class),即:USB 视频类,是一种为 USB 视频捕获设备定义的协议标准。是 Microsoft 与另外几家设备厂商联合推出的为 USB 视频捕获设备定义的协议标准,已成为 USB org 标准之一。
insert image description hereAfter looking through it, I found that there is no ID number of my current camera.
insert image description here
Looked through the supported devices, here is a tip like this: The following table lists known UVC devices, other UVC-compliant video input devices are likely to be supported , if your UVC device is not listed below Please report it to the Linux Media Development mailing list.

In fact, my usb camera supports UVC, and you can view it in the following way under the linux system:

Gnep@lpvm:~$ lsusb -d 1e4e:0110 -v | grep "14 Video"
Couldn't open device, some information will be missing
      bFunctionClass         14 Video
      bInterfaceClass        14 Video
      bInterfaceClass        14 Video
      bInterfaceClass        14 Video
      bInterfaceClass        14 Video
      bInterfaceClass        14 Video
      bInterfaceClass        14 Video
      bInterfaceClass        14 Video
      bInterfaceClass        14 Video
      bInterfaceClass        14 Video
      bInterfaceClass        14 Video
      bInterfaceClass        14 Video
      bInterfaceClass        14 Video
      bInterfaceClass        14 Video
      bInterfaceClass        14 Video

If the camera is compatible with UVC, it will output information similar to the above. If there is no above information, it is a non-UVC device.

3. Use the following command to view the device node

ls /dev/video*
Gnep@lpvm:~$ ls /dev/video*
/dev/video0  /dev/video1

Here video0 is the device node of the camera that comes with the notebook, and video1 is the usb camera we just connected.

2. Install the application to display the video captured by the camera

1. Use the app eggplant (cheese)

sudo apt-get install cheese

insert image description here

2. Run cheese to capture video

Enter the cheese command to capture video.
insert image description here
The cheese command shows a black screen

Solution:
①. Check whether the virtual machine is connected to the camera, virtual machine -> removable device -> Cubeternet USB2.0 Camera, if it shows disconnected (connected to the host) (D), then the virtual machine is connected to the camera.
insert image description here
②. Modify the permission of video1. If /dev/video1 already has 777 permission, you don’t need to modify it.
insert image description here
③. Confirm whether there is webCam, if not, install webCam.
insert image description here
④. If the camera still cannot be turned on after the above operations are confirmed, if the USB compatibility is defaulted to USB 2.0, replace it with USB 3.1.
insert image description here
Reseat the device.
Type cheese again to see the result.
insert image description here
Now it can be displayed normally


My qq: 2442391036, welcome to communicate!


Guess you like

Origin blog.csdn.net/qq_41839588/article/details/131811985
Recommended