From: Gianluca Anzolin <gianluca@sottospazio.it>
To: andrey.vihrov@gmail.com
Cc: peter@hurleysoftware.com, marcel@holtmann.org,
gregkh@linuxfoundation.org, jslaby@suse.cz,
linux-bluetooth@vger.kernel.org
Subject: Re: A problem with "rfcomm bind" and wvdial
Date: Sun, 5 Jan 2014 16:49:42 +0100 [thread overview]
Message-ID: <20140105154942.GA12621@sottospazio.it> (raw)
Hello,
I looked at your problem this afternoon and I think I know what's happening:
wvdial is opening the port with the flag O_NONBLOCK. As expected the rfcomm
code returns immediately instead of waiting for the BT connection to come
up. Then wvdial sends the AT commands and the writes fail.
In the past it worked because the carrier_raised() logic was open coded inside
the rfcomm code: it always waited for a successful or failed connection even
with a non-blocking tty.
But now the code uses the tty_port methods and won't wait for a successful
bluetooth connection on open().
But there is more: when wvdial terminates, it will set the CLOCAL flag for the
tty and this will result in the same behaviour described above, even without
setting the O_NONBLOCK flag. This will affect other users of the tty.
These two cases make clear that the use of carrier_raised() method was not that
fair after all: while that allowed us to remove some code we now have to work
around it to get the previous behaviour.
For example we could mask off the O_NONBLOCK flag before opening the port and
then restore it when the tty_port_open() is completed. We could do something
similar for the CLOCAL flag: always remove it in rfcomm_tty_set_termios().
The alternative is to remove the carrier_raised() method and wait for the BT
connection in rfcomm_dev_activate() like the old code did.
I'm CC-ing some people who know the code better than me to get a suggestion
on how to proceed.
Thank you,
Gianluca
next reply other threads:[~2014-01-05 15:49 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-05 15:49 Gianluca Anzolin [this message]
2014-01-06 11:33 ` A problem with "rfcomm bind" and wvdial Gianluca Anzolin
2014-01-06 16:06 ` Andrey Vihrov
-- strict thread matches above, loose matches on Subject: below --
2014-01-03 18:24 Andrey Vihrov
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=20140105154942.GA12621@sottospazio.it \
--to=gianluca@sottospazio.it \
--cc=andrey.vihrov@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=jslaby@suse.cz \
--cc=linux-bluetooth@vger.kernel.org \
--cc=marcel@holtmann.org \
--cc=peter@hurleysoftware.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