linux-bluetooth.vger.kernel.org archive mirror
 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: [PATCH 3/4] btio: Add option for SCO socket mode
Date: Wed, 30 Jan 2013 18:03:03 +0100	[thread overview]
Message-ID: <1359565384-4656-4-git-send-email-frederic.dalleau@linux.intel.com> (raw)
In-Reply-To: <1359565384-4656-1-git-send-email-frederic.dalleau@linux.intel.com>

---
 btio/btio.c |   11 ++++++++---
 btio/btio.h |    1 +
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/btio/btio.c b/btio/btio.c
index bbf1208..f9afc36 100644
--- a/btio/btio.c
+++ b/btio/btio.c
@@ -77,6 +77,7 @@ struct set_opts {
 	uint8_t mode;
 	int flushable;
 	uint32_t priority;
+	uint8_t sco_mode;
 };
 
 struct connect {
@@ -720,7 +721,7 @@ static int sco_connect(int sock, const bdaddr_t *dst)
 	return 0;
 }
 
-static gboolean sco_set(int sock, uint16_t mtu, GError **err)
+static gboolean sco_set(int sock, uint16_t mtu, uint8_t mode, GError **err)
 {
 	struct sco_options sco_opt;
 	socklen_t len;
@@ -736,6 +737,7 @@ static gboolean sco_set(int sock, uint16_t mtu, GError **err)
 	}
 
 	sco_opt.mtu = mtu;
+	sco_opt.mode = mode;
 	if (setsockopt(sock, SOL_SCO, SCO_OPTIONS, &sco_opt,
 						sizeof(sco_opt)) < 0) {
 		ERROR_FAILED(err, "setsockopt(SCO_OPTIONS)", errno);
@@ -825,6 +827,9 @@ static gboolean parse_set_opts(struct set_opts *opts, GError **err,
 		case BT_IO_OPT_PRIORITY:
 			opts->priority = va_arg(args, int);
 			break;
+		case BT_IO_OPT_SCO_MODE:
+			opts->sco_mode = va_arg(args, int);
+			break;
 		default:
 			g_set_error(err, BT_IO_ERROR, EINVAL,
 					"Unknown option %d", opt);
@@ -1303,7 +1308,7 @@ gboolean bt_io_set(GIOChannel *io, GError **err, BtIOOption opt1, ...)
 	case BT_IO_RFCOMM:
 		return rfcomm_set(sock, opts.sec_level, opts.master, err);
 	case BT_IO_SCO:
-		return sco_set(sock, opts.mtu, err);
+		return sco_set(sock, opts.mtu, opts.sco_mode, err);
 	default:
 		g_set_error(err, BT_IO_ERROR, EINVAL,
 				"Unknown BtIO type %d", type);
@@ -1370,7 +1375,7 @@ static GIOChannel *create_io(gboolean server, struct set_opts *opts,
 		}
 		if (sco_bind(sock, &opts->src, err) < 0)
 			goto failed;
-		if (!sco_set(sock, opts->mtu, err))
+		if (!sco_set(sock, opts->mtu, opts->sco_mode, err))
 			goto failed;
 		break;
 	default:
diff --git a/btio/btio.h b/btio/btio.h
index a6ff5a2..e6ef990 100644
--- a/btio/btio.h
+++ b/btio/btio.h
@@ -54,6 +54,7 @@ typedef enum {
 	BT_IO_OPT_MODE,
 	BT_IO_OPT_FLUSHABLE,
 	BT_IO_OPT_PRIORITY,
+	BT_IO_OPT_SCO_MODE,
 } BtIOOption;
 
 typedef enum {
-- 
1.7.9.5


  parent reply	other threads:[~2013-01-30 17:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-30 17:03 [PATCH 0/4] sco: Integrate SCO socket option in user space Frédéric Dalleau
2013-01-30 17:03 ` [PATCH 1/4] lib: Declare mode field in sco_options Frédéric Dalleau
2013-01-30 17:03 ` [PATCH 2/4] scotest: Add option for SCO socket mode Frédéric Dalleau
2013-01-30 17:03 ` Frédéric Dalleau [this message]
2013-01-30 17:03 ` [PATCH 4/4] btiotest: " 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=1359565384-4656-4-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;
as well as URLs for NNTP newsgroup(s).