public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: Marcel Holtmann <marcel@holtmann.org>
To: BlueZ development <bluez-devel@lists.sourceforge.net>
Subject: Re: [Bluez-devel] Possible Race condition in Rfcomm TTY
Date: Wed, 05 Dec 2007 08:28:02 +0100	[thread overview]
Message-ID: <1196839682.12292.159.camel@violet> (raw)
In-Reply-To: <200712051601.03309.denis.kenzior@trolltech.com>

Hi Denis,

> I think there is a race condition in the RFCOMM Socket -> TTY adaptation.  
> Basically whenever a client device connects and starts sending data right 
> away, the serial port will not receive it.
> 
> To see what I mean:
> 
> run 'rfcomm -r listen 0 15' on a server.
> 
> and run a simple test app that sends data right after connecting (one 
> attached).
> 
> Once connection has been established, run 'cat /dev/rfcomm0' 
> 
> Using my Suse 10.2 desktop with kernel 2.6.18.8 and Neo with kernel 2.6.22.5 
> (Nov 26 snapshot), about 95% of the time the initial data sent never shows up 
> on the serial port.  If I reverse the roles, the desktop usually gets the 
> initial chunk of data.  This inconsistency makes it hard to implement 
> something like the DUN or Handsfree services where clients very frequently 
> send data right away.

I am not a big fan of the TTY support at all. It had more problems in
the end than we ever expected. Using the socket directly is always the
better approach.

For Handsfree, I would prefer if the audio service will be extended and
that is what is currently planned. For DUN you can use the serial
service proxy feature. This can directly attach to a physical TTY or to
a Unix socket.

> Looking at the kernel code it seems that the data is copied into the socket 
> buf or into the serial buf from the rfcomm_recv_data.  It also seems that 
> rfcomm_dev_add never copies what is in the socket buffer to what is in the 
> serial buffer.  It would seem that rfomm_dev_add should also copy any pending 
> data from a socket read buffer to the serial port read buffer whenever doing 
> the conversion.  Or is there something else going on here?

No. That is probably it. Feel free to send a patch.

Regards

Marcel



-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

  reply	other threads:[~2007-12-05  7:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-04 23:25 [Bluez-devel] [PATCH] audio - ignore permission denied errors on avctp and avdtp sockets Bastian Blank
2007-12-05  6:01 ` [Bluez-devel] Possible Race condition in Rfcomm TTY Denis KENZIOR
2007-12-05  7:28   ` Marcel Holtmann [this message]
2007-12-05  7:22 ` [Bluez-devel] [PATCH] audio - ignore permission denied errors on avctp and avdtp sockets Marcel Holtmann

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=1196839682.12292.159.camel@violet \
    --to=marcel@holtmann.org \
    --cc=bluez-devel@lists.sourceforge.net \
    /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