Resubmission of Fixes in rfcomm tty
Subsystems (2)
PATCH 1/1 Resubmission of Fixes in rfcomm tty
Marcel,
Previous patch broken up into two:
rfcomm-tty-keep-socket-data:
If the TTY socket receives data before TTY is created, or the TTY is not opened (e.g. on devfs) then the data is discarded. This makes it impossible to support some protocols which send data right away, e.g. DUN and HFP
This one should be applied first.
rfcomm-tty-echo-overflow:
The serial core sends us lots of 1 byte requests when dealing with canonical ttys (e.g. ones that echo). This attempts to fix this issue by tweaking how the wfree is handled and also tries to be intelligent in the handling these 1 byte requests by appending them to the pending packet if there is room.
-Denis
net/bluetooth/rfcomm/core.c +5 -1
@@ -457,11 +457,10 @@BT_DBG ("dlc %p mtu %d len %d" , d, d->mtu, len);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))rfcomm_schedule (RFCOMM_SCHED_TX );return len;
@@ -1021,10 +1020,11 @@put_unaligned (htobs (__len16 (len)), (__le16 *) &hdr->len); }else { hdr = (void *)skb_push (skb,3 ); hdr->len =__len8 (len); } + hdr->addr = addr; hdr->ctrl =__ctrl (RFCOMM_UIH ,0 ); crc =skb_put (skb,1 ); *crc =__fcs ((void *) hdr);
@@ -1673,19 +1673,23 @@ }if (test_bit (RFCOMM_TX_THROTTLED , &d->flags))return skb_queue_len (&d->tx_queue); +/* Need to lock this in case the tty driver might be messing with the tx queue */ +rfcomm_dlc_lock (d);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);break ; }kfree_skb (skb); d->tx_credits--; } +rfcomm_dlc_unlock (d);if (d->cfc && !d->tx_credits) {/* We're out of TX credits. * Set TX_THROTTLED flag to avoid unnesary wakeups by dlc_send. */ set_bit (RFCOMM_TX_THROTTLED , &d->flags);
net/bluetooth/rfcomm/tty.c +57 -1
144 lines not on this page · raw message
net/bluetooth/rfcomm/tty.c +19 -6
@@ -292,18 +311,17 @@ }/* ---- Send buffer ---- */ static inline unsigned int rfcomm_room (struct rfcomm_dlc *dlc) { -/* We can't let it be zero, because we don't get a callback -when tx_credits becomes nonzero, hence we'd never wake up */ -return dlc->mtu * (dlc->tx_credits?:1 ); +return RFCOMM_MAX_CREDITS *RFCOMM_DEFAULT_MTU *10 ; }static void rfcomm_wfree (struct sk_buff *skb) {struct rfcomm_dev *dev = (void *) skb->sk; +atomic_sub (skb->truesize, &dev->wmem_alloc);if (test_bit (RFCOMM_TTY_ATTACHED , &dev->flags))tasklet_schedule (&dev->wakeup_task);rfcomm_dev_put (dev); }
@@ -690,14 +745,30 @@struct sk_buff *skb;int err =0 , sent =0 , size;BT_DBG ("tty %p count %d" , tty, count); +/* We get lots of 1 byte requests in canonical mode */ +/* So we just put them on the tail of our tx queue */ +/* if possible */ + +rfcomm_dlc_lock (dlc); + skb =skb_peek_tail (&dlc->tx_queue); +if (skb) { + size =min_t (uint, count, dlc->mtu - skb->len); +memcpy (skb_put (skb, size), buf + sent, size); + + sent += size; + count -= size; + } +rfcomm_dlc_unlock (dlc); + skb =0 ; +while (count) { size =min_t (uint, count, dlc->mtu); - skb =rfcomm_wmalloc (dev, size +RFCOMM_SKB_RESERVE ,GFP_ATOMIC ); + skb =rfcomm_wmalloc (dev, dlc->mtu +RFCOMM_SKB_RESERVE ,GFP_ATOMIC );if (!skb)break ;skb_reserve (skb,RFCOMM_SKB_HEAD_RESERVE );
@@ -964,12 +1035,10 @@BT_DBG ("tty %p dev %p" , tty, dev);if (!dev || !dev->dlc)return ; -skb_queue_purge (&dev->dlc->tx_queue); -if (test_bit (TTY_DO_WRITE_WAKEUP , &tty->flags) && tty->ldisc.write_wakeup) tty->ldisc.write_wakeup (tty); }static void rfcomm_tty_send_xchar (struct tty_struct *tty,char ch)
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel
PATCH 1/1 HFP options in audio.conf
Hi Johan/Fredric,
Attaching a patch for HFP AG feature options in audio.conf and the other changes we discussed on #bluez yesterday.
Let me know if something needs to be changed.
-Alok.
Index: audio/audio.conf
===================================================================
RCS file: /cvsroot/bluez/utils/audio/audio.conf,v
retrieving revision 1.3
audio.conf +12 -0
@@ -18,8 +18,20 @@ # Set to true to only support HSP # Defaults to false DisableHFP=true +# HFP Gateway features +# Defaults to false +3WayCalling=false +EchoCancelNoiseCancel=false +VoiceRecognition=false +InBandRingtone=false +VoiceTags=false +RejectingCalls=false +EnhancedCallStatus=false +EnhancedCallControl=false +ExtendedErrorResultCodes=false + # Just an example of potential config options for the other interfaces #[A2DP] #SourceCount=2
Index: audio/manager.h
===================================================================
RCS file: /cvsroot/bluez/utils/audio/manager.h,v
retrieving revision 1.31
manager.h +3 -3
@@ -24,10 +24,12 @@#define MAX_PATH_LENGTH 64/* D-Bus path */ #define AUDIO_MANAGER_PATH "/org/bluez/audio"#define AUDIO_MANAGER_INTERFACE "org.bluez.audio.Manager" +#define configfile CONFIGDIR"/audio.conf" +struct enabled_interfaces {gboolean headset;gboolean gateway;gboolean sink;gboolean source;
@@ -35,13 +37,11 @@ struct enabled_interfaces {gboolean target; };typedef void (*create_dev_cb_t ) (struct device *dev,void *user_data); -int audio_init (DBusConnection *conn,struct enabled_interfaces *enabled, -gboolean no_hfp,gboolean sco_hci,int source_count); - +int audio_init (DBusConnection *conn,GKeyFile *config);void audio_exit (void );uint32_t add_service_record (DBusConnection *conn,sdp_buf_t *buf);int remove_service_record (DBusConnection *conn,uint32_t rec_id);gboolean server_is_enabled (uint16_t svc);
Index: audio/manager.c
===================================================================
RCS file: /cvsroot/bluez/utils/audio/manager.c,v
retrieving revision 1.85
manager.c +92 -19
200 lines not on this page · raw message
Index: audio/headset.h
===================================================================
RCS file: /cvsroot/bluez/utils/audio/headset.h,v
retrieving revision 1.34
headset.h +2 -0
@@ -45,10 +45,12 @@ typedef void (*headset_stream_cb_t) (strstruct headset *headset_init (struct device *dev,sdp_record_t *record,uint16_t svc);void headset_free (struct device *dev); +int headset_config_init (GKeyFile *config); +void headset_update (struct device *dev,sdp_record_t *record,uint16_t svc);unsigned int headset_request_stream (struct device *dev,headset_stream_cb_t cb,void *user_data);gboolean headset_cancel_stream (struct device *dev,unsigned int id);
Index: audio/headset.c
===================================================================
RCS file: /cvsroot/bluez/utils/audio/headset.c,v
retrieving revision 1.157
headset.c +131 -1
153 lines not on this page · raw message
Index: audio/main.c
===================================================================
RCS file: /cvsroot/bluez/utils/audio/main.c,v
retrieving revision 1.29
main.c +9 -103
171 lines not on this page · raw message
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel