Skip to contentSkip to conversation

Fixes for RFCOMM #2

PATCH New Denis KENZIOR 1 participant 1 message Jun 20, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fixes for RFCOMM #2

rfcomm-keep-tty-data:
    Fix the problem of disappearing packets when the socket is meant to be used as an rfcomm tty server.  The data needs to be queued since packets might arrive after the socket has been connected, but before the tty has been opened

rfcomm-keep-modem-status:
    Keep the modem status around in case the tty really needs it.

include/net/bluetooth/rfcomm.h +1 -0
index 98ec7a3..d74094d 100644
@@ -180,6 +180,7 @@ struct rfcomm_dlc {
 	u8            addr;
 	u8            priority;
 	u8            v24_sig;
+	u8            remote_v24_sig;
 	u8            mscex;
 
 	u32           link_mode;
net/bluetooth/rfcomm/core.c +1 -0
index 0c2c937..2e37bb0 100644
@@ -1459,6 +1459,7 @@ 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);
net/bluetooth/rfcomm/tty.c +4 -0
index 2488027..41041ff 100644
@@ -271,6 +271,9 @@ static int rfcomm_dev_add(struct rfcomm_dev_req *req, struct rfcomm_dlc *dlc)
 
 	dlc->owner = dev;
 	dev->dlc   = dlc;
+
+	/* Update the modem_status, call under lock */
+	rfcomm_dev_modem_status(dlc, dlc->remote_v24_sig);
 	rfcomm_dlc_unlock(dlc);
 
 	/* It's safe to call __module_get() here because socket already
@@ -588,6 +591,7 @@ static void rfcomm_dev_state_change(struct rfcomm_dlc *dlc, int err)
 	}
 }
 
+/* This is called under dlc lock, so we can safely mess with dlc here */
 static void rfcomm_dev_modem_status(struct rfcomm_dlc *dlc, u8 v24_sig)
 {
 	struct rfcomm_dev *dev = dlc->owner;
net/bluetooth/rfcomm/core.c +1 -1
index 2e37bb0..a90fe94 100644
@@ -457,7 +457,6 @@ int rfcomm_dlc_send(struct rfcomm_dlc *d, struct sk_buff *skb)
 	if (len > d->mtu)
 		return -EINVAL;
 
-	rfcomm_make_uih(skb, d->addr);
 	skb_queue_tail(&d->tx_queue, skb);
 
 	if (!test_bit(RFCOMM_TX_THROTTLED, &d->flags))
@@ -1675,6 +1674,7 @@ static inline int rfcomm_process_tx(struct rfcomm_dlc *d)
 		return skb_queue_len(&d->tx_queue);
 
 	while (d->tx_credits && (skb = skb_dequeue(&d->tx_queue))) {
+		rfcomm_make_uih(skb, d->addr);
 		err = rfcomm_send_frame(d->session, skb->data, skb->len);
 		if (err < 0) {
 			skb_queue_head(&d->tx_queue, skb);
net/bluetooth/rfcomm/tty.c +52 -1

101 lines not on this page · raw message

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source.
http://sourceforge.net/services/buy/index.php

_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel