On Thu, Jun 07, 2007 at 03:21:14PM -0700, Youngwhan Song wrote:
> Hi all,
> 
> I am using Keyspan USB Serial Device. I found the below fact recently,
> and want to get verification from you if this behavior is right or to
> be updated.
> 
> I found that
> 
>    1. When the Keyspan USB device is plugged out, the application does
> not handle file descriptor correctly.

What application are you talking about?

>    2. It checks the connectivity of USB device using open(), but
> "OPEN" method does not tell actual connectivity. In real, when it is
> not connected to anything, it returns file descriptor as -1. However,
> once it is connected and opened, and when the device is disconnected,
> the opened file descriptor does not to be gone automatically in kernel
> side unless it calls close().

Yes, this is true.

> In this case, since the previous file descriptor is still in kernel
> side, the device driver returns another file descriptor when it tries
> to open() to check the connectivity even though actual device is not
> connected.

Ok, but calling open is not the way to check if the device is really
there.

>    3. So, when it is disconnected and connected again, then the device
> is recognized as ttyUSB1 (or another number different with previous
> one) not ttyUSB0 because the previous file descriptor has not been
> gone.

Yes.

> More simple question is How application knows whether Keyspan USB
> Serial Device is connected or not. Is there any nice way to detect the
> connectivity of the USB device?

Look in sysfs, or use HAL to get a list of all present usb to serial
devices.  That's the best way.

thanks,

greg k-h

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to