Linux bluetooth development
 help / color / mirror / Atom feed
* Re: [PATCH v2 1/5] lib: Add flag to force large MTU size used for SDP connection
From: simon @ 2014-01-20 18:28 UTC (permalink / raw)
  To: Szymon Janc; +Cc: linux-bluetooth, Szymon Janc
In-Reply-To: <1390216116-23670-1-git-send-email-szymon.janc@tieto.com>

> From: Szymon Janc <szymon.janc@gmail.com>
>
> This will allow to workaround Dualshock4 not respecting L2CAP MTU
> size while sending SDP response. Use same L2CAP MTU value base on
> RFCOMM.

I can confirm that the V2 series of patches work with my DS4 and crappy
laptop. Still require particular 'connect' sequence...

I note that I do not need the original '[PATCH 3/3] input: Add DualShock 4
detection' patch. I am using just this sequence of 5 patches on top of
5.13.
Simon



^ permalink raw reply

* Re: [PATCH v2 1/5] lib: Add flag to force large MTU size used for SDP connection
From: Szymon Janc @ 2014-01-20 18:48 UTC (permalink / raw)
  To: simon; +Cc: Szymon Janc, linux-bluetooth
In-Reply-To: <cfdf976e52d86b180ee5e750c23fed8f.squirrel@mungewell.org>

Hi Simon,

On Monday 20 January 2014 13:28:57 simon@mungewell.org wrote:
> > From: Szymon Janc <szymon.janc@gmail.com>
> > 
> > This will allow to workaround Dualshock4 not respecting L2CAP MTU
> > size while sending SDP response. Use same L2CAP MTU value base on
> > RFCOMM.
> 
> I can confirm that the V2 series of patches work with my DS4 and crappy
> laptop. Still require particular 'connect' sequence...

Thanks for testing, and yes this sequence is about dedicated vs general 
bonding mentioned in commit message.

> 
> I note that I do not need the original '[PATCH 3/3] input: Add DualShock 4
> detection' patch. I am using just this sequence of 5 patches on top of
> 5.13.

This detection is used only when using SSP controller. And only in case when 
dedicated bonding is used - when DS4 tries to connect immediately after 
pairing is completed, but before bluetoothd was able to retrieve SDP.

-- 
Szymon K. Janc
szymon.janc@gmail.com

^ permalink raw reply

* [PATCH SBC v2 1/2] sbc: Add sbc_init_a2dp
From: Luiz Augusto von Dentz @ 2014-01-20 18:51 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

This adds sbc_init_a2dp that can be used to convert A2DP configuration to
the internal representation since they are not binary compatible.
---
 sbc/sbc.c | 144 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 sbc/sbc.h |   2 +
 2 files changed, 146 insertions(+)

diff --git a/sbc/sbc.c b/sbc/sbc.c
index c589217..9352446 100644
--- a/sbc/sbc.c
+++ b/sbc/sbc.c
@@ -57,6 +57,55 @@
 #define MSBC_SYNCWORD	0xAD
 #define MSBC_BLOCKS	15
 
+#define A2DP_SAMPLING_FREQ_16000		(1 << 3)
+#define A2DP_SAMPLING_FREQ_32000		(1 << 2)
+#define A2DP_SAMPLING_FREQ_44100		(1 << 1)
+#define A2DP_SAMPLING_FREQ_48000		1
+
+#define A2DP_CHANNEL_MODE_MONO			(1 << 3)
+#define A2DP_CHANNEL_MODE_DUAL_CHANNEL		(1 << 2)
+#define A2DP_CHANNEL_MODE_STEREO		(1 << 1)
+#define A2DP_CHANNEL_MODE_JOINT_STEREO		1
+
+#define A2DP_BLOCK_LENGTH_4			(1 << 3)
+#define A2DP_BLOCK_LENGTH_8			(1 << 2)
+#define A2DP_BLOCK_LENGTH_12			(1 << 1)
+#define A2DP_BLOCK_LENGTH_16			1
+
+#define A2DP_SUBBANDS_4				(1 << 1)
+#define A2DP_SUBBANDS_8				1
+
+#define A2DP_ALLOCATION_SNR			(1 << 1)
+#define A2DP_ALLOCATION_LOUDNESS		1
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+
+struct a2dp_sbc {
+	uint8_t channel_mode:4;
+	uint8_t frequency:4;
+	uint8_t allocation_method:2;
+	uint8_t subbands:2;
+	uint8_t block_length:4;
+	uint8_t min_bitpool;
+	uint8_t max_bitpool;
+} __attribute__ ((packed));
+
+#elif __BYTE_ORDER == __BIG_ENDIAN
+
+struct a2dp_sbc {
+	uint8_t frequency:4;
+	uint8_t channel_mode:4;
+	uint8_t block_length:4;
+	uint8_t subbands:2;
+	uint8_t allocation_method:2;
+	uint8_t min_bitpool;
+	uint8_t max_bitpool;
+} __attribute__ ((packed));
+
+#else
+#error "Unknown byte order"
+#endif
+
 /* This structure contains an unpacked SBC frame.
    Yes, there is probably quite some unused space herein */
 struct sbc_frame {
@@ -1046,6 +1095,101 @@ SBC_EXPORT int sbc_init_msbc(sbc_t *sbc, unsigned long flags)
 	return 0;
 }
 
+SBC_EXPORT int sbc_init_a2dp(sbc_t *sbc, unsigned long flags,
+						const void *config, size_t len)
+{
+	const struct a2dp_sbc *a2dp;
+	int err;
+
+	if (len != sizeof(*a2dp))
+		return -EINVAL;
+
+	err = sbc_init(sbc, flags);
+	if (err < 0)
+		return err;
+
+	a2dp = config;
+
+	switch (a2dp->frequency) {
+	case A2DP_SAMPLING_FREQ_16000:
+		sbc->frequency = SBC_FREQ_16000;
+		break;
+	case A2DP_SAMPLING_FREQ_32000:
+		sbc->frequency = SBC_FREQ_32000;
+		break;
+	case A2DP_SAMPLING_FREQ_44100:
+		sbc->frequency = SBC_FREQ_44100;
+		break;
+	case A2DP_SAMPLING_FREQ_48000:
+		sbc->frequency = SBC_FREQ_48000;
+		break;
+	default:
+		goto failed;
+	}
+
+	switch (a2dp->channel_mode) {
+	case A2DP_CHANNEL_MODE_MONO:
+		sbc->mode = SBC_MODE_MONO;
+		break;
+	case A2DP_CHANNEL_MODE_DUAL_CHANNEL:
+		sbc->mode = SBC_MODE_DUAL_CHANNEL;
+		break;
+	case A2DP_CHANNEL_MODE_STEREO:
+		sbc->mode = SBC_MODE_STEREO;
+		break;
+	case A2DP_CHANNEL_MODE_JOINT_STEREO:
+		sbc->mode = SBC_MODE_JOINT_STEREO;
+		break;
+	default:
+		goto failed;
+	}
+
+	switch (a2dp->allocation_method) {
+	case A2DP_ALLOCATION_SNR:
+		sbc->allocation = SBC_AM_SNR;
+		break;
+	case A2DP_ALLOCATION_LOUDNESS:
+		sbc->allocation = SBC_AM_LOUDNESS;
+		break;
+	default:
+		goto failed;
+	}
+
+	switch (a2dp->subbands) {
+	case A2DP_SUBBANDS_4:
+		sbc->subbands = SBC_SB_4;
+		break;
+	case A2DP_SUBBANDS_8:
+		sbc->subbands = SBC_SB_8;
+		break;
+	default:
+		goto failed;
+	}
+
+	switch (a2dp->block_length) {
+	case A2DP_BLOCK_LENGTH_4:
+		sbc->blocks = SBC_BLK_4;
+		break;
+	case A2DP_BLOCK_LENGTH_8:
+		sbc->blocks = SBC_BLK_8;
+		break;
+	case A2DP_BLOCK_LENGTH_12:
+		sbc->blocks = SBC_BLK_12;
+		break;
+	case A2DP_BLOCK_LENGTH_16:
+		sbc->blocks = SBC_BLK_16;
+		break;
+	default:
+		goto failed;
+	}
+
+	return 0;
+
+failed:
+	sbc_finish(sbc);
+	return -EINVAL;
+}
+
 SBC_EXPORT ssize_t sbc_parse(sbc_t *sbc, const void *input, size_t input_len)
 {
 	return sbc_decode(sbc, input, input_len, NULL, 0, NULL);
diff --git a/sbc/sbc.h b/sbc/sbc.h
index 5f8a1fc..5791faa 100644
--- a/sbc/sbc.h
+++ b/sbc/sbc.h
@@ -84,6 +84,8 @@ typedef struct sbc_struct sbc_t;
 int sbc_init(sbc_t *sbc, unsigned long flags);
 int sbc_reinit(sbc_t *sbc, unsigned long flags);
 int sbc_init_msbc(sbc_t *sbc, unsigned long flags);
+int sbc_init_a2dp(sbc_t *sbc, unsigned long flags, const void *config,
+								size_t len);
 
 ssize_t sbc_parse(sbc_t *sbc, const void *input, size_t input_len);
 
-- 
1.8.4.2


^ permalink raw reply related

* [PATCH SBC v2 2/2] sbc: Add sbc_init_a2dp to sbc.sym
From: Luiz Augusto von Dentz @ 2014-01-20 18:51 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1390243913-13962-1-git-send-email-luiz.dentz@gmail.com>

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

---
 sbc/sbc.sym | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/sbc/sbc.sym b/sbc/sbc.sym
index 3a0c6bf..0c23a05 100644
--- a/sbc/sbc.sym
+++ b/sbc/sbc.sym
@@ -19,3 +19,7 @@ SBC_1.1 {
 global:
 	sbc_init_msbc;
 } SBC_1.0;
+SBC_1.2 {
+global:
+	sbc_init_a2dp;
+} SBC_1.1;
-- 
1.8.4.2


^ permalink raw reply related

* Re: [PATCH] obexd/irmc: Fix folder for LUID requests
From: Luiz Augusto von Dentz @ 2014-01-20 19:29 UTC (permalink / raw)
  To: Harald Schmitt; +Cc: linux-bluetooth@vger.kernel.org
In-Reply-To: <1390239558-6384-1-git-send-email-linux@hschmitt.de>

Hi Harald,

On Mon, Jan 20, 2014 at 7:39 PM, Harald Schmitt <linux@hschmitt.de> wrote:
> The old macro PB_LUID_FOLDER had the folder luid on the second level:
> /telecom/luid. But the luid folder occurs per IrMC spec on level three e.g.
> /telecom/pb/luid. On the second level the object store e.g. pb is specified.
> This bug was introduced with commit 62ebf8d0f345e7722334d852cf7a010b202647e7.
> ---
>  obexd/plugins/irmc.c      | 6 +++---
>  obexd/plugins/phonebook.h | 2 +-
>  2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/obexd/plugins/irmc.c b/obexd/plugins/irmc.c
> index d343977..d0e98b4 100644
> --- a/obexd/plugins/irmc.c
> +++ b/obexd/plugins/irmc.c
> @@ -326,7 +326,7 @@ static int irmc_open_nt(struct irmc_session *irmc)
>         return 0;
>  }
>
> -static int irmc_open_luid(struct irmc_session *irmc)
> +static int irmc_open_pb_luid(struct irmc_session *irmc)
>  {
>         if (irmc->buffer == NULL)
>                 irmc->buffer = g_string_new("");
> @@ -381,8 +381,8 @@ static void *irmc_open(const char *name, int oflag, mode_t mode, void *context,
>                 ret = irmc_open_cal(irmc);
>         else if (g_str_has_prefix(path, PB_NOTES_FOLDER))
>                 ret = irmc_open_nt(irmc);
> -       else if (g_str_has_prefix(path, PB_LUID_FOLDER))
> -               ret = irmc_open_luid(irmc);
> +       else if (g_str_has_prefix(path, PB_CONTACTS_LUID_FOLDER))
> +               ret = irmc_open_pb_luid(irmc);
>         else
>                 ret = -EBADR;
>
> diff --git a/obexd/plugins/phonebook.h b/obexd/plugins/phonebook.h
> index 441cff2..015c9a3 100644
> --- a/obexd/plugins/phonebook.h
> +++ b/obexd/plugins/phonebook.h
> @@ -37,7 +37,7 @@
>  #define PB_CALLS_INCOMING_FOLDER "/telecom/ich"
>  #define PB_CALLS_MISSED_FOLDER "/telecom/mch"
>  #define PB_CALLS_OUTGOING_FOLDER "/telecom/och"
> -#define PB_LUID_FOLDER "/telecom/luid"
> +#define PB_CONTACTS_LUID_FOLDER "/telecom/pb/luid"
>
>  #define PB_CONTACTS "/telecom/pb.vcf"
>  #define PB_CALLS_COMBINED "/telecom/cch.vcf"
> --
> 1.8.3.2

I went ahead and pushed this one, but I preserve much of the define
and function names used before since I did not see any reason to
change those.


-- 
Luiz Augusto von Dentz

^ permalink raw reply

* [PATCH SBC v3 1/2] sbc: Add sbc_init_a2dp
From: Luiz Augusto von Dentz @ 2014-01-20 19:34 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

This adds sbc_init_a2dp that can be used to convert A2DP configuration to
the internal representation since they are not binary compatible.
---
 sbc/sbc.c | 144 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 sbc/sbc.h |   2 +
 2 files changed, 146 insertions(+)

diff --git a/sbc/sbc.c b/sbc/sbc.c
index c589217..9fd2311 100644
--- a/sbc/sbc.c
+++ b/sbc/sbc.c
@@ -57,6 +57,55 @@
 #define MSBC_SYNCWORD	0xAD
 #define MSBC_BLOCKS	15
 
+#define A2DP_SAMPLING_FREQ_16000		(1 << 3)
+#define A2DP_SAMPLING_FREQ_32000		(1 << 2)
+#define A2DP_SAMPLING_FREQ_44100		(1 << 1)
+#define A2DP_SAMPLING_FREQ_48000		1
+
+#define A2DP_CHANNEL_MODE_MONO			(1 << 3)
+#define A2DP_CHANNEL_MODE_DUAL_CHANNEL		(1 << 2)
+#define A2DP_CHANNEL_MODE_STEREO		(1 << 1)
+#define A2DP_CHANNEL_MODE_JOINT_STEREO		1
+
+#define A2DP_BLOCK_LENGTH_4			(1 << 3)
+#define A2DP_BLOCK_LENGTH_8			(1 << 2)
+#define A2DP_BLOCK_LENGTH_12			(1 << 1)
+#define A2DP_BLOCK_LENGTH_16			1
+
+#define A2DP_SUBBANDS_4				(1 << 1)
+#define A2DP_SUBBANDS_8				1
+
+#define A2DP_ALLOCATION_SNR			(1 << 1)
+#define A2DP_ALLOCATION_LOUDNESS		1
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+
+struct a2dp_sbc {
+	uint8_t channel_mode:4;
+	uint8_t frequency:4;
+	uint8_t allocation_method:2;
+	uint8_t subbands:2;
+	uint8_t block_length:4;
+	uint8_t min_bitpool;
+	uint8_t max_bitpool;
+} __attribute__ ((packed));
+
+#elif __BYTE_ORDER == __BIG_ENDIAN
+
+struct a2dp_sbc {
+	uint8_t frequency:4;
+	uint8_t channel_mode:4;
+	uint8_t block_length:4;
+	uint8_t subbands:2;
+	uint8_t allocation_method:2;
+	uint8_t min_bitpool;
+	uint8_t max_bitpool;
+} __attribute__ ((packed));
+
+#else
+#error "Unknown byte order"
+#endif
+
 /* This structure contains an unpacked SBC frame.
    Yes, there is probably quite some unused space herein */
 struct sbc_frame {
@@ -1046,6 +1095,101 @@ SBC_EXPORT int sbc_init_msbc(sbc_t *sbc, unsigned long flags)
 	return 0;
 }
 
+SBC_EXPORT int sbc_init_a2dp(sbc_t *sbc, unsigned long flags, const void *conf,
+							size_t conf_len)
+{
+	const struct a2dp_sbc *a2dp;
+	int err;
+
+	if (conf_len != sizeof(*a2dp))
+		return -EINVAL;
+
+	err = sbc_init(sbc, flags);
+	if (err < 0)
+		return err;
+
+	a2dp = conf;
+
+	switch (a2dp->frequency) {
+	case A2DP_SAMPLING_FREQ_16000:
+		sbc->frequency = SBC_FREQ_16000;
+		break;
+	case A2DP_SAMPLING_FREQ_32000:
+		sbc->frequency = SBC_FREQ_32000;
+		break;
+	case A2DP_SAMPLING_FREQ_44100:
+		sbc->frequency = SBC_FREQ_44100;
+		break;
+	case A2DP_SAMPLING_FREQ_48000:
+		sbc->frequency = SBC_FREQ_48000;
+		break;
+	default:
+		goto failed;
+	}
+
+	switch (a2dp->channel_mode) {
+	case A2DP_CHANNEL_MODE_MONO:
+		sbc->mode = SBC_MODE_MONO;
+		break;
+	case A2DP_CHANNEL_MODE_DUAL_CHANNEL:
+		sbc->mode = SBC_MODE_DUAL_CHANNEL;
+		break;
+	case A2DP_CHANNEL_MODE_STEREO:
+		sbc->mode = SBC_MODE_STEREO;
+		break;
+	case A2DP_CHANNEL_MODE_JOINT_STEREO:
+		sbc->mode = SBC_MODE_JOINT_STEREO;
+		break;
+	default:
+		goto failed;
+	}
+
+	switch (a2dp->allocation_method) {
+	case A2DP_ALLOCATION_SNR:
+		sbc->allocation = SBC_AM_SNR;
+		break;
+	case A2DP_ALLOCATION_LOUDNESS:
+		sbc->allocation = SBC_AM_LOUDNESS;
+		break;
+	default:
+		goto failed;
+	}
+
+	switch (a2dp->subbands) {
+	case A2DP_SUBBANDS_4:
+		sbc->subbands = SBC_SB_4;
+		break;
+	case A2DP_SUBBANDS_8:
+		sbc->subbands = SBC_SB_8;
+		break;
+	default:
+		goto failed;
+	}
+
+	switch (a2dp->block_length) {
+	case A2DP_BLOCK_LENGTH_4:
+		sbc->blocks = SBC_BLK_4;
+		break;
+	case A2DP_BLOCK_LENGTH_8:
+		sbc->blocks = SBC_BLK_8;
+		break;
+	case A2DP_BLOCK_LENGTH_12:
+		sbc->blocks = SBC_BLK_12;
+		break;
+	case A2DP_BLOCK_LENGTH_16:
+		sbc->blocks = SBC_BLK_16;
+		break;
+	default:
+		goto failed;
+	}
+
+	return 0;
+
+failed:
+	sbc_finish(sbc);
+	return -EINVAL;
+}
+
 SBC_EXPORT ssize_t sbc_parse(sbc_t *sbc, const void *input, size_t input_len)
 {
 	return sbc_decode(sbc, input, input_len, NULL, 0, NULL);
diff --git a/sbc/sbc.h b/sbc/sbc.h
index 5f8a1fc..02ad9fe 100644
--- a/sbc/sbc.h
+++ b/sbc/sbc.h
@@ -84,6 +84,8 @@ typedef struct sbc_struct sbc_t;
 int sbc_init(sbc_t *sbc, unsigned long flags);
 int sbc_reinit(sbc_t *sbc, unsigned long flags);
 int sbc_init_msbc(sbc_t *sbc, unsigned long flags);
+int sbc_init_a2dp(sbc_t *sbc, unsigned long flags, const void *conf,
+							size_t conf_len);
 
 ssize_t sbc_parse(sbc_t *sbc, const void *input, size_t input_len);
 
-- 
1.8.4.2


^ permalink raw reply related

* [PATCH SBC v3 2/2] sbc: Add sbc_init_a2dp to sbc.sym
From: Luiz Augusto von Dentz @ 2014-01-20 19:34 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1390246452-29103-1-git-send-email-luiz.dentz@gmail.com>

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

---
 sbc/sbc.sym | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/sbc/sbc.sym b/sbc/sbc.sym
index 3a0c6bf..0c23a05 100644
--- a/sbc/sbc.sym
+++ b/sbc/sbc.sym
@@ -19,3 +19,7 @@ SBC_1.1 {
 global:
 	sbc_init_msbc;
 } SBC_1.0;
+SBC_1.2 {
+global:
+	sbc_init_a2dp;
+} SBC_1.1;
-- 
1.8.4.2


^ permalink raw reply related

* Re: [PATCH 1/5] lib: Add flag to double L2CAP IMTU size used for SDP connection
From: Szymon Janc @ 2014-01-20 20:00 UTC (permalink / raw)
  To: simon; +Cc: linux-bluetooth
In-Reply-To: <649bfd2b8da26f5cf4b19f59d40d26fc.squirrel@mungewell.org>

Hi Simon,

On Monday 20 January 2014 12:31:14 simon@mungewell.org wrote:

<snip>

> I also noticed a weird log at one point, although only saw this once and
> don't know what triggered it.
> --
> [bluetooth]#
> [CHG] Device 1C:66:6D:07:C3:E0 Class: 0x200404
> [CHG] Device 1C:66:6D:07:C3:E0 Icon: audio-card <--------!!
> [CHG] Device 1C:66:6D:07:C3:E0 Class: 0x002508
> [CHG] Device 1C:66:6D:07:C3:E0 Icon: input-gaming
> --

Yes, I've seen this as well. I suspect that DS4 has some extra features 
related to audio (it has jack for headphones) and it enables that for PS4 
only, possibly switching to 'gamepad mode' if not connected to PS4. Maybe 
related to connecting USB first or sth...

But this is just my suspicion... 

-- 
Szymon K. Janc
szymon.janc@gmail.com

^ permalink raw reply

* RE: linux-firmware: pull-request Marvell mwifiex-firmware 2014-01-09
From: Bing Zhao @ 2014-01-20 20:25 UTC (permalink / raw)
  To: quozl@laptop.org
  Cc: Ben Hutchings, linux-wireless@vger.kernel.org,
	linux-bluetooth@vger.kernel.org, Frank Huang
In-Reply-To: <20140120022223.GI17658@us.netrek.org>

Hi James,

> On Sun, Jan 19, 2014 at 06:10:03PM -0800, Bing Zhao wrote:
> > The 2nd (69 or 68) and 3rd (11 or 29) numbers in the version string
> > do not necessarily mean the version increasing or decreasing. Only
> > when first 3 numbers are fixed, a smaller 4th number will mean that
> > the version is rolling backward.
> 
> Ah, light dawns.  I've been dealing with these version numbers for
> years now, for 8388, 8686 and 8787, and I didn't know that.  Is this
> documented anywhere else?  Have the 2nd and 3rd numbers any meaning or
> are they random?

They're not random. They represent firmware branch and features built in.

Thanks,
Bing

^ permalink raw reply

* RE: linux-firmware: pull-request Marvell mwifiex-firmware 2014-01-09
From: Bing Zhao @ 2014-01-20 20:26 UTC (permalink / raw)
  To: Ben Hutchings
  Cc: linux-wireless@vger.kernel.org, linux-bluetooth@vger.kernel.org,
	Frank Huang
In-Reply-To: <1390186665.3651.27.camel@deadeye.wl.decadent.org.uk>

SGkgQmVuLA0KDQo+ID4gPiA+ICBGaWxlOiBtcnZsL3VzYjg3OTdfdWFwc3RhLmJpbg0KPiA+ID4g
PiAtVmVyc2lvbjogMTQuNjkuMTEucDE3OQ0KPiA+ID4gPiArVmVyc2lvbjogMTQuNjguMjkucDI2
DQo+ID4gPiBbLi4uXQ0KPiA+ID4NCj4gPiA+IFdoeSBhcmUgdGhlc2UgdXBkYXRlcyByb2xsaW5n
IHRoZSB2ZXJzaW9uIG51bWJlciBiYWNrd2FyZD8gIERpZCB0aGUNCj4gPiA+IGxhdGVyIHZlcnNp
b25zIGNhdXNlIHJlZ3Jlc3Npb25zPw0KPiA+DQo+ID4gVGhlc2UgaW1hZ2VzIGFyZSBuZXdlciBm
aXJtd2FyZSB2ZXJzaW9ucyBhY3R1YWxseS4NCj4gPg0KPiA+IFRoZSAybmQgKDY5IG9yIDY4KSBh
bmQgM3JkICgxMSBvciAyOSkgbnVtYmVycyBpbiB0aGUgdmVyc2lvbiBzdHJpbmcgZG8NCj4gPiBu
b3QgbmVjZXNzYXJpbHkgbWVhbiB0aGUgdmVyc2lvbiBpbmNyZWFzaW5nIG9yIGRlY3JlYXNpbmcu
IE9ubHkgd2hlbg0KPiA+IGZpcnN0IDMgbnVtYmVycyBhcmUgZml4ZWQsIGEgc21hbGxlciA0dGgg
bnVtYmVyIHdpbGwgbWVhbiB0aGF0IHRoZQ0KPiA+IHZlcnNpb24gaXMgcm9sbGluZyBiYWNrd2Fy
ZC4gRm9yIGV4YW1wbGVzLA0KPiANCj4gU28gd2hhdCBkbyB5b3UgdGhleSBtZWFuIGFuZCB3aHkg
YXJlIHRoZXkgaW4gdGhlIHZlcnNpb24gbnVtYmVyPw0KDQpUaGUgZmlyc3QgMyBudW1iZXJzIGFs
dG9nZXRoZXIgaWRlbnRpZmllcyB0aGUgZmlybXdhcmUgYnJhbmNoL2ZlYXR1cmVzLiBUaGUgNHRo
IG51bWJlciBpcyB0aGUgZmlybXdhcmUgcmV2aXNpb24uDQoNClRoYW5rcywNCkJpbmcNCg0K

^ permalink raw reply

* Re: linux-firmware: pull-request Marvell mwifiex-firmware 2014-01-09
From: Ben Hutchings @ 2014-01-20 20:32 UTC (permalink / raw)
  To: Bing Zhao
  Cc: linux-wireless@vger.kernel.org, linux-bluetooth@vger.kernel.org,
	Frank Huang
In-Reply-To: <477F20668A386D41ADCC57781B1F70430F53691FC8@SC-VEXCH1.marvell.com>

On Mon, Jan 20, 2014 at 12:26:47PM -0800, Bing Zhao wrote:
> Hi Ben,
> 
> > > > >  File: mrvl/usb8797_uapsta.bin
> > > > > -Version: 14.69.11.p179
> > > > > +Version: 14.68.29.p26
> > > > [...]
> > > >
> > > > Why are these updates rolling the version number backward?  Did the
> > > > later versions cause regressions?
> > >
> > > These images are newer firmware versions actually.
> > >
> > > The 2nd (69 or 68) and 3rd (11 or 29) numbers in the version string do
> > > not necessarily mean the version increasing or decreasing. Only when
> > > first 3 numbers are fixed, a smaller 4th number will mean that the
> > > version is rolling backward. For examples,
> > 
> > So what do you they mean and why are they in the version number?
> 
> The first 3 numbers altogether identifies the firmware branch/features. The 4th number is the firmware revision.

This is a uniquely confusing way of generating version numbers.  If
only the current 4th part (what you call firmware revision) follows
the usual version ordering, then I think that should be used as the
(public) version number.

Ben.

-- 
Ben Hutchings
Gates has joked that everything goes on and off unexepectedly in the house,
which is run by a high-end PC network built on Windows NT. - Seattle Times

^ permalink raw reply

* Re: [PATCH] obexd/irmc: Fix folder for LUID requests
From: Harald Schmitt @ 2014-01-20 20:55 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: linux-bluetooth@vger.kernel.org
In-Reply-To: <CABBYNZLDtvMzbZN8Ju+VpAnFwQc2vVnqkgAeyM73XC8af3XeGw@mail.gmail.com>

Hi Luiz,

Am 20.01.2014 20:29, schrieb Luiz Augusto von Dentz:
> Hi Harald,
> 
> On Mon, Jan 20, 2014 at 7:39 PM, Harald Schmitt <linux@hschmitt.de> wrote:
>> The old macro PB_LUID_FOLDER had the folder luid on the second level:
>> /telecom/luid. But the luid folder occurs per IrMC spec on level three e.g.
>> /telecom/pb/luid. On the second level the object store e.g. pb is specified.
>> This bug was introduced with commit 62ebf8d0f345e7722334d852cf7a010b202647e7.
>> ---
>>  obexd/plugins/irmc.c      | 6 +++---
>>  obexd/plugins/phonebook.h | 2 +-
>>  2 files changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/obexd/plugins/irmc.c b/obexd/plugins/irmc.c
>> index d343977..d0e98b4 100644
>> --- a/obexd/plugins/irmc.c
>> +++ b/obexd/plugins/irmc.c
>> @@ -326,7 +326,7 @@ static int irmc_open_nt(struct irmc_session *irmc)
>>         return 0;
>>  }
>>
>> -static int irmc_open_luid(struct irmc_session *irmc)
>> +static int irmc_open_pb_luid(struct irmc_session *irmc)
>>  {
>>         if (irmc->buffer == NULL)
>>                 irmc->buffer = g_string_new("");
>> @@ -381,8 +381,8 @@ static void *irmc_open(const char *name, int oflag, mode_t mode, void *context,
>>                 ret = irmc_open_cal(irmc);
>>         else if (g_str_has_prefix(path, PB_NOTES_FOLDER))
>>                 ret = irmc_open_nt(irmc);
>> -       else if (g_str_has_prefix(path, PB_LUID_FOLDER))
>> -               ret = irmc_open_luid(irmc);
>> +       else if (g_str_has_prefix(path, PB_CONTACTS_LUID_FOLDER))
>> +               ret = irmc_open_pb_luid(irmc);
>>         else
>>                 ret = -EBADR;
>>
>> diff --git a/obexd/plugins/phonebook.h b/obexd/plugins/phonebook.h
>> index 441cff2..015c9a3 100644
>> --- a/obexd/plugins/phonebook.h
>> +++ b/obexd/plugins/phonebook.h
>> @@ -37,7 +37,7 @@
>>  #define PB_CALLS_INCOMING_FOLDER "/telecom/ich"
>>  #define PB_CALLS_MISSED_FOLDER "/telecom/mch"
>>  #define PB_CALLS_OUTGOING_FOLDER "/telecom/och"
>> -#define PB_LUID_FOLDER "/telecom/luid"
>> +#define PB_CONTACTS_LUID_FOLDER "/telecom/pb/luid"
>>
>>  #define PB_CONTACTS "/telecom/pb.vcf"
>>  #define PB_CALLS_COMBINED "/telecom/cch.vcf"
>> --
>> 1.8.3.2
> 
> I went ahead and pushed this one, but I preserve much of the define
> and function names used before since I did not see any reason to
> change those.
> 
That's fine with me. I just thought it would be more descriptive.


^ permalink raw reply

* Re: [PATCH SBC v3 1/2] sbc: Add sbc_init_a2dp
From: Marcel Holtmann @ 2014-01-20 22:07 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: linux-bluetooth@vger.kernel.org development
In-Reply-To: <1390246452-29103-1-git-send-email-luiz.dentz@gmail.com>

Hi Luiz,

> This adds sbc_init_a2dp that can be used to convert A2DP configuration to
> the internal representation since they are not binary compatible.
> ---
> sbc/sbc.c | 144 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> sbc/sbc.h |   2 +
> 2 files changed, 146 insertions(+)
> 
> diff --git a/sbc/sbc.c b/sbc/sbc.c
> index c589217..9fd2311 100644
> --- a/sbc/sbc.c
> +++ b/sbc/sbc.c
> @@ -57,6 +57,55 @@
> #define MSBC_SYNCWORD	0xAD
> #define MSBC_BLOCKS	15
> 
> +#define A2DP_SAMPLING_FREQ_16000		(1 << 3)
> +#define A2DP_SAMPLING_FREQ_32000		(1 << 2)
> +#define A2DP_SAMPLING_FREQ_44100		(1 << 1)
> +#define A2DP_SAMPLING_FREQ_48000		1

please use (1 << 0) here.

> +
> +#define A2DP_CHANNEL_MODE_MONO			(1 << 3)
> +#define A2DP_CHANNEL_MODE_DUAL_CHANNEL		(1 << 2)
> +#define A2DP_CHANNEL_MODE_STEREO		(1 << 1)
> +#define A2DP_CHANNEL_MODE_JOINT_STEREO		1
> +
> +#define A2DP_BLOCK_LENGTH_4			(1 << 3)
> +#define A2DP_BLOCK_LENGTH_8			(1 << 2)
> +#define A2DP_BLOCK_LENGTH_12			(1 << 1)
> +#define A2DP_BLOCK_LENGTH_16			1
> +
> +#define A2DP_SUBBANDS_4				(1 << 1)
> +#define A2DP_SUBBANDS_8				1
> +
> +#define A2DP_ALLOCATION_SNR			(1 << 1)
> +#define A2DP_ALLOCATION_LOUDNESS		1
> +
> +#if __BYTE_ORDER == __LITTLE_ENDIAN
> +
> +struct a2dp_sbc {
> +	uint8_t channel_mode:4;
> +	uint8_t frequency:4;
> +	uint8_t allocation_method:2;
> +	uint8_t subbands:2;
> +	uint8_t block_length:4;
> +	uint8_t min_bitpool;
> +	uint8_t max_bitpool;
> +} __attribute__ ((packed));
> +
> +#elif __BYTE_ORDER == __BIG_ENDIAN
> +
> +struct a2dp_sbc {
> +	uint8_t frequency:4;
> +	uint8_t channel_mode:4;
> +	uint8_t block_length:4;
> +	uint8_t subbands:2;
> +	uint8_t allocation_method:2;
> +	uint8_t min_bitpool;
> +	uint8_t max_bitpool;
> +} __attribute__ ((packed));
> +
> +#else
> +#error "Unknown byte order"
> +#endif
> +
> /* This structure contains an unpacked SBC frame.
>    Yes, there is probably quite some unused space herein */
> struct sbc_frame {
> @@ -1046,6 +1095,101 @@ SBC_EXPORT int sbc_init_msbc(sbc_t *sbc, unsigned long flags)
> 	return 0;
> }
> 
> +SBC_EXPORT int sbc_init_a2dp(sbc_t *sbc, unsigned long flags, const void *conf,
> +							size_t conf_len)
> +{
> +	const struct a2dp_sbc *a2dp;
> +	int err;
> +
> +	if (conf_len != sizeof(*a2dp))
> +		return -EINVAL;
> +
> +	err = sbc_init(sbc, flags);
> +	if (err < 0)
> +		return err;
> +
> +	a2dp = conf;
> +
> +	switch (a2dp->frequency) {
> +	case A2DP_SAMPLING_FREQ_16000:
> +		sbc->frequency = SBC_FREQ_16000;
> +		break;
> +	case A2DP_SAMPLING_FREQ_32000:
> +		sbc->frequency = SBC_FREQ_32000;
> +		break;
> +	case A2DP_SAMPLING_FREQ_44100:
> +		sbc->frequency = SBC_FREQ_44100;
> +		break;
> +	case A2DP_SAMPLING_FREQ_48000:
> +		sbc->frequency = SBC_FREQ_48000;
> +		break;
> +	default:
> +		goto failed;
> +	}
> +
> +	switch (a2dp->channel_mode) {
> +	case A2DP_CHANNEL_MODE_MONO:
> +		sbc->mode = SBC_MODE_MONO;
> +		break;
> +	case A2DP_CHANNEL_MODE_DUAL_CHANNEL:
> +		sbc->mode = SBC_MODE_DUAL_CHANNEL;
> +		break;
> +	case A2DP_CHANNEL_MODE_STEREO:
> +		sbc->mode = SBC_MODE_STEREO;
> +		break;
> +	case A2DP_CHANNEL_MODE_JOINT_STEREO:
> +		sbc->mode = SBC_MODE_JOINT_STEREO;
> +		break;
> +	default:
> +		goto failed;
> +	}
> +
> +	switch (a2dp->allocation_method) {
> +	case A2DP_ALLOCATION_SNR:
> +		sbc->allocation = SBC_AM_SNR;
> +		break;
> +	case A2DP_ALLOCATION_LOUDNESS:
> +		sbc->allocation = SBC_AM_LOUDNESS;
> +		break;
> +	default:
> +		goto failed;
> +	}
> +
> +	switch (a2dp->subbands) {
> +	case A2DP_SUBBANDS_4:
> +		sbc->subbands = SBC_SB_4;
> +		break;
> +	case A2DP_SUBBANDS_8:
> +		sbc->subbands = SBC_SB_8;
> +		break;
> +	default:
> +		goto failed;
> +	}
> +
> +	switch (a2dp->block_length) {
> +	case A2DP_BLOCK_LENGTH_4:
> +		sbc->blocks = SBC_BLK_4;
> +		break;
> +	case A2DP_BLOCK_LENGTH_8:
> +		sbc->blocks = SBC_BLK_8;
> +		break;
> +	case A2DP_BLOCK_LENGTH_12:
> +		sbc->blocks = SBC_BLK_12;
> +		break;
> +	case A2DP_BLOCK_LENGTH_16:
> +		sbc->blocks = SBC_BLK_16;
> +		break;
> +	default:
> +		goto failed;
> +	}
> +
> +	return 0;
> +
> +failed:
> +	sbc_finish(sbc);
> +	return -EINVAL;
> +}
> +
> SBC_EXPORT ssize_t sbc_parse(sbc_t *sbc, const void *input, size_t input_len)
> {
> 	return sbc_decode(sbc, input, input_len, NULL, 0, NULL);
> diff --git a/sbc/sbc.h b/sbc/sbc.h
> index 5f8a1fc..02ad9fe 100644
> --- a/sbc/sbc.h
> +++ b/sbc/sbc.h
> @@ -84,6 +84,8 @@ typedef struct sbc_struct sbc_t;
> int sbc_init(sbc_t *sbc, unsigned long flags);
> int sbc_reinit(sbc_t *sbc, unsigned long flags);
> int sbc_init_msbc(sbc_t *sbc, unsigned long flags);
> +int sbc_init_a2dp(sbc_t *sbc, unsigned long flags, const void *conf,
> +							size_t conf_len);

Lets get const void *conf and size_t conf_len both on the second line. It feels looks wise a little bit easier on eyes. 

And then the same for the actual implementation of course. Otherwise, this looks good.

Regards

Marcel


^ permalink raw reply

* Re: [PATCHv5 00/11] IPC negative tester
From: Szymon Janc @ 2014-01-20 22:26 UTC (permalink / raw)
  To: Jakub Tyszkowski; +Cc: linux-bluetooth
In-Reply-To: <1390210570-28260-1-git-send-email-jakub.tyszkowski@tieto.com>

Hi Jakub,

On Monday 20 January 2014 10:35:59 Jakub Tyszkowski wrote:
> Following patchset adds IPC negative tester framework along with test cases
> checking IPC's behaviour on daemon side. Expected daemon's behaviour is to
> shut down gracefully in case of receiving invalid IPC data.
> 
> v2 changes:
>   * fixed few indentation issues
>   * fixed missing __attribute__((packed))
>   * fixed amount of data written for 'malformed data' test case
>   * fixed opcode for 'invalid service' test case
>   * added patch(8) with more 'malformed data' cases
> 
> v3 changes:
>   * changed license to GPL
>   * changed 'ipc-negative-tester' name to 'ipc-tester'
> 
> v4 changes:
>   * fixed typo in first test case and last commit's message
>   * fixed daemon shutdown handler function
> 
> v5 changes:
>   * added clean up in case of setup failure
>   * added test execution macro enhancement for easy data creation
>   * added test cases for core BT interfaces (Patches: 9, 10, 11)
> 
> Jakub Tyszkowski (11):
>   android/ipc-tester: Skeleton for ipc negative tester
>   android/ipc-tester: Run daemon in separate process
>   android/ipc-tester: Add IPC initialization
>   android/ipc-tester: Add daemon shutdown handler
>   android/ipc-tester: Add sending test data with ipc
>   android/ipc-tester: Register services
>   android/ipc-tester: Add basic test cases for IPC's daemon site
>   android/ipc-tester: Add more cases for malformed data
>   android/ipc-tester: Add cases for service opcode boundaries
>   android/ipc-tester: Add cases for Core message data size
>   android/ipc-tester: Add cases for BT message data size
> 
>  .gitignore           |   1 +
>  android/Makefile.am  |  17 +
>  android/ipc-tester.c | 868
> +++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 886
> insertions(+)
>  create mode 100644 android/ipc-tester.c
> 

All patches in this set have been applied, thanks.

-- 
Szymon K. Janc
szymon.janc@gmail.com

^ permalink raw reply

* [PATCH 0/1] HIDP: Add a special case for the Dualshock 4
From: Frank Praznik @ 2014-01-20 23:37 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: dh.herrmann, simon

This adds a special case in the HIDP core for the Dualshock 4 controller.
The controller only recognizes output reports with the report type 0x52 and 
only accepts reports sent via the ctrl channel. 

Unfortunately, this was the only way I could send data to the controller. I
looked around for alternatives, but adding a special case to the HIDP system
seemed to be the only way. If there is a way to set a custom report type and 
specify the channel without polluting the core with a device specific quirk 
I'll gladly use it.

^ permalink raw reply

* [PATCH 1/1] HIDP: Add a special case for the Dualshock 4
From: Frank Praznik @ 2014-01-20 23:37 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: dh.herrmann, simon, Frank Praznik
In-Reply-To: <1390261022-3113-1-git-send-email-frank.praznik@oh.rr.com>

The Dualshock 4 wants reports with type 0x52 sent on the ctrlchannel when
running over bluetooth. This adds a special case so that the reports can
be successfully sent.

Signed-off-by: Frank Praznik <frank.praznik@oh.rr.com>

---

 net/bluetooth/hidp/core.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c
index 292e619..e597e3f 100644
--- a/net/bluetooth/hidp/core.c
+++ b/net/bluetooth/hidp/core.c
@@ -360,9 +360,17 @@ static int hidp_output_raw_report(struct hid_device *hid, unsigned char *data, s
 	int ret;
 
 	if (report_type == HID_OUTPUT_REPORT) {
-		report_type = HIDP_TRANS_DATA | HIDP_DATA_RTYPE_OUPUT;
-		return hidp_send_intr_message(session, report_type,
+		/* The Dualshock 4 wants report type 0x52 sent via the ctrl channel */
+		if(hid->vendor == 0x54c && hid->product == 0x5c4) {
+			report_type = HIDP_TRANS_SET_REPORT | HIDP_DATA_RTYPE_OUPUT;
+			return hidp_send_ctrl_message(session, report_type,
 					      data, count);
+		}
+		else {
+			report_type = HIDP_TRANS_DATA | HIDP_DATA_RTYPE_OUPUT;
+			return hidp_send_intr_message(session, report_type,
+					      data, count);
+		}
 	} else if (report_type != HID_FEATURE_REPORT) {
 		return -EINVAL;
 	}
-- 
1.8.4.2


^ permalink raw reply related

* [PATCH BlueZ] emulator: Fix unaligned memory access compilation errors
From: Anderson Lizardo @ 2014-01-21  1:46 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Anderson Lizardo

The u128_xor() function does proper aligned access and accepts void *
arguments, therefore the casts are unnecessary and trigger clang errors.
---
 emulator/smp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/emulator/smp.c b/emulator/smp.c
index 2b4f9a5..cb7cda0 100644
--- a/emulator/smp.c
+++ b/emulator/smp.c
@@ -248,7 +248,7 @@ static int smp_c1(struct smp_conn *conn, uint8_t rnd[16], uint8_t res[16])
 	baswap((bdaddr_t *) (p2 + 10), (bdaddr_t *) conn->ra);
 
 	/* res = r XOR p1 */
-	u128_xor((u128 *) res, (u128 *) rnd, (u128 *) p1);
+	u128_xor(res, rnd, p1);
 
 	/* res = e(k, res) */
 	err = smp_e(conn->smp->alg_sk, conn->tk, res, res);
@@ -256,7 +256,7 @@ static int smp_c1(struct smp_conn *conn, uint8_t rnd[16], uint8_t res[16])
 		return err;
 
 	/* res = res XOR p2 */
-	u128_xor((u128 *) res, (u128 *) res, (u128 *) p2);
+	u128_xor(res, res, p2);
 
 	/* res = e(k, res) */
 	return smp_e(conn->smp->alg_sk, conn->tk, res, res);
-- 
1.8.3.2


^ permalink raw reply related

* Re: [PATCH 0/1] HIDP: Add a special case for the Dualshock 4
From: simon @ 2014-01-21  2:00 UTC (permalink / raw)
  To: Frank Praznik; +Cc: linux-bluetooth, dh.herrmann, simon

[-- Attachment #1: Type: text/plain, Size: 987 bytes --]

> This adds a special case in the HIDP core for the Dualshock 4
controller.
> The controller only recognizes output reports with the report type 0x52
and only accepts reports sent via the ctrl channel.

Which part of the system is 'at fault' here, is it simply the DS4 behaving
incorrectly or that Bluez is not picking up some data or that 'we' are
just the incorrect method to send the data (in the hid-sony kernel
driver)?


I noticed that the BT HID spec notes a 'HID control' channel in the
example descriptor in table 5.3.3 as 'Parameter 0'.

The DS4 gives this in it's SDP report
--
	Attribute 0x0004 - ProtocolDescriptorList
		Sequence
			Sequence
				UUID16 0x0100 - L2CAP
				UINT16 0x0011 <---------- 'HDI Control' PSM 17
			Sequence
				UUID16 0x0011 - HIDP
--

Shouldn't Bluez be remembering this and sending accesses to this PSM in
the appropriate mode?

Just looking to fix the problem where it really exists, without just
working around specifically for the DS4.

Simon



[-- Attachment #2: records_raw.txt --]
[-- Type: text/plain, Size: 3035 bytes --]

Sequence
	Attribute 0x0000 - ServiceRecordHandle
		UINT32 0x00010001
	Attribute 0x0001 - ServiceClassIDList
		Sequence
			UUID16 0x1124 - HumanInterfaceDeviceService (HID)
	Attribute 0x0004 - ProtocolDescriptorList
		Sequence
			Sequence
				UUID16 0x0100 - L2CAP
				UINT16 0x0011
			Sequence
				UUID16 0x0011 - HIDP
	Attribute 0x0006 - LanguageBaseAttributeIDList
		Sequence
			UINT16 0x656e
			UINT16 0x006a
			UINT16 0x0100
	Attribute 0x0009 - BluetoothProfileDescriptorList
		Sequence
			Sequence
				UUID16 0x1124 - HumanInterfaceDeviceService (HID)
				UINT16 0x0100
	Attribute 0x000d - AdditionalProtocolDescriptorLists
		Sequence
			Sequence
				Sequence
					UUID16 0x0100 - L2CAP
					UINT16 0x0013
				Sequence
					UUID16 0x0011 - HIDP
	Attribute 0x0100
		String Wireless Controller\0
	Attribute 0x0101
		String Game Controller\0
	Attribute 0x0102
		String Sony Computer Entertainment\0
	Attribute 0x0200				<===== ?????
		UINT16 0x0100
	Attribute 0x0201				<===== HIDParserVersion 
		UINT16 0x0111
	Attribute 0x0202				<===== HIDDeviceSubclass 
		UINT8 0x08
	Attribute 0x0203				<===== HIDCountryCode 
		UINT8 0x00
	Attribute 0x0204				<===== HIDVirtualCable
		Bool False
	Attribute 0x0205				<===== HIDReconnectInitiate
		Bool True
	Attribute 0x0206				<===== HIDDescriptorList
		Sequence
			Sequence
				UINT8 0x22
				Data 05 01 09 05 a1 01 85 01 09 30 09 31 09 32 09 35 15 00 26 ff 00 75 08 95 04 81 02 09 39 15 00 25 07 75 04 95 01 81 42 05 09 19 01 29 0e 15 00 25 01 75 01 95 0e 81 02 75 06 95 01 81 01 05 01 09 33 09 34 15 00 26 ff 00 75 08 95 02 81 02 06 04 ff 85 02 09 24 95 24 b1 02 85 a3 09 25 95 30 b1 02 85 05 09 26 95 28 b1 02 85 06 09 27 95 34 b1 02 85 07 09 28 95 30 b1 02 85 08 09 29 95 2f b1 02 06 03 ff 85 03 09 21 95 26 b1 02 85 04 09 22 95 2e b1 02 85 f0 09 47 95 3f b1 02 85 f1 09 48 95 3f b1 02 85 f2 09 49 95 0f b1 02 06 00 ff 85 11 09 20 15 00 26 ff 00 75 08 95 4d 81 02 09 21 91 02 85 12 09 22 95 8d 81 02 09 23 91 02 85 13 09 24 95 cd 81 02 09 25 91 02 85 14 09 26 96 0d 01 81 02 09 27 91 02 85 15 09 28 96 4d 01 81 02 09 29 91 02 85 16 09 2a 96 8d 01 81 02 09 2b 91 02 85 17 09 2c 96 cd 01 81 02 09 2d 91 02 85 18 09 2e 96 0d 02 81 02 09 2f 91 02 85 19 09 30 96 22 02 81 02 09 31 91 02 06 80 ff 85 82 09 22 95 3f b1 02 85 83 09 23 b1 02 85 84 09 24 b1 02 85 90 09 30 b1 02 85 91 09 31 b1 02 85 92 09 32 b1 02 85 93 09 33 b1 02 85 a0 09 40 b1 02 85 a4 09 44 b1 02 c0 00
Sequence
	Attribute 0x0000 - ServiceRecordHandle
		UINT32 0x00010002
	Attribute 0x0001 - ServiceClassIDList
		Sequence
			UUID16 0x1200 - PnPInformation
	Attribute 0x0004 - ProtocolDescriptorList
		Sequence
			Sequence
				UUID16 0x0100 - L2CAP
				UINT16 0x0001
			Sequence
				UUID16 0x0001 - SDP
	Attribute 0x0009 - BluetoothProfileDescriptorList
		Sequence
			Sequence
				UUID16 0x1200 - PnPInformation
				UINT16 0x0103
	Attribute 0x0200
		UINT16 0x0103
	Attribute 0x0201
		UINT16 0x054c
	Attribute 0x0202
		UINT16 0x05c4
	Attribute 0x0203
		UINT16 0x0100
	Attribute 0x0204
		Bool True
	Attribute 0x0205
		UINT16 0x0002

^ permalink raw reply

* Re: [PATCH 0/1] HIDP: Add a special case for the Dualshock 4
From: David Herrmann @ 2014-01-21  8:26 UTC (permalink / raw)
  To: Simon Wood; +Cc: Frank Praznik, linux-bluetooth@vger.kernel.org
In-Reply-To: <5ddfeed2ae259064d50f6b08eb15cf5f.squirrel@mungewell.org>

Hi

On Tue, Jan 21, 2014 at 3:00 AM,  <simon@mungewell.org> wrote:
>> This adds a special case in the HIDP core for the Dualshock 4
> controller.
>> The controller only recognizes output reports with the report type 0x52
> and only accepts reports sent via the ctrl channel.
>
> Which part of the system is 'at fault' here, is it simply the DS4 behaving
> incorrectly or that Bluez is not picking up some data or that 'we' are
> just the incorrect method to send the data (in the hid-sony kernel
> driver)?

No-one is at fault. Well, strictly speaking the DS4 is, as it has to
accept SET_REPORT and asynchronous OUTPUT_REPORTs, but it doesn't.
That's quite common. What we actually want is HIDP to provide to
functions, one to call SET_REPORT and one to do the async
OUTPUT_REPORT is currently does.

I implemented this some time ago here:
  http://cgit.freedesktop.org/~dvdhrm/linux/log/?h=hid

Maybe it's time to get that merged. But that hack here is ugly and not
the way to go.

Thanks
David

>
> I noticed that the BT HID spec notes a 'HID control' channel in the
> example descriptor in table 5.3.3 as 'Parameter 0'.
>
> The DS4 gives this in it's SDP report
> --
>         Attribute 0x0004 - ProtocolDescriptorList
>                 Sequence
>                         Sequence
>                                 UUID16 0x0100 - L2CAP
>                                 UINT16 0x0011 <---------- 'HDI Control' PSM 17
>                         Sequence
>                                 UUID16 0x0011 - HIDP
> --
>
> Shouldn't Bluez be remembering this and sending accesses to this PSM in
> the appropriate mode?
>
> Just looking to fix the problem where it really exists, without just
> working around specifically for the DS4.
>
> Simon
>
>

^ permalink raw reply

* [PATCH SBC v4 1/2] sbc: Add sbc_init_a2dp
From: Luiz Augusto von Dentz @ 2014-01-21  8:46 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

This adds sbc_init_a2dp that can be used to convert A2DP configuration to
the internal representation since they are not binary compatible.
---
 sbc/sbc.c | 144 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 sbc/sbc.h |   2 +
 2 files changed, 146 insertions(+)

diff --git a/sbc/sbc.c b/sbc/sbc.c
index c589217..12e8238 100644
--- a/sbc/sbc.c
+++ b/sbc/sbc.c
@@ -57,6 +57,55 @@
 #define MSBC_SYNCWORD	0xAD
 #define MSBC_BLOCKS	15
 
+#define A2DP_SAMPLING_FREQ_16000		(1 << 3)
+#define A2DP_SAMPLING_FREQ_32000		(1 << 2)
+#define A2DP_SAMPLING_FREQ_44100		(1 << 1)
+#define A2DP_SAMPLING_FREQ_48000		(1 << 0)
+
+#define A2DP_CHANNEL_MODE_MONO			(1 << 3)
+#define A2DP_CHANNEL_MODE_DUAL_CHANNEL		(1 << 2)
+#define A2DP_CHANNEL_MODE_STEREO		(1 << 1)
+#define A2DP_CHANNEL_MODE_JOINT_STEREO		(1 << 0)
+
+#define A2DP_BLOCK_LENGTH_4			(1 << 3)
+#define A2DP_BLOCK_LENGTH_8			(1 << 2)
+#define A2DP_BLOCK_LENGTH_12			(1 << 1)
+#define A2DP_BLOCK_LENGTH_16			(1 << 0)
+
+#define A2DP_SUBBANDS_4				(1 << 1)
+#define A2DP_SUBBANDS_8				(1 << 0)
+
+#define A2DP_ALLOCATION_SNR			(1 << 1)
+#define A2DP_ALLOCATION_LOUDNESS		(1 << 0)
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+
+struct a2dp_sbc {
+	uint8_t channel_mode:4;
+	uint8_t frequency:4;
+	uint8_t allocation_method:2;
+	uint8_t subbands:2;
+	uint8_t block_length:4;
+	uint8_t min_bitpool;
+	uint8_t max_bitpool;
+} __attribute__ ((packed));
+
+#elif __BYTE_ORDER == __BIG_ENDIAN
+
+struct a2dp_sbc {
+	uint8_t frequency:4;
+	uint8_t channel_mode:4;
+	uint8_t block_length:4;
+	uint8_t subbands:2;
+	uint8_t allocation_method:2;
+	uint8_t min_bitpool;
+	uint8_t max_bitpool;
+} __attribute__ ((packed));
+
+#else
+#error "Unknown byte order"
+#endif
+
 /* This structure contains an unpacked SBC frame.
    Yes, there is probably quite some unused space herein */
 struct sbc_frame {
@@ -1046,6 +1095,101 @@ SBC_EXPORT int sbc_init_msbc(sbc_t *sbc, unsigned long flags)
 	return 0;
 }
 
+SBC_EXPORT int sbc_init_a2dp(sbc_t *sbc, unsigned long flags, const void *conf,
+							size_t conf_len)
+{
+	const struct a2dp_sbc *a2dp;
+	int err;
+
+	if (conf_len != sizeof(*a2dp))
+		return -EINVAL;
+
+	err = sbc_init(sbc, flags);
+	if (err < 0)
+		return err;
+
+	a2dp = conf;
+
+	switch (a2dp->frequency) {
+	case A2DP_SAMPLING_FREQ_16000:
+		sbc->frequency = SBC_FREQ_16000;
+		break;
+	case A2DP_SAMPLING_FREQ_32000:
+		sbc->frequency = SBC_FREQ_32000;
+		break;
+	case A2DP_SAMPLING_FREQ_44100:
+		sbc->frequency = SBC_FREQ_44100;
+		break;
+	case A2DP_SAMPLING_FREQ_48000:
+		sbc->frequency = SBC_FREQ_48000;
+		break;
+	default:
+		goto failed;
+	}
+
+	switch (a2dp->channel_mode) {
+	case A2DP_CHANNEL_MODE_MONO:
+		sbc->mode = SBC_MODE_MONO;
+		break;
+	case A2DP_CHANNEL_MODE_DUAL_CHANNEL:
+		sbc->mode = SBC_MODE_DUAL_CHANNEL;
+		break;
+	case A2DP_CHANNEL_MODE_STEREO:
+		sbc->mode = SBC_MODE_STEREO;
+		break;
+	case A2DP_CHANNEL_MODE_JOINT_STEREO:
+		sbc->mode = SBC_MODE_JOINT_STEREO;
+		break;
+	default:
+		goto failed;
+	}
+
+	switch (a2dp->allocation_method) {
+	case A2DP_ALLOCATION_SNR:
+		sbc->allocation = SBC_AM_SNR;
+		break;
+	case A2DP_ALLOCATION_LOUDNESS:
+		sbc->allocation = SBC_AM_LOUDNESS;
+		break;
+	default:
+		goto failed;
+	}
+
+	switch (a2dp->subbands) {
+	case A2DP_SUBBANDS_4:
+		sbc->subbands = SBC_SB_4;
+		break;
+	case A2DP_SUBBANDS_8:
+		sbc->subbands = SBC_SB_8;
+		break;
+	default:
+		goto failed;
+	}
+
+	switch (a2dp->block_length) {
+	case A2DP_BLOCK_LENGTH_4:
+		sbc->blocks = SBC_BLK_4;
+		break;
+	case A2DP_BLOCK_LENGTH_8:
+		sbc->blocks = SBC_BLK_8;
+		break;
+	case A2DP_BLOCK_LENGTH_12:
+		sbc->blocks = SBC_BLK_12;
+		break;
+	case A2DP_BLOCK_LENGTH_16:
+		sbc->blocks = SBC_BLK_16;
+		break;
+	default:
+		goto failed;
+	}
+
+	return 0;
+
+failed:
+	sbc_finish(sbc);
+	return -EINVAL;
+}
+
 SBC_EXPORT ssize_t sbc_parse(sbc_t *sbc, const void *input, size_t input_len)
 {
 	return sbc_decode(sbc, input, input_len, NULL, 0, NULL);
diff --git a/sbc/sbc.h b/sbc/sbc.h
index 5f8a1fc..02ad9fe 100644
--- a/sbc/sbc.h
+++ b/sbc/sbc.h
@@ -84,6 +84,8 @@ typedef struct sbc_struct sbc_t;
 int sbc_init(sbc_t *sbc, unsigned long flags);
 int sbc_reinit(sbc_t *sbc, unsigned long flags);
 int sbc_init_msbc(sbc_t *sbc, unsigned long flags);
+int sbc_init_a2dp(sbc_t *sbc, unsigned long flags, const void *conf,
+							size_t conf_len);
 
 ssize_t sbc_parse(sbc_t *sbc, const void *input, size_t input_len);
 
-- 
1.8.4.2


^ permalink raw reply related

* [PATCH SBC v4 2/2] sbc: Add sbc_init_a2dp to sbc.sym
From: Luiz Augusto von Dentz @ 2014-01-21  8:46 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1390293983-31667-1-git-send-email-luiz.dentz@gmail.com>

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

---
 sbc/sbc.sym | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/sbc/sbc.sym b/sbc/sbc.sym
index 3a0c6bf..0c23a05 100644
--- a/sbc/sbc.sym
+++ b/sbc/sbc.sym
@@ -19,3 +19,7 @@ SBC_1.1 {
 global:
 	sbc_init_msbc;
 } SBC_1.0;
+SBC_1.2 {
+global:
+	sbc_init_a2dp;
+} SBC_1.1;
-- 
1.8.4.2


^ permalink raw reply related

* Re: [PATCH SBC v4 1/2] sbc: Add sbc_init_a2dp
From: Marcel Holtmann @ 2014-01-21  8:58 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: linux-bluetooth@vger.kernel.org development
In-Reply-To: <1390293983-31667-1-git-send-email-luiz.dentz@gmail.com>

Hi Luiz,

> This adds sbc_init_a2dp that can be used to convert A2DP configuration to
> the internal representation since they are not binary compatible.
> ---
> sbc/sbc.c | 144 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> sbc/sbc.h |   2 +
> 2 files changed, 146 insertions(+)
> 
> diff --git a/sbc/sbc.c b/sbc/sbc.c
> index c589217..12e8238 100644
> --- a/sbc/sbc.c
> +++ b/sbc/sbc.c
> @@ -57,6 +57,55 @@
> #define MSBC_SYNCWORD	0xAD
> #define MSBC_BLOCKS	15
> 
> +#define A2DP_SAMPLING_FREQ_16000		(1 << 3)
> +#define A2DP_SAMPLING_FREQ_32000		(1 << 2)
> +#define A2DP_SAMPLING_FREQ_44100		(1 << 1)
> +#define A2DP_SAMPLING_FREQ_48000		(1 << 0)
> +
> +#define A2DP_CHANNEL_MODE_MONO			(1 << 3)
> +#define A2DP_CHANNEL_MODE_DUAL_CHANNEL		(1 << 2)
> +#define A2DP_CHANNEL_MODE_STEREO		(1 << 1)
> +#define A2DP_CHANNEL_MODE_JOINT_STEREO		(1 << 0)
> +
> +#define A2DP_BLOCK_LENGTH_4			(1 << 3)
> +#define A2DP_BLOCK_LENGTH_8			(1 << 2)
> +#define A2DP_BLOCK_LENGTH_12			(1 << 1)
> +#define A2DP_BLOCK_LENGTH_16			(1 << 0)
> +
> +#define A2DP_SUBBANDS_4				(1 << 1)
> +#define A2DP_SUBBANDS_8				(1 << 0)
> +
> +#define A2DP_ALLOCATION_SNR			(1 << 1)
> +#define A2DP_ALLOCATION_LOUDNESS		(1 << 0)
> +
> +#if __BYTE_ORDER == __LITTLE_ENDIAN
> +
> +struct a2dp_sbc {
> +	uint8_t channel_mode:4;
> +	uint8_t frequency:4;
> +	uint8_t allocation_method:2;
> +	uint8_t subbands:2;
> +	uint8_t block_length:4;
> +	uint8_t min_bitpool;
> +	uint8_t max_bitpool;
> +} __attribute__ ((packed));
> +
> +#elif __BYTE_ORDER == __BIG_ENDIAN
> +
> +struct a2dp_sbc {
> +	uint8_t frequency:4;
> +	uint8_t channel_mode:4;
> +	uint8_t block_length:4;
> +	uint8_t subbands:2;
> +	uint8_t allocation_method:2;
> +	uint8_t min_bitpool;
> +	uint8_t max_bitpool;
> +} __attribute__ ((packed));
> +
> +#else
> +#error "Unknown byte order"
> +#endif
> +
> /* This structure contains an unpacked SBC frame.
>    Yes, there is probably quite some unused space herein */
> struct sbc_frame {
> @@ -1046,6 +1095,101 @@ SBC_EXPORT int sbc_init_msbc(sbc_t *sbc, unsigned long flags)
> 	return 0;
> }
> 
> +SBC_EXPORT int sbc_init_a2dp(sbc_t *sbc, unsigned long flags, const void *conf,
> +							size_t conf_len)

just to make it easier on the eyes:

			..a2dp(sbc_t *sbc, unsigned long flags,
						const void *conf, size_t conf_len)

> +{
> +	const struct a2dp_sbc *a2dp;
> +	int err;
> +
> +	if (conf_len != sizeof(*a2dp))
> +		return -EINVAL;
> +
> +	err = sbc_init(sbc, flags);
> +	if (err < 0)
> +		return err;
> +
> +	a2dp = conf;
> +
> +	switch (a2dp->frequency) {
> +	case A2DP_SAMPLING_FREQ_16000:
> +		sbc->frequency = SBC_FREQ_16000;
> +		break;
> +	case A2DP_SAMPLING_FREQ_32000:
> +		sbc->frequency = SBC_FREQ_32000;
> +		break;
> +	case A2DP_SAMPLING_FREQ_44100:
> +		sbc->frequency = SBC_FREQ_44100;
> +		break;
> +	case A2DP_SAMPLING_FREQ_48000:
> +		sbc->frequency = SBC_FREQ_48000;
> +		break;
> +	default:
> +		goto failed;
> +	}
> +
> +	switch (a2dp->channel_mode) {
> +	case A2DP_CHANNEL_MODE_MONO:
> +		sbc->mode = SBC_MODE_MONO;
> +		break;
> +	case A2DP_CHANNEL_MODE_DUAL_CHANNEL:
> +		sbc->mode = SBC_MODE_DUAL_CHANNEL;
> +		break;
> +	case A2DP_CHANNEL_MODE_STEREO:
> +		sbc->mode = SBC_MODE_STEREO;
> +		break;
> +	case A2DP_CHANNEL_MODE_JOINT_STEREO:
> +		sbc->mode = SBC_MODE_JOINT_STEREO;
> +		break;
> +	default:
> +		goto failed;
> +	}
> +
> +	switch (a2dp->allocation_method) {
> +	case A2DP_ALLOCATION_SNR:
> +		sbc->allocation = SBC_AM_SNR;
> +		break;
> +	case A2DP_ALLOCATION_LOUDNESS:
> +		sbc->allocation = SBC_AM_LOUDNESS;
> +		break;
> +	default:
> +		goto failed;
> +	}
> +
> +	switch (a2dp->subbands) {
> +	case A2DP_SUBBANDS_4:
> +		sbc->subbands = SBC_SB_4;
> +		break;
> +	case A2DP_SUBBANDS_8:
> +		sbc->subbands = SBC_SB_8;
> +		break;
> +	default:
> +		goto failed;
> +	}
> +
> +	switch (a2dp->block_length) {
> +	case A2DP_BLOCK_LENGTH_4:
> +		sbc->blocks = SBC_BLK_4;
> +		break;
> +	case A2DP_BLOCK_LENGTH_8:
> +		sbc->blocks = SBC_BLK_8;
> +		break;
> +	case A2DP_BLOCK_LENGTH_12:
> +		sbc->blocks = SBC_BLK_12;
> +		break;
> +	case A2DP_BLOCK_LENGTH_16:
> +		sbc->blocks = SBC_BLK_16;
> +		break;
> +	default:
> +		goto failed;
> +	}
> +
> +	return 0;
> +
> +failed:
> +	sbc_finish(sbc);
> +	return -EINVAL;
> +}
> +
> SBC_EXPORT ssize_t sbc_parse(sbc_t *sbc, const void *input, size_t input_len)
> {
> 	return sbc_decode(sbc, input, input_len, NULL, 0, NULL);
> diff --git a/sbc/sbc.h b/sbc/sbc.h
> index 5f8a1fc..02ad9fe 100644
> --- a/sbc/sbc.h
> +++ b/sbc/sbc.h
> @@ -84,6 +84,8 @@ typedef struct sbc_struct sbc_t;
> int sbc_init(sbc_t *sbc, unsigned long flags);
> int sbc_reinit(sbc_t *sbc, unsigned long flags);
> int sbc_init_msbc(sbc_t *sbc, unsigned long flags);
> +int sbc_init_a2dp(sbc_t *sbc, unsigned long flags, const void *conf,
> +							size_t conf_len);

Same here:

	int sbc_init_a2dp(sbc_t *sbc, unsigned long flags,
					const void *conf, size_t conf_len);

> 
> ssize_t sbc_parse(sbc_t *sbc, const void *input, size_t input_len);

Regards

Marcel


^ permalink raw reply

* Re: [PATCH BlueZ] emulator: Fix unaligned memory access compilation errors
From: Johan Hedberg @ 2014-01-21  9:08 UTC (permalink / raw)
  To: Anderson Lizardo; +Cc: linux-bluetooth
In-Reply-To: <1390268769-30209-1-git-send-email-anderson.lizardo@openbossa.org>

Hi Lizardo,

On Mon, Jan 20, 2014, Anderson Lizardo wrote:
> The u128_xor() function does proper aligned access and accepts void *
> arguments, therefore the casts are unnecessary and trigger clang errors.
> ---
>  emulator/smp.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Applied. Thanks.

Johan

^ permalink raw reply

* [PATCH SBC v5 1/2] sbc: Add sbc_init_a2dp
From: Luiz Augusto von Dentz @ 2014-01-21  9:08 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

This adds sbc_init_a2dp that can be used to convert A2DP configuration to
the internal representation since they are not binary compatible.
---
 sbc/sbc.c | 144 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 sbc/sbc.h |   2 +
 2 files changed, 146 insertions(+)

diff --git a/sbc/sbc.c b/sbc/sbc.c
index c589217..ee6a2ab 100644
--- a/sbc/sbc.c
+++ b/sbc/sbc.c
@@ -57,6 +57,55 @@
 #define MSBC_SYNCWORD	0xAD
 #define MSBC_BLOCKS	15
 
+#define A2DP_SAMPLING_FREQ_16000		(1 << 3)
+#define A2DP_SAMPLING_FREQ_32000		(1 << 2)
+#define A2DP_SAMPLING_FREQ_44100		(1 << 1)
+#define A2DP_SAMPLING_FREQ_48000		(1 << 0)
+
+#define A2DP_CHANNEL_MODE_MONO			(1 << 3)
+#define A2DP_CHANNEL_MODE_DUAL_CHANNEL		(1 << 2)
+#define A2DP_CHANNEL_MODE_STEREO		(1 << 1)
+#define A2DP_CHANNEL_MODE_JOINT_STEREO		(1 << 0)
+
+#define A2DP_BLOCK_LENGTH_4			(1 << 3)
+#define A2DP_BLOCK_LENGTH_8			(1 << 2)
+#define A2DP_BLOCK_LENGTH_12			(1 << 1)
+#define A2DP_BLOCK_LENGTH_16			(1 << 0)
+
+#define A2DP_SUBBANDS_4				(1 << 1)
+#define A2DP_SUBBANDS_8				(1 << 0)
+
+#define A2DP_ALLOCATION_SNR			(1 << 1)
+#define A2DP_ALLOCATION_LOUDNESS		(1 << 0)
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+
+struct a2dp_sbc {
+	uint8_t channel_mode:4;
+	uint8_t frequency:4;
+	uint8_t allocation_method:2;
+	uint8_t subbands:2;
+	uint8_t block_length:4;
+	uint8_t min_bitpool;
+	uint8_t max_bitpool;
+} __attribute__ ((packed));
+
+#elif __BYTE_ORDER == __BIG_ENDIAN
+
+struct a2dp_sbc {
+	uint8_t frequency:4;
+	uint8_t channel_mode:4;
+	uint8_t block_length:4;
+	uint8_t subbands:2;
+	uint8_t allocation_method:2;
+	uint8_t min_bitpool;
+	uint8_t max_bitpool;
+} __attribute__ ((packed));
+
+#else
+#error "Unknown byte order"
+#endif
+
 /* This structure contains an unpacked SBC frame.
    Yes, there is probably quite some unused space herein */
 struct sbc_frame {
@@ -1046,6 +1095,101 @@ SBC_EXPORT int sbc_init_msbc(sbc_t *sbc, unsigned long flags)
 	return 0;
 }
 
+SBC_EXPORT int sbc_init_a2dp(sbc_t *sbc, unsigned long flags,
+					const void *conf, size_t conf_len)
+{
+	const struct a2dp_sbc *a2dp;
+	int err;
+
+	if (conf_len != sizeof(*a2dp))
+		return -EINVAL;
+
+	err = sbc_init(sbc, flags);
+	if (err < 0)
+		return err;
+
+	a2dp = conf;
+
+	switch (a2dp->frequency) {
+	case A2DP_SAMPLING_FREQ_16000:
+		sbc->frequency = SBC_FREQ_16000;
+		break;
+	case A2DP_SAMPLING_FREQ_32000:
+		sbc->frequency = SBC_FREQ_32000;
+		break;
+	case A2DP_SAMPLING_FREQ_44100:
+		sbc->frequency = SBC_FREQ_44100;
+		break;
+	case A2DP_SAMPLING_FREQ_48000:
+		sbc->frequency = SBC_FREQ_48000;
+		break;
+	default:
+		goto failed;
+	}
+
+	switch (a2dp->channel_mode) {
+	case A2DP_CHANNEL_MODE_MONO:
+		sbc->mode = SBC_MODE_MONO;
+		break;
+	case A2DP_CHANNEL_MODE_DUAL_CHANNEL:
+		sbc->mode = SBC_MODE_DUAL_CHANNEL;
+		break;
+	case A2DP_CHANNEL_MODE_STEREO:
+		sbc->mode = SBC_MODE_STEREO;
+		break;
+	case A2DP_CHANNEL_MODE_JOINT_STEREO:
+		sbc->mode = SBC_MODE_JOINT_STEREO;
+		break;
+	default:
+		goto failed;
+	}
+
+	switch (a2dp->allocation_method) {
+	case A2DP_ALLOCATION_SNR:
+		sbc->allocation = SBC_AM_SNR;
+		break;
+	case A2DP_ALLOCATION_LOUDNESS:
+		sbc->allocation = SBC_AM_LOUDNESS;
+		break;
+	default:
+		goto failed;
+	}
+
+	switch (a2dp->subbands) {
+	case A2DP_SUBBANDS_4:
+		sbc->subbands = SBC_SB_4;
+		break;
+	case A2DP_SUBBANDS_8:
+		sbc->subbands = SBC_SB_8;
+		break;
+	default:
+		goto failed;
+	}
+
+	switch (a2dp->block_length) {
+	case A2DP_BLOCK_LENGTH_4:
+		sbc->blocks = SBC_BLK_4;
+		break;
+	case A2DP_BLOCK_LENGTH_8:
+		sbc->blocks = SBC_BLK_8;
+		break;
+	case A2DP_BLOCK_LENGTH_12:
+		sbc->blocks = SBC_BLK_12;
+		break;
+	case A2DP_BLOCK_LENGTH_16:
+		sbc->blocks = SBC_BLK_16;
+		break;
+	default:
+		goto failed;
+	}
+
+	return 0;
+
+failed:
+	sbc_finish(sbc);
+	return -EINVAL;
+}
+
 SBC_EXPORT ssize_t sbc_parse(sbc_t *sbc, const void *input, size_t input_len)
 {
 	return sbc_decode(sbc, input, input_len, NULL, 0, NULL);
diff --git a/sbc/sbc.h b/sbc/sbc.h
index 5f8a1fc..32eb2e9 100644
--- a/sbc/sbc.h
+++ b/sbc/sbc.h
@@ -84,6 +84,8 @@ typedef struct sbc_struct sbc_t;
 int sbc_init(sbc_t *sbc, unsigned long flags);
 int sbc_reinit(sbc_t *sbc, unsigned long flags);
 int sbc_init_msbc(sbc_t *sbc, unsigned long flags);
+int sbc_init_a2dp(sbc_t *sbc, unsigned long flags,
+					const void *conf, size_t conf_len);
 
 ssize_t sbc_parse(sbc_t *sbc, const void *input, size_t input_len);
 
-- 
1.8.4.2


^ permalink raw reply related

* [PATCH SBC v5 2/2] sbc: Add sbc_init_a2dp to sbc.sym
From: Luiz Augusto von Dentz @ 2014-01-21  9:08 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1390295313-5951-1-git-send-email-luiz.dentz@gmail.com>

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

---
 sbc/sbc.sym | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/sbc/sbc.sym b/sbc/sbc.sym
index 3a0c6bf..0c23a05 100644
--- a/sbc/sbc.sym
+++ b/sbc/sbc.sym
@@ -19,3 +19,7 @@ SBC_1.1 {
 global:
 	sbc_init_msbc;
 } SBC_1.0;
+SBC_1.2 {
+global:
+	sbc_init_a2dp;
+} SBC_1.1;
-- 
1.8.4.2


^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox