How to turn off CSI camera?

I didn’t feel like waiting till next week.
The exact camera I have is this one
https://www.amazon.com/gp/product/B07VDHWB2X/ it comes with free expert support. Yeah!
Manufacturer page is here https://www.waveshare.com/wiki/IMX219-160IR_Camera

This transcript sums it up nicely. How do I close the waveshare camera after it is launched?
Ctrl-W did not work, and this is not windows.

Initial Question: Camera is connected to Jetson Nano and displays picture with command from waveshare support page, but fills screen and cannot be closed or minimized. Unable to view any other open windows. Must restart computer in order to remove camera image from screen. Ctrl C does nothing.

04:33 AM PDT Aldwin(Amazon): ​Hello, this is Aldwin from Amazon Product Support Experts. I’m here to help you today.
… pleasantries removed
04:34 AM PDT Aldwin: I just want to confirm, are you pertaining to this item? ​​Camera Support NVIDIA Jetson Nano Developer Kit.
04:34 AM PDT Dustin: yes
04:35 AM PDT Aldwin: Thanks for confirming. Please allow me to check this one, just give me a minute or 2.
… edit for char limit
04:37 AM PDT Dustin: I followed instructions at this page [link removed]
04:37 AM PDT Aldwin: Got it.
04:37 AM PDT Dustin: tried Ctrl-C, esc, alt-F4
04:38 AM PDT Dustin: once the camera is launched, it wont close
04:39 AM PDT Aldwin: I see.
04:40 AM PDT Dustin: I just realised I have a problem. I am typing this on the same computer as the camera. So if I launch camera for testing, I will no longer be able to communicate with you.
04:41 AM PDT Aldwin: Got it, do you still want to try the same item to check if the same issue is still happening?
04:42 AM PDT Dustin: I dont think it is defective product becauser it displays video. I think there is missing critiical info from support poage. How am I supposed to close camera window? It does not say. That is the support I need
04:45 AM PDT Aldwin: I see.
04:47 AM PDT Aldwin: And if you want to get an accurate information about that issue, you can contact waveshare on this email - [e-mail address removed].
Because they are the one who designed and engineer the product, and they are more knowled​geable about it.
04:48 AM PDT Aldwin: But if you want to return this item back to us, I can help you with that.
04:49 AM PDT Dustin: but this is the support option that they proivide. waveshare says contact seller for support. the product page said free product support from amazon. that is you. please do not send me in circles. this is a very simple question for an “expert” how do I turn it off?
04:50 AM PDT Aldwin: You already contacted them?
04:50 AM PDT Dustin: from their support page “Contact your seller (fast response and most recommended)”
04:52 AM PDT Aldwin: If you want I can give you the direct link on how to contact the seller of this product.
04:52 AM PDT Dustin: please
… got link
04:57 AM PDT Dustin: ok, I can use that to get a response in maybe 2 days. how is that product support from amazon? Is your job really just to point me somewhere else? This is a real question, Not retorical. I am trying to understand the intended role of Amnazon product support.
04:59 AM PDT Aldwin: I do apologize for this Dustin. But honestly I don’t want to give you a false information about this item because I really want to help you that’s why I give the direct link on how to contact the seller because I know that they can give you the accurate information on how to use that item because they are the one who design and engineer that item and also they are more knowledgeable about it.
05:01 AM PDT Dustin: But, does amazon product support have ANY information about the product? All I am asking is how do I tuirn it off. Is that the sort of question I should expect product support to answer?
05:02 AM PDT Aldwin: If you want to close that item when you’re using a computer you can click ctrl+w.
05:03 AM PDT Dustin: Thank you. That was rthe info I needed. Why was that so hard?
05:04 AM PDT Aldwin: And if you can’t still close that window when you’re using that item, you don’t need to restart the computer. You can just click Alt+ctrl+delete then go application that is running and click End task to close the program

Hello Dustin,

I’m sorry for the problem you have. Yes, if you have any problem with using this product, you can always feel free to contact us, we will always try
to help solve it.

Now as we are in National Holiday, the engineer will back to work on Oct. 8, I will tell them your problem and ask them to help solve. Don’t worry,
we will surely help solve the problem, if we couldn’t, we will resend or refund.

Best regards
Way

As of right now the command on the Waveshare site works. I can close the feed with Ctrl C now.
The launch command is

DISPLAY=:0.0 gst-launch-1.0 nvarguscamerasrc ! 'video/x-raw(memory:NVMM), width=3280, height=2464, format=(string)NV12, framerate=(fraction)20/1' ! nvoverlaysink -e

The command copied from my bash buffer, which generated the problem is this

DISPLAY=:0.0 gst-launch-1.0 nvarguscamerasrc ! 'video/x-raw(memory:NVMM), width=3280, height=2464, format=(string)NV12, framerate=(fraction)20/1' ! nvoverlaysink -e

They look exactly the same to me, but this continues to launch a feed which will not close. I’m stumped.

FYI, the launch command from GitHub - JetsonHacksNano/CSI-Camera: Simple example of using a CSI-Camera (like the Raspberry Pi Version 2 camera) with the NVIDIA Jetson Developer Kit

gst-launch-1.0 nvarguscamerasrc ! 'video/x-raw(memory:NVMM),width=3820, height=2464, framerate=21/1, format=NV12' ! nvvidconv flip-method=0 ! 'video/x-raw,width=960, height=616' ! nvvidconv ! nvegltransform ! nveglglessink -e

when used with this waveshare camera puts the feed in a window and does allow it to be minimized, but does not allow it to be closed. Clicking X in corner of window and Ctrl C have no effect.

So, the situation is better, but the core question remains. If a stream is launched such that Ctrl C does not send EOS, how do we shut it down without rebooting the machine?

The answer is NOT top and kill PID of gst-launch+. That causes “System problems detected” dialog.

Now I’m even more stumped. Almost everything that didn’t work before now works, but I didn’t change anything.

slo@sloNano:~$ DISPLAY=:0.0 gst-launch-1.0 nvarguscamerasrc ! 'video/x-raw(memory:NVMM), width=3280, height=2464, format=(string)NV12, framerate=(fraction)20/1' ! nvoverlaysink -e
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
GST_ARGUS: Creating output stream
CONSUMER: Waiting until producer is connected...
GST_ARGUS: Available Sensor modes :
GST_ARGUS: 3264 x 2464 FR = 21.000000 fps Duration = 47619048 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;

GST_ARGUS: 3264 x 1848 FR = 28.000001 fps Duration = 35714284 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;

GST_ARGUS: 1920 x 1080 FR = 29.999999 fps Duration = 33333334 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;

GST_ARGUS: 1280 x 720 FR = 59.999999 fps Duration = 16666667 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;

GST_ARGUS: 1280 x 720 FR = 120.000005 fps Duration = 8333333 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;

GST_ARGUS: Running with following settings:
   Camera index = 0 
   Camera mode  = 0 
   Output Stream W = 3264 H = 2464 
   seconds to Run    = 0 
   Frame Rate = 21.000000 
GST_ARGUS: PowerService: requested_clock_Hz=35358400
GST_ARGUS: Setup Complete, Starting captures for 0 seconds
GST_ARGUS: Starting repeat capture requests.
CONSUMER: Producer has connected; continuing.
^Chandling interrupt.
Interrupt: Stopping pipeline ...
EOS on shutdown enabled -- Forcing EOS on the pipeline
Waiting for EOS...
Got EOS from element "pipeline0".
EOS received - stopping pipeline...
Execution ended after 0:00:10.962431641
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
GST_ARGUS: Cleaning up
CONSUMER: Done Success
GST_ARGUS: Done Success
Setting pipeline to NULL ...
Freeing pipeline ...
GST_ARGUS: 
PowerServiceHwVic::cleanupResources
slo@sloNano:~$

This also wouldn’t close with Ctrl C before but it will now.

slo@sloNano:~$ gst-launch-1.0 videotestsrc ! videoconvert ! autovideosink
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
^Chandling interrupt.
Interrupt: Stopping pipeline ...
Execution ended after 0:00:05.139894647
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...
slo@sloNano:~$

Everything works now except for the the JetsonHacks line, which still fails to close.

slo@sloNano:~$ gst-launch-1.0 nvarguscamerasrc ! 'video/x-raw(memory:NVMM),width=3820, height=2464, framerate=21/1, format=NV12' ! nvvidconv flip-method=0 ! 'video/x-raw,width=960, height=616' ! nvvidconv ! nvegltransform ! nveglglessink -e
Setting pipeline to PAUSED ...

Using winsys: x11 
Pipeline is live and does not need PREROLL ...
Got context from element 'eglglessink0': gst.egl.EGLDisplay=context, display=(GstEGLDisplay)NULL;
Setting pipeline to PLAYING ...
New clock: GstSystemClock
GST_ARGUS: Creating output stream
CONSUMER: Waiting until producer is connected...
GST_ARGUS: Available Sensor modes :
GST_ARGUS: 3264 x 2464 FR = 21.000000 fps Duration = 47619048 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;

GST_ARGUS: 3264 x 1848 FR = 28.000001 fps Duration = 35714284 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;

GST_ARGUS: 1920 x 1080 FR = 29.999999 fps Duration = 33333334 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;

GST_ARGUS: 1280 x 720 FR = 59.999999 fps Duration = 16666667 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;

GST_ARGUS: 1280 x 720 FR = 120.000005 fps Duration = 8333333 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;

GST_ARGUS: Running with following settings:
   Camera index = 0 
   Camera mode  = 0 
   Output Stream W = 3264 H = 2464 
   seconds to Run    = 0 
   Frame Rate = 21.000000 
GST_ARGUS: PowerService: requested_clock_Hz=43238580
GST_ARGUS: Setup Complete, Starting captures for 0 seconds
GST_ARGUS: Starting repeat capture requests.
CONSUMER: Producer has connected; continuing.
ERROR: from element /GstPipeline:pipeline0/GstEglGlesSink:eglglessink0: Output window was closed
Additional debug info:
/dvs/git/dirty/git-master_linux/3rdparty/gst/gst-nveglglessink/ext/eglgles/gsteglglessink.c(882): gst_eglglessink_event_thread (): /GstPipeline:pipeline0/GstEglGlesSink:eglglessink0
EOS on shutdown enabled -- waiting for EOS after Error
Waiting for EOS...

Not sure if this is related, but this Jetson Nano occasionally flashes small black boxes on the screen. As if it were trying to redraw the screen, but misses an element(black), then redraws again and gets it right. Also, sometimes right click context menus stay black for several seconds before being drawn. Sometimes the highlighted line in the context menu fails to follow the pointer, but when I click, it performs the action under the cursor, not the highlighted command. It doesn’t happen often, but more than once. Being an input problem, I thought perhaps it could also be interfering with key presses or something. It would also sometimes drop the gui, then show something like "Failed to read out thermal zone 6(-5) and shutdown. On reboot, the temps were only about 38degrees. The barrel jack power supply is rated 10Amps.
Any troubleshooting steps I should try to narrow down the cause?

slo@sloNano:~$ tegrastats
RAM 2485/3956MB (lfb 113x4MB) SWAP 0/6074MB (cached 0MB) CPU [13%@921,17%@921,12%@921,13%@921] EMC_FREQ 0% GR3D_FREQ 54% PLL@45.5C CPU@50.5C iwlwifi@43C PMIC@100C GPU@46.5C AO@56C thermal@48.5C POM_5V_IN 3370/3370 POM_5V_GPU 160/160 POM_5V_CPU 441/441

Ok, this is embarrassing. I think the problem is a broken space bar. It seems to get stuck down randomly, but will sometimes pop back up. The steady stream of repeating spaces was inhibiting the Ctrl C from being received. It just happened at really unfortunate times.

Also note that the Ctrl-C has to be caught by the terminal where you’ve launched gst-launch for stopping it. A common cause is clicking with mouse and having your terminal loosing focus, so your Ctrl-C would be sent to another window (hopefully) ignoring it.
When using nvoverlaysink with GUI, I always maximize the terminal before and avoid using mouse as long as it’s running.