Example of hot pluggable cameras

Are there any examples on how to build a deepstream app that gracefully handle when camera’s disappear ?
Or any hints on how to neatly cleanup a pipeline on error, so the application stays running and it can re-try again ?

I’m handling the GST_MESSAGE_ERROR by setting the play state to GST_STATE_NULL and removing the callback handler for that pipeline,

				gst_element_set_state( sd->pipeline, GST_STATE_NULL );
				gst_bus_remove_signal_watch (sd->bus);

however it looks like the v4l2src doesn’t get released, as when i try to startup a new pipeline once the camera is available again, it gives me a WARNING: CameraProvider was not destroyed before client connection terminated , which makes me believe i didn’t close the previous pipeline/plugin correctly .

any hints/tips/examples welcome !!

Jul 22 14:51:59 yoda-desktop kernel: [21004.935060] usb 1-2.1: new high-speed USB device number 47 using tegra-xusb
Jul 22 14:51:59 yoda-desktop kernel: [21005.178399] usb 1-2.1: New USB device found, idVendor=046d, idProduct=0825
Jul 22 14:51:59 yoda-desktop kernel: [21005.178423] usb 1-2.1: New USB device strings: Mfr=0, Product=0, SerialNumber=2
Jul 22 14:51:59 yoda-desktop kernel: [21005.178438] usb 1-2.1: SerialNumber: 2821F020
Jul 22 14:51:59 yoda-desktop kernel: [21005.181407] uvcvideo: Found UVC 1.00 device <unnamed> (046d:0825)
Jul 22 14:51:59 yoda-desktop kernel: [21005.271081] uvcvideo 1-2.1:1.0: Entity type for entity Extension 4 was not initialized!
Jul 22 14:51:59 yoda-desktop kernel: [21005.279141] uvcvideo 1-2.1:1.0: Entity type for entity Extension 6 was not initialized!
Jul 22 14:51:59 yoda-desktop kernel: [21005.287277] uvcvideo 1-2.1:1.0: Entity type for entity Extension 7 was not initialized!
Jul 22 14:51:59 yoda-desktop kernel: [21005.295424] uvcvideo 1-2.1:1.0: Entity type for entity Processing 2 was not initialized!
Jul 22 14:51:59 yoda-desktop kernel: [21005.303682] uvcvideo 1-2.1:1.0: Entity type for entity Extension 3 was not initialized!
Jul 22 14:51:59 yoda-desktop kernel: [21005.311830] uvcvideo 1-2.1:1.0: Entity type for entity Camera 1 was not initialized!
Jul 22 14:51:59 yoda-desktop kernel: [21005.320214] input: UVC Camera (046d:0825) as /devices/70090000.xusb/usb1/1-2/1-2.1/1-2.1:1.0/input/input46
Jul 22 14:52:00 yoda-desktop kernel: [21006.667704] usb 1-2.1: set resolution quirk: cval->res = 384
Jul 22 14:52:00 yoda-desktop mtp-probe: checking bus 1, device 47: "/sys/devices/70090000.xusb/usb1/1-2/1-2.1"
Jul 22 14:52:00 yoda-desktop mtp-probe: bus: 1, device: 47 was not an MTP device
Jul 22 14:52:01 yoda-desktop pulseaudio[5746]: [pulseaudio] module-alsa-card.c: Failed to find a working profile.
Jul 22 14:52:01 yoda-desktop pulseaudio[5746]: [pulseaudio] module.c: Failed to load module "module-alsa-card" (argument: "device_id="2" name="usb-046d_0825_2821F020-02" card_name="alsa_card.usb-046d_0825_2821F020-02" namereg_fail=false tsched=yes fixed_latency_range=no ignore_dB=no deferred_volume=yes use_ucm=yes card_properties="module-udev-detect.discovered=1""): initialization failed.
Jul 22 14:52:01 yoda-desktop pulseaudio[6518]: [pulseaudio] source.c: Default and alternate sample rates are the same.
Jul 22 14:52:01 yoda-desktop rtkit-daemon[5748]: Supervising 4 threads of 1 processes of 1 users.
Jul 22 14:52:01 yoda-desktop rtkit-daemon[5748]: Successfully made thread 30519 of process 6518 (n/a) owned by '1000' RT at priority 5.
Jul 22 14:52:01 yoda-desktop rtkit-daemon[5748]: Supervising 5 threads of 1 processes of 1 users.
Jul 22 14:52:03 yoda-desktop nvargus-daemon[5175]: === aethersprite[29820]: CameraProvider initialized (0x7f89bb5010)=== aethersprite[29820]: Connection closed (7F8EB1A1D0)=== aethersprite[29820]: WARNING: CameraProvider was not destroyed before client connection terminated.=== aethersprite[29820]:          The client may have abnormally terminated. Destroying CameraProvider...=== aethersprite[29820]: CameraProvider destroyed (0x7f89bb5010)=== aethersprite[29820]: Connection cleaned up (7F8EB1A1D0)=== aethersprite[30395]: Connection established (7F8EB1A1D0)OFParserListModules: module list: /proc/device-tree/tegra-camera-platform/modules/module0
Jul 22 14:52:03 yoda-desktop nvargus-daemon[5175]: OFParserListModules: module list: /proc/device-tree/tegra-camera-platform/modules/module1
Jul 22 14:52:03 yoda-desktop nvargus-daemon[5175]: OFParserGetVirtualDevice: NVIDIA Camera virtual enumerator not found in proc device-tree
Jul 22 14:52:03 yoda-desktop nvargus-daemon[5175]: ---- imager: No override file found. ----
Jul 22 14:52:03 yoda-desktop nvargus-daemon[5175]: (NvCamV4l2) Error ModuleNotPresent: V4L2Device not available (in /dvs/git/dirty/git-master_linux/camera/utils/nvcamv4l2/v4l2_device.cpp, function findDevice(), line 256)
Jul 22 14:52:03 yoda-desktop nvargus-daemon[5175]: (NvCamV4l2) Error ModuleNotPresent:  (propagating from /dvs/git/dirty/git-master_linux/camera/utils/nvcamv4l2/v4l2_device.cpp, function initialize(), line 60)
Jul 22 14:52:03 yoda-desktop nvargus-daemon[5175]: (NvOdmDevice) Error ModuleNotPresent:  (propagating from dvs/git/dirty/git-master_linux/camera-partner/imager/src/devices/V4L2SensorViCsi.cpp, function initialize(), line 107)
Jul 22 14:52:03 yoda-desktop nvargus-daemon[5175]: NvPclDriverInitializeData: Unable to initialize driver v4l2_sensor
Jul 22 14:52:03 yoda-desktop nvargus-daemon[5175]: NvPclInitializeDrivers: error: Failed to init camera sub module v4l2_sensor
Jul 22 14:52:03 yoda-desktop nvargus-daemon[5175]: NvPclStartPlatformDrivers: Failed to start module drivers
Jul 22 14:52:03 yoda-desktop nvargus-daemon[5175]: NvPclStateControllerOpen: Failed ImagerGUID 1. (error 0xA000E)
Jul 22 14:52:03 yoda-desktop nvargus-daemon[5175]: NvPclOpen: PCL Open Failed. Error: 0xf
Jul 22 14:52:03 yoda-desktop nvargus-daemon[5175]: SCF: Error BadParameter: Sensor could not be opened. (in src/services/capture/CaptureServiceDeviceSensor.cpp, function getSourceFromGuid(), line 582)
Jul 22 14:52:03 yoda-desktop nvargus-daemon[5175]: SCF: Error BadParameter:  (propagating from src/services/capture/CaptureService.cpp, function addSourceByGuid(), line 437)
Jul 22 14:52:03 yoda-desktop nvargus-daemon[5175]: SCF: Error BadParameter:  (propagating from src/api/CameraDriver.cpp, function addSourceByIndex(), line 303)
Jul 22 14:52:03 yoda-desktop nvargus-daemon[5175]: SCF: Error BadParameter:  (propagating from src/api/CameraDriver.cpp, function getSource(), line 466)
Jul 22 14:52:03 yoda-desktop nvargus-daemon[5175]: Acquiring SCF Camera device source via index 0 has failed. ---- imager: No override file found. ----
Jul 22 14:52:03 yoda-desktop nvargus-daemon[5175]: (NvCamV4l2) Error ModuleNotPresent: V4L2Device not available (in /dvs/git/dirty/git-master_linux/camera/utils/nvcamv4l2/v4l2_device.cpp, function findDevice(), line 256)
Jul 22 14:52:03 yoda-desktop nvargus-daemon[5175]: (NvCamV4l2) Error ModuleNotPresent:  (propagating from /dvs/git/dirty/git-master_linux/camera/utils/nvcamv4l2/v4l2_device.cpp, function initialize(), line 60)
Jul 22 14:52:03 yoda-desktop nvargus-daemon[5175]: (NvOdmDevice) Error ModuleNotPresent:  (propagating from dvs/git/dirty/git-master_linux/camera-partner/imager/src/devices/V4L2SensorViCsi.cpp, function initialize(), line 107)
Jul 22 14:52:03 yoda-desktop nvargus-daemon[5175]: NvPclDriverInitializeData: Unable to initialize driver v4l2_sensor
Jul 22 14:52:03 yoda-desktop nvargus-daemon[5175]: NvPclInitializeDrivers: error: Failed to init camera sub module v4l2_sensor
Jul 22 14:52:03 yoda-desktop nvargus-daemon[5175]: NvPclStartPlatformDrivers: Failed to start module drivers
Jul 22 14:52:03 yoda-desktop nvargus-daemon[5175]: NvPclStateControllerOpen: Failed ImagerGUID 0. (error 0xA000E)
Jul 22 14:52:03 yoda-desktop nvargus-daemon[5175]: NvPclOpen: PCL Open Failed. Error: 0xf
Jul 22 14:52:03 yoda-desktop nvargus-daemon[5175]: SCF: Error BadParameter: Sensor could not be opened. (in src/services/capture/CaptureServiceDeviceSensor.cpp, function getSourceFromGuid(), line 582)
Jul 22 14:52:03 yoda-desktop nvargus-daemon[5175]: SCF: Error BadParameter:  (propagating from src/services/capture/CaptureService.cpp, function addSourceByGuid(), line 437)
Jul 22 14:52:03 yoda-desktop nvargus-daemon[5175]: SCF: Error BadParameter:  (propagating from src/api/CameraDriver.cpp, function addSourceByIndex(), line 303)
Jul 22 14:52:03 yoda-desktop nvargus-daemon[5175]: SCF: Error BadParameter:  (propagating from src/api/CameraDriver.cpp, function getSource(), line 466)
Jul 22 14:52:03 yoda-desktop nvargus-daemon[5175]: Acquiring SCF Camera device source via index 1 has failed. ---- imager: No override file found. ----
Jul 22 14:52:03 yoda-desktop nvargus-daemon[5175]: initializeDevNode: Failed to open dev node '/dev/camera/video0'; No such file or directory, trying alternate default location
Jul 22 14:52:03 yoda-desktop nvargus-daemon[5175]: (NvCamV4l2) Error BadParameter: Control 10094858 not found (in /dvs/git/dirty/git-master_linux/camera/utils/nvcamv4l2/v4l2_device.cpp, function findControlById(), line 1874)
Jul 22 14:52:03 yoda-desktop nvargus-daemon[5175]: (NvCamV4l2) Error BadParameter:  (propagating from /dvs/git/dirty/git-master_linux/camera/utils/nvcamv4l2/v4l2_device.cpp, function getControlRange(), line 331)
Jul 22 14:52:03 yoda-desktop nvargus-daemon[5175]: initialize: focus query failed
Jul 22 14:52:06 yoda-desktop pulseaudio[5746]: [pulseaudio] source.c: Default and alternate sample rates are the same.
Jul 22 14:52:06 yoda-desktop rtkit-daemon[5748]: Supervising 5 threads of 1 processes of 1 users.
Jul 22 14:52:13 yoda-desktop kernel: [21019.338607] usb 1-2.1: usb_suspend_both: status 0

Did you use v4l2src only? The error looks like from Argus instead of v4l2src.
Current Argus camera didn’t support hot plug case.

Ah, i see.

The gst-launch-1.0 equivalent is
v4l2src device=/dev/video1 ! video/x-raw, width=1280, height=720, framerate=10/1 ! interpipe name=video0

I can’t imagine that the interpipe plugin is what starts up a nvargus-daemon ? (I assume the nv means nvidia)

bool
PipelineManager::start_camera_source_stream( Ref<CameraDetails> cd)
{
	Log::log("start_camera_source_stream");
	bool ret_value = false;

	Ref<CameraSourceStreamDetails> sd 	= mkRef<CameraSourceStreamDetails>();
	sd->m_serial 						= cd->get_serial();
	sd->m_resolution 					= cd->m_prefered_resolution;
	sd->loop 							= m_loop;

	// start camera source stream
	// v4l2src device=/dev/video1 ! 
	// video/x-raw, width=1280, height=720, framerate=10/1 !
	// interpipe name=video0

	// gstream setup
	GstMessage *msg;
	GstStateChangeReturn ret;

  	sd->pipeline = gst_pipeline_new (combine("camera-source-pipeline", sd->m_serial).c_str());

  	if ( sd->pipeline ) 
  	{
  		sd->bus = gst_element_get_bus(sd->pipeline);
  		gst_bus_add_signal_watch (sd->bus);
  		g_signal_connect (sd->bus, "message", (GCallback) cb_message, sd.get());

 		//--------------------------------------------------------------------
 		// v4l2src device=/dev/video0 !
  		sd->source = create_plugin("v4l2src", sd->m_serial);
  		if( G_IS_OBJECT(sd->source)  )
  		{
  			string devicestring = "/dev/" + cd->get_device_name();
  			g_object_set (G_OBJECT(sd->source), "device", devicestring.c_str(), NULL);


	 		//--------------------------------------------------------------------
	 		// video/x-raw,width=1280,height=720,framerate=10/1 !
  			GstCaps* caps_source = gst_caps_from_string("video/x-raw,width=1024,height=576,framerate=10/1");
  			sd->source_caps_filter = create_plugin("capsfilter", sd->m_serial, "source"); 
  			g_object_set (G_OBJECT(sd->source_caps_filter), "caps", caps_source, NULL);
  			sd->interpipe_sink = create_plugin("interpipesink", sd->m_serial,cd->get_device_name()); 

  			if( G_IS_OBJECT(sd->interpipe_sink)  )
  			{
 				g_object_set (sd->interpipe_sink, 
  					"sync", true,
  					"async", false,
  					NULL);

  				gst_bin_add_many( GST_BIN  (sd->pipeline),
  					sd->source,
  					sd->source_caps_filter, 
  					sd->interpipe_sink,
  					NULL); 

  				gst_element_link_many( 	sd->source,
  					sd->source_caps_filter,
  					sd->interpipe_sink,
  					NULL);

  				gst_element_set_state(sd->pipeline, GST_STATE_PLAYING);

  				ret_value = true;
  			}
  		}
  	}
  	if( ret_value)
  	{
  		sd->m_running = true;
		// add it to the collection
  		m_camera_source_stream_details_map[sd->m_serial] = sd;
  	}
  	return ret_value;
  }

Maybe it include the nvarguscamerasrc to trigger the nvargus-daemon.
What’s your camera type. v4l2-ctl --all

mmmm i think i found something.
the other side of the interpipe is another interpipe that listens to it…

interpipesrc listento=video0 ! clockoverlay halignment=right valignment=bottom text="Device Time:" shaded-background=true font-desc="Sans, 12" ! nvvidconv ! 'video/x-raw(memory:NVMM),format=(string)I420' ! nvv4l2h265enc bitrate=2000000 ! 'video/x-h265, stream-format=(string)byte-stream'! h265parse ! qtmux ! filesink location=test265.mp4 -e v4l2src device=/dev/video0

  _______                             ┌──────────────────┐
 |__/-\[]|              ┌────────┐   │    interpipe       │
 |  (_)  |────────────▶ │ source │─▶ │   name=video0    │ 
 |_______|              └────────┘   │                    │
                                      └──────────────────┘
┌──────────────────┐                 ┌─────────┐
│    interpipe       │   ┌────────┐   │         │
│listen-to=video0   ├─▶ │filesink│───▶│   mp4   │ 
│                    │   └────────┘   │         │
└──────────────────┘                 └─────────┘

(doing this to be able to dynamically switch add/remove sinks)

if i don’t startup that other pipeline (the mp4 writing one) the unplug and replug works fine…
not sure i understand what is happening, but this points to something in the other pipeline hanging onto the camera…perhaps…

btw: it’s a logitech C270

yoda@yoda-desktop:~$ v4l2-ctl --all
Driver Info (not using libv4l2):
	Driver name   : uvcvideo
	Card type     : UVC Camera (046d:0825)
	Bus info      : usb-70090000.xusb-2.1
	Driver version: 4.9.201
	Capabilities  : 0x84200001
		Video Capture
		Streaming
		Extended Pix Format
		Device Capabilities
	Device Caps   : 0x04200001
		Video Capture
		Streaming
		Extended Pix Format
Priority: 2
Video input : 0 (Camera 1: ok)
Format Video Capture:
	Width/Height      : 1024/576
	Pixel Format      : 'YUYV'
	Field             : None
	Bytes per Line    : 2048
	Size Image        : 1179648
	Colorspace        : sRGB
	Transfer Function : Default (maps to sRGB)
	YCbCr/HSV Encoding: Default (maps to ITU-R 601)
	Quantization      : Default (maps to Limited Range)
	Flags             : 
Crop Capability Video Capture:
	Bounds      : Left 0, Top 0, Width 1024, Height 576
	Default     : Left 0, Top 0, Width 1024, Height 576
	Pixel Aspect: 1/1
Selection: crop_default, Left 0, Top 0, Width 1024, Height 576
Selection: crop_bounds, Left 0, Top 0, Width 1024, Height 576
Streaming Parameters Video Capture:
	Capabilities     : timeperframe
	Frames per second: 10.000 (10/1)
	Read buffers     : 0
                     brightness 0x00980900 (int)    : min=0 max=255 step=1 default=128 value=128
                       contrast 0x00980901 (int)    : min=0 max=255 step=1 default=32 value=32
                     saturation 0x00980902 (int)    : min=0 max=255 step=1 default=32 value=32
 white_balance_temperature_auto 0x0098090c (bool)   : default=1 value=1
                           gain 0x00980913 (int)    : min=0 max=255 step=1 default=64 value=1
           power_line_frequency 0x00980918 (menu)   : min=0 max=2 default=2 value=2
      white_balance_temperature 0x0098091a (int)    : min=0 max=10000 step=10 default=4000 value=2150 flags=inactive
                      sharpness 0x0098091b (int)    : min=0 max=255 step=1 default=24 value=24
         backlight_compensation 0x0098091c (int)    : min=0 max=1 step=1 default=0 value=0
                  exposure_auto 0x009a0901 (menu)   : min=0 max=3 default=3 value=3
              exposure_absolute 0x009a0902 (int)    : min=1 max=10000 step=1 default=166 value=665 flags=inactive
         exposure_auto_priority 0x009a0903 (bool)   : default=0 value=1

i was a bit puzzled about the nvargus-daemon in the syslog, so just for laughs i stopped the service
systemctl stop nvargus-daemon.service
and it works just fine now…

what is nvargus-daemon used for ? Does that handle the hardware acceleration ?

It’s for CSI Bayer Raw sensor, Looks like your device didn’t have this kind of sensor you can just stop this service for your case. Otherwise you need to check your source to remove the nvarguscamerasrc pipeline if have it.

1 Like

This is Odd… when the application first start the pipelines it does so without a problem,
the second time it seems to need this nvargus-daemon…
when i set the source pipeline to PLAYING it complains:

(Argus) Error FileOperationFailed: Connecting to nvargus-daemon failed: Connection refused (in src/rpc/socket/client/SocketClientDispatch.cpp, function openSocketConnection(), line 201)
(Argus) Error FileOperationFailed: Cannot create camera provider (in src/rpc/socket/client/SocketClientDispatch.cpp, function createCameraProvider(), line 102)
ArgusV4L2_Open failed: Connection refused
Opening in BLOCKING MODE

this is puzzling

I’ve exported some dot files of my 2 pipelines here

is there anything that stands out of why it needs access to the nvargus-daemon ?

Looks like ArgusV4L2_Open() is from libv4l2_nvargus API have you include anything relative Argus?

no nothing in the source (or the binary

yoda@yoda-desktop:~/projects/src/aethersprite$ ls 
aethersprite                   camera_manager.cpp  dot      main.cpp              pipeline_manager.o  string_utils.o
camera_details.cpp             camera_manager.hpp  fs       main.o                README.md           usb-046d_0825_2821F020-video-index0-20210722195649.mp4
camera_details.hpp             camera_manager.o    log.cpp  Makefile              stream_details.hpp  usb-046d_0825_2821F020-video-index0-20210722200044.mp4
camera_details.o               cpp_support.hpp     log.hpp  pipeline_manager.cpp  string_utils.cpp    usb-046d_0825_2821F020-video-index0-20210722200105.mp4
camera_details_resolution.hpp  doc                 log.o    pipeline_manager.hpp  string_utils.hpp
yoda@yoda-desktop:~/projects/src/aethersprite$ grep -r -i argus
yoda@yoda-desktop:~/projects/src/aethersprite$ 
yoda@yoda-desktop:~/projects/src/aethersprite$ ldd aethersprite 
	linux-vdso.so.1 (0x0000007fabf21000)
	libgstreamer-1.0.so.0 => /usr/lib/aarch64-linux-gnu/libgstreamer-1.0.so.0 (0x0000007fabd6a000)
	libgobject-2.0.so.0 => /usr/lib/aarch64-linux-gnu/libgobject-2.0.so.0 (0x0000007fabd0c000)
	libglib-2.0.so.0 => /usr/lib/aarch64-linux-gnu/libglib-2.0.so.0 (0x0000007fabbfd000)
	libpthread.so.0 => /lib/aarch64-linux-gnu/libpthread.so.0 (0x0000007fabbd1000)
	libstdc++.so.6 => /usr/lib/aarch64-linux-gnu/libstdc++.so.6 (0x0000007faba3d000)
	libgcc_s.so.1 => /lib/aarch64-linux-gnu/libgcc_s.so.1 (0x0000007faba19000)
	libc.so.6 => /lib/aarch64-linux-gnu/libc.so.6 (0x0000007fab8c0000)
	/lib/ld-linux-aarch64.so.1 (0x0000007fabef5000)
	libgmodule-2.0.so.0 => /usr/lib/aarch64-linux-gnu/libgmodule-2.0.so.0 (0x0000007fab8ac000)
	libm.so.6 => /lib/aarch64-linux-gnu/libm.so.6 (0x0000007fab7f3000)
	libdl.so.2 => /lib/aarch64-linux-gnu/libdl.so.2 (0x0000007fab7de000)
	libffi.so.6 => /usr/lib/aarch64-linux-gnu/libffi.so.6 (0x0000007fab7c6000)
	libpcre.so.3 => /lib/aarch64-linux-gnu/libpcre.so.3 (0x0000007fab754000)

so i thought if it needs nvargus-daemon, i may as well see what it is saying by following some instructions that i found on here:

yoda@yoda-desktop:~/projects/src/aethersprite$ sudo su
[sudo] password for yoda: 
root@yoda-desktop:/home/yoda/projects/src/aethersprite# export enableCamPclLogs=5
root@yoda-desktop:/home/yoda/projects/src/aethersprite# /usr/sbin/nvargus_daemon
bash: /usr/sbin/nvargus_daemon: No such file or directory
root@yoda-desktop:/home/yoda/projects/src/aethersprite# /usr/sbin/nvargus-daemon
Client is not authorized to connect to Servernvbuf_utils: Could not get EGL display connection
=== NVIDIA Libargus Camera Service (0.97.3)=== Listening for connections...^C
root@yoda-desktop:/home/yoda/projects/src/aethersprite# export DISPLAY=:0
root@yoda-desktop:/home/yoda/projects/src/aethersprite# /usr/sbin/nvargus-daemon
No protocol specified
nvbuf_utils: Could not get EGL display connection
=== NVIDIA Libargus Camera Service (0.97.3)=== Listening for connections...

=== aethersprite[8331]: Connection established (7F9BC4D1D0)NvPclSetHotplugCallback: ++++++++++++++++++++++
---- Imager: Calibration blob file handling supported in this build ----
NvPclHwGetModuleList: OFParserListModules Succeeded
OFParserListModules: module list: /proc/device-tree/tegra-camera-platform/modules/module0
OFParserListModules: module list: /proc/device-tree/tegra-camera-platform/modules/module1
NvPclHwMatchPartNum: Found calibration Part#: RBPCV2:"RBPCV2"
NvPclHwPrintModuleDefinition -- Name: porg_front_RBPCV2
NvPclHwPrintModuleDefinition -- Position: 1
NvPclHwPrintModuleDefinition -- CalibrationData Found: 1
NvPclHwPrintCameraSubModule -- HwCamSubModule[0].Name: v4l2_lens
NvPclHwPrintCameraSubModule -- HwCamSubModule[0].DevName: 
NvPclHwPrintCameraSubModule -- HwCamSubModule[1].Name: v4l2_sensor
NvPclHwPrintCameraSubModule -- HwCamSubModule[1].DevName: imx219 7-0010
NvPclHwMatchPartNum: Found calibration Part#: RBPCV2:"RBPCV2"
NvPclHwPrintModuleDefinition -- Name: porg_rear_RBPCV2
NvPclHwPrintModuleDefinition -- Position: 0
NvPclHwPrintModuleDefinition -- CalibrationData Found: 1
NvPclHwPrintCameraSubModule -- HwCamSubModule[0].Name: v4l2_lens
NvPclHwPrintCameraSubModule -- HwCamSubModule[0].DevName: 
NvPclHwPrintCameraSubModule -- HwCamSubModule[1].Name: v4l2_sensor
NvPclHwPrintCameraSubModule -- HwCamSubModule[1].DevName: imx219 8-0010
NvPclHwGetModuleList: OFParserListModules Succeeded
NvPclModuleListInitialize: NvPclModule list[0]: porg_front_RBPCV2 position1
NvPclModuleListInitialize: NvPclModule list[1]: porg_rear_RBPCV2 position0
NvPclHwScanExternalCameras -- adding video0 to discover list
NvPclHwScanExternalCameras -- adding video0 to discover list
NvPclHwScanExternalCameras -- adding video0 to discover list
NvPclHwScanExternalCameras -- adding video0 to discover list
NvPclHwAddModules -- Found plugable sensor at usb@video0
NvPclHwPrintModuleDefinition -- Name: usb@video0
NvPclHwPrintModuleDefinition -- Position: 2
NvPclHwPrintModuleDefinition -- CalibrationData Found: 1
NvPclHwPrintCameraSubModule -- HwCamSubModule[0].Name: v4l2_sensor_usb
NvPclHwPrintCameraSubModule -- HwCamSubModule[0].DevName: 
NvPclModuleListInitialize: NvPclModule list[2]: usb@video0 position2
getHotplugMonitor: Getting hotplug monitor instance
 initializeHotplug++
 hotPlugfunc ++ 
 addWatch: Watch added wd='1'
CheckProcDTExists: INFO: accessing /proc/device-tree/tegra-virtual-camera-platform/modules; No such file or directory
OFParserGetVirtualDevice: NVIDIA Camera virtual enumerator not found in proc device-tree
setHotplugCallback: Registered new callback client
NvPclSetHotplugCallback: ----------------------
 hotPlugfunc: reading from inotify FD, Thread waiting 
NvPclOpen: ++++++++++++++++++++++
NvPclStateControllerOpen: Found GUID 1 match at index[0]
NvPclHwInitializeModule: allocate overrides pathname @ 0x7f948029c0
NvPclHwInitializeModule: allocate overrides pathname @ 0x7f94844cc0
NvPclHwInitializeModule: allocate overrides pathname @ 0x7f94517bd0
NvPclHwInitializeModule: allocate overrides pathname @ 0x7f9480b300
NvPclHwInitializeModule: allocate overrides pathname @ 0x7f9492dcf0
NvPclHwInitializeModule: allocate overrides pathname @ 0x7f94966370
LoadOverridesFile: looking for override file [/Calib/camera_override.isp] 1/16
CheckOverridesPermissions: stat(/Calib/camera_override.isp) call failed
LoadOverridesFile: looking for override file [/data/vendor/nvcam/settings/camera_overrides.isp] 2/16
CheckOverridesPermissions: stat(/data/vendor/nvcam/settings/camera_overrides.isp) call failed
LoadOverridesFile: looking for override file [/opt/nvidia/nvcam/settings/camera_overrides.isp] 3/16
CheckOverridesPermissions: stat(/opt/nvidia/nvcam/settings/camera_overrides.isp) call failed
LoadOverridesFile: looking for override file [/var/nvidia/nvcam/settings/camera_overrides.isp] 4/16
CheckOverridesPermissions: stat(/var/nvidia/nvcam/settings/camera_overrides.isp) call failed
LoadOverridesFile: looking for override file [/data/vendor/nvcam/camera_overrides.isp] 5/16
CheckOverridesPermissions: stat(/data/vendor/nvcam/camera_overrides.isp) call failed
LoadOverridesFile: looking for override file [/data/vendor/nvcam/settings/porg_front_RBPCV2.isp] 6/16
CheckOverridesPermissions: stat(/data/vendor/nvcam/settings/porg_front_RBPCV2.isp) call failed
LoadOverridesFile: looking for override file [/opt/nvidia/nvcam/settings/porg_front_RBPCV2.isp] 7/16
CheckOverridesPermissions: stat(/opt/nvidia/nvcam/settings/porg_front_RBPCV2.isp) call failed
LoadOverridesFile: looking for override file [/var/nvidia/nvcam/settings/porg_front_RBPCV2.isp] 8/16
CheckOverridesPermissions: stat(/var/nvidia/nvcam/settings/porg_front_RBPCV2.isp) call failed
---- imager: No override file found. ----
Imager: looking for override file [/mnt/factory/camera/factory.bin] 1/16
Imager: looking for override file [/Calib/factory.bin] 2/16
Imager: looking for override file [/Calib/calibration.bin] 3/16
Imager: looking for override file [(null)] 4/16
Imager: looking for override file [(null)] 5/16
Imager: looking for override file [(null)] 6/16
Imager: looking for override file [(null)] 7/16
Imager: looking for override file [(null)] 8/16
Imager: looking for override file [(null)] 9/16
Imager: looking for override file [(null)] 10/16
Imager: looking for override file [(null)] 11/16
Imager: looking for override file [(null)] 12/16
Imager: looking for override file [(null)] 13/16
Imager: looking for override file [(null)] 14/16
Imager: looking for override file [(null)] 15/16
Imager: looking for override file [(null)] 16/16
Imager: looking for override file [/data/vendor/nvcam/settings/factory.bin] 1/16
Imager: looking for override file [/data/vendor/nvcam/settings/porg_front_RBPCV2.bin] 2/16
Imager: looking for override file [/opt/nvidia/nvcam/settings/porg_front_RBPCV2.bin] 3/16
Imager: looking for override file [/var/nvidia/nvcam/settings/porg_front_RBPCV2.bin] 4/16
Imager: looking for override file [(null)] 5/16
Imager: looking for override file [(null)] 6/16
Imager: looking for override file [(null)] 7/16
Imager: looking for override file [(null)] 8/16
Imager: looking for override file [(null)] 9/16
Imager: looking for override file [(null)] 10/16
Imager: looking for override file [(null)] 11/16
Imager: looking for override file [(null)] 12/16
Imager: looking for override file [(null)] 13/16
Imager: looking for override file [(null)] 14/16
Imager: looking for override file [(null)] 15/16
Imager: looking for override file [(null)] 16/16
NvPclCreateDriver: Found NvPcl Driver Hal dev_name match (v4l2_lens)
NvPclCreateDriver: Found a Driver name match (v4l2_lens)
NvPclCreateDriver: Found NvPcl Driver Hal dev_name match (v4l2_sensor)
NvPclCreateDriver: Found a Driver name match (v4l2_sensor)
NvPclConnectDrivers: hImager was NULL, creating new imager
NvPclInitializeDrivers: v4l2_lens ++++++++++++++++++
initialize WARNING: No focuser object, allocating for lens
OFDPropertyCopyToLong: could not read property [maxslewrate]
loadLensMetadata: maxslewrate not set in driver
NvPclInitializeDrivers: NvOdmLensStub ------------------
NvPclInitializeDrivers: v4l2_sensor ++++++++++++++++++
OFDPropertyGetString: could not read property [devnode-bus]
(NvCamV4l2) Error ModuleNotPresent: V4L2Device not available (in /dvs/git/dirty/git-master_linux/camera/utils/nvcamv4l2/v4l2_device.cpp, function findDevice(), line 256)
(NvCamV4l2) Error ModuleNotPresent:  (propagating from /dvs/git/dirty/git-master_linux/camera/utils/nvcamv4l2/v4l2_device.cpp, function initialize(), line 60)
(NvOdmDevice) Error ModuleNotPresent:  (propagating from dvs/git/dirty/git-master_linux/camera-partner/imager/src/devices/V4L2SensorViCsi.cpp, function initialize(), line 107)
NvPclDriverInitializeData: Unable to initialize driver v4l2_sensor
NvPclInitializeDrivers: error: Failed to init camera sub module v4l2_sensor
NvPclStartPlatformDrivers: Failed to start module drivers
NvPclCloseModuleDrivers: deallocate/free overrides pathname @ 0x7f9480b300
NvPclCloseModuleDrivers: deallocate/free overrides pathname @ 0x7f9492dcf0
NvPclCloseModuleDrivers: deallocate/free overrides pathname @ 0x7f94966370
NvPclCloseModuleDrivers: deallocate/free overrides pathname @ 0x7f948029c0
NvPclCloseModuleDrivers: deallocate/free overrides pathname @ 0x7f94844cc0
NvPclCloseModuleDrivers: deallocate/free overrides pathname @ 0x7f94517bd0
NvPclStateControllerOpen: Failed ImagerGUID 1. (error 0xA000E)
NvPclStateControllerClose: Module porg_front_RBPCV2 closed
NvPclOpen: PCL Open Failed. Error: 0xf
NvPclClose: ++++++++++++++++++++++
NvPclClose: ----------------------
NvPclOpen: ----------------------
SCF: Error BadParameter: Sensor could not be opened. (in src/services/capture/CaptureServiceDeviceSensor.cpp, function getSourceFromGuid(), line 582)
SCF: Error BadParameter:  (propagating from src/services/capture/CaptureService.cpp, function addSourceByGuid(), line 437)
SCF: Error BadParameter:  (propagating from src/api/CameraDriver.cpp, function addSourceByIndex(), line 303)
SCF: Error BadParameter:  (propagating from src/api/CameraDriver.cpp, function getSource(), line 466)
Acquiring SCF Camera device source via index 0 has failed. NvPclOpen: ++++++++++++++++++++++
NvPclStateControllerOpen: Found GUID 0 match at index[1]
NvPclHwInitializeModule: allocate overrides pathname @ 0x7f9492dda0
NvPclHwInitializeModule: allocate overrides pathname @ 0x7f94517bd0
NvPclHwInitializeModule: allocate overrides pathname @ 0x7f94844cc0
NvPclHwInitializeModule: allocate overrides pathname @ 0x7f948029c0
NvPclHwInitializeModule: allocate overrides pathname @ 0x7f94966370
NvPclHwInitializeModule: allocate overrides pathname @ 0x7f9492dcf0
LoadOverridesFile: looking for override file [/Calib/camera_override.isp] 1/16
CheckOverridesPermissions: stat(/Calib/camera_override.isp) call failed
LoadOverridesFile: looking for override file [/data/vendor/nvcam/settings/camera_overrides.isp] 2/16
CheckOverridesPermissions: stat(/data/vendor/nvcam/settings/camera_overrides.isp) call failed
LoadOverridesFile: looking for override file [/opt/nvidia/nvcam/settings/camera_overrides.isp] 3/16
CheckOverridesPermissions: stat(/opt/nvidia/nvcam/settings/camera_overrides.isp) call failed
LoadOverridesFile: looking for override file [/var/nvidia/nvcam/settings/camera_overrides.isp] 4/16
CheckOverridesPermissions: stat(/var/nvidia/nvcam/settings/camera_overrides.isp) call failed
LoadOverridesFile: looking for override file [/data/vendor/nvcam/camera_overrides.isp] 5/16
CheckOverridesPermissions: stat(/data/vendor/nvcam/camera_overrides.isp) call failed
LoadOverridesFile: looking for override file [/data/vendor/nvcam/settings/porg_rear_RBPCV2.isp] 6/16
CheckOverridesPermissions: stat(/data/vendor/nvcam/settings/porg_rear_RBPCV2.isp) call failed
LoadOverridesFile: looking for override file [/opt/nvidia/nvcam/settings/porg_rear_RBPCV2.isp] 7/16
CheckOverridesPermissions: stat(/opt/nvidia/nvcam/settings/porg_rear_RBPCV2.isp) call failed
LoadOverridesFile: looking for override file [/var/nvidia/nvcam/settings/porg_rear_RBPCV2.isp] 8/16
CheckOverridesPermissions: stat(/var/nvidia/nvcam/settings/porg_rear_RBPCV2.isp) call failed
---- imager: No override file found. ----
Imager: looking for override file [/mnt/factory/camera/factory.bin] 1/16
Imager: looking for override file [/Calib/factory.bin] 2/16
Imager: looking for override file [/Calib/calibration.bin] 3/16
Imager: looking for override file [(null)] 4/16
Imager: looking for override file [(null)] 5/16
Imager: looking for override file [(null)] 6/16
Imager: looking for override file [(null)] 7/16
Imager: looking for override file [(null)] 8/16
Imager: looking for override file [(null)] 9/16
Imager: looking for override file [(null)] 10/16
Imager: looking for override file [(null)] 11/16
Imager: looking for override file [(null)] 12/16
Imager: looking for override file [(null)] 13/16
Imager: looking for override file [(null)] 14/16
Imager: looking for override file [(null)] 15/16
Imager: looking for override file [(null)] 16/16
Imager: looking for override file [/data/vendor/nvcam/settings/factory.bin] 1/16
Imager: looking for override file [/data/vendor/nvcam/settings/porg_rear_RBPCV2.bin] 2/16
Imager: looking for override file [/opt/nvidia/nvcam/settings/porg_rear_RBPCV2.bin] 3/16
Imager: looking for override file [/var/nvidia/nvcam/settings/porg_rear_RBPCV2.bin] 4/16
Imager: looking for override file [(null)] 5/16
Imager: looking for override file [(null)] 6/16
Imager: looking for override file [(null)] 7/16
Imager: looking for override file [(null)] 8/16
Imager: looking for override file [(null)] 9/16
Imager: looking for override file [(null)] 10/16
Imager: looking for override file [(null)] 11/16
Imager: looking for override file [(null)] 12/16
Imager: looking for override file [(null)] 13/16
Imager: looking for override file [(null)] 14/16
Imager: looking for override file [(null)] 15/16
Imager: looking for override file [(null)] 16/16
NvPclCreateDriver: Found NvPcl Driver Hal dev_name match (v4l2_lens)
NvPclCreateDriver: Found a Driver name match (v4l2_lens)
NvPclCreateDriver: Found NvPcl Driver Hal dev_name match (v4l2_sensor)
NvPclCreateDriver: Found a Driver name match (v4l2_sensor)
NvPclConnectDrivers: hImager was NULL, creating new imager
NvPclInitializeDrivers: v4l2_lens ++++++++++++++++++
initialize WARNING: No focuser object, allocating for lens
OFDPropertyCopyToLong: could not read property [maxslewrate]
loadLensMetadata: maxslewrate not set in driver
NvPclInitializeDrivers: NvOdmLensStub ------------------
NvPclInitializeDrivers: v4l2_sensor ++++++++++++++++++
OFDPropertyGetString: could not read property [devnode-bus]
(NvCamV4l2) Error ModuleNotPresent: V4L2Device not available (in /dvs/git/dirty/git-master_linux/camera/utils/nvcamv4l2/v4l2_device.cpp, function findDevice(), line 256)
(NvCamV4l2) Error ModuleNotPresent:  (propagating from /dvs/git/dirty/git-master_linux/camera/utils/nvcamv4l2/v4l2_device.cpp, function initialize(), line 60)
(NvOdmDevice) Error ModuleNotPresent:  (propagating from dvs/git/dirty/git-master_linux/camera-partner/imager/src/devices/V4L2SensorViCsi.cpp, function initialize(), line 107)
NvPclDriverInitializeData: Unable to initialize driver v4l2_sensor
NvPclInitializeDrivers: error: Failed to init camera sub module v4l2_sensor
NvPclStartPlatformDrivers: Failed to start module drivers
NvPclCloseModuleDrivers: deallocate/free overrides pathname @ 0x7f948029c0
NvPclCloseModuleDrivers: deallocate/free overrides pathname @ 0x7f94966370
NvPclCloseModuleDrivers: deallocate/free overrides pathname @ 0x7f9492dcf0
NvPclCloseModuleDrivers: deallocate/free overrides pathname @ 0x7f9492dda0
NvPclCloseModuleDrivers: deallocate/free overrides pathname @ 0x7f94517bd0
NvPclCloseModuleDrivers: deallocate/free overrides pathname @ 0x7f94844cc0
NvPclStateControllerOpen: Failed ImagerGUID 0. (error 0xA000E)
NvPclStateControllerClose: Module porg_rear_RBPCV2 closed
NvPclOpen: PCL Open Failed. Error: 0xf
NvPclClose: ++++++++++++++++++++++
NvPclClose: ----------------------
NvPclOpen: ----------------------
SCF: Error BadParameter: Sensor could not be opened. (in src/services/capture/CaptureServiceDeviceSensor.cpp, function getSourceFromGuid(), line 582)
SCF: Error BadParameter:  (propagating from src/services/capture/CaptureService.cpp, function addSourceByGuid(), line 437)
SCF: Error BadParameter:  (propagating from src/api/CameraDriver.cpp, function addSourceByIndex(), line 303)
SCF: Error BadParameter:  (propagating from src/api/CameraDriver.cpp, function getSource(), line 466)
Acquiring SCF Camera device source via index 1 has failed. NvPclOpen: ++++++++++++++++++++++
NvPclStateControllerOpen: Found GUID 2 match at index[2]
NvPclHwInitializeModule: allocate overrides pathname @ 0x7f9480b300
NvPclHwInitializeModule: allocate overrides pathname @ 0x7f94844cc0
NvPclHwInitializeModule: allocate overrides pathname @ 0x7f94517bd0
NvPclHwInitializeModule: allocate overrides pathname @ 0x7f9492dda0
NvPclHwInitializeModule: allocate overrides pathname @ 0x7f9492dcf0
NvPclHwInitializeModule: allocate overrides pathname @ 0x7f94966370
LoadOverridesFile: looking for override file [/data/vendor/nvcam/settings/usb@video0.isp] 6/16
CheckOverridesPermissions: stat(/data/vendor/nvcam/settings/usb@video0.isp) call failed
LoadOverridesFile: looking for override file [/opt/nvidia/nvcam/settings/usb@video0.isp] 7/16
CheckOverridesPermissions: stat(/opt/nvidia/nvcam/settings/usb@video0.isp) call failed
LoadOverridesFile: looking for override file [/var/nvidia/nvcam/settings/usb@video0.isp] 8/16
CheckOverridesPermissions: stat(/var/nvidia/nvcam/settings/usb@video0.isp) call failed
---- imager: No override file found. ----
NvPclCreateDriver: Found NvPcl Driver Hal dev_name match (v4l2_sensor_usb)
NvPclCreateDriver: Found a Driver name match (v4l2_sensor_usb)
NvPclConnectDrivers: hImager was NULL, creating new imager
NvPclInitializeDrivers: v4l2_sensor_usb ++++++++++++++++++
initializeDevNode: Failed to open dev node '/dev/camera/video0'; No such file or directory, trying alternate default location
initializeDevNode: Module usb@video0 : /dev/video0
initialize: Modules is of type USB
Skipped format (buffer type:1, pixel format:YUYV, is depth:0)
Supported format MJPG
Supported resolution 640x480
Supported resolution 176x144
Supported resolution 320x240
Supported resolution 352x288
Supported resolution 800x600
Supported resolution 1280x720
Supported resolution 1280x960
Supported resolution 640x480
Supported resolution 176x144
Supported resolution 320x240
Supported resolution 352x288
Supported resolution 800x600
Supported resolution 1280x720
Supported resolution 1280x960
(NvCamV4l2) Error BadParameter: Control 10094858 not found (in /dvs/git/dirty/git-master_linux/camera/utils/nvcamv4l2/v4l2_device.cpp, function findControlById(), line 1874)
(NvCamV4l2) Error BadParameter:  (propagating from /dvs/git/dirty/git-master_linux/camera/utils/nvcamv4l2/v4l2_device.cpp, function getControlRange(), line 331)
initialize: focus query failed
initialize: Loaded Driver: 14 Modes Available--------------
NvPclInitializeDrivers: v4l2_sensor_usb ------------------
NvPclOpen: ----------------------
=== aethersprite[8331]: CameraProvider initialized (0x7f9492de30)=== aethersprite[8331]: Connection closed (7F9BC4D1D0)=== aethersprite[8331]: WARNING: CameraProvider was not destroyed before client connection terminated.=== aethersprite[8331]:          The client may have abnormally terminated. Destroying CameraProvider...=== aethersprite[8331]: CameraProvider destroyed (0x7f9492de30)NvPclClose: ++++++++++++++++++++++
NvPclCloseModuleDrivers: deallocate/free overrides pathname @ 0x7f9492dda0
NvPclCloseModuleDrivers: deallocate/free overrides pathname @ 0x7f9492dcf0
NvPclCloseModuleDrivers: deallocate/free overrides pathname @ 0x7f94966370
NvPclCloseModuleDrivers: deallocate/free overrides pathname @ 0x7f9480b300
NvPclCloseModuleDrivers: deallocate/free overrides pathname @ 0x7f94844cc0
NvPclCloseModuleDrivers: deallocate/free overrides pathname @ 0x7f94517bd0
NvPclStateControllerClose: Module usb@video0 closed
NvPclClose: ----------------------
NvPclShutdown: ++++++++++++++++++++++
NvPclModuleListShutdown: Client still conntected, skipping shutdown
NvPclShutdown: ----------------------
NvPclRemoveHotplugCallback: ++++++++++++++++++++++
getHotplugMonitor: Getting hotplug monitor instance
 shutdownHotplug: Requesting thread exit
 hotPlugfunc: Read 16 bytes from inotify FD
 hotPlugfunc: A File was Modified 00008000 NAME :  CREATE : 00000100, DELETE : 00000200 IGNORED : 00008000 CLOSE_WRITE : 00000008
 hotPlugfunc: Exit thread
 hotPlugfunc: close failure error: 'Bad file descriptor' (9)
 hotPlugfunc -- 
 shutdownHotplug -- : shutdown of hotplug is complete 
Removed callback client
NvPclRemoveHotplugCallback: ----------------------
=== aethersprite[8331]: Connection cleaned up (7F9BC4D1D0)

I’ve really plugged in a Logitech C270 . what does it look like in the logs ?

Must some process are using the nvarguscamerasrc otherwise won’t create connection with nvargus-daemon.

i’m giving up. i’m 100% sure i instantiate the first and second time exactly the same (it is the same code) yet the second time it uses nvarguscamerasrc…