* [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
* Re: Unable to use Sony Dualshock 4 game controller
From: Szymon Janc @ 2014-01-21 11:06 UTC (permalink / raw)
To: Christopher Rosell; +Cc: linux-bluetooth
In-Reply-To: <CAPk--xzV9n5-RnAhPhbM2hCnftvJxeCm9E0Wgkj+zzdqNqseVQ@mail.gmail.com>
Hi Christopher,
On Friday 20 of December 2013 16:43:17 Christopher Rosell wrote:
> Hello there,
>
> I'm attempting to use a Sony Dualshock 4 game controller with bluez,
> but have run into some problems. I'm running Linux kernel 3.12.4 on
> Arch Linux with bluez 5.12.
>
> The DS4 is a standard bluetooth device, unlike the DS3 and I was able
> to pair and use it without any problems in Windows 7, but in Linux I
> have not been able to get it working correctly. The controller can be
> started in two modes, a pairing mode by pressing the buttons Share and
> PS at the same time and a normal mode by pressing the PS button only.
Please check BlueZ 5.14.
--
Best regards,
Szymon Janc
^ permalink raw reply
* unknown main item tag 0x0
From: Alexander Holler @ 2014-01-21 11:32 UTC (permalink / raw)
To: linux-bluetooth
Hello,
I can't remember since when I'm seeing the kernel message "unknown main
item tag 0x0" for many Bluetooth input devices, but it is since quiet
some time.
Has someone already tried to find out where that does come from?
My first guess would be that bluez misses one or more bytes a connection
startup, which is based on the fact that, since ever, it misses the
first keystroke of BT-keyboards too (the keystroke which wakes up the
keyboard and initiates the connection). And I'm pretty sure my keyboard
does transmit that initiating keystroke, because Windows receives it. ;)
Besides that, that guess isn't based on anything. I neither have tried
to search through the source nor did I run some tests.
But because I'm curious I can't completely ignore that kernel message,
even if I haven't experienced any obvious problems. So here is the
question if someone else has a pointer or has already searched what the
reason for that message is. I don't think it's a fault of the used
device(s), as I see this message for multiple bt-input-devices.
Regards,
Alexander Holler
^ permalink raw reply
* Re: [PATCH BlueZ 2/2] android/A2DP: Fix sending notification on bt_a2dp_unregister
From: Luiz Augusto von Dentz @ 2014-01-21 11:41 UTC (permalink / raw)
To: linux-bluetooth@vger.kernel.org
In-Reply-To: <1390220727-21494-2-git-send-email-luiz.dentz@gmail.com>
Hi,
On Mon, Jan 20, 2014 at 2:25 PM, Luiz Augusto von Dentz
<luiz.dentz@gmail.com> wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
>
> At this point IPC might have been closed already.
> ---
> android/a2dp.c | 13 ++++---------
> 1 file changed, 4 insertions(+), 9 deletions(-)
>
> diff --git a/android/a2dp.c b/android/a2dp.c
> index 8ec03c8..5569691 100644
> --- a/android/a2dp.c
> +++ b/android/a2dp.c
> @@ -119,8 +119,10 @@ static void unregister_endpoint(void *data)
> g_free(endpoint);
> }
>
> -static void a2dp_device_free(struct a2dp_device *dev)
> +static void a2dp_device_free(void *data)
> {
> + struct a2dp_device *dev = data;
> +
> if (dev->idle_id > 0)
> g_source_remove(dev->idle_id);
>
> @@ -1471,13 +1473,6 @@ fail:
> return false;
> }
>
> -static void a2dp_device_disconnected(gpointer data, gpointer user_data)
> -{
> - struct a2dp_device *dev = data;
> -
> - bt_a2dp_notify_state(dev, HAL_A2DP_STATE_DISCONNECTED);
> -}
> -
> void bt_a2dp_unregister(void)
> {
> DBG("");
> @@ -1488,7 +1483,7 @@ void bt_a2dp_unregister(void)
> g_slist_free_full(endpoints, unregister_endpoint);
> endpoints = NULL;
>
> - g_slist_foreach(devices, a2dp_device_disconnected, NULL);
> + g_slist_free_full(devices, a2dp_device_free);
> devices = NULL;
>
> ipc_unregister(HAL_SERVICE_ID_A2DP);
> --
> 1.8.4.2
Applied, patch 1/2 will need some changes so it is not applied yet.
--
Luiz Augusto von Dentz
^ permalink raw reply
* [PATCH_v2 1/2] android/hidhost: Fix miscalculation of get report event notification length
From: Ravi kumar Veeramally @ 2014-01-21 12:24 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Ravi kumar Veeramally
Event length is size of struct + data len (if any). It is miscalulated.
---
android/hidhost.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/android/hidhost.c b/android/hidhost.c
index 3da77c8..108493a 100644
--- a/android/hidhost.c
+++ b/android/hidhost.c
@@ -371,7 +371,7 @@ static void bt_hid_notify_get_report(struct hid_device *dev, uint8_t *buf,
ba2str(&dev->dst, address);
DBG("device %s", address);
- ev_len = sizeof(*ev) + sizeof(struct hal_ev_hidhost_get_report) + 1;
+ ev_len = sizeof(*ev);
if (!((buf[0] == (HID_MSG_DATA | HID_DATA_TYPE_INPUT)) ||
(buf[0] == (HID_MSG_DATA | HID_DATA_TYPE_OUTPUT)) ||
--
1.8.3.2
^ permalink raw reply related
* [PATCH_v2 2/2] android/tester: Add HIDhost GetReport test
From: Ravi kumar Veeramally @ 2014-01-21 12:24 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Ravi kumar Veeramally
In-Reply-To: <1390307059-7772-1-git-send-email-ravikumar.veeramally@linux.intel.com>
---
android/android-tester.c | 64 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 64 insertions(+)
diff --git a/android/android-tester.c b/android/android-tester.c
index 9a17612..e0b4579 100644
--- a/android/android-tester.c
+++ b/android/android-tester.c
@@ -3206,6 +3206,10 @@ static void setup_hidhost_interface(const void *test_data)
#define HID_SEND_DATA 0xa2
+#define HID_GET_INPUT_REPORT 0x49
+#define HID_GET_OUTPUT_REPORT 0x4a
+#define HID_GET_FEATURE_REPORT 0x4b
+
static void hid_prepare_reply_protocol_mode(const void *data, uint16_t len)
{
struct test_data *t_data = tester_get_data();
@@ -3221,6 +3225,22 @@ static void hid_prepare_reply_protocol_mode(const void *data, uint16_t len)
(void *)pdu, pdu_len);
}
+static void hid_prepare_reply_report(const void *data, uint16_t len)
+{
+ struct test_data *t_data = tester_get_data();
+ struct bthost *bthost = hciemu_client_get_host(t_data->hciemu);
+ uint8_t pdu[3] = { 0, 0, 0 };
+ uint16_t pdu_len = 0;
+
+ pdu_len = 3;
+ pdu[0] = 0xa2;
+ pdu[1] = 0x01;
+ pdu[2] = 0x00;
+
+ bthost_send_cid(bthost, t_data->ctrl_handle, t_data->ctrl_cid,
+ (void *)pdu, pdu_len);
+}
+
static void hid_intr_cid_hook_cb(const void *data, uint16_t len,
void *user_data)
{
@@ -3255,6 +3275,11 @@ static void hid_ctrl_cid_hook_cb(const void *data, uint16_t len,
case HID_SET_BOOT_PROTOCOL:
hid_prepare_reply_protocol_mode(data, len);
break;
+ case HID_GET_INPUT_REPORT:
+ case HID_GET_OUTPUT_REPORT:
+ case HID_GET_FEATURE_REPORT:
+ hid_prepare_reply_report(data, len);
+ break;
/* HID device doesnot reply for this commads, so reaching pdu's
* to hid device means assuming test passed */
case HID_SET_INPUT_REPORT:
@@ -3514,6 +3539,41 @@ static void test_hidhost_send_data(const void *test_data)
tester_test_failed();
}
+static void hid_get_report_cb(bt_bdaddr_t *bd_addr, bthh_status_t status,
+ uint8_t *report, int size)
+{
+ struct test_data *data = tester_get_data();
+ const struct hidhost_generic_data *test = data->test_data;
+
+ if (data->cb_count == test->expected_cb_count &&
+ status == test->expected_status &&
+ size == test->expected_report_size)
+ tester_test_passed();
+ else
+ tester_test_failed();
+}
+
+static const struct hidhost_generic_data hidhost_test_get_report = {
+ .expected_hal_cb.get_report_cb = hid_get_report_cb,
+ .expected_cb_count = 1,
+ .expected_status = BTHH_OK,
+ .expected_report_size = 2,
+};
+
+static void test_hidhost_get_report(const void *test_data)
+{
+ struct test_data *data = tester_get_data();
+ const uint8_t *hid_addr = hciemu_get_client_bdaddr(data->hciemu);
+ bt_bdaddr_t bdaddr;
+ bt_status_t bt_status;
+
+ data->cb_count = 0;
+ bdaddr2android((const bdaddr_t *) hid_addr, &bdaddr);
+ bt_status = data->if_hid->get_report(&bdaddr, BTHH_INPUT_REPORT, 1, 20);
+ if (bt_status != BT_STATUS_SUCCESS)
+ tester_test_failed();
+}
+
#define test_bredrle(name, data, test_setup, test, test_teardown) \
do { \
struct test_data *user; \
@@ -3879,6 +3939,10 @@ int main(int argc, char *argv[])
&hidhost_test_get_protocol, setup_hidhost_connect,
test_hidhost_set_protocol, teardown);
+ test_bredrle("HIDHost GetReport Success",
+ &hidhost_test_get_report, setup_hidhost_connect,
+ test_hidhost_get_report, teardown);
+
test_bredrle("HIDHost SetReport Success",
NULL, setup_hidhost_connect,
test_hidhost_set_report, teardown);
--
1.8.3.2
^ permalink raw reply related
* Re: [PATCH 1/2] android: Add btmgmt to debug builds
From: Johan Hedberg @ 2014-01-21 12:56 UTC (permalink / raw)
To: Marcel Holtmann
Cc: Andrzej Kaczmarek, linux-bluetooth@vger.kernel.org development
In-Reply-To: <BE345789-E478-4C6C-B192-4DAB782CE135@holtmann.org>
Hi Marcel,
On Thu, Jan 16, 2014, Marcel Holtmann wrote:
> > android/Android.mk | 36 ++++++++++++++++++++++++++++++++++++
> > 1 file changed, 36 insertions(+)
> >
> > diff --git a/android/Android.mk b/android/Android.mk
> > index 7e97ec8..b3e6a50 100644
> > --- a/android/Android.mk
> > +++ b/android/Android.mk
> > @@ -282,3 +282,39 @@ LOCAL_MODULE_TAGS := optional
> > LOCAL_MODULE := bluetoothd-snoop
> >
> > include $(BUILD_EXECUTABLE)
> > +
> > +#
> > +# btmgmt
> > +#
> > +
> > +include $(CLEAR_VARS)
> > +
> > +LOCAL_SRC_FILES := \
> > + ../tools/btmgmt.c \
> > + ../monitor/mainloop.c \
> > + ../lib/bluetooth.c \
> > + ../lib/sdp.c \
> > + ../src/eir.c \
> > + ../src/glib-helper.c \
> > + ../src/shared/io-mainloop.c \
> > + ../src/shared/mgmt.c \
> > + ../src/shared/queue.c \
> > + ../src/shared/util.c \
> > +
> > +LOCAL_C_INCLUDES := \
> > + $(call include-path-for, glib) \
> > + $(call include-path-for, glib)/glib \
> > + $(LOCAL_PATH)/.. \
> > + $(LOCAL_PATH)/../src \
> > + $(LOCAL_PATH)/../lib \
> > +
> > +LOCAL_SHARED_LIBRARIES := \
> > + libglib \
>
> have Johan fix the dependency on GLib instead. It should not be needed anymore.
btmgmt is now free of GLib so Andrzej is free to send a new patch for
the Android build.
Johan
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox