Linux bluetooth development
 help / color / mirror / Atom feed
From: "Frédéric Dalleau" <frederic.dalleau@linux.intel.com>
To: linux-bluetooth@vger.kernel.org
Cc: "Frédéric Dalleau" <frederic.dalleau@linux.intel.com>
Subject: [RFC v2 1/5] Bluetooth: Add option for SCO socket mode
Date: Tue, 11 Dec 2012 17:53:48 +0100	[thread overview]
Message-ID: <1355244832-2729-2-git-send-email-frederic.dalleau@linux.intel.com> (raw)
In-Reply-To: <1355244832-2729-1-git-send-email-frederic.dalleau@linux.intel.com>

This patch extends the current SCO socket option to add a 'mode' field. This
field is intended to choose data type at runtime. Current modes are CVSD and
transparent SCO, but adding new modes could allow support for CSA2 and fine
tuning a sco connection, for example latency, bandwith, voice setting. Incoming
connections will be setup during defered setup. Outgoing connections have to
be setup before connect(). The selected type is stored in the sco socket info.
This patch declares needed members and implements getsockopt().
---
 include/net/bluetooth/sco.h |   19 +++++++++++++++++++
 net/bluetooth/sco.c         |    3 +++
 2 files changed, 22 insertions(+)

diff --git a/include/net/bluetooth/sco.h b/include/net/bluetooth/sco.h
index 1e35c43..1798fd3 100644
--- a/include/net/bluetooth/sco.h
+++ b/include/net/bluetooth/sco.h
@@ -41,8 +41,26 @@ struct sockaddr_sco {
 
 /* SCO socket options */
 #define SCO_OPTIONS	0x01
+
+#define SCO_MODE_CVSD		0x00
+#define SCO_MODE_TRANSPARENT	0x01
+#define SCO_MODE_ENHANCED	0x02
 struct sco_options {
 	__u16 mtu;
+	__u8 mode;
+};
+
+struct sco_coding {
+	__u8 format;
+	__u16 vid;
+	__u16 cid;
+};
+
+struct sco_options_enhanced {
+	__u16 mtu;
+	__u8 mode;
+	struct sco_coding host;
+	struct sco_coding air;
 };
 
 #define SCO_CONNINFO	0x02
@@ -73,6 +91,7 @@ struct sco_conn {
 struct sco_pinfo {
 	struct bt_sock	bt;
 	__u32		flags;
+	__u8		mode;
 	struct sco_conn	*conn;
 };
 
diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c
index 531a93d..bdb21b2 100644
--- a/net/bluetooth/sco.c
+++ b/net/bluetooth/sco.c
@@ -418,6 +418,8 @@ static struct sock *sco_sock_alloc(struct net *net, struct socket *sock, int pro
 	sk->sk_protocol = proto;
 	sk->sk_state    = BT_OPEN;
 
+	sco_pi(sk)->mode = SCO_MODE_CVSD;
+
 	setup_timer(&sk->sk_timer, sco_sock_timeout, (unsigned long)sk);
 
 	bt_sock_link(&sco_sk_list, sk);
@@ -736,6 +738,7 @@ static int sco_sock_getsockopt_old(struct socket *sock, int optname, char __user
 		}
 
 		opts.mtu = sco_pi(sk)->conn->mtu;
+		opts.mode = sco_pi(sk)->mode;
 
 		BT_DBG("mtu %d", opts.mtu);
 
-- 
1.7.9.5


  reply	other threads:[~2012-12-11 16:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-11 16:53 [RFC v2 0/5] sco: SCO socket option for mode Frédéric Dalleau
2012-12-11 16:53 ` Frédéric Dalleau [this message]
2012-12-11 16:53 ` [RFC v2 2/5] Bluetooth: Add setsockopt for SCO socket mode Frédéric Dalleau
2012-12-11 16:53 ` [RFC v2 3/5] Bluetooth: Use codec to create SCO connection Frédéric Dalleau
2012-12-11 16:53 ` [RFC v2 4/5] Bluetooth: Set parameters for outgoing connections Frédéric Dalleau
2012-12-11 16:53 ` [RFC v2 5/5] Bluetooth: Fallback transparent SCO from T2 to T1 Frédéric Dalleau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1355244832-2729-2-git-send-email-frederic.dalleau@linux.intel.com \
    --to=frederic.dalleau@linux.intel.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox