LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Closed Thread
  Search this Thread
Old 03-23-2009, 02:08 AM   #1
gauravparihar
LQ Newbie
 
Registered: May 2008
Location: India
Distribution: redhat,kubuntu
Posts: 14

Rep: Reputation: 0
Unhappy Resetting a serial port in Linux?


Hi all,

Scenario:
I communication with different subsystems using serial port. In some subsystems after running for a while, I start getting invalid data inspite of system sending correct data. For dealing with this situation I used to
reset serial ports by closing and reopening serial port, it was doing the
trick but somehow when I have implemented this in my new application, this
also doesn't work. I am struck.
void CPort::ResetPort()
{
tcflush(Fd, TCIFLUSH);//flush all data received but not read
ClosePort();//close port
OpenPort(mStrPortNo);//open the port specified by port number and in read mode
qDebug("\n Reset Subsystem =%s,Port number =%s,Fd=%d ",qPrintable(msSubsystemName),mStrPortNo,Fd);
//code for setting port setting of serial port for individual sub systems
}

The ClosePort function invokes close system call.

Can anybody suggest me some other way to reset serial port in Linux.
I am using RHEL 4, C++ and Qt 4.2.1 for my application development. Also
I have used multithreading to implement each subsystem in a separate thread. Its strange that if A,B,C are three threads, A & B run fine together but when C is introduced B starts receiving invalid data after
sometime and never recovers even after resetting the port as mentioned above.

Any suggestions???????????????????
 
Old 03-23-2009, 07:41 AM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 16,412

Rep: Reputation: 1936Reputation: 1936Reputation: 1936Reputation: 1936Reputation: 1936Reputation: 1936Reputation: 1936Reputation: 1936Reputation: 1936Reputation: 1936Reputation: 1936
Please post your thread in only one forum. Posting a single thread in the most relevant forum will make it easier for members to help you and will keep the discussion in one place. This thread is being closed because it is a duplicate.
 
  


Closed Thread


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
linux serial port to router console port connection? frankie_fix Linux - General 3 02-26-2007 10:32 PM
ata sort resetting port kaz2100 Linux - Kernel 3 02-17-2007 11:28 AM
Using serial port card(PCMCIA) with IPAQ running Linux, can't find ttyS0 port d2army Linux - Laptop and Netbook 0 11-12-2005 09:07 PM
Resetting USB Port iomari Linux - Hardware 0 01-28-2005 12:31 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:32 AM.

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