LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 12-29-2011, 11:20 PM   #1
hareshmv
LQ Newbie
 
Registered: Dec 2011
Posts: 4

Rep: Reputation: Disabled
serial port device detection


hi,

i want know is there any mechanism to detect any serial port device is connected or not. My project is hardware monitoring, so i want it is in C code. Is there any option to add kernel patch for getting serial port information ?

I tried with setserial and ioctl but i didn't get device is connected or not.

Any one know any method pls reply.

Thanks and regards

Haresh
 
Old 12-30-2011, 02:47 AM   #2
Doc CPU
Senior Member
 
Registered: Jun 2011
Location: Stuttgart, Germany
Distribution: Mint, Debian, Gentoo, Win 2k/XP
Posts: 1,099

Rep: Reputation: 344Reputation: 344Reputation: 344Reputation: 344
Hi there,

Quote:
Originally Posted by hareshmv View Post
i want know is there any mechanism to detect any serial port device is connected or not.
that depends on the device. If it repeatedly tries to send some data, it can be identified by that data. But if that device behaves more or less passive, I don't think there's an easy way to detect it. You can, of course, take the initiative and regularly send a particular string, to which the device should respond in a particular way. But that means you have to probe for that certain device yoe expect, which might disturb others.

It's like you want to detect if someone is standing in front of your door: If that person rings the door bell or makes some other loud noise, you can clearly tell there's somebody, maybe even recognize who it is, without opening the door. But if the person is very quiet, you have to open the door again and again and take a look outside, or ask into the darkness outside: "Is anybody there? - Tina, is that you?"

USB, for example, is different because the USB protocol requires that every device newly attached to the bus identifies itself. But the older interfaces don't support that style of hot-plugging - you can connect a device any time, but it's usually not detected automatically.

[X] Doc CPU
 
Old 12-30-2011, 07:41 AM   #3
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,681

Rep: Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894
As stated not really unless your looking for a particular device. There is no serial port communication standard and using hardware control is optional.
 
Old 12-30-2011, 10:53 PM   #4
hareshmv
LQ Newbie
 
Registered: Dec 2011
Posts: 4

Original Poster
Rep: Reputation: Disabled
Re:

hi

Thank you for u r reply

I know there is no standard mechanism. I want at least connected or not, no any further information. I there any option by Interrupt mechanism. I read by ioctl with TIOCMIWAIT, can detect any changes in serial port. Any of u know the code pls reply.

Thanks and regards

Haresh M V
 
Old 12-31-2011, 09:42 PM   #5
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,681

Rep: Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894
AFAIK there isn't.
 
  


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
detection of a device when plugged through USB port chaitalil Linux - Newbie 6 02-12-2013 11:52 AM
Parallel Port & Serial Port device identification helpmeforlinux Linux - Hardware 3 01-02-2007 01:15 AM
Serial Port Detection WrightExposure Fedora 5 12-28-2006 06:04 AM
How can I detect the Serial Port Device ? lovelylinux Linux - Hardware 4 12-06-2006 08:20 PM
serial port detection reallycoolguy Linux - Hardware 0 07-06-2004 10:42 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 07:15 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