<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[QSerialPort permissions problem (No. Not the easy problem)]]></title><description><![CDATA[<p dir="auto">Qt 11.2 on CentOS 7.  I'm having a problem with permissions on a set of /dev/ttyUSB? devices while running Qt apps.  They act like a user somehow gets an invisible exclusive ownership of a device which prevents other users from using the device, errno is set to EPERM (operation not permitted).  The devices are all crw-rw-rw-, and all the users are in the dialout group.  This problem persists even after unplugging/plugging the device, reboots, and power cycles.  Non Qt apps like screen have no problems accessing the devices.</p>
<p dir="auto">More information: I wrote a stub class TSerialPort : public QIODevice { } which uses calls ::open() to open the serial device.  This has no problem, so I know that the base functionality of QIODevice isn't the problem.</p>
]]></description><link>https://forum.qt.io/topic/101007/qserialport-permissions-problem-no-not-the-easy-problem</link><generator>RSS for Node</generator><lastBuildDate>Mon, 21 Sep 2026 08:56:59 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/101007.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 22 Mar 2019 17:10:23 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to QSerialPort permissions problem (No. Not the easy problem) on Sat, 23 Mar 2019 09:43:59 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/kent-dorfman">@<bdi>Kent-Dorfman</bdi></a><br />
Out of curiosity, and not wanting to start a flame war, I'm slightly surprised that you ship I/O access out-of-process.  It may well be convenient for debugging/testing, but for production?  Then again I know nothing about hardware, so you may so that serial port top speed is slow it doesn't matter, I don't know....</p>
]]></description><link>https://forum.qt.io/post/519127</link><guid isPermaLink="true">https://forum.qt.io/post/519127</guid><dc:creator><![CDATA[JonB]]></dc:creator><pubDate>Sat, 23 Mar 2019 09:43:59 GMT</pubDate></item><item><title><![CDATA[Reply to QSerialPort permissions problem (No. Not the easy problem) on Sat, 23 Mar 2019 07:29:02 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/dhkaplan">@<bdi>dhkaplan</bdi></a> said in <a href="/post/519086">QSerialPort permissions problem (No. Not the easy problem)</a>:</p>
<blockquote>
<p dir="auto">I'd prefer it if this lock feature were optional.</p>
</blockquote>
<p dir="auto">Lock files it is a common <a href="https://www.tldp.org/HOWTO/Serial-HOWTO-13.html" target="_blank" rel="noopener noreferrer nofollow ugc">practicle</a>. Besides, it gives same behavior on different platforms (as on Windows the serial ports opened only with exclusive access). And I can't imagine at all a situation when needs an access to the same serial port from different processes.</p>
]]></description><link>https://forum.qt.io/post/519117</link><guid isPermaLink="true">https://forum.qt.io/post/519117</guid><dc:creator><![CDATA[kuzulis]]></dc:creator><pubDate>Sat, 23 Mar 2019 07:29:02 GMT</pubDate></item><item><title><![CDATA[Reply to QSerialPort permissions problem (No. Not the easy problem) on Sat, 23 Mar 2019 05:58:57 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/aha_1980">@<bdi>aha_1980</bdi></a> said in <a href="/post/519113">QSerialPort permissions problem (No. Not the easy problem)</a>:</p>
<blockquote>
<p dir="auto">Yeah, but that's not cross-platform ;)</p>
</blockquote>
<p dir="auto">Op said he's working on Linux.  Actually, I usually recommend manager daemons for access to I/O devices and use of IPC to communicate with them.  By abstracting in that way the benefits are: much easier to unit test and validate, and the ability to trivially swap to different IO mechanisms.  If your Serial daemon reships the data as a TCP stream then your clients only need to implement a TCP client handler...and guess what?  Your serial data no longer needs to reside on the local machine.  Then there is GPIO...NEVER give a userland client program direct access to GPIO.  Always run it through a manager so that the client can only fiddle with the channels intended, and in a way that doesn't break things.</p>
<p dir="auto">Anyway, more than enough comment to spawn a suitable flame war, so I digres.</p>
]]></description><link>https://forum.qt.io/post/519114</link><guid isPermaLink="true">https://forum.qt.io/post/519114</guid><dc:creator><![CDATA[Kent-Dorfman]]></dc:creator><pubDate>Sat, 23 Mar 2019 05:58:57 GMT</pubDate></item><item><title><![CDATA[Reply to QSerialPort permissions problem (No. Not the easy problem) on Sat, 23 Mar 2019 05:47:24 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/kent-dorfman">@<bdi>Kent-Dorfman</bdi></a></p>
<blockquote>
<p dir="auto">I usually just do POSIX programming in a separate thread</p>
</blockquote>
<p dir="auto">Yeah, but that's not cross-platform ;)</p>
]]></description><link>https://forum.qt.io/post/519113</link><guid isPermaLink="true">https://forum.qt.io/post/519113</guid><dc:creator><![CDATA[aha_1980]]></dc:creator><pubDate>Sat, 23 Mar 2019 05:47:24 GMT</pubDate></item><item><title><![CDATA[Reply to QSerialPort permissions problem (No. Not the easy problem) on Sat, 23 Mar 2019 04:50:08 GMT]]></title><description><![CDATA[<p dir="auto">Along the lines of serial port control in Linux, nothing says you HAVE to use the Qt classes for serial access.  I usually just do POSIX programming in a separate thread with its own read loop and select() to read data when it's available...because I'm much familiar more with POSIX system programming.  It's then not too hard to make the data available to the GUI thread via an IPC mechanism.</p>
]]></description><link>https://forum.qt.io/post/519112</link><guid isPermaLink="true">https://forum.qt.io/post/519112</guid><dc:creator><![CDATA[Kent-Dorfman]]></dc:creator><pubDate>Sat, 23 Mar 2019 04:50:08 GMT</pubDate></item><item><title><![CDATA[Reply to QSerialPort permissions problem (No. Not the easy problem) on Sat, 23 Mar 2019 04:37:48 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/dhkaplan">@<bdi>dhkaplan</bdi></a></p>
<blockquote>
<p dir="auto">Apparently, the lock file is removed only if the QSeialPort::close() method is called, not if implicitly closed by (proper) program termination.</p>
</blockquote>
<p dir="auto">If that's the case, then it would be a bug. Because the design is as follows:</p>
<p dir="auto">The lock file is removed in <a href="https://code.woboq.org/qt5/qtserialport/src/serialport/qserialport_unix.cpp.html#_ZN18QSerialPortPrivate5closeEv" target="_blank" rel="noopener noreferrer nofollow ugc">QSerialPortPrivate::close()</a>, which is called from <a href="https://code.woboq.org/qt5/qtserialport/src/serialport/qserialport.cpp.html#_ZN11QSerialPort5closeEv" target="_blank" rel="noopener noreferrer nofollow ugc">QSerialPort::close()</a> which is called from the destructor <a href="https://code.woboq.org/qt5/qtserialport/src/serialport/qserialport.cpp.html#_ZN11QSerialPortD1Ev" target="_blank" rel="noopener noreferrer nofollow ugc">~QSerialPort()</a></p>
<p dir="auto">Result: the lock file should be removed when the serial port object is removed.</p>
<p dir="auto">Regards</p>
]]></description><link>https://forum.qt.io/post/519110</link><guid isPermaLink="true">https://forum.qt.io/post/519110</guid><dc:creator><![CDATA[aha_1980]]></dc:creator><pubDate>Sat, 23 Mar 2019 04:37:48 GMT</pubDate></item><item><title><![CDATA[Reply to QSerialPort permissions problem (No. Not the easy problem) on Sat, 23 Mar 2019 00:34:14 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/kent-dorfman">@<bdi>Kent-Dorfman</bdi></a> That's correct. No issues with non-Qt access to the serial ports.</p>
]]></description><link>https://forum.qt.io/post/519103</link><guid isPermaLink="true">https://forum.qt.io/post/519103</guid><dc:creator><![CDATA[dhkaplan]]></dc:creator><pubDate>Sat, 23 Mar 2019 00:34:14 GMT</pubDate></item><item><title><![CDATA[Reply to QSerialPort permissions problem (No. Not the easy problem) on Fri, 22 Mar 2019 23:37:23 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/dhkaplan">@<bdi>dhkaplan</bdi></a> said in <a href="/post/519086">QSerialPort permissions problem (No. Not the easy problem)</a>:</p>
<blockquote>
<p dir="auto">Apparently, the lock file is removed only if the QSeialPort::close() method is called, not if implicitly closed by (proper) program termination.  I'd prefer it if this lock feature were optional.</p>
</blockquote>
<p dir="auto">And keep in mind that lock files implemented by the QSerialPort are specific to Qt, and NOT Linux system level..IOW, they only protect exclusive access in Qt applications.</p>
]]></description><link>https://forum.qt.io/post/519098</link><guid isPermaLink="true">https://forum.qt.io/post/519098</guid><dc:creator><![CDATA[Kent-Dorfman]]></dc:creator><pubDate>Fri, 22 Mar 2019 23:37:23 GMT</pubDate></item><item><title><![CDATA[Reply to QSerialPort permissions problem (No. Not the easy problem) on Fri, 22 Mar 2019 23:09:55 GMT]]></title><description><![CDATA[<p dir="auto">OK I know how to deal with this now.  Thanks for your help.</p>
]]></description><link>https://forum.qt.io/post/519096</link><guid isPermaLink="true">https://forum.qt.io/post/519096</guid><dc:creator><![CDATA[dhkaplan]]></dc:creator><pubDate>Fri, 22 Mar 2019 23:09:55 GMT</pubDate></item><item><title><![CDATA[Reply to QSerialPort permissions problem (No. Not the easy problem) on Fri, 22 Mar 2019 21:50:01 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/christian-ehrlicher">@<bdi>Christian-Ehrlicher</bdi></a> Apparently, the lock file is removed only if the QSeialPort::close() method is called, not if implicitly closed by (proper) program termination.  I'd prefer it if this lock feature were optional.</p>
]]></description><link>https://forum.qt.io/post/519086</link><guid isPermaLink="true">https://forum.qt.io/post/519086</guid><dc:creator><![CDATA[dhkaplan]]></dc:creator><pubDate>Fri, 22 Mar 2019 21:50:01 GMT</pubDate></item><item><title><![CDATA[Reply to QSerialPort permissions problem (No. Not the easy problem) on Fri, 22 Mar 2019 20:24:29 GMT]]></title><description><![CDATA[<p dir="auto">I think they're created as QTemporaryFile so they should only be there when the program crashes - at least I would expect this.</p>
]]></description><link>https://forum.qt.io/post/519067</link><guid isPermaLink="true">https://forum.qt.io/post/519067</guid><dc:creator><![CDATA[Christian Ehrlicher]]></dc:creator><pubDate>Fri, 22 Mar 2019 20:24:29 GMT</pubDate></item><item><title><![CDATA[Reply to QSerialPort permissions problem (No. Not the easy problem) on Fri, 22 Mar 2019 20:23:10 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/christian-ehrlicher">@<bdi>Christian-Ehrlicher</bdi></a> Ah ha!  There they are.  Are they left hanging if the devices are not explicitly closed before the program exits?</p>
]]></description><link>https://forum.qt.io/post/519066</link><guid isPermaLink="true">https://forum.qt.io/post/519066</guid><dc:creator><![CDATA[dhkaplan]]></dc:creator><pubDate>Fri, 22 Mar 2019 20:23:10 GMT</pubDate></item><item><title><![CDATA[Reply to QSerialPort permissions problem (No. Not the easy problem) on Fri, 22 Mar 2019 20:08:15 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/dhkaplan">@<bdi>dhkaplan</bdi></a> said in <a href="/post/519060">QSerialPort permissions problem (No. Not the easy problem)</a>:</p>
<blockquote>
<p dir="auto">Is it possible that a lock is left hanging if the a program exits improperly?</p>
</blockquote>
<p dir="auto">At least on linux yes - see /tmp/lockTTYS0 (or something similar - don't remember exactly the naming of the file but it's obvious when you see it).</p>
]]></description><link>https://forum.qt.io/post/519063</link><guid isPermaLink="true">https://forum.qt.io/post/519063</guid><dc:creator><![CDATA[Christian Ehrlicher]]></dc:creator><pubDate>Fri, 22 Mar 2019 20:08:15 GMT</pubDate></item><item><title><![CDATA[Reply to QSerialPort permissions problem (No. Not the easy problem) on Fri, 22 Mar 2019 20:08:10 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/dhkaplan">@<bdi>dhkaplan</bdi></a></p>
<blockquote>
<p dir="auto">Is it possible that a lock is left hanging if the a program exits improperly?</p>
</blockquote>
<p dir="auto">Could be, QSP uses lock files. Does your app exit improperly?</p>
]]></description><link>https://forum.qt.io/post/519062</link><guid isPermaLink="true">https://forum.qt.io/post/519062</guid><dc:creator><![CDATA[aha_1980]]></dc:creator><pubDate>Fri, 22 Mar 2019 20:08:10 GMT</pubDate></item><item><title><![CDATA[Reply to QSerialPort permissions problem (No. Not the easy problem) on Fri, 22 Mar 2019 20:05:41 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/christian-ehrlicher">@<bdi>Christian-Ehrlicher</bdi></a> This is not an problem with accessing the ports at the same time.  But this brings up a question, how is this exclusivity implemented?  Is it possible that a lock is left hanging if the a program exits improperly?</p>
]]></description><link>https://forum.qt.io/post/519060</link><guid isPermaLink="true">https://forum.qt.io/post/519060</guid><dc:creator><![CDATA[dhkaplan]]></dc:creator><pubDate>Fri, 22 Mar 2019 20:05:41 GMT</pubDate></item><item><title><![CDATA[Reply to QSerialPort permissions problem (No. Not the easy problem) on Fri, 22 Mar 2019 17:43:48 GMT]]></title><description><![CDATA[<p dir="auto">See <a href="https://doc.qt.io/qt-5/qserialport.html#details" target="_blank" rel="noopener noreferrer nofollow ugc">https://doc.qt.io/qt-5/qserialport.html#details</a></p>
<pre><code>Note: The serial port is always opened with exclusive access (that is, no other process or thread can access an already opened serial port).
</code></pre>
]]></description><link>https://forum.qt.io/post/519044</link><guid isPermaLink="true">https://forum.qt.io/post/519044</guid><dc:creator><![CDATA[Christian Ehrlicher]]></dc:creator><pubDate>Fri, 22 Mar 2019 17:43:48 GMT</pubDate></item></channel></rss>