Skip to contentSkip to conversation

Volume Control Profile

PATCH Superseded Sathish Narasimman 5 participants 9 messages Sep 12, 2022 – Sep 15, 2022

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover Volume Control Profile

Initial Development of Volment Control profile and its service Volume Control Service.

Sathish Narasimman (4):
lib/uuid: Add VCS UUIDs
shared/vcp: Add initial code for handling VCP
profiles: Add initial code for vcp plugin monitor/att: Add decoding support for Volume Control Serice

 Makefile.am          |    1 +
 Makefile.plugins     |    5 +
 configure.ac         |    4 +
 lib/uuid.h           |    7 +
 monitor/att.c        |  159 +++++++
 profiles/audio/vcp.c |  312 +++++++++++++
 src/shared/vcp.c     | 1033 ++++++++++++++++++++++++++++++++++++++++++
 src/shared/vcp.h     |   58 +++
 8 files changed, 1579 insertions(+)
 create mode 100644 profiles/audio/vcp.c
 create mode 100644 src/shared/vcp.c
 create mode 100644 src/shared/vcp.h
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/4 lib/uuid: Add VCS UUIDs

This adds Volume Control Service UUIDs which will be used by Volume Control Profile.

---
 lib/uuid.h | 7 +++++++
 1 file changed, 7 insertions(+)
lib/uuid.h +7 -0
index cb9294be8c6e..f667a74b9b73 100644
@@ -164,6 +164,13 @@ extern "C" {
 #define ASE_SOURCE_UUID					0x2bc5
 #define ASE_CP_UUID					0x2bc6
 
+#define VCS_UUID					0x1844
+#define VOL_OFFSET_CS_UUID				0x1845
+#define AUDIO_INPUT_CS_UUID				0x1843
+#define VOL_STATE_CHRC_UUID				0x2B7D
+#define VOL_CP_CHRC_UUID				0x2B7E
+#define VOL_FLAG_CHRC_UUID				0x2B7F
+
 typedef struct {
 	enum {
 		BT_UUID_UNSPEC = 0,
Signature · 1 line
2.25.1
#2 lore raw

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=676220

---Test result---

Test Summary:

CheckPatch                    FAIL      5.79 seconds
GitLint                       PASS      3.00 seconds
Prep - Setup ELL              PASS      31.92 seconds
Build - Prep                  PASS      0.90 seconds
Build - Configure             PASS      9.87 seconds
Build - Make                  PASS      1165.82 seconds
Make Check                    PASS      12.98 seconds
Make Check w/Valgrind         PASS      355.07 seconds
Make Distcheck                PASS      306.75 seconds
Build w/ext ELL - Configure   PASS      10.50 seconds
Build w/ext ELL - Make        PASS      107.90 seconds
Incremental Build w/ patches  PASS      510.36 seconds
Scan Build                    WARNING   1238.26 seconds

Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script with rule in .checkpatch.conf Output:
[BlueZ,2/4] shared/vcp: Add initial code for handling VCP WARNING:LONG_LINE: line length of 88 exceeds 80 columns #393: FILE: src/shared/vcp.c:302:
+ gatt_db_attribute_notify(vdb->vcs->vs, (void *)vstate, sizeof(struct vol_state),

WARNING:LONG_LINE: line length of 88 exceeds 80 columns #425: FILE: src/shared/vcp.c:334:
+ gatt_db_attribute_notify(vdb->vcs->vs, (void *)vstate, sizeof(struct vol_state),

WARNING:LONG_LINE: line length of 88 exceeds 80 columns #458: FILE: src/shared/vcp.c:367:
+ gatt_db_attribute_notify(vdb->vcs->vs, (void *)vstate, sizeof(struct vol_state),

WARNING:LONG_LINE: line length of 88 exceeds 80 columns #491: FILE: src/shared/vcp.c:400:
+ gatt_db_attribute_notify(vdb->vcs->vs, (void *)vstate, sizeof(struct vol_state),

WARNING:LONG_LINE: line length of 88 exceeds 80 columns #523: FILE: src/shared/vcp.c:432:
+ gatt_db_attribute_notify(vdb->vcs->vs, (void *)vstate, sizeof(struct vol_state),

WARNING:LONG_LINE: line length of 88 exceeds 80 columns #555: FILE: src/shared/vcp.c:464:
+ gatt_db_attribute_notify(vdb->vcs->vs, (void *)vstate, sizeof(struct vol_state),

WARNING:LONG_LINE: line length of 82 exceeds 80 columns #1051: FILE: src/shared/vcp.c:960:
+ value_handle, vcp_vstate_register,

WARNING:LONG_LINE: line length of 81 exceeds 80 columns #1080: FILE: src/shared/vcp.c:989:
+ value_handle, vcp_vflag_register,

WARNING:PREFER_DEFINED_ATTRIBUTE_MACRO: Prefer __packed over __attribute__((packed)) #1146: FILE: src/shared/vcp.h:16:
+#define __packed __attribute__((packed))

/github/workspace/src/12973630.patch total: 0 errors, 9 warnings, 1098 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.

/github/workspace/src/12973630.patch has style problems, please review.

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

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

[BlueZ,3/4] profiles: Add initial code for vcp plugin ERROR:INITIALISED_STATIC: do not initialise statics to 0 #395: FILE: profiles/audio/vcp.c:288:
+static unsigned int vcp_id = 0;

/github/workspace/src/12973633.patch total: 1 errors, 0 warnings, 330 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.

/github/workspace/src/12973633.patch has style problems, please review.

NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG 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: Scan Build - WARNING
Desc: Run Scan Build with patches
Output:
*****************************************************************************
The bugs reported by the scan-build may or may not be caused by your patches.
Please check the list and fix the bugs if they are caused by your patch.
*****************************************************************************
src/shared/vcp.c:288:11: warning: Access to field 'vcs' results in a dereference of a null pointer (loaded from variable 'vdb')

        vstate = vdb->vcs->vstate;
                 ^~~~~~~~
src/shared/vcp.c:294:25: warning: Access to field 'counter' results in a dereference of a null pointer (loaded from variable 'vstate')
        if (*change_counter != vstate->counter) {
                               ^~~~~~~~~~~~~~~
src/shared/vcp.c:320:11: warning: Access to field 'vcs' results in a dereference of a null pointer (loaded from variable 'vdb')
        vstate = vdb->vcs->vstate;
                 ^~~~~~~~
src/shared/vcp.c:326:25: warning: Access to field 'counter' results in a dereference of a null pointer (loaded from variable 'vstate')
        if (*change_counter != vstate->counter) {
                               ^~~~~~~~~~~~~~~
src/shared/vcp.c:352:11: warning: Access to field 'vcs' results in a dereference of a null pointer (loaded from variable 'vdb')
        vstate = vdb->vcs->vstate;
                 ^~~~~~~~
src/shared/vcp.c:358:25: warning: Access to field 'counter' results in a dereference of a null pointer (loaded from variable 'vstate')
        if (*change_counter != vstate->counter) {
                               ^~~~~~~~~~~~~~~
src/shared/vcp.c:385:11: warning: Access to field 'vcs' results in a dereference of a null pointer (loaded from variable 'vdb')
        vstate = vdb->vcs->vstate;
                 ^~~~~~~~
src/shared/vcp.c:391:25: warning: Access to field 'counter' results in a dereference of a null pointer (loaded from variable 'vstate')
        if (*change_counter != vstate->counter) {
                               ^~~~~~~~~~~~~~~
src/shared/vcp.c:418:11: warning: Access to field 'vcs' results in a dereference of a null pointer (loaded from variable 'vdb')
        vstate = vdb->vcs->vstate;
                 ^~~~~~~~
src/shared/vcp.c:424:29: warning: Access to field 'counter' results in a dereference of a null pointer (loaded from variable 'vstate')
        if (req->change_counter != vstate->counter) {
                                   ^~~~~~~~~~~~~~~
src/shared/vcp.c:450:11: warning: Access to field 'vcs' results in a dereference of a null pointer (loaded from variable 'vdb')
        vstate = vdb->vcs->vstate;
                 ^~~~~~~~
src/shared/vcp.c:456:25: warning: Access to field 'counter' results in a dereference of a null pointer (loaded from variable 'vstate')
        if (*change_counter != vstate->counter) {
                               ^~~~~~~~~~~~~~~
src/shared/vcp.c:482:11: warning: Access to field 'vcs' results in a dereference of a null pointer (loaded from variable 'vdb')
        vstate = vdb->vcs->vstate;
                 ^~~~~~~~
src/shared/vcp.c:488:25: warning: Access to field 'counter' results in a dereference of a null pointer (loaded from variable 'vstate')
        if (*change_counter != vstate->counter) {
                               ^~~~~~~~~~~~~~~

14 warnings generated.

---
Regards,
Linux Bluetooth

#3 lore raw

Hi Sathish,

Quoted 148 lines · On Mon, Sep 12, 2022 at 7:08 AM <[email protected]> wrote:

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=676220

---Test result---

Test Summary:

CheckPatch                    FAIL      5.79 seconds
GitLint                       PASS      3.00 seconds
Prep - Setup ELL              PASS      31.92 seconds
Build - Prep                  PASS      0.90 seconds
Build - Configure             PASS      9.87 seconds
Build - Make                  PASS      1165.82 seconds
Make Check                    PASS      12.98 seconds
Make Check w/Valgrind         PASS      355.07 seconds
Make Distcheck                PASS      306.75 seconds
Build w/ext ELL - Configure   PASS      10.50 seconds
Build w/ext ELL - Make        PASS      107.90 seconds
Incremental Build w/ patches  PASS      510.36 seconds
Scan Build                    WARNING   1238.26 seconds

Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script with rule in .checkpatch.conf Output:
[BlueZ,2/4] shared/vcp: Add initial code for handling VCP WARNING:LONG_LINE: line length of 88 exceeds 80 columns #393: FILE: src/shared/vcp.c:302:
+ gatt_db_attribute_notify(vdb->vcs->vs, (void *)vstate, sizeof(struct vol_state),

WARNING:LONG_LINE: line length of 88 exceeds 80 columns #425: FILE: src/shared/vcp.c:334:
+ gatt_db_attribute_notify(vdb->vcs->vs, (void *)vstate, sizeof(struct vol_state),

WARNING:LONG_LINE: line length of 88 exceeds 80 columns #458: FILE: src/shared/vcp.c:367:
+ gatt_db_attribute_notify(vdb->vcs->vs, (void *)vstate, sizeof(struct vol_state),

WARNING:LONG_LINE: line length of 88 exceeds 80 columns #491: FILE: src/shared/vcp.c:400:
+ gatt_db_attribute_notify(vdb->vcs->vs, (void *)vstate, sizeof(struct vol_state),

WARNING:LONG_LINE: line length of 88 exceeds 80 columns #523: FILE: src/shared/vcp.c:432:
+ gatt_db_attribute_notify(vdb->vcs->vs, (void *)vstate, sizeof(struct vol_state),

WARNING:LONG_LINE: line length of 88 exceeds 80 columns #555: FILE: src/shared/vcp.c:464:
+ gatt_db_attribute_notify(vdb->vcs->vs, (void *)vstate, sizeof(struct vol_state),

WARNING:LONG_LINE: line length of 82 exceeds 80 columns #1051: FILE: src/shared/vcp.c:960:
+ value_handle, vcp_vstate_register,

WARNING:LONG_LINE: line length of 81 exceeds 80 columns #1080: FILE: src/shared/vcp.c:989:
+ value_handle, vcp_vflag_register,

WARNING:PREFER_DEFINED_ATTRIBUTE_MACRO: Prefer __packed over __attribute__((packed)) #1146: FILE: src/shared/vcp.h:16:
+#define __packed __attribute__((packed))

/github/workspace/src/12973630.patch total: 0 errors, 9 warnings, 1098 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.

/github/workspace/src/12973630.patch has style problems, please review.

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

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

[BlueZ,3/4] profiles: Add initial code for vcp plugin ERROR:INITIALISED_STATIC: do not initialise statics to 0 #395: FILE: profiles/audio/vcp.c:288:
+static unsigned int vcp_id = 0;

/github/workspace/src/12973633.patch total: 1 errors, 0 warnings, 330 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.

/github/workspace/src/12973633.patch has style problems, please review.

NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG 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: Scan Build - WARNING
Desc: Run Scan Build with patches
Output:
*****************************************************************************
The bugs reported by the scan-build may or may not be caused by your patches.
Please check the list and fix the bugs if they are caused by your patch.
*****************************************************************************
src/shared/vcp.c:288:11: warning: Access to field 'vcs' results in a dereference of a null pointer (loaded from variable 'vdb')

        vstate = vdb->vcs->vstate;
                 ^~~~~~~~
src/shared/vcp.c:294:25: warning: Access to field 'counter' results in a dereference of a null pointer (loaded from variable 'vstate')
        if (*change_counter != vstate->counter) {
                               ^~~~~~~~~~~~~~~
src/shared/vcp.c:320:11: warning: Access to field 'vcs' results in a dereference of a null pointer (loaded from variable 'vdb')
        vstate = vdb->vcs->vstate;
                 ^~~~~~~~
src/shared/vcp.c:326:25: warning: Access to field 'counter' results in a dereference of a null pointer (loaded from variable 'vstate')
        if (*change_counter != vstate->counter) {
                               ^~~~~~~~~~~~~~~
src/shared/vcp.c:352:11: warning: Access to field 'vcs' results in a dereference of a null pointer (loaded from variable 'vdb')
        vstate = vdb->vcs->vstate;
                 ^~~~~~~~
src/shared/vcp.c:358:25: warning: Access to field 'counter' results in a dereference of a null pointer (loaded from variable 'vstate')
        if (*change_counter != vstate->counter) {
                               ^~~~~~~~~~~~~~~
src/shared/vcp.c:385:11: warning: Access to field 'vcs' results in a dereference of a null pointer (loaded from variable 'vdb')
        vstate = vdb->vcs->vstate;
                 ^~~~~~~~
src/shared/vcp.c:391:25: warning: Access to field 'counter' results in a dereference of a null pointer (loaded from variable 'vstate')
        if (*change_counter != vstate->counter) {
                               ^~~~~~~~~~~~~~~
src/shared/vcp.c:418:11: warning: Access to field 'vcs' results in a dereference of a null pointer (loaded from variable 'vdb')
        vstate = vdb->vcs->vstate;
                 ^~~~~~~~
src/shared/vcp.c:424:29: warning: Access to field 'counter' results in a dereference of a null pointer (loaded from variable 'vstate')
        if (req->change_counter != vstate->counter) {
                                   ^~~~~~~~~~~~~~~
src/shared/vcp.c:450:11: warning: Access to field 'vcs' results in a dereference of a null pointer (loaded from variable 'vdb')
        vstate = vdb->vcs->vstate;
                 ^~~~~~~~
src/shared/vcp.c:456:25: warning: Access to field 'counter' results in a dereference of a null pointer (loaded from variable 'vstate')
        if (*change_counter != vstate->counter) {
                               ^~~~~~~~~~~~~~~
src/shared/vcp.c:482:11: warning: Access to field 'vcs' results in a dereference of a null pointer (loaded from variable 'vdb')
        vstate = vdb->vcs->vstate;
                 ^~~~~~~~
src/shared/vcp.c:488:25: warning: Access to field 'counter' results in a dereference of a null pointer (loaded from variable 'vstate')
        if (*change_counter != vstate->counter) {
                               ^~~~~~~~~~~~~~~
Quoted 1 line

14 warnings generated.

Would you please fix the above problems, also Id reorder the patches so the monitor changes can be applied before the others.

Signature · 1 line
Luiz Augusto von Dentz
#4 lore raw

Hi Luiz

Updated v2 of the patch.
Please review

Quoted 159 lines · Luiz Augusto von Dentz

Hi Sathish,

Quoted 148 lines · On Mon, Sep 12, 2022 at 7:08 AM <[email protected]> wrote:

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=676220

---Test result---

Test Summary:

CheckPatch                    FAIL      5.79 seconds
GitLint                       PASS      3.00 seconds
Prep - Setup ELL              PASS      31.92 seconds
Build - Prep                  PASS      0.90 seconds
Build - Configure             PASS      9.87 seconds
Build - Make                  PASS      1165.82 seconds
Make Check                    PASS      12.98 seconds
Make Check w/Valgrind         PASS      355.07 seconds
Make Distcheck                PASS      306.75 seconds
Build w/ext ELL - Configure   PASS      10.50 seconds
Build w/ext ELL - Make        PASS      107.90 seconds
Incremental Build w/ patches  PASS      510.36 seconds
Scan Build                    WARNING   1238.26 seconds

Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script with rule in .checkpatch.conf Output:
[BlueZ,2/4] shared/vcp: Add initial code for handling VCP WARNING:LONG_LINE: line length of 88 exceeds 80 columns #393: FILE: src/shared/vcp.c:302:
+ gatt_db_attribute_notify(vdb->vcs->vs, (void *)vstate, sizeof(struct vol_state),

WARNING:LONG_LINE: line length of 88 exceeds 80 columns #425: FILE: src/shared/vcp.c:334:
+ gatt_db_attribute_notify(vdb->vcs->vs, (void *)vstate, sizeof(struct vol_state),

WARNING:LONG_LINE: line length of 88 exceeds 80 columns #458: FILE: src/shared/vcp.c:367:
+ gatt_db_attribute_notify(vdb->vcs->vs, (void *)vstate, sizeof(struct vol_state),

WARNING:LONG_LINE: line length of 88 exceeds 80 columns #491: FILE: src/shared/vcp.c:400:
+ gatt_db_attribute_notify(vdb->vcs->vs, (void *)vstate, sizeof(struct vol_state),

WARNING:LONG_LINE: line length of 88 exceeds 80 columns #523: FILE: src/shared/vcp.c:432:
+ gatt_db_attribute_notify(vdb->vcs->vs, (void *)vstate, sizeof(struct vol_state),

WARNING:LONG_LINE: line length of 88 exceeds 80 columns #555: FILE: src/shared/vcp.c:464:
+ gatt_db_attribute_notify(vdb->vcs->vs, (void *)vstate, sizeof(struct vol_state),

WARNING:LONG_LINE: line length of 82 exceeds 80 columns #1051: FILE: src/shared/vcp.c:960:
+ value_handle, vcp_vstate_register,

WARNING:LONG_LINE: line length of 81 exceeds 80 columns #1080: FILE: src/shared/vcp.c:989:
+ value_handle, vcp_vflag_register,

WARNING:PREFER_DEFINED_ATTRIBUTE_MACRO: Prefer __packed over __attribute__((packed)) #1146: FILE: src/shared/vcp.h:16:
+#define __packed __attribute__((packed))

/github/workspace/src/12973630.patch total: 0 errors, 9 warnings, 1098 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.

/github/workspace/src/12973630.patch has style problems, please review.

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

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

[BlueZ,3/4] profiles: Add initial code for vcp plugin ERROR:INITIALISED_STATIC: do not initialise statics to 0 #395: FILE: profiles/audio/vcp.c:288:
+static unsigned int vcp_id = 0;

/github/workspace/src/12973633.patch total: 1 errors, 0 warnings, 330 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.

/github/workspace/src/12973633.patch has style problems, please review.

NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG 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: Scan Build - WARNING
Desc: Run Scan Build with patches
Output:
*****************************************************************************
The bugs reported by the scan-build may or may not be caused by your patches.
Please check the list and fix the bugs if they are caused by your patch.
*****************************************************************************
src/shared/vcp.c:288:11: warning: Access to field 'vcs' results in a dereference of a null pointer (loaded from variable 'vdb')

        vstate = vdb->vcs->vstate;
                 ^~~~~~~~
src/shared/vcp.c:294:25: warning: Access to field 'counter' results in a dereference of a null pointer (loaded from variable 'vstate')
        if (*change_counter != vstate->counter) {
                               ^~~~~~~~~~~~~~~
src/shared/vcp.c:320:11: warning: Access to field 'vcs' results in a dereference of a null pointer (loaded from variable 'vdb')
        vstate = vdb->vcs->vstate;
                 ^~~~~~~~
src/shared/vcp.c:326:25: warning: Access to field 'counter' results in a dereference of a null pointer (loaded from variable 'vstate')
        if (*change_counter != vstate->counter) {
                               ^~~~~~~~~~~~~~~
src/shared/vcp.c:352:11: warning: Access to field 'vcs' results in a dereference of a null pointer (loaded from variable 'vdb')
        vstate = vdb->vcs->vstate;
                 ^~~~~~~~
src/shared/vcp.c:358:25: warning: Access to field 'counter' results in a dereference of a null pointer (loaded from variable 'vstate')
        if (*change_counter != vstate->counter) {
                               ^~~~~~~~~~~~~~~
src/shared/vcp.c:385:11: warning: Access to field 'vcs' results in a dereference of a null pointer (loaded from variable 'vdb')
        vstate = vdb->vcs->vstate;
                 ^~~~~~~~
src/shared/vcp.c:391:25: warning: Access to field 'counter' results in a dereference of a null pointer (loaded from variable 'vstate')
        if (*change_counter != vstate->counter) {
                               ^~~~~~~~~~~~~~~
src/shared/vcp.c:418:11: warning: Access to field 'vcs' results in a dereference of a null pointer (loaded from variable 'vdb')
        vstate = vdb->vcs->vstate;
                 ^~~~~~~~
src/shared/vcp.c:424:29: warning: Access to field 'counter' results in a dereference of a null pointer (loaded from variable 'vstate')
        if (req->change_counter != vstate->counter) {
                                   ^~~~~~~~~~~~~~~
src/shared/vcp.c:450:11: warning: Access to field 'vcs' results in a dereference of a null pointer (loaded from variable 'vdb')
        vstate = vdb->vcs->vstate;
                 ^~~~~~~~
src/shared/vcp.c:456:25: warning: Access to field 'counter' results in a dereference of a null pointer (loaded from variable 'vstate')
        if (*change_counter != vstate->counter) {
                               ^~~~~~~~~~~~~~~
src/shared/vcp.c:482:11: warning: Access to field 'vcs' results in a dereference of a null pointer (loaded from variable 'vdb')
        vstate = vdb->vcs->vstate;
                 ^~~~~~~~
src/shared/vcp.c:488:25: warning: Access to field 'counter' results in a dereference of a null pointer (loaded from variable 'vstate')
        if (*change_counter != vstate->counter) {
                               ^~~~~~~~~~~~~~~
Quoted 1 line

14 warnings generated.

Would you please fix the above problems, also Id reorder the patches so the monitor changes can be applied before the others.

--
Luiz Augusto von Dentz

#5 lore raw

PATCH 2/4 shared/vcp: Add initial code for handling VCP

In reply to Sathish Narasimman

This adds initial code for Volume Control Profile.

---
 Makefile.am      |    1 +
 src/shared/vcp.c | 1033 ++++++++++++++++++++++++++++++++++++++++++++++
 src/shared/vcp.h |   58 +++
 3 files changed, 1092 insertions(+)
 create mode 100644 src/shared/vcp.c
 create mode 100644 src/shared/vcp.h
Makefile.am +1 -0
index 960bf21bc726..27715c73d76f 100644
@@ -231,6 +231,7 @@ shared_sources = src/shared/io.h src/shared/timeout.h \
 			src/shared/gap.h src/shared/gap.c \
 			src/shared/log.h src/shared/log.c \
 			src/shared/bap.h src/shared/bap.c src/shared/ascs.h \
+			src/shared/vcp.c src/shared/vcp.h \
 			src/shared/lc3.h src/shared/tty.h
 
 if READLINE
src/shared/vcp.c new file +1033 -0

1,033 lines not on this page · raw message

src/shared/vcp.h new file +58 -0

58 lines not on this page · raw message

Signature · 1 line
2.25.1
#6 lore raw

PATCH 3/4 profiles: Add initial code for vcp plugin

In reply to Sathish Narasimman

This adds initial code for vcp plugin which handles Volume Control Profile and Volume Control Service.

---
 Makefile.plugins     |   5 +
 configure.ac         |   4 +
 profiles/audio/vcp.c | 312 +++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 321 insertions(+)
 create mode 100644 profiles/audio/vcp.c
Makefile.plugins +5 -0
index 213ed99edf2d..a3654980f86d 100644
@@ -121,3 +121,8 @@ if BAP
 builtin_modules += bap
 builtin_sources += profiles/audio/bap.c
 endif
+
+if VCP
+builtin_modules += vcp
+builtin_sources += profiles/audio/vcp.c
+endif
configure.ac +4 -0
index 1f76915b4349..79645e6917cc 100644
@@ -199,6 +199,10 @@ AC_ARG_ENABLE(bap, AS_HELP_STRING([--disable-bap],
 		[disable BAP profile]), [enable_bap=${enableval}])
 AM_CONDITIONAL(BAP, test "${enable_bap}" != "no")
 
+AC_ARG_ENABLE(vcp, AS_HELP_STRING([--disable-vcp],
+		[disable VCP profile]), [enable_vcp=${enableval}])
+AM_CONDITIONAL(VCP, test "${enable_vcp}" != "no")
+
 AC_ARG_ENABLE(tools, AS_HELP_STRING([--disable-tools],
 		[disable Bluetooth tools]), [enable_tools=${enableval}])
 AM_CONDITIONAL(TOOLS, test "${enable_tools}" != "no")
profiles/audio/vcp.c new file +312 -0

312 lines not on this page · raw message

Signature · 1 line
2.25.1
#7 lore raw

PATCH 4/4 monitor/att: Add decoding support for Volume Control Serice

In reply to Sathish Narasimman

This adds decoding support for VCS attributes

Quoted 1 line

ACL Data RX: Handle 3585 flags 0x02 dlen 7

      ATT: Read Request (0x0a) len 2
        Handle: 0x0017 Type: Volume State (0x2b7d)

< ACL Data TX: Handle 3585 flags 0x00 dlen 8
ATT: Read Response (0x0b) len 3
Value: 000000
Handle: 0x0017 Type: Volume State (0x2b7d)
Volume Setting: 0
Not Muted: 0
Change Counter: 0

Quoted 1 line

HCI Event: Number of Completed Packets (0x13) plen 5

Num handles: 1
Handle: 3585 Address: 49:71:FC:C0:66:C6 (Resolvable)
Count: 1

Quoted 1 line

ACL Data RX: Handle 3585 flags 0x02 dlen 7

      ATT: Read Request (0x0a) len 2
        Handle: 0x001c Type: Volume Flags (0x2b7f)
< ACL Data TX: Handle 3585 flags 0x00 dlen 6
      ATT: Read Response (0x0b) len 1
        Value: 01
        Handle: 0x001c Type: Volume Flags (0x2b7f)
            Volume Falg: 1
---
 monitor/att.c | 159 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 159 insertions(+)
monitor/att.c +159 -0
index b7470f7a2ff4..3c1ff2e2aaa0 100644
@@ -1590,6 +1590,162 @@ static void pac_context_notify(const struct l2cap_frame *frame)
 	print_pac_context(frame);
 }
 
+static void print_vcs_state(const struct l2cap_frame *frame)
+{
+	uint8_t vol_set, mute, chng_ctr;
+
+	if (!l2cap_frame_get_u8((void *)frame, &vol_set)) {
+		print_text(COLOR_ERROR, "Volume Settings: invalid size");
+		goto done;
+	}
+	print_field("    Volume Setting: %u", vol_set);
+
+	if (!l2cap_frame_get_u8((void *)frame, &mute)) {
+		print_text(COLOR_ERROR, "Mute Filed: invalid size");
+		goto done;
+	}
+
+	switch (mute) {
+	case 0x00:
+		print_field("    Not Muted: %u", mute);
+		break;
+	case 0x01:
+		print_field("    Muted: %u", mute);
+		break;
+	default:
+		print_field("    Unknown Mute Value: %u", mute);
+		break;
+	}
+
+	if (!l2cap_frame_get_u8((void *)frame, &chng_ctr)) {
+		print_text(COLOR_ERROR, "Change Counter: invalid size");
+		goto done;
+	}
+	print_field("    Change Counter: %u", chng_ctr);
+
+done:
+	if (frame->size)
+		print_hex_field("  Data", frame->data, frame->size);
+}
+
+static void vol_state_read(const struct l2cap_frame *frame)
+{
+	print_vcs_state(frame);
+}
+
+static void vol_state_notify(const struct l2cap_frame *frame)
+{
+	print_vcs_state(frame);
+}
+
+static bool vcs_config_cmd(const struct l2cap_frame *frame)
+{
+	if (!l2cap_frame_print_u8((void *)frame, "    Change Counter"))
+		return false;
+
+	return true;
+}
+
+static bool vcs_absolute_cmd(const struct l2cap_frame *frame)
+{
+	if (!l2cap_frame_print_u8((void *)frame, "    Change Counter"))
+		return false;
+
+	if (!l2cap_frame_print_u8((void *)frame, "    Volume Setting"))
+		return false;
+
+	return true;
+}
+
+#define ASE_CMD(_op, _desc, _func) \
+[_op] = { \
+	.desc = _desc, \
+	.func = _func, \
+}
+
+struct vcs_cmd {
+	const char *desc;
+	bool (*func)(const struct l2cap_frame *frame);
+} vcs_cmd_table[] = {
+	/* Opcode = 0x00 (Relative Volume Down) */
+	ASE_CMD(0x00, "Relative Volume Down", vcs_config_cmd),
+	/* Opcode = 0x01 (Relative Volume Up) */
+	ASE_CMD(0x01, "Relative Volume Up", vcs_config_cmd),
+	/* Opcode = 0x02 (Unmute/Relative Volume Down) */
+	ASE_CMD(0x02, "Unmute/Relative Volume Down", vcs_config_cmd),
+	/* Opcode = 0x03 (Unmute/Relative Volume Up) */
+	ASE_CMD(0x03, "Unmute/Relative Volume Up", vcs_config_cmd),
+	/* Opcode = 0x04 (Set Absolute Volume) */
+	ASE_CMD(0x04, "Set Absolute Volume", vcs_absolute_cmd),
+	/* Opcode = 0x05 (Unmute) */
+	ASE_CMD(0x05, "Unmute", vcs_config_cmd),
+	/* Opcode = 0x06 (Mute) */
+	ASE_CMD(0x06, "Mute", vcs_config_cmd),
+};
+
+static struct vcs_cmd *vcs_get_cmd(uint8_t op)
+{
+	if (op > ARRAY_SIZE(vcs_cmd_table))
+		return NULL;
+
+	return &vcs_cmd_table[op];
+}
+
+static void print_vcs_cmd(const struct l2cap_frame *frame)
+{
+	uint8_t op;
+	struct vcs_cmd *cmd;
+
+	if (!l2cap_frame_get_u8((void *)frame, &op)) {
+		print_text(COLOR_ERROR, "opcode: invalid size");
+		goto done;
+	}
+
+	cmd = vcs_get_cmd(op);
+	if (!cmd) {
+		print_field("    Opcode: Reserved (0x%2.2x)", op);
+		goto done;
+	}
+
+	print_field("    Opcode: %s (0x%2.2x)", cmd->desc, op);
+	if (!cmd->func(frame))
+		print_field("    Unknown Opcode");
+
+done:
+	if (frame->size)
+		print_hex_field("  Data", frame->data, frame->size);
+}
+
+static void vol_cp_write(const struct l2cap_frame *frame)
+{
+	print_vcs_cmd(frame);
+}
+
+static void print_vcs_flag(const struct l2cap_frame *frame)
+{
+	uint8_t vol_flag;
+
+	if (!l2cap_frame_get_u8((void *)frame, &vol_flag)) {
+		print_text(COLOR_ERROR, "Volume Flag: invalid size");
+		goto done;
+	}
+	print_field("    Volume Falg: %u", vol_flag);
+
+done:
+	if (frame->size)
+		print_hex_field("  Data", frame->data, frame->size);
+}
+
+static void vol_flag_read(const struct l2cap_frame *frame)
+{
+	print_vcs_flag(frame);
+}
+
+static void vol_flag_notify(const struct l2cap_frame *frame)
+{
+	print_vcs_flag(frame);
+}
+
 #define GATT_HANDLER(_uuid, _read, _write, _notify) \
 { \
 	.uuid = { \
@@ -1617,6 +1773,9 @@ struct gatt_handler {
 	GATT_HANDLER(0x2bcc, pac_loc_read, NULL, pac_loc_notify),
 	GATT_HANDLER(0x2bcd, pac_context_read, NULL, pac_context_notify),
 	GATT_HANDLER(0x2bce, pac_context_read, NULL, pac_context_notify),
+	GATT_HANDLER(0x2b7d, vol_state_read, NULL, vol_state_notify),
+	GATT_HANDLER(0x2b7e, NULL, vol_cp_write, NULL),
+	GATT_HANDLER(0x2b7f, vol_flag_read, NULL, vol_flag_notify),
 };
 
 static struct gatt_handler *get_handler(struct gatt_db_attribute *attr)
Signature · 1 line
2.25.1
#8 lore raw
In reply to Sathish Narasimman
This series was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:

Hello:

This series was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:

Quoted 10 lines · On Mon, 12 Sep 2022 18:16:53 +0530 you wrote:

Initial Development of Volment Control profile and its service Volume Control Service.

Sathish Narasimman (4):
lib/uuid: Add VCS UUIDs
shared/vcp: Add initial code for handling VCP
profiles: Add initial code for vcp plugin monitor/att: Add decoding support for Volume Control Serice

[...]

Here is the summary with links:
- [BlueZ,1/4] lib/uuid: Add VCS UUIDs

    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=af1bfbb470c0

- [BlueZ,2/4] shared/vcp: Add initial code for handling VCP (no matching commit)
- [BlueZ,3/4] profiles: Add initial code for vcp plugin
(no matching commit)
- [BlueZ,4/4] monitor/att: Add decoding support for Volume Control Serice (no matching commit)

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html