My app need spiService to function. However, when the target complete the boot up, the spiService is not running by default. If I type ‘$app status’ from ssh usb, it shows spiService stopped. I have to manually activate it by typing ‘$app start spiService’.
Is there anyway to configure it to automatically activate it from my app configuration?
jyijyi
February 10, 2022, 1:29am
2
you need to set “start” option in .adef:
Is the changes made in my app .adef or in platform spiService app .adef?
jyijyi
February 10, 2022, 1:34am
4
why don’t you write a unsanboxed application to just call
system(“app start spiService”);
That seems to be the easiest for you.
Or you can call a script inside the application:
I don’t see problem on WP76 FW R13.
You can use my hello6.tar.gz.
hello6.tar.gz (314.7 KB)
root@swi-mdm9x28-wp:~# chmod 777 /tmp/test.sh
root@swi-mdm9x28-wp:~# /tmp/test.sh
root@swi-mdm9x28-wp:~# ls /tmp/123.txt
/tmp/123.txt
root@swi-mdm9x28-wp:~# cat /tmp/123.txt
123
root@swi-mdm9x28-wp:~# rm /tmp/123.txt
root@swi-mdm9x28-wp:~# ls /tmp/
hello6.wp76xx.update legato test.sh
hosts pkgdwl thermal_engi_ipc
ld.so.cache psm_socket …
Thanks @jyijyi , the first approach seems more attractive to me, but could you please elaborate?
So I need to make my changes in my .adef? What is the syntax to do:
system(“app start spiService”). A snippet of .adef will be great.
Sorry I am newbie in legato framework
jyijyi
February 10, 2022, 1:54am
6
you can see the unsandboxed app here:
I don’t see problem on WP76 FW R13.
You can use my hello6.tar.gz.
hello6.tar.gz (314.7 KB)
root@swi-mdm9x28-wp:~# chmod 777 /tmp/test.sh
root@swi-mdm9x28-wp:~# /tmp/test.sh
root@swi-mdm9x28-wp:~# ls /tmp/123.txt
/tmp/123.txt
root@swi-mdm9x28-wp:~# cat /tmp/123.txt
123
root@swi-mdm9x28-wp:~# rm /tmp/123.txt
root@swi-mdm9x28-wp:~# ls /tmp/
hello6.wp76xx.update legato test.sh
hosts pkgdwl thermal_engi_ipc
ld.so.cache psm_socket …
Hmm isn’t this the second approach (calling script)? I was interested first approach, where changes is made in my app definition (that is what I understand from you).
jyijyi
February 10, 2022, 2:01am
8
you can change the code inside the system call!!!
hmm ok never mind, thanks for your help anyway.
Pankaj
February 14, 2022, 8:16am
10
@babang.parhusip
you can change it in spiService.adef
Thanks @Pankaj , for it take effect, should I rebuild the platform code or the application code?
jyijyi
February 14, 2022, 9:10am
12
yes, you need to rebuild the legato.cwe
Ok, rebuilding platform code just to auto activate this spiService is visible but I find it overkill.
I tried alternative by issuing system call in component init like this:
COMPONENT_INIT
{
system(“app start spiService”);
…
}
but it does not resolve the issue, as the code has no chance to execute. I have to manually type command ‘$app start spiService’ which trigger my app (i.e. COMPONENT_INIT). So where we should put this command?
jyijyi
February 16, 2022, 3:28am
14
do you mean it iis not starting the spiService app by system(“app start spiService”)?
How about adding a delay before the system call like sleep(15)?
Adding sleep(15) does not help either.
jyijyi
February 16, 2022, 3:53am
16
did you set it to unsandboxed application in adef?
how about system(“echo 123 > /tmp/123.txt”); ???
Can it create the file in /tmp?
in .adef
{
sandboxed:false
}
And the following does not create file
“how about system(“echo 123 > /tmp/123.txt”); ???
Can it create the file in /tmp?”
jyijyi
February 16, 2022, 5:13am
18
how about this application?
I don’t see problem on WP76 FW R13.
You can use my hello6.tar.gz.
hello6.tar.gz (314.7 KB)
root@swi-mdm9x28-wp:~# chmod 777 /tmp/test.sh
root@swi-mdm9x28-wp:~# /tmp/test.sh
root@swi-mdm9x28-wp:~# ls /tmp/123.txt
/tmp/123.txt
root@swi-mdm9x28-wp:~# cat /tmp/123.txt
123
root@swi-mdm9x28-wp:~# rm /tmp/123.txt
root@swi-mdm9x28-wp:~# ls /tmp/
hello6.wp76xx.update legato test.sh
hosts pkgdwl thermal_engi_ipc
ld.so.cache psm_socket …
Can it create the /tmp/123.txt?
BTW, “sandboxed: false” should not be inside { } ?
Can it create the /tmp/123.txt? → No
BTW, “sandboxed: false” should not be inside { } ? → you are right, it was typo. This is right one
jyijyi
February 16, 2022, 5:34am
20
it is calling system(“/tmp/test.sh”);
Did you place the test.sh in /tmp where this script will create /tmp/123.txt?