Get device info for dev file

This is a very simply question. I have 3 potential camera devices in /dev/: video0, video1 and video2. I need to find out which one is my actual webcam and which one is a loopback device. I couldn't find any tool able to simply take any device file path and output info about it.

Does such a thing exist, or is there a better way to determine which one's my webcam?


Solution 1:

Try first to list all video devices picked up by the kernel:

ls -l /dev/video*

To list all devices attached to USB use lsusb, to list all devices attached to PCI use lspci.

The following command-line one liner should also do so:

for I in /sys/class/video4linux/*; do cat $I/name; done

Another way is to use the v4l2-ctl command which is part of v4l-utils (described in Introduction to v4l-utils):

The v4l2-ctl tool is used to control video4linux devices, either video, vbi, radio or swradio, both input and output. It is able to control almost any aspect of such devices covering the full V4L2 API.

Using it can give an output similar to:

$ v4l2-ctl --list-devices
HPigh Definition Webcam (usb-0000:00:14.0-11):
    /dev/video2
UVC Camera (046d:0821) (usb-0000:00:14.0-13):
    /dev/video0
Logitech Webcam C930e (usb-0000:00:14.0-9):
    /dev/video1 1.0MP H