LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Kernel (https://www.linuxquestions.org/questions/linux-kernel-70/)
-   -   serial port device detection (https://www.linuxquestions.org/questions/linux-kernel-70/serial-port-device-detection-921160/)

hareshmv 12-29-2011 11:20 PM

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

Doc CPU 12-30-2011 02:47 AM

Hi there,

Quote:

Originally Posted by hareshmv (Post 4561478)
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

michaelk 12-30-2011 07:41 AM

As stated not really unless your looking for a particular device. There is no serial port communication standard and using hardware control is optional.

hareshmv 12-30-2011 10:53 PM

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

michaelk 12-31-2011 09:42 PM

AFAIK there isn't.


All times are GMT -5. The time now is 02:17 AM.