From: Peter Hurley <peter@hurleysoftware.com>
To: Shreyas Bethur <shreyas.bethur@ni.com>
Cc: gregkh@linuxfoundation.org, jslaby@suse.cz, linux-serial@vger.kernel.org
Subject: Re: [PATCH 1/1] tty: Do not set modem lines when reopening ports
Date: Wed, 05 Nov 2014 18:39:56 -0500 [thread overview]
Message-ID: <545AB54C.1000305@hurleysoftware.com> (raw)
In-Reply-To: <OFC3DBEDDF.98889C80-ON86257D87.006F9538-86257D87.0078F95B@ni.com>
On 11/05/2014 05:01 PM, Shreyas Bethur wrote:
>> From: Peter Hurley <peter@hurleysoftware.com>
>> On 10/31/2014 04:33 PM, Shreyas Bethur wrote:
>>> When tty port is opened, we will raise the DTR and RTS lines. But for
>>> second and subsequent opens, we should not modify these lines because the
>>> first session might be actively using these lines. We don't want a second
>>> open to interfere with the first session.
>>>
>>> Signed-off-by: Shreyas Bethur <shreyas.bethur@ni.com>
>>> ---
>>> To give some background for this patch, we have a product that uses the
>>> DTR line on the serial port for synchronization with other devices. While
>>> the synchronization application is using the DTR line, if another process
>>> opens the same port, then DTR line is raised, and thus interferes with the
>>> synchronization application. So, if a port is open, subsequent opens
>>> should not modify any modem lines.
>>
>> Would you please expand on your use-case?
>
> We have many devices in a real-time test & measurement system, and the
> clocks on all these devices needs to be synchronized for our applications.
> So we connect all the devices to a central hub via serial ports. We open
> a tty session (in exclusive mode and non-admin user) and toggle the DTR
> lines from all the devices, every time cycle. The hub measures the time
> difference between these signals and correct the clock on the devices.
> We also have a service that the user can use to enumerate all the serial
> ports and check whether they are in use. When this service opens the port
> that is used for synchronization, it gets EBUSY error, which is good; But
> the tty driver raises the DTR line before returning EBUSY.
>
> I would expect that if a tty session is opened in exclusive mode, any
> subsequent opens to not change anything on the port including DTR and RTS
> lines. Please let me know if I'm missing something or if my understanding
> is incorrect.
Your understanding is exactly right, and I think your application's use and
expectation of TTY_EXCLUSIVE is correct as well.
But I think the appropriate fix for this is elsewhere; I need to do some
testing but I think I can get you a test patch in the next couple of days.
What kernel version are you using to test (so I can make sure the test patch
applies)?
Regards,
Peter Hurley
next prev parent reply other threads:[~2014-11-05 23:40 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-31 20:33 [PATCH 1/1] tty: Do not set modem lines when reopening ports Shreyas Bethur
2014-11-03 23:13 ` Peter Hurley
2014-11-05 22:01 ` Shreyas Bethur
2014-11-05 23:39 ` Peter Hurley [this message]
2014-11-05 23:56 ` Shreyas Bethur
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=545AB54C.1000305@hurleysoftware.com \
--to=peter@hurleysoftware.com \
--cc=gregkh@linuxfoundation.org \
--cc=jslaby@suse.cz \
--cc=linux-serial@vger.kernel.org \
--cc=shreyas.bethur@ni.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox