From: "hyungseoung.yoo" <[email protected]>
Preserve the master role when SCO or eSCO is active
as this improves compatability with lots of
headset and chipset combinations.
This is one of the number of patches from the Android AOSP
common.git tree, which is used on almost all Android devices.
It looks like it would improve support for compatibility with
lot of headset,so I wanted to submit it for review to see
if it should go upstream.
Cc: Marcel Holtmann <[email protected]> (maintainer:BLUETOOTH SUBSYSTEM)
Cc: Gustavo Padovan <[email protected]> (maintainer:BLUETOOTH SUBSYSTEM)
Cc: Johan Hedberg <[email protected]> (maintainer:BLUETOOTH SUBSYSTEM)
Cc: "David S. Miller" <[email protected]> (maintainer:NETWORKING [GENERAL])
Cc: [email protected] (open list:BLUETOOTH SUBSYSTEM)
Cc: [email protected] (open list:NETWORKING [GENERAL])
Cc: [email protected] (open list)
Cc: Android Kernel Team <[email protected]>
Cc: John Stultz <[email protected]>
Signed-off-by: hyungseoung.yoo <[email protected]>
Signed-off-by: Jaikumar Ganesh <[email protected]>
[kiran: Added context to commit message]
Signed-off-by: Kiran Raparthy <[email protected]>
---
net/bluetooth/hci_event.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 15010a2..6f944d5 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -1915,6 +1915,15 @@ unlock:
hci_conn_check_pending(hdev);
}
+static inline bool is_sco_active(struct hci_dev *hdev)
+{
+ if (hci_conn_hash_lookup_state(hdev, SCO_LINK, BT_CONNECTED) ||
+ (hci_conn_hash_lookup_state(hdev, ESCO_LINK,
+ BT_CONNECTED)))
+ return true;
+ return false;
+}
+
static void hci_conn_request_evt(struct hci_dev *hdev, struct sk_buff *skb)
{
struct hci_ev_conn_request *ev = (void *) skb->data;
@@ -1961,7 +1970,8 @@ static void hci_conn_request_evt(struct hci_dev *hdev, struct sk_buff *skb)
bacpy(&cp.bdaddr, &ev->bdaddr);
- if (lmp_rswitch_capable(hdev) && (mask & HCI_LM_MASTER))
+ if (lmp_rswitch_capable(hdev) && ((mask & HCI_LM_MASTER)
+ || is_sco_active(hdev)))
cp.role = 0x00; /* Become master */
else
cp.role = 0x01; /* Remain slave */
--
1.8.2.1
Hello.
On 05/28/2014 09:56 AM, Kiran Kumar Raparthy wrote:
> From: "hyungseoung.yoo" <[email protected]>
> Preserve the master role when SCO or eSCO is active
> as this improves compatability with lots of
Compatibility.
> headset and chipset combinations.
> This is one of the number of patches from the Android AOSP
> common.git tree, which is used on almost all Android devices.
> It looks like it would improve support for compatibility with
> lot of headset,so I wanted to submit it for review to see
> if it should go upstream.
> Cc: Marcel Holtmann <[email protected]> (maintainer:BLUETOOTH SUBSYSTEM)
> Cc: Gustavo Padovan <[email protected]> (maintainer:BLUETOOTH SUBSYSTEM)
> Cc: Johan Hedberg <[email protected]> (maintainer:BLUETOOTH SUBSYSTEM)
> Cc: "David S. Miller" <[email protected]> (maintainer:NETWORKING [GENERAL])
> Cc: [email protected] (open list:BLUETOOTH SUBSYSTEM)
> Cc: [email protected] (open list:NETWORKING [GENERAL])
> Cc: [email protected] (open list)
> Cc: Android Kernel Team <[email protected]>
> Cc: John Stultz <[email protected]>
> Signed-off-by: hyungseoung.yoo <[email protected]>
> Signed-off-by: Jaikumar Ganesh <[email protected]>
> [kiran: Added context to commit message]
> Signed-off-by: Kiran Raparthy <[email protected]>
> ---
> net/bluetooth/hci_event.c | 12 +++++++++++-
> 1 file changed, 11 insertions(+), 1 deletion(-)
> diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
> index 15010a2..6f944d5 100644
> --- a/net/bluetooth/hci_event.c
> +++ b/net/bluetooth/hci_event.c
> @@ -1915,6 +1915,15 @@ unlock:
> hci_conn_check_pending(hdev);
> }
>
> +static inline bool is_sco_active(struct hci_dev *hdev)
> +{
> + if (hci_conn_hash_lookup_state(hdev, SCO_LINK, BT_CONNECTED) ||
> + (hci_conn_hash_lookup_state(hdev, ESCO_LINK,
() around function/macro invocation not needed (if this is a macro,
consider enclosing its definition in parens instead). Also, this line should
start under 'hdev' on the previous one.
> + BT_CONNECTED)))
> + return true;
> + return false;
> +}
> +
> static void hci_conn_request_evt(struct hci_dev *hdev, struct sk_buff *skb)
> {
> struct hci_ev_conn_request *ev = (void *) skb->data;
> @@ -1961,7 +1970,8 @@ static void hci_conn_request_evt(struct hci_dev *hdev, struct sk_buff *skb)
>
> bacpy(&cp.bdaddr, &ev->bdaddr);
>
> - if (lmp_rswitch_capable(hdev) && (mask & HCI_LM_MASTER))
> + if (lmp_rswitch_capable(hdev) && ((mask & HCI_LM_MASTER)
> + || is_sco_active(hdev)))
Don't start the line with ||, leave it on the previous line instead.
WBR, Sergei
Hi,
On Wed, May 28, 2014 at 8:56 AM, Kiran Kumar Raparthy
<[email protected]> wrote:
> From: "hyungseoung.yoo" <[email protected]>
>
> Preserve the master role when SCO or eSCO is active
> as this improves compatability with lots of
> headset and chipset combinations.
>
> This is one of the number of patches from the Android AOSP
> common.git tree, which is used on almost all Android devices.
> It looks like it would improve support for compatibility with
> lot of headset,so I wanted to submit it for review to see
> if it should go upstream.
>
> Cc: Marcel Holtmann <[email protected]> (maintainer:BLUETOOTH SUBSYSTEM)
> Cc: Gustavo Padovan <[email protected]> (maintainer:BLUETOOTH SUBSYSTEM)
> Cc: Johan Hedberg <[email protected]> (maintainer:BLUETOOTH SUBSYSTEM)
> Cc: "David S. Miller" <[email protected]> (maintainer:NETWORKING [GENERAL])
> Cc: [email protected] (open list:BLUETOOTH SUBSYSTEM)
> Cc: [email protected] (open list:NETWORKING [GENERAL])
> Cc: [email protected] (open list)
> Cc: Android Kernel Team <[email protected]>
> Cc: John Stultz <[email protected]>
> Signed-off-by: hyungseoung.yoo <[email protected]>
> Signed-off-by: Jaikumar Ganesh <[email protected]>
> [kiran: Added context to commit message]
> Signed-off-by: Kiran Raparthy <[email protected]>
> ---
> net/bluetooth/hci_event.c | 12 +++++++++++-
> 1 file changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
> index 15010a2..6f944d5 100644
> --- a/net/bluetooth/hci_event.c
> +++ b/net/bluetooth/hci_event.c
> @@ -1915,6 +1915,15 @@ unlock:
> hci_conn_check_pending(hdev);
> }
>
> +static inline bool is_sco_active(struct hci_dev *hdev)
> +{
> + if (hci_conn_hash_lookup_state(hdev, SCO_LINK, BT_CONNECTED) ||
> + (hci_conn_hash_lookup_state(hdev, ESCO_LINK,
> + BT_CONNECTED)))
> + return true;
> + return false;
> +}
> +
> static void hci_conn_request_evt(struct hci_dev *hdev, struct sk_buff *skb)
> {
> struct hci_ev_conn_request *ev = (void *) skb->data;
> @@ -1961,7 +1970,8 @@ static void hci_conn_request_evt(struct hci_dev *hdev, struct sk_buff *skb)
>
> bacpy(&cp.bdaddr, &ev->bdaddr);
>
> - if (lmp_rswitch_capable(hdev) && (mask & HCI_LM_MASTER))
> + if (lmp_rswitch_capable(hdev) && ((mask & HCI_LM_MASTER)
> + || is_sco_active(hdev)))
> cp.role = 0x00; /* Become master */
> else
> cp.role = 0x01; /* Remain slave */
> --
> 1.8.2.1
I guess the real issue is the possibility of creating a scatternet if
you have more than one connection, I will send a patch for scatternet
shortly but that does not guarantee the remote device wont reject it.
--
Luiz Augusto von Dentz