Sample Header Ad - 728x90

How can I find the usb devices camera?

1 vote
1 answer
4537 views
I am begginer in LINUX, sorry if my question isn't the best. I have a c++ app that uses OpenCV lib. This app runs at startup via a service(using systemctl). My app needs as arguments, the id of usb camera devices. I have 2 usb camera. When I switch off these devices, the output of ls /dev/video* is: /dev/video1 If I plug in the devices, the output of ls /dev/video* is: /dev/video0 /dev/video1 /dev/video2 So,I find out the usb camera devices and right now, I know how to run my c++ app: ./my_app 0 2 Here is my problem: My app runs automatically at every start up without to plug in/off my camera devices so I am not able to find out these ids (in this case, 0 and 2). At each restart, these ids differs. What is the rules to find out only the usb camera devices? My OS : Ubuntu 18.04 LTS My board: Nvidia Jetson Tx2 ( it has an integrated camera that I don't want to use) EDIT:output of lsusb: Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 001 Device 006: ID 03f0:094a Hewlett-Packard Optical Mouse [672662-001] Bus 001 Device 004: ID 258a:0001 Bus 001 Device 039: ID 0ac8:0346 Z-Star Microelectronics Corp. Bus 001 Device 038: ID 0ac8:0346 Z-Star Microelectronics Corp. Bus 001 Device 037: ID 14cd:8601 Super Top Bus 001 Device 002: ID 14cd:8601 Super Top Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Asked by Fredi (79 rep)
Sep 24, 2021, 08:31 AM
Last activity: Sep 27, 2021, 06:47 AM