Reputation: 3483
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?
Upvotes: 5
Views: 7051
Reputation: 3483
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
Upvotes: 14