[Bluetooth] Store remote modem status for RFCOMM TTY
authorMarcel Holtmann <marcel@holtmann.org>
Mon, 14 Jul 2008 18:13:52 +0000 (20:13 +0200)
committerMarcel Holtmann <marcel@holtmann.org>
Mon, 14 Jul 2008 18:13:52 +0000 (20:13 +0200)
When switching a RFCOMM socket to a TTY, the remote modem status might
be needed later. Currently it is lost since the original configuration
is done via the socket interface. So store the modem status and reply
it when the socket has been converted to a TTY.

Signed-off-by: Denis Kenzior <denis.kenzior@trolltech.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
include/net/bluetooth/rfcomm.h
net/bluetooth/rfcomm/core.c
net/bluetooth/rfcomm/tty.c

index 8c54ff37ad4fb5a50b7c68d5e0817a9de5938317..4dc8d92a4638e993a5c097a484bebf4e3e9fa7ae 100644 (file)
@@ -180,6 +180,7 @@ struct rfcomm_dlc {
        u8            addr;
        u8            priority;
        u8            v24_sig;
+       u8            remote_v24_sig;
        u8            mscex;
        u8            out;
 
index e56bcfc35a49519c1e4e6ab3baaf0945e9c18747..fcd2cafe70c858b9aa29250f7ef405bf58e9e5ac 100644 (file)
@@ -1463,8 +1463,12 @@ static int rfcomm_recv_msc(struct rfcomm_session *s, int cr, struct sk_buff *skb
                        clear_bit(RFCOMM_TX_THROTTLED, &d->flags);
 
                rfcomm_dlc_lock(d);
+
+               d->remote_v24_sig = msc->v24_sig;
+
                if (d->modem_status)
                        d->modem_status(d, msc->v24_sig);
+
                rfcomm_dlc_unlock(d);
 
                rfcomm_send_msc(s, 0, dlci, msc->v24_sig);
index 248802796e1284abab27bfd071fe5d2ab61e67eb..8fcca08cef8e65cdf654bb01add5b7c4b7acf808 100644 (file)
@@ -271,6 +271,9 @@ static int rfcomm_dev_add(struct rfcomm_dev_req *req, struct rfcomm_dlc *dlc)
 
        dlc->owner = dev;
        dev->dlc   = dlc;
+
+       rfcomm_dev_modem_status(dlc, dlc->remote_v24_sig);
+
        rfcomm_dlc_unlock(dlc);
 
        /* It's safe to call __module_get() here because socket already