Fixes for RFCOMM
Subsystems (2)
PATCH 1/1 Fixes for RFCOMM
Marcel,
Here's a cleaned up version of the fixes for RFCOMM:
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-tty-no-canonical:
Let the tty driver be non-canonical by default. Fixes some issues with canonical mode not being handled properly in rfcomm_tty_write.
rfcomm-keep-modem-status:
Keep the modem status around in case the tty really needs it.
-Denis
include/net/bluetooth/rfcomm.h +2 -1
@@ -193,7 +193,8 @@ struct rfcomm_dlc {void (*data_ready)(struct rfcomm_dlc *d,struct sk_buff *skb);void (*state_change)(struct rfcomm_dlc *d,int err); -void (*modem_status)(struct rfcomm_dlc *d,u8 v24_sig); +void (*modem_status)(struct rfcomm_dlc *d); +u8 remote_v24_sig; };/* DLC and session flags */
net/bluetooth/rfcomm/core.c +2 -1
@@ -1458,8 +1458,9 @@ static int rfcomm_recv_msc(struct rfcomm_session *s, int cr, struct sk_buff *skbclear_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); + d->modem_status (d);rfcomm_dlc_unlock (d);rfcomm_send_msc (s,0 , dlci, msc->v24_sig);
net/bluetooth/rfcomm/tty.c +8 -2
@@ -87,7 +87,7 @@ static DEFINE_RWLOCK(rfcomm_dev_lock);static void rfcomm_dev_data_ready (struct rfcomm_dlc *dlc,struct sk_buff *skb);static void rfcomm_dev_state_change (struct rfcomm_dlc *dlc,int err); -static void rfcomm_dev_modem_status (struct rfcomm_dlc *dlc,u8 v24_sig); +static void rfcomm_dev_modem_status (struct rfcomm_dlc *dlc);static void rfcomm_tty_wakeup (unsigned long arg);
@@ -292,6 +292,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);rfcomm_dlc_unlock (dlc);/* It's safe to call __module_get() here because socket already
@@ -619,9 +622,12 @@ static void rfcomm_dev_state_change(struct rfcomm_dlc *dlc, int err) } } -static void rfcomm_dev_modem_status (struct rfcomm_dlc *dlc,u8 v24_sig) +/* This is called under dlc lock, so we can safely mess with dlc here */ +static void rfcomm_dev_modem_status (struct rfcomm_dlc *dlc) {struct rfcomm_dev *dev = dlc->owner; +u8 v24_sig = dlc->remote_v24_sig; +if (!dev)return ;
net/bluetooth/rfcomm/core.c +1 -1
@@ -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))
@@ -1674,6 +1673,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 +59 -1
108 lines not on this page · raw message
net/bluetooth/rfcomm/tty.c +1 -0
@@ -1181,6 +1181,7 @@ int rfcomm_init_ttys(void) rfcomm_tty_driver->flags =TTY_DRIVER_REAL_RAW |TTY_DRIVER_DYNAMIC_DEV ; rfcomm_tty_driver->init_termios = tty_std_termios; rfcomm_tty_driver->init_termios.c_cflag =B9600 |CS8 |CREAD |HUPCL |CLOCAL ; + rfcomm_tty_driver->init_termios.c_lflag &= ~ICANON ;tty_set_operations (rfcomm_tty_driver, &rfcomm_ops);if (tty_register_driver (rfcomm_tty_driver)) {
-------------------------------------------------------------------------
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