2005-04-20 11:22:40

by Timo Teräs

[permalink] [raw]
Subject: [Bluez-devel] [PATCH] RFCOMM does not call tty_hangup() when DCD is de-asserted

===== net/bluetooth/rfcomm/tty.c 1.36 vs edited =====
--- 1.36/net/bluetooth/rfcomm/tty.c 2005-04-13 15:55:20 +03:00
+++ edited/net/bluetooth/rfcomm/tty.c 2005-04-20 14:13:45 +03:00
@@ -531,6 +531,12 @@ static void rfcomm_dev_modem_status(stru

BT_DBG("dlc %p dev %p v24_sig 0x%02x", dlc, dev, v24_sig);

+ if ((dev->modem_status & TIOCM_CD) &&
+ !(v24_sig & RFCOMM_V24_DV)) {
+ if (dev->tty)
+ tty_hangup(dev->tty);
+ }
+
dev->modem_status =
((v24_sig & RFCOMM_V24_RTC) ? (TIOCM_DSR | TIOCM_DTR) : 0) |
((v24_sig & RFCOMM_V24_RTR) ? (TIOCM_RTS | TIOCM_CTS) : 0) |


Attachments:
bluez-dcd-fix.diff (586.00 B)

2005-04-20 13:26:21

by Timo Teräs

[permalink] [raw]
Subject: Re: [Bluez-devel] [PATCH] RFCOMM does not call tty_hangup() when DCD is de-asserted

Hi Marcel,

ext Marcel Holtmann wrote:
> from my part this patch looks fine, but I don't like the modem emulatio=
n
> part of RFCOMM in general. For me it is only a stream. Nothing less and
> nothing more. So if this patch is useful I am going to apply it.

PPP relies on this behaviour to detect when remote side has hang up the
call. So PPP will be broken without this patch.

>>+ if ((dev->modem_status & TIOCM_CD) &&
>>+ !(v24_sig & RFCOMM_V24_DV)) {
>=20
> You must comply with the coding style here. So change it into
>=20
> if ((dev->modem_status & TIOCM_CD) && !(v24_sig & RFCOMM_V24_DV)) {

Fixed. I also added check for CLOCAL being unset. If it is set modem cont=
rol
lines should be ignored (also the uart code check for this).

Cheers,
Timo

Signed-off-by: Timo Ter=E4s <[email protected]>

=3D=3D=3D=3D=3D net/bluetooth/rfcomm/tty.c 1.36 vs edited =3D=3D=3D=3D=3D
--- 1.36/net/bluetooth/rfcomm/tty.c 2005-04-13 15:55:20 +03:00
+++ edited/net/bluetooth/rfcomm/tty.c 2005-04-20 15:56:31 +03:00
@@ -531,6 +531,11 @@ static void rfcomm_dev_modem_status(stru

BT_DBG("dlc %p dev %p v24_sig 0x%02x", dlc, dev, v24_sig);

+ if ((dev->modem_status & TIOCM_CD) && !(v24_sig & RFCOMM_V24_DV))=
{
+ if (dev->tty && !C_CLOCAL(dev->tty))
+ tty_hangup(dev->tty);
+ }
+
dev->modem_status =3D
((v24_sig & RFCOMM_V24_RTC) ? (TIOCM_DSR | TIOCM_DTR) : =
0) |
((v24_sig & RFCOMM_V24_RTR) ? (TIOCM_RTS | TIOCM_CTS) : =
0) |


-------------------------------------------------------
This SF.Net email is sponsored by: New Crystal Reports XI.
Version 11 adds new functionality designed to reduce time involved in
creating, integrating, and deploying reporting solutions. Free runtime info,
new features, or free trial, at: http://www.businessobjects.com/devxi/728
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2005-04-20 12:39:32

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-devel] [PATCH] RFCOMM does not call tty_hangup() when DCD is de-asserted

Hi Timo,

> It seems that RFCOMM does not handle properly the de-assertation of CD
> signal. It should call tty_hangup() to work properly.
>
> One side effect is that data calls that are hanged up from remote side
> are not detected as being hanged up.
>
> I've made a very quick patch for this. In my case this patch enabled the
> detection carried detect signal de-assertation. But since I'm not an
> expert on RFCOMM stuff there might be some cases where tty_hangup()
> should not be called. In serial side the DCD change is handled by
> uart_handle_dcd_change() defined in include/linux/serial_core.h and it
> has some extra checks there as well.
>
> So could some one wiser there check what actually has to be done for the
> hangup mechanism to work properly. Or if my patch looks good enough feel
> free to commit it.

from my part this patch looks fine, but I don't like the modem emulation
part of RFCOMM in general. For me it is only a stream. Nothing less and
nothing more. So if this patch is useful I am going to apply it.

> + if ((dev->modem_status & TIOCM_CD) &&
> + !(v24_sig & RFCOMM_V24_DV)) {

You must comply with the coding style here. So change it into

if ((dev->modem_status & TIOCM_CD) && !(v24_sig & RFCOMM_V24_DV)) {

And don't forget to add a Signed-off-by: line when you resend it.

Regards

Marcel




-------------------------------------------------------
This SF.Net email is sponsored by: New Crystal Reports XI.
Version 11 adds new functionality designed to reduce time involved in
creating, integrating, and deploying reporting solutions. Free runtime info,
new features, or free trial, at: http://www.businessobjects.com/devxi/728
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel