wc168
Posts: 4
Joined: Sat Aug 06, 2022 12:25 am

Is it possible to disable info text output on screen?

Sat Aug 06, 2022 12:43 am

I try to use libcamera-app in my own app. Could I disable the following text printed on the screen?
(I don't have much experience to handle libcamera code.)

[1:03:13.479258786] [1223] INFO Camera camera_manager.cpp:293 libcamera v0.0.0+3804-961a6cf7
[1:03:13.530999234] [1224] WARN V4L2 v4l2_pixelformat.cpp:301 Unsupported V4L2 pixel format BSTA
[1:03:13.531104760] [1224] WARN Formats formats.cpp:838 Unsupported pixel format 0x00000000
[1:03:13.531463892] [1224] INFO RPI raspberrypi.cpp:1374 Registered camera /base/soc/i2c0mux/i2c@1/ov5647@36 to Unicam device /dev/media3 and ISP device /dev/media0
Last edited by wc168 on Sat Aug 06, 2022 3:37 pm, edited 1 time in total.

User avatar
jahboater
Posts: 8216
Joined: Wed Feb 04, 2015 6:38 pm
Location: Wonderful West Dorset

Re: Is it possible to disable info text output on screen?

Sat Aug 06, 2022 3:41 am

You may discard the out from a command with:

command &>/dev/null

which will throw away both normal text and error messages.

Without the &, only normal text will be thrown away.

wc168
Posts: 4
Joined: Sat Aug 06, 2022 12:25 am

Re: Is it possible to disable info text output on screen?

Sat Aug 06, 2022 3:35 pm

I try both &>/dev/null or >/dev/null, it is not effective to stop libcamera-hello to print information to the screen.


wc@pi:~/libcamera-apps/apps/build $ &>/dev/null
wc@pi:~/libcamera-apps/apps/build $ libcamera-hello
Made DRM preview window
[1:16:44.464529619] [3321] INFO Camera camera_manager.cpp:293 libcamera v0.0.0+3804-961a6cf7
[1:16:44.506474912] [3322] WARN V4L2 v4l2_pixelformat.cpp:301 Unsupported V4L2 pixel format BSTA
[1:16:44.506619027] [3322] WARN Formats formats.cpp:838 Unsupported pixel format 0x00000000
[1:16:44.507040174] [3322] INFO RPI raspberrypi.cpp:1374 Registered camera /base/soc/i2c0mux/i2c@1/ov5647@36 to Unicam device /dev/media3 and ISP device /dev/media0
[1:16:44.509230963] [3321] INFO Camera camera.cpp:1029 configuring streams: (0) 1296x972-YUV420
[1:16:44.510229091] [3322] INFO RPI raspberrypi.cpp:761 Sensor: /base/soc/i2c0mux/i2c@1/ov5647@36 - Selected sensor format: 1296x972-SGBRG10_1X10 - Selected unicam format: 1296x972-pGAA
[1:16:44.511607324] [3322] WARN V4L2 v4l2_pixelformat.cpp:301 Unsupported V4L2 pixel format BSTA
[1:16:44.511688210] [3322] WARN Formats formats.cpp:838 Unsupported pixel format 0x00000000

User avatar
rpdom
Posts: 20380
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Is it possible to disable info text output on screen?

Sat Aug 06, 2022 3:49 pm

Did you try

Code: Select all

libcamera-hello &> /dev/null
?
Unreadable squiggle

wc168
Posts: 4
Joined: Sat Aug 06, 2022 12:25 am

Re: Is it possible to disable info text output on screen?

Sat Aug 06, 2022 4:13 pm

I just try libcamera-hello &> /dev/null. it works indeed! Thank you very much!

I am following "Understanding and Writing your own Apps" in "https://www.raspberrypi.com/documentati ... amera-apps" to modify libcamera-jpg.cpp to combine with my code, and use CMAKE to build. Do you have alternative way to disable the txt output feature inside the code?

User avatar
jahboater
Posts: 8216
Joined: Wed Feb 04, 2015 6:38 pm
Location: Wonderful West Dorset

Re: Is it possible to disable info text output on screen?

Sat Aug 06, 2022 6:39 pm

wc168 wrote:
Sat Aug 06, 2022 4:13 pm
Do you have alternative way to disable the txt output feature inside the code?
I would close file descriptors 1 and 2 at the start of main().
Then immediately re-open them for "/dev/null".
Check the new file descriptors are still 1 and 2 (they should be) and after that any output to stdout or stderr should be discarded.

This would fail of course if the user had redirected the standard fd's to something other than /dev/null or /dev/tty

cleverca22
Posts: 6317
Joined: Sat Aug 18, 2012 2:33 pm

Re: Is it possible to disable info text output on screen?

Sat Aug 06, 2022 6:51 pm

jahboater wrote:
Sat Aug 06, 2022 6:39 pm
I would close file descriptors 1 and 2 at the start of main().
Then immediately re-open them for "/dev/null".
Check the new file descriptors are still 1 and 2 (they should be) and after that any output to stdout or stderr should be discarded.
this is what the dup2() function is for

it lets you copy any open file descriptor to a specified number, so you can overwrite 1/2 rather then praying open() uses 1/2 next

Return to “Camera board”