- Silicon Labs Community
- Welcome and Announcements
- Silicon Labs Knowledge Base
- 8-bit MCU
- 32-bit MCU
- Bluetooth / Wi-Fi
- Other Products Category
- Optical/RH/Temp Sensor
- Other Products
- Hardware and Software Tools
- Simplicity Studio and Software
- General Discussions and Suggestions
- Chinese Forum
- Software Libraries
- Development Kits
- Reference Designs
- Third Party Tools
- White Papers
- Official Blog of Silicon Labs
- Chinese Blog
04-05-2017 05:01 AM
I have been running SL Ember Zigbee stack for a number of years now using ncp/ezsp configration, on EFM32GG and EM357 (running on Keil RTX). However now I am porting the host application to run on Linux.
The question: Can the host application, (which was generated using S.L AppBuilder - part of Studio) run as a background Linux process? (making it to be a daemon - and starting it from /etc/init.d/XXX).
I can run my host application (which is a Coordinator) and runs perfectly fine. However, putting it to the background, as a process, is a problem.
Looking at file app/util/serial/linux-serial.c, in some comments, tells me that that the program can be run as a background. I can see the creation of pipes and creation of child thread etc. but I can't see anything which handles input from STDIN.
If I start the application from /etc/init.d then the readline function (which reads from STDIN) is getting an EOF character. I am pretty sure that application should not be reading from STDIN directly like this and should channel the STDIN to one of the pipes instead.
Can anyone here confirms with me that it does or doesn't or it is suppose to be OK to run as a background process?
Thank you very much,
Host application created using AppBuilder - running as Coordinator using 5.7.0 GA build 411.
Cross compile using:
Linux abc 3.14.28-tm1 #1 SMP PREEMPT Thu Sep 15 08:43:31 BST 2016 armv7l GNU/Linux
04-05-2017 09:35 PM
It is supposed to be OK to run Host application as a background process.
04-10-2017 08:06 AM
Hi @YK thank you very much for the answer.
I was hoping that you would elaborate your answer a bit.
Would you mind telling me what OS that you were running on, and the method you used to start the application/process?
Also how did you handle the stdin and stderr messages which the application was giving out?
Thank you again.
05-10-2017 03:41 AM
I also have this problem.
My ezsp stack runs from PHP script with this command:
exec('bash -c "exec nohup setsid /root/ezsp -p /dev/ttyAPP0 -b 57600 > /dev/null &"');
And the stack does not start.
exec('bash -c "exec nohup setsid /root/dummy | /root/ezsp -p /dev/ttyAPP0 -b 57600 > /dev/null &"');
where dummy - program which makes putchar (" "); infinitely.
In this case the stack starts.
I know that is terrible method, but I cant find the better decision.