Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 12-18-2011, 11:05 PM   #1
LQ Newbie
Registered: Feb 2011
Location: Bangalore, India
Distribution: Fedora
Posts: 16

Rep: Reputation: 0
Close or reset a serial port


Currently I have a code that opens a serial port in linux and sends data on it.
When I execute the code for a second time, It gets stuck because I'm unable to close the port.

Is there any shell script or C program using which I can close serial port? Im using Qt 4.7.4. The close(); command is not doing the job.
Old 12-19-2011, 10:58 PM   #2
LQ 5k Club
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,397
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
So you read a return code from a system call, and it says the port is 'stuck'? To get useful help, you should give clear descriptions of what actually happens, and show the code we are expected to help you with in [CODE][/CODE] tags, please. What does lsof say about the open port? What is the state of the process that had opened the port? Has all of the data to send been flushed? Only the process that had open()ed the port can close() it.
--- rod.


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
Is a USBtty (USB serial port) treated the same as tty (normal serial port) in C? spudgunner Programming 1 11-12-2010 02:19 PM
telnet to reset modem > can't close CQ1ST Linux - Newbie 2 01-01-2010 08:32 PM
how to close port 1050 please help how to close it. mr norm Linux - General 1 09-12-2008 08:57 AM
Real-time close loop control needs serial port communication areftaidi Linux - Software 6 01-25-2006 07:30 PM
close(fd) of serial port without modem never returns tlaresearch Programming 0 04-08-2004 09:49 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:16 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration