Code handling for VOCS service
Subsystems (2)
v2 cover Code handling for VOCS service
Hello Maintainers
This patch series handles code implementation for mandatory features of Volume Offset Control Service.
Implementation of following features have been handled in this patch series
- Volume Offset Control Service
- Volume Offset State Characteristic (Read, Notify)
- Audio Location Characteristic (Read)
- Volume Offset Control Point Characteristic (Write)
- Audio Output Description Characteristic (Read)
- Set Volume Offset
All the code implementation has been tested using PTS testing the verdict is PASS for all mandatory test cases.
Thank you in advance for your review.
Warm Regards
Nitin Jadhav
Nitin Jadhav (2):
Added initial code for handling VOCS
Fixed the following issue observed during PTS testing for mandatory
test cases - Specified Upper and Lower Limit for Volume offset - Corrected the number of handles for VOCS - VOCS is made as included service of VCS because VOCS is secondary service and VSC is primary service
lib/uuid.h | 5 + src/shared/vcp.c | 552 ++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 555 insertions(+), 2 deletions(-)
Signature · 1 line
2.34.1
PATCH v2 1/2 Added initial code for handling VOCS
This adds implementation for VOCS service and characteristics
---
v2: Corrected prefixs and cosmetic changes (Luiz Augusto von Dentz)
--- lib/uuid.h | 5 + src/shared/vcp.c | 537 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 542 insertions(+)
lib/uuid.h +5 -0
@@ -179,6 +179,11 @@ extern "C" {#define VOL_CP_CHRC_UUID 0x2B7E#define VOL_FLAG_CHRC_UUID 0x2B7F +#define VOCS_STATE_CHAR_UUID 0x2B80 +#define VOCS_AUDIO_LOC_CHRC_UUID 0x2B81 +#define VOCS_CP_CHRC_UUID 0x2B82 +#define VOCS_AUDIO_OP_DESC_CHAR_UUID 0x2B83 +#define GMCS_UUID 0x1849#define MEDIA_PLAYER_NAME_CHRC_UUID 0x2b93#define MEDIA_TRACK_CHNGD_CHRC_UUID 0x2b96
src/shared/vcp.c +537 -0
665 lines not on this page · raw message
Signature · 1 line
2.34.1
Re: [PATCH BlueZ v2 1/2] Added initial code for handling VOCS
Dear Nitin,
Thank you for your patch.
Am 07.06.23 um 14:13 schrieb Nitin Jadhav:
It’d be great if you used imperative mood in the commit message summary/title. Maybe:
Add initial VOCS code
Quoted 1 line
This adds implementation for VOCS service and characteristics
Please document the datasheet name and version, you used to write the code.
If you summarized the implementation, and also documented how you tested this, that’d be great.
Quoted 6 lines
---
v2: Corrected prefixs and cosmetic changes (Luiz Augusto von Dentz)--- lib/uuid.h | 5 + src/shared/vcp.c | 537 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 542 insertions(+)
[…]
Kind regards,
Paul
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=754867
---Test result---
Test Summary:
CheckPatch FAIL 1.74 seconds GitLint PASS 0.72 seconds BuildEll PASS 27.11 seconds BluezMake PASS 863.57 seconds MakeCheck PASS 12.34 seconds MakeDistcheck PASS 154.02 seconds CheckValgrind PASS 255.60 seconds CheckSmatch PASS 340.33 seconds bluezmakeextell PASS 102.67 seconds IncrementalBuild PASS 1417.56 seconds ScanBuild WARNING 1055.29 seconds
Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script
Output:
[BlueZ,v2,1/2] Added initial code for handling VOCS WARNING:LONG_LINE: line length of 93 exceeds 80 columns #596: FILE: src/shared/vcp.c:1268:
+ uint16_t value_handle, const uint8_t *value, uint16_t length,
WARNING:LONG_LINE: line length of 89 exceeds 80 columns #614: FILE: src/shared/vcp.c:1340:
+ uint8_t att_ecode, const uint8_t *value, uint16_t length,
WARNING:LONG_LINE: line length of 85 exceeds 80 columns #624: FILE: src/shared/vcp.c:1350:
+ DBG(vcp, "Unable to read Vol Offset State: error 0x%02x", att_ecode);
WARNING:LONG_LINE: line length of 89 exceeds 80 columns #639: FILE: src/shared/vcp.c:1365:
+ uint8_t att_ecode, const uint8_t *value, uint16_t length,
WARNING:LONG_LINE: line length of 88 exceeds 80 columns #649: FILE: src/shared/vcp.c:1375:
+ DBG(vcp, "Unable to read VOCS Audio Location: error 0x%02x", att_ecode);
WARNING:LONG_LINE: line length of 89 exceeds 80 columns #664: FILE: src/shared/vcp.c:1390:
+ uint8_t att_ecode, const uint8_t *value, uint16_t length,
WARNING:LONG_LINE: line length of 85 exceeds 80 columns #724: FILE: src/shared/vcp.c:1599:
+ vcp_voffset_state_notify, NULL);
WARNING:LONG_LINE: line length of 81 exceeds 80 columns #739: FILE: src/shared/vcp.c:1614:
+ vcp_read_value(vcp, value_handle, read_vocs_audio_location, vcp);
WARNING:LONG_LINE: line length of 81 exceeds 80 columns #742: FILE: src/shared/vcp.c:1617:
+ vcp_audio_loc_notify, NULL);
WARNING:LONG_LINE: line length of 83 exceeds 80 columns #769: FILE: src/shared/vcp.c:1644:
+ vcp_read_value(vcp, value_handle, read_vocs_audio_descriptor, vcp);
WARNING:LONG_LINE: line length of 87 exceeds 80 columns #771: FILE: src/shared/vcp.c:1646:
+ vcp_audio_descriptor_notify, NULL);
/github/workspace/src/src/13270609.patch total: 0 errors, 11 warnings, 676 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/src/13270609.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: ScanBuild - WARNING
Desc: Run Scan Build
Output:src/shared/vcp.c:1272:2: warning: Null pointer passed to 1st parameter expecting 'nonnull'
memcpy(vocs_audio_loc_n, value, sizeof(uint32_t));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~1 warning generated.
---
Regards,
Linux Bluetooth
PATCH v2 2/2 Make VOCS (Secondary) as an included service of VCS (Primary)
In reply to Nitin JadhavFixed the following issue observed during PTS testing
- Specified Upper and Lower Limit for Volume offset
- Corrected the number of handles for VOCS
- VOCS is made as included service of VCS
(VOCS is secondary service and VSC is primary service)
---
v2: Cosmetic Changes (Bluez Test Bot)
--- src/shared/vcp.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-)
src/shared/vcp.c +18 -7
@@ -32,9 +32,13 @@#define VCP_STEP_SIZE 1 +#define VOCS_VOL_OFFSET_UPPER_LIMIT 255 +#define VOCS_VOL_OFFSET_LOWER_LIMIT -255 +/* Apllication Error Code */ #define BT_ATT_ERROR_INVALID_CHANGE_COUNTER 0x80#define BT_ATT_ERROR_OPCODE_NOT_SUPPORTED 0x81 +#define BT_ATT_ERROR_VALUE_OUT_OF_RANGE 0x82#define BT_VCP_NA 0x00000000#define BT_VCP_FRONT_LEFT 0x00000001
@@ -100,7 +104,7 @@ struct bt_vcs_ab_vol {struct bt_vocs_set_vol_off {uint8_t change_counter; -uint8_t set_vol_offset; +int16_t set_vol_offset; } __packed;struct bt_vcp_cb {
@@ -167,7 +171,7 @@ struct bt_vcs {/* Contains local bt_vcp_db */ struct vol_offset_state { -uint16_t vol_offset; +int16_t vol_offset;uint8_t counter; } __packed;
@@ -705,6 +709,11 @@ static uint8_t vocs_set_vol_offset(struct bt_vocs *vocs, struct bt_vcp *vcp,return BT_ATT_ERROR_INVALID_CHANGE_COUNTER ; } +if (req->set_vol_offset >VOCS_VOL_OFFSET_UPPER_LIMIT || + req->set_vol_offset <VOCS_VOL_OFFSET_LOWER_LIMIT ) { +DBG (vcp,"error: Value Out of Range" ); +return BT_ATT_ERROR_VALUE_OUT_OF_RANGE ; + } vstate->vol_offset = req->set_vol_offset; vstate->counter = -~vstate->counter;/*Increment Change Counter*/
@@ -971,7 +980,7 @@ static void vocs_voaodec_read(struct gatt_db_attribute *attrib, iov.iov_len); } -static struct bt_vcs *vcs_new (struct gatt_db *db) +static struct bt_vcs *vcs_new (struct gatt_db *db,struct bt_vcp_db *vdb) {struct bt_vcs *vcs;struct vol_state *vstate;
@@ -990,6 +999,8 @@ static struct bt_vcs *vcs_new(struct gatt_db *db)/* Populate DB with VCS attributes */ bt_uuid16_create (&uuid,VCS_UUID ); vcs->service =gatt_db_add_service (db, &uuid, true,9 ); +gatt_db_service_add_included (vcs->service, vdb->vocs->service); +gatt_db_service_set_active (vdb->vocs->service, true);bt_uuid16_create (&uuid,VOL_STATE_CHRC_UUID ); vcs->vs = gatt_db_service_add_characteristic(vcs->service,
@@ -1048,7 +1059,8 @@ static struct bt_vocs *vocs_new(struct gatt_db *db)/* Populate DB with VOCS attributes */ bt_uuid16_create (&uuid,VOL_OFFSET_CS_UUID ); - vocs->service =gatt_db_add_service (db, &uuid, true,9 ); + + vocs->service =gatt_db_add_service (db, &uuid, false,12 );bt_uuid16_create (&uuid,VOCS_STATE_CHAR_UUID ); vocs->vos = gatt_db_service_add_characteristic(vocs->service,
@@ -1110,11 +1122,10 @@ static struct bt_vcp_db *vcp_db_new(struct gatt_db *db)if (!vcp_db) vcp_db =queue_new (); - vdb->vcs =vcs_new (db); - vdb->vcs->vdb = vdb; - vdb->vocs =vocs_new (db); vdb->vocs->vdb = vdb; + vdb->vcs =vcs_new (db, vdb); + vdb->vcs->vdb = vdb;queue_push_tail (vcp_db, vdb);
Signature · 1 line
2.34.1