LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
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


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

Rep: Reputation: 0
Close or reset a serial port


Hello,

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, 09:58 PM   #2
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
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.
 
  


Reply



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 01:19 PM
telnet to reset modem > can't close CQ1ST Linux - Newbie 2 01-01-2010 07:32 PM
how to close port 1050 please help how to close it. mr norm Linux - General 1 09-12-2008 07:57 AM
Real-time close loop control needs serial port communication areftaidi Linux - Software 6 01-25-2006 06:30 PM
close(fd) of serial port without modem never returns tlaresearch Programming 0 04-08-2004 08:49 AM

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

All times are GMT -5. The time now is 10:40 PM.

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
Open Source Consulting | Domain Registration