2020-11-16 23:43:58

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: [RFC BlueZ 1/2] avdtp: Fix connecting using streaming mode with signalling channel

From: Luiz Augusto von Dentz <[email protected]>

Signalling channel shall only use Basic or ERTM modes.
---
profiles/audio/avdtp.c | 26 ++++++++++++++++----------
1 file changed, 16 insertions(+), 10 deletions(-)

diff --git a/profiles/audio/avdtp.c b/profiles/audio/avdtp.c
index 16fa20bba..619b94e29 100644
--- a/profiles/audio/avdtp.c
+++ b/profiles/audio/avdtp.c
@@ -2429,20 +2429,13 @@ uint16_t avdtp_get_version(struct avdtp *session)
return session->version;
}

-static GIOChannel *l2cap_connect(struct avdtp *session)
+static GIOChannel *l2cap_connect(struct avdtp *session, BtIOMode mode)
{
GError *err = NULL;
GIOChannel *io;
const bdaddr_t *src;
- BtIOMode mode;
-
src = btd_adapter_get_address(device_get_adapter(session->device));

- if (btd_opts.mps == MPS_OFF)
- mode = BT_IO_MODE_BASIC;
- else
- mode = BT_IO_MODE_STREAMING;
-
if (session->phy)
io = bt_io_connect(avdtp_connect_cb, session,
NULL, &err,
@@ -2610,7 +2603,14 @@ static int send_req(struct avdtp *session, gboolean priority,
int err, timeout;

if (session->state == AVDTP_SESSION_STATE_DISCONNECTED) {
- session->io = l2cap_connect(session);
+ BtIOMode mode;
+
+ if (btd_opts.mps == MPS_OFF)
+ mode = BT_IO_MODE_BASIC;
+ else
+ mode = BT_IO_MODE_ERTM;
+
+ session->io = l2cap_connect(session, mode);
if (!session->io) {
/* Report disconnection anyways, as the other layers
* are using this state for cleanup.
@@ -2807,8 +2807,14 @@ static gboolean avdtp_open_resp(struct avdtp *session, struct avdtp_stream *stre
struct seid_rej *resp, int size)
{
struct avdtp_local_sep *sep = stream->lsep;
+ BtIOMode mode;
+
+ if (btd_opts.mps == MPS_OFF)
+ mode = BT_IO_MODE_BASIC;
+ else
+ mode = BT_IO_MODE_STREAMING;

- stream->io = l2cap_connect(session);
+ stream->io = l2cap_connect(session, mode);
if (!stream->io) {
avdtp_sep_set_state(session, sep, AVDTP_STATE_IDLE);
return FALSE;
--
2.26.2


2020-11-17 00:59:00

by bluez.test.bot

[permalink] [raw]
Subject: RE: [RFC,BlueZ,1/2] avdtp: Fix connecting using streaming mode with signalling channel

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=385541

---Test result---

##############################
Test: CheckPatch - FAIL
Output:
main.conf: Add option to configure AVDP session/stream channel modes
WARNING:TYPO_SPELLING: 'prefered' may be misspelled - perhaps 'preferred'?
#7:
This adds a new group AVDTP where platform can confure the prefered

WARNING:STATIC_CONST_CHAR_ARRAY: static const char * array should probably be static const char * const
#101: FILE: src/main.c:141:
+static const char *avdtp_options[] = {

- total: 0 errors, 2 warnings, 150 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.

"[PATCH] main.conf: Add option to configure AVDP session/stream" has style problems, please review.

NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPLIT_STRING SSCANF_TO_KSTRTO

NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.


##############################
Test: CheckGitLint - PASS

##############################
Test: CheckBuild - PASS

##############################
Test: MakeCheck - PASS



---
Regards,
Linux Bluetooth

2020-11-17 14:46:29

by Alain Michaud

[permalink] [raw]
Subject: Re: [RFC BlueZ 1/2] avdtp: Fix connecting using streaming mode with signalling channel

On Mon, Nov 16, 2020 at 7:22 PM Luiz Augusto von Dentz
<[email protected]> wrote:
>
> From: Luiz Augusto von Dentz <[email protected]>
>
> Signalling channel shall only use Basic or ERTM modes.

Reviewed-by: Alain Michaud <[email protected]>
Tested-by: Alain Michaud <[email protected]>

> ---
> profiles/audio/avdtp.c | 26 ++++++++++++++++----------
> 1 file changed, 16 insertions(+), 10 deletions(-)
>
> diff --git a/profiles/audio/avdtp.c b/profiles/audio/avdtp.c
> index 16fa20bba..619b94e29 100644
> --- a/profiles/audio/avdtp.c
> +++ b/profiles/audio/avdtp.c
> @@ -2429,20 +2429,13 @@ uint16_t avdtp_get_version(struct avdtp *session)
> return session->version;
> }
>
> -static GIOChannel *l2cap_connect(struct avdtp *session)
> +static GIOChannel *l2cap_connect(struct avdtp *session, BtIOMode mode)
> {
> GError *err = NULL;
> GIOChannel *io;
> const bdaddr_t *src;
> - BtIOMode mode;
> -
> src = btd_adapter_get_address(device_get_adapter(session->device));
>
> - if (btd_opts.mps == MPS_OFF)
> - mode = BT_IO_MODE_BASIC;
> - else
> - mode = BT_IO_MODE_STREAMING;
> -
> if (session->phy)
> io = bt_io_connect(avdtp_connect_cb, session,
> NULL, &err,
> @@ -2610,7 +2603,14 @@ static int send_req(struct avdtp *session, gboolean priority,
> int err, timeout;
>
> if (session->state == AVDTP_SESSION_STATE_DISCONNECTED) {
> - session->io = l2cap_connect(session);
> + BtIOMode mode;
> +
> + if (btd_opts.mps == MPS_OFF)
> + mode = BT_IO_MODE_BASIC;
> + else
> + mode = BT_IO_MODE_ERTM;
> +
> + session->io = l2cap_connect(session, mode);
> if (!session->io) {
> /* Report disconnection anyways, as the other layers
> * are using this state for cleanup.
> @@ -2807,8 +2807,14 @@ static gboolean avdtp_open_resp(struct avdtp *session, struct avdtp_stream *stre
> struct seid_rej *resp, int size)
> {
> struct avdtp_local_sep *sep = stream->lsep;
> + BtIOMode mode;
> +
> + if (btd_opts.mps == MPS_OFF)
> + mode = BT_IO_MODE_BASIC;
> + else
> + mode = BT_IO_MODE_STREAMING;
>
> - stream->io = l2cap_connect(session);
> + stream->io = l2cap_connect(session, mode);
> if (!stream->io) {
> avdtp_sep_set_state(session, sep, AVDTP_STATE_IDLE);
> return FALSE;
> --
> 2.26.2
>