Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer
User Name
Linux - Embedded & Single-board computer This forum is for the discussion of Linux on both embedded devices and single-board computers (such as the Raspberry Pi, BeagleBoard and PandaBoard). Discussions involving Arduino, plug computers and other micro-controller like devices are also welcome.


  Search this Thread
Old 10-03-2014, 05:30 AM   #1
LQ Newbie
Registered: Oct 2014
Posts: 1

Rep: Reputation: Disabled
Shell exit when init complete to allow application to use only serial port

Hi All

I am a linux newbee, but experienced with RTOS. I am developing an embedded control application to operate in a restricted access environment.

I am considering Xenomai running on Debian to provide my real time OS.

The issue I have is that there is only 1 serial connection between the SBC and the host system.

I need to share the serial port between the shell and the application. My initialisation scripts should act as follows:
  1. Run Built in Test (BIT) executable from init script - report output to the serial port as console output.
  2. If BIT passed then start application and close the shell to free the serial port for my application to run it's serial protocol.
  3. If BIT failed remain in the shell so can debug the system.
I understand how to design the init script to perform the BIT logic but my problem is how to exit the shell and free up the serial port for the application.

I have googled around and also started to look at linux serial port multiplexors and redirecting console stdin & stdout -> null but not found the answers yet. I

I would apreciate any advice.

Thanks in advance
Old 10-03-2014, 08:14 AM   #2
Keith Hedger
Senior Member
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Linux From Scratch, Slackware64, Partedmagic
Posts: 3,103

Rep: Reputation: 836Reputation: 836Reputation: 836Reputation: 836Reputation: 836Reputation: 836Reputation: 836
Don't know much about serial ports but for general bash info grab a copy of the advanced bash scripting guide here:

You will have to grab the return code of your test ie:
true;echo $?
false;echo $?
You can replace the current process using the 'exec' function but be aware that antything in the script after the exec command will not get executed.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Serial Port write, wait for transmission complete with the function tcdrain() volbus Programming 13 04-29-2014 03:56 PM
problem in creating serial port application using threads tejendra Programming 3 03-22-2011 07:26 AM
Not getting Shell when booting through serial port b_senthilbe Linux - Hardware 2 02-24-2011 10:57 AM
[SOLVED] Serial port : Read data problem, not reading complete data anujmehta Linux - Networking 5 09-06-2010 07:10 AM
how to transfer and receive file using serial port from my application amit_pansuria Programming 5 06-14-2007 06:27 PM > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer

All times are GMT -5. The time now is 04:48 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration