Tx2 Auto start script fail issue

Hello All,

I’m developing custom sensor driver on tx2.
I want to make gstreamer script autorun on power boot.

i added system service in /lib/systemd/system/

i found that autorun script is running before sensor driver initialize in dmesg log.

[    2.047689] systemd[1]: File /lib/systemd/system/systemd-journald.service:36 configures an IP firewall (IPAddressDeny=any), but the local system does not support BPF/cgroup based firewalling.
[    2.047696] systemd[1]: Proceeding WITHOUT firewalling in effect! (This warning is only shown for the first loaded unit using IP firewalling.)
[    2.064319] tegra_cec 3960000.tegra_cec: physical address: 10:00.
[    2.104499] systemd[1]: Configuration file /lib/systemd/system/start_test.service is marked executable. Please remove executable permission bits. Proceeding anyway.
[    2.128838] tegra_cec 3960000.tegra_cec: Sent <Text View On> res: -113.
[    2.128842] tegra_cec 3960000.tegra_cec: tegra_cec_init Done.
[    2.157673] random: systemd: uninitialized urandom read (16 bytes read)
[    2.157701] systemd[1]: Reached target Swap.
[    2.157887] random: systemd: uninitialized urandom read (16 bytes read)
[    2.159088] systemd[1]: Created slice User and Session Slice.
[    2.159225] random: systemd: uninitialized urandom read (16 bytes read)
[    2.160585] systemd[1]: Set up automount Arbitrary Executable File Formats File System Automount Point.
[    2.160743] systemd[1]: Started Forward Password Requests to Wall Directory Watch.
[    2.189975] EXT4-fs (mmcblk0p1): re-mounted. Opts: (null)
[    2.194696] gpio tegra-gpio-aon wake30 for gpio=60(FF:4)
[    2.248318] tegra-pcie 10003000.pcie-controller: link 0 down, retrying
[    2.250364] tegra-pcie 10003000.pcie-controller: link 0 down, ignoring
[    2.295915] bcpu-throttle-alert cooling device registered.
[    2.296085] mcpu-throttle-alert cooling device registered.
[    2.296354] gpu-throttle-alert cooling device registered.
[    2.302156] random: crng init done
[    2.302161] random: 7 urandom warning(s) missed due to ratelimiting
[    2.561140] systemd-journald[2303]: Received request to flush runtime journal from PID 1
[    2.672264] tegra-pcie 10003000.pcie-controller: link 2 down, retrying
[    3.082520] tegra-pcie 10003000.pcie-controller: link 2 down, retrying
[    3.168099] using random self ethernet address
[    3.172643] using random host ethernet address
[    3.501129] imx686 2-0010: [IMX686]: probing v4l2 sensor at addr 0x10.
[    3.510427] tegra-pcie 10003000.pcie-controller: link 2 down, retrying
[    3.512327] tegra-pcie 10003000.pcie-controller: link 2 down, ignoring
[    3.531804] imx686 2-0010: tegracam sensor driver:imx686_v2.0.6
[    3.617405] imx686 2-0010: imx686_set_exposure_ex: val: 0 [us], coarse_time: 0 [lines]
[    3.676643] imx686 2-0010: imx686_set_frame_rate_ex: val: 0e-6 [fps], frame_length: 0 [lines/frame] 900000000 [pix_clk_val] 1000000 [frm_factor] 13856 [line_length]
[    3.705435] imx686 2-0010: imx686_set_exposure_ex: val: 34 [us], coarse_time: 2 [lines]
[    3.714821] tegra-pcie 10003000.pcie-controller: PCIE: no end points detected
[    3.715096] tegra-pcie 10003000.pcie-controller: PCIE: Disable power rails
[    3.734265] imx686 2-0010: imx686_set_frame_rate_ex: val: 4000000e-6 [fps], frame_length: 16238 [lines/frame] 900000000 [pix_clk_val] 1000000 [frm_factor] 13856 [line_length]

how to adjust start to autorun script after sensor driver initialize?

hello jpchae,

please refer to /etc/systemd/system/ for those system init services.
it’s nvargus-daemon.service to enable Argus daemon for the camera functionality, please add your script file after that.
thanks

Hello JerryChang,

Thank you for your help.
I solved the problem by adding “nvargus-daemon.service” to the script.

I have some question.

What do I need to add to the script to automatically run NVIDIA Jetson_multimedia_api in text mode(without x11 window)?

/usr/src/jetson_multimedia_api/argus/build/apps/camera/ui/camera/argus_camera

thanks

hello jpchae,

try to enable $ xinit & and export DISPLAY=:0 for preview rendering.

hello JerryChang

As your recommend, i try to added commands as shown below.
but it’s not working.

#!/bin/bash

xinit &
export DISPLAY=:0

./usr/src/jetson_multimedia_api/argus/build/apps/camera/ui/camera/argus_camera

exit 0

thanks

hello jpchae,

I haven’t try argus_camera without x11 window for a while,
could you please try export the display to other sources, may also I know what’s the failures,
thanks

nvoverlaysink does not use x, it just writes to the display.

nveglglessink will display in the x subsystem

I think this is what you are asking.

ubuntu 18.04 allows autologin for a user. You can then set a startup script to run when it comes up.

Once you get it to work, reboot and the video will be on the display, the boot does take a while…

Terry

thanks terrysu50z’s comments, argus_camera sample app is using EGL to render the preview frames.

Hello JerryChang ,

I’ve only partially solved the problem.
I modified the script to make it run.
However, a white box is displayed on the screen as shown below.

I have some question.

How do i remove the white box?
How can I make the argus window fill the monitor screen?

#!/bin/bash

export DISPLAY=:0
xinit &

cd /usr/src/jetson_multimedia_api/argus/build/apps/camera/ui/camera/
./argus_camera

exit 0

thanks,

Hi,

That window looks like created by xinit. Instead of xinit, can you try with startx?

Hello WayneWWW ,

As your recomend, i was modified script from “xinit &” to “startx”
but argus_camera doesn’t appear in monitor.

what am i missing ?

Is X running after you run startx?

Do you see some result from xrandr?

Is X running after you run startx?
→ when it comes reboot , X is not running.

Do you see some result from xrandr?
→ xrandr runs come out “Can’t open display”.

Why did you reboot the device??? Nobody is asking you to reboot the device…

You should just run startx, export DISPLAY parameters and tell me if xrandr can give your result…

i attached capture image of xrandr run in


terminal.

ok then now you have X to run argus camera.

As your recommend, argus_camera run well.

I have some question.

  1. why does not run “startx” in autostart shell script ?

  2. If I want to automatically enlarge the argus_camera window to full screen and run it,
    is there any other way other than adjusting it with the mouse or clicking the top of the window and selecting maximzie?

I am not sure what kind of answer you want me to say here.

We already enabled some X server for you, that is the ubuntu desktop. Then you disabled it.

@JerryChang , can you help with the screen size of argus camera?

I want to display like embedded device.
I want to make the operating system such as Ubuntu or Windows not visible, but only the camera image and control menu as a standalone device.

so, what i want to make as shown below.

  1. When booting, the program is automatically executed.
  2. Only the corresponding application screen is displayed on the monitor screen.
  3. Make the operating system invisible.

please refer to below two code snippets.
for example,
argus/public/samples/utils/gtk/Window.cpp

namespace ArgusSamples
{

static const uint32_t DEFAULT_LEFT = 0;
static const uint32_t DEFAULT_TOP = 0;
static const uint32_t DEFAULT_WIDTH = 1024;
static const uint32_t DEFAULT_HEIGHT = 768;

and

bool Window::setWindowRect(uint32_t x, uint32_t y, uint32_t w, uint32_t h)
{
    assert(m_private);

    if (m_private->m_window)
    {
        gtk_window_move(m_private->m_window, y, y);
        gtk_window_resize(m_private->m_window, w, h);
    }

    m_private->m_left = x;
    m_private->m_top = y;
    m_private->m_width = w;
    m_private->m_height = h;

it’s by default configure the argus_camera as 1024x768 to render camera preview frames.
you should recompile the application to adapt the settings if you ensure the display monitor resolution,
thanks