QExtSerialPort: How to determine if a serial port is in use by another application?
-
QextSerialPort used POSIX API. But the design of the library is not incorporated this possibility.
For a solution of problem is need to use other library as QtSerialPort.
PS:
And indeed, to be honest it's very slippery POSIX solution, because not all applications adhere to the standards for locking already open serial ports. Therefore, if a some program opens a port, but did not set a "lock" (as TIOEXCL or using the lock file), then you are in any way you not will know that the device is already being used by someone.
-
[quote author="kuzulis" date="1367927829"]
And indeed, to be honest it's very slippery POSIX solution, because not all applications adhere to the standards for locking already open serial ports. Therefore, if a some program opens a port, but did not set a "lock" (as TIOEXCL or using the lock file), then you are in any way you not will know that the device is already being used by someone.
[/quote]That would be OK. I only need a lock for my own application, because the user can start several instances of my application to connect to all attached serial devices. If a port is locked by another instance, then the new instance has to search on the next available port.
Do you know how to set a lock and how to release it? If the application crashes then the lock must also be released. I do not really know much about POSIX standards, lock files and such things.Thanks
-
See e.g. http://linux.die.net/man/3/lockdev
-
Hi,
Please, don't highjack someone's thread with your own question, create a new thread, and for politeness don't use all caps phrase, this won't get you any help.
Additionally, you'll have to give more details about what you wan't to do.
-
-
As I said, please, open a new thread for your problem and provide more details about your problem. I won't answer on this thread about them.
-
[quote author="kuzulis" date="1367939084"]See e.g. http://linux.die.net/man/3/lockdev[/quote]
Many Thanks for this hint!