5

I have two USB camera in Linux, so i have two entries in /dev/ directory(video0 and video1).

I want to get hardware information (i.e. vendor id, product id, device name) about this two camera base on videoX and choose right camera depend on its hardware information.

is there any way to get hardware information about videoX in cpp?

1 Answer 1

14

It's easy by just traversing sysfs devices by a given class. The following command-line:

cat /sys/class/video4linux/video0/name 
cat /sys/class/video4linux/video0/device/input/input3/id/product
cat /sys/class/video4linux/video0/device/input/input3/id/vendor
1
  • 1
    Note that it is not always called input35
    – Eric
    Commented Mar 15, 2018 at 19:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.